UNPKG

1.46 MBJavaScriptView Raw
1(function webpackUniversalModuleDefinition(root, factory) {
2 if(typeof exports === 'object' && typeof module === 'object')
3 module.exports = factory();
4 else if(typeof define === 'function' && define.amd)
5 define([], factory);
6 else if(typeof exports === 'object')
7 exports["G2_3"] = factory();
8 else
9 root["G2_3"] = factory();
10})(typeof self !== 'undefined' ? self : this, function() {
11return /******/ (function(modules) { // webpackBootstrap
12/******/ // The module cache
13/******/ var installedModules = {};
14/******/
15/******/ // The require function
16/******/ function __webpack_require__(moduleId) {
17/******/
18/******/ // Check if module is in cache
19/******/ if(installedModules[moduleId]) {
20/******/ return installedModules[moduleId].exports;
21/******/ }
22/******/ // Create a new module (and put it into the cache)
23/******/ var module = installedModules[moduleId] = {
24/******/ i: moduleId,
25/******/ l: false,
26/******/ exports: {}
27/******/ };
28/******/
29/******/ // Execute the module function
30/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
31/******/
32/******/ // Flag the module as loaded
33/******/ module.l = true;
34/******/
35/******/ // Return the exports of the module
36/******/ return module.exports;
37/******/ }
38/******/
39/******/
40/******/ // expose the modules object (__webpack_modules__)
41/******/ __webpack_require__.m = modules;
42/******/
43/******/ // expose the module cache
44/******/ __webpack_require__.c = installedModules;
45/******/
46/******/ // define getter function for harmony exports
47/******/ __webpack_require__.d = function(exports, name, getter) {
48/******/ if(!__webpack_require__.o(exports, name)) {
49/******/ Object.defineProperty(exports, name, {
50/******/ configurable: false,
51/******/ enumerable: true,
52/******/ get: getter
53/******/ });
54/******/ }
55/******/ };
56/******/
57/******/ // getDefaultExport function for compatibility with non-harmony modules
58/******/ __webpack_require__.n = function(module) {
59/******/ var getter = module && module.__esModule ?
60/******/ function getDefault() { return module['default']; } :
61/******/ function getModuleExports() { return module; };
62/******/ __webpack_require__.d(getter, 'a', getter);
63/******/ return getter;
64/******/ };
65/******/
66/******/ // Object.prototype.hasOwnProperty.call
67/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
68/******/
69/******/ // __webpack_public_path__
70/******/ __webpack_require__.p = "";
71/******/
72/******/ // Load entry module and return exports
73/******/ return __webpack_require__(__webpack_require__.s = 126);
74/******/ })
75/************************************************************************/
76/******/ ([
77/* 0 */
78/***/ (function(module, exports, __webpack_require__) {
79
80/**
81 * @fileOverview The util method based on the lodash.
82 * @author dxq613@gmail.com
83 * @see https://github.com/lodash/lodash
84 */
85
86var MAX_LEVEL = 5;
87
88function _mix(dist, obj) {
89 for (var k in obj) {
90 if (obj.hasOwnProperty(k) && k !== 'constructor' && obj[k] !== undefined) {
91 dist[k] = obj[k];
92 }
93 }
94}
95
96var Util = {
97 each: __webpack_require__(127),
98 map: __webpack_require__(142),
99 isObject: __webpack_require__(7),
100 isNumber: __webpack_require__(193),
101 isString: __webpack_require__(89),
102 isFunction: __webpack_require__(48),
103 isFinite: __webpack_require__(194),
104 isBoolean: __webpack_require__(195),
105 isEmpty: __webpack_require__(196),
106 lowerFirst: __webpack_require__(197),
107 upperFirst: __webpack_require__(202),
108 upperCase: __webpack_require__(203),
109 isNil: __webpack_require__(93),
110 isNull: __webpack_require__(212),
111 isArray: __webpack_require__(3),
112 isDate: __webpack_require__(213),
113 isPlainObject: __webpack_require__(215),
114 toArray: __webpack_require__(216),
115 indexOf: __webpack_require__(220),
116 assign: __webpack_require__(60),
117 groupBy: __webpack_require__(231),
118 cloneDeep: __webpack_require__(102),
119 maxBy: __webpack_require__(256),
120 minBy: __webpack_require__(258),
121 round: __webpack_require__(260),
122 filter: __webpack_require__(262),
123 isEqualWith: __webpack_require__(264),
124 isEqual: __webpack_require__(265),
125 replace: __webpack_require__(266),
126 union: __webpack_require__(267),
127 pick: __webpack_require__(274),
128 uniq: __webpack_require__(280),
129 snapEqual: function snapEqual(v1, v2) {
130 return Math.abs(v1 - v2) < 0.001;
131 },
132 fixedBase: function fixedBase(v, base) {
133 var str = base.toString();
134 var index = str.indexOf('.');
135 if (index === -1) {
136 return Math.round(v);
137 }
138 var length = str.substr(index + 1).length;
139 if (length > 20) {
140 length = 20;
141 }
142 return parseFloat(v.toFixed(length));
143 },
144 mix: function mix(dist, obj1, obj2, obj3) {
145 if (obj1) {
146 _mix(dist, obj1);
147 }
148
149 if (obj2) {
150 _mix(dist, obj2);
151 }
152
153 if (obj3) {
154 _mix(dist, obj3);
155 }
156 return dist;
157 },
158 inArray: function inArray(arr, value) {
159 return arr.indexOf(value) >= 0;
160 },
161
162 /**
163 * 封装事件,便于使用上下文this,和便于解除事件时使用
164 * @protected
165 * @param {Object} obj 对象
166 * @param {String} action 事件名称
167 * @return {Function} 返回事件处理函数
168 */
169 wrapBehavior: function wrapBehavior(obj, action) {
170 if (obj['_wrap_' + action]) {
171 return obj['_wrap_' + action];
172 }
173 var method = function method(e) {
174 obj[action](e);
175 };
176 obj['_wrap_' + action] = method;
177 return method;
178 },
179
180 /**
181 * 获取封装的事件
182 * @protected
183 * @param {Object} obj 对象
184 * @param {String} action 事件名称
185 * @return {Function} 返回事件处理函数
186 */
187 getWrapBehavior: function getWrapBehavior(obj, action) {
188 return obj['_wrap_' + action];
189 },
190
191 /**
192 * 将用户输入的 padding 转换成 [top, right, bottom, right] 的模式
193 * @param {Number|Array} padding 输入的padding
194 * @return {Array} 四个padding 值
195 */
196 toAllPadding: function toAllPadding(padding) {
197 var top = 0;
198 var left = 0;
199 var right = 0;
200 var bottom = 0;
201
202 if (Util.isNumber(padding) || Util.isString(padding)) {
203 top = left = right = bottom = padding;
204 } else if (Util.isArray(padding)) {
205 top = padding[0];
206 right = !Util.isNil(padding[1]) ? padding[1] : padding[0];
207 bottom = !Util.isNil(padding[2]) ? padding[2] : padding[0];
208 left = !Util.isNil(padding[3]) ? padding[3] : right;
209 } else if (Util.isObject(padding)) {
210 top = padding.top || 0;
211 right = padding.right || 0;
212 bottom = padding.bottom || 0;
213 left = padding.left || 0;
214 }
215 return [top, right, bottom, left];
216 },
217
218 /**
219 * 替换字符串中的字段.
220 * @param {String} str 模版字符串
221 * @param {Object} o json data
222 * @return {String} 替换后的字符串
223 */
224 substitute: function substitute(str, o) {
225 if (!str || !o) {
226 return str;
227 }
228 return str.replace(/\\?\{([^{}]+)\}/g, function (match, name) {
229 if (match.charAt(0) === '\\') {
230 return match.slice(1);
231 }
232 return o[name] === undefined ? '' : o[name];
233 });
234 }
235};
236
237function deepMix(dst, src, level) {
238 level = level || 0;
239 for (var k in src) {
240 if (src.hasOwnProperty(k)) {
241 var value = src[k];
242 if (value !== null && Util.isPlainObject(value)) {
243 if (!Util.isPlainObject(dst[k])) {
244 dst[k] = {};
245 }
246 if (level < MAX_LEVEL) {
247 deepMix(dst[k], src[k], level + 1);
248 } else {
249 dst[k] = src[k];
250 }
251 } else if (Util.isArray(value)) {
252 dst[k] = [];
253 dst[k] = dst[k].concat(value);
254 } else if (value !== undefined) {
255 dst[k] = src[k];
256 }
257 }
258 }
259}
260
261Util.deepMix = function () {
262 var args = Util.toArray(arguments);
263 var rst = args[0];
264 for (var i = 1; i < args.length; i++) {
265 var source = args[i];
266 deepMix(rst, source);
267 }
268 return rst;
269};
270
271Util.Array = {
272 merge: function merge(dataArray) {
273 var rst = [];
274 for (var i = 0; i < dataArray.length; i++) {
275 rst = rst.concat(dataArray[i]);
276 }
277 return rst;
278 },
279 values: function values(data, name) {
280 var rst = [];
281 var tmpMap = {};
282 for (var i = 0; i < data.length; i++) {
283 var obj = data[i];
284 var value = obj[name];
285 if (!Util.isNil(value)) {
286 if (!Util.isArray(value)) {
287 value = [value];
288 }
289 Util.each(value, function (val) {
290 if (!tmpMap[val]) {
291 rst.push(val);
292 tmpMap[val] = true;
293 }
294 });
295 }
296 }
297 return rst;
298 },
299 getRange: function getRange(values) {
300 if (!values.length) {
301 // 如果没有数值则直接返回0
302 return {
303 min: 0,
304 max: 0
305 };
306 }
307 if (Util.isArray(values[0])) {
308 var tmp = [];
309 for (var i = 0; i < values.length; i++) {
310 tmp = tmp.concat(values[i]);
311 }
312 values = tmp;
313 }
314 var max = Math.max.apply(null, values);
315 var min = Math.min.apply(null, values);
316 return {
317 min: min,
318 max: max
319 };
320 },
321 firstValue: function firstValue(data, name) {
322 var rst = null;
323 for (var i = 0; i < data.length; i++) {
324 var obj = data[i];
325 var value = obj[name];
326 if (!Util.isNil(value)) {
327 if (Util.isArray(value)) {
328 rst = value[0];
329 } else {
330 rst = value;
331 }
332 break;
333 }
334 }
335 return rst;
336 },
337 group: function group(data, condition) {
338 if (!condition) {
339 return [data];
340 }
341 var groups = Util.Array.groupToMap(data, condition);
342 var array = [];
343 for (var i in groups) {
344 array.push(groups[i]);
345 }
346 return array;
347 },
348 groupToMap: function groupToMap(data, condition) {
349 if (!condition) {
350 return {
351 0: data
352 };
353 }
354 if (!Util.isFunction(condition)) {
355 var paramsCondition = Util.isArray(condition) ? condition : condition.replace(/\s+/g, '').split('*');
356 condition = function condition(row) {
357 var unique = '_'; // 避免出现数字作为Key的情况,会进行按照数字的排序
358 for (var i = 0, l = paramsCondition.length; i < l; i++) {
359 unique += row[paramsCondition[i]] && row[paramsCondition[i]].toString();
360 }
361 return unique;
362 };
363 }
364 var groups = Util.groupBy(data, condition);
365 return groups;
366 },
367 remove: function remove(arr, obj) {
368 var index = Util.indexOf(arr, obj);
369 if (index !== -1) {
370 arr.splice(index, 1);
371 }
372 }
373};
374
375module.exports = Util;
376
377/***/ }),
378/* 1 */
379/***/ (function(module, exports, __webpack_require__) {
380
381/**
382 * @fileOverview 全局变量
383 * @author dxq613
384 */
385var Util = __webpack_require__(0);
386var Theme = __webpack_require__(292);
387
388var Global = {};
389var Default = {
390 version: '3.0.2-beta.1',
391 trackable: true,
392 animate: true,
393 snapArray: [0, 1, 2, 4, 5, 10],
394 // 指定固定 tick 数的逼近值
395 snapCountArray: [0, 1, 1.2, 1.5, 1.6, 2, 2.2, 2.4, 3, 4, 5, 6, 7.5, 8, 10],
396 widthRatio: { // 宽度所占的分类的比例
397 column: 1 / 2, // 一般的柱状图占比 1/2
398 rose: 0.9999999, // 玫瑰图柱状占比 1
399 multiplePie: 1 / 1.3 // 多层的饼图、环图
400 },
401 // 折线图、区域图、path 当只有一个数据时,是否显示成点
402 showSinglePoint: false,
403 connectNulls: false,
404 scales: {}
405};
406
407function setTheme(theme) {
408 for (var k in Global) {
409 if (Global.hasOwnProperty(k)) {
410 delete Global[k];
411 }
412 }
413
414 var newTheme = {};
415 if (Util.isObject(theme)) {
416 newTheme = theme;
417 } else if (Util.indexOf(Object.keys(Theme), theme) !== -1) {
418 newTheme = Theme[theme];
419 } else {
420 newTheme = Theme.default;
421 }
422 Util.deepMix(Global, Default, newTheme);
423 Global.setTheme = setTheme;
424}
425
426setTheme('default');
427
428module.exports = Global;
429
430/***/ }),
431/* 2 */
432/***/ (function(module, exports, __webpack_require__) {
433
434/* WEBPACK VAR INJECTION */(function(module) {var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
435
436(function webpackUniversalModuleDefinition(root, factory) {
437 if (( false ? 'undefined' : _typeof2(exports)) === 'object' && ( false ? 'undefined' : _typeof2(module)) === 'object') module.exports = factory();else if (true) !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
438 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
439 (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
440 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));else if ((typeof exports === 'undefined' ? 'undefined' : _typeof2(exports)) === 'object') exports["G"] = factory();else root["G"] = factory();
441})(this, function () {
442 return (/******/function (modules) {
443 // webpackBootstrap
444 /******/ // The module cache
445 /******/var installedModules = {};
446 /******/
447 /******/ // The require function
448 /******/function __webpack_require__(moduleId) {
449 /******/
450 /******/ // Check if module is in cache
451 /******/if (installedModules[moduleId]) {
452 /******/return installedModules[moduleId].exports;
453 /******/
454 }
455 /******/ // Create a new module (and put it into the cache)
456 /******/var module = installedModules[moduleId] = {
457 /******/i: moduleId,
458 /******/l: false,
459 /******/exports: {}
460 /******/ };
461 /******/
462 /******/ // Execute the module function
463 /******/modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
464 /******/
465 /******/ // Flag the module as loaded
466 /******/module.l = true;
467 /******/
468 /******/ // Return the exports of the module
469 /******/return module.exports;
470 /******/
471 }
472 /******/
473 /******/
474 /******/ // expose the modules object (__webpack_modules__)
475 /******/__webpack_require__.m = modules;
476 /******/
477 /******/ // expose the module cache
478 /******/__webpack_require__.c = installedModules;
479 /******/
480 /******/ // define getter function for harmony exports
481 /******/__webpack_require__.d = function (exports, name, getter) {
482 /******/if (!__webpack_require__.o(exports, name)) {
483 /******/Object.defineProperty(exports, name, {
484 /******/configurable: false,
485 /******/enumerable: true,
486 /******/get: getter
487 /******/ });
488 /******/
489 }
490 /******/
491 };
492 /******/
493 /******/ // getDefaultExport function for compatibility with non-harmony modules
494 /******/__webpack_require__.n = function (module) {
495 /******/var getter = module && module.__esModule ?
496 /******/function getDefault() {
497 return module['default'];
498 } :
499 /******/function getModuleExports() {
500 return module;
501 };
502 /******/__webpack_require__.d(getter, 'a', getter);
503 /******/return getter;
504 /******/
505 };
506 /******/
507 /******/ // Object.prototype.hasOwnProperty.call
508 /******/__webpack_require__.o = function (object, property) {
509 return Object.prototype.hasOwnProperty.call(object, property);
510 };
511 /******/
512 /******/ // __webpack_public_path__
513 /******/__webpack_require__.p = "";
514 /******/
515 /******/ // Load entry module and return exports
516 /******/return __webpack_require__(__webpack_require__.s = 112);
517 /******/
518 }(
519 /************************************************************************/
520 /******/[
521 /* 0 */
522 /***/function (module, exports, __webpack_require__) {
523
524 var CommonUtil = __webpack_require__(31);
525 var DomUtil = __webpack_require__(85);
526
527 var Util = {};
528
529 CommonUtil.merge(Util, CommonUtil, DomUtil, {
530 mixin: function mixin(c, mixins) {
531 var Param = c.CFG ? 'CFG' : 'ATTRS';
532 if (c && mixins) {
533 c._mixins = mixins;
534 c[Param] = c[Param] || {};
535 var temp = {};
536 Util.each(mixins, function (mixin) {
537 Util.augment(c, mixin);
538 var attrs = mixin[Param];
539 if (attrs) {
540 Util.merge(temp, attrs);
541 }
542 });
543 c[Param] = Util.merge(temp, c[Param]);
544 }
545 }
546 });
547
548 module.exports = Util;
549
550 /***/
551 },
552 /* 1 */
553 /***/function (module, exports, __webpack_require__) {
554
555 var Util = __webpack_require__(0);
556 var Element = __webpack_require__(88);
557 var Inside = __webpack_require__(2);
558
559 var Shape = function Shape(cfg) {
560 Shape.superclass.constructor.call(this, cfg);
561 };
562
563 Shape.ATTRS = {};
564
565 Util.extend(Shape, Element);
566
567 Util.augment(Shape, {
568 isShape: true,
569 createPath: function createPath() {},
570 drawInner: function drawInner(context) {
571 var self = this;
572 var attrs = self.__attrs;
573 self.createPath(context);
574 var originOpacity = context.globalAlpha;
575 if (self.hasFill()) {
576 var fillOpacity = attrs.fillOpacity;
577 if (!Util.isNil(fillOpacity) && fillOpacity !== 1) {
578 context.globalAlpha = fillOpacity;
579 context.fill();
580 context.globalAlpha = originOpacity;
581 } else {
582 context.fill();
583 }
584 }
585 if (self.hasStroke()) {
586 var lineWidth = self.__attrs.lineWidth;
587 if (lineWidth > 0) {
588 var strokeOpacity = attrs.strokeOpacity;
589 if (!Util.isNil(strokeOpacity) && strokeOpacity !== 1) {
590 context.globalAlpha = strokeOpacity;
591 }
592 context.stroke();
593 }
594 }
595 },
596
597 /**
598 * 节点是否在图形中
599 * @param {Number} x x 坐标
600 * @param {Number} y y 坐标
601 * @return {Boolean} 是否在图形中
602 */
603 isPointInPath: function isPointInPath() {
604 return false;
605 },
606
607 /**
608 * 击中图形时是否进行包围盒判断
609 * @return {Boolean} [description]
610 */
611 isHitBox: function isHitBox() {
612 return true;
613 },
614
615 /**
616 * 节点是否能够被击中
617 * @param {Number} x x坐标
618 * @param {Number} y y坐标
619 * @return {Boolean} 是否在图形中
620 */
621 isHit: function isHit(x, y) {
622 var self = this;
623 var v = [x, y, 1];
624 self.invert(v); // canvas
625
626 if (self.isHitBox()) {
627 var box = self.getBBox();
628 if (box && !Inside.box(box.minX, box.maxX, box.minY, box.maxY, v[0], v[1])) {
629 return false;
630 }
631 }
632 var clip = self.__attrs.clip;
633 if (clip) {
634 if (clip.inside(x, y)) {
635 return self.isPointInPath(v[0], v[1]);
636 }
637 } else {
638 return self.isPointInPath(v[0], v[1]);
639 }
640 return false;
641 },
642
643 /**
644 * @protected
645 * 计算包围盒
646 * @return {Object} 包围盒
647 */
648 calculateBox: function calculateBox() {
649 return null;
650 },
651
652 // 清除当前的矩阵
653 clearTotalMatrix: function clearTotalMatrix() {
654 this.__cfg.totalMatrix = null;
655 this.__cfg.region = null;
656 },
657 clearBBox: function clearBBox() {
658 this.__cfg.box = null;
659 this.__cfg.region = null;
660 },
661 getBBox: function getBBox() {
662 var box = this.__cfg.box;
663 // 延迟计算
664 if (!box) {
665 box = this.calculateBox();
666 if (box) {
667 box.x = box.minX;
668 box.y = box.minY;
669 box.width = box.maxX - box.minX;
670 box.height = box.maxY - box.minY;
671 }
672 this.__cfg.box = box;
673 }
674 return box;
675 }
676 });
677
678 module.exports = Shape;
679
680 /***/
681 },
682 /* 2 */
683 /***/function (module, exports, __webpack_require__) {
684
685 var Line = __webpack_require__(52);
686 var Quadratic = __webpack_require__(53);
687 var Cubic = __webpack_require__(30);
688 var Arc = __webpack_require__(54);
689
690 module.exports = {
691 line: function line(x1, y1, x2, y2, lineWidth, x, y) {
692 var box = Line.box(x1, y1, x2, y2, lineWidth);
693
694 if (!this.box(box.minX, box.maxX, box.minY, box.maxY, x, y)) {
695 return false;
696 }
697
698 var d = Line.pointDistance(x1, y1, x2, y2, x, y);
699 if (isNaN(d)) {
700 return false;
701 }
702 return d <= lineWidth / 2;
703 },
704 polyline: function polyline(points, lineWidth, x, y) {
705 var l = points.length - 1;
706 if (l < 1) {
707 return false;
708 }
709 for (var i = 0; i < l; i++) {
710 var x1 = points[i][0];
711 var y1 = points[i][1];
712 var x2 = points[i + 1][0];
713 var y2 = points[i + 1][1];
714
715 if (this.line(x1, y1, x2, y2, lineWidth, x, y)) {
716 return true;
717 }
718 }
719
720 return false;
721 },
722 cubicline: function cubicline(x1, y1, x2, y2, x3, y3, x4, y4, lineWidth, x, y) {
723 return Cubic.pointDistance(x1, y1, x2, y2, x3, y3, x4, y4, x, y) <= lineWidth / 2;
724 },
725 quadraticline: function quadraticline(x1, y1, x2, y2, x3, y3, lineWidth, x, y) {
726 return Quadratic.pointDistance(x1, y1, x2, y2, x3, y3, x, y) <= lineWidth / 2;
727 },
728 arcline: function arcline(cx, cy, r, startAngle, endAngle, clockwise, lineWidth, x, y) {
729 return Arc.pointDistance(cx, cy, r, startAngle, endAngle, clockwise, x, y) <= lineWidth / 2;
730 },
731 rect: function rect(rx, ry, width, height, x, y) {
732 return rx <= x && x <= rx + width && ry <= y && y <= ry + height;
733 },
734 circle: function circle(cx, cy, r, x, y) {
735 return Math.pow(x - cx, 2) + Math.pow(y - cy, 2) <= Math.pow(r, 2);
736 },
737 box: function box(minX, maxX, minY, maxY, x, y) {
738 return minX <= x && x <= maxX && minY <= y && y <= maxY;
739 }
740 };
741
742 /***/
743 },
744 /* 3 */
745 /***/function (module, exports, __webpack_require__) {
746
747 var CommonUtil = __webpack_require__(31);
748 var mat3 = __webpack_require__(230);
749 var vec3 = __webpack_require__(231);
750 var vec2 = __webpack_require__(232);
751
752 vec2.angle = function (v1, v2) {
753 var theta = vec2.dot(v1, v2) / (vec2.length(v1) * vec2.length(v2));
754 return Math.acos(CommonUtil.clamp(theta, -1, 1));
755 };
756 /**
757 * 向量 v1 到 向量 v2 夹角的方向
758 * @param {Array} v1 向量
759 * @param {Array} v2 向量
760 * @return {Boolean} >= 0 顺时针 < 0 逆时针
761 */
762 vec2.direction = function (v1, v2) {
763 return v1[0] * v2[1] - v2[0] * v1[1];
764 };
765 vec2.angleTo = function (v1, v2, direct) {
766 var angle = vec2.angle(v1, v2);
767 var angleLargeThanPI = vec2.direction(v1, v2) >= 0;
768 if (direct) {
769 if (angleLargeThanPI) {
770 return Math.PI * 2 - angle;
771 }
772
773 return angle;
774 }
775
776 if (angleLargeThanPI) {
777 return angle;
778 }
779 return Math.PI * 2 - angle;
780 };
781 vec2.vertical = function (out, v, flag) {
782 if (flag) {
783 out[0] = v[1];
784 out[1] = -1 * v[0];
785 } else {
786 out[0] = -1 * v[1];
787 out[1] = v[0];
788 }
789
790 return out;
791 };
792
793 mat3.translate = function (out, a, v) {
794 var transMat = new Array(9);
795 mat3.fromTranslation(transMat, v);
796 return mat3.multiply(out, transMat, a);
797 };
798
799 mat3.rotate = function (out, a, rad) {
800 var rotateMat = new Array(9);
801 mat3.fromRotation(rotateMat, rad);
802 return mat3.multiply(out, rotateMat, a);
803 };
804
805 mat3.scale = function (out, a, v) {
806 var scaleMat = new Array(9);
807 mat3.fromScaling(scaleMat, v);
808 return mat3.multiply(out, scaleMat, a);
809 };
810
811 module.exports = {
812 mat3: mat3,
813 vec2: vec2,
814 vec3: vec3,
815 transform: function transform(m, ts) {
816 m = CommonUtil.clone(m);
817 CommonUtil.each(ts, function (t) {
818 switch (t[0]) {
819 case 't':
820 mat3.translate(m, m, [t[1], t[2]]);
821 break;
822 case 's':
823 mat3.scale(m, m, [t[1], t[2]]);
824 break;
825 case 'r':
826 mat3.rotate(m, m, t[1]);
827 break;
828 case 'm':
829 mat3.multiply(m, m, t[1]);
830 break;
831 default:
832 return false;
833 }
834 });
835 return m;
836 }
837 };
838
839 /***/
840 },
841 /* 4 */
842 /***/function (module, exports, __webpack_require__) {
843
844 var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) {
845 return typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
846 } : function (obj) {
847 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
848 };
849
850 var freeGlobal = __webpack_require__(55);
851
852 /** Detect free variable `self`. */
853 var freeSelf = (typeof self === 'undefined' ? 'undefined' : _typeof(self)) == 'object' && self && self.Object === Object && self;
854
855 /** Used as a reference to the global object. */
856 var root = freeGlobal || freeSelf || Function('return this')();
857
858 module.exports = root;
859
860 /***/
861 },
862 /* 5 */
863 /***/function (module, exports) {
864
865 var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) {
866 return typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
867 } : function (obj) {
868 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
869 };
870
871 /**
872 * Checks if `value` is object-like. A value is object-like if it's not `null`
873 * and has a `typeof` result of "object".
874 *
875 * @static
876 * @memberOf _
877 * @since 4.0.0
878 * @category Lang
879 * @param {*} value The value to check.
880 * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
881 * @example
882 *
883 * _.isObjectLike({});
884 * // => true
885 *
886 * _.isObjectLike([1, 2, 3]);
887 * // => true
888 *
889 * _.isObjectLike(_.noop);
890 * // => false
891 *
892 * _.isObjectLike(null);
893 * // => false
894 */
895 function isObjectLike(value) {
896 return value != null && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) == 'object';
897 }
898
899 module.exports = isObjectLike;
900
901 /***/
902 },
903 /* 6 */
904 /***/function (module, exports) {
905
906 /**
907 * Checks if `value` is classified as an `Array` object.
908 *
909 * @static
910 * @memberOf _
911 * @since 0.1.0
912 * @category Lang
913 * @param {*} value The value to check.
914 * @returns {boolean} Returns `true` if `value` is an array, else `false`.
915 * @example
916 *
917 * _.isArray([1, 2, 3]);
918 * // => true
919 *
920 * _.isArray(document.body.children);
921 * // => false
922 *
923 * _.isArray('abc');
924 * // => false
925 *
926 * _.isArray(_.noop);
927 * // => false
928 */
929 var isArray = Array.isArray;
930
931 module.exports = isArray;
932
933 /***/
934 },
935 /* 7 */
936 /***/function (module, exports, __webpack_require__) {
937
938 var _Symbol = __webpack_require__(11),
939 getRawTag = __webpack_require__(115),
940 objectToString = __webpack_require__(116);
941
942 /** `Object#toString` result references. */
943 var nullTag = '[object Null]',
944 undefinedTag = '[object Undefined]';
945
946 /** Built-in value references. */
947 var symToStringTag = _Symbol ? _Symbol.toStringTag : undefined;
948
949 /**
950 * The base implementation of `getTag` without fallbacks for buggy environments.
951 *
952 * @private
953 * @param {*} value The value to query.
954 * @returns {string} Returns the `toStringTag`.
955 */
956 function baseGetTag(value) {
957 if (value == null) {
958 return value === undefined ? undefinedTag : nullTag;
959 }
960 return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
961 }
962
963 module.exports = baseGetTag;
964
965 /***/
966 },
967 /* 8 */
968 /***/function (module, exports) {
969
970 var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) {
971 return typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
972 } : function (obj) {
973 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
974 };
975
976 /**
977 * Checks if `value` is the
978 * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
979 * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
980 *
981 * @static
982 * @memberOf _
983 * @since 0.1.0
984 * @category Lang
985 * @param {*} value The value to check.
986 * @returns {boolean} Returns `true` if `value` is an object, else `false`.
987 * @example
988 *
989 * _.isObject({});
990 * // => true
991 *
992 * _.isObject([1, 2, 3]);
993 * // => true
994 *
995 * _.isObject(_.noop);
996 * // => true
997 *
998 * _.isObject(null);
999 * // => false
1000 */
1001 function isObject(value) {
1002 var type = typeof value === 'undefined' ? 'undefined' : _typeof(value);
1003 return value != null && (type == 'object' || type == 'function');
1004 }
1005
1006 module.exports = isObject;
1007
1008 /***/
1009 },
1010 /* 9 */
1011 /***/function (module, exports, __webpack_require__) {
1012
1013 var isFunction = __webpack_require__(20),
1014 isLength = __webpack_require__(60);
1015
1016 /**
1017 * Checks if `value` is array-like. A value is considered array-like if it's
1018 * not a function and has a `value.length` that's an integer greater than or
1019 * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
1020 *
1021 * @static
1022 * @memberOf _
1023 * @since 4.0.0
1024 * @category Lang
1025 * @param {*} value The value to check.
1026 * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
1027 * @example
1028 *
1029 * _.isArrayLike([1, 2, 3]);
1030 * // => true
1031 *
1032 * _.isArrayLike(document.body.children);
1033 * // => true
1034 *
1035 * _.isArrayLike('abc');
1036 * // => true
1037 *
1038 * _.isArrayLike(_.noop);
1039 * // => false
1040 */
1041 function isArrayLike(value) {
1042 return value != null && isLength(value.length) && !isFunction(value);
1043 }
1044
1045 module.exports = isArrayLike;
1046
1047 /***/
1048 },
1049 /* 10 */
1050 /***/function (module, exports, __webpack_require__) {
1051
1052 var baseIsNative = __webpack_require__(123),
1053 getValue = __webpack_require__(126);
1054
1055 /**
1056 * Gets the native function at `key` of `object`.
1057 *
1058 * @private
1059 * @param {Object} object The object to query.
1060 * @param {string} key The key of the method to get.
1061 * @returns {*} Returns the function if it's native, else `undefined`.
1062 */
1063 function getNative(object, key) {
1064 var value = getValue(object, key);
1065 return baseIsNative(value) ? value : undefined;
1066 }
1067
1068 module.exports = getNative;
1069
1070 /***/
1071 },
1072 /* 11 */
1073 /***/function (module, exports, __webpack_require__) {
1074
1075 var root = __webpack_require__(4);
1076
1077 /** Built-in value references. */
1078 var _Symbol = root.Symbol;
1079
1080 module.exports = _Symbol;
1081
1082 /***/
1083 },
1084 /* 12 */
1085 /***/function (module, exports, __webpack_require__) {
1086
1087 var assignValue = __webpack_require__(37),
1088 baseAssignValue = __webpack_require__(38);
1089
1090 /**
1091 * Copies properties of `source` to `object`.
1092 *
1093 * @private
1094 * @param {Object} source The object to copy properties from.
1095 * @param {Array} props The property identifiers to copy.
1096 * @param {Object} [object={}] The object to copy properties to.
1097 * @param {Function} [customizer] The function to customize copied values.
1098 * @returns {Object} Returns `object`.
1099 */
1100 function copyObject(source, props, object, customizer) {
1101 var isNew = !object;
1102 object || (object = {});
1103
1104 var index = -1,
1105 length = props.length;
1106
1107 while (++index < length) {
1108 var key = props[index];
1109
1110 var newValue = customizer ? customizer(object[key], source[key], key, object, source) : undefined;
1111
1112 if (newValue === undefined) {
1113 newValue = source[key];
1114 }
1115 if (isNew) {
1116 baseAssignValue(object, key, newValue);
1117 } else {
1118 assignValue(object, key, newValue);
1119 }
1120 }
1121 return object;
1122 }
1123
1124 module.exports = copyObject;
1125
1126 /***/
1127 },
1128 /* 13 */
1129 /***/function (module, exports, __webpack_require__) {
1130
1131 var arrayLikeKeys = __webpack_require__(66),
1132 baseKeys = __webpack_require__(57),
1133 isArrayLike = __webpack_require__(9);
1134
1135 /**
1136 * Creates an array of the own enumerable property names of `object`.
1137 *
1138 * **Note:** Non-object values are coerced to objects. See the
1139 * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
1140 * for more details.
1141 *
1142 * @static
1143 * @since 0.1.0
1144 * @memberOf _
1145 * @category Object
1146 * @param {Object} object The object to query.
1147 * @returns {Array} Returns the array of property names.
1148 * @example
1149 *
1150 * function Foo() {
1151 * this.a = 1;
1152 * this.b = 2;
1153 * }
1154 *
1155 * Foo.prototype.c = 3;
1156 *
1157 * _.keys(new Foo);
1158 * // => ['a', 'b'] (iteration order is not guaranteed)
1159 *
1160 * _.keys('hi');
1161 * // => ['0', '1']
1162 */
1163 function keys(object) {
1164 return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
1165 }
1166
1167 module.exports = keys;
1168
1169 /***/
1170 },
1171 /* 14 */
1172 /***/function (module, __webpack_exports__, __webpack_require__) {
1173
1174 "use strict";
1175 /* harmony import */
1176 var __WEBPACK_IMPORTED_MODULE_0__src_color__ = __webpack_require__(49);
1177 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "a", function () {
1178 return __WEBPACK_IMPORTED_MODULE_0__src_color__["e"];
1179 });
1180 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "f", function () {
1181 return __WEBPACK_IMPORTED_MODULE_0__src_color__["g"];
1182 });
1183 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "d", function () {
1184 return __WEBPACK_IMPORTED_MODULE_0__src_color__["f"];
1185 });
1186 /* harmony import */var __WEBPACK_IMPORTED_MODULE_1__src_lab__ = __webpack_require__(249);
1187 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "e", function () {
1188 return __WEBPACK_IMPORTED_MODULE_1__src_lab__["a"];
1189 });
1190 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "c", function () {
1191 return __WEBPACK_IMPORTED_MODULE_1__src_lab__["b"];
1192 });
1193 /* harmony import */var __WEBPACK_IMPORTED_MODULE_2__src_cubehelix__ = __webpack_require__(250);
1194 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "b", function () {
1195 return __WEBPACK_IMPORTED_MODULE_2__src_cubehelix__["a"];
1196 });
1197
1198 /***/
1199 },
1200 /* 15 */
1201 /***/function (module, exports) {
1202
1203 var PI = Math.PI;
1204 var sin = Math.sin;
1205 var cos = Math.cos;
1206 var atan2 = Math.atan2;
1207 var DEFAULT_LENGTH = 10;
1208 var DEFAULT_ANGLE = PI / 3;
1209
1210 function _addArrow(ctx, attrs, x1, y1, x2, y2) {
1211 var leftX = void 0;
1212 var leftY = void 0;
1213 var rightX = void 0;
1214 var rightY = void 0;
1215 var offsetX = void 0;
1216 var offsetY = void 0;
1217 var angle = void 0;
1218
1219 if (!attrs.fill) {
1220 // 闭合的不绘制箭头
1221 var arrowLength = attrs.arrowLength || DEFAULT_LENGTH;
1222 var arrowAngle = attrs.arrowAngle ? attrs.arrowAngle * PI / 180 : DEFAULT_ANGLE; // 转换为弧度
1223
1224 // Calculate angle
1225 angle = atan2(y2 - y1, x2 - x1);
1226 // Adjust angle correctly
1227 angle -= PI;
1228 // Calculate offset to place arrow at edge of path
1229 offsetX = attrs.lineWidth * cos(angle);
1230 offsetY = attrs.lineWidth * sin(angle);
1231
1232 // Calculate coordinates for left half of arrow
1233 leftX = x2 + arrowLength * cos(angle + arrowAngle / 2);
1234 leftY = y2 + arrowLength * sin(angle + arrowAngle / 2);
1235 // Calculate coordinates for right half of arrow
1236 rightX = x2 + arrowLength * cos(angle - arrowAngle / 2);
1237 rightY = y2 + arrowLength * sin(angle - arrowAngle / 2);
1238
1239 // Draw left half of arrow
1240 ctx.moveTo(leftX - offsetX, leftY - offsetY);
1241 ctx.lineTo(x2 - offsetX, y2 - offsetY);
1242 // Draw right half of arrow
1243 ctx.lineTo(rightX - offsetX, rightY - offsetY);
1244
1245 // Visually connect arrow to path
1246 ctx.moveTo(x2 - offsetX, y2 - offsetY);
1247 ctx.lineTo(x2 + offsetX, y2 + offsetY);
1248 // Move back to end of path
1249 ctx.moveTo(x2, y2);
1250 }
1251 }
1252
1253 module.exports = {
1254 addStartArrow: function addStartArrow(ctx, attrs, x1, y1, x2, y2) {
1255 if (attrs.startArrow) {
1256 _addArrow(ctx, attrs, x1, y1, x2, y2);
1257 }
1258 },
1259 addEndArrow: function addEndArrow(ctx, attrs, x1, y1, x2, y2) {
1260 if (attrs.endArrow) {
1261 _addArrow(ctx, attrs, x1, y1, x2, y2);
1262 }
1263 }
1264 };
1265
1266 /***/
1267 },
1268 /* 16 */
1269 /***/function (module, exports) {
1270
1271 /** Used for built-in method references. */
1272 var objectProto = Object.prototype;
1273
1274 /**
1275 * Checks if `value` is likely a prototype object.
1276 *
1277 * @private
1278 * @param {*} value The value to check.
1279 * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
1280 */
1281 function isPrototype(value) {
1282 var Ctor = value && value.constructor,
1283 proto = typeof Ctor == 'function' && Ctor.prototype || objectProto;
1284
1285 return value === proto;
1286 }
1287
1288 module.exports = isPrototype;
1289
1290 /***/
1291 },
1292 /* 17 */
1293 /***/function (module, exports, __webpack_require__) {
1294
1295 /* WEBPACK VAR INJECTION */(function (module) {
1296 var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) {
1297 return typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
1298 } : function (obj) {
1299 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
1300 };
1301
1302 var root = __webpack_require__(4),
1303 stubFalse = __webpack_require__(131);
1304
1305 /** Detect free variable `exports`. */
1306 var freeExports = (false ? 'undefined' : _typeof(exports)) == 'object' && exports && !exports.nodeType && exports;
1307
1308 /** Detect free variable `module`. */
1309 var freeModule = freeExports && (false ? 'undefined' : _typeof(module)) == 'object' && module && !module.nodeType && module;
1310
1311 /** Detect the popular CommonJS extension `module.exports`. */
1312 var moduleExports = freeModule && freeModule.exports === freeExports;
1313
1314 /** Built-in value references. */
1315 var Buffer = moduleExports ? root.Buffer : undefined;
1316
1317 /* Built-in method references for those with the same name as other `lodash` methods. */
1318 var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
1319
1320 /**
1321 * Checks if `value` is a buffer.
1322 *
1323 * @static
1324 * @memberOf _
1325 * @since 4.3.0
1326 * @category Lang
1327 * @param {*} value The value to check.
1328 * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
1329 * @example
1330 *
1331 * _.isBuffer(new Buffer(2));
1332 * // => true
1333 *
1334 * _.isBuffer(new Uint8Array(2));
1335 * // => false
1336 */
1337 var isBuffer = nativeIsBuffer || stubFalse;
1338
1339 module.exports = isBuffer;
1340 /* WEBPACK VAR INJECTION */
1341 }).call(exports, __webpack_require__(34)(module));
1342
1343 /***/
1344 },
1345 /* 18 */
1346 /***/function (module, exports) {
1347
1348 /**
1349 * Performs a
1350 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
1351 * comparison between two values to determine if they are equivalent.
1352 *
1353 * @static
1354 * @memberOf _
1355 * @since 4.0.0
1356 * @category Lang
1357 * @param {*} value The value to compare.
1358 * @param {*} other The other value to compare.
1359 * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
1360 * @example
1361 *
1362 * var object = { 'a': 1 };
1363 * var other = { 'a': 1 };
1364 *
1365 * _.eq(object, object);
1366 * // => true
1367 *
1368 * _.eq(object, other);
1369 * // => false
1370 *
1371 * _.eq('a', 'a');
1372 * // => true
1373 *
1374 * _.eq('a', Object('a'));
1375 * // => false
1376 *
1377 * _.eq(NaN, NaN);
1378 * // => true
1379 */
1380 function eq(value, other) {
1381 return value === other || value !== value && other !== other;
1382 }
1383
1384 module.exports = eq;
1385
1386 /***/
1387 },
1388 /* 19 */
1389 /***/function (module, __webpack_exports__, __webpack_require__) {
1390
1391 "use strict";
1392 /* harmony export (immutable) */
1393 __webpack_exports__["c"] = hue;
1394 /* harmony export (immutable) */__webpack_exports__["b"] = gamma;
1395 /* harmony export (immutable) */__webpack_exports__["a"] = nogamma;
1396 /* harmony import */var __WEBPACK_IMPORTED_MODULE_0__constant__ = __webpack_require__(92);
1397
1398 function linear(a, d) {
1399 return function (t) {
1400 return a + t * d;
1401 };
1402 }
1403
1404 function exponential(a, b, y) {
1405 return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function (t) {
1406 return Math.pow(a + t * b, y);
1407 };
1408 }
1409
1410 function hue(a, b) {
1411 var d = b - a;
1412 return d ? linear(a, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d) : Object(__WEBPACK_IMPORTED_MODULE_0__constant__["a" /* default */])(isNaN(a) ? b : a);
1413 }
1414
1415 function gamma(y) {
1416 return (y = +y) === 1 ? nogamma : function (a, b) {
1417 return b - a ? exponential(a, b, y) : Object(__WEBPACK_IMPORTED_MODULE_0__constant__["a" /* default */])(isNaN(a) ? b : a);
1418 };
1419 }
1420
1421 function nogamma(a, b) {
1422 var d = b - a;
1423 return d ? linear(a, d) : Object(__WEBPACK_IMPORTED_MODULE_0__constant__["a" /* default */])(isNaN(a) ? b : a);
1424 }
1425
1426 /***/
1427 },
1428 /* 20 */
1429 /***/function (module, exports, __webpack_require__) {
1430
1431 var baseGetTag = __webpack_require__(7),
1432 isObject = __webpack_require__(8);
1433
1434 /** `Object#toString` result references. */
1435 var asyncTag = '[object AsyncFunction]',
1436 funcTag = '[object Function]',
1437 genTag = '[object GeneratorFunction]',
1438 proxyTag = '[object Proxy]';
1439
1440 /**
1441 * Checks if `value` is classified as a `Function` object.
1442 *
1443 * @static
1444 * @memberOf _
1445 * @since 0.1.0
1446 * @category Lang
1447 * @param {*} value The value to check.
1448 * @returns {boolean} Returns `true` if `value` is a function, else `false`.
1449 * @example
1450 *
1451 * _.isFunction(_);
1452 * // => true
1453 *
1454 * _.isFunction(/abc/);
1455 * // => false
1456 */
1457 function isFunction(value) {
1458 if (!isObject(value)) {
1459 return false;
1460 }
1461 // The use of `Object#toString` avoids issues with the `typeof` operator
1462 // in Safari 9 which returns 'object' for typed arrays and other constructors.
1463 var tag = baseGetTag(value);
1464 return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
1465 }
1466
1467 module.exports = isFunction;
1468
1469 /***/
1470 },
1471 /* 21 */
1472 /***/function (module, exports, __webpack_require__) {
1473
1474 var DataView = __webpack_require__(122),
1475 Map = __webpack_require__(32),
1476 Promise = __webpack_require__(127),
1477 Set = __webpack_require__(128),
1478 WeakMap = __webpack_require__(129),
1479 baseGetTag = __webpack_require__(7),
1480 toSource = __webpack_require__(59);
1481
1482 /** `Object#toString` result references. */
1483 var mapTag = '[object Map]',
1484 objectTag = '[object Object]',
1485 promiseTag = '[object Promise]',
1486 setTag = '[object Set]',
1487 weakMapTag = '[object WeakMap]';
1488
1489 var dataViewTag = '[object DataView]';
1490
1491 /** Used to detect maps, sets, and weakmaps. */
1492 var dataViewCtorString = toSource(DataView),
1493 mapCtorString = toSource(Map),
1494 promiseCtorString = toSource(Promise),
1495 setCtorString = toSource(Set),
1496 weakMapCtorString = toSource(WeakMap);
1497
1498 /**
1499 * Gets the `toStringTag` of `value`.
1500 *
1501 * @private
1502 * @param {*} value The value to query.
1503 * @returns {string} Returns the `toStringTag`.
1504 */
1505 var getTag = baseGetTag;
1506
1507 // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
1508 if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map && getTag(new Map()) != mapTag || Promise && getTag(Promise.resolve()) != promiseTag || Set && getTag(new Set()) != setTag || WeakMap && getTag(new WeakMap()) != weakMapTag) {
1509 getTag = function getTag(value) {
1510 var result = baseGetTag(value),
1511 Ctor = result == objectTag ? value.constructor : undefined,
1512 ctorString = Ctor ? toSource(Ctor) : '';
1513
1514 if (ctorString) {
1515 switch (ctorString) {
1516 case dataViewCtorString:
1517 return dataViewTag;
1518 case mapCtorString:
1519 return mapTag;
1520 case promiseCtorString:
1521 return promiseTag;
1522 case setCtorString:
1523 return setTag;
1524 case weakMapCtorString:
1525 return weakMapTag;
1526 }
1527 }
1528 return result;
1529 };
1530 }
1531
1532 module.exports = getTag;
1533
1534 /***/
1535 },
1536 /* 22 */
1537 /***/function (module, exports, __webpack_require__) {
1538
1539 var baseIsTypedArray = __webpack_require__(132),
1540 baseUnary = __webpack_require__(61),
1541 nodeUtil = __webpack_require__(133);
1542
1543 /* Node.js helper references. */
1544 var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
1545
1546 /**
1547 * Checks if `value` is classified as a typed array.
1548 *
1549 * @static
1550 * @memberOf _
1551 * @since 3.0.0
1552 * @category Lang
1553 * @param {*} value The value to check.
1554 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
1555 * @example
1556 *
1557 * _.isTypedArray(new Uint8Array);
1558 * // => true
1559 *
1560 * _.isTypedArray([]);
1561 * // => false
1562 */
1563 var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
1564
1565 module.exports = isTypedArray;
1566
1567 /***/
1568 },
1569 /* 23 */
1570 /***/function (module, exports, __webpack_require__) {
1571
1572 var listCacheClear = __webpack_require__(139),
1573 listCacheDelete = __webpack_require__(140),
1574 listCacheGet = __webpack_require__(141),
1575 listCacheHas = __webpack_require__(142),
1576 listCacheSet = __webpack_require__(143);
1577
1578 /**
1579 * Creates an list cache object.
1580 *
1581 * @private
1582 * @constructor
1583 * @param {Array} [entries] The key-value pairs to cache.
1584 */
1585 function ListCache(entries) {
1586 var index = -1,
1587 length = entries == null ? 0 : entries.length;
1588
1589 this.clear();
1590 while (++index < length) {
1591 var entry = entries[index];
1592 this.set(entry[0], entry[1]);
1593 }
1594 }
1595
1596 // Add methods to `ListCache`.
1597 ListCache.prototype.clear = listCacheClear;
1598 ListCache.prototype['delete'] = listCacheDelete;
1599 ListCache.prototype.get = listCacheGet;
1600 ListCache.prototype.has = listCacheHas;
1601 ListCache.prototype.set = listCacheSet;
1602
1603 module.exports = ListCache;
1604
1605 /***/
1606 },
1607 /* 24 */
1608 /***/function (module, exports, __webpack_require__) {
1609
1610 var eq = __webpack_require__(18);
1611
1612 /**
1613 * Gets the index at which the `key` is found in `array` of key-value pairs.
1614 *
1615 * @private
1616 * @param {Array} array The array to inspect.
1617 * @param {*} key The key to search for.
1618 * @returns {number} Returns the index of the matched value, else `-1`.
1619 */
1620 function assocIndexOf(array, key) {
1621 var length = array.length;
1622 while (length--) {
1623 if (eq(array[length][0], key)) {
1624 return length;
1625 }
1626 }
1627 return -1;
1628 }
1629
1630 module.exports = assocIndexOf;
1631
1632 /***/
1633 },
1634 /* 25 */
1635 /***/function (module, exports, __webpack_require__) {
1636
1637 var getNative = __webpack_require__(10);
1638
1639 /* Built-in method references that are verified to be native. */
1640 var nativeCreate = getNative(Object, 'create');
1641
1642 module.exports = nativeCreate;
1643
1644 /***/
1645 },
1646 /* 26 */
1647 /***/function (module, exports, __webpack_require__) {
1648
1649 var isKeyable = __webpack_require__(157);
1650
1651 /**
1652 * Gets the data for `map`.
1653 *
1654 * @private
1655 * @param {Object} map The map to query.
1656 * @param {string} key The reference key.
1657 * @returns {*} Returns the map data.
1658 */
1659 function getMapData(map, key) {
1660 var data = map.__data__;
1661 return isKeyable(key) ? data[typeof key == 'string' ? 'string' : 'hash'] : data.map;
1662 }
1663
1664 module.exports = getMapData;
1665
1666 /***/
1667 },
1668 /* 27 */
1669 /***/function (module, exports, __webpack_require__) {
1670
1671 var arrayLikeKeys = __webpack_require__(66),
1672 baseKeysIn = __webpack_require__(164),
1673 isArrayLike = __webpack_require__(9);
1674
1675 /**
1676 * Creates an array of the own and inherited enumerable property names of `object`.
1677 *
1678 * **Note:** Non-object values are coerced to objects.
1679 *
1680 * @static
1681 * @memberOf _
1682 * @since 3.0.0
1683 * @category Object
1684 * @param {Object} object The object to query.
1685 * @returns {Array} Returns the array of property names.
1686 * @example
1687 *
1688 * function Foo() {
1689 * this.a = 1;
1690 * this.b = 2;
1691 * }
1692 *
1693 * Foo.prototype.c = 3;
1694 *
1695 * _.keysIn(new Foo);
1696 * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
1697 */
1698 function keysIn(object) {
1699 return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
1700 }
1701
1702 module.exports = keysIn;
1703
1704 /***/
1705 },
1706 /* 28 */
1707 /***/function (module, exports) {
1708
1709 /**
1710 * Copies the values of `source` to `array`.
1711 *
1712 * @private
1713 * @param {Array} source The array to copy values from.
1714 * @param {Array} [array=[]] The array to copy values to.
1715 * @returns {Array} Returns `array`.
1716 */
1717 function copyArray(source, array) {
1718 var index = -1,
1719 length = source.length;
1720
1721 array || (array = Array(length));
1722 while (++index < length) {
1723 array[index] = source[index];
1724 }
1725 return array;
1726 }
1727
1728 module.exports = copyArray;
1729
1730 /***/
1731 },
1732 /* 29 */
1733 /***/function (module, __webpack_exports__, __webpack_require__) {
1734
1735 "use strict";
1736 /* harmony default export */
1737 __webpack_exports__["a"] = function (a, b) {
1738 return a = +a, b -= a, function (t) {
1739 return a + b * t;
1740 };
1741 };
1742
1743 /***/
1744 },
1745 /* 30 */
1746 /***/function (module, exports, __webpack_require__) {
1747
1748 var Util = __webpack_require__(0);
1749 var vec2 = __webpack_require__(3).vec2;
1750
1751 function cubicAt(p0, p1, p2, p3, t) {
1752 var onet = 1 - t;
1753 return onet * onet * (onet * p3 + 3 * t * p2) + t * t * (t * p0 + 3 * onet * p1);
1754 }
1755
1756 function cubicDerivativeAt(p0, p1, p2, p3, t) {
1757 var onet = 1 - t;
1758 return 3 * (((p1 - p0) * onet + 2 * (p2 - p1) * t) * onet + (p3 - p2) * t * t);
1759 }
1760
1761 function cubicProjectPoint(x1, y1, x2, y2, x3, y3, x4, y4, x, y, out) {
1762 var t = void 0;
1763 var interval = 0.005;
1764 var d = Infinity;
1765 var _t = void 0;
1766 var v1 = void 0;
1767 var d1 = void 0;
1768 var d2 = void 0;
1769 var v2 = void 0;
1770 var prev = void 0;
1771 var next = void 0;
1772 var EPSILON = 0.0001;
1773 var v0 = [x, y];
1774
1775 for (_t = 0; _t < 1; _t += 0.05) {
1776 v1 = [cubicAt(x1, x2, x3, x4, _t), cubicAt(y1, y2, y3, y4, _t)];
1777
1778 d1 = vec2.squaredDistance(v0, v1);
1779 if (d1 < d) {
1780 t = _t;
1781 d = d1;
1782 }
1783 }
1784 d = Infinity;
1785
1786 for (var i = 0; i < 32; i++) {
1787 if (interval < EPSILON) {
1788 break;
1789 }
1790
1791 prev = t - interval;
1792 next = t + interval;
1793
1794 v1 = [cubicAt(x1, x2, x3, x4, prev), cubicAt(y1, y2, y3, y4, prev)];
1795
1796 d1 = vec2.squaredDistance(v0, v1);
1797
1798 if (prev >= 0 && d1 < d) {
1799 t = prev;
1800 d = d1;
1801 } else {
1802 v2 = [cubicAt(x1, x2, x3, x4, next), cubicAt(y1, y2, y3, y4, next)];
1803
1804 d2 = vec2.squaredDistance(v0, v2);
1805
1806 if (next <= 1 && d2 < d) {
1807 t = next;
1808 d = d2;
1809 } else {
1810 interval *= 0.5;
1811 }
1812 }
1813 }
1814
1815 if (out) {
1816 out.x = cubicAt(x1, x2, x3, x4, t);
1817 out.y = cubicAt(y1, y2, y3, y4, t);
1818 }
1819
1820 return Math.sqrt(d);
1821 }
1822
1823 function cubicExtrema(p0, p1, p2, p3) {
1824 var a = 3 * p0 - 9 * p1 + 9 * p2 - 3 * p3;
1825 var b = 6 * p1 - 12 * p2 + 6 * p3;
1826 var c = 3 * p2 - 3 * p3;
1827 var extrema = [];
1828 var t1 = void 0;
1829 var t2 = void 0;
1830 var discSqrt = void 0;
1831
1832 if (Util.isNumberEqual(a, 0)) {
1833 if (!Util.isNumberEqual(b, 0)) {
1834 t1 = -c / b;
1835 if (t1 >= 0 && t1 <= 1) {
1836 extrema.push(t1);
1837 }
1838 }
1839 } else {
1840 var disc = b * b - 4 * a * c;
1841 if (Util.isNumberEqual(disc, 0)) {
1842 extrema.push(-b / (2 * a));
1843 } else if (disc > 0) {
1844 discSqrt = Math.sqrt(disc);
1845 t1 = (-b + discSqrt) / (2 * a);
1846 t2 = (-b - discSqrt) / (2 * a);
1847 if (t1 >= 0 && t1 <= 1) {
1848 extrema.push(t1);
1849 }
1850 if (t2 >= 0 && t2 <= 1) {
1851 extrema.push(t2);
1852 }
1853 }
1854 }
1855 return extrema;
1856 }
1857
1858 function base3(t, p1, p2, p3, p4) {
1859 var t1 = -3 * p1 + 9 * p2 - 9 * p3 + 3 * p4;
1860 var t2 = t * t1 + 6 * p1 - 12 * p2 + 6 * p3;
1861 return t * t2 - 3 * p1 + 3 * p2;
1862 }
1863
1864 function cubiclLen(x1, y1, x2, y2, x3, y3, x4, y4, z) {
1865 if (Util.isNil(z)) {
1866 z = 1;
1867 }
1868 z = z > 1 ? 1 : z < 0 ? 0 : z;
1869 var z2 = z / 2;
1870 var n = 12;
1871 var Tvalues = [-0.1252, 0.1252, -0.3678, 0.3678, -0.5873, 0.5873, -0.7699, 0.7699, -0.9041, 0.9041, -0.9816, 0.9816];
1872 var Cvalues = [0.2491, 0.2491, 0.2335, 0.2335, 0.2032, 0.2032, 0.1601, 0.1601, 0.1069, 0.1069, 0.0472, 0.0472];
1873 var sum = 0;
1874 for (var i = 0; i < n; i++) {
1875 var ct = z2 * Tvalues[i] + z2;
1876 var xbase = base3(ct, x1, x2, x3, x4);
1877 var ybase = base3(ct, y1, y2, y3, y4);
1878 var comb = xbase * xbase + ybase * ybase;
1879 sum += Cvalues[i] * Math.sqrt(comb);
1880 }
1881 return z2 * sum;
1882 }
1883
1884 module.exports = {
1885 at: cubicAt,
1886 derivativeAt: cubicDerivativeAt,
1887 projectPoint: function projectPoint(x1, y1, x2, y2, x3, y3, x4, y4, x, y) {
1888 var rst = {};
1889 cubicProjectPoint(x1, y1, x2, y2, x3, y3, x4, y4, x, y, rst);
1890 return rst;
1891 },
1892
1893 pointDistance: cubicProjectPoint,
1894 extrema: cubicExtrema,
1895 len: cubiclLen
1896 };
1897
1898 /***/
1899 },
1900 /* 31 */
1901 /***/function (module, exports, __webpack_require__) {
1902
1903 var PRECISION = 0.00001; // 常量,据的精度,小于这个精度认为是0
1904 var RADIAN = Math.PI / 180;
1905 var DEGREE = 180 / Math.PI;
1906
1907 module.exports = {
1908 isFunction: __webpack_require__(20),
1909 isObject: __webpack_require__(8),
1910 isBoolean: __webpack_require__(117),
1911 isNil: __webpack_require__(118),
1912 isString: __webpack_require__(56),
1913 isArray: __webpack_require__(6),
1914 isNumber: __webpack_require__(119),
1915 isEmpty: __webpack_require__(120), // isBlank
1916 uniqueId: __webpack_require__(134),
1917 clone: __webpack_require__(137),
1918 assign: __webpack_require__(180), // simpleMix
1919 merge: __webpack_require__(188), // mix
1920 upperFirst: __webpack_require__(195), // ucfirst
1921 remove: __webpack_require__(201),
1922 each: __webpack_require__(209),
1923 isEqual: __webpack_require__(214),
1924 toArray: __webpack_require__(224),
1925 extend: function extend(subclass, superclass, overrides, staticOverrides) {
1926 // 如果只提供父类构造函数,则自动生成子类构造函数
1927 if (!this.isFunction(superclass)) {
1928 overrides = superclass;
1929 superclass = subclass;
1930 subclass = function subclass() {};
1931 }
1932
1933 var create = Object.create ? function (proto, c) {
1934 return Object.create(proto, {
1935 constructor: {
1936 value: c
1937 }
1938 });
1939 } : function (proto, c) {
1940 function F() {}
1941
1942 F.prototype = proto;
1943 var o = new F();
1944 o.constructor = c;
1945 return o;
1946 };
1947
1948 var superObj = create(superclass.prototype, subclass); // new superclass(),//实例化父类作为子类的prototype
1949 subclass.prototype = this.merge(superObj, subclass.prototype); // 指定子类的prototype
1950 subclass.superclass = create(superclass.prototype, superclass);
1951 this.merge(superObj, overrides);
1952 this.merge(subclass, staticOverrides);
1953 return subclass;
1954 },
1955 augment: function augment(c) {
1956 var args = this.toArray(arguments);
1957 for (var i = 1; i < args.length; i++) {
1958 var obj = args[i];
1959 if (this.isFunction(obj)) {
1960 obj = obj.prototype;
1961 }
1962 this.merge(c.prototype, obj);
1963 }
1964 },
1965
1966 /**
1967 * 判断两个数是否相等
1968 * @param {Number} a 数
1969 * @param {Number} b 数
1970 * @return {Boolean} 是否相等
1971 **/
1972 isNumberEqual: function isNumberEqual(a, b) {
1973 return Math.abs(a - b) < PRECISION;
1974 },
1975
1976 /**
1977 * 获取角度对应的弧度
1978 * @param {Number} degree 角度
1979 * @return {Number} 弧度
1980 **/
1981 toRadian: function toRadian(degree) {
1982 return RADIAN * degree;
1983 },
1984
1985 /**
1986 * 获取弧度对应的角度
1987 * @param {Number} radian 弧度
1988 * @return {Number} 角度
1989 **/
1990 toDegree: function toDegree(radian) {
1991 return DEGREE * radian;
1992 },
1993
1994 /**
1995 * 广义取模运算
1996 * @param {Number} n 被取模的值
1997 * @param {Number} m 模
1998 * @return {Number} 返回n 被 m 取模的结果
1999 */
2000 mod: function mod(n, m) {
2001 return (n % m + m) % m;
2002 },
2003
2004 /**
2005 * 把a夹在min,max中间, 低于min的返回min,高于max的返回max,否则返回自身
2006 * @param {Number} a 数
2007 * @param {Number} min 下限
2008 * @param {Number} max 上限
2009 * @return {Number} 返回结果值
2010 **/
2011 clamp: function clamp(a, min, max) {
2012 if (a < min) {
2013 return min;
2014 } else if (a > max) {
2015 return max;
2016 }
2017
2018 return a;
2019 }
2020 };
2021
2022 /***/
2023 },
2024 /* 32 */
2025 /***/function (module, exports, __webpack_require__) {
2026
2027 var getNative = __webpack_require__(10),
2028 root = __webpack_require__(4);
2029
2030 /* Built-in method references that are verified to be native. */
2031 var Map = getNative(root, 'Map');
2032
2033 module.exports = Map;
2034
2035 /***/
2036 },
2037 /* 33 */
2038 /***/function (module, exports, __webpack_require__) {
2039
2040 var baseIsArguments = __webpack_require__(130),
2041 isObjectLike = __webpack_require__(5);
2042
2043 /** Used for built-in method references. */
2044 var objectProto = Object.prototype;
2045
2046 /** Used to check objects for own properties. */
2047 var hasOwnProperty = objectProto.hasOwnProperty;
2048
2049 /** Built-in value references. */
2050 var propertyIsEnumerable = objectProto.propertyIsEnumerable;
2051
2052 /**
2053 * Checks if `value` is likely an `arguments` object.
2054 *
2055 * @static
2056 * @memberOf _
2057 * @since 0.1.0
2058 * @category Lang
2059 * @param {*} value The value to check.
2060 * @returns {boolean} Returns `true` if `value` is an `arguments` object,
2061 * else `false`.
2062 * @example
2063 *
2064 * _.isArguments(function() { return arguments; }());
2065 * // => true
2066 *
2067 * _.isArguments([1, 2, 3]);
2068 * // => false
2069 */
2070 var isArguments = baseIsArguments(function () {
2071 return arguments;
2072 }()) ? baseIsArguments : function (value) {
2073 return isObjectLike(value) && hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee');
2074 };
2075
2076 module.exports = isArguments;
2077
2078 /***/
2079 },
2080 /* 34 */
2081 /***/function (module, exports) {
2082
2083 module.exports = function (module) {
2084 if (!module.webpackPolyfill) {
2085 module.deprecate = function () {};
2086 module.paths = [];
2087 // module.parent = undefined by default
2088 if (!module.children) module.children = [];
2089 Object.defineProperty(module, "loaded", {
2090 enumerable: true,
2091 get: function get() {
2092 return module.l;
2093 }
2094 });
2095 Object.defineProperty(module, "id", {
2096 enumerable: true,
2097 get: function get() {
2098 return module.i;
2099 }
2100 });
2101 module.webpackPolyfill = 1;
2102 }
2103 return module;
2104 };
2105
2106 /***/
2107 },
2108 /* 35 */
2109 /***/function (module, exports) {
2110
2111 /**
2112 * A specialized version of `_.map` for arrays without support for iteratee
2113 * shorthands.
2114 *
2115 * @private
2116 * @param {Array} [array] The array to iterate over.
2117 * @param {Function} iteratee The function invoked per iteration.
2118 * @returns {Array} Returns the new mapped array.
2119 */
2120 function arrayMap(array, iteratee) {
2121 var index = -1,
2122 length = array == null ? 0 : array.length,
2123 result = Array(length);
2124
2125 while (++index < length) {
2126 result[index] = iteratee(array[index], index, array);
2127 }
2128 return result;
2129 }
2130
2131 module.exports = arrayMap;
2132
2133 /***/
2134 },
2135 /* 36 */
2136 /***/function (module, exports, __webpack_require__) {
2137
2138 var ListCache = __webpack_require__(23),
2139 stackClear = __webpack_require__(144),
2140 stackDelete = __webpack_require__(145),
2141 stackGet = __webpack_require__(146),
2142 stackHas = __webpack_require__(147),
2143 stackSet = __webpack_require__(148);
2144
2145 /**
2146 * Creates a stack cache object to store key-value pairs.
2147 *
2148 * @private
2149 * @constructor
2150 * @param {Array} [entries] The key-value pairs to cache.
2151 */
2152 function Stack(entries) {
2153 var data = this.__data__ = new ListCache(entries);
2154 this.size = data.size;
2155 }
2156
2157 // Add methods to `Stack`.
2158 Stack.prototype.clear = stackClear;
2159 Stack.prototype['delete'] = stackDelete;
2160 Stack.prototype.get = stackGet;
2161 Stack.prototype.has = stackHas;
2162 Stack.prototype.set = stackSet;
2163
2164 module.exports = Stack;
2165
2166 /***/
2167 },
2168 /* 37 */
2169 /***/function (module, exports, __webpack_require__) {
2170
2171 var baseAssignValue = __webpack_require__(38),
2172 eq = __webpack_require__(18);
2173
2174 /** Used for built-in method references. */
2175 var objectProto = Object.prototype;
2176
2177 /** Used to check objects for own properties. */
2178 var hasOwnProperty = objectProto.hasOwnProperty;
2179
2180 /**
2181 * Assigns `value` to `key` of `object` if the existing value is not equivalent
2182 * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
2183 * for equality comparisons.
2184 *
2185 * @private
2186 * @param {Object} object The object to modify.
2187 * @param {string} key The key of the property to assign.
2188 * @param {*} value The value to assign.
2189 */
2190 function assignValue(object, key, value) {
2191 var objValue = object[key];
2192 if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || value === undefined && !(key in object)) {
2193 baseAssignValue(object, key, value);
2194 }
2195 }
2196
2197 module.exports = assignValue;
2198
2199 /***/
2200 },
2201 /* 38 */
2202 /***/function (module, exports, __webpack_require__) {
2203
2204 var defineProperty = __webpack_require__(65);
2205
2206 /**
2207 * The base implementation of `assignValue` and `assignMergeValue` without
2208 * value checks.
2209 *
2210 * @private
2211 * @param {Object} object The object to modify.
2212 * @param {string} key The key of the property to assign.
2213 * @param {*} value The value to assign.
2214 */
2215 function baseAssignValue(object, key, value) {
2216 if (key == '__proto__' && defineProperty) {
2217 defineProperty(object, key, {
2218 'configurable': true,
2219 'enumerable': true,
2220 'value': value,
2221 'writable': true
2222 });
2223 } else {
2224 object[key] = value;
2225 }
2226 }
2227
2228 module.exports = baseAssignValue;
2229
2230 /***/
2231 },
2232 /* 39 */
2233 /***/function (module, exports, __webpack_require__) {
2234
2235 var arrayFilter = __webpack_require__(167),
2236 stubArray = __webpack_require__(69);
2237
2238 /** Used for built-in method references. */
2239 var objectProto = Object.prototype;
2240
2241 /** Built-in value references. */
2242 var propertyIsEnumerable = objectProto.propertyIsEnumerable;
2243
2244 /* Built-in method references for those with the same name as other `lodash` methods. */
2245 var nativeGetSymbols = Object.getOwnPropertySymbols;
2246
2247 /**
2248 * Creates an array of the own enumerable symbols of `object`.
2249 *
2250 * @private
2251 * @param {Object} object The object to query.
2252 * @returns {Array} Returns the array of symbols.
2253 */
2254 var getSymbols = !nativeGetSymbols ? stubArray : function (object) {
2255 if (object == null) {
2256 return [];
2257 }
2258 object = Object(object);
2259 return arrayFilter(nativeGetSymbols(object), function (symbol) {
2260 return propertyIsEnumerable.call(object, symbol);
2261 });
2262 };
2263
2264 module.exports = getSymbols;
2265
2266 /***/
2267 },
2268 /* 40 */
2269 /***/function (module, exports, __webpack_require__) {
2270
2271 var overArg = __webpack_require__(58);
2272
2273 /** Built-in value references. */
2274 var getPrototype = overArg(Object.getPrototypeOf, Object);
2275
2276 module.exports = getPrototype;
2277
2278 /***/
2279 },
2280 /* 41 */
2281 /***/function (module, exports, __webpack_require__) {
2282
2283 var Uint8Array = __webpack_require__(74);
2284
2285 /**
2286 * Creates a clone of `arrayBuffer`.
2287 *
2288 * @private
2289 * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
2290 * @returns {ArrayBuffer} Returns the cloned array buffer.
2291 */
2292 function cloneArrayBuffer(arrayBuffer) {
2293 var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
2294 new Uint8Array(result).set(new Uint8Array(arrayBuffer));
2295 return result;
2296 }
2297
2298 module.exports = cloneArrayBuffer;
2299
2300 /***/
2301 },
2302 /* 42 */
2303 /***/function (module, exports) {
2304
2305 /**
2306 * Converts `map` to its key-value pairs.
2307 *
2308 * @private
2309 * @param {Object} map The map to convert.
2310 * @returns {Array} Returns the key-value pairs.
2311 */
2312 function mapToArray(map) {
2313 var index = -1,
2314 result = Array(map.size);
2315
2316 map.forEach(function (value, key) {
2317 result[++index] = [key, value];
2318 });
2319 return result;
2320 }
2321
2322 module.exports = mapToArray;
2323
2324 /***/
2325 },
2326 /* 43 */
2327 /***/function (module, exports) {
2328
2329 /**
2330 * Converts `set` to an array of its values.
2331 *
2332 * @private
2333 * @param {Object} set The set to convert.
2334 * @returns {Array} Returns the values.
2335 */
2336 function setToArray(set) {
2337 var index = -1,
2338 result = Array(set.size);
2339
2340 set.forEach(function (value) {
2341 result[++index] = value;
2342 });
2343 return result;
2344 }
2345
2346 module.exports = setToArray;
2347
2348 /***/
2349 },
2350 /* 44 */
2351 /***/function (module, exports) {
2352
2353 /**
2354 * This method returns the first argument it receives.
2355 *
2356 * @static
2357 * @since 0.1.0
2358 * @memberOf _
2359 * @category Util
2360 * @param {*} value Any value.
2361 * @returns {*} Returns `value`.
2362 * @example
2363 *
2364 * var object = { 'a': 1 };
2365 *
2366 * console.log(_.identity(object) === object);
2367 * // => true
2368 */
2369 function identity(value) {
2370 return value;
2371 }
2372
2373 module.exports = identity;
2374
2375 /***/
2376 },
2377 /* 45 */
2378 /***/function (module, __webpack_exports__, __webpack_require__) {
2379
2380 "use strict";
2381 /* harmony export (binding) */
2382 __webpack_require__.d(__webpack_exports__, "b", function () {
2383 return EPSILON;
2384 });
2385 /* harmony export (binding) */__webpack_require__.d(__webpack_exports__, "a", function () {
2386 return ARRAY_TYPE;
2387 });
2388 /* harmony export (binding) */__webpack_require__.d(__webpack_exports__, "c", function () {
2389 return RANDOM;
2390 });
2391 /* unused harmony export setMatrixArrayType */
2392 /* unused harmony export toRadian */
2393 /* unused harmony export equals */
2394 /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.
2395
2396 Permission is hereby granted, free of charge, to any person obtaining a copy
2397 of this software and associated documentation files (the "Software"), to deal
2398 in the Software without restriction, including without limitation the rights
2399 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2400 copies of the Software, and to permit persons to whom the Software is
2401 furnished to do so, subject to the following conditions:
2402
2403 The above copyright notice and this permission notice shall be included in
2404 all copies or substantial portions of the Software.
2405
2406 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2407 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2408 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2409 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2410 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2411 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2412 THE SOFTWARE. */
2413
2414 /**
2415 * Common utilities
2416 * @module glMatrix
2417 */
2418
2419 // Configuration Constants
2420 var EPSILON = 0.000001;
2421 var ARRAY_TYPE = typeof Float32Array !== 'undefined' ? Float32Array : Array;
2422 var RANDOM = Math.random;
2423
2424 /**
2425 * Sets the type of array used when creating new vectors and matrices
2426 *
2427 * @param {Type} type Array type, such as Float32Array or Array
2428 */
2429 function setMatrixArrayType(type) {
2430 ARRAY_TYPE = type;
2431 }
2432
2433 var degree = Math.PI / 180;
2434
2435 /**
2436 * Convert Degree To Radian
2437 *
2438 * @param {Number} a Angle in Degrees
2439 */
2440 function toRadian(a) {
2441 return a * degree;
2442 }
2443
2444 /**
2445 * Tests whether or not the arguments have approximately the same value, within an absolute
2446 * or relative tolerance of glMatrix.EPSILON (an absolute tolerance is used for values less
2447 * than or equal to 1.0, and a relative tolerance is used for larger values)
2448 *
2449 * @param {Number} a The first number to test.
2450 * @param {Number} b The second number to test.
2451 * @returns {Boolean} True if the numbers are approximately equal, false otherwise.
2452 */
2453 function equals(a, b) {
2454 return Math.abs(a - b) <= EPSILON * Math.max(1.0, Math.abs(a), Math.abs(b));
2455 }
2456
2457 /***/
2458 },
2459 /* 46 */
2460 /***/function (module, exports, __webpack_require__) {
2461
2462 var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) {
2463 return typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
2464 } : function (obj) {
2465 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
2466 };
2467
2468 var Util = __webpack_require__(31);
2469 var SPACES = '\t\n\x0B\f\r \xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029';
2470 var PATH_COMMAND = new RegExp('([a-z])[' + SPACES + ',]*((-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?[' + SPACES + ']*,?[' + SPACES + ']*)+)', 'ig');
2471 var PATH_VALUES = new RegExp('(-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?)[' + SPACES + ']*,?[' + SPACES + ']*', 'ig');
2472
2473 // Parses given path string into an array of arrays of path segments
2474 var parsePathString = function parsePathString(pathString) {
2475 if (!pathString) {
2476 return null;
2477 }
2478
2479 if ((typeof pathString === 'undefined' ? 'undefined' : _typeof(pathString)) === _typeof([])) {
2480 return pathString;
2481 }
2482 var paramCounts = {
2483 a: 7,
2484 c: 6,
2485 o: 2,
2486 h: 1,
2487 l: 2,
2488 m: 2,
2489 r: 4,
2490 q: 4,
2491 s: 4,
2492 t: 2,
2493 v: 1,
2494 u: 3,
2495 z: 0
2496 };
2497 var data = [];
2498
2499 String(pathString).replace(PATH_COMMAND, function (a, b, c) {
2500 var params = [];
2501 var name = b.toLowerCase();
2502 c.replace(PATH_VALUES, function (a, b) {
2503 b && params.push(+b);
2504 });
2505 if (name === 'm' && params.length > 2) {
2506 data.push([b].concat(params.splice(0, 2)));
2507 name = 'l';
2508 b = b === 'm' ? 'l' : 'L';
2509 }
2510 if (name === 'o' && params.length === 1) {
2511 data.push([b, params[0]]);
2512 }
2513 if (name === 'r') {
2514 data.push([b].concat(params));
2515 } else {
2516 while (params.length >= paramCounts[name]) {
2517 data.push([b].concat(params.splice(0, paramCounts[name])));
2518 if (!paramCounts[name]) {
2519 break;
2520 }
2521 }
2522 }
2523 });
2524
2525 return data;
2526 };
2527
2528 // http://schepers.cc/getting-to-the-point
2529 var catmullRom2bezier = function catmullRom2bezier(crp, z) {
2530 var d = [];
2531 for (var i = 0, iLen = crp.length; iLen - 2 * !z > i; i += 2) {
2532 var p = [{
2533 x: +crp[i - 2],
2534 y: +crp[i - 1]
2535 }, {
2536 x: +crp[i],
2537 y: +crp[i + 1]
2538 }, {
2539 x: +crp[i + 2],
2540 y: +crp[i + 3]
2541 }, {
2542 x: +crp[i + 4],
2543 y: +crp[i + 5]
2544 }];
2545 if (z) {
2546 if (!i) {
2547 p[0] = {
2548 x: +crp[iLen - 2],
2549 y: +crp[iLen - 1]
2550 };
2551 } else if (iLen - 4 === i) {
2552 p[3] = {
2553 x: +crp[0],
2554 y: +crp[1]
2555 };
2556 } else if (iLen - 2 === i) {
2557 p[2] = {
2558 x: +crp[0],
2559 y: +crp[1]
2560 };
2561 p[3] = {
2562 x: +crp[2],
2563 y: +crp[3]
2564 };
2565 }
2566 } else {
2567 if (iLen - 4 === i) {
2568 p[3] = p[2];
2569 } else if (!i) {
2570 p[0] = {
2571 x: +crp[i],
2572 y: +crp[i + 1]
2573 };
2574 }
2575 }
2576 d.push(['C', (-p[0].x + 6 * p[1].x + p[2].x) / 6, (-p[0].y + 6 * p[1].y + p[2].y) / 6, (p[1].x + 6 * p[2].x - p[3].x) / 6, (p[1].y + 6 * p[2].y - p[3].y) / 6, p[2].x, p[2].y]);
2577 }
2578
2579 return d;
2580 };
2581
2582 var ellipsePath = function ellipsePath(x, y, rx, ry, a) {
2583 var res = [];
2584 if (a === null && ry === null) {
2585 ry = rx;
2586 }
2587 x = +x;
2588 y = +y;
2589 rx = +rx;
2590 ry = +ry;
2591 if (a !== null) {
2592 var rad = Math.PI / 180;
2593 var x1 = x + rx * Math.cos(-ry * rad);
2594 var x2 = x + rx * Math.cos(-a * rad);
2595 var y1 = y + rx * Math.sin(-ry * rad);
2596 var y2 = y + rx * Math.sin(-a * rad);
2597 res = [['M', x1, y1], ['A', rx, rx, 0, +(a - ry > 180), 0, x2, y2]];
2598 } else {
2599 res = [['M', x, y], ['m', 0, -ry], ['a', rx, ry, 0, 1, 1, 0, 2 * ry], ['a', rx, ry, 0, 1, 1, 0, -2 * ry], ['z']];
2600 }
2601 return res;
2602 };
2603
2604 var pathToAbsolute = function pathToAbsolute(pathArray) {
2605 pathArray = parsePathString(pathArray);
2606
2607 if (!pathArray || !pathArray.length) {
2608 return [['M', 0, 0]];
2609 }
2610 var res = [];
2611 var x = 0;
2612 var y = 0;
2613 var mx = 0;
2614 var my = 0;
2615 var start = 0;
2616 var pa0 = void 0;
2617 var dots = void 0;
2618 if (pathArray[0][0] === 'M') {
2619 x = +pathArray[0][1];
2620 y = +pathArray[0][2];
2621 mx = x;
2622 my = y;
2623 start++;
2624 res[0] = ['M', x, y];
2625 }
2626 var crz = pathArray.length === 3 && pathArray[0][0] === 'M' && pathArray[1][0].toUpperCase() === 'R' && pathArray[2][0].toUpperCase() === 'Z';
2627 for (var r, pa, i = start, ii = pathArray.length; i < ii; i++) {
2628 res.push(r = []);
2629 pa = pathArray[i];
2630 pa0 = pa[0];
2631 if (pa0 !== pa0.toUpperCase()) {
2632 r[0] = pa0.toUpperCase();
2633 switch (r[0]) {
2634 case 'A':
2635 r[1] = pa[1];
2636 r[2] = pa[2];
2637 r[3] = pa[3];
2638 r[4] = pa[4];
2639 r[5] = pa[5];
2640 r[6] = +pa[6] + x;
2641 r[7] = +pa[7] + y;
2642 break;
2643 case 'V':
2644 r[1] = +pa[1] + y;
2645 break;
2646 case 'H':
2647 r[1] = +pa[1] + x;
2648 break;
2649 case 'R':
2650 dots = [x, y].concat(pa.slice(1));
2651 for (var j = 2, jj = dots.length; j < jj; j++) {
2652 dots[j] = +dots[j] + x;
2653 dots[++j] = +dots[j] + y;
2654 }
2655 res.pop();
2656 res = res.concat(catmullRom2bezier(dots, crz));
2657 break;
2658 case 'O':
2659 res.pop();
2660 dots = ellipsePath(x, y, pa[1], pa[2]);
2661 dots.push(dots[0]);
2662 res = res.concat(dots);
2663 break;
2664 case 'U':
2665 res.pop();
2666 res = res.concat(ellipsePath(x, y, pa[1], pa[2], pa[3]));
2667 r = ['U'].concat(res[res.length - 1].slice(-2));
2668 break;
2669 case 'M':
2670 mx = +pa[1] + x;
2671 my = +pa[2] + y;
2672 break; // for lint
2673 default:
2674 for (var _j = 1, _jj = pa.length; _j < _jj; _j++) {
2675 r[_j] = +pa[_j] + (_j % 2 ? x : y);
2676 }
2677 }
2678 } else if (pa0 === 'R') {
2679 dots = [x, y].concat(pa.slice(1));
2680 res.pop();
2681 res = res.concat(catmullRom2bezier(dots, crz));
2682 r = ['R'].concat(pa.slice(-2));
2683 } else if (pa0 === 'O') {
2684 res.pop();
2685 dots = ellipsePath(x, y, pa[1], pa[2]);
2686 dots.push(dots[0]);
2687 res = res.concat(dots);
2688 } else if (pa0 === 'U') {
2689 res.pop();
2690 res = res.concat(ellipsePath(x, y, pa[1], pa[2], pa[3]));
2691 r = ['U'].concat(res[res.length - 1].slice(-2));
2692 } else {
2693 for (var k = 0, kk = pa.length; k < kk; k++) {
2694 r[k] = pa[k];
2695 }
2696 }
2697 pa0 = pa0.toUpperCase();
2698 if (pa0 !== 'O') {
2699 switch (r[0]) {
2700 case 'Z':
2701 x = +mx;
2702 y = +my;
2703 break;
2704 case 'H':
2705 x = r[1];
2706 break;
2707 case 'V':
2708 y = r[1];
2709 break;
2710 case 'M':
2711 mx = r[r.length - 2];
2712 my = r[r.length - 1];
2713 break; // for lint
2714 default:
2715 x = r[r.length - 2];
2716 y = r[r.length - 1];
2717 }
2718 }
2719 }
2720
2721 return res;
2722 };
2723
2724 var l2c = function l2c(x1, y1, x2, y2) {
2725 return [x1, y1, x2, y2, x2, y2];
2726 };
2727
2728 var q2c = function q2c(x1, y1, ax, ay, x2, y2) {
2729 var _13 = 1 / 3;
2730 var _23 = 2 / 3;
2731 return [_13 * x1 + _23 * ax, _13 * y1 + _23 * ay, _13 * x2 + _23 * ax, _13 * y2 + _23 * ay, x2, y2];
2732 };
2733
2734 var a2c = function a2c(x1, y1, rx, ry, angle, large_arc_flag, sweep_flag, x2, y2, recursive) {
2735 // for more information of where this math came from visit:
2736 // http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes
2737 if (rx === ry) {
2738 rx += 1;
2739 }
2740
2741 var _120 = Math.PI * 120 / 180;
2742 var rad = Math.PI / 180 * (+angle || 0);
2743 var res = [];
2744 var xy = void 0;
2745 var f1 = void 0;
2746 var f2 = void 0;
2747 var cx = void 0;
2748 var cy = void 0;
2749 var rotate = function rotate(x, y, rad) {
2750 var X = x * Math.cos(rad) - y * Math.sin(rad);
2751 var Y = x * Math.sin(rad) + y * Math.cos(rad);
2752 return {
2753 x: X,
2754 y: Y
2755 };
2756 };
2757 if (!recursive) {
2758 xy = rotate(x1, y1, -rad);
2759 x1 = xy.x;
2760 y1 = xy.y;
2761 xy = rotate(x2, y2, -rad);
2762 x2 = xy.x;
2763 y2 = xy.y;
2764 if (x1 === x2 && y1 === y2) {
2765 // 若弧的起始点和终点重叠则错开一点
2766 x2 += 1;
2767 y2 += 1;
2768 }
2769 // const cos = Math.cos(Math.PI / 180 * angle);
2770 // const sin = Math.sin(Math.PI / 180 * angle);
2771 var x = (x1 - x2) / 2;
2772 var y = (y1 - y2) / 2;
2773 var h = x * x / (rx * rx) + y * y / (ry * ry);
2774 if (h > 1) {
2775 h = Math.sqrt(h);
2776 rx = h * rx;
2777 ry = h * ry;
2778 }
2779 var rx2 = rx * rx;
2780 var ry2 = ry * ry;
2781 var k = (large_arc_flag === sweep_flag ? -1 : 1) * Math.sqrt(Math.abs((rx2 * ry2 - rx2 * y * y - ry2 * x * x) / (rx2 * y * y + ry2 * x * x)));
2782 cx = k * rx * y / ry + (x1 + x2) / 2;
2783 cy = k * -ry * x / rx + (y1 + y2) / 2;
2784 f1 = Math.asin(((y1 - cy) / ry).toFixed(9));
2785 f2 = Math.asin(((y2 - cy) / ry).toFixed(9));
2786
2787 f1 = x1 < cx ? Math.PI - f1 : f1;
2788 f2 = x2 < cx ? Math.PI - f2 : f2;
2789 f1 < 0 && (f1 = Math.PI * 2 + f1);
2790 f2 < 0 && (f2 = Math.PI * 2 + f2);
2791 if (sweep_flag && f1 > f2) {
2792 f1 = f1 - Math.PI * 2;
2793 }
2794 if (!sweep_flag && f2 > f1) {
2795 f2 = f2 - Math.PI * 2;
2796 }
2797 } else {
2798 f1 = recursive[0];
2799 f2 = recursive[1];
2800 cx = recursive[2];
2801 cy = recursive[3];
2802 }
2803 var df = f2 - f1;
2804 if (Math.abs(df) > _120) {
2805 var f2old = f2;
2806 var x2old = x2;
2807 var y2old = y2;
2808 f2 = f1 + _120 * (sweep_flag && f2 > f1 ? 1 : -1);
2809 x2 = cx + rx * Math.cos(f2);
2810 y2 = cy + ry * Math.sin(f2);
2811 res = a2c(x2, y2, rx, ry, angle, 0, sweep_flag, x2old, y2old, [f2, f2old, cx, cy]);
2812 }
2813 df = f2 - f1;
2814 var c1 = Math.cos(f1);
2815 var s1 = Math.sin(f1);
2816 var c2 = Math.cos(f2);
2817 var s2 = Math.sin(f2);
2818 var t = Math.tan(df / 4);
2819 var hx = 4 / 3 * rx * t;
2820 var hy = 4 / 3 * ry * t;
2821 var m1 = [x1, y1];
2822 var m2 = [x1 + hx * s1, y1 - hy * c1];
2823 var m3 = [x2 + hx * s2, y2 - hy * c2];
2824 var m4 = [x2, y2];
2825 m2[0] = 2 * m1[0] - m2[0];
2826 m2[1] = 2 * m1[1] - m2[1];
2827 if (recursive) {
2828 return [m2, m3, m4].concat(res);
2829 }
2830 res = [m2, m3, m4].concat(res).join().split(',');
2831 var newres = [];
2832 for (var i = 0, ii = res.length; i < ii; i++) {
2833 newres[i] = i % 2 ? rotate(res[i - 1], res[i], rad).y : rotate(res[i], res[i + 1], rad).x;
2834 }
2835 return newres;
2836 };
2837
2838 var pathTocurve = function pathTocurve(path, path2) {
2839 var pcoms1 = []; // path commands of original path p
2840 var pcoms2 = []; // path commands of original path p2
2841 var p = pathToAbsolute(path);
2842 var p2 = path2 && pathToAbsolute(path2);
2843 var attrs = {
2844 x: 0,
2845 y: 0,
2846 bx: 0,
2847 by: 0,
2848 X: 0,
2849 Y: 0,
2850 qx: null,
2851 qy: null
2852 };
2853 var attrs2 = {
2854 x: 0,
2855 y: 0,
2856 bx: 0,
2857 by: 0,
2858 X: 0,
2859 Y: 0,
2860 qx: null,
2861 qy: null
2862 };
2863 var processPath = function processPath(path, d, pcom) {
2864 var nx = void 0;
2865 var ny = void 0;
2866 if (!path) {
2867 return ['C', d.x, d.y, d.x, d.y, d.x, d.y];
2868 }!(path[0] in {
2869 T: 1,
2870 Q: 1
2871 }) && (d.qx = d.qy = null);
2872 switch (path[0]) {
2873 case 'M':
2874 d.X = path[1];
2875 d.Y = path[2];
2876 break;
2877 case 'A':
2878 path = ['C'].concat(a2c.apply(0, [d.x, d.y].concat(path.slice(1))));
2879 break;
2880 case 'S':
2881 if (pcom === 'C' || pcom === 'S') {
2882 // In "S" case we have to take into account, if the previous command is C/S.
2883 nx = d.x * 2 - d.bx; // And reflect the previous
2884 ny = d.y * 2 - d.by; // command's control point relative to the current point.
2885 } else {
2886 // or some else or nothing
2887 nx = d.x;
2888 ny = d.y;
2889 }
2890 path = ['C', nx, ny].concat(path.slice(1));
2891 break;
2892 case 'T':
2893 if (pcom === 'Q' || pcom === 'T') {
2894 // In "T" case we have to take into account, if the previous command is Q/T.
2895 d.qx = d.x * 2 - d.qx; // And make a reflection similar
2896 d.qy = d.y * 2 - d.qy; // to case "S".
2897 } else {
2898 // or something else or nothing
2899 d.qx = d.x;
2900 d.qy = d.y;
2901 }
2902 path = ['C'].concat(q2c(d.x, d.y, d.qx, d.qy, path[1], path[2]));
2903 break;
2904 case 'Q':
2905 d.qx = path[1];
2906 d.qy = path[2];
2907 path = ['C'].concat(q2c(d.x, d.y, path[1], path[2], path[3], path[4]));
2908 break;
2909 case 'L':
2910 path = ['C'].concat(l2c(d.x, d.y, path[1], path[2]));
2911 break;
2912 case 'H':
2913 path = ['C'].concat(l2c(d.x, d.y, path[1], d.y));
2914 break;
2915 case 'V':
2916 path = ['C'].concat(l2c(d.x, d.y, d.x, path[1]));
2917 break;
2918 case 'Z':
2919 path = ['C'].concat(l2c(d.x, d.y, d.X, d.Y));
2920 break;
2921 default:
2922 path = []; // for lint
2923 }
2924 return path;
2925 };
2926 var fixArc = function fixArc(pp, i) {
2927 if (pp[i].length > 7) {
2928 pp[i].shift();
2929 var pi = pp[i];
2930 while (pi.length) {
2931 pcoms1[i] = 'A'; // if created multiple C:s, their original seg is saved
2932 p2 && (pcoms2[i] = 'A'); // the same as above
2933 pp.splice(i++, 0, ['C'].concat(pi.splice(0, 6)));
2934 }
2935 pp.splice(i, 1);
2936 // ii = Math.max(p.length, p2 && p2.length || 0);
2937 }
2938 };
2939 var fixM = function fixM(path1, path2, a1, a2, i) {
2940 if (path1 && path2 && path1[i][0] === 'M' && path2[i][0] !== 'M') {
2941 path2.splice(i, 0, ['M', a2.x, a2.y]);
2942 a1.bx = 0;
2943 a1.by = 0;
2944 a1.x = path1[i][1];
2945 a1.y = path1[i][2];
2946 // ii = Math.max(p.length, p2 && p2.length || 0);
2947 }
2948 };
2949 var pfirst = ''; // temporary holder for original path command
2950 var pcom = ''; // holder for previous path command of original path
2951 for (var i = 0, ii = Math.max(p.length, p2 && p2.length || 0); i < ii; i++) {
2952 p[i] && (pfirst = p[i][0]); // save current path command
2953
2954 if (pfirst !== 'C') {
2955 // C is not saved yet, because it may be result of conversion
2956 pcoms1[i] = pfirst; // Save current path command
2957 i && (pcom = pcoms1[i - 1]); // Get previous path command pcom
2958 }
2959 p[i] = processPath(p[i], attrs, pcom); // Previous path command is inputted to processPath
2960
2961 if (pcoms1[i] !== 'A' && pfirst === 'C') pcoms1[i] = 'C'; // A is the only command
2962 // which may produce multiple C:s
2963 // so we have to make sure that C is also C in original path
2964
2965 fixArc(p, i); // fixArc adds also the right amount of A:s to pcoms1
2966
2967 if (p2) {
2968 // the same procedures is done to p2
2969 p2[i] && (pfirst = p2[i][0]);
2970 if (pfirst !== 'C') {
2971 pcoms2[i] = pfirst;
2972 i && (pcom = pcoms2[i - 1]);
2973 }
2974 p2[i] = processPath(p2[i], attrs2, pcom);
2975
2976 if (pcoms2[i] !== 'A' && pfirst === 'C') {
2977 pcoms2[i] = 'C';
2978 }
2979
2980 fixArc(p2, i);
2981 }
2982 fixM(p, p2, attrs, attrs2, i);
2983 fixM(p2, p, attrs2, attrs, i);
2984 var seg = p[i];
2985 var seg2 = p2 && p2[i];
2986 var seglen = seg.length;
2987 var seg2len = p2 && seg2.length;
2988 attrs.x = seg[seglen - 2];
2989 attrs.y = seg[seglen - 1];
2990 attrs.bx = parseFloat(seg[seglen - 4]) || attrs.x;
2991 attrs.by = parseFloat(seg[seglen - 3]) || attrs.y;
2992 attrs2.bx = p2 && (parseFloat(seg2[seg2len - 4]) || attrs2.x);
2993 attrs2.by = p2 && (parseFloat(seg2[seg2len - 3]) || attrs2.y);
2994 attrs2.x = p2 && seg2[seg2len - 2];
2995 attrs2.y = p2 && seg2[seg2len - 1];
2996 }
2997
2998 return p2 ? [p, p2] : p;
2999 };
3000
3001 var p2s = /,?([a-z]),?/gi;
3002 var parsePathArray = function parsePathArray(path) {
3003 return path.join(',').replace(p2s, '$1');
3004 };
3005
3006 var base3 = function base3(t, p1, p2, p3, p4) {
3007 var t1 = -3 * p1 + 9 * p2 - 9 * p3 + 3 * p4;
3008 var t2 = t * t1 + 6 * p1 - 12 * p2 + 6 * p3;
3009 return t * t2 - 3 * p1 + 3 * p2;
3010 };
3011
3012 var bezlen = function bezlen(x1, y1, x2, y2, x3, y3, x4, y4, z) {
3013 if (z === null) {
3014 z = 1;
3015 }
3016 z = z > 1 ? 1 : z < 0 ? 0 : z;
3017 var z2 = z / 2;
3018 var n = 12;
3019 var Tvalues = [-0.1252, 0.1252, -0.3678, 0.3678, -0.5873, 0.5873, -0.7699, 0.7699, -0.9041, 0.9041, -0.9816, 0.9816];
3020 var Cvalues = [0.2491, 0.2491, 0.2335, 0.2335, 0.2032, 0.2032, 0.1601, 0.1601, 0.1069, 0.1069, 0.0472, 0.0472];
3021 var sum = 0;
3022 for (var i = 0; i < n; i++) {
3023 var ct = z2 * Tvalues[i] + z2;
3024 var xbase = base3(ct, x1, x2, x3, x4);
3025 var ybase = base3(ct, y1, y2, y3, y4);
3026 var comb = xbase * xbase + ybase * ybase;
3027 sum += Cvalues[i] * Math.sqrt(comb);
3028 }
3029 return z2 * sum;
3030 };
3031
3032 var curveDim = function curveDim(x0, y0, x1, y1, x2, y2, x3, y3) {
3033 var tvalues = [];
3034 var bounds = [[], []];
3035 var a = void 0;
3036 var b = void 0;
3037 var c = void 0;
3038 var t = void 0;
3039
3040 for (var i = 0; i < 2; ++i) {
3041 if (i === 0) {
3042 b = 6 * x0 - 12 * x1 + 6 * x2;
3043 a = -3 * x0 + 9 * x1 - 9 * x2 + 3 * x3;
3044 c = 3 * x1 - 3 * x0;
3045 } else {
3046 b = 6 * y0 - 12 * y1 + 6 * y2;
3047 a = -3 * y0 + 9 * y1 - 9 * y2 + 3 * y3;
3048 c = 3 * y1 - 3 * y0;
3049 }
3050 if (Math.abs(a) < 1e-12) {
3051 if (Math.abs(b) < 1e-12) {
3052 continue;
3053 }
3054 t = -c / b;
3055 if (t > 0 && t < 1) {
3056 tvalues.push(t);
3057 }
3058 continue;
3059 }
3060 var b2ac = b * b - 4 * c * a;
3061 var sqrtb2ac = Math.sqrt(b2ac);
3062 if (b2ac < 0) {
3063 continue;
3064 }
3065 var t1 = (-b + sqrtb2ac) / (2 * a);
3066 if (t1 > 0 && t1 < 1) {
3067 tvalues.push(t1);
3068 }
3069 var t2 = (-b - sqrtb2ac) / (2 * a);
3070 if (t2 > 0 && t2 < 1) {
3071 tvalues.push(t2);
3072 }
3073 }
3074
3075 var j = tvalues.length;
3076 var jlen = j;
3077 var mt = void 0;
3078 while (j--) {
3079 t = tvalues[j];
3080 mt = 1 - t;
3081 bounds[0][j] = mt * mt * mt * x0 + 3 * mt * mt * t * x1 + 3 * mt * t * t * x2 + t * t * t * x3;
3082 bounds[1][j] = mt * mt * mt * y0 + 3 * mt * mt * t * y1 + 3 * mt * t * t * y2 + t * t * t * y3;
3083 }
3084
3085 bounds[0][jlen] = x0;
3086 bounds[1][jlen] = y0;
3087 bounds[0][jlen + 1] = x3;
3088 bounds[1][jlen + 1] = y3;
3089 bounds[0].length = bounds[1].length = jlen + 2;
3090
3091 return {
3092 min: {
3093 x: Math.min.apply(0, bounds[0]),
3094 y: Math.min.apply(0, bounds[1])
3095 },
3096 max: {
3097 x: Math.max.apply(0, bounds[0]),
3098 y: Math.max.apply(0, bounds[1])
3099 }
3100 };
3101 };
3102
3103 var intersect = function intersect(x1, y1, x2, y2, x3, y3, x4, y4) {
3104 if (Math.max(x1, x2) < Math.min(x3, x4) || Math.min(x1, x2) > Math.max(x3, x4) || Math.max(y1, y2) < Math.min(y3, y4) || Math.min(y1, y2) > Math.max(y3, y4)) {
3105 return;
3106 }
3107 var nx = (x1 * y2 - y1 * x2) * (x3 - x4) - (x1 - x2) * (x3 * y4 - y3 * x4);
3108 var ny = (x1 * y2 - y1 * x2) * (y3 - y4) - (y1 - y2) * (x3 * y4 - y3 * x4);
3109 var denominator = (x1 - x2) * (y3 - y4) - (y1 - y2) * (x3 - x4);
3110
3111 if (!denominator) {
3112 return;
3113 }
3114 var px = nx / denominator;
3115 var py = ny / denominator;
3116 var px2 = +px.toFixed(2);
3117 var py2 = +py.toFixed(2);
3118 if (px2 < +Math.min(x1, x2).toFixed(2) || px2 > +Math.max(x1, x2).toFixed(2) || px2 < +Math.min(x3, x4).toFixed(2) || px2 > +Math.max(x3, x4).toFixed(2) || py2 < +Math.min(y1, y2).toFixed(2) || py2 > +Math.max(y1, y2).toFixed(2) || py2 < +Math.min(y3, y4).toFixed(2) || py2 > +Math.max(y3, y4).toFixed(2)) {
3119 return;
3120 }
3121 return {
3122 x: px,
3123 y: py
3124 };
3125 };
3126
3127 var isPointInsideBBox = function isPointInsideBBox(bbox, x, y) {
3128 return x >= bbox.x && x <= bbox.x + bbox.width && y >= bbox.y && y <= bbox.y + bbox.height;
3129 };
3130
3131 var rectPath = function rectPath(x, y, w, h, r) {
3132 if (r) {
3133 return [['M', +x + +r, y], ['l', w - r * 2, 0], ['a', r, r, 0, 0, 1, r, r], ['l', 0, h - r * 2], ['a', r, r, 0, 0, 1, -r, r], ['l', r * 2 - w, 0], ['a', r, r, 0, 0, 1, -r, -r], ['l', 0, r * 2 - h], ['a', r, r, 0, 0, 1, r, -r], ['z']];
3134 }
3135 var res = [['M', x, y], ['l', w, 0], ['l', 0, h], ['l', -w, 0], ['z']];
3136 res.parsePathArray = parsePathArray;
3137 return res;
3138 };
3139
3140 var box = function box(x, y, width, height) {
3141 if (x === null) {
3142 x = y = width = height = 0;
3143 }
3144 if (y === null) {
3145 y = x.y;
3146 width = x.width;
3147 height = x.height;
3148 x = x.x;
3149 }
3150 return {
3151 x: x,
3152 y: y,
3153 width: width,
3154 w: width,
3155 height: height,
3156 h: height,
3157 x2: x + width,
3158 y2: y + height,
3159 cx: x + width / 2,
3160 cy: y + height / 2,
3161 r1: Math.min(width, height) / 2,
3162 r2: Math.max(width, height) / 2,
3163 r0: Math.sqrt(width * width + height * height) / 2,
3164 path: rectPath(x, y, width, height),
3165 vb: [x, y, width, height].join(' ')
3166 };
3167 };
3168
3169 var isBBoxIntersect = function isBBoxIntersect(bbox1, bbox2) {
3170 bbox1 = box(bbox1);
3171 bbox2 = box(bbox2);
3172 return isPointInsideBBox(bbox2, bbox1.x, bbox1.y) || isPointInsideBBox(bbox2, bbox1.x2, bbox1.y) || isPointInsideBBox(bbox2, bbox1.x, bbox1.y2) || isPointInsideBBox(bbox2, bbox1.x2, bbox1.y2) || isPointInsideBBox(bbox1, bbox2.x, bbox2.y) || isPointInsideBBox(bbox1, bbox2.x2, bbox2.y) || isPointInsideBBox(bbox1, bbox2.x, bbox2.y2) || isPointInsideBBox(bbox1, bbox2.x2, bbox2.y2) || (bbox1.x < bbox2.x2 && bbox1.x > bbox2.x || bbox2.x < bbox1.x2 && bbox2.x > bbox1.x) && (bbox1.y < bbox2.y2 && bbox1.y > bbox2.y || bbox2.y < bbox1.y2 && bbox2.y > bbox1.y);
3173 };
3174
3175 var bezierBBox = function bezierBBox(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y) {
3176 if (!Util.isArray(p1x)) {
3177 p1x = [p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y];
3178 }
3179 var bbox = curveDim.apply(null, p1x);
3180 return box(bbox.min.x, bbox.min.y, bbox.max.x - bbox.min.x, bbox.max.y - bbox.min.y);
3181 };
3182
3183 var findDotsAtSegment = function findDotsAtSegment(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t) {
3184 var t1 = 1 - t;
3185 var t13 = Math.pow(t1, 3);
3186 var t12 = Math.pow(t1, 2);
3187 var t2 = t * t;
3188 var t3 = t2 * t;
3189 var x = t13 * p1x + t12 * 3 * t * c1x + t1 * 3 * t * t * c2x + t3 * p2x;
3190 var y = t13 * p1y + t12 * 3 * t * c1y + t1 * 3 * t * t * c2y + t3 * p2y;
3191 var mx = p1x + 2 * t * (c1x - p1x) + t2 * (c2x - 2 * c1x + p1x);
3192 var my = p1y + 2 * t * (c1y - p1y) + t2 * (c2y - 2 * c1y + p1y);
3193 var nx = c1x + 2 * t * (c2x - c1x) + t2 * (p2x - 2 * c2x + c1x);
3194 var ny = c1y + 2 * t * (c2y - c1y) + t2 * (p2y - 2 * c2y + c1y);
3195 var ax = t1 * p1x + t * c1x;
3196 var ay = t1 * p1y + t * c1y;
3197 var cx = t1 * c2x + t * p2x;
3198 var cy = t1 * c2y + t * p2y;
3199 var alpha = 90 - Math.atan2(mx - nx, my - ny) * 180 / Math.PI;
3200 // (mx > nx || my < ny) && (alpha += 180);
3201 return {
3202 x: x,
3203 y: y,
3204 m: {
3205 x: mx,
3206 y: my
3207 },
3208 n: {
3209 x: nx,
3210 y: ny
3211 },
3212 start: {
3213 x: ax,
3214 y: ay
3215 },
3216 end: {
3217 x: cx,
3218 y: cy
3219 },
3220 alpha: alpha
3221 };
3222 };
3223
3224 var interHelper = function interHelper(bez1, bez2, justCount) {
3225 var bbox1 = bezierBBox(bez1);
3226 var bbox2 = bezierBBox(bez2);
3227 if (!isBBoxIntersect(bbox1, bbox2)) {
3228 return justCount ? 0 : [];
3229 }
3230 var l1 = bezlen.apply(0, bez1);
3231 var l2 = bezlen.apply(0, bez2);
3232 var n1 = ~~(l1 / 8);
3233 var n2 = ~~(l2 / 8);
3234 var dots1 = [];
3235 var dots2 = [];
3236 var xy = {};
3237 var res = justCount ? 0 : [];
3238 for (var i = 0; i < n1 + 1; i++) {
3239 var d = findDotsAtSegment.apply(0, bez1.concat(i / n1));
3240 dots1.push({
3241 x: d.x,
3242 y: d.y,
3243 t: i / n1
3244 });
3245 }
3246 for (var _i = 0; _i < n2 + 1; _i++) {
3247 var _d = findDotsAtSegment.apply(0, bez2.concat(_i / n2));
3248 dots2.push({
3249 x: _d.x,
3250 y: _d.y,
3251 t: _i / n2
3252 });
3253 }
3254 for (var _i2 = 0; _i2 < n1; _i2++) {
3255 for (var j = 0; j < n2; j++) {
3256 var di = dots1[_i2];
3257 var di1 = dots1[_i2 + 1];
3258 var dj = dots2[j];
3259 var dj1 = dots2[j + 1];
3260 var ci = Math.abs(di1.x - di.x) < 0.001 ? 'y' : 'x';
3261 var cj = Math.abs(dj1.x - dj.x) < 0.001 ? 'y' : 'x';
3262 var is = intersect(di.x, di.y, di1.x, di1.y, dj.x, dj.y, dj1.x, dj1.y);
3263 if (is) {
3264 if (xy[is.x.toFixed(4)] === is.y.toFixed(4)) {
3265 continue;
3266 }
3267 xy[is.x.toFixed(4)] = is.y.toFixed(4);
3268 var t1 = di.t + Math.abs((is[ci] - di[ci]) / (di1[ci] - di[ci])) * (di1.t - di.t);
3269 var t2 = dj.t + Math.abs((is[cj] - dj[cj]) / (dj1[cj] - dj[cj])) * (dj1.t - dj.t);
3270 if (t1 >= 0 && t1 <= 1 && t2 >= 0 && t2 <= 1) {
3271 if (justCount) {
3272 res++;
3273 } else {
3274 res.push({
3275 x: is.x,
3276 y: is.y,
3277 t1: t1,
3278 t2: t2
3279 });
3280 }
3281 }
3282 }
3283 }
3284 }
3285 return res;
3286 };
3287
3288 var interPathHelper = function interPathHelper(path1, path2, justCount) {
3289 path1 = pathTocurve(path1);
3290 path2 = pathTocurve(path2);
3291 var x1 = void 0;
3292 var y1 = void 0;
3293 var x2 = void 0;
3294 var y2 = void 0;
3295 var x1m = void 0;
3296 var y1m = void 0;
3297 var x2m = void 0;
3298 var y2m = void 0;
3299 var bez1 = void 0;
3300 var bez2 = void 0;
3301 var res = justCount ? 0 : [];
3302 for (var i = 0, ii = path1.length; i < ii; i++) {
3303 var pi = path1[i];
3304 if (pi[0] === 'M') {
3305 x1 = x1m = pi[1];
3306 y1 = y1m = pi[2];
3307 } else {
3308 if (pi[0] === 'C') {
3309 bez1 = [x1, y1].concat(pi.slice(1));
3310 x1 = bez1[6];
3311 y1 = bez1[7];
3312 } else {
3313 bez1 = [x1, y1, x1, y1, x1m, y1m, x1m, y1m];
3314 x1 = x1m;
3315 y1 = y1m;
3316 }
3317 for (var j = 0, jj = path2.length; j < jj; j++) {
3318 var pj = path2[j];
3319 if (pj[0] === 'M') {
3320 x2 = x2m = pj[1];
3321 y2 = y2m = pj[2];
3322 } else {
3323 if (pj[0] === 'C') {
3324 bez2 = [x2, y2].concat(pj.slice(1));
3325 x2 = bez2[6];
3326 y2 = bez2[7];
3327 } else {
3328 bez2 = [x2, y2, x2, y2, x2m, y2m, x2m, y2m];
3329 x2 = x2m;
3330 y2 = y2m;
3331 }
3332 var intr = interHelper(bez1, bez2, justCount);
3333 if (justCount) {
3334 res += intr;
3335 } else {
3336 for (var k = 0, kk = intr.length; k < kk; k++) {
3337 intr[k].segment1 = i;
3338 intr[k].segment2 = j;
3339 intr[k].bez1 = bez1;
3340 intr[k].bez2 = bez2;
3341 }
3342 res = res.concat(intr);
3343 }
3344 }
3345 }
3346 }
3347 }
3348 return res;
3349 };
3350
3351 var pathIntersection = function pathIntersection(path1, path2) {
3352 return interPathHelper(path1, path2);
3353 };
3354
3355 module.exports = {
3356 parsePathString: parsePathString,
3357 parsePathArray: parsePathArray,
3358 pathTocurve: pathTocurve,
3359 pathToAbsolute: pathToAbsolute,
3360 catmullRomToBezier: catmullRom2bezier,
3361 rectPath: rectPath,
3362 intersection: pathIntersection
3363 };
3364
3365 /***/
3366 },
3367 /* 47 */
3368 /***/function (module, __webpack_exports__, __webpack_require__) {
3369
3370 "use strict";
3371 /* harmony export (immutable) */
3372 __webpack_exports__["b"] = now;
3373 /* harmony export (immutable) */__webpack_exports__["a"] = Timer;
3374 /* harmony export (immutable) */__webpack_exports__["c"] = timer;
3375 /* harmony export (immutable) */__webpack_exports__["d"] = timerFlush;
3376 var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) {
3377 return typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
3378 } : function (obj) {
3379 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
3380 };
3381
3382 var frame = 0,
3383
3384 // is an animation frame pending?
3385 timeout = 0,
3386
3387 // is a timeout pending?
3388 interval = 0,
3389
3390 // are any timers active?
3391 pokeDelay = 1000,
3392
3393 // how frequently we check for clock skew
3394 taskHead,
3395 taskTail,
3396 clockLast = 0,
3397 clockNow = 0,
3398 clockSkew = 0,
3399 clock = (typeof performance === "undefined" ? "undefined" : _typeof(performance)) === "object" && performance.now ? performance : Date,
3400 setFrame = (typeof window === "undefined" ? "undefined" : _typeof(window)) === "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function (f) {
3401 setTimeout(f, 17);
3402 };
3403
3404 function now() {
3405 return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew);
3406 }
3407
3408 function clearNow() {
3409 clockNow = 0;
3410 }
3411
3412 function Timer() {
3413 this._call = this._time = this._next = null;
3414 }
3415
3416 Timer.prototype = timer.prototype = {
3417 constructor: Timer,
3418 restart: function restart(callback, delay, time) {
3419 if (typeof callback !== "function") throw new TypeError("callback is not a function");
3420 time = (time == null ? now() : +time) + (delay == null ? 0 : +delay);
3421 if (!this._next && taskTail !== this) {
3422 if (taskTail) taskTail._next = this;else taskHead = this;
3423 taskTail = this;
3424 }
3425 this._call = callback;
3426 this._time = time;
3427 sleep();
3428 },
3429 stop: function stop() {
3430 if (this._call) {
3431 this._call = null;
3432 this._time = Infinity;
3433 sleep();
3434 }
3435 }
3436 };
3437
3438 function timer(callback, delay, time) {
3439 var t = new Timer();
3440 t.restart(callback, delay, time);
3441 return t;
3442 }
3443
3444 function timerFlush() {
3445 now(); // Get the current time, if not already set.
3446 ++frame; // Pretend we’ve set an alarm, if we haven’t already.
3447 var t = taskHead,
3448 e;
3449 while (t) {
3450 if ((e = clockNow - t._time) >= 0) t._call.call(null, e);
3451 t = t._next;
3452 }
3453 --frame;
3454 }
3455
3456 function wake() {
3457 clockNow = (clockLast = clock.now()) + clockSkew;
3458 frame = timeout = 0;
3459 try {
3460 timerFlush();
3461 } finally {
3462 frame = 0;
3463 nap();
3464 clockNow = 0;
3465 }
3466 }
3467
3468 function poke() {
3469 var now = clock.now(),
3470 delay = now - clockLast;
3471 if (delay > pokeDelay) clockSkew -= delay, clockLast = now;
3472 }
3473
3474 function nap() {
3475 var t0,
3476 t1 = taskHead,
3477 t2,
3478 time = Infinity;
3479 while (t1) {
3480 if (t1._call) {
3481 if (time > t1._time) time = t1._time;
3482 t0 = t1, t1 = t1._next;
3483 } else {
3484 t2 = t1._next, t1._next = null;
3485 t1 = t0 ? t0._next = t2 : taskHead = t2;
3486 }
3487 }
3488 taskTail = t0;
3489 sleep(time);
3490 }
3491
3492 function sleep(time) {
3493 if (frame) return; // Soonest alarm already set, or will be.
3494 if (timeout) timeout = clearTimeout(timeout);
3495 var delay = time - clockNow; // Strictly less than if we recomputed clockNow.
3496 if (delay > 24) {
3497 if (time < Infinity) timeout = setTimeout(wake, time - clock.now() - clockSkew);
3498 if (interval) interval = clearInterval(interval);
3499 } else {
3500 if (!interval) clockLast = clock.now(), interval = setInterval(poke, pokeDelay);
3501 frame = 1, setFrame(wake);
3502 }
3503 }
3504
3505 /***/
3506 },
3507 /* 48 */
3508 /***/function (module, __webpack_exports__, __webpack_require__) {
3509
3510 "use strict";
3511 /* harmony import */
3512 var __WEBPACK_IMPORTED_MODULE_0_d3_color__ = __webpack_require__(14);
3513 /* harmony import */var __WEBPACK_IMPORTED_MODULE_1__rgb__ = __webpack_require__(90);
3514 /* harmony import */var __WEBPACK_IMPORTED_MODULE_2__array__ = __webpack_require__(93);
3515 /* harmony import */var __WEBPACK_IMPORTED_MODULE_3__date__ = __webpack_require__(94);
3516 /* harmony import */var __WEBPACK_IMPORTED_MODULE_4__number__ = __webpack_require__(29);
3517 /* harmony import */var __WEBPACK_IMPORTED_MODULE_5__object__ = __webpack_require__(95);
3518 /* harmony import */var __WEBPACK_IMPORTED_MODULE_6__string__ = __webpack_require__(96);
3519 /* harmony import */var __WEBPACK_IMPORTED_MODULE_7__constant__ = __webpack_require__(92);
3520 var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) {
3521 return typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
3522 } : function (obj) {
3523 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
3524 };
3525
3526 /* harmony default export */__webpack_exports__["a"] = function (a, b) {
3527 var t = typeof b === "undefined" ? "undefined" : _typeof(b),
3528 c;
3529 return b == null || t === "boolean" ? Object(__WEBPACK_IMPORTED_MODULE_7__constant__["a" /* default */])(b) : (t === "number" ? __WEBPACK_IMPORTED_MODULE_4__number__["a" /* default */] : t === "string" ? (c = Object(__WEBPACK_IMPORTED_MODULE_0_d3_color__["a" /* color */])(b)) ? (b = c, __WEBPACK_IMPORTED_MODULE_1__rgb__["a" /* default */]) : __WEBPACK_IMPORTED_MODULE_6__string__["a" /* default */] : b instanceof __WEBPACK_IMPORTED_MODULE_0_d3_color__["a" /* color */] ? __WEBPACK_IMPORTED_MODULE_1__rgb__["a" /* default */] : b instanceof Date ? __WEBPACK_IMPORTED_MODULE_3__date__["a" /* default */] : Array.isArray(b) ? __WEBPACK_IMPORTED_MODULE_2__array__["a" /* default */] : typeof b.valueOf !== "function" && typeof b.toString !== "function" || isNaN(b) ? __WEBPACK_IMPORTED_MODULE_5__object__["a" /* default */] : __WEBPACK_IMPORTED_MODULE_4__number__["a" /* default */])(a, b);
3530 };
3531
3532 /***/
3533 },
3534 /* 49 */
3535 /***/function (module, __webpack_exports__, __webpack_require__) {
3536
3537 "use strict";
3538 /* harmony export (immutable) */
3539 __webpack_exports__["a"] = Color;
3540 /* harmony export (binding) */__webpack_require__.d(__webpack_exports__, "d", function () {
3541 return _darker;
3542 });
3543 /* harmony export (binding) */__webpack_require__.d(__webpack_exports__, "c", function () {
3544 return _brighter;
3545 });
3546 /* harmony export (immutable) */__webpack_exports__["e"] = color;
3547 /* harmony export (immutable) */__webpack_exports__["h"] = rgbConvert;
3548 /* harmony export (immutable) */__webpack_exports__["g"] = rgb;
3549 /* harmony export (immutable) */__webpack_exports__["b"] = Rgb;
3550 /* unused harmony export hslConvert */
3551 /* harmony export (immutable) */__webpack_exports__["f"] = hsl;
3552 /* harmony import */var __WEBPACK_IMPORTED_MODULE_0__define__ = __webpack_require__(50);
3553
3554 function Color() {}
3555
3556 var _darker = 0.7;
3557
3558 var _brighter = 1 / _darker;
3559
3560 var reI = "\\s*([+-]?\\d+)\\s*",
3561 reN = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",
3562 reP = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",
3563 reHex3 = /^#([0-9a-f]{3})$/,
3564 reHex6 = /^#([0-9a-f]{6})$/,
3565 reRgbInteger = new RegExp("^rgb\\(" + [reI, reI, reI] + "\\)$"),
3566 reRgbPercent = new RegExp("^rgb\\(" + [reP, reP, reP] + "\\)$"),
3567 reRgbaInteger = new RegExp("^rgba\\(" + [reI, reI, reI, reN] + "\\)$"),
3568 reRgbaPercent = new RegExp("^rgba\\(" + [reP, reP, reP, reN] + "\\)$"),
3569 reHslPercent = new RegExp("^hsl\\(" + [reN, reP, reP] + "\\)$"),
3570 reHslaPercent = new RegExp("^hsla\\(" + [reN, reP, reP, reN] + "\\)$");
3571
3572 var named = {
3573 aliceblue: 0xf0f8ff,
3574 antiquewhite: 0xfaebd7,
3575 aqua: 0x00ffff,
3576 aquamarine: 0x7fffd4,
3577 azure: 0xf0ffff,
3578 beige: 0xf5f5dc,
3579 bisque: 0xffe4c4,
3580 black: 0x000000,
3581 blanchedalmond: 0xffebcd,
3582 blue: 0x0000ff,
3583 blueviolet: 0x8a2be2,
3584 brown: 0xa52a2a,
3585 burlywood: 0xdeb887,
3586 cadetblue: 0x5f9ea0,
3587 chartreuse: 0x7fff00,
3588 chocolate: 0xd2691e,
3589 coral: 0xff7f50,
3590 cornflowerblue: 0x6495ed,
3591 cornsilk: 0xfff8dc,
3592 crimson: 0xdc143c,
3593 cyan: 0x00ffff,
3594 darkblue: 0x00008b,
3595 darkcyan: 0x008b8b,
3596 darkgoldenrod: 0xb8860b,
3597 darkgray: 0xa9a9a9,
3598 darkgreen: 0x006400,
3599 darkgrey: 0xa9a9a9,
3600 darkkhaki: 0xbdb76b,
3601 darkmagenta: 0x8b008b,
3602 darkolivegreen: 0x556b2f,
3603 darkorange: 0xff8c00,
3604 darkorchid: 0x9932cc,
3605 darkred: 0x8b0000,
3606 darksalmon: 0xe9967a,
3607 darkseagreen: 0x8fbc8f,
3608 darkslateblue: 0x483d8b,
3609 darkslategray: 0x2f4f4f,
3610 darkslategrey: 0x2f4f4f,
3611 darkturquoise: 0x00ced1,
3612 darkviolet: 0x9400d3,
3613 deeppink: 0xff1493,
3614 deepskyblue: 0x00bfff,
3615 dimgray: 0x696969,
3616 dimgrey: 0x696969,
3617 dodgerblue: 0x1e90ff,
3618 firebrick: 0xb22222,
3619 floralwhite: 0xfffaf0,
3620 forestgreen: 0x228b22,
3621 fuchsia: 0xff00ff,
3622 gainsboro: 0xdcdcdc,
3623 ghostwhite: 0xf8f8ff,
3624 gold: 0xffd700,
3625 goldenrod: 0xdaa520,
3626 gray: 0x808080,
3627 green: 0x008000,
3628 greenyellow: 0xadff2f,
3629 grey: 0x808080,
3630 honeydew: 0xf0fff0,
3631 hotpink: 0xff69b4,
3632 indianred: 0xcd5c5c,
3633 indigo: 0x4b0082,
3634 ivory: 0xfffff0,
3635 khaki: 0xf0e68c,
3636 lavender: 0xe6e6fa,
3637 lavenderblush: 0xfff0f5,
3638 lawngreen: 0x7cfc00,
3639 lemonchiffon: 0xfffacd,
3640 lightblue: 0xadd8e6,
3641 lightcoral: 0xf08080,
3642 lightcyan: 0xe0ffff,
3643 lightgoldenrodyellow: 0xfafad2,
3644 lightgray: 0xd3d3d3,
3645 lightgreen: 0x90ee90,
3646 lightgrey: 0xd3d3d3,
3647 lightpink: 0xffb6c1,
3648 lightsalmon: 0xffa07a,
3649 lightseagreen: 0x20b2aa,
3650 lightskyblue: 0x87cefa,
3651 lightslategray: 0x778899,
3652 lightslategrey: 0x778899,
3653 lightsteelblue: 0xb0c4de,
3654 lightyellow: 0xffffe0,
3655 lime: 0x00ff00,
3656 limegreen: 0x32cd32,
3657 linen: 0xfaf0e6,
3658 magenta: 0xff00ff,
3659 maroon: 0x800000,
3660 mediumaquamarine: 0x66cdaa,
3661 mediumblue: 0x0000cd,
3662 mediumorchid: 0xba55d3,
3663 mediumpurple: 0x9370db,
3664 mediumseagreen: 0x3cb371,
3665 mediumslateblue: 0x7b68ee,
3666 mediumspringgreen: 0x00fa9a,
3667 mediumturquoise: 0x48d1cc,
3668 mediumvioletred: 0xc71585,
3669 midnightblue: 0x191970,
3670 mintcream: 0xf5fffa,
3671 mistyrose: 0xffe4e1,
3672 moccasin: 0xffe4b5,
3673 navajowhite: 0xffdead,
3674 navy: 0x000080,
3675 oldlace: 0xfdf5e6,
3676 olive: 0x808000,
3677 olivedrab: 0x6b8e23,
3678 orange: 0xffa500,
3679 orangered: 0xff4500,
3680 orchid: 0xda70d6,
3681 palegoldenrod: 0xeee8aa,
3682 palegreen: 0x98fb98,
3683 paleturquoise: 0xafeeee,
3684 palevioletred: 0xdb7093,
3685 papayawhip: 0xffefd5,
3686 peachpuff: 0xffdab9,
3687 peru: 0xcd853f,
3688 pink: 0xffc0cb,
3689 plum: 0xdda0dd,
3690 powderblue: 0xb0e0e6,
3691 purple: 0x800080,
3692 rebeccapurple: 0x663399,
3693 red: 0xff0000,
3694 rosybrown: 0xbc8f8f,
3695 royalblue: 0x4169e1,
3696 saddlebrown: 0x8b4513,
3697 salmon: 0xfa8072,
3698 sandybrown: 0xf4a460,
3699 seagreen: 0x2e8b57,
3700 seashell: 0xfff5ee,
3701 sienna: 0xa0522d,
3702 silver: 0xc0c0c0,
3703 skyblue: 0x87ceeb,
3704 slateblue: 0x6a5acd,
3705 slategray: 0x708090,
3706 slategrey: 0x708090,
3707 snow: 0xfffafa,
3708 springgreen: 0x00ff7f,
3709 steelblue: 0x4682b4,
3710 tan: 0xd2b48c,
3711 teal: 0x008080,
3712 thistle: 0xd8bfd8,
3713 tomato: 0xff6347,
3714 turquoise: 0x40e0d0,
3715 violet: 0xee82ee,
3716 wheat: 0xf5deb3,
3717 white: 0xffffff,
3718 whitesmoke: 0xf5f5f5,
3719 yellow: 0xffff00,
3720 yellowgreen: 0x9acd32
3721 };
3722
3723 Object(__WEBPACK_IMPORTED_MODULE_0__define__["a" /* default */])(Color, color, {
3724 displayable: function displayable() {
3725 return this.rgb().displayable();
3726 },
3727 toString: function toString() {
3728 return this.rgb() + "";
3729 }
3730 });
3731
3732 function color(format) {
3733 var m;
3734 format = (format + "").trim().toLowerCase();
3735 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
3736 ) : (m = reHex6.exec(format)) ? rgbn(parseInt(m[1], 16)) // #ff0000
3737 : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0)
3738 : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%)
3739 : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1)
3740 : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1)
3741 : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%)
3742 : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1)
3743 : named.hasOwnProperty(format) ? rgbn(named[format]) : format === "transparent" ? new Rgb(NaN, NaN, NaN, 0) : null;
3744 }
3745
3746 function rgbn(n) {
3747 return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1);
3748 }
3749
3750 function rgba(r, g, b, a) {
3751 if (a <= 0) r = g = b = NaN;
3752 return new Rgb(r, g, b, a);
3753 }
3754
3755 function rgbConvert(o) {
3756 if (!(o instanceof Color)) o = color(o);
3757 if (!o) return new Rgb();
3758 o = o.rgb();
3759 return new Rgb(o.r, o.g, o.b, o.opacity);
3760 }
3761
3762 function rgb(r, g, b, opacity) {
3763 return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);
3764 }
3765
3766 function Rgb(r, g, b, opacity) {
3767 this.r = +r;
3768 this.g = +g;
3769 this.b = +b;
3770 this.opacity = +opacity;
3771 }
3772
3773 Object(__WEBPACK_IMPORTED_MODULE_0__define__["a" /* default */])(Rgb, rgb, Object(__WEBPACK_IMPORTED_MODULE_0__define__["b" /* extend */])(Color, {
3774 brighter: function brighter(k) {
3775 k = k == null ? _brighter : Math.pow(_brighter, k);
3776 return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
3777 },
3778 darker: function darker(k) {
3779 k = k == null ? _darker : Math.pow(_darker, k);
3780 return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
3781 },
3782 rgb: function rgb() {
3783 return this;
3784 },
3785 displayable: function displayable() {
3786 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;
3787 },
3788 toString: function toString() {
3789 var a = this.opacity;a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a));
3790 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 + ")");
3791 }
3792 }));
3793
3794 function hsla(h, s, l, a) {
3795 if (a <= 0) h = s = l = NaN;else if (l <= 0 || l >= 1) h = s = NaN;else if (s <= 0) h = NaN;
3796 return new Hsl(h, s, l, a);
3797 }
3798
3799 function hslConvert(o) {
3800 if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity);
3801 if (!(o instanceof Color)) o = color(o);
3802 if (!o) return new Hsl();
3803 if (o instanceof Hsl) return o;
3804 o = o.rgb();
3805 var r = o.r / 255,
3806 g = o.g / 255,
3807 b = o.b / 255,
3808 min = Math.min(r, g, b),
3809 max = Math.max(r, g, b),
3810 h = NaN,
3811 s = max - min,
3812 l = (max + min) / 2;
3813 if (s) {
3814 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;
3815 s /= l < 0.5 ? max + min : 2 - max - min;
3816 h *= 60;
3817 } else {
3818 s = l > 0 && l < 1 ? 0 : h;
3819 }
3820 return new Hsl(h, s, l, o.opacity);
3821 }
3822
3823 function hsl(h, s, l, opacity) {
3824 return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);
3825 }
3826
3827 function Hsl(h, s, l, opacity) {
3828 this.h = +h;
3829 this.s = +s;
3830 this.l = +l;
3831 this.opacity = +opacity;
3832 }
3833
3834 Object(__WEBPACK_IMPORTED_MODULE_0__define__["a" /* default */])(Hsl, hsl, Object(__WEBPACK_IMPORTED_MODULE_0__define__["b" /* extend */])(Color, {
3835 brighter: function brighter(k) {
3836 k = k == null ? _brighter : Math.pow(_brighter, k);
3837 return new Hsl(this.h, this.s, this.l * k, this.opacity);
3838 },
3839 darker: function darker(k) {
3840 k = k == null ? _darker : Math.pow(_darker, k);
3841 return new Hsl(this.h, this.s, this.l * k, this.opacity);
3842 },
3843 rgb: function rgb() {
3844 var h = this.h % 360 + (this.h < 0) * 360,
3845 s = isNaN(h) || isNaN(this.s) ? 0 : this.s,
3846 l = this.l,
3847 m2 = l + (l < 0.5 ? l : 1 - l) * s,
3848 m1 = 2 * l - m2;
3849 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);
3850 },
3851 displayable: function displayable() {
3852 return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && 0 <= this.l && this.l <= 1 && 0 <= this.opacity && this.opacity <= 1;
3853 }
3854 }));
3855
3856 /* From FvD 13.37, CSS Color Module Level 3 */
3857 function hsl2rgb(h, m1, m2) {
3858 return (h < 60 ? m1 + (m2 - m1) * h / 60 : h < 180 ? m2 : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60 : m1) * 255;
3859 }
3860
3861 /***/
3862 },
3863 /* 50 */
3864 /***/function (module, __webpack_exports__, __webpack_require__) {
3865
3866 "use strict";
3867 /* harmony export (immutable) */
3868 __webpack_exports__["b"] = extend;
3869 /* harmony default export */__webpack_exports__["a"] = function (constructor, factory, prototype) {
3870 constructor.prototype = factory.prototype = prototype;
3871 prototype.constructor = constructor;
3872 };
3873
3874 function extend(parent, definition) {
3875 var prototype = Object.create(parent.prototype);
3876 for (var key in definition) {
3877 prototype[key] = definition[key];
3878 }return prototype;
3879 }
3880
3881 /***/
3882 },
3883 /* 51 */
3884 /***/function (module, __webpack_exports__, __webpack_require__) {
3885
3886 "use strict";
3887 /* harmony export (immutable) */
3888 __webpack_exports__["a"] = basis;
3889 function basis(t1, v0, v1, v2, v3) {
3890 var t2 = t1 * t1,
3891 t3 = t2 * t1;
3892 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;
3893 }
3894
3895 /* harmony default export */__webpack_exports__["b"] = function (values) {
3896 var n = values.length - 1;
3897 return function (t) {
3898 var i = t <= 0 ? t = 0 : t >= 1 ? (t = 1, n - 1) : Math.floor(t * n),
3899 v1 = values[i],
3900 v2 = values[i + 1],
3901 v0 = i > 0 ? values[i - 1] : 2 * v1 - v2,
3902 v3 = i < n - 1 ? values[i + 2] : 2 * v2 - v1;
3903 return basis((t - i / n) * n, v0, v1, v2, v3);
3904 };
3905 };
3906
3907 /***/
3908 },
3909 /* 52 */
3910 /***/function (module, exports, __webpack_require__) {
3911
3912 var vec2 = __webpack_require__(3).vec2;
3913
3914 module.exports = {
3915 at: function at(p1, p2, t) {
3916 return (p2 - p1) * t + p1;
3917 },
3918 pointDistance: function pointDistance(x1, y1, x2, y2, x, y) {
3919 var d = [x2 - x1, y2 - y1];
3920 if (vec2.exactEquals(d, [0, 0])) {
3921 return NaN;
3922 }
3923
3924 var u = [-d[1], d[0]];
3925 vec2.normalize(u, u);
3926 var a = [x - x1, y - y1];
3927 return Math.abs(vec2.dot(a, u));
3928 },
3929 box: function box(x1, y1, x2, y2, lineWidth) {
3930 var halfWidth = lineWidth / 2;
3931 var minX = Math.min(x1, x2);
3932 var maxX = Math.max(x1, x2);
3933 var minY = Math.min(y1, y2);
3934 var maxY = Math.max(y1, y2);
3935
3936 return {
3937 minX: minX - halfWidth,
3938 minY: minY - halfWidth,
3939 maxX: maxX + halfWidth,
3940 maxY: maxY + halfWidth
3941 };
3942 },
3943 len: function len(x1, y1, x2, y2) {
3944 return Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
3945 }
3946 };
3947
3948 /***/
3949 },
3950 /* 53 */
3951 /***/function (module, exports, __webpack_require__) {
3952
3953 var Util = __webpack_require__(0);
3954 var vec2 = __webpack_require__(3).vec2;
3955
3956 function quadraticAt(p0, p1, p2, t) {
3957 var onet = 1 - t;
3958 return onet * (onet * p0 + 2 * t * p1) + t * t * p2;
3959 }
3960
3961 function quadraticProjectPoint(x1, y1, x2, y2, x3, y3, x, y, out) {
3962 var t = void 0;
3963 var interval = 0.005;
3964 var d = Infinity;
3965 var d1 = void 0;
3966 var v1 = void 0;
3967 var v2 = void 0;
3968 var _t = void 0;
3969 var d2 = void 0;
3970 var i = void 0;
3971 var EPSILON = 0.0001;
3972 var v0 = [x, y];
3973
3974 for (_t = 0; _t < 1; _t += 0.05) {
3975 v1 = [quadraticAt(x1, x2, x3, _t), quadraticAt(y1, y2, y3, _t)];
3976
3977 d1 = vec2.squaredDistance(v0, v1);
3978 if (d1 < d) {
3979 t = _t;
3980 d = d1;
3981 }
3982 }
3983 d = Infinity;
3984
3985 for (i = 0; i < 32; i++) {
3986 if (interval < EPSILON) {
3987 break;
3988 }
3989
3990 var prev = t - interval;
3991 var next = t + interval;
3992
3993 v1 = [quadraticAt(x1, x2, x3, prev), quadraticAt(y1, y2, y3, prev)];
3994
3995 d1 = vec2.squaredDistance(v0, v1);
3996
3997 if (prev >= 0 && d1 < d) {
3998 t = prev;
3999 d = d1;
4000 } else {
4001 v2 = [quadraticAt(x1, x2, x3, next), quadraticAt(y1, y2, y3, next)];
4002
4003 d2 = vec2.squaredDistance(v0, v2);
4004
4005 if (next <= 1 && d2 < d) {
4006 t = next;
4007 d = d2;
4008 } else {
4009 interval *= 0.5;
4010 }
4011 }
4012 }
4013
4014 if (out) {
4015 out.x = quadraticAt(x1, x2, x3, t);
4016 out.y = quadraticAt(y1, y2, y3, t);
4017 }
4018
4019 return Math.sqrt(d);
4020 }
4021
4022 function quadraticExtrema(p0, p1, p2) {
4023 var a = p0 + p2 - 2 * p1;
4024 if (Util.isNumberEqual(a, 0)) {
4025 return [0.5];
4026 }
4027 var rst = (p0 - p1) / a;
4028 if (rst <= 1 && rst >= 0) {
4029 return [rst];
4030 }
4031 return [];
4032 }
4033
4034 module.exports = {
4035 at: quadraticAt,
4036 projectPoint: function projectPoint(x1, y1, x2, y2, x3, y3, x, y) {
4037 var rst = {};
4038 quadraticProjectPoint(x1, y1, x2, y2, x3, y3, x, y, rst);
4039 return rst;
4040 },
4041
4042 pointDistance: quadraticProjectPoint,
4043 extrema: quadraticExtrema
4044 };
4045
4046 /***/
4047 },
4048 /* 54 */
4049 /***/function (module, exports, __webpack_require__) {
4050
4051 var Util = __webpack_require__(0);
4052 var vec2 = __webpack_require__(3).vec2;
4053
4054 function circlePoint(cx, cy, r, angle) {
4055 return {
4056 x: Math.cos(angle) * r + cx,
4057 y: Math.sin(angle) * r + cy
4058 };
4059 }
4060
4061 function angleNearTo(angle, min, max, out) {
4062 var v1 = void 0;
4063 var v2 = void 0;
4064 if (out) {
4065 if (angle < min) {
4066 v1 = min - angle;
4067 v2 = Math.PI * 2 - max + angle;
4068 } else if (angle > max) {
4069 v1 = Math.PI * 2 - angle + min;
4070 v2 = angle - max;
4071 }
4072 } else {
4073 v1 = angle - min;
4074 v2 = max - angle;
4075 }
4076
4077 return v1 > v2 ? max : min;
4078 }
4079
4080 function nearAngle(angle, startAngle, endAngle, clockwise) {
4081 var plus = 0;
4082 if (endAngle - startAngle >= Math.PI * 2) {
4083 plus = Math.PI * 2;
4084 }
4085 startAngle = Util.mod(startAngle, Math.PI * 2);
4086 endAngle = Util.mod(endAngle, Math.PI * 2) + plus;
4087 angle = Util.mod(angle, Math.PI * 2);
4088 if (clockwise) {
4089 if (startAngle >= endAngle) {
4090 if (angle > endAngle && angle < startAngle) {
4091 return angle;
4092 }
4093 return angleNearTo(angle, endAngle, startAngle, true);
4094 }
4095 if (angle < startAngle || angle > endAngle) {
4096 return angle;
4097 }
4098 return angleNearTo(angle, startAngle, endAngle);
4099 }
4100 if (startAngle <= endAngle) {
4101 if (startAngle < angle && angle < endAngle) {
4102 return angle;
4103 }
4104 return angleNearTo(angle, startAngle, endAngle, true);
4105 }
4106 if (angle > startAngle || angle < endAngle) {
4107 return angle;
4108 }
4109 return angleNearTo(angle, endAngle, startAngle);
4110 }
4111
4112 function arcProjectPoint(cx, cy, r, startAngle, endAngle, clockwise, x, y, out) {
4113 var v = [x, y];
4114 var v0 = [cx, cy];
4115 var v1 = [1, 0];
4116 var subv = vec2.subtract([], v, v0);
4117 var angle = vec2.angleTo(v1, subv);
4118
4119 angle = nearAngle(angle, startAngle, endAngle, clockwise);
4120 var vpoint = [r * Math.cos(angle) + cx, r * Math.sin(angle) + cy];
4121 if (out) {
4122 out.x = vpoint[0];
4123 out.y = vpoint[1];
4124 }
4125 var d = vec2.distance(vpoint, v);
4126 return d;
4127 }
4128
4129 function arcBox(cx, cy, r, startAngle, endAngle, clockwise) {
4130 var angleRight = 0;
4131 var angleBottom = Math.PI / 2;
4132 var angleLeft = Math.PI;
4133 var angleTop = Math.PI * 3 / 2;
4134 var points = [];
4135 var angle = nearAngle(angleRight, startAngle, endAngle, clockwise);
4136 if (angle === angleRight) {
4137 points.push(circlePoint(cx, cy, r, angleRight));
4138 }
4139
4140 angle = nearAngle(angleBottom, startAngle, endAngle, clockwise);
4141 if (angle === angleBottom) {
4142 points.push(circlePoint(cx, cy, r, angleBottom));
4143 }
4144
4145 angle = nearAngle(angleLeft, startAngle, endAngle, clockwise);
4146 if (angle === angleLeft) {
4147 points.push(circlePoint(cx, cy, r, angleLeft));
4148 }
4149
4150 angle = nearAngle(angleTop, startAngle, endAngle, clockwise);
4151 if (angle === angleTop) {
4152 points.push(circlePoint(cx, cy, r, angleTop));
4153 }
4154
4155 points.push(circlePoint(cx, cy, r, startAngle));
4156 points.push(circlePoint(cx, cy, r, endAngle));
4157 var minX = Infinity;
4158 var maxX = -Infinity;
4159 var minY = Infinity;
4160 var maxY = -Infinity;
4161 Util.each(points, function (point) {
4162 if (minX > point.x) {
4163 minX = point.x;
4164 }
4165 if (maxX < point.x) {
4166 maxX = point.x;
4167 }
4168 if (minY > point.y) {
4169 minY = point.y;
4170 }
4171 if (maxY < point.y) {
4172 maxY = point.y;
4173 }
4174 });
4175
4176 return {
4177 minX: minX,
4178 minY: minY,
4179 maxX: maxX,
4180 maxY: maxY
4181 };
4182 }
4183
4184 module.exports = {
4185 nearAngle: nearAngle,
4186 projectPoint: function projectPoint(cx, cy, r, startAngle, endAngle, clockwise, x, y) {
4187 var rst = {};
4188 arcProjectPoint(cx, cy, r, startAngle, endAngle, clockwise, x, y, rst);
4189 return rst;
4190 },
4191
4192 pointDistance: arcProjectPoint,
4193 box: arcBox
4194 };
4195
4196 /***/
4197 },
4198 /* 55 */
4199 /***/function (module, exports, __webpack_require__) {
4200
4201 /* WEBPACK VAR INJECTION */(function (global) {
4202 var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) {
4203 return typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
4204 } : function (obj) {
4205 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
4206 };
4207
4208 /** Detect free variable `global` from Node.js. */
4209 var freeGlobal = (typeof global === 'undefined' ? 'undefined' : _typeof(global)) == 'object' && global && global.Object === Object && global;
4210
4211 module.exports = freeGlobal;
4212 /* WEBPACK VAR INJECTION */
4213 }).call(exports, __webpack_require__(114));
4214
4215 /***/
4216 },
4217 /* 56 */
4218 /***/function (module, exports, __webpack_require__) {
4219
4220 var baseGetTag = __webpack_require__(7),
4221 isArray = __webpack_require__(6),
4222 isObjectLike = __webpack_require__(5);
4223
4224 /** `Object#toString` result references. */
4225 var stringTag = '[object String]';
4226
4227 /**
4228 * Checks if `value` is classified as a `String` primitive or object.
4229 *
4230 * @static
4231 * @since 0.1.0
4232 * @memberOf _
4233 * @category Lang
4234 * @param {*} value The value to check.
4235 * @returns {boolean} Returns `true` if `value` is a string, else `false`.
4236 * @example
4237 *
4238 * _.isString('abc');
4239 * // => true
4240 *
4241 * _.isString(1);
4242 * // => false
4243 */
4244 function isString(value) {
4245 return typeof value == 'string' || !isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag;
4246 }
4247
4248 module.exports = isString;
4249
4250 /***/
4251 },
4252 /* 57 */
4253 /***/function (module, exports, __webpack_require__) {
4254
4255 var isPrototype = __webpack_require__(16),
4256 nativeKeys = __webpack_require__(121);
4257
4258 /** Used for built-in method references. */
4259 var objectProto = Object.prototype;
4260
4261 /** Used to check objects for own properties. */
4262 var hasOwnProperty = objectProto.hasOwnProperty;
4263
4264 /**
4265 * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
4266 *
4267 * @private
4268 * @param {Object} object The object to query.
4269 * @returns {Array} Returns the array of property names.
4270 */
4271 function baseKeys(object) {
4272 if (!isPrototype(object)) {
4273 return nativeKeys(object);
4274 }
4275 var result = [];
4276 for (var key in Object(object)) {
4277 if (hasOwnProperty.call(object, key) && key != 'constructor') {
4278 result.push(key);
4279 }
4280 }
4281 return result;
4282 }
4283
4284 module.exports = baseKeys;
4285
4286 /***/
4287 },
4288 /* 58 */
4289 /***/function (module, exports) {
4290
4291 /**
4292 * Creates a unary function that invokes `func` with its argument transformed.
4293 *
4294 * @private
4295 * @param {Function} func The function to wrap.
4296 * @param {Function} transform The argument transform.
4297 * @returns {Function} Returns the new function.
4298 */
4299 function overArg(func, transform) {
4300 return function (arg) {
4301 return func(transform(arg));
4302 };
4303 }
4304
4305 module.exports = overArg;
4306
4307 /***/
4308 },
4309 /* 59 */
4310 /***/function (module, exports) {
4311
4312 /** Used for built-in method references. */
4313 var funcProto = Function.prototype;
4314
4315 /** Used to resolve the decompiled source of functions. */
4316 var funcToString = funcProto.toString;
4317
4318 /**
4319 * Converts `func` to its source code.
4320 *
4321 * @private
4322 * @param {Function} func The function to convert.
4323 * @returns {string} Returns the source code.
4324 */
4325 function toSource(func) {
4326 if (func != null) {
4327 try {
4328 return funcToString.call(func);
4329 } catch (e) {}
4330 try {
4331 return func + '';
4332 } catch (e) {}
4333 }
4334 return '';
4335 }
4336
4337 module.exports = toSource;
4338
4339 /***/
4340 },
4341 /* 60 */
4342 /***/function (module, exports) {
4343
4344 /** Used as references for various `Number` constants. */
4345 var MAX_SAFE_INTEGER = 9007199254740991;
4346
4347 /**
4348 * Checks if `value` is a valid array-like length.
4349 *
4350 * **Note:** This method is loosely based on
4351 * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
4352 *
4353 * @static
4354 * @memberOf _
4355 * @since 4.0.0
4356 * @category Lang
4357 * @param {*} value The value to check.
4358 * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
4359 * @example
4360 *
4361 * _.isLength(3);
4362 * // => true
4363 *
4364 * _.isLength(Number.MIN_VALUE);
4365 * // => false
4366 *
4367 * _.isLength(Infinity);
4368 * // => false
4369 *
4370 * _.isLength('3');
4371 * // => false
4372 */
4373 function isLength(value) {
4374 return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
4375 }
4376
4377 module.exports = isLength;
4378
4379 /***/
4380 },
4381 /* 61 */
4382 /***/function (module, exports) {
4383
4384 /**
4385 * The base implementation of `_.unary` without support for storing metadata.
4386 *
4387 * @private
4388 * @param {Function} func The function to cap arguments for.
4389 * @returns {Function} Returns the new capped function.
4390 */
4391 function baseUnary(func) {
4392 return function (value) {
4393 return func(value);
4394 };
4395 }
4396
4397 module.exports = baseUnary;
4398
4399 /***/
4400 },
4401 /* 62 */
4402 /***/function (module, exports, __webpack_require__) {
4403
4404 var baseToString = __webpack_require__(135);
4405
4406 /**
4407 * Converts `value` to a string. An empty string is returned for `null`
4408 * and `undefined` values. The sign of `-0` is preserved.
4409 *
4410 * @static
4411 * @memberOf _
4412 * @since 4.0.0
4413 * @category Lang
4414 * @param {*} value The value to convert.
4415 * @returns {string} Returns the converted string.
4416 * @example
4417 *
4418 * _.toString(null);
4419 * // => ''
4420 *
4421 * _.toString(-0);
4422 * // => '-0'
4423 *
4424 * _.toString([1, 2, 3]);
4425 * // => '1,2,3'
4426 */
4427 function toString(value) {
4428 return value == null ? '' : baseToString(value);
4429 }
4430
4431 module.exports = toString;
4432
4433 /***/
4434 },
4435 /* 63 */
4436 /***/function (module, exports, __webpack_require__) {
4437
4438 var mapCacheClear = __webpack_require__(149),
4439 mapCacheDelete = __webpack_require__(156),
4440 mapCacheGet = __webpack_require__(158),
4441 mapCacheHas = __webpack_require__(159),
4442 mapCacheSet = __webpack_require__(160);
4443
4444 /**
4445 * Creates a map cache object to store key-value pairs.
4446 *
4447 * @private
4448 * @constructor
4449 * @param {Array} [entries] The key-value pairs to cache.
4450 */
4451 function MapCache(entries) {
4452 var index = -1,
4453 length = entries == null ? 0 : entries.length;
4454
4455 this.clear();
4456 while (++index < length) {
4457 var entry = entries[index];
4458 this.set(entry[0], entry[1]);
4459 }
4460 }
4461
4462 // Add methods to `MapCache`.
4463 MapCache.prototype.clear = mapCacheClear;
4464 MapCache.prototype['delete'] = mapCacheDelete;
4465 MapCache.prototype.get = mapCacheGet;
4466 MapCache.prototype.has = mapCacheHas;
4467 MapCache.prototype.set = mapCacheSet;
4468
4469 module.exports = MapCache;
4470
4471 /***/
4472 },
4473 /* 64 */
4474 /***/function (module, exports) {
4475
4476 /**
4477 * A specialized version of `_.forEach` for arrays without support for
4478 * iteratee shorthands.
4479 *
4480 * @private
4481 * @param {Array} [array] The array to iterate over.
4482 * @param {Function} iteratee The function invoked per iteration.
4483 * @returns {Array} Returns `array`.
4484 */
4485 function arrayEach(array, iteratee) {
4486 var index = -1,
4487 length = array == null ? 0 : array.length;
4488
4489 while (++index < length) {
4490 if (iteratee(array[index], index, array) === false) {
4491 break;
4492 }
4493 }
4494 return array;
4495 }
4496
4497 module.exports = arrayEach;
4498
4499 /***/
4500 },
4501 /* 65 */
4502 /***/function (module, exports, __webpack_require__) {
4503
4504 var getNative = __webpack_require__(10);
4505
4506 var defineProperty = function () {
4507 try {
4508 var func = getNative(Object, 'defineProperty');
4509 func({}, '', {});
4510 return func;
4511 } catch (e) {}
4512 }();
4513
4514 module.exports = defineProperty;
4515
4516 /***/
4517 },
4518 /* 66 */
4519 /***/function (module, exports, __webpack_require__) {
4520
4521 var baseTimes = __webpack_require__(162),
4522 isArguments = __webpack_require__(33),
4523 isArray = __webpack_require__(6),
4524 isBuffer = __webpack_require__(17),
4525 isIndex = __webpack_require__(67),
4526 isTypedArray = __webpack_require__(22);
4527
4528 /** Used for built-in method references. */
4529 var objectProto = Object.prototype;
4530
4531 /** Used to check objects for own properties. */
4532 var hasOwnProperty = objectProto.hasOwnProperty;
4533
4534 /**
4535 * Creates an array of the enumerable property names of the array-like `value`.
4536 *
4537 * @private
4538 * @param {*} value The value to query.
4539 * @param {boolean} inherited Specify returning inherited property names.
4540 * @returns {Array} Returns the array of property names.
4541 */
4542 function arrayLikeKeys(value, inherited) {
4543 var isArr = isArray(value),
4544 isArg = !isArr && isArguments(value),
4545 isBuff = !isArr && !isArg && isBuffer(value),
4546 isType = !isArr && !isArg && !isBuff && isTypedArray(value),
4547 skipIndexes = isArr || isArg || isBuff || isType,
4548 result = skipIndexes ? baseTimes(value.length, String) : [],
4549 length = result.length;
4550
4551 for (var key in value) {
4552 if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && (
4553 // Safari 9 has enumerable `arguments.length` in strict mode.
4554 key == 'length' ||
4555 // Node.js 0.10 has enumerable non-index properties on buffers.
4556 isBuff && (key == 'offset' || key == 'parent') ||
4557 // PhantomJS 2 has enumerable non-index properties on typed arrays.
4558 isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset') ||
4559 // Skip index properties.
4560 isIndex(key, length)))) {
4561 result.push(key);
4562 }
4563 }
4564 return result;
4565 }
4566
4567 module.exports = arrayLikeKeys;
4568
4569 /***/
4570 },
4571 /* 67 */
4572 /***/function (module, exports) {
4573
4574 /** Used as references for various `Number` constants. */
4575 var MAX_SAFE_INTEGER = 9007199254740991;
4576
4577 /** Used to detect unsigned integer values. */
4578 var reIsUint = /^(?:0|[1-9]\d*)$/;
4579
4580 /**
4581 * Checks if `value` is a valid array-like index.
4582 *
4583 * @private
4584 * @param {*} value The value to check.
4585 * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
4586 * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
4587 */
4588 function isIndex(value, length) {
4589 length = length == null ? MAX_SAFE_INTEGER : length;
4590 return !!length && (typeof value == 'number' || reIsUint.test(value)) && value > -1 && value % 1 == 0 && value < length;
4591 }
4592
4593 module.exports = isIndex;
4594
4595 /***/
4596 },
4597 /* 68 */
4598 /***/function (module, exports, __webpack_require__) {
4599
4600 /* WEBPACK VAR INJECTION */(function (module) {
4601 var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) {
4602 return typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
4603 } : function (obj) {
4604 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
4605 };
4606
4607 var root = __webpack_require__(4);
4608
4609 /** Detect free variable `exports`. */
4610 var freeExports = (false ? 'undefined' : _typeof(exports)) == 'object' && exports && !exports.nodeType && exports;
4611
4612 /** Detect free variable `module`. */
4613 var freeModule = freeExports && (false ? 'undefined' : _typeof(module)) == 'object' && module && !module.nodeType && module;
4614
4615 /** Detect the popular CommonJS extension `module.exports`. */
4616 var moduleExports = freeModule && freeModule.exports === freeExports;
4617
4618 /** Built-in value references. */
4619 var Buffer = moduleExports ? root.Buffer : undefined,
4620 allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined;
4621
4622 /**
4623 * Creates a clone of `buffer`.
4624 *
4625 * @private
4626 * @param {Buffer} buffer The buffer to clone.
4627 * @param {boolean} [isDeep] Specify a deep clone.
4628 * @returns {Buffer} Returns the cloned buffer.
4629 */
4630 function cloneBuffer(buffer, isDeep) {
4631 if (isDeep) {
4632 return buffer.slice();
4633 }
4634 var length = buffer.length,
4635 result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
4636
4637 buffer.copy(result);
4638 return result;
4639 }
4640
4641 module.exports = cloneBuffer;
4642 /* WEBPACK VAR INJECTION */
4643 }).call(exports, __webpack_require__(34)(module));
4644
4645 /***/
4646 },
4647 /* 69 */
4648 /***/function (module, exports) {
4649
4650 /**
4651 * This method returns a new empty array.
4652 *
4653 * @static
4654 * @memberOf _
4655 * @since 4.13.0
4656 * @category Util
4657 * @returns {Array} Returns the new empty array.
4658 * @example
4659 *
4660 * var arrays = _.times(2, _.stubArray);
4661 *
4662 * console.log(arrays);
4663 * // => [[], []]
4664 *
4665 * console.log(arrays[0] === arrays[1]);
4666 * // => false
4667 */
4668 function stubArray() {
4669 return [];
4670 }
4671
4672 module.exports = stubArray;
4673
4674 /***/
4675 },
4676 /* 70 */
4677 /***/function (module, exports, __webpack_require__) {
4678
4679 var arrayPush = __webpack_require__(71),
4680 getPrototype = __webpack_require__(40),
4681 getSymbols = __webpack_require__(39),
4682 stubArray = __webpack_require__(69);
4683
4684 /* Built-in method references for those with the same name as other `lodash` methods. */
4685 var nativeGetSymbols = Object.getOwnPropertySymbols;
4686
4687 /**
4688 * Creates an array of the own and inherited enumerable symbols of `object`.
4689 *
4690 * @private
4691 * @param {Object} object The object to query.
4692 * @returns {Array} Returns the array of symbols.
4693 */
4694 var getSymbolsIn = !nativeGetSymbols ? stubArray : function (object) {
4695 var result = [];
4696 while (object) {
4697 arrayPush(result, getSymbols(object));
4698 object = getPrototype(object);
4699 }
4700 return result;
4701 };
4702
4703 module.exports = getSymbolsIn;
4704
4705 /***/
4706 },
4707 /* 71 */
4708 /***/function (module, exports) {
4709
4710 /**
4711 * Appends the elements of `values` to `array`.
4712 *
4713 * @private
4714 * @param {Array} array The array to modify.
4715 * @param {Array} values The values to append.
4716 * @returns {Array} Returns `array`.
4717 */
4718 function arrayPush(array, values) {
4719 var index = -1,
4720 length = values.length,
4721 offset = array.length;
4722
4723 while (++index < length) {
4724 array[offset + index] = values[index];
4725 }
4726 return array;
4727 }
4728
4729 module.exports = arrayPush;
4730
4731 /***/
4732 },
4733 /* 72 */
4734 /***/function (module, exports, __webpack_require__) {
4735
4736 var baseGetAllKeys = __webpack_require__(73),
4737 getSymbols = __webpack_require__(39),
4738 keys = __webpack_require__(13);
4739
4740 /**
4741 * Creates an array of own enumerable property names and symbols of `object`.
4742 *
4743 * @private
4744 * @param {Object} object The object to query.
4745 * @returns {Array} Returns the array of property names and symbols.
4746 */
4747 function getAllKeys(object) {
4748 return baseGetAllKeys(object, keys, getSymbols);
4749 }
4750
4751 module.exports = getAllKeys;
4752
4753 /***/
4754 },
4755 /* 73 */
4756 /***/function (module, exports, __webpack_require__) {
4757
4758 var arrayPush = __webpack_require__(71),
4759 isArray = __webpack_require__(6);
4760
4761 /**
4762 * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
4763 * `keysFunc` and `symbolsFunc` to get the enumerable property names and
4764 * symbols of `object`.
4765 *
4766 * @private
4767 * @param {Object} object The object to query.
4768 * @param {Function} keysFunc The function to get the keys of `object`.
4769 * @param {Function} symbolsFunc The function to get the symbols of `object`.
4770 * @returns {Array} Returns the array of property names and symbols.
4771 */
4772 function baseGetAllKeys(object, keysFunc, symbolsFunc) {
4773 var result = keysFunc(object);
4774 return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
4775 }
4776
4777 module.exports = baseGetAllKeys;
4778
4779 /***/
4780 },
4781 /* 74 */
4782 /***/function (module, exports, __webpack_require__) {
4783
4784 var root = __webpack_require__(4);
4785
4786 /** Built-in value references. */
4787 var Uint8Array = root.Uint8Array;
4788
4789 module.exports = Uint8Array;
4790
4791 /***/
4792 },
4793 /* 75 */
4794 /***/function (module, exports) {
4795
4796 /**
4797 * A specialized version of `_.reduce` for arrays without support for
4798 * iteratee shorthands.
4799 *
4800 * @private
4801 * @param {Array} [array] The array to iterate over.
4802 * @param {Function} iteratee The function invoked per iteration.
4803 * @param {*} [accumulator] The initial value.
4804 * @param {boolean} [initAccum] Specify using the first element of `array` as
4805 * the initial value.
4806 * @returns {*} Returns the accumulated value.
4807 */
4808 function arrayReduce(array, iteratee, accumulator, initAccum) {
4809 var index = -1,
4810 length = array == null ? 0 : array.length;
4811
4812 if (initAccum && length) {
4813 accumulator = array[++index];
4814 }
4815 while (++index < length) {
4816 accumulator = iteratee(accumulator, array[index], index, array);
4817 }
4818 return accumulator;
4819 }
4820
4821 module.exports = arrayReduce;
4822
4823 /***/
4824 },
4825 /* 76 */
4826 /***/function (module, exports, __webpack_require__) {
4827
4828 var cloneArrayBuffer = __webpack_require__(41);
4829
4830 /**
4831 * Creates a clone of `typedArray`.
4832 *
4833 * @private
4834 * @param {Object} typedArray The typed array to clone.
4835 * @param {boolean} [isDeep] Specify a deep clone.
4836 * @returns {Object} Returns the cloned typed array.
4837 */
4838 function cloneTypedArray(typedArray, isDeep) {
4839 var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
4840 return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
4841 }
4842
4843 module.exports = cloneTypedArray;
4844
4845 /***/
4846 },
4847 /* 77 */
4848 /***/function (module, exports, __webpack_require__) {
4849
4850 var baseCreate = __webpack_require__(179),
4851 getPrototype = __webpack_require__(40),
4852 isPrototype = __webpack_require__(16);
4853
4854 /**
4855 * Initializes an object clone.
4856 *
4857 * @private
4858 * @param {Object} object The object to clone.
4859 * @returns {Object} Returns the initialized clone.
4860 */
4861 function initCloneObject(object) {
4862 return typeof object.constructor == 'function' && !isPrototype(object) ? baseCreate(getPrototype(object)) : {};
4863 }
4864
4865 module.exports = initCloneObject;
4866
4867 /***/
4868 },
4869 /* 78 */
4870 /***/function (module, exports, __webpack_require__) {
4871
4872 var baseRest = __webpack_require__(79),
4873 isIterateeCall = __webpack_require__(187);
4874
4875 /**
4876 * Creates a function like `_.assign`.
4877 *
4878 * @private
4879 * @param {Function} assigner The function to assign values.
4880 * @returns {Function} Returns the new assigner function.
4881 */
4882 function createAssigner(assigner) {
4883 return baseRest(function (object, sources) {
4884 var index = -1,
4885 length = sources.length,
4886 customizer = length > 1 ? sources[length - 1] : undefined,
4887 guard = length > 2 ? sources[2] : undefined;
4888
4889 customizer = assigner.length > 3 && typeof customizer == 'function' ? (length--, customizer) : undefined;
4890
4891 if (guard && isIterateeCall(sources[0], sources[1], guard)) {
4892 customizer = length < 3 ? undefined : customizer;
4893 length = 1;
4894 }
4895 object = Object(object);
4896 while (++index < length) {
4897 var source = sources[index];
4898 if (source) {
4899 assigner(object, source, index, customizer);
4900 }
4901 }
4902 return object;
4903 });
4904 }
4905
4906 module.exports = createAssigner;
4907
4908 /***/
4909 },
4910 /* 79 */
4911 /***/function (module, exports, __webpack_require__) {
4912
4913 var identity = __webpack_require__(44),
4914 overRest = __webpack_require__(181),
4915 setToString = __webpack_require__(183);
4916
4917 /**
4918 * The base implementation of `_.rest` which doesn't validate or coerce arguments.
4919 *
4920 * @private
4921 * @param {Function} func The function to apply a rest parameter to.
4922 * @param {number} [start=func.length-1] The start position of the rest parameter.
4923 * @returns {Function} Returns the new function.
4924 */
4925 function baseRest(func, start) {
4926 return setToString(overRest(func, start, identity), func + '');
4927 }
4928
4929 module.exports = baseRest;
4930
4931 /***/
4932 },
4933 /* 80 */
4934 /***/function (module, exports, __webpack_require__) {
4935
4936 var baseAssignValue = __webpack_require__(38),
4937 eq = __webpack_require__(18);
4938
4939 /**
4940 * This function is like `assignValue` except that it doesn't assign
4941 * `undefined` values.
4942 *
4943 * @private
4944 * @param {Object} object The object to modify.
4945 * @param {string} key The key of the property to assign.
4946 * @param {*} value The value to assign.
4947 */
4948 function assignMergeValue(object, key, value) {
4949 if (value !== undefined && !eq(object[key], value) || value === undefined && !(key in object)) {
4950 baseAssignValue(object, key, value);
4951 }
4952 }
4953
4954 module.exports = assignMergeValue;
4955
4956 /***/
4957 },
4958 /* 81 */
4959 /***/function (module, exports, __webpack_require__) {
4960
4961 var createBaseFor = __webpack_require__(190);
4962
4963 /**
4964 * The base implementation of `baseForOwn` which iterates over `object`
4965 * properties returned by `keysFunc` and invokes `iteratee` for each property.
4966 * Iteratee functions may exit iteration early by explicitly returning `false`.
4967 *
4968 * @private
4969 * @param {Object} object The object to iterate over.
4970 * @param {Function} iteratee The function invoked per iteration.
4971 * @param {Function} keysFunc The function to get the keys of `object`.
4972 * @returns {Object} Returns `object`.
4973 */
4974 var baseFor = createBaseFor();
4975
4976 module.exports = baseFor;
4977
4978 /***/
4979 },
4980 /* 82 */
4981 /***/function (module, exports) {
4982
4983 /** Used to compose unicode character classes. */
4984 var rsAstralRange = '\\ud800-\\udfff',
4985 rsComboMarksRange = '\\u0300-\\u036f',
4986 reComboHalfMarksRange = '\\ufe20-\\ufe2f',
4987 rsComboSymbolsRange = '\\u20d0-\\u20ff',
4988 rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
4989 rsVarRange = '\\ufe0e\\ufe0f';
4990
4991 /** Used to compose unicode capture groups. */
4992 var rsZWJ = '\\u200d';
4993
4994 /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
4995 var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
4996
4997 /**
4998 * Checks if `string` contains Unicode symbols.
4999 *
5000 * @private
5001 * @param {string} string The string to inspect.
5002 * @returns {boolean} Returns `true` if a symbol is found, else `false`.
5003 */
5004 function hasUnicode(string) {
5005 return reHasUnicode.test(string);
5006 }
5007
5008 module.exports = hasUnicode;
5009
5010 /***/
5011 },
5012 /* 83 */
5013 /***/function (module, exports, __webpack_require__) {
5014
5015 var asciiToArray = __webpack_require__(199),
5016 hasUnicode = __webpack_require__(82),
5017 unicodeToArray = __webpack_require__(200);
5018
5019 /**
5020 * Converts `string` to an array.
5021 *
5022 * @private
5023 * @param {string} string The string to convert.
5024 * @returns {Array} Returns the converted array.
5025 */
5026 function stringToArray(string) {
5027 return hasUnicode(string) ? unicodeToArray(string) : asciiToArray(string);
5028 }
5029
5030 module.exports = stringToArray;
5031
5032 /***/
5033 },
5034 /* 84 */
5035 /***/function (module, exports, __webpack_require__) {
5036
5037 var SetCache = __webpack_require__(217),
5038 arraySome = __webpack_require__(220),
5039 cacheHas = __webpack_require__(221);
5040
5041 /** Used to compose bitmasks for value comparisons. */
5042 var COMPARE_PARTIAL_FLAG = 1,
5043 COMPARE_UNORDERED_FLAG = 2;
5044
5045 /**
5046 * A specialized version of `baseIsEqualDeep` for arrays with support for
5047 * partial deep comparisons.
5048 *
5049 * @private
5050 * @param {Array} array The array to compare.
5051 * @param {Array} other The other array to compare.
5052 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
5053 * @param {Function} customizer The function to customize comparisons.
5054 * @param {Function} equalFunc The function to determine equivalents of values.
5055 * @param {Object} stack Tracks traversed `array` and `other` objects.
5056 * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
5057 */
5058 function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
5059 var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
5060 arrLength = array.length,
5061 othLength = other.length;
5062
5063 if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
5064 return false;
5065 }
5066 // Assume cyclic values are equal.
5067 var stacked = stack.get(array);
5068 if (stacked && stack.get(other)) {
5069 return stacked == other;
5070 }
5071 var index = -1,
5072 result = true,
5073 seen = bitmask & COMPARE_UNORDERED_FLAG ? new SetCache() : undefined;
5074
5075 stack.set(array, other);
5076 stack.set(other, array);
5077
5078 // Ignore non-index properties.
5079 while (++index < arrLength) {
5080 var arrValue = array[index],
5081 othValue = other[index];
5082
5083 if (customizer) {
5084 var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack);
5085 }
5086 if (compared !== undefined) {
5087 if (compared) {
5088 continue;
5089 }
5090 result = false;
5091 break;
5092 }
5093 // Recursively compare arrays (susceptible to call stack limits).
5094 if (seen) {
5095 if (!arraySome(other, function (othValue, othIndex) {
5096 if (!cacheHas(seen, othIndex) && (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
5097 return seen.push(othIndex);
5098 }
5099 })) {
5100 result = false;
5101 break;
5102 }
5103 } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
5104 result = false;
5105 break;
5106 }
5107 }
5108 stack['delete'](array);
5109 stack['delete'](other);
5110 return result;
5111 }
5112
5113 module.exports = equalArrays;
5114
5115 /***/
5116 },
5117 /* 85 */
5118 /***/function (module, exports) {
5119
5120 var TABLE = document.createElement('table');
5121 var TABLE_TR = document.createElement('tr');
5122 var FRAGMENT_REG = /^\s*<(\w+|!)[^>]*>/;
5123 var CONTAINERS = {
5124 tr: document.createElement('tbody'),
5125 tbody: TABLE,
5126 thead: TABLE,
5127 tfoot: TABLE,
5128 td: TABLE_TR,
5129 th: TABLE_TR,
5130 '*': document.createElement('div')
5131 };
5132
5133 module.exports = {
5134 getBoundingClientRect: function getBoundingClientRect(node) {
5135 var rect = node.getBoundingClientRect();
5136 var top = document.documentElement.clientTop;
5137 var left = document.documentElement.clientLeft;
5138 return {
5139 top: rect.top - top,
5140 bottom: rect.bottom - top,
5141 left: rect.left - left,
5142 right: rect.right - left
5143 };
5144 },
5145
5146 /**
5147 * 获取样式
5148 * @param {Object} dom DOM节点
5149 * @param {String} name 样式名
5150 * @return {String} 属性值
5151 */
5152 getStyle: function getStyle(dom, name) {
5153 if (window.getComputedStyle) {
5154 return window.getComputedStyle(dom, null)[name];
5155 }
5156 return dom.currentStyle[name];
5157 },
5158 modifyCSS: function modifyCSS(dom, css) {
5159 for (var key in css) {
5160 if (css.hasOwnProperty(key)) {
5161 dom.style[key] = css[key];
5162 }
5163 }
5164 return dom;
5165 },
5166
5167 /**
5168 * 创建DOM 节点
5169 * @param {String} str Dom 字符串
5170 * @return {HTMLElement} DOM 节点
5171 */
5172 createDom: function createDom(str) {
5173 var name = FRAGMENT_REG.test(str) && RegExp.$1;
5174 if (!(name in CONTAINERS)) {
5175 name = '*';
5176 }
5177 var container = CONTAINERS[name];
5178 str = str.replace(/(^\s*)|(\s*$)/g, '');
5179 container.innerHTML = '' + str;
5180 return container.childNodes[0];
5181 },
5182 getRatio: function getRatio() {
5183 return window.devicePixelRatio ? window.devicePixelRatio : 2;
5184 },
5185
5186 /**
5187 * 获取宽度
5188 * @param {HTMLElement} el dom节点
5189 * @return {Number} 宽度
5190 */
5191 getWidth: function getWidth(el) {
5192 var width = this.getStyle(el, 'width');
5193 if (width === 'auto') {
5194 width = el.offsetWidth;
5195 }
5196 return parseFloat(width);
5197 },
5198
5199 /**
5200 * 获取高度
5201 * @param {HTMLElement} el dom节点
5202 * @return {Number} 高度
5203 */
5204 getHeight: function getHeight(el) {
5205 var height = this.getStyle(el, 'height');
5206 if (height === 'auto') {
5207 height = el.offsetHeight;
5208 }
5209 return parseFloat(height);
5210 },
5211
5212 /**
5213 * 获取外层高度
5214 * @param {HTMLElement} el dom节点
5215 * @return {Number} 高度
5216 */
5217 getOuterHeight: function getOuterHeight(el) {
5218 var height = this.getHeight(el);
5219 var bTop = parseFloat(this.getStyle(el, 'borderTopWidth')) || 0;
5220 var pTop = parseFloat(this.getStyle(el, 'paddingTop'));
5221 var pBottom = parseFloat(this.getStyle(el, 'paddingBottom'));
5222 var bBottom = parseFloat(this.getStyle(el, 'borderBottomWidth')) || 0;
5223 return height + bTop + bBottom + pTop + pBottom;
5224 },
5225
5226 /**
5227 * 获取外层宽度
5228 * @param {HTMLElement} el dom节点
5229 * @return {Number} 宽度
5230 */
5231 getOuterWidth: function getOuterWidth(el) {
5232 var width = this.getWidth(el);
5233 var bLeft = parseFloat(this.getStyle(el, 'borderLeftWidth')) || 0;
5234 var pLeft = parseFloat(this.getStyle(el, 'paddingLeft'));
5235 var pRight = parseFloat(this.getStyle(el, 'paddingRight'));
5236 var bRight = parseFloat(this.getStyle(el, 'borderRightWidth')) || 0;
5237 return width + bLeft + bRight + pLeft + pRight;
5238 },
5239
5240 /**
5241 * 添加事件监听器
5242 * @param {Object} target DOM对象
5243 * @param {String} eventType 事件名
5244 * @param {Funtion} callback 回调函数
5245 * @return {Object} 返回对象
5246 */
5247 addEventListener: function addEventListener(target, eventType, callback) {
5248 if (target.addEventListener) {
5249 target.addEventListener(eventType, callback, false);
5250 return {
5251 remove: function remove() {
5252 target.removeEventListener(eventType, callback, false);
5253 }
5254 };
5255 } else if (target.attachEvent) {
5256 target.attachEvent('on' + eventType, callback);
5257 return {
5258 remove: function remove() {
5259 target.detachEvent('on' + eventType, callback);
5260 }
5261 };
5262 }
5263 },
5264 requestAnimationFrame: function requestAnimationFrame(fn) {
5265 var method = window.requestAnimationFrame || window.webkitRequestAnimationFrame || function (fn) {
5266 return setTimeout(fn, 16);
5267 };
5268
5269 return method(fn);
5270 }
5271 };
5272
5273 /***/
5274 },
5275 /* 86 */
5276 /***/function (module, exports, __webpack_require__) {
5277
5278 var Util = __webpack_require__(0);
5279
5280 var Event = function Event(type, event, bubbles, cancelable) {
5281 this.type = type; // 事件类型
5282 this.target = null; // 目标
5283 this.currentTarget = null; // 当前目标
5284 this.bubbles = bubbles; // 冒泡
5285 this.cancelable = cancelable; // 是否能够阻止
5286 this.timeStamp = new Date().getTime(); // 时间戳
5287 this.defaultPrevented = false; // 阻止默认
5288 this.propagationStopped = false; // 阻止冒泡
5289 this.removed = false; // 是否被移除
5290 this.event = event; // 触发的原生事件
5291 };
5292
5293 Util.augment(Event, {
5294 preventDefault: function preventDefault() {
5295 this.defaultPrevented = this.cancelable && true;
5296 },
5297 stopPropagation: function stopPropagation() {
5298 this.propagationStopped = true;
5299 },
5300 remove: function remove() {
5301 this.remove = true;
5302 },
5303 clone: function clone() {
5304 return Util.clone(this);
5305 },
5306 toString: function toString() {
5307 return '[Event (type=' + this.type + ')]';
5308 }
5309 });
5310
5311 module.exports = Event;
5312
5313 /***/
5314 },
5315 /* 87 */
5316 /***/function (module, exports, __webpack_require__) {
5317
5318 var Util = __webpack_require__(0);
5319 var Element = __webpack_require__(88);
5320 var Shape = __webpack_require__(262);
5321 var SHAPE_MAP = {}; // 缓存图形类型
5322 var INDEX = '_INDEX';
5323
5324 function find(children, x, y) {
5325 var rst = void 0;
5326 for (var i = children.length - 1; i >= 0; i--) {
5327 var child = children[i];
5328 if (child.__cfg.visible && child.__cfg.capture) {
5329 if (child.isGroup) {
5330 rst = child.getShape(x, y);
5331 } else if (child.isHit(x, y)) {
5332 rst = child;
5333 }
5334 }
5335 if (rst) {
5336 break;
5337 }
5338 }
5339 return rst;
5340 }
5341
5342 function getComparer(compare) {
5343 return function (left, right) {
5344 var result = compare(left, right);
5345 return result === 0 ? left[INDEX] - right[INDEX] : result;
5346 };
5347 }
5348
5349 var Group = function Group(cfg) {
5350 Group.superclass.constructor.call(this, cfg);
5351 this.set('children', []);
5352
5353 this._beforeRenderUI();
5354 this._renderUI();
5355 this._bindUI();
5356 };
5357
5358 function initClassCfgs(c) {
5359 if (c.__cfg || c === Group) {
5360 return;
5361 }
5362 var superCon = c.superclass.constructor;
5363 if (superCon && !superCon.__cfg) {
5364 initClassCfgs(superCon);
5365 }
5366 c.__cfg = {};
5367
5368 Util.merge(c.__cfg, superCon.__cfg);
5369 Util.merge(c.__cfg, c.CFG);
5370 }
5371
5372 Util.extend(Group, Element);
5373
5374 Util.augment(Group, {
5375 isGroup: true,
5376 canFill: true,
5377 canStroke: true,
5378 getDefaultCfg: function getDefaultCfg() {
5379 initClassCfgs(this.constructor);
5380 return Util.merge({}, this.constructor.__cfg);
5381 },
5382 _beforeRenderUI: function _beforeRenderUI() {},
5383 _renderUI: function _renderUI() {},
5384 _bindUI: function _bindUI() {},
5385 addShape: function addShape(type, cfg) {
5386 var canvas = this.get('canvas');
5387 cfg = cfg || {};
5388 var shapeType = SHAPE_MAP[type];
5389 if (!shapeType) {
5390 shapeType = Util.upperFirst(type);
5391 SHAPE_MAP[type] = shapeType;
5392 }
5393 if (cfg.attrs) {
5394 var attrs = cfg.attrs;
5395 if (type === 'text') {
5396 // 临时解决
5397 var topFontFamily = canvas.get('fontFamily');
5398 if (topFontFamily) {
5399 attrs.fontFamily = attrs.fontFamily ? attrs.fontFamily : topFontFamily;
5400 }
5401 }
5402 }
5403 cfg.canvas = canvas;
5404 cfg.type = type;
5405 var rst = new Shape[shapeType](cfg);
5406 this.add(rst);
5407 return rst;
5408 },
5409
5410 /** 添加图组
5411 * @param {Function|Object|undefined} param 图组类
5412 * @param {Object} cfg 配置项
5413 * @return {Object} rst 图组
5414 */
5415 addGroup: function addGroup(param, cfg) {
5416 var canvas = this.get('canvas');
5417 var rst = void 0;
5418 cfg = Util.merge({}, cfg);
5419 if (Util.isFunction(param)) {
5420 if (cfg) {
5421 cfg.canvas = canvas;
5422 cfg.parent = this;
5423 rst = new param(cfg);
5424 } else {
5425 rst = new param({
5426 canvas: canvas,
5427 parent: this
5428 });
5429 }
5430 this.add(rst);
5431 } else if (Util.isObject(param)) {
5432 param.canvas = canvas;
5433 rst = new Group(param);
5434 this.add(rst);
5435 } else if (param === undefined) {
5436 rst = new Group();
5437 this.add(rst);
5438 } else {
5439 return false;
5440 }
5441 return rst;
5442 },
5443
5444 /** 绘制背景
5445 * @param {Array} padding 内边距
5446 * @param {Attrs} attrs 图形属性
5447 * @param {Shape} backShape 背景图形
5448 * @return {Object} 背景层对象
5449 */
5450 renderBack: function renderBack(padding, attrs) {
5451 var backShape = this.get('backShape');
5452 var innerBox = this.getBBox();
5453 // const parent = this.get('parent'); // getParent
5454 Util.merge(attrs, {
5455 x: innerBox.minX - padding[3],
5456 y: innerBox.minY - padding[0],
5457 width: innerBox.width + padding[1] + padding[3],
5458 height: innerBox.height + padding[0] + padding[2]
5459 });
5460 if (backShape) {
5461 backShape.attr(attrs);
5462 } else {
5463 backShape = this.addShape('rect', {
5464 zIndex: -1,
5465 attrs: attrs
5466 });
5467 }
5468 this.set('backShape', backShape);
5469 this.sort();
5470 return backShape;
5471 },
5472 removeChild: function removeChild(item, destroy) {
5473 if (arguments.length >= 2) {
5474 if (this.contain(item)) {
5475 item.remove(destroy);
5476 }
5477 } else {
5478 if (arguments.length === 1) {
5479 if (Util.isBoolean(item)) {
5480 destroy = item;
5481 } else {
5482 if (this.contain(item)) {
5483 item.remove(true);
5484 }
5485 return this;
5486 }
5487 }
5488 if (arguments.length === 0) {
5489 destroy = true;
5490 }
5491
5492 Group.superclass.remove.call(this, destroy);
5493 }
5494 return this;
5495 },
5496
5497 /**
5498 * 向组中添加shape或者group
5499 * @param {Object} items 图形或者分组
5500 * @return {Object} group 本尊
5501 */
5502 add: function add(items) {
5503 var self = this;
5504 var children = self.get('children');
5505 if (Util.isArray(items)) {
5506 Util.each(items, function (item) {
5507 var parent = item.get('parent');
5508 if (parent) {
5509 parent.removeChild(item, false);
5510 }
5511 self.__setEvn(item);
5512 });
5513 children.push.apply(children, items);
5514 } else {
5515 var item = items;
5516 var parent = item.get('parent');
5517 if (parent) {
5518 parent.removeChild(item, false);
5519 }
5520 self.__setEvn(item);
5521 children.push(item);
5522 }
5523 return self;
5524 },
5525 contain: function contain(item) {
5526 var children = this.get('children');
5527 return children.indexOf(item) > -1;
5528 },
5529 getChildByIndex: function getChildByIndex(index) {
5530 var children = this.get('children');
5531 return children[index];
5532 },
5533 getFirst: function getFirst() {
5534 return this.getChildByIndex(0);
5535 },
5536 getLast: function getLast() {
5537 var lastIndex = this.get('children').length - 1;
5538 return this.getChildByIndex(lastIndex);
5539 },
5540 __setEvn: function __setEvn(item) {
5541 var self = this;
5542 item.__cfg.parent = self;
5543 item.__cfg.context = self.__cfg.context;
5544 item.__cfg.canvas = self.__cfg.canvas;
5545 var clip = item.__attrs.clip;
5546 if (clip) {
5547 clip.setSilent('parent', self);
5548 clip.setSilent('context', self.get('context'));
5549 }
5550 var children = item.__cfg.children;
5551 if (children) {
5552 Util.each(children, function (child) {
5553 item.__setEvn(child);
5554 });
5555 }
5556 },
5557 getBBox: function getBBox() {
5558 var self = this;
5559 var minX = Infinity;
5560 var maxX = -Infinity;
5561 var minY = Infinity;
5562 var maxY = -Infinity;
5563 var children = self.get('children');
5564 Util.each(children, function (child) {
5565 if (child.get('visible')) {
5566 var _box = child.getBBox();
5567 if (!_box) {
5568 return true;
5569 }
5570
5571 var leftTop = [_box.minX, _box.minY, 1];
5572 var leftBottom = [_box.minX, _box.maxY, 1];
5573 var rightTop = [_box.maxX, _box.minY, 1];
5574 var rightBottom = [_box.maxX, _box.maxY, 1];
5575
5576 child.apply(leftTop);
5577 child.apply(leftBottom);
5578 child.apply(rightTop);
5579 child.apply(rightBottom);
5580
5581 var boxMinX = Math.min(leftTop[0], leftBottom[0], rightTop[0], rightBottom[0]);
5582 var boxMaxX = Math.max(leftTop[0], leftBottom[0], rightTop[0], rightBottom[0]);
5583 var boxMinY = Math.min(leftTop[1], leftBottom[1], rightTop[1], rightBottom[1]);
5584 var boxMaxY = Math.max(leftTop[1], leftBottom[1], rightTop[1], rightBottom[1]);
5585
5586 if (boxMinX < minX) {
5587 minX = boxMinX;
5588 }
5589
5590 if (boxMaxX > maxX) {
5591 maxX = boxMaxX;
5592 }
5593
5594 if (boxMinY < minY) {
5595 minY = boxMinY;
5596 }
5597
5598 if (boxMaxY > maxY) {
5599 maxY = boxMaxY;
5600 }
5601 }
5602 });
5603 var box = {
5604 minX: minX,
5605 minY: minY,
5606 maxX: maxX,
5607 maxY: maxY
5608 };
5609 box.x = box.minX;
5610 box.y = box.minY;
5611 box.width = box.maxX - box.minX;
5612 box.height = box.maxY - box.minY;
5613 return box;
5614 },
5615 drawInner: function drawInner(context) {
5616 var children = this.get('children');
5617 for (var i = 0; i < children.length; i++) {
5618 var child = children[i];
5619 child.draw(context);
5620 }
5621 return this;
5622 },
5623 getCount: function getCount() {
5624 return this.get('children').length;
5625 },
5626 sort: function sort() {
5627 var children = this.get('children');
5628 // 稳定排序
5629 Util.each(children, function (child, index) {
5630 child[INDEX] = index;
5631 return child;
5632 });
5633
5634 children.sort(getComparer(function (obj1, obj2) {
5635 return obj1.get('zIndex') - obj2.get('zIndex');
5636 }));
5637
5638 return this;
5639 },
5640 find: function find(id) {
5641 return this.findBy(function (item) {
5642 return item.get('id') === id;
5643 });
5644 },
5645
5646 /**
5647 * 根据查找函数查找分组或者图形
5648 * @param {Function} fn 匹配函数
5649 * @return {Canvas.Base} 分组或者图形
5650 */
5651 findBy: function findBy(fn) {
5652 var children = this.get('children');
5653 var rst = null;
5654
5655 Util.each(children, function (item) {
5656 if (fn(item)) {
5657 rst = item;
5658 } else if (item.findBy) {
5659 rst = item.findBy(fn);
5660 }
5661 if (rst) {
5662 return false;
5663 }
5664 });
5665 return rst;
5666 },
5667 findAllBy: function findAllBy(fn) {
5668 var children = this.get('children');
5669 var rst = [];
5670 var childRst = [];
5671 Util.each(children, function (item) {
5672 if (fn(item)) {
5673 rst.push(item);
5674 }
5675 if (item.findAllBy) {
5676 childRst = item.findAllBy(fn);
5677 rst = rst.concat(childRst);
5678 }
5679 });
5680 return rst;
5681 },
5682
5683 /**
5684 * 根据x,y轴坐标获取对应的图形
5685 * @param {Number} x x坐标
5686 * @param {Number} y y坐标
5687 * @return {Object} 最上面的图形
5688 */
5689 getShape: function getShape(x, y) {
5690 var self = this;
5691 var clip = self.__attrs.clip;
5692 var children = self.__cfg.children;
5693 var rst = void 0;
5694 if (clip) {
5695 if (clip.inside(x, y)) {
5696 rst = find(children, x, y);
5697 }
5698 } else {
5699 rst = find(children, x, y);
5700 }
5701 return rst;
5702 },
5703 clearTotalMatrix: function clearTotalMatrix() {
5704 var m = this.get('totalMatrix');
5705 if (m) {
5706 this.setSilent('totalMatrix', null);
5707 var children = this.__cfg.children;
5708 for (var i = 0; i < children.length; i++) {
5709 var child = children[i];
5710 child.clearTotalMatrix();
5711 }
5712 }
5713 },
5714 clear: function clear() {
5715 var children = this.get('children');
5716
5717 while (children.length !== 0) {
5718 children[children.length - 1].remove();
5719 }
5720 return this;
5721 },
5722 destroy: function destroy() {
5723 if (this.get('destroyed')) {
5724 return;
5725 }
5726 this.clear();
5727 Group.superclass.destroy.call(this);
5728 }
5729 });
5730
5731 module.exports = Group;
5732
5733 /***/
5734 },
5735 /* 88 */
5736 /***/function (module, exports, __webpack_require__) {
5737
5738 var Util = __webpack_require__(0);
5739 var Attribute = __webpack_require__(228);
5740 var Transform = __webpack_require__(229);
5741 var Animate = __webpack_require__(233);
5742 var Format = __webpack_require__(97);
5743 var EventEmitter = __webpack_require__(261);
5744
5745 var SHAPE_ATTRS = ['fillStyle', 'font', 'globalAlpha', 'lineCap', 'lineWidth', 'lineJoin', 'miterLimit', 'shadowBlur', 'shadowColor', 'shadowOffsetX', 'shadowOffsetY', 'strokeStyle', 'textAlign', 'textBaseline', 'lineDash'];
5746
5747 var Element = function Element(cfg) {
5748 this.__cfg = {
5749 zIndex: 0,
5750 capture: true,
5751 visible: true,
5752 destroyed: false
5753 }; // 配置存放地
5754
5755 Util.assign(this.__cfg, this.getDefaultCfg(), cfg); // Element.CFG不合并,提升性能 合并默认配置,用户配置->继承默认配置->Element默认配置
5756 this.initAttrs(this.__cfg.attrs); // 初始化绘图属性
5757 this.initTransform(); // 初始化变换
5758 this.init(); // 类型初始化
5759 };
5760
5761 Element.CFG = {
5762 /**
5763 * 唯一标示
5764 * @type {Number}
5765 */
5766 id: null,
5767 /**
5768 * Z轴的层叠关系,Z值越大离用户越近
5769 * @type {Number}
5770 */
5771 zIndex: 0,
5772 /**
5773 * Canvas对象
5774 * @type: {Object}
5775 */
5776 canvas: null,
5777 /**
5778 * 父元素指针
5779 * @type {Object}
5780 */
5781 parent: null,
5782 /**
5783 * 用来设置当前对象是否能被捕捉
5784 * true 能
5785 * false 不能
5786 * 对象默认是都可以被捕捉的, 当capture为false时,group.getShape(x, y)方法无法获得该元素
5787 * 通过将不必要捕捉的元素的该属性设置成false, 来提高捕捉性能
5788 * @type {Boolean}
5789 **/
5790 capture: true,
5791 /**
5792 * 画布的上下文
5793 * @type {Object}
5794 */
5795 context: null,
5796 /**
5797 * 是否显示
5798 * @type {Boolean}
5799 */
5800 visible: true,
5801 /**
5802 * 是否被销毁
5803 * @type: {Boolean}
5804 */
5805 destroyed: false
5806 };
5807
5808 Util.augment(Element, Attribute, Transform, EventEmitter, Animate, {
5809 init: function init() {
5810 this.setSilent('animable', true);
5811 this.setSilent('animating', false); // 初始时不处于动画状态
5812 var attrs = this.__attrs;
5813 if (attrs && attrs.rotate) {
5814 this.rotateAtStart(attrs.rotate);
5815 }
5816 },
5817 getParent: function getParent() {
5818 return this.get('parent');
5819 },
5820
5821 /**
5822 * 获取默认的配置信息
5823 * @protected
5824 * @return {Object} 默认的属性
5825 */
5826 getDefaultCfg: function getDefaultCfg() {
5827 return {};
5828 },
5829 set: function set(name, value) {
5830 var m = '__set' + Util.upperFirst(name);
5831
5832 if (this[m]) {
5833 value = this[m](value);
5834 }
5835 this.__cfg[name] = value;
5836 return this;
5837 },
5838 setSilent: function setSilent(name, value) {
5839 this.__cfg[name] = value;
5840 },
5841 get: function get(name) {
5842 return this.__cfg[name];
5843 },
5844 draw: function draw(context) {
5845 if (this.get('destroyed')) {
5846 return;
5847 }
5848 if (this.get('visible')) {
5849 this.setContext(context);
5850 this.drawInner(context);
5851 this.restoreContext(context);
5852 }
5853 },
5854 setContext: function setContext(context) {
5855 var clip = this.__attrs.clip;
5856 context.save();
5857 if (clip) {
5858 // context.save();
5859 clip.resetTransform(context);
5860 clip.createPath(context);
5861 context.clip();
5862 // context.restore();
5863 }
5864 this.resetContext(context);
5865 this.resetTransform(context);
5866 },
5867 restoreContext: function restoreContext(context) {
5868 context.restore();
5869 },
5870 resetContext: function resetContext(context) {
5871 var elAttrs = this.__attrs;
5872 // var canvas = this.get('canvas');
5873 if (!this.isGroup) {
5874 // canvas.registShape(this); // 快速拾取方案暂时不执行
5875 for (var k in elAttrs) {
5876 if (SHAPE_ATTRS.indexOf(k) > -1) {
5877 // 非canvas属性不附加
5878 var v = elAttrs[k];
5879 if (k === 'fillStyle') {
5880 v = Format.parseStyle(v, this);
5881 }
5882 if (k === 'strokeStyle') {
5883 v = Format.parseStyle(v, this);
5884 }
5885 if (k === 'lineDash' && context.setLineDash) {
5886 if (Util.isArray(v)) {
5887 context.setLineDash(v);
5888 } else if (Util.isString(v)) {
5889 context.setLineDash(v.split(' '));
5890 }
5891 } else {
5892 context[k] = v;
5893 }
5894 }
5895 }
5896 }
5897 },
5898 drawInner: function drawInner() /* context */{},
5899 show: function show() {
5900 this.set('visible', true);
5901 return this;
5902 },
5903 hide: function hide() {
5904 this.set('visible', false);
5905 return this;
5906 },
5907 remove: function remove(destroy) {
5908 if (destroy === undefined) {
5909 destroy = true;
5910 }
5911
5912 if (this.get('parent')) {
5913 var parent = this.get('parent');
5914 var children = parent.get('children');
5915 Util.remove(children, this);
5916 }
5917
5918 if (destroy) {
5919 this.destroy();
5920 }
5921
5922 return this;
5923 },
5924 destroy: function destroy() {
5925 var destroyed = this.get('destroyed');
5926
5927 if (destroyed) {
5928 return;
5929 }
5930 this.__cfg = {};
5931 this.__attrs = null;
5932 this.removeEvent(); // 移除所有的事件
5933 this.set('destroyed', true);
5934 },
5935 __setZIndex: function __setZIndex(zIndex) {
5936 this.__cfg.zIndex = zIndex;
5937
5938 if (!Util.isNil(this.get('parent'))) {
5939 this.get('parent').sort();
5940 }
5941 return zIndex;
5942 },
5943 __setAttrs: function __setAttrs(attrs) {
5944 this.attr(attrs);
5945 return attrs;
5946 },
5947 setZIndex: function setZIndex(zIndex) {
5948 this.__cfg.zIndex = zIndex;
5949 return zIndex;
5950 },
5951 clone: function clone() {
5952 return Util.clone(this);
5953 },
5954 getBBox: function getBBox() {
5955 return {
5956 minX: 0,
5957 maxX: 0,
5958 minY: 0,
5959 maxY: 0
5960 };
5961 }
5962 });
5963
5964 module.exports = Element;
5965
5966 /***/
5967 },
5968 /* 89 */
5969 /***/function (module, __webpack_exports__, __webpack_require__) {
5970
5971 "use strict";
5972 /* harmony export (binding) */
5973 __webpack_require__.d(__webpack_exports__, "a", function () {
5974 return deg2rad;
5975 });
5976 /* harmony export (binding) */__webpack_require__.d(__webpack_exports__, "b", function () {
5977 return rad2deg;
5978 });
5979 var deg2rad = Math.PI / 180;
5980 var rad2deg = 180 / Math.PI;
5981
5982 /***/
5983 },
5984 /* 90 */
5985 /***/function (module, __webpack_exports__, __webpack_require__) {
5986
5987 "use strict";
5988 /* harmony export (binding) */
5989 __webpack_require__.d(__webpack_exports__, "b", function () {
5990 return rgbBasis;
5991 });
5992 /* harmony export (binding) */__webpack_require__.d(__webpack_exports__, "c", function () {
5993 return rgbBasisClosed;
5994 });
5995 /* harmony import */var __WEBPACK_IMPORTED_MODULE_0_d3_color__ = __webpack_require__(14);
5996 /* harmony import */var __WEBPACK_IMPORTED_MODULE_1__basis__ = __webpack_require__(51);
5997 /* harmony import */var __WEBPACK_IMPORTED_MODULE_2__basisClosed__ = __webpack_require__(91);
5998 /* harmony import */var __WEBPACK_IMPORTED_MODULE_3__color__ = __webpack_require__(19);
5999
6000 /* harmony default export */__webpack_exports__["a"] = function rgbGamma(y) {
6001 var color = Object(__WEBPACK_IMPORTED_MODULE_3__color__["b" /* gamma */])(y);
6002
6003 function rgb(start, end) {
6004 var r = color((start = Object(__WEBPACK_IMPORTED_MODULE_0_d3_color__["f" /* rgb */])(start)).r, (end = Object(__WEBPACK_IMPORTED_MODULE_0_d3_color__["f" /* rgb */])(end)).r),
6005 g = color(start.g, end.g),
6006 b = color(start.b, end.b),
6007 opacity = Object(__WEBPACK_IMPORTED_MODULE_3__color__["a" /* default */])(start.opacity, end.opacity);
6008 return function (t) {
6009 start.r = r(t);
6010 start.g = g(t);
6011 start.b = b(t);
6012 start.opacity = opacity(t);
6013 return start + "";
6014 };
6015 }
6016
6017 rgb.gamma = rgbGamma;
6018
6019 return rgb;
6020 }(1);
6021
6022 function rgbSpline(spline) {
6023 return function (colors) {
6024 var n = colors.length,
6025 r = new Array(n),
6026 g = new Array(n),
6027 b = new Array(n),
6028 i,
6029 color;
6030 for (i = 0; i < n; ++i) {
6031 color = Object(__WEBPACK_IMPORTED_MODULE_0_d3_color__["f" /* rgb */])(colors[i]);
6032 r[i] = color.r || 0;
6033 g[i] = color.g || 0;
6034 b[i] = color.b || 0;
6035 }
6036 r = spline(r);
6037 g = spline(g);
6038 b = spline(b);
6039 color.opacity = 1;
6040 return function (t) {
6041 color.r = r(t);
6042 color.g = g(t);
6043 color.b = b(t);
6044 return color + "";
6045 };
6046 };
6047 }
6048
6049 var rgbBasis = rgbSpline(__WEBPACK_IMPORTED_MODULE_1__basis__["b" /* default */]);
6050 var rgbBasisClosed = rgbSpline(__WEBPACK_IMPORTED_MODULE_2__basisClosed__["a" /* default */]);
6051
6052 /***/
6053 },
6054 /* 91 */
6055 /***/function (module, __webpack_exports__, __webpack_require__) {
6056
6057 "use strict";
6058 /* harmony import */
6059 var __WEBPACK_IMPORTED_MODULE_0__basis__ = __webpack_require__(51);
6060
6061 /* harmony default export */__webpack_exports__["a"] = function (values) {
6062 var n = values.length;
6063 return function (t) {
6064 var i = Math.floor(((t %= 1) < 0 ? ++t : t) * n),
6065 v0 = values[(i + n - 1) % n],
6066 v1 = values[i % n],
6067 v2 = values[(i + 1) % n],
6068 v3 = values[(i + 2) % n];
6069 return Object(__WEBPACK_IMPORTED_MODULE_0__basis__["a" /* basis */])((t - i / n) * n, v0, v1, v2, v3);
6070 };
6071 };
6072
6073 /***/
6074 },
6075 /* 92 */
6076 /***/function (module, __webpack_exports__, __webpack_require__) {
6077
6078 "use strict";
6079 /* harmony default export */
6080 __webpack_exports__["a"] = function (x) {
6081 return function () {
6082 return x;
6083 };
6084 };
6085
6086 /***/
6087 },
6088 /* 93 */
6089 /***/function (module, __webpack_exports__, __webpack_require__) {
6090
6091 "use strict";
6092 /* harmony import */
6093 var __WEBPACK_IMPORTED_MODULE_0__value__ = __webpack_require__(48);
6094
6095 /* harmony default export */__webpack_exports__["a"] = function (a, b) {
6096 var nb = b ? b.length : 0,
6097 na = a ? Math.min(nb, a.length) : 0,
6098 x = new Array(na),
6099 c = new Array(nb),
6100 i;
6101
6102 for (i = 0; i < na; ++i) {
6103 x[i] = Object(__WEBPACK_IMPORTED_MODULE_0__value__["a" /* default */])(a[i], b[i]);
6104 }for (; i < nb; ++i) {
6105 c[i] = b[i];
6106 }return function (t) {
6107 for (i = 0; i < na; ++i) {
6108 c[i] = x[i](t);
6109 }return c;
6110 };
6111 };
6112
6113 /***/
6114 },
6115 /* 94 */
6116 /***/function (module, __webpack_exports__, __webpack_require__) {
6117
6118 "use strict";
6119 /* harmony default export */
6120 __webpack_exports__["a"] = function (a, b) {
6121 var d = new Date();
6122 return a = +a, b -= a, function (t) {
6123 return d.setTime(a + b * t), d;
6124 };
6125 };
6126
6127 /***/
6128 },
6129 /* 95 */
6130 /***/function (module, __webpack_exports__, __webpack_require__) {
6131
6132 "use strict";
6133 /* harmony import */
6134 var __WEBPACK_IMPORTED_MODULE_0__value__ = __webpack_require__(48);
6135 var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) {
6136 return typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
6137 } : function (obj) {
6138 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
6139 };
6140
6141 /* harmony default export */__webpack_exports__["a"] = function (a, b) {
6142 var i = {},
6143 c = {},
6144 k;
6145
6146 if (a === null || (typeof a === "undefined" ? "undefined" : _typeof(a)) !== "object") a = {};
6147 if (b === null || (typeof b === "undefined" ? "undefined" : _typeof(b)) !== "object") b = {};
6148
6149 for (k in b) {
6150 if (k in a) {
6151 i[k] = Object(__WEBPACK_IMPORTED_MODULE_0__value__["a" /* default */])(a[k], b[k]);
6152 } else {
6153 c[k] = b[k];
6154 }
6155 }
6156
6157 return function (t) {
6158 for (k in i) {
6159 c[k] = i[k](t);
6160 }return c;
6161 };
6162 };
6163
6164 /***/
6165 },
6166 /* 96 */
6167 /***/function (module, __webpack_exports__, __webpack_require__) {
6168
6169 "use strict";
6170 /* harmony import */
6171 var __WEBPACK_IMPORTED_MODULE_0__number__ = __webpack_require__(29);
6172
6173 var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,
6174 reB = new RegExp(reA.source, "g");
6175
6176 function zero(b) {
6177 return function () {
6178 return b;
6179 };
6180 }
6181
6182 function one(b) {
6183 return function (t) {
6184 return b(t) + "";
6185 };
6186 }
6187
6188 /* harmony default export */__webpack_exports__["a"] = function (a, b) {
6189 var bi = reA.lastIndex = reB.lastIndex = 0,
6190
6191 // scan index for next number in b
6192 am,
6193
6194 // current match in a
6195 bm,
6196
6197 // current match in b
6198 bs,
6199
6200 // string preceding current number in b, if any
6201 i = -1,
6202
6203 // index in s
6204 s = [],
6205
6206 // string constants and placeholders
6207 q = []; // number interpolators
6208
6209 // Coerce inputs to strings.
6210 a = a + "", b = b + "";
6211
6212 // Interpolate pairs of numbers in a & b.
6213 while ((am = reA.exec(a)) && (bm = reB.exec(b))) {
6214 if ((bs = bm.index) > bi) {
6215 // a string precedes the next number in b
6216 bs = b.slice(bi, bs);
6217 if (s[i]) s[i] += bs; // coalesce with previous string
6218 else s[++i] = bs;
6219 }
6220 if ((am = am[0]) === (bm = bm[0])) {
6221 // numbers in a & b match
6222 if (s[i]) s[i] += bm; // coalesce with previous string
6223 else s[++i] = bm;
6224 } else {
6225 // interpolate non-matching numbers
6226 s[++i] = null;
6227 q.push({ i: i, x: Object(__WEBPACK_IMPORTED_MODULE_0__number__["a" /* default */])(am, bm) });
6228 }
6229 bi = reB.lastIndex;
6230 }
6231
6232 // Add remains of b.
6233 if (bi < b.length) {
6234 bs = b.slice(bi);
6235 if (s[i]) s[i] += bs; // coalesce with previous string
6236 else s[++i] = bs;
6237 }
6238
6239 // Special optimization for only a single match.
6240 // Otherwise, interpolate each of the numbers and rejoin the string.
6241 return s.length < 2 ? q[0] ? one(q[0].x) : zero(b) : (b = q.length, function (t) {
6242 for (var i = 0, o; i < b; ++i) {
6243 s[(o = q[i]).i] = o.x(t);
6244 }return s.join("");
6245 });
6246 };
6247
6248 /***/
6249 },
6250 /* 97 */
6251 /***/function (module, exports, __webpack_require__) {
6252
6253 var Util = __webpack_require__(0);
6254
6255 var regexTags = /[MLHVQTCSAZ]([^MLHVQTCSAZ]*)/ig;
6256 var regexDot = /[^\s\,]+/ig;
6257 var regexLG = /^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i;
6258 var regexRG = /^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i;
6259 var regexPR = /^p\s*\(\s*([axyn])\s*\)\s*(.*)/i;
6260 var regexColorStop = /[\d.]+:(#[^\s]+|[^\)]+\))/ig;
6261 var numColorCache = {};
6262
6263 function addStop(steps, gradient) {
6264 var arr = steps.match(regexColorStop);
6265 Util.each(arr, function (item) {
6266 item = item.split(':');
6267 gradient.addColorStop(item[0], item[1]);
6268 });
6269 }
6270
6271 function parseLineGradient(color, self) {
6272 var arr = regexLG.exec(color);
6273 var angle = Util.mod(Util.toRadian(parseFloat(arr[1])), Math.PI * 2);
6274 var steps = arr[2];
6275 var box = self.getBBox();
6276 var start = void 0;
6277 var end = void 0;
6278
6279 if (angle >= 0 && angle < 0.5 * Math.PI) {
6280 start = {
6281 x: box.minX,
6282 y: box.minY
6283 };
6284 end = {
6285 x: box.maxX,
6286 y: box.maxY
6287 };
6288 } else if (0.5 * Math.PI <= angle && angle < Math.PI) {
6289 start = {
6290 x: box.maxX,
6291 y: box.minY
6292 };
6293 end = {
6294 x: box.minX,
6295 y: box.maxY
6296 };
6297 } else if (Math.PI <= angle && angle < 1.5 * Math.PI) {
6298 start = {
6299 x: box.maxX,
6300 y: box.maxY
6301 };
6302 end = {
6303 x: box.minX,
6304 y: box.minY
6305 };
6306 } else {
6307 start = {
6308 x: box.minX,
6309 y: box.maxY
6310 };
6311 end = {
6312 x: box.maxX,
6313 y: box.minY
6314 };
6315 }
6316
6317 var tanTheta = Math.tan(angle);
6318 var tanTheta2 = tanTheta * tanTheta;
6319
6320 var x = (end.x - start.x + tanTheta * (end.y - start.y)) / (tanTheta2 + 1) + start.x;
6321 var y = tanTheta * (end.x - start.x + tanTheta * (end.y - start.y)) / (tanTheta2 + 1) + start.y;
6322 var context = self.get('context');
6323 var gradient = context.createLinearGradient(start.x, start.y, x, y);
6324 addStop(steps, gradient);
6325 return gradient;
6326 }
6327
6328 function parseRadialGradient(color, self) {
6329 var arr = regexRG.exec(color);
6330 var fx = parseFloat(arr[1]);
6331 var fy = parseFloat(arr[2]);
6332 var fr = parseFloat(arr[3]);
6333 var steps = arr[4];
6334 var box = self.getBBox();
6335 var context = self.get('context');
6336 var width = box.maxX - box.minX;
6337 var height = box.maxY - box.minY;
6338 var r = Math.sqrt(width * width + height * height) / 2;
6339 var gradient = context.createRadialGradient(box.minX + width * fx, box.minY + height * fy, fr * r, box.minX + width / 2, box.minY + height / 2, r);
6340 addStop(steps, gradient);
6341 return gradient;
6342 }
6343
6344 function parsePattern(color, self) {
6345 if (self.get('patternSource') && self.get('patternSource') === color) {
6346 return self.get('pattern');
6347 }
6348 var pattern = void 0;
6349 var img = void 0;
6350 var arr = regexPR.exec(color);
6351 var repeat = arr[1];
6352 var source = arr[2];
6353
6354 // Function to be called when pattern loads
6355 function onload() {
6356 // Create pattern
6357 var context = self.get('context');
6358 pattern = context.createPattern(img, repeat);
6359 self.setSilent('pattern', pattern); // be a cache
6360 self.setSilent('patternSource', color);
6361 }
6362
6363 switch (repeat) {
6364 case 'a':
6365 repeat = 'repeat';
6366 break;
6367 case 'x':
6368 repeat = 'repeat-x';
6369 break;
6370 case 'y':
6371 repeat = 'repeat-y';
6372 break;
6373 case 'n':
6374 repeat = 'no-repeat';
6375 break;
6376 default:
6377 repeat = 'no-repeat';
6378 }
6379
6380 img = new Image();
6381 // If source URL is not a data URL
6382 if (!source.match(/^data:/i)) {
6383 // Set crossOrigin for this image
6384 img.crossOrigin = 'Anonymous';
6385 }
6386 img.src = source;
6387
6388 if (img.complete) {
6389 onload();
6390 } else {
6391 img.onload = onload;
6392 // Fix onload() bug in IE9
6393 img.src = img.src;
6394 }
6395
6396 return pattern;
6397 }
6398
6399 module.exports = {
6400 parsePath: function parsePath(path) {
6401 path = path || [];
6402 if (Util.isArray(path)) {
6403 return path;
6404 }
6405
6406 if (Util.isString(path)) {
6407 path = path.match(regexTags);
6408 Util.each(path, function (item, index) {
6409 item = item.match(regexDot);
6410 if (item[0].length > 1) {
6411 var tag = item[0].charAt(0);
6412 item.splice(1, 0, item[0].substr(1));
6413 item[0] = tag;
6414 }
6415 Util.each(item, function (sub, i) {
6416 if (!isNaN(sub)) {
6417 item[i] = +sub;
6418 }
6419 });
6420 path[index] = item;
6421 });
6422 return path;
6423 }
6424 },
6425 parseStyle: function parseStyle(color, self) {
6426 if (Util.isString(color)) {
6427 if (color[1] === '(' || color[2] === '(') {
6428 if (color[0] === 'l') {
6429 // regexLG.test(color)
6430 return parseLineGradient(color, self);
6431 } else if (color[0] === 'r') {
6432 // regexRG.test(color)
6433 return parseRadialGradient(color, self);
6434 } else if (color[0] === 'p') {
6435 // regexPR.test(color)
6436 return parsePattern(color, self);
6437 }
6438 }
6439 return color;
6440 }
6441 },
6442 numberToColor: function numberToColor(num) {
6443 // 增加缓存
6444 var color = numColorCache[num];
6445 if (!color) {
6446 var str = num.toString(16);
6447 for (var i = str.length; i < 6; i++) {
6448 str = '0' + str;
6449 }
6450 color = '#' + str;
6451 numColorCache[num] = color;
6452 }
6453 return color;
6454 }
6455 };
6456
6457 /***/
6458 },
6459 /* 98 */
6460 /***/function (module, exports, __webpack_require__) {
6461
6462 var Util = __webpack_require__(0);
6463 var Shape = __webpack_require__(1);
6464 var Inside = __webpack_require__(2);
6465
6466 var Rect = function Rect(cfg) {
6467 Rect.superclass.constructor.call(this, cfg);
6468 };
6469
6470 Rect.ATTRS = {
6471 x: 0,
6472 y: 0,
6473 width: 0,
6474 height: 0,
6475 radius: 0,
6476 lineWidth: 1
6477 };
6478
6479 Util.extend(Rect, Shape);
6480
6481 Util.augment(Rect, {
6482 canFill: true,
6483 canStroke: true,
6484 type: 'rect',
6485 getDefaultAttrs: function getDefaultAttrs() {
6486 return {
6487 lineWidth: 1,
6488 radius: 0
6489 };
6490 },
6491 calculateBox: function calculateBox() {
6492 var self = this;
6493 var attrs = self.__attrs;
6494 var x = attrs.x;
6495 var y = attrs.y;
6496 var width = attrs.width;
6497 var height = attrs.height;
6498 var lineWidth = attrs.lineWidth;
6499
6500 var halfWidth = lineWidth / 2;
6501 return {
6502 minX: x - halfWidth,
6503 minY: y - halfWidth,
6504 maxX: x + width + halfWidth,
6505 maxY: y + height + halfWidth
6506 };
6507 },
6508 isPointInPath: function isPointInPath(x, y) {
6509 var self = this;
6510 var fill = self.hasFill();
6511 var stroke = self.hasStroke();
6512
6513 if (fill && stroke) {
6514 return self.__isPointInFill(x, y) || self.__isPointInStroke(x, y);
6515 }
6516
6517 if (fill) {
6518 return self.__isPointInFill(x, y);
6519 }
6520
6521 if (stroke) {
6522 return self.__isPointInStroke(x, y);
6523 }
6524
6525 return false;
6526 },
6527 __isPointInFill: function __isPointInFill(x, y) {
6528 var context = this.get('context');
6529
6530 if (!context) return false;
6531 this.createPath();
6532 return context.isPointInPath(x, y);
6533 },
6534 __isPointInStroke: function __isPointInStroke(x, y) {
6535 var self = this;
6536 var attrs = self.__attrs;
6537 var rx = attrs.x;
6538 var ry = attrs.y;
6539 var width = attrs.width;
6540 var height = attrs.height;
6541 var radius = attrs.radius;
6542 var lineWidth = attrs.lineWidth;
6543
6544 if (radius === 0) {
6545 var halfWidth = lineWidth / 2;
6546 return Inside.line(rx - halfWidth, ry, rx + width + halfWidth, ry, lineWidth, x, y) || Inside.line(rx + width, ry - halfWidth, rx + width, ry + height + halfWidth, lineWidth, x, y) || Inside.line(rx + width + halfWidth, ry + height, rx - halfWidth, ry + height, lineWidth, x, y) || Inside.line(rx, ry + height + halfWidth, rx, ry - halfWidth, lineWidth, x, y);
6547 }
6548
6549 return Inside.line(rx + radius, ry, rx + width - radius, ry, lineWidth, x, y) || Inside.line(rx + width, ry + radius, rx + width, ry + height - radius, lineWidth, x, y) || Inside.line(rx + width - radius, ry + height, rx + radius, ry + height, lineWidth, x, y) || Inside.line(rx, ry + height - radius, rx, ry + radius, lineWidth, x, y) || Inside.arcline(rx + width - radius, ry + radius, radius, 1.5 * Math.PI, 2 * Math.PI, false, lineWidth, x, y) || Inside.arcline(rx + width - radius, ry + height - radius, radius, 0, 0.5 * Math.PI, false, lineWidth, x, y) || Inside.arcline(rx + radius, ry + height - radius, radius, 0.5 * Math.PI, Math.PI, false, lineWidth, x, y) || Inside.arcline(rx + radius, ry + radius, radius, Math.PI, 1.5 * Math.PI, false, lineWidth, x, y);
6550 },
6551 createPath: function createPath(context) {
6552 var self = this;
6553 var attrs = self.__attrs;
6554 var x = attrs.x;
6555 var y = attrs.y;
6556 var width = attrs.width;
6557 var height = attrs.height;
6558 var radius = attrs.radius;
6559 context = context || self.get('context');
6560
6561 context.beginPath();
6562 if (radius === 0) {
6563 // 改成原生的rect方法
6564 context.rect(x, y, width, height);
6565 } else {
6566 context.moveTo(x + radius, y);
6567 context.lineTo(x + width - radius, y);
6568 context.arc(x + width - radius, y + radius, radius, -Math.PI / 2, 0, false);
6569 context.lineTo(x + width, y + height - radius);
6570 context.arc(x + width - radius, y + height - radius, radius, 0, Math.PI / 2, false);
6571 context.lineTo(x + radius, y + height);
6572 context.arc(x + radius, y + height - radius, radius, Math.PI / 2, Math.PI, false);
6573 context.lineTo(x, y + radius);
6574 context.arc(x + radius, y + radius, radius, Math.PI, Math.PI * 3 / 2, false);
6575 context.closePath();
6576 }
6577 }
6578 });
6579
6580 module.exports = Rect;
6581
6582 /***/
6583 },
6584 /* 99 */
6585 /***/function (module, exports, __webpack_require__) {
6586
6587 var Util = __webpack_require__(0);
6588 var Shape = __webpack_require__(1);
6589 var Inside = __webpack_require__(2);
6590
6591 var Circle = function Circle(cfg) {
6592 Circle.superclass.constructor.call(this, cfg);
6593 };
6594
6595 Circle.ATTRS = {
6596 x: 0,
6597 y: 0,
6598 r: 0,
6599 lineWidth: 1
6600 };
6601
6602 Util.extend(Circle, Shape);
6603
6604 Util.augment(Circle, {
6605 canFill: true,
6606 canStroke: true,
6607 type: 'circle',
6608 getDefaultAttrs: function getDefaultAttrs() {
6609 return {
6610 lineWidth: 1
6611 };
6612 },
6613 calculateBox: function calculateBox() {
6614 var attrs = this.__attrs;
6615 var cx = attrs.x;
6616 var cy = attrs.y;
6617 var r = attrs.r;
6618 var lineWidth = attrs.lineWidth;
6619 var halfWidth = lineWidth / 2 + r;
6620 return {
6621 minX: cx - halfWidth,
6622 minY: cy - halfWidth,
6623 maxX: cx + halfWidth,
6624 maxY: cy + halfWidth
6625 };
6626 },
6627 isPointInPath: function isPointInPath(x, y) {
6628 var fill = this.hasFill();
6629 var stroke = this.hasStroke();
6630 if (fill && stroke) {
6631 return this.__isPointInFill(x, y) || this.__isPointInStroke(x, y);
6632 }
6633
6634 if (fill) {
6635 return this.__isPointInFill(x, y);
6636 }
6637
6638 if (stroke) {
6639 return this.__isPointInStroke(x, y);
6640 }
6641
6642 return false;
6643 },
6644 __isPointInFill: function __isPointInFill(x, y) {
6645 var attrs = this.__attrs;
6646 var cx = attrs.x;
6647 var cy = attrs.y;
6648 var r = attrs.r;
6649
6650 return Inside.circle(cx, cy, r, x, y);
6651 },
6652 __isPointInStroke: function __isPointInStroke(x, y) {
6653 var attrs = this.__attrs;
6654 var cx = attrs.x;
6655 var cy = attrs.y;
6656 var r = attrs.r;
6657 var lineWidth = attrs.lineWidth;
6658
6659 return Inside.arcline(cx, cy, r, 0, Math.PI * 2, false, lineWidth, x, y);
6660 },
6661 createPath: function createPath(context) {
6662 var attrs = this.__attrs;
6663 var cx = attrs.x;
6664 var cy = attrs.y;
6665 var r = attrs.r;
6666 context = context || self.get('context');
6667
6668 context.beginPath();
6669 context.arc(cx, cy, r, 0, Math.PI * 2, false);
6670 }
6671 });
6672
6673 module.exports = Circle;
6674
6675 /***/
6676 },
6677 /* 100 */
6678 /***/function (module, exports, __webpack_require__) {
6679
6680 var Util = __webpack_require__(0);
6681 var Shape = __webpack_require__(1);
6682 var Inside = __webpack_require__(2);
6683 var mat3 = __webpack_require__(3).mat3;
6684 var vec3 = __webpack_require__(3).vec3;
6685
6686 var Ellipse = function Ellipse(cfg) {
6687 Ellipse.superclass.constructor.call(this, cfg);
6688 };
6689
6690 Ellipse.ATTRS = {
6691 x: 0,
6692 y: 0,
6693 rx: 1,
6694 ry: 1,
6695 lineWidth: 1
6696 };
6697
6698 Util.extend(Ellipse, Shape);
6699
6700 Util.augment(Ellipse, {
6701 canFill: true,
6702 canStroke: true,
6703 type: 'ellipse',
6704 getDefaultAttrs: function getDefaultAttrs() {
6705 return {
6706 lineWidth: 1
6707 };
6708 },
6709 calculateBox: function calculateBox() {
6710 var attrs = this.__attrs;
6711 var cx = attrs.x;
6712 var cy = attrs.y;
6713 var rx = attrs.rx;
6714 var ry = attrs.ry;
6715 var lineWidth = attrs.lineWidth;
6716 var halfXWidth = rx + lineWidth / 2;
6717 var halfYWidth = ry + lineWidth / 2;
6718
6719 return {
6720 minX: cx - halfXWidth,
6721 minY: cy - halfYWidth,
6722 maxX: cx + halfXWidth,
6723 maxY: cy + halfYWidth
6724 };
6725 },
6726 isPointInPath: function isPointInPath(x, y) {
6727 var fill = this.hasFill();
6728 var stroke = this.hasStroke();
6729
6730 if (fill && stroke) {
6731 return this.__isPointInFill(x, y) || this.__isPointInStroke(x, y);
6732 }
6733
6734 if (fill) {
6735 return this.__isPointInFill(x, y);
6736 }
6737
6738 if (stroke) {
6739 return this.__isPointInStroke(x, y);
6740 }
6741
6742 return false;
6743 },
6744 __isPointInFill: function __isPointInFill(x, y) {
6745 var attrs = this.__attrs;
6746 var cx = attrs.x;
6747 var cy = attrs.y;
6748 var rx = attrs.rx;
6749 var ry = attrs.ry;
6750
6751 var r = rx > ry ? rx : ry;
6752 var scaleX = rx > ry ? 1 : rx / ry;
6753 var scaleY = rx > ry ? ry / rx : 1;
6754
6755 var p = [x, y, 1];
6756 var m = [1, 0, 0, 0, 1, 0, 0, 0, 1];
6757 mat3.scale(m, m, [scaleX, scaleY]);
6758 mat3.translate(m, m, [cx, cy]);
6759 var inm = mat3.invert([], m);
6760 vec3.transformMat3(p, p, inm);
6761
6762 return Inside.circle(0, 0, r, p[0], p[1]);
6763 },
6764 __isPointInStroke: function __isPointInStroke(x, y) {
6765 var attrs = this.__attrs;
6766 var cx = attrs.x;
6767 var cy = attrs.y;
6768 var rx = attrs.rx;
6769 var ry = attrs.ry;
6770 var lineWidth = attrs.lineWidth;
6771
6772 var r = rx > ry ? rx : ry;
6773 var scaleX = rx > ry ? 1 : rx / ry;
6774 var scaleY = rx > ry ? ry / rx : 1;
6775 var p = [x, y, 1];
6776 var m = [1, 0, 0, 0, 1, 0, 0, 0, 1];
6777 mat3.scale(m, m, [scaleX, scaleY]);
6778 mat3.translate(m, m, [cx, cy]);
6779 var inm = mat3.invert([], m);
6780 vec3.transformMat3(p, p, inm);
6781
6782 return Inside.arcline(0, 0, r, 0, Math.PI * 2, false, lineWidth, p[0], p[1]);
6783 },
6784 createPath: function createPath(context) {
6785 var attrs = this.__attrs;
6786 var cx = attrs.x;
6787 var cy = attrs.y;
6788 var rx = attrs.rx;
6789 var ry = attrs.ry;
6790
6791 context = context || self.get('context');
6792 var r = rx > ry ? rx : ry;
6793 var scaleX = rx > ry ? 1 : rx / ry;
6794 var scaleY = rx > ry ? ry / rx : 1;
6795
6796 var m = [1, 0, 0, 0, 1, 0, 0, 0, 1];
6797 mat3.scale(m, m, [scaleX, scaleY]);
6798 mat3.translate(m, m, [cx, cy]);
6799 context.beginPath();
6800 context.save();
6801 context.transform(m[0], m[1], m[3], m[4], m[6], m[7]);
6802 context.arc(0, 0, r, 0, Math.PI * 2);
6803 context.restore();
6804 context.closePath();
6805 }
6806 });
6807
6808 module.exports = Ellipse;
6809
6810 /***/
6811 },
6812 /* 101 */
6813 /***/function (module, exports, __webpack_require__) {
6814
6815 var Util = __webpack_require__(0);
6816 var Shape = __webpack_require__(1);
6817 var PathSegment = __webpack_require__(263);
6818 var Format = __webpack_require__(97);
6819 var Arrow = __webpack_require__(15);
6820 var PathUtil = __webpack_require__(46);
6821 var CubicMath = __webpack_require__(30);
6822
6823 var Path = function Path(cfg) {
6824 Path.superclass.constructor.call(this, cfg);
6825 };
6826
6827 Path.ATTRS = {
6828 path: null,
6829 lineWidth: 1,
6830 curve: null, // 曲线path
6831 tCache: null,
6832 startArrow: false,
6833 endArrow: false
6834 };
6835
6836 Util.extend(Path, Shape);
6837
6838 Util.augment(Path, {
6839 canFill: true,
6840 canStroke: true,
6841 type: 'path',
6842 getDefaultAttrs: function getDefaultAttrs() {
6843 return {
6844 lineWidth: 1,
6845 startArrow: false,
6846 endArrow: false
6847 };
6848 },
6849 __afterSetAttrPath: function __afterSetAttrPath(path) {
6850 var self = this;
6851 if (Util.isNil(path)) {
6852 self.setSilent('segments', null);
6853 self.setSilent('box', undefined);
6854 return;
6855 }
6856 var pathArray = Format.parsePath(path);
6857 var preSegment = void 0;
6858 var segments = [];
6859
6860 if (!Util.isArray(pathArray) || pathArray.length === 0 || pathArray[0][0] !== 'M' && pathArray[0][0] !== 'm') {
6861 return;
6862 }
6863 var count = pathArray.length;
6864 for (var i = 0; i < pathArray.length; i++) {
6865 var item = pathArray[i];
6866 preSegment = new PathSegment(item, preSegment, i === count - 1);
6867 segments.push(preSegment);
6868 }
6869 self.setSilent('segments', segments);
6870 self.set('tCache', null);
6871 this.setSilent('box', null);
6872 },
6873 __afterSetAttrAll: function __afterSetAttrAll(objs) {
6874 if (objs.path) {
6875 this.__afterSetAttrPath(objs.path);
6876 }
6877 },
6878 calculateBox: function calculateBox() {
6879 var self = this;
6880 var attrs = self.__attrs;
6881 var lineWidth = attrs.lineWidth;
6882 var lineAppendWidth = attrs.lineAppendWidth || 0;
6883 var segments = self.get('segments');
6884
6885 if (!segments) {
6886 return null;
6887 }
6888 lineWidth += lineAppendWidth;
6889 var minX = Infinity;
6890 var maxX = -Infinity;
6891 var minY = Infinity;
6892 var maxY = -Infinity;
6893 Util.each(segments, function (segment) {
6894 segment.getBBox(lineWidth);
6895 var box = segment.box;
6896 if (box) {
6897 if (box.minX < minX) {
6898 minX = box.minX;
6899 }
6900
6901 if (box.maxX > maxX) {
6902 maxX = box.maxX;
6903 }
6904
6905 if (box.minY < minY) {
6906 minY = box.minY;
6907 }
6908
6909 if (box.maxY > maxY) {
6910 maxY = box.maxY;
6911 }
6912 }
6913 });
6914 return {
6915 minX: minX,
6916 minY: minY,
6917 maxX: maxX,
6918 maxY: maxY
6919 };
6920 },
6921 isPointInPath: function isPointInPath(x, y) {
6922 var self = this;
6923 var fill = self.hasFill();
6924 var stroke = self.hasStroke();
6925
6926 if (fill && stroke) {
6927 return self.__isPointInFill(x, y) || self.__isPointInStroke(x, y);
6928 }
6929
6930 if (fill) {
6931 return self.__isPointInFill(x, y);
6932 }
6933
6934 if (stroke) {
6935 return self.__isPointInStroke(x, y);
6936 }
6937
6938 return false;
6939 },
6940 __isPointInFill: function __isPointInFill(x, y) {
6941 var self = this;
6942 var context = self.get('context');
6943 if (!context) return undefined;
6944 self.createPath();
6945 return context.isPointInPath(x, y);
6946 },
6947 __isPointInStroke: function __isPointInStroke(x, y) {
6948 var self = this;
6949 var segments = self.get('segments');
6950 if (!Util.isEmpty(segments)) {
6951 var attrs = self.__attrs;
6952 var lineWidth = attrs.lineWidth;
6953 var appendWidth = attrs.lineAppendWidth || 0;
6954 lineWidth += appendWidth;
6955 for (var i = 0, l = segments.length; i < l; i++) {
6956 if (segments[i].isInside(x, y, lineWidth)) {
6957 return true;
6958 }
6959 }
6960 }
6961
6962 return false;
6963 },
6964 __setTcache: function __setTcache() {
6965 var totalLength = 0;
6966 var tempLength = 0;
6967 var tCache = [];
6968 var segmentT = void 0;
6969 var segmentL = void 0;
6970 var segmentN = void 0;
6971 var l = void 0;
6972 var curve = this.curve;
6973
6974 if (!curve) {
6975 return;
6976 }
6977
6978 Util.each(curve, function (segment, i) {
6979 segmentN = curve[i + 1];
6980 l = segment.length;
6981 if (segmentN) {
6982 totalLength += CubicMath.len(segment[l - 2], segment[l - 1], segmentN[1], segmentN[2], segmentN[3], segmentN[4], segmentN[5], segmentN[6]);
6983 }
6984 });
6985
6986 Util.each(curve, function (segment, i) {
6987 segmentN = curve[i + 1];
6988 l = segment.length;
6989 if (segmentN) {
6990 segmentT = [];
6991 segmentT[0] = tempLength / totalLength;
6992 segmentL = CubicMath.len(segment[l - 2], segment[l - 1], segmentN[1], segmentN[2], segmentN[3], segmentN[4], segmentN[5], segmentN[6]);
6993 tempLength += segmentL;
6994 segmentT[1] = tempLength / totalLength;
6995 tCache.push(segmentT);
6996 }
6997 });
6998
6999 this.tCache = tCache;
7000 },
7001 __calculateCurve: function __calculateCurve() {
7002 var self = this;
7003 var attrs = self.__attrs;
7004 var path = attrs.path;
7005 this.curve = PathUtil.pathTocurve(path);
7006 },
7007 getPoint: function getPoint(t) {
7008 var tCache = this.tCache;
7009 var subt = void 0;
7010 var index = void 0;
7011
7012 if (!tCache) {
7013 this.__calculateCurve();
7014 this.__setTcache();
7015 tCache = this.tCache;
7016 }
7017
7018 var curve = this.curve;
7019
7020 if (!tCache) {
7021 if (curve) {
7022 return {
7023 x: curve[0][1],
7024 y: curve[0][2]
7025 };
7026 }
7027 return null;
7028 }
7029 Util.each(tCache, function (v, i) {
7030 if (t >= v[0] && t <= v[1]) {
7031 subt = (t - v[0]) / (v[1] - v[0]);
7032 index = i;
7033 }
7034 });
7035 var seg = curve[index];
7036 if (Util.isNil(seg) || Util.isNil(index)) {
7037 return null;
7038 }
7039 var l = seg.length;
7040 var nextSeg = curve[index + 1];
7041 return {
7042 x: CubicMath.at(seg[l - 2], nextSeg[1], nextSeg[3], nextSeg[5], 1 - subt),
7043 y: CubicMath.at(seg[l - 1], nextSeg[2], nextSeg[4], nextSeg[6], 1 - subt)
7044 };
7045 },
7046 createPath: function createPath(context) {
7047 var self = this;
7048 var attrs = self.__attrs;
7049 var segments = self.get('segments');
7050
7051 if (!Util.isArray(segments)) return;
7052
7053 context = context || self.get('context');
7054
7055 context.beginPath();
7056
7057 var path = attrs.path;
7058 var startPoint = void 0;
7059 var endPoint = void 0;
7060 var closed = false;
7061 if (path[path.length - 1] === 'z' || path[path.length - 1] === 'Z' || attrs.fill) {
7062 // 闭合路径不绘制箭头
7063 closed = true;
7064 }
7065
7066 var segmentsLen = segments.length;
7067 if (segmentsLen > 1 && !closed) {
7068 startPoint = segments[0].endPoint;
7069 endPoint = segments[1].endPoint;
7070 Arrow.addStartArrow(context, attrs, endPoint.x, endPoint.y, startPoint.x, startPoint.y);
7071 }
7072
7073 for (var i = 0, l = segmentsLen; i < l; i++) {
7074 segments[i].draw(context);
7075 }
7076
7077 if (segmentsLen > 1 && !closed) {
7078 startPoint = segments[segmentsLen - 2].endPoint;
7079 endPoint = segments[segmentsLen - 1].endPoint;
7080 Arrow.addEndArrow(context, attrs, startPoint.x, startPoint.y, endPoint.x, endPoint.y);
7081 }
7082 }
7083 });
7084
7085 module.exports = Path;
7086
7087 /***/
7088 },
7089 /* 102 */
7090 /***/function (module, exports, __webpack_require__) {
7091
7092 var Util = __webpack_require__(0);
7093 var Shape = __webpack_require__(1);
7094 var Inside = __webpack_require__(2);
7095
7096 var CText = function CText(cfg) {
7097 CText.superclass.constructor.call(this, cfg);
7098 };
7099
7100 CText.ATTRS = {
7101 x: 0,
7102 y: 0,
7103 text: null,
7104 fontSize: 12,
7105 fontFamily: 'sans-serif',
7106 fontStyle: 'normal',
7107 fontWeight: 'normal',
7108 fontVariant: 'normal',
7109 textAlign: 'start',
7110 textBaseline: 'bottom',
7111 lineHeight: null,
7112 textArr: null
7113 };
7114
7115 Util.extend(CText, Shape);
7116
7117 Util.augment(CText, {
7118 canFill: true,
7119 canStroke: true,
7120 type: 'text',
7121 getDefaultAttrs: function getDefaultAttrs() {
7122 return {
7123 lineWidth: 1,
7124 lineCount: 1,
7125 fontSize: 12,
7126 fontFamily: 'sans-serif',
7127 fontStyle: 'normal',
7128 fontWeight: 'normal',
7129 fontVariant: 'normal',
7130 textAlign: 'start',
7131 textBaseline: 'bottom'
7132 };
7133 },
7134 initTransform: function initTransform() {
7135 this.attr('matrix', [1, 0, 0, 0, 1, 0, 0, 0, 1]);
7136 var fontSize = this.__attrs.fontSize;
7137 if (fontSize && +fontSize < 12) {
7138 // 小于 12 像素的文本进行 scale 处理
7139 this.transform([['t', -1 * this.__attrs.x, -1 * this.__attrs.y], ['s', +fontSize / 12, +fontSize / 12], ['t', this.__attrs.x, this.__attrs.y]]);
7140 }
7141 },
7142 __assembleFont: function __assembleFont() {
7143 // var self = this;
7144 var attrs = this.__attrs;
7145 var fontSize = attrs.fontSize;
7146 var fontFamily = attrs.fontFamily;
7147 var fontWeight = attrs.fontWeight;
7148 var fontStyle = attrs.fontStyle; // self.attr('fontStyle');
7149 var fontVariant = attrs.fontVariant; // self.attr('fontVariant');
7150 // self.attr('font', [fontStyle, fontVariant, fontWeight, fontSize + 'px', fontFamily].join(' '));
7151 attrs.font = [fontStyle, fontVariant, fontWeight, fontSize + 'px', fontFamily].join(' ');
7152 },
7153 __afterSetAttrFontSize: function __afterSetAttrFontSize() {
7154 /* this.attr({
7155 height: this.__getTextHeight()
7156 }); */
7157 this.__assembleFont();
7158 },
7159 __afterSetAttrFontFamily: function __afterSetAttrFontFamily() {
7160 this.__assembleFont();
7161 },
7162 __afterSetAttrFontWeight: function __afterSetAttrFontWeight() {
7163 this.__assembleFont();
7164 },
7165 __afterSetAttrFontStyle: function __afterSetAttrFontStyle() {
7166 this.__assembleFont();
7167 },
7168 __afterSetAttrFontVariant: function __afterSetAttrFontVariant() {
7169 this.__assembleFont();
7170 },
7171 __afterSetAttrFont: function __afterSetAttrFont() {
7172 // this.attr('width', this.measureText());
7173 },
7174 __afterSetAttrText: function __afterSetAttrText() {
7175 var attrs = this.__attrs;
7176 var text = attrs.text;
7177 var textArr = void 0;
7178 if (Util.isString(text) && text.indexOf('\n') !== -1) {
7179 textArr = text.split('\n');
7180 var lineCount = textArr.length;
7181 attrs.lineCount = lineCount;
7182 attrs.textArr = textArr;
7183 }
7184 // attrs.height = this.__getTextHeight();
7185 // attrs.width = this.measureText();
7186 },
7187 __getTextHeight: function __getTextHeight() {
7188 var attrs = this.__attrs;
7189 var lineCount = attrs.lineCount;
7190 var fontSize = attrs.fontSize * 1;
7191 if (lineCount > 1) {
7192 var spaceingY = this.__getSpaceingY();
7193 return fontSize * lineCount + spaceingY * (lineCount - 1);
7194 }
7195 return fontSize;
7196 },
7197
7198 // 计算浪费,效率低,待优化
7199 __afterSetAttrAll: function __afterSetAttrAll(objs) {
7200 var self = this;
7201 if ('fontSize' in objs || 'fontWeight' in objs || 'fontStyle' in objs || 'fontVariant' in objs || 'fontFamily' in objs) {
7202 self.__assembleFont();
7203 }
7204
7205 if ('text' in objs) {
7206 self.__afterSetAttrText(objs.text);
7207 }
7208 },
7209 isHitBox: function isHitBox() {
7210 return false;
7211 },
7212 calculateBox: function calculateBox() {
7213 var self = this;
7214 var attrs = self.__attrs;
7215 var x = attrs.x;
7216 var y = attrs.y;
7217 var width = self.measureText(); // attrs.width
7218 if (!width) {
7219 // 如果width不存在,四点共其实点
7220 return {
7221 minX: x,
7222 minY: y,
7223 maxX: x,
7224 maxY: y
7225 };
7226 }
7227 var height = self.__getTextHeight(); // attrs.height
7228 var textAlign = attrs.textAlign;
7229 var textBaseline = attrs.textBaseline;
7230 var lineWidth = attrs.lineWidth;
7231 var point = {
7232 x: x,
7233 y: y - height
7234 };
7235
7236 if (textAlign) {
7237 if (textAlign === 'end' || textAlign === 'right') {
7238 point.x -= width;
7239 } else if (textAlign === 'center') {
7240 point.x -= width / 2;
7241 }
7242 }
7243
7244 if (textBaseline) {
7245 if (textBaseline === 'top') {
7246 point.y += height;
7247 } else if (textBaseline === 'middle') {
7248 point.y += height / 2;
7249 }
7250 }
7251
7252 this.set('startPoint', point);
7253 var halfWidth = lineWidth / 2;
7254 return {
7255 minX: point.x - halfWidth,
7256 minY: point.y - halfWidth,
7257 maxX: point.x + width + halfWidth,
7258 maxY: point.y + height + halfWidth
7259 };
7260 },
7261 __getSpaceingY: function __getSpaceingY() {
7262 var attrs = this.__attrs;
7263 var lineHeight = attrs.lineHeight;
7264 var fontSize = attrs.fontSize * 1;
7265 return lineHeight ? lineHeight - fontSize : fontSize * 0.14;
7266 },
7267 isPointInPath: function isPointInPath(x, y) {
7268 var self = this;
7269 var box = self.getBBox();
7270 if (self.hasFill() || self.hasStroke()) {
7271 return Inside.box(box.minX, box.maxX, box.minY, box.maxY, x, y);
7272 }
7273 },
7274 drawInner: function drawInner(context) {
7275 var self = this;
7276 var attrs = self.__attrs;
7277 var text = attrs.text;
7278 if (!text) {
7279 return;
7280 }
7281 var textArr = attrs.textArr;
7282 var fontSize = attrs.fontSize * 1;
7283 var spaceingY = self.__getSpaceingY();
7284 var x = attrs.x;
7285 var y = attrs.y;
7286 var textBaseline = attrs.textBaseline;
7287 var height = void 0;
7288 if (textArr) {
7289 var box = self.getBBox();
7290 height = box.maxY - box.minY;
7291 }
7292 var subY = void 0;
7293
7294 context.beginPath();
7295 if (self.hasFill()) {
7296 var fillOpacity = attrs.fillOpacity;
7297 if (!Util.isNil(fillOpacity) && fillOpacity !== 1) {
7298 context.globalAlpha = fillOpacity;
7299 }
7300 if (textArr) {
7301 Util.each(textArr, function (subText, index) {
7302 subY = y + index * (spaceingY + fontSize) - height + fontSize; // bottom;
7303 if (textBaseline === 'middle') subY += height - fontSize - (height - fontSize) / 2;
7304 if (textBaseline === 'top') subY += height - fontSize;
7305 context.fillText(subText, x, subY);
7306 });
7307 } else {
7308 context.fillText(text, x, y);
7309 }
7310 }
7311
7312 if (self.hasStroke()) {
7313 if (textArr) {
7314 Util.each(textArr, function (subText, index) {
7315 subY = y + index * (spaceingY + fontSize) - height + fontSize; // bottom;
7316 if (textBaseline === 'middle') subY += height - fontSize - (height - fontSize) / 2;
7317 if (textBaseline === 'top') subY += height - fontSize;
7318 context.strokeText(subText, x, subY);
7319 });
7320 } else {
7321 context.strokeText(text, x, y);
7322 }
7323 }
7324 },
7325 measureText: function measureText() {
7326 var self = this;
7327 var attrs = self.__attrs;
7328 var text = attrs.text;
7329 var font = attrs.font;
7330 var textArr = attrs.textArr;
7331 var measureWidth = void 0;
7332 var width = 0;
7333
7334 if (Util.isNil(text)) return undefined;
7335 var context = document.createElement('canvas').getContext('2d');
7336 context.save();
7337 context.font = font;
7338 if (textArr) {
7339 Util.each(textArr, function (subText) {
7340 measureWidth = context.measureText(subText).width;
7341 if (width < measureWidth) {
7342 width = measureWidth;
7343 }
7344 context.restore();
7345 });
7346 } else {
7347 width = context.measureText(text).width;
7348 context.restore();
7349 }
7350 return width;
7351 }
7352 });
7353
7354 module.exports = CText;
7355
7356 /***/
7357 },
7358 /* 103 */
7359 /***/function (module, exports, __webpack_require__) {
7360
7361 var Util = __webpack_require__(0);
7362 var Shape = __webpack_require__(1);
7363 var Inside = __webpack_require__(2);
7364 var Arrow = __webpack_require__(15);
7365 var LineMath = __webpack_require__(52);
7366
7367 var Line = function Line(cfg) {
7368 Line.superclass.constructor.call(this, cfg);
7369 };
7370
7371 Line.ATTRS = {
7372 x1: 0,
7373 y1: 0,
7374 x2: 0,
7375 y2: 0,
7376 lineWidth: 1,
7377 startArrow: false,
7378 endArrow: false
7379 };
7380
7381 Util.extend(Line, Shape);
7382
7383 Util.augment(Line, {
7384 canStroke: true,
7385 type: 'line',
7386 getDefaultAttrs: function getDefaultAttrs() {
7387 return {
7388 lineWidth: 1,
7389 startArrow: false,
7390 endArrow: false
7391 };
7392 },
7393 calculateBox: function calculateBox() {
7394 var attrs = this.__attrs;
7395 var x1 = attrs.x1,
7396 y1 = attrs.y1,
7397 x2 = attrs.x2,
7398 y2 = attrs.y2,
7399 lineWidth = attrs.lineWidth;
7400
7401 return LineMath.box(x1, y1, x2, y2, lineWidth);
7402 },
7403 isPointInPath: function isPointInPath(x, y) {
7404 var attrs = this.__attrs;
7405 var x1 = attrs.x1,
7406 y1 = attrs.y1,
7407 x2 = attrs.x2,
7408 y2 = attrs.y2,
7409 lineWidth = attrs.lineWidth;
7410
7411 if (this.hasStroke()) {
7412 return Inside.line(x1, y1, x2, y2, lineWidth, x, y);
7413 }
7414
7415 return false;
7416 },
7417 createPath: function createPath(context) {
7418 var attrs = this.__attrs;
7419 var x1 = attrs.x1,
7420 y1 = attrs.y1,
7421 x2 = attrs.x2,
7422 y2 = attrs.y2;
7423
7424 context = context || self.get('context');
7425 context.beginPath();
7426
7427 Arrow.addStartArrow(context, attrs, x1, y1, x2, y2);
7428 context.moveTo(x1, y1);
7429 context.lineTo(x2, y2);
7430 Arrow.addEndArrow(context, attrs, x2, y2, x1, y1);
7431 },
7432 getPoint: function getPoint(t) {
7433 var attrs = this.__attrs;
7434 return {
7435 x: LineMath.at(attrs.x1, attrs.x2, t),
7436 y: LineMath.at(attrs.y1, attrs.y2, t)
7437 };
7438 }
7439 });
7440
7441 module.exports = Line;
7442
7443 /***/
7444 },
7445 /* 104 */
7446 /***/function (module, exports, __webpack_require__) {
7447
7448 var Util = __webpack_require__(0);
7449 var Shape = __webpack_require__(1);
7450 var Inside = __webpack_require__(2);
7451
7452 var CImage = function CImage(cfg) {
7453 CImage.superclass.constructor.call(this, cfg);
7454 };
7455
7456 CImage.ATTRS = {
7457 x: 0,
7458 y: 0,
7459 img: undefined,
7460 width: 0,
7461 height: 0,
7462 sx: null,
7463 sy: null,
7464 swidth: null,
7465 sheight: null
7466 };
7467
7468 Util.extend(CImage, Shape);
7469
7470 Util.augment(CImage, {
7471 type: 'image',
7472 __afterSetAttrImg: function __afterSetAttrImg(img) {
7473 this.__setAttrImg(img);
7474 },
7475 __afterSetAttrAll: function __afterSetAttrAll(params) {
7476 if (params.img) {
7477 this.__setAttrImg(params.img);
7478 }
7479 },
7480 isHitBox: function isHitBox() {
7481 return false;
7482 },
7483 calculateBox: function calculateBox() {
7484 var attrs = this.__attrs;
7485 var x = attrs.x;
7486 var y = attrs.y;
7487 var width = attrs.width;
7488 var height = attrs.height;
7489
7490 return {
7491 minX: x,
7492 minY: y,
7493 maxX: x + width,
7494 maxY: y + height
7495 };
7496 },
7497 isPointInPath: function isPointInPath(x, y) {
7498 var attrs = this.__attrs;
7499 if (this.get('toDraw') || !attrs.img) {
7500 return false;
7501 }
7502 var rx = attrs.x;
7503 var ry = attrs.y;
7504 var width = attrs.width;
7505 var height = attrs.height;
7506 return Inside.rect(rx, ry, width, height, x, y);
7507 },
7508 __setLoading: function __setLoading(loading) {
7509 var canvas = this.get('canvas');
7510 if (loading === false && this.get('toDraw') === true) {
7511 this.__cfg.loading = false;
7512 canvas.draw();
7513 }
7514 return loading;
7515 },
7516 __setAttrImg: function __setAttrImg(img) {
7517 var self = this;
7518 var attrs = self.__attrs;
7519 if (Util.isString(img)) {
7520 var image = new Image();
7521 image.onload = function () {
7522 if (self.get('destroyed')) return false;
7523 self.attr('imgSrc', img);
7524 self.attr('img', image);
7525 var callback = self.get('callback');
7526 if (callback) {
7527 callback.call(self);
7528 }
7529 self.set('loading', false);
7530 };
7531 image.src = img;
7532 self.set('loading', true);
7533 } else if (img instanceof Image) {
7534 if (!attrs.width) {
7535 self.attr('width', img.width);
7536 }
7537
7538 if (!attrs.height) {
7539 self.attr('height', img.height);
7540 }
7541 return img;
7542 } else if (img instanceof HTMLElement && Util.isString(img.nodeName) && img.nodeName.toUpperCase() === 'CANVAS') {
7543 if (!attrs.width) {
7544 self.attr('width', Number(img.getAttribute('width')));
7545 }
7546
7547 if (!attrs.height) {
7548 self.attr('height', Number(img.getAttribute('height')));
7549 }
7550 return img;
7551 } else if (img instanceof ImageData) {
7552 if (!attrs.width) {
7553 self.attr('width', img.width);
7554 }
7555
7556 if (!attrs.height) {
7557 self.attr('height', img.height);
7558 }
7559 return img;
7560 } else {
7561 return null;
7562 }
7563 },
7564 drawInner: function drawInner(context) {
7565 if (this.get('loading')) {
7566 this.set('toDraw', true);
7567 return;
7568 }
7569 this.__drawImage(context);
7570 },
7571 __drawImage: function __drawImage(context) {
7572 var attrs = this.__attrs;
7573 var x = attrs.x;
7574 var y = attrs.y;
7575 var img = attrs.img;
7576 var width = attrs.width;
7577 var height = attrs.height;
7578 var sx = attrs.sx;
7579 var sy = attrs.sy;
7580 var swidth = attrs.swidth;
7581 var sheight = attrs.sheight;
7582 this.set('toDraw', false);
7583
7584 if (img instanceof Image || img instanceof HTMLElement && Util.isString(img.nodeName) && img.nodeName.toUpperCase() === 'CANVAS') {
7585 if (Util.isNil(sx) || Util.isNil(sy) || Util.isNil(swidth) || Util.isNil(sheight)) {
7586 context.drawImage(img, x, y, width, height);
7587 return;
7588 }
7589 if (!Util.isNil(sx) && !Util.isNil(sy) && !Util.isNil(swidth) && !Util.isNil(sheight)) {
7590 context.drawImage(img, sx, sy, swidth, sheight, x, y, width, height);
7591 return;
7592 }
7593 } else if (img instanceof ImageData) {
7594 context.putImageData(img, x, y, sx || 0, sy || 0, swidth || width, sheight || height);
7595 return;
7596 }
7597 return;
7598 }
7599 });
7600
7601 module.exports = CImage;
7602
7603 /***/
7604 },
7605 /* 105 */
7606 /***/function (module, exports, __webpack_require__) {
7607
7608 var Util = __webpack_require__(0);
7609 var Shape = __webpack_require__(1);
7610 var Inside = __webpack_require__(2);
7611
7612 var Polygon = function Polygon(cfg) {
7613 Polygon.superclass.constructor.call(this, cfg);
7614 };
7615
7616 Polygon.ATTRS = {
7617 points: null,
7618 lineWidth: 1
7619 };
7620
7621 Util.extend(Polygon, Shape);
7622
7623 Util.augment(Polygon, {
7624 canFill: true,
7625 canStroke: true,
7626 type: 'polygon',
7627 getDefaultAttrs: function getDefaultAttrs() {
7628 return {
7629 lineWidth: 1
7630 };
7631 },
7632 calculateBox: function calculateBox() {
7633 var self = this;
7634 var attrs = self.__attrs;
7635 var points = attrs.points;
7636 var lineWidth = attrs.lineWidth;
7637 if (!points || points.length === 0) {
7638 return null;
7639 }
7640 var minX = Infinity;
7641 var minY = Infinity;
7642 var maxX = -Infinity;
7643 var maxY = -Infinity;
7644
7645 Util.each(points, function (point) {
7646 var x = point[0];
7647 var y = point[1];
7648 if (x < minX) {
7649 minX = x;
7650 }
7651 if (x > maxX) {
7652 maxX = x;
7653 }
7654
7655 if (y < minY) {
7656 minY = y;
7657 }
7658
7659 if (y > maxY) {
7660 maxY = y;
7661 }
7662 });
7663
7664 var halfWidth = lineWidth / 2;
7665 return {
7666 minX: minX - halfWidth,
7667 minY: minY - halfWidth,
7668 maxX: maxX + halfWidth,
7669 maxY: maxY + halfWidth
7670 };
7671 },
7672 isPointInPath: function isPointInPath(x, y) {
7673 var self = this;
7674 var fill = self.hasFill();
7675 var stroke = self.hasStroke();
7676
7677 if (fill && stroke) {
7678 return self.__isPointInFill(x, y) || self.__isPointInStroke(x, y);
7679 }
7680
7681 if (fill) {
7682 return self.__isPointInFill(x, y);
7683 }
7684
7685 if (stroke) {
7686 return self.__isPointInStroke(x, y);
7687 }
7688
7689 return false;
7690 },
7691 __isPointInFill: function __isPointInFill(x, y) {
7692 var self = this;
7693 var context = self.get('context');
7694 self.createPath();
7695 return context.isPointInPath(x, y);
7696 },
7697 __isPointInStroke: function __isPointInStroke(x, y) {
7698 var self = this;
7699 var attrs = self.__attrs;
7700 var points = attrs.points;
7701 if (points.length < 2) {
7702 return false;
7703 }
7704 var lineWidth = attrs.lineWidth;
7705 var outPoints = points.slice(0);
7706 if (points.length >= 3) {
7707 outPoints.push(points[0]);
7708 }
7709
7710 return Inside.polyline(outPoints, lineWidth, x, y);
7711 },
7712 createPath: function createPath(context) {
7713 var self = this;
7714 var attrs = self.__attrs;
7715 var points = attrs.points;
7716 if (points.length < 2) {
7717 return;
7718 }
7719 context = context || self.get('context');
7720 context.beginPath();
7721 Util.each(points, function (point, index) {
7722 if (index === 0) {
7723 context.moveTo(point[0], point[1]);
7724 } else {
7725 context.lineTo(point[0], point[1]);
7726 }
7727 });
7728 context.closePath();
7729 }
7730 });
7731
7732 module.exports = Polygon;
7733
7734 /***/
7735 },
7736 /* 106 */
7737 /***/function (module, exports, __webpack_require__) {
7738
7739 var Util = __webpack_require__(0);
7740 var Shape = __webpack_require__(1);
7741 var Inside = __webpack_require__(2);
7742 var Arrow = __webpack_require__(15);
7743 var LineMath = __webpack_require__(52);
7744
7745 var Polyline = function Polyline(cfg) {
7746 Polyline.superclass.constructor.call(this, cfg);
7747 };
7748
7749 Polyline.ATTRS = {
7750 points: null,
7751 lineWidth: 1,
7752 startArrow: false,
7753 endArrow: false,
7754 tCache: null
7755 };
7756
7757 Util.extend(Polyline, Shape);
7758
7759 Util.augment(Polyline, {
7760 canStroke: true,
7761 type: 'polyline',
7762 tCache: null, // 缓存各点的t
7763 getDefaultAttrs: function getDefaultAttrs() {
7764 return {
7765 lineWidth: 1,
7766 startArrow: false,
7767 endArrow: false
7768 };
7769 },
7770 calculateBox: function calculateBox() {
7771 var self = this;
7772 var attrs = self.__attrs;
7773 var lineWidth = attrs.lineWidth;
7774 var points = attrs.points;
7775 if (!points || points.length === 0) {
7776 return null;
7777 }
7778 var minX = Infinity;
7779 var minY = Infinity;
7780 var maxX = -Infinity;
7781 var maxY = -Infinity;
7782
7783 Util.each(points, function (point) {
7784 var x = point[0];
7785 var y = point[1];
7786 if (x < minX) {
7787 minX = x;
7788 }
7789 if (x > maxX) {
7790 maxX = x;
7791 }
7792
7793 if (y < minY) {
7794 minY = y;
7795 }
7796
7797 if (y > maxY) {
7798 maxY = y;
7799 }
7800 });
7801
7802 var halfWidth = lineWidth / 2;
7803 return {
7804 minX: minX - halfWidth,
7805 minY: minY - halfWidth,
7806 maxX: maxX + halfWidth,
7807 maxY: maxY + halfWidth
7808 };
7809 },
7810 __setTcache: function __setTcache() {
7811 var self = this;
7812 var attrs = self.__attrs;
7813 var points = attrs.points;
7814 var totalLength = 0;
7815 var tempLength = 0;
7816 var tCache = [];
7817 var segmentT = void 0;
7818 var segmentL = void 0;
7819 if (!points || points.length === 0) {
7820 return;
7821 }
7822
7823 Util.each(points, function (p, i) {
7824 if (points[i + 1]) {
7825 totalLength += LineMath.len(p[0], p[1], points[i + 1][0], points[i + 1][1]);
7826 }
7827 });
7828 if (totalLength <= 0) {
7829 return;
7830 }
7831 Util.each(points, function (p, i) {
7832 if (points[i + 1]) {
7833 segmentT = [];
7834 segmentT[0] = tempLength / totalLength;
7835 segmentL = LineMath.len(p[0], p[1], points[i + 1][0], points[i + 1][1]);
7836 tempLength += segmentL;
7837 segmentT[1] = tempLength / totalLength;
7838 tCache.push(segmentT);
7839 }
7840 });
7841 this.tCache = tCache;
7842 },
7843 isPointInPath: function isPointInPath(x, y) {
7844 var self = this;
7845 var attrs = self.__attrs;
7846 if (self.hasStroke()) {
7847 var points = attrs.points;
7848 if (points.length < 2) {
7849 return false;
7850 }
7851 var lineWidth = attrs.lineWidth;
7852 return Inside.polyline(points, lineWidth, x, y);
7853 }
7854 return false;
7855 },
7856 createPath: function createPath(context) {
7857 var self = this;
7858 var attrs = self.__attrs;
7859 var points = attrs.points;
7860 var l = void 0;
7861 var i = void 0;
7862
7863 if (points.length < 2) {
7864 return;
7865 }
7866 context = context || self.get('context');
7867 context.beginPath();
7868
7869 Arrow.addStartArrow(context, attrs, points[1][0], points[1][1], points[0][0], points[0][1]);
7870 context.moveTo(points[0][0], points[0][1]);
7871 for (i = 1, l = points.length - 1; i < l; i++) {
7872 context.lineTo(points[i][0], points[i][1]);
7873 }
7874 context.lineTo(points[l][0], points[l][1]);
7875 Arrow.addEndArrow(context, attrs, points[l - 1][0], points[l - 1][1], points[l][0], points[l][1]);
7876 },
7877 getPoint: function getPoint(t) {
7878 var attrs = this.__attrs;
7879 var points = attrs.points;
7880 var tCache = this.tCache;
7881 var subt = void 0;
7882 var index = void 0;
7883 if (!tCache) {
7884 this.__setTcache();
7885 tCache = this.tCache;
7886 }
7887 Util.each(tCache, function (v, i) {
7888 if (t >= v[0] && t <= v[1]) {
7889 subt = (t - v[0]) / (v[1] - v[0]);
7890 index = i;
7891 }
7892 });
7893 return {
7894 x: LineMath.at(points[index][0], points[index + 1][0], subt),
7895 y: LineMath.at(points[index][1], points[index + 1][1], subt)
7896 };
7897 }
7898 });
7899
7900 module.exports = Polyline;
7901
7902 /***/
7903 },
7904 /* 107 */
7905 /***/function (module, exports, __webpack_require__) {
7906
7907 var Util = __webpack_require__(0);
7908 var Shape = __webpack_require__(1);
7909 var Inside = __webpack_require__(2);
7910 var ArcMath = __webpack_require__(54);
7911 var Arrow = __webpack_require__(15);
7912
7913 function _getArcX(x, radius, angle) {
7914 return x + radius * Math.cos(angle);
7915 }
7916 function _getArcY(y, radius, angle) {
7917 return y + radius * Math.sin(angle);
7918 }
7919
7920 var Arc = function Arc(cfg) {
7921 Arc.superclass.constructor.call(this, cfg);
7922 };
7923
7924 Arc.ATTRS = {
7925 x: 0,
7926 y: 0,
7927 r: 0,
7928 startAngle: 0,
7929 endAngle: 0,
7930 clockwise: false,
7931 lineWidth: 1,
7932 startArrow: false,
7933 endArrow: false
7934 };
7935
7936 Util.extend(Arc, Shape);
7937
7938 Util.augment(Arc, {
7939 canStroke: true,
7940 type: 'arc',
7941 getDefaultAttrs: function getDefaultAttrs() {
7942 return {
7943 x: 0,
7944 y: 0,
7945 r: 0,
7946 startAngle: 0,
7947 endAngle: 0,
7948 clockwise: false,
7949 lineWidth: 1,
7950 startArrow: false,
7951 endArrow: false
7952 };
7953 },
7954 calculateBox: function calculateBox() {
7955 var attrs = this.__attrs;
7956 var x = attrs.x,
7957 y = attrs.y,
7958 r = attrs.r,
7959 startAngle = attrs.startAngle,
7960 endAngle = attrs.endAngle,
7961 clockwise = attrs.clockwise,
7962 lineWidth = attrs.lineWidth;
7963
7964 var halfWidth = lineWidth / 2;
7965 var box = ArcMath.box(x, y, r, startAngle, endAngle, clockwise);
7966 box.minX -= halfWidth;
7967 box.minY -= halfWidth;
7968 box.maxX += halfWidth;
7969 box.maxY += halfWidth;
7970 return box;
7971 },
7972 isPointInPath: function isPointInPath(x, y) {
7973 var attrs = this.__attrs;
7974 var cx = attrs.x;
7975 var cy = attrs.y;
7976 var r = attrs.r,
7977 startAngle = attrs.startAngle,
7978 endAngle = attrs.endAngle,
7979 clockwise = attrs.clockwise,
7980 lineWidth = attrs.lineWidth;
7981
7982 if (this.hasStroke()) {
7983 return Inside.arcline(cx, cy, r, startAngle, endAngle, clockwise, lineWidth, x, y);
7984 }
7985 return false;
7986 },
7987 createPath: function createPath(context) {
7988 var attrs = this.__attrs;
7989 var x = attrs.x,
7990 y = attrs.y,
7991 r = attrs.r,
7992 startAngle = attrs.startAngle,
7993 endAngle = attrs.endAngle,
7994 clockwise = attrs.clockwise;
7995
7996 var diff = void 0;
7997 var x1 = void 0;
7998 var y1 = void 0;
7999 var x2 = void 0;
8000 var y2 = void 0;
8001
8002 context = context || self.get('context');
8003 context.beginPath();
8004
8005 if (attrs.startArrow) {
8006 diff = Math.PI / 180;
8007 if (clockwise) {
8008 diff *= -1;
8009 }
8010
8011 // Calculate coordinates for start arrow
8012 x1 = _getArcX(x, r, startAngle + diff);
8013 y1 = _getArcY(y, r, startAngle + diff);
8014 x2 = _getArcX(x, r, startAngle);
8015 y2 = _getArcY(y, r, startAngle);
8016 Arrow.addStartArrow(context, attrs, x1, y1, x2, y2);
8017 }
8018 context.arc(x, y, r, startAngle, endAngle, clockwise);
8019
8020 if (attrs.endArrow) {
8021 diff = Math.PI / 180;
8022 if (clockwise) {
8023 diff *= -1;
8024 }
8025
8026 // Calculate coordinates for start arrow
8027 x1 = _getArcX(x, r, endAngle + diff);
8028 y1 = _getArcY(y, r, endAngle + diff);
8029 x2 = _getArcX(x, r, endAngle);
8030 y2 = _getArcY(y, r, endAngle);
8031 Arrow.addEndArrow(context, attrs, x2, y2, x1, y1);
8032 }
8033 }
8034 });
8035
8036 module.exports = Arc;
8037
8038 /***/
8039 },
8040 /* 108 */
8041 /***/function (module, exports, __webpack_require__) {
8042
8043 var Util = __webpack_require__(0);
8044 var Shape = __webpack_require__(1);
8045 var Inside = __webpack_require__(2);
8046 var ArcMath = __webpack_require__(54);
8047 var vec2 = __webpack_require__(3).vec2;
8048
8049 var Fan = function Fan(cfg) {
8050 Fan.superclass.constructor.call(this, cfg);
8051 };
8052
8053 Fan.ATTRS = {
8054 x: 0,
8055 y: 0,
8056 rs: 0,
8057 re: 0,
8058 startAngle: 0,
8059 endAngle: 0,
8060 clockwise: false,
8061 lineWidth: 1
8062 };
8063
8064 Util.extend(Fan, Shape);
8065
8066 Util.augment(Fan, {
8067 canFill: true,
8068 canStroke: true,
8069 type: 'fan',
8070 getDefaultAttrs: function getDefaultAttrs() {
8071 return {
8072 clockwise: false,
8073 lineWidth: 1,
8074 rs: 0,
8075 re: 0
8076 };
8077 },
8078 calculateBox: function calculateBox() {
8079 var self = this;
8080 var attrs = self.__attrs;
8081 var cx = attrs.x;
8082 var cy = attrs.y;
8083 var rs = attrs.rs;
8084 var re = attrs.re;
8085 var startAngle = attrs.startAngle;
8086 var endAngle = attrs.endAngle;
8087 var clockwise = attrs.clockwise;
8088 var lineWidth = attrs.lineWidth;
8089
8090 var boxs = ArcMath.box(cx, cy, rs, startAngle, endAngle, clockwise);
8091 var boxe = ArcMath.box(cx, cy, re, startAngle, endAngle, clockwise);
8092 var minX = Math.min(boxs.minX, boxe.minX);
8093 var minY = Math.min(boxs.minY, boxe.minY);
8094 var maxX = Math.max(boxs.maxX, boxe.maxX);
8095 var maxY = Math.max(boxs.maxY, boxe.maxY);
8096
8097 var halfWidth = lineWidth / 2;
8098 return {
8099 minX: minX - halfWidth,
8100 minY: minY - halfWidth,
8101 maxX: maxX + halfWidth,
8102 maxY: maxY + halfWidth
8103 };
8104 },
8105 isPointInPath: function isPointInPath(x, y) {
8106 var fill = this.hasFill();
8107 var stroke = this.hasStroke();
8108
8109 if (fill && stroke) {
8110 return this.__isPointInFill(x, y) || this.__isPointInStroke(x, y);
8111 }
8112
8113 if (fill) {
8114 return this.__isPointInFill(x, y);
8115 }
8116
8117 if (stroke) {
8118 return this.__isPointInStroke(x, y);
8119 }
8120 return false;
8121 },
8122 __isPointInFill: function __isPointInFill(x, y) {
8123 var attrs = this.__attrs;
8124 var cx = attrs.x;
8125 var cy = attrs.y;
8126 var rs = attrs.rs;
8127 var re = attrs.re;
8128 var startAngle = attrs.startAngle;
8129 var endAngle = attrs.endAngle;
8130 var clockwise = attrs.clockwise;
8131 var v1 = [1, 0];
8132 var subv = [x - cx, y - cy];
8133 var angle = vec2.angleTo(v1, subv);
8134
8135 var angle1 = ArcMath.nearAngle(angle, startAngle, endAngle, clockwise);
8136
8137 if (Util.isNumberEqual(angle, angle1)) {
8138 var ls = vec2.squaredLength(subv);
8139 if (rs * rs <= ls && ls <= re * re) {
8140 return true;
8141 }
8142 }
8143 return false;
8144 },
8145 __isPointInStroke: function __isPointInStroke(x, y) {
8146 var attrs = this.__attrs;
8147 var cx = attrs.x;
8148 var cy = attrs.y;
8149 var rs = attrs.rs;
8150 var re = attrs.re;
8151 var startAngle = attrs.startAngle;
8152 var endAngle = attrs.endAngle;
8153 var clockwise = attrs.clockwise;
8154 var lineWidth = attrs.lineWidth;
8155
8156 var ssp = {
8157 x: Math.cos(startAngle) * rs + cx,
8158 y: Math.sin(startAngle) * rs + cy
8159 };
8160 var sep = {
8161 x: Math.cos(startAngle) * re + cx,
8162 y: Math.sin(startAngle) * re + cy
8163 };
8164 var esp = {
8165 x: Math.cos(endAngle) * rs + cx,
8166 y: Math.sin(endAngle) * rs + cy
8167 };
8168 var eep = {
8169 x: Math.cos(endAngle) * re + cx,
8170 y: Math.sin(endAngle) * re + cy
8171 };
8172
8173 if (Inside.line(ssp.x, ssp.y, sep.x, sep.y, lineWidth, x, y)) {
8174 return true;
8175 }
8176
8177 if (Inside.line(esp.x, esp.y, eep.x, eep.y, lineWidth, x, y)) {
8178 return true;
8179 }
8180
8181 if (Inside.arcline(cx, cy, rs, startAngle, endAngle, clockwise, lineWidth, x, y)) {
8182 return true;
8183 }
8184
8185 if (Inside.arcline(cx, cy, re, startAngle, endAngle, clockwise, lineWidth, x, y)) {
8186 return true;
8187 }
8188
8189 return false;
8190 },
8191 createPath: function createPath(context) {
8192 var attrs = this.__attrs;
8193 var cx = attrs.x;
8194 var cy = attrs.y;
8195 var rs = attrs.rs;
8196 var re = attrs.re;
8197 var startAngle = attrs.startAngle;
8198 var endAngle = attrs.endAngle;
8199 var clockwise = attrs.clockwise;
8200
8201 var ssp = {
8202 x: Math.cos(startAngle) * rs + cx,
8203 y: Math.sin(startAngle) * rs + cy
8204 };
8205 var sep = {
8206 x: Math.cos(startAngle) * re + cx,
8207 y: Math.sin(startAngle) * re + cy
8208 };
8209 var esp = {
8210 x: Math.cos(endAngle) * rs + cx,
8211 y: Math.sin(endAngle) * rs + cy
8212 };
8213
8214 context = context || self.get('context');
8215 context.beginPath();
8216 context.moveTo(ssp.x, ssp.y);
8217 context.lineTo(sep.x, sep.y);
8218 context.arc(cx, cy, re, startAngle, endAngle, clockwise);
8219 context.lineTo(esp.x, esp.y);
8220 context.arc(cx, cy, rs, endAngle, startAngle, !clockwise);
8221 context.closePath();
8222 }
8223 });
8224
8225 module.exports = Fan;
8226
8227 /***/
8228 },
8229 /* 109 */
8230 /***/function (module, exports, __webpack_require__) {
8231
8232 var Util = __webpack_require__(0);
8233 var Shape = __webpack_require__(1);
8234 var Inside = __webpack_require__(2);
8235 var Arrow = __webpack_require__(15);
8236 var CubicMath = __webpack_require__(30);
8237
8238 var Cubic = function Cubic(cfg) {
8239 Cubic.superclass.constructor.call(this, cfg);
8240 };
8241
8242 Cubic.ATTRS = {
8243 p1: null, // 起始点
8244 p2: null, // 第一个控制点
8245 p3: null, // 第二个控制点
8246 p4: null, // 终点
8247 lineWidth: 1,
8248 startArrow: false,
8249 endArrow: false
8250 };
8251
8252 Util.extend(Cubic, Shape);
8253
8254 Util.augment(Cubic, {
8255 canStroke: true,
8256 type: 'cubic',
8257 getDefaultAttrs: function getDefaultAttrs() {
8258 return {
8259 lineWidth: 1,
8260 startArrow: false,
8261 endArrow: false
8262 };
8263 },
8264 calculateBox: function calculateBox() {
8265 var attrs = this.__attrs;
8266 var p1 = attrs.p1,
8267 p2 = attrs.p2,
8268 p3 = attrs.p3,
8269 p4 = attrs.p4,
8270 lineWidth = attrs.lineWidth;
8271
8272 var i = void 0;
8273 var l = void 0;
8274
8275 if (Util.isNil(p1) || Util.isNil(p2) || Util.isNil(p3) || Util.isNil(p4)) {
8276 return null;
8277 }
8278 var halfWidth = lineWidth / 2;
8279
8280 var xDim = CubicMath.extrema(p1[0], p2[0], p3[0], p4[0]);
8281 for (i = 0, l = xDim.length; i < l; i++) {
8282 xDim[i] = CubicMath.at(p1[0], p2[0], p3[0], p4[0], xDim[i]);
8283 }
8284 var yDim = CubicMath.extrema(p1[1], p2[1], p3[1], p4[1]);
8285 for (i = 0, l = yDim.length; i < l; i++) {
8286 yDim[i] = CubicMath.at(p1[1], p2[1], p3[1], p4[1], yDim[i]);
8287 }
8288 xDim.push(p1[0], p4[0]);
8289 yDim.push(p1[1], p4[1]);
8290
8291 return {
8292 minX: Math.min.apply(Math, xDim) - halfWidth,
8293 maxX: Math.max.apply(Math, xDim) + halfWidth,
8294 minY: Math.min.apply(Math, yDim) - halfWidth,
8295 maxY: Math.max.apply(Math, yDim) + halfWidth
8296 };
8297 },
8298 isPointInPath: function isPointInPath(x, y) {
8299 var attrs = this.__attrs;
8300 var p1 = attrs.p1,
8301 p2 = attrs.p2,
8302 p3 = attrs.p3,
8303 p4 = attrs.p4,
8304 lineWidth = attrs.lineWidth;
8305
8306 return Inside.cubicline(p1[0], p1[1], p2[0], p2[1], p3[0], p3[1], p4[0], p4[1], lineWidth, x, y);
8307 },
8308 createPath: function createPath(context) {
8309 var attrs = this.__attrs;
8310 var p1 = attrs.p1,
8311 p2 = attrs.p2,
8312 p3 = attrs.p3,
8313 p4 = attrs.p4;
8314
8315 context = context || self.get('context');
8316 if (Util.isNil(p1) || Util.isNil(p2) || Util.isNil(p3) || Util.isNil(p4)) {
8317 return;
8318 }
8319
8320 context.beginPath();
8321
8322 Arrow.addStartArrow(context, attrs, p2[0], p2[1], p1[0], p1[1]);
8323 context.moveTo(p1[0], p1[1]);
8324 context.bezierCurveTo(p2[0], p2[1], p3[0], p3[1], p4[0], p4[1]);
8325 Arrow.addEndArrow(context, attrs, p3[0], p3[1], p4[0], p4[1]);
8326 },
8327 getPoint: function getPoint(t) {
8328 var attrs = this.__attrs;
8329 return {
8330 x: CubicMath.at(attrs.p4[0], attrs.p3[0], attrs.p2[0], attrs.p1[0], t),
8331 y: CubicMath.at(attrs.p4[1], attrs.p3[1], attrs.p2[1], attrs.p1[1], t)
8332 };
8333 }
8334 });
8335
8336 module.exports = Cubic;
8337
8338 /***/
8339 },
8340 /* 110 */
8341 /***/function (module, exports, __webpack_require__) {
8342
8343 var Util = __webpack_require__(0);
8344 var Shape = __webpack_require__(1);
8345 var Inside = __webpack_require__(2);
8346 var Arrow = __webpack_require__(15);
8347 var QuadraticMath = __webpack_require__(53);
8348
8349 var Quadratic = function Quadratic(cfg) {
8350 Quadratic.superclass.constructor.call(this, cfg);
8351 };
8352
8353 Quadratic.ATTRS = {
8354 p1: null, // 起始点
8355 p2: null, // 控制点
8356 p3: null, // 结束点
8357 lineWidth: 1,
8358 startArrow: false,
8359 endArrow: false
8360 };
8361
8362 Util.extend(Quadratic, Shape);
8363
8364 Util.augment(Quadratic, {
8365 canStroke: true,
8366 type: 'quadratic',
8367 getDefaultAttrs: function getDefaultAttrs() {
8368 return {
8369 lineWidth: 1,
8370 startArrow: false,
8371 endArrow: false
8372 };
8373 },
8374 calculateBox: function calculateBox() {
8375 var self = this;
8376 var attrs = self.__attrs;
8377 var p1 = attrs.p1,
8378 p2 = attrs.p2,
8379 p3 = attrs.p3,
8380 lineWidth = attrs.lineWidth;
8381
8382 var i = void 0;
8383 var l = void 0;
8384
8385 if (Util.isNil(p1) || Util.isNil(p2) || Util.isNil(p3)) {
8386 return null;
8387 }
8388 var halfWidth = lineWidth / 2;
8389 var xDims = QuadraticMath.extrema(p1[0], p2[0], p3[0]);
8390 for (i = 0, l = xDims.length; i < l; i++) {
8391 xDims[i] = QuadraticMath.at(p1[0], p2[0], p3[0], xDims[i]);
8392 }
8393 xDims.push(p1[0], p3[0]);
8394 var yDims = QuadraticMath.extrema(p1[1], p2[1], p3[1]);
8395 for (i = 0, l = yDims.length; i < l; i++) {
8396 yDims[i] = QuadraticMath.at(p1[1], p2[1], p3[1], yDims[i]);
8397 }
8398 yDims.push(p1[1], p3[1]);
8399
8400 return {
8401 minX: Math.min.apply(Math, xDims) - halfWidth,
8402 maxX: Math.max.apply(Math, xDims) + halfWidth,
8403 minY: Math.min.apply(Math, yDims) - halfWidth,
8404 maxY: Math.max.apply(Math, yDims) + halfWidth
8405 };
8406 },
8407 isPointInPath: function isPointInPath(x, y) {
8408 var self = this;
8409 var attrs = self.__attrs;
8410 var p1 = attrs.p1,
8411 p2 = attrs.p2,
8412 p3 = attrs.p3,
8413 lineWidth = attrs.lineWidth;
8414
8415 return Inside.quadraticline(p1[0], p1[1], p2[0], p2[1], p3[0], p3[1], lineWidth, x, y);
8416 },
8417 createPath: function createPath(context) {
8418 var self = this;
8419 var attrs = self.__attrs;
8420 var p1 = attrs.p1,
8421 p2 = attrs.p2,
8422 p3 = attrs.p3;
8423
8424 if (Util.isNil(p1) || Util.isNil(p2) || Util.isNil(p3)) {
8425 return;
8426 }
8427 context = context || self.get('context');
8428 context.beginPath();
8429
8430 Arrow.addStartArrow(context, attrs, p2[0], p2[1], p1[0], p1[1]);
8431 context.moveTo(p1[0], p1[1]);
8432 context.quadraticCurveTo(p2[0], p2[1], p3[0], p3[1]);
8433 Arrow.addEndArrow(context, attrs, p2[0], p2[1], p3[0], p3[1]);
8434 },
8435 getPoint: function getPoint(t) {
8436 var attrs = this.__attrs;
8437 return {
8438 x: QuadraticMath.at(attrs.p1[0], attrs.p2[0], attrs.p3[0], t),
8439 y: QuadraticMath.at(attrs.p1[1], attrs.p2[1], attrs.p3[1], t)
8440 };
8441 }
8442 });
8443
8444 module.exports = Quadratic;
8445
8446 /***/
8447 },
8448 /* 111 */
8449 /***/function (module, exports, __webpack_require__) {
8450
8451 var Util = __webpack_require__(0);
8452 var Shape = __webpack_require__(1);
8453 var Inside = __webpack_require__(2);
8454
8455 var Marker = function Marker(cfg) {
8456 Marker.superclass.constructor.call(this, cfg);
8457 };
8458
8459 Marker.Symbols = {
8460 // 圆
8461 circle: function circle(x, y, r, ctx) {
8462 ctx.arc(x, y, r, 0, Math.PI * 2, false);
8463 },
8464
8465 // 正方形
8466 square: function square(x, y, r, ctx) {
8467 ctx.moveTo(x - r, y - r);
8468 ctx.lineTo(x + r, y - r);
8469 ctx.lineTo(x + r, y + r);
8470 ctx.lineTo(x - r, y + r);
8471 ctx.closePath();
8472 },
8473
8474 // 菱形
8475 diamond: function diamond(x, y, r, ctx) {
8476 ctx.moveTo(x - r, y);
8477 ctx.lineTo(x, y - r);
8478 ctx.lineTo(x + r, y);
8479 ctx.lineTo(x, y + r);
8480 ctx.closePath();
8481 },
8482
8483 // 三角形
8484 triangle: function triangle(x, y, r, ctx) {
8485 var diffY = r * Math.sin(1 / 3 * Math.PI);
8486 ctx.moveTo(x - r, y + diffY);
8487 ctx.lineTo(x, y - diffY);
8488 ctx.lineTo(x + r, y + diffY);
8489 ctx.closePath();
8490 },
8491
8492 // 倒三角形
8493 'triangle-down': function triangleDown(x, y, r, ctx) {
8494 var diffY = r * Math.sin(1 / 3 * Math.PI);
8495 ctx.moveTo(x - r, y - diffY);
8496 ctx.lineTo(x + r, y - diffY);
8497 ctx.lineTo(x, y + diffY);
8498 ctx.closePath();
8499 }
8500 };
8501
8502 Marker.ATTRS = {
8503 path: null,
8504 lineWidth: 1
8505 };
8506
8507 Util.extend(Marker, Shape);
8508
8509 Util.augment(Marker, {
8510 type: 'marker',
8511 canFill: true,
8512 canStroke: true,
8513 getDefaultAttrs: function getDefaultAttrs() {
8514 return {
8515 x: 0,
8516 y: 0,
8517 lineWidth: 1
8518 };
8519 },
8520 calculateBox: function calculateBox() {
8521 var attrs = this.__attrs;
8522 var cx = attrs.x;
8523 var cy = attrs.y;
8524 var r = attrs.radius;
8525 var lineWidth = attrs.lineWidth;
8526 var halfWidth = lineWidth / 2 + r;
8527 return {
8528 minX: cx - halfWidth,
8529 minY: cy - halfWidth,
8530 maxX: cx + halfWidth,
8531 maxY: cy + halfWidth
8532 };
8533 },
8534 isPointInPath: function isPointInPath(x, y) {
8535 var attrs = this.__attrs;
8536 var cx = attrs.x;
8537 var cy = attrs.y;
8538 var r = attrs.radius;
8539 return Inside.circle(cx, cy, r, x, y);
8540 },
8541 createPath: function createPath(context) {
8542 var attrs = this.__attrs;
8543 var x = attrs.x;
8544 var y = attrs.y;
8545 var r = attrs.radius;
8546 var symbol = attrs.symbol || 'circle';
8547 var method = void 0;
8548 if (Util.isFunction(symbol)) {
8549 method = symbol;
8550 } else {
8551 method = Marker.Symbols[symbol];
8552 }
8553 context.beginPath();
8554 method(x, y, r, context, this);
8555 }
8556 });
8557
8558 module.exports = Marker;
8559
8560 /***/
8561 },
8562 /* 112 */
8563 /***/function (module, exports, __webpack_require__) {
8564
8565 module.exports = {
8566 Canvas: __webpack_require__(113),
8567 Group: __webpack_require__(87),
8568 Shape: __webpack_require__(1),
8569 Rect: __webpack_require__(98),
8570 Circle: __webpack_require__(99),
8571 Ellipse: __webpack_require__(100),
8572 Path: __webpack_require__(101),
8573 Text: __webpack_require__(102),
8574 Line: __webpack_require__(103),
8575 Image: __webpack_require__(104),
8576 Polygon: __webpack_require__(105),
8577 Polyline: __webpack_require__(106),
8578 Arc: __webpack_require__(107),
8579 Fan: __webpack_require__(108),
8580 Cubic: __webpack_require__(109),
8581 Quadratic: __webpack_require__(110),
8582 Marker: __webpack_require__(111),
8583 PathUtil: __webpack_require__(46),
8584 MatrixUtil: __webpack_require__(3),
8585 DomUtil: __webpack_require__(85),
8586 Event: __webpack_require__(86)
8587 };
8588
8589 /***/
8590 },
8591 /* 113 */
8592 /***/function (module, exports, __webpack_require__) {
8593
8594 var Util = __webpack_require__(0);
8595 var Event = __webpack_require__(86);
8596 var Group = __webpack_require__(87);
8597
8598 function requestAnimationFrame(fn) {
8599 var method = window.requestAnimationFrame || window.webkitRequestAnimationFrame || function (fn) {
8600 return setTimeout(fn, 16);
8601 };
8602 return method(fn);
8603 }
8604 var Canvas = function Canvas(cfg) {
8605 Canvas.superclass.constructor.call(this, cfg);
8606 };
8607
8608 Canvas.CFG = {
8609 eventEnable: true,
8610 /**
8611 * 像素宽度
8612 * @type {Number}
8613 */
8614 width: null,
8615 /**
8616 * 像素高度
8617 * @type {Number}
8618 */
8619 height: null,
8620 /**
8621 * 画布宽度
8622 * @type {Number}
8623 */
8624 widthCanvas: null,
8625 /**
8626 * 画布高度
8627 * @type {Number}
8628 */
8629 heightCanvas: null,
8630 /**
8631 * CSS宽
8632 * @type {String}
8633 */
8634 widthStyle: null,
8635 /**
8636 * CSS高
8637 * @type {String}
8638 */
8639 heightStyle: null,
8640 /**
8641 * 容器DOM
8642 * @type {Object}
8643 */
8644 containerDOM: null,
8645 /**
8646 * 当前Canvas的DOM
8647 * @type {Object}
8648 */
8649 canvasDOM: null,
8650 /**
8651 * 屏幕像素比
8652 * @type {Number}
8653 */
8654 pixelRatio: null
8655 };
8656
8657 Util.extend(Canvas, Group);
8658
8659 Util.augment(Canvas, {
8660 init: function init() {
8661 Canvas.superclass.init.call(this);
8662 this._setGlobalParam();
8663 this._setDOM();
8664 this._setInitSize();
8665 this._setCanvas();
8666 this._scale();
8667 if (this.get('eventEnable')) {
8668 this._registEvents();
8669 }
8670 },
8671 getEmitter: function getEmitter(element, event) {
8672 if (element) {
8673 if (Util.isEmpty(element._getEvents())) {
8674 var parent = element.get('parent');
8675 if (parent && !event.propagationStopped) {
8676 return this.getEmitter(parent, event);
8677 }
8678 } else {
8679 return element;
8680 }
8681 }
8682 },
8683 _getEventObj: function _getEventObj(type, e, point, target) {
8684 var event = new Event(type, e, true, true);
8685 event.x = point.x;
8686 event.y = point.y;
8687 event.clientX = e.clientX;
8688 event.clientY = e.clientY;
8689 event.currentTarget = target;
8690 event.target = target;
8691 return event;
8692 },
8693 _triggerEvent: function _triggerEvent(type, e) {
8694 var point = this.getPointByClient(e.clientX, e.clientY);
8695 var shape = this.getShape(point.x, point.y);
8696 var emitObj = void 0;
8697 if (type === 'mousemove') {
8698 var canvasmousemove = this._getEventObj('mousemove', e, point, this);
8699 this.emit('mousemove', canvasmousemove);
8700
8701 var preShape = this.get('preShape');
8702 if (preShape && preShape !== shape) {
8703 var mouseleave = this._getEventObj('mouseleave', e, point, preShape);
8704 emitObj = this.getEmitter(preShape, e);
8705 emitObj && emitObj.emit('mouseleave', mouseleave);
8706 }
8707
8708 if (shape) {
8709 var mousemove = this._getEventObj('mousemove', e, point, shape);
8710 emitObj = this.getEmitter(shape, e);
8711 emitObj && emitObj.emit('mousemove', mousemove);
8712
8713 if (preShape !== shape) {
8714 var mouseenter = this._getEventObj('mouseenter', e, point, shape);
8715 emitObj && emitObj.emit('mouseenter', mouseenter, e);
8716 }
8717 }
8718
8719 this.set('preShape', shape);
8720 } else {
8721 var event = this._getEventObj(type, e, point, shape || this);
8722 emitObj = this.getEmitter(shape, e);
8723 if (emitObj && emitObj !== this) {
8724 emitObj.emit(type, event);
8725 }
8726 this.emit(type, event);
8727 }
8728
8729 var el = this.get('el');
8730 if (shape && !shape.get('destroyed')) {
8731 el.style.cursor = shape.attr('cursor') || 'default';
8732 }
8733 },
8734 _registEvents: function _registEvents() {
8735 var self = this;
8736 var el = self.get('el');
8737
8738 el.addEventListener('mouseout', function (e) {
8739 self._triggerEvent('mouseleave', e);
8740 }, false);
8741
8742 el.addEventListener('mouseover', function (e) {
8743 self._triggerEvent('mouseenter', e);
8744 }, false);
8745
8746 el.addEventListener('mousemove', function (e) {
8747 self._triggerEvent('mousemove', e);
8748 }, false);
8749
8750 el.addEventListener('mousedown', function (e) {
8751 self._triggerEvent('mousedown', e);
8752 }, false);
8753
8754 el.addEventListener('mouseup', function (e) {
8755 self._triggerEvent('mouseup', e);
8756 }, false);
8757
8758 el.addEventListener('click', function (e) {
8759 self._triggerEvent('click', e);
8760 }, false);
8761
8762 el.addEventListener('dblclick', function (e) {
8763 self._triggerEvent('dblclick', e);
8764 }, false);
8765
8766 el.addEventListener('touchstart', function (e) {
8767 if (!Util.isEmpty(e.touches)) {
8768 self._triggerEvent('touchstart', e.touches[0]);
8769 }
8770 }, false);
8771
8772 el.addEventListener('touchmove', function (e) {
8773 if (!Util.isEmpty(e.touches)) {
8774 self._triggerEvent('touchmove', e.touches[0]);
8775 }
8776 }, false);
8777
8778 el.addEventListener('touchend', function (e) {
8779 if (!Util.isEmpty(e.changedTouches)) {
8780 self._triggerEvent('touchend', e.changedTouches[0]);
8781 }
8782 }, false);
8783 },
8784 _scale: function _scale() {
8785 var pixelRatio = this.get('pixelRatio');
8786 this.scale(pixelRatio, pixelRatio);
8787 },
8788 _setCanvas: function _setCanvas() {
8789 var canvasDOM = this.get('canvasDOM');
8790 this.set('el', canvasDOM);
8791 this.set('context', canvasDOM.getContext('2d'));
8792 this.set('canvas', this);
8793 },
8794 _setGlobalParam: function _setGlobalParam() {
8795 var pixelRatio = this.get('pixelRatio');
8796 if (!pixelRatio) {
8797 this.set('pixelRatio', Util.getRatio());
8798 }
8799 return;
8800 },
8801 _setDOM: function _setDOM() {
8802 this._setContainer();
8803 this._setLayer();
8804 },
8805 _setContainer: function _setContainer() {
8806 var containerId = this.get('containerId');
8807 var containerDOM = this.get('containerDOM');
8808 if (!containerDOM) {
8809 containerDOM = document.getElementById(containerId);
8810 this.set('containerDOM', containerDOM);
8811 }
8812 Util.modifyCSS(containerDOM, {
8813 position: 'relative'
8814 });
8815 },
8816 _setLayer: function _setLayer() {
8817 var containerDOM = this.get('containerDOM');
8818 var canvasId = Util.uniqueId('canvas_');
8819 if (containerDOM) {
8820 var canvasDOM = Util.createDom('<canvas id="' + canvasId + '"></canvas>');
8821 containerDOM.appendChild(canvasDOM);
8822 this.set('canvasDOM', canvasDOM);
8823 }
8824 },
8825 _setInitSize: function _setInitSize() {
8826 this.changeSize(this.get('width'), this.get('height'));
8827 },
8828 _reSize: function _reSize() {
8829 var canvasDOM = this.get('canvasDOM');
8830 var widthCanvas = this.get('widthCanvas');
8831 var heightCanvas = this.get('heightCanvas');
8832 var widthStyle = this.get('widthStyle');
8833 var heightStyle = this.get('heightStyle');
8834
8835 canvasDOM.style.width = widthStyle;
8836 canvasDOM.style.height = heightStyle;
8837 canvasDOM.setAttribute('width', widthCanvas);
8838 canvasDOM.setAttribute('height', heightCanvas);
8839 },
8840 getWidth: function getWidth() {
8841 var pixelRatio = this.get('pixelRatio');
8842 var width = this.get('width');
8843 return width * pixelRatio;
8844 },
8845 getHeight: function getHeight() {
8846 var pixelRatio = this.get('pixelRatio');
8847 var height = this.get('height');
8848 return height * pixelRatio;
8849 },
8850 changeSize: function changeSize(width, height) {
8851 var pixelRatio = this.get('pixelRatio');
8852 var widthCanvas = width * pixelRatio;
8853 var heightCanvas = height * pixelRatio;
8854
8855 this.set('widthCanvas', widthCanvas);
8856 this.set('heightCanvas', heightCanvas);
8857 this.set('widthStyle', width + 'px');
8858 this.set('heightStyle', height + 'px');
8859 this.set('width', width);
8860 this.set('height', height);
8861 this._reSize();
8862 },
8863
8864 /**
8865 * 将窗口坐标转变成 canvas 坐标
8866 * @param {Number} clientX 窗口x坐标
8867 * @param {Number} clientY 窗口y坐标
8868 * @return {Object} canvas坐标
8869 */
8870 getPointByClient: function getPointByClient(clientX, clientY) {
8871 var el = this.get('el');
8872 var bbox = el.getBoundingClientRect();
8873 var width = bbox.right - bbox.left;
8874 var height = bbox.bottom - bbox.top;
8875 return {
8876 x: (clientX - bbox.left) * (el.width / width),
8877 y: (clientY - bbox.top) * (el.height / height)
8878 };
8879 },
8880 getClientByPoint: function getClientByPoint(x, y) {
8881 var el = this.get('el');
8882 var bbox = el.getBoundingClientRect();
8883 var width = bbox.right - bbox.left;
8884 var height = bbox.bottom - bbox.top;
8885 return {
8886 clientX: x / (el.width / width) + bbox.left,
8887 clientY: y / (el.height / height) + bbox.top
8888 };
8889 },
8890 beforeDraw: function beforeDraw() {
8891 var context = this.get('context');
8892 var el = this.get('el');
8893 context && context.clearRect(0, 0, el.width, el.height);
8894 },
8895 _beginDraw: function _beginDraw() {
8896 this.setSilent('toDraw', true);
8897 },
8898 _endDraw: function _endDraw() {
8899 this.setSilent('toDraw', false);
8900 },
8901 draw: function draw() {
8902 var self = this;
8903 function drawInner() {
8904 self.setSilent('animateHandler', requestAnimationFrame(function () {
8905 self.setSilent('animateHandler', undefined);
8906 if (self.get('toDraw')) {
8907 drawInner();
8908 }
8909 }));
8910 self.beforeDraw();
8911 try {
8912 var context = self.get('context');
8913 Canvas.superclass.draw.call(self, context);
8914 // self._drawCanvas();
8915 } catch (ev) {
8916 // 绘制时异常,中断重绘
8917 console.warn('error in draw canvas, detail as:');
8918 console.warn(ev);
8919 self._endDraw();
8920 }
8921 self._endDraw();
8922 }
8923
8924 if (self.get('destroyed')) {
8925 return;
8926 }
8927 if (self.get('animateHandler')) {
8928 this._beginDraw();
8929 } else {
8930 drawInner();
8931 }
8932 },
8933 destroy: function destroy() {
8934 var containerDOM = this.get('containerDOM');
8935 var canvasDOM = this.get('canvasDOM');
8936 if (canvasDOM && containerDOM) {
8937 containerDOM.removeChild(canvasDOM);
8938 }
8939 Canvas.superclass.destroy.call(this);
8940 }
8941 });
8942
8943 module.exports = Canvas;
8944
8945 /***/
8946 },
8947 /* 114 */
8948 /***/function (module, exports) {
8949
8950 var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) {
8951 return typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
8952 } : function (obj) {
8953 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
8954 };
8955
8956 var g;
8957
8958 // This works in non-strict mode
8959 g = function () {
8960 return this;
8961 }();
8962
8963 try {
8964 // This works if eval is allowed (see CSP)
8965 g = g || Function("return this")() || (1, eval)("this");
8966 } catch (e) {
8967 // This works if the window reference is available
8968 if ((typeof window === "undefined" ? "undefined" : _typeof(window)) === "object") g = window;
8969 }
8970
8971 // g can still be undefined, but nothing to do about it...
8972 // We return undefined, instead of nothing here, so it's
8973 // easier to handle this case. if(!global) { ...}
8974
8975 module.exports = g;
8976
8977 /***/
8978 },
8979 /* 115 */
8980 /***/function (module, exports, __webpack_require__) {
8981
8982 var _Symbol = __webpack_require__(11);
8983
8984 /** Used for built-in method references. */
8985 var objectProto = Object.prototype;
8986
8987 /** Used to check objects for own properties. */
8988 var hasOwnProperty = objectProto.hasOwnProperty;
8989
8990 /**
8991 * Used to resolve the
8992 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
8993 * of values.
8994 */
8995 var nativeObjectToString = objectProto.toString;
8996
8997 /** Built-in value references. */
8998 var symToStringTag = _Symbol ? _Symbol.toStringTag : undefined;
8999
9000 /**
9001 * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
9002 *
9003 * @private
9004 * @param {*} value The value to query.
9005 * @returns {string} Returns the raw `toStringTag`.
9006 */
9007 function getRawTag(value) {
9008 var isOwn = hasOwnProperty.call(value, symToStringTag),
9009 tag = value[symToStringTag];
9010
9011 try {
9012 value[symToStringTag] = undefined;
9013 var unmasked = true;
9014 } catch (e) {}
9015
9016 var result = nativeObjectToString.call(value);
9017 if (unmasked) {
9018 if (isOwn) {
9019 value[symToStringTag] = tag;
9020 } else {
9021 delete value[symToStringTag];
9022 }
9023 }
9024 return result;
9025 }
9026
9027 module.exports = getRawTag;
9028
9029 /***/
9030 },
9031 /* 116 */
9032 /***/function (module, exports) {
9033
9034 /** Used for built-in method references. */
9035 var objectProto = Object.prototype;
9036
9037 /**
9038 * Used to resolve the
9039 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
9040 * of values.
9041 */
9042 var nativeObjectToString = objectProto.toString;
9043
9044 /**
9045 * Converts `value` to a string using `Object.prototype.toString`.
9046 *
9047 * @private
9048 * @param {*} value The value to convert.
9049 * @returns {string} Returns the converted string.
9050 */
9051 function objectToString(value) {
9052 return nativeObjectToString.call(value);
9053 }
9054
9055 module.exports = objectToString;
9056
9057 /***/
9058 },
9059 /* 117 */
9060 /***/function (module, exports, __webpack_require__) {
9061
9062 var baseGetTag = __webpack_require__(7),
9063 isObjectLike = __webpack_require__(5);
9064
9065 /** `Object#toString` result references. */
9066 var boolTag = '[object Boolean]';
9067
9068 /**
9069 * Checks if `value` is classified as a boolean primitive or object.
9070 *
9071 * @static
9072 * @memberOf _
9073 * @since 0.1.0
9074 * @category Lang
9075 * @param {*} value The value to check.
9076 * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
9077 * @example
9078 *
9079 * _.isBoolean(false);
9080 * // => true
9081 *
9082 * _.isBoolean(null);
9083 * // => false
9084 */
9085 function isBoolean(value) {
9086 return value === true || value === false || isObjectLike(value) && baseGetTag(value) == boolTag;
9087 }
9088
9089 module.exports = isBoolean;
9090
9091 /***/
9092 },
9093 /* 118 */
9094 /***/function (module, exports) {
9095
9096 /**
9097 * Checks if `value` is `null` or `undefined`.
9098 *
9099 * @static
9100 * @memberOf _
9101 * @since 4.0.0
9102 * @category Lang
9103 * @param {*} value The value to check.
9104 * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
9105 * @example
9106 *
9107 * _.isNil(null);
9108 * // => true
9109 *
9110 * _.isNil(void 0);
9111 * // => true
9112 *
9113 * _.isNil(NaN);
9114 * // => false
9115 */
9116 function isNil(value) {
9117 return value == null;
9118 }
9119
9120 module.exports = isNil;
9121
9122 /***/
9123 },
9124 /* 119 */
9125 /***/function (module, exports, __webpack_require__) {
9126
9127 var baseGetTag = __webpack_require__(7),
9128 isObjectLike = __webpack_require__(5);
9129
9130 /** `Object#toString` result references. */
9131 var numberTag = '[object Number]';
9132
9133 /**
9134 * Checks if `value` is classified as a `Number` primitive or object.
9135 *
9136 * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
9137 * classified as numbers, use the `_.isFinite` method.
9138 *
9139 * @static
9140 * @memberOf _
9141 * @since 0.1.0
9142 * @category Lang
9143 * @param {*} value The value to check.
9144 * @returns {boolean} Returns `true` if `value` is a number, else `false`.
9145 * @example
9146 *
9147 * _.isNumber(3);
9148 * // => true
9149 *
9150 * _.isNumber(Number.MIN_VALUE);
9151 * // => true
9152 *
9153 * _.isNumber(Infinity);
9154 * // => true
9155 *
9156 * _.isNumber('3');
9157 * // => false
9158 */
9159 function isNumber(value) {
9160 return typeof value == 'number' || isObjectLike(value) && baseGetTag(value) == numberTag;
9161 }
9162
9163 module.exports = isNumber;
9164
9165 /***/
9166 },
9167 /* 120 */
9168 /***/function (module, exports, __webpack_require__) {
9169
9170 var baseKeys = __webpack_require__(57),
9171 getTag = __webpack_require__(21),
9172 isArguments = __webpack_require__(33),
9173 isArray = __webpack_require__(6),
9174 isArrayLike = __webpack_require__(9),
9175 isBuffer = __webpack_require__(17),
9176 isPrototype = __webpack_require__(16),
9177 isTypedArray = __webpack_require__(22);
9178
9179 /** `Object#toString` result references. */
9180 var mapTag = '[object Map]',
9181 setTag = '[object Set]';
9182
9183 /** Used for built-in method references. */
9184 var objectProto = Object.prototype;
9185
9186 /** Used to check objects for own properties. */
9187 var hasOwnProperty = objectProto.hasOwnProperty;
9188
9189 /**
9190 * Checks if `value` is an empty object, collection, map, or set.
9191 *
9192 * Objects are considered empty if they have no own enumerable string keyed
9193 * properties.
9194 *
9195 * Array-like values such as `arguments` objects, arrays, buffers, strings, or
9196 * jQuery-like collections are considered empty if they have a `length` of `0`.
9197 * Similarly, maps and sets are considered empty if they have a `size` of `0`.
9198 *
9199 * @static
9200 * @memberOf _
9201 * @since 0.1.0
9202 * @category Lang
9203 * @param {*} value The value to check.
9204 * @returns {boolean} Returns `true` if `value` is empty, else `false`.
9205 * @example
9206 *
9207 * _.isEmpty(null);
9208 * // => true
9209 *
9210 * _.isEmpty(true);
9211 * // => true
9212 *
9213 * _.isEmpty(1);
9214 * // => true
9215 *
9216 * _.isEmpty([1, 2, 3]);
9217 * // => false
9218 *
9219 * _.isEmpty({ 'a': 1 });
9220 * // => false
9221 */
9222 function isEmpty(value) {
9223 if (value == null) {
9224 return true;
9225 }
9226 if (isArrayLike(value) && (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' || isBuffer(value) || isTypedArray(value) || isArguments(value))) {
9227 return !value.length;
9228 }
9229 var tag = getTag(value);
9230 if (tag == mapTag || tag == setTag) {
9231 return !value.size;
9232 }
9233 if (isPrototype(value)) {
9234 return !baseKeys(value).length;
9235 }
9236 for (var key in value) {
9237 if (hasOwnProperty.call(value, key)) {
9238 return false;
9239 }
9240 }
9241 return true;
9242 }
9243
9244 module.exports = isEmpty;
9245
9246 /***/
9247 },
9248 /* 121 */
9249 /***/function (module, exports, __webpack_require__) {
9250
9251 var overArg = __webpack_require__(58);
9252
9253 /* Built-in method references for those with the same name as other `lodash` methods. */
9254 var nativeKeys = overArg(Object.keys, Object);
9255
9256 module.exports = nativeKeys;
9257
9258 /***/
9259 },
9260 /* 122 */
9261 /***/function (module, exports, __webpack_require__) {
9262
9263 var getNative = __webpack_require__(10),
9264 root = __webpack_require__(4);
9265
9266 /* Built-in method references that are verified to be native. */
9267 var DataView = getNative(root, 'DataView');
9268
9269 module.exports = DataView;
9270
9271 /***/
9272 },
9273 /* 123 */
9274 /***/function (module, exports, __webpack_require__) {
9275
9276 var isFunction = __webpack_require__(20),
9277 isMasked = __webpack_require__(124),
9278 isObject = __webpack_require__(8),
9279 toSource = __webpack_require__(59);
9280
9281 /**
9282 * Used to match `RegExp`
9283 * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
9284 */
9285 var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
9286
9287 /** Used to detect host constructors (Safari). */
9288 var reIsHostCtor = /^\[object .+?Constructor\]$/;
9289
9290 /** Used for built-in method references. */
9291 var funcProto = Function.prototype,
9292 objectProto = Object.prototype;
9293
9294 /** Used to resolve the decompiled source of functions. */
9295 var funcToString = funcProto.toString;
9296
9297 /** Used to check objects for own properties. */
9298 var hasOwnProperty = objectProto.hasOwnProperty;
9299
9300 /** Used to detect if a method is native. */
9301 var reIsNative = RegExp('^' + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&').replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$');
9302
9303 /**
9304 * The base implementation of `_.isNative` without bad shim checks.
9305 *
9306 * @private
9307 * @param {*} value The value to check.
9308 * @returns {boolean} Returns `true` if `value` is a native function,
9309 * else `false`.
9310 */
9311 function baseIsNative(value) {
9312 if (!isObject(value) || isMasked(value)) {
9313 return false;
9314 }
9315 var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
9316 return pattern.test(toSource(value));
9317 }
9318
9319 module.exports = baseIsNative;
9320
9321 /***/
9322 },
9323 /* 124 */
9324 /***/function (module, exports, __webpack_require__) {
9325
9326 var coreJsData = __webpack_require__(125);
9327
9328 /** Used to detect methods masquerading as native. */
9329 var maskSrcKey = function () {
9330 var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
9331 return uid ? 'Symbol(src)_1.' + uid : '';
9332 }();
9333
9334 /**
9335 * Checks if `func` has its source masked.
9336 *
9337 * @private
9338 * @param {Function} func The function to check.
9339 * @returns {boolean} Returns `true` if `func` is masked, else `false`.
9340 */
9341 function isMasked(func) {
9342 return !!maskSrcKey && maskSrcKey in func;
9343 }
9344
9345 module.exports = isMasked;
9346
9347 /***/
9348 },
9349 /* 125 */
9350 /***/function (module, exports, __webpack_require__) {
9351
9352 var root = __webpack_require__(4);
9353
9354 /** Used to detect overreaching core-js shims. */
9355 var coreJsData = root['__core-js_shared__'];
9356
9357 module.exports = coreJsData;
9358
9359 /***/
9360 },
9361 /* 126 */
9362 /***/function (module, exports) {
9363
9364 /**
9365 * Gets the value at `key` of `object`.
9366 *
9367 * @private
9368 * @param {Object} [object] The object to query.
9369 * @param {string} key The key of the property to get.
9370 * @returns {*} Returns the property value.
9371 */
9372 function getValue(object, key) {
9373 return object == null ? undefined : object[key];
9374 }
9375
9376 module.exports = getValue;
9377
9378 /***/
9379 },
9380 /* 127 */
9381 /***/function (module, exports, __webpack_require__) {
9382
9383 var getNative = __webpack_require__(10),
9384 root = __webpack_require__(4);
9385
9386 /* Built-in method references that are verified to be native. */
9387 var Promise = getNative(root, 'Promise');
9388
9389 module.exports = Promise;
9390
9391 /***/
9392 },
9393 /* 128 */
9394 /***/function (module, exports, __webpack_require__) {
9395
9396 var getNative = __webpack_require__(10),
9397 root = __webpack_require__(4);
9398
9399 /* Built-in method references that are verified to be native. */
9400 var Set = getNative(root, 'Set');
9401
9402 module.exports = Set;
9403
9404 /***/
9405 },
9406 /* 129 */
9407 /***/function (module, exports, __webpack_require__) {
9408
9409 var getNative = __webpack_require__(10),
9410 root = __webpack_require__(4);
9411
9412 /* Built-in method references that are verified to be native. */
9413 var WeakMap = getNative(root, 'WeakMap');
9414
9415 module.exports = WeakMap;
9416
9417 /***/
9418 },
9419 /* 130 */
9420 /***/function (module, exports, __webpack_require__) {
9421
9422 var baseGetTag = __webpack_require__(7),
9423 isObjectLike = __webpack_require__(5);
9424
9425 /** `Object#toString` result references. */
9426 var argsTag = '[object Arguments]';
9427
9428 /**
9429 * The base implementation of `_.isArguments`.
9430 *
9431 * @private
9432 * @param {*} value The value to check.
9433 * @returns {boolean} Returns `true` if `value` is an `arguments` object,
9434 */
9435 function baseIsArguments(value) {
9436 return isObjectLike(value) && baseGetTag(value) == argsTag;
9437 }
9438
9439 module.exports = baseIsArguments;
9440
9441 /***/
9442 },
9443 /* 131 */
9444 /***/function (module, exports) {
9445
9446 /**
9447 * This method returns `false`.
9448 *
9449 * @static
9450 * @memberOf _
9451 * @since 4.13.0
9452 * @category Util
9453 * @returns {boolean} Returns `false`.
9454 * @example
9455 *
9456 * _.times(2, _.stubFalse);
9457 * // => [false, false]
9458 */
9459 function stubFalse() {
9460 return false;
9461 }
9462
9463 module.exports = stubFalse;
9464
9465 /***/
9466 },
9467 /* 132 */
9468 /***/function (module, exports, __webpack_require__) {
9469
9470 var baseGetTag = __webpack_require__(7),
9471 isLength = __webpack_require__(60),
9472 isObjectLike = __webpack_require__(5);
9473
9474 /** `Object#toString` result references. */
9475 var argsTag = '[object Arguments]',
9476 arrayTag = '[object Array]',
9477 boolTag = '[object Boolean]',
9478 dateTag = '[object Date]',
9479 errorTag = '[object Error]',
9480 funcTag = '[object Function]',
9481 mapTag = '[object Map]',
9482 numberTag = '[object Number]',
9483 objectTag = '[object Object]',
9484 regexpTag = '[object RegExp]',
9485 setTag = '[object Set]',
9486 stringTag = '[object String]',
9487 weakMapTag = '[object WeakMap]';
9488
9489 var arrayBufferTag = '[object ArrayBuffer]',
9490 dataViewTag = '[object DataView]',
9491 float32Tag = '[object Float32Array]',
9492 float64Tag = '[object Float64Array]',
9493 int8Tag = '[object Int8Array]',
9494 int16Tag = '[object Int16Array]',
9495 int32Tag = '[object Int32Array]',
9496 uint8Tag = '[object Uint8Array]',
9497 uint8ClampedTag = '[object Uint8ClampedArray]',
9498 uint16Tag = '[object Uint16Array]',
9499 uint32Tag = '[object Uint32Array]';
9500
9501 /** Used to identify `toStringTag` values of typed arrays. */
9502 var typedArrayTags = {};
9503 typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
9504 typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
9505
9506 /**
9507 * The base implementation of `_.isTypedArray` without Node.js optimizations.
9508 *
9509 * @private
9510 * @param {*} value The value to check.
9511 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
9512 */
9513 function baseIsTypedArray(value) {
9514 return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
9515 }
9516
9517 module.exports = baseIsTypedArray;
9518
9519 /***/
9520 },
9521 /* 133 */
9522 /***/function (module, exports, __webpack_require__) {
9523
9524 /* WEBPACK VAR INJECTION */(function (module) {
9525 var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) {
9526 return typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
9527 } : function (obj) {
9528 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
9529 };
9530
9531 var freeGlobal = __webpack_require__(55);
9532
9533 /** Detect free variable `exports`. */
9534 var freeExports = (false ? 'undefined' : _typeof(exports)) == 'object' && exports && !exports.nodeType && exports;
9535
9536 /** Detect free variable `module`. */
9537 var freeModule = freeExports && (false ? 'undefined' : _typeof(module)) == 'object' && module && !module.nodeType && module;
9538
9539 /** Detect the popular CommonJS extension `module.exports`. */
9540 var moduleExports = freeModule && freeModule.exports === freeExports;
9541
9542 /** Detect free variable `process` from Node.js. */
9543 var freeProcess = moduleExports && freeGlobal.process;
9544
9545 /** Used to access faster Node.js helpers. */
9546 var nodeUtil = function () {
9547 try {
9548 return freeProcess && freeProcess.binding && freeProcess.binding('util');
9549 } catch (e) {}
9550 }();
9551
9552 module.exports = nodeUtil;
9553 /* WEBPACK VAR INJECTION */
9554 }).call(exports, __webpack_require__(34)(module));
9555
9556 /***/
9557 },
9558 /* 134 */
9559 /***/function (module, exports, __webpack_require__) {
9560
9561 var toString = __webpack_require__(62);
9562
9563 /** Used to generate unique IDs. */
9564 var idCounter = 0;
9565
9566 /**
9567 * Generates a unique ID. If `prefix` is given, the ID is appended to it.
9568 *
9569 * @static
9570 * @since 0.1.0
9571 * @memberOf _
9572 * @category Util
9573 * @param {string} [prefix=''] The value to prefix the ID with.
9574 * @returns {string} Returns the unique ID.
9575 * @example
9576 *
9577 * _.uniqueId('contact_');
9578 * // => 'contact_104'
9579 *
9580 * _.uniqueId();
9581 * // => '105'
9582 */
9583 function uniqueId(prefix) {
9584 var id = ++idCounter;
9585 return toString(prefix) + id;
9586 }
9587
9588 module.exports = uniqueId;
9589
9590 /***/
9591 },
9592 /* 135 */
9593 /***/function (module, exports, __webpack_require__) {
9594
9595 var _Symbol = __webpack_require__(11),
9596 arrayMap = __webpack_require__(35),
9597 isArray = __webpack_require__(6),
9598 isSymbol = __webpack_require__(136);
9599
9600 /** Used as references for various `Number` constants. */
9601 var INFINITY = 1 / 0;
9602
9603 /** Used to convert symbols to primitives and strings. */
9604 var symbolProto = _Symbol ? _Symbol.prototype : undefined,
9605 symbolToString = symbolProto ? symbolProto.toString : undefined;
9606
9607 /**
9608 * The base implementation of `_.toString` which doesn't convert nullish
9609 * values to empty strings.
9610 *
9611 * @private
9612 * @param {*} value The value to process.
9613 * @returns {string} Returns the string.
9614 */
9615 function baseToString(value) {
9616 // Exit early for strings to avoid a performance hit in some environments.
9617 if (typeof value == 'string') {
9618 return value;
9619 }
9620 if (isArray(value)) {
9621 // Recursively convert values (susceptible to call stack limits).
9622 return arrayMap(value, baseToString) + '';
9623 }
9624 if (isSymbol(value)) {
9625 return symbolToString ? symbolToString.call(value) : '';
9626 }
9627 var result = value + '';
9628 return result == '0' && 1 / value == -INFINITY ? '-0' : result;
9629 }
9630
9631 module.exports = baseToString;
9632
9633 /***/
9634 },
9635 /* 136 */
9636 /***/function (module, exports, __webpack_require__) {
9637
9638 var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) {
9639 return typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
9640 } : function (obj) {
9641 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
9642 };
9643
9644 var baseGetTag = __webpack_require__(7),
9645 isObjectLike = __webpack_require__(5);
9646
9647 /** `Object#toString` result references. */
9648 var symbolTag = '[object Symbol]';
9649
9650 /**
9651 * Checks if `value` is classified as a `Symbol` primitive or object.
9652 *
9653 * @static
9654 * @memberOf _
9655 * @since 4.0.0
9656 * @category Lang
9657 * @param {*} value The value to check.
9658 * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
9659 * @example
9660 *
9661 * _.isSymbol(Symbol.iterator);
9662 * // => true
9663 *
9664 * _.isSymbol('abc');
9665 * // => false
9666 */
9667 function isSymbol(value) {
9668 return (typeof value === 'undefined' ? 'undefined' : _typeof(value)) == 'symbol' || isObjectLike(value) && baseGetTag(value) == symbolTag;
9669 }
9670
9671 module.exports = isSymbol;
9672
9673 /***/
9674 },
9675 /* 137 */
9676 /***/function (module, exports, __webpack_require__) {
9677
9678 var baseClone = __webpack_require__(138);
9679
9680 /** Used to compose bitmasks for cloning. */
9681 var CLONE_SYMBOLS_FLAG = 4;
9682
9683 /**
9684 * Creates a shallow clone of `value`.
9685 *
9686 * **Note:** This method is loosely based on the
9687 * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
9688 * and supports cloning arrays, array buffers, booleans, date objects, maps,
9689 * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
9690 * arrays. The own enumerable properties of `arguments` objects are cloned
9691 * as plain objects. An empty object is returned for uncloneable values such
9692 * as error objects, functions, DOM nodes, and WeakMaps.
9693 *
9694 * @static
9695 * @memberOf _
9696 * @since 0.1.0
9697 * @category Lang
9698 * @param {*} value The value to clone.
9699 * @returns {*} Returns the cloned value.
9700 * @see _.cloneDeep
9701 * @example
9702 *
9703 * var objects = [{ 'a': 1 }, { 'b': 2 }];
9704 *
9705 * var shallow = _.clone(objects);
9706 * console.log(shallow[0] === objects[0]);
9707 * // => true
9708 */
9709 function clone(value) {
9710 return baseClone(value, CLONE_SYMBOLS_FLAG);
9711 }
9712
9713 module.exports = clone;
9714
9715 /***/
9716 },
9717 /* 138 */
9718 /***/function (module, exports, __webpack_require__) {
9719
9720 var Stack = __webpack_require__(36),
9721 arrayEach = __webpack_require__(64),
9722 assignValue = __webpack_require__(37),
9723 baseAssign = __webpack_require__(161),
9724 baseAssignIn = __webpack_require__(163),
9725 cloneBuffer = __webpack_require__(68),
9726 copyArray = __webpack_require__(28),
9727 copySymbols = __webpack_require__(166),
9728 copySymbolsIn = __webpack_require__(168),
9729 getAllKeys = __webpack_require__(72),
9730 getAllKeysIn = __webpack_require__(169),
9731 getTag = __webpack_require__(21),
9732 initCloneArray = __webpack_require__(170),
9733 initCloneByTag = __webpack_require__(171),
9734 initCloneObject = __webpack_require__(77),
9735 isArray = __webpack_require__(6),
9736 isBuffer = __webpack_require__(17),
9737 isObject = __webpack_require__(8),
9738 keys = __webpack_require__(13);
9739
9740 /** Used to compose bitmasks for cloning. */
9741 var CLONE_DEEP_FLAG = 1,
9742 CLONE_FLAT_FLAG = 2,
9743 CLONE_SYMBOLS_FLAG = 4;
9744
9745 /** `Object#toString` result references. */
9746 var argsTag = '[object Arguments]',
9747 arrayTag = '[object Array]',
9748 boolTag = '[object Boolean]',
9749 dateTag = '[object Date]',
9750 errorTag = '[object Error]',
9751 funcTag = '[object Function]',
9752 genTag = '[object GeneratorFunction]',
9753 mapTag = '[object Map]',
9754 numberTag = '[object Number]',
9755 objectTag = '[object Object]',
9756 regexpTag = '[object RegExp]',
9757 setTag = '[object Set]',
9758 stringTag = '[object String]',
9759 symbolTag = '[object Symbol]',
9760 weakMapTag = '[object WeakMap]';
9761
9762 var arrayBufferTag = '[object ArrayBuffer]',
9763 dataViewTag = '[object DataView]',
9764 float32Tag = '[object Float32Array]',
9765 float64Tag = '[object Float64Array]',
9766 int8Tag = '[object Int8Array]',
9767 int16Tag = '[object Int16Array]',
9768 int32Tag = '[object Int32Array]',
9769 uint8Tag = '[object Uint8Array]',
9770 uint8ClampedTag = '[object Uint8ClampedArray]',
9771 uint16Tag = '[object Uint16Array]',
9772 uint32Tag = '[object Uint32Array]';
9773
9774 /** Used to identify `toStringTag` values supported by `_.clone`. */
9775 var cloneableTags = {};
9776 cloneableTags[argsTag] = cloneableTags[arrayTag] = cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = cloneableTags[boolTag] = cloneableTags[dateTag] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag] = cloneableTags[numberTag] = cloneableTags[objectTag] = cloneableTags[regexpTag] = cloneableTags[setTag] = cloneableTags[stringTag] = cloneableTags[symbolTag] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
9777 cloneableTags[errorTag] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false;
9778
9779 /**
9780 * The base implementation of `_.clone` and `_.cloneDeep` which tracks
9781 * traversed objects.
9782 *
9783 * @private
9784 * @param {*} value The value to clone.
9785 * @param {boolean} bitmask The bitmask flags.
9786 * 1 - Deep clone
9787 * 2 - Flatten inherited properties
9788 * 4 - Clone symbols
9789 * @param {Function} [customizer] The function to customize cloning.
9790 * @param {string} [key] The key of `value`.
9791 * @param {Object} [object] The parent object of `value`.
9792 * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
9793 * @returns {*} Returns the cloned value.
9794 */
9795 function baseClone(value, bitmask, customizer, key, object, stack) {
9796 var result,
9797 isDeep = bitmask & CLONE_DEEP_FLAG,
9798 isFlat = bitmask & CLONE_FLAT_FLAG,
9799 isFull = bitmask & CLONE_SYMBOLS_FLAG;
9800
9801 if (customizer) {
9802 result = object ? customizer(value, key, object, stack) : customizer(value);
9803 }
9804 if (result !== undefined) {
9805 return result;
9806 }
9807 if (!isObject(value)) {
9808 return value;
9809 }
9810 var isArr = isArray(value);
9811 if (isArr) {
9812 result = initCloneArray(value);
9813 if (!isDeep) {
9814 return copyArray(value, result);
9815 }
9816 } else {
9817 var tag = getTag(value),
9818 isFunc = tag == funcTag || tag == genTag;
9819
9820 if (isBuffer(value)) {
9821 return cloneBuffer(value, isDeep);
9822 }
9823 if (tag == objectTag || tag == argsTag || isFunc && !object) {
9824 result = isFlat || isFunc ? {} : initCloneObject(value);
9825 if (!isDeep) {
9826 return isFlat ? copySymbolsIn(value, baseAssignIn(result, value)) : copySymbols(value, baseAssign(result, value));
9827 }
9828 } else {
9829 if (!cloneableTags[tag]) {
9830 return object ? value : {};
9831 }
9832 result = initCloneByTag(value, tag, baseClone, isDeep);
9833 }
9834 }
9835 // Check for circular references and return its corresponding clone.
9836 stack || (stack = new Stack());
9837 var stacked = stack.get(value);
9838 if (stacked) {
9839 return stacked;
9840 }
9841 stack.set(value, result);
9842
9843 var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys;
9844
9845 var props = isArr ? undefined : keysFunc(value);
9846 arrayEach(props || value, function (subValue, key) {
9847 if (props) {
9848 key = subValue;
9849 subValue = value[key];
9850 }
9851 // Recursively populate clone (susceptible to call stack limits).
9852 assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
9853 });
9854 return result;
9855 }
9856
9857 module.exports = baseClone;
9858
9859 /***/
9860 },
9861 /* 139 */
9862 /***/function (module, exports) {
9863
9864 /**
9865 * Removes all key-value entries from the list cache.
9866 *
9867 * @private
9868 * @name clear
9869 * @memberOf ListCache
9870 */
9871 function listCacheClear() {
9872 this.__data__ = [];
9873 this.size = 0;
9874 }
9875
9876 module.exports = listCacheClear;
9877
9878 /***/
9879 },
9880 /* 140 */
9881 /***/function (module, exports, __webpack_require__) {
9882
9883 var assocIndexOf = __webpack_require__(24);
9884
9885 /** Used for built-in method references. */
9886 var arrayProto = Array.prototype;
9887
9888 /** Built-in value references. */
9889 var splice = arrayProto.splice;
9890
9891 /**
9892 * Removes `key` and its value from the list cache.
9893 *
9894 * @private
9895 * @name delete
9896 * @memberOf ListCache
9897 * @param {string} key The key of the value to remove.
9898 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
9899 */
9900 function listCacheDelete(key) {
9901 var data = this.__data__,
9902 index = assocIndexOf(data, key);
9903
9904 if (index < 0) {
9905 return false;
9906 }
9907 var lastIndex = data.length - 1;
9908 if (index == lastIndex) {
9909 data.pop();
9910 } else {
9911 splice.call(data, index, 1);
9912 }
9913 --this.size;
9914 return true;
9915 }
9916
9917 module.exports = listCacheDelete;
9918
9919 /***/
9920 },
9921 /* 141 */
9922 /***/function (module, exports, __webpack_require__) {
9923
9924 var assocIndexOf = __webpack_require__(24);
9925
9926 /**
9927 * Gets the list cache value for `key`.
9928 *
9929 * @private
9930 * @name get
9931 * @memberOf ListCache
9932 * @param {string} key The key of the value to get.
9933 * @returns {*} Returns the entry value.
9934 */
9935 function listCacheGet(key) {
9936 var data = this.__data__,
9937 index = assocIndexOf(data, key);
9938
9939 return index < 0 ? undefined : data[index][1];
9940 }
9941
9942 module.exports = listCacheGet;
9943
9944 /***/
9945 },
9946 /* 142 */
9947 /***/function (module, exports, __webpack_require__) {
9948
9949 var assocIndexOf = __webpack_require__(24);
9950
9951 /**
9952 * Checks if a list cache value for `key` exists.
9953 *
9954 * @private
9955 * @name has
9956 * @memberOf ListCache
9957 * @param {string} key The key of the entry to check.
9958 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
9959 */
9960 function listCacheHas(key) {
9961 return assocIndexOf(this.__data__, key) > -1;
9962 }
9963
9964 module.exports = listCacheHas;
9965
9966 /***/
9967 },
9968 /* 143 */
9969 /***/function (module, exports, __webpack_require__) {
9970
9971 var assocIndexOf = __webpack_require__(24);
9972
9973 /**
9974 * Sets the list cache `key` to `value`.
9975 *
9976 * @private
9977 * @name set
9978 * @memberOf ListCache
9979 * @param {string} key The key of the value to set.
9980 * @param {*} value The value to set.
9981 * @returns {Object} Returns the list cache instance.
9982 */
9983 function listCacheSet(key, value) {
9984 var data = this.__data__,
9985 index = assocIndexOf(data, key);
9986
9987 if (index < 0) {
9988 ++this.size;
9989 data.push([key, value]);
9990 } else {
9991 data[index][1] = value;
9992 }
9993 return this;
9994 }
9995
9996 module.exports = listCacheSet;
9997
9998 /***/
9999 },
10000 /* 144 */
10001 /***/function (module, exports, __webpack_require__) {
10002
10003 var ListCache = __webpack_require__(23);
10004
10005 /**
10006 * Removes all key-value entries from the stack.
10007 *
10008 * @private
10009 * @name clear
10010 * @memberOf Stack
10011 */
10012 function stackClear() {
10013 this.__data__ = new ListCache();
10014 this.size = 0;
10015 }
10016
10017 module.exports = stackClear;
10018
10019 /***/
10020 },
10021 /* 145 */
10022 /***/function (module, exports) {
10023
10024 /**
10025 * Removes `key` and its value from the stack.
10026 *
10027 * @private
10028 * @name delete
10029 * @memberOf Stack
10030 * @param {string} key The key of the value to remove.
10031 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
10032 */
10033 function stackDelete(key) {
10034 var data = this.__data__,
10035 result = data['delete'](key);
10036
10037 this.size = data.size;
10038 return result;
10039 }
10040
10041 module.exports = stackDelete;
10042
10043 /***/
10044 },
10045 /* 146 */
10046 /***/function (module, exports) {
10047
10048 /**
10049 * Gets the stack value for `key`.
10050 *
10051 * @private
10052 * @name get
10053 * @memberOf Stack
10054 * @param {string} key The key of the value to get.
10055 * @returns {*} Returns the entry value.
10056 */
10057 function stackGet(key) {
10058 return this.__data__.get(key);
10059 }
10060
10061 module.exports = stackGet;
10062
10063 /***/
10064 },
10065 /* 147 */
10066 /***/function (module, exports) {
10067
10068 /**
10069 * Checks if a stack value for `key` exists.
10070 *
10071 * @private
10072 * @name has
10073 * @memberOf Stack
10074 * @param {string} key The key of the entry to check.
10075 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
10076 */
10077 function stackHas(key) {
10078 return this.__data__.has(key);
10079 }
10080
10081 module.exports = stackHas;
10082
10083 /***/
10084 },
10085 /* 148 */
10086 /***/function (module, exports, __webpack_require__) {
10087
10088 var ListCache = __webpack_require__(23),
10089 Map = __webpack_require__(32),
10090 MapCache = __webpack_require__(63);
10091
10092 /** Used as the size to enable large array optimizations. */
10093 var LARGE_ARRAY_SIZE = 200;
10094
10095 /**
10096 * Sets the stack `key` to `value`.
10097 *
10098 * @private
10099 * @name set
10100 * @memberOf Stack
10101 * @param {string} key The key of the value to set.
10102 * @param {*} value The value to set.
10103 * @returns {Object} Returns the stack cache instance.
10104 */
10105 function stackSet(key, value) {
10106 var data = this.__data__;
10107 if (data instanceof ListCache) {
10108 var pairs = data.__data__;
10109 if (!Map || pairs.length < LARGE_ARRAY_SIZE - 1) {
10110 pairs.push([key, value]);
10111 this.size = ++data.size;
10112 return this;
10113 }
10114 data = this.__data__ = new MapCache(pairs);
10115 }
10116 data.set(key, value);
10117 this.size = data.size;
10118 return this;
10119 }
10120
10121 module.exports = stackSet;
10122
10123 /***/
10124 },
10125 /* 149 */
10126 /***/function (module, exports, __webpack_require__) {
10127
10128 var Hash = __webpack_require__(150),
10129 ListCache = __webpack_require__(23),
10130 Map = __webpack_require__(32);
10131
10132 /**
10133 * Removes all key-value entries from the map.
10134 *
10135 * @private
10136 * @name clear
10137 * @memberOf MapCache
10138 */
10139 function mapCacheClear() {
10140 this.size = 0;
10141 this.__data__ = {
10142 'hash': new Hash(),
10143 'map': new (Map || ListCache)(),
10144 'string': new Hash()
10145 };
10146 }
10147
10148 module.exports = mapCacheClear;
10149
10150 /***/
10151 },
10152 /* 150 */
10153 /***/function (module, exports, __webpack_require__) {
10154
10155 var hashClear = __webpack_require__(151),
10156 hashDelete = __webpack_require__(152),
10157 hashGet = __webpack_require__(153),
10158 hashHas = __webpack_require__(154),
10159 hashSet = __webpack_require__(155);
10160
10161 /**
10162 * Creates a hash object.
10163 *
10164 * @private
10165 * @constructor
10166 * @param {Array} [entries] The key-value pairs to cache.
10167 */
10168 function Hash(entries) {
10169 var index = -1,
10170 length = entries == null ? 0 : entries.length;
10171
10172 this.clear();
10173 while (++index < length) {
10174 var entry = entries[index];
10175 this.set(entry[0], entry[1]);
10176 }
10177 }
10178
10179 // Add methods to `Hash`.
10180 Hash.prototype.clear = hashClear;
10181 Hash.prototype['delete'] = hashDelete;
10182 Hash.prototype.get = hashGet;
10183 Hash.prototype.has = hashHas;
10184 Hash.prototype.set = hashSet;
10185
10186 module.exports = Hash;
10187
10188 /***/
10189 },
10190 /* 151 */
10191 /***/function (module, exports, __webpack_require__) {
10192
10193 var nativeCreate = __webpack_require__(25);
10194
10195 /**
10196 * Removes all key-value entries from the hash.
10197 *
10198 * @private
10199 * @name clear
10200 * @memberOf Hash
10201 */
10202 function hashClear() {
10203 this.__data__ = nativeCreate ? nativeCreate(null) : {};
10204 this.size = 0;
10205 }
10206
10207 module.exports = hashClear;
10208
10209 /***/
10210 },
10211 /* 152 */
10212 /***/function (module, exports) {
10213
10214 /**
10215 * Removes `key` and its value from the hash.
10216 *
10217 * @private
10218 * @name delete
10219 * @memberOf Hash
10220 * @param {Object} hash The hash to modify.
10221 * @param {string} key The key of the value to remove.
10222 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
10223 */
10224 function hashDelete(key) {
10225 var result = this.has(key) && delete this.__data__[key];
10226 this.size -= result ? 1 : 0;
10227 return result;
10228 }
10229
10230 module.exports = hashDelete;
10231
10232 /***/
10233 },
10234 /* 153 */
10235 /***/function (module, exports, __webpack_require__) {
10236
10237 var nativeCreate = __webpack_require__(25);
10238
10239 /** Used to stand-in for `undefined` hash values. */
10240 var HASH_UNDEFINED = '__lodash_hash_undefined__';
10241
10242 /** Used for built-in method references. */
10243 var objectProto = Object.prototype;
10244
10245 /** Used to check objects for own properties. */
10246 var hasOwnProperty = objectProto.hasOwnProperty;
10247
10248 /**
10249 * Gets the hash value for `key`.
10250 *
10251 * @private
10252 * @name get
10253 * @memberOf Hash
10254 * @param {string} key The key of the value to get.
10255 * @returns {*} Returns the entry value.
10256 */
10257 function hashGet(key) {
10258 var data = this.__data__;
10259 if (nativeCreate) {
10260 var result = data[key];
10261 return result === HASH_UNDEFINED ? undefined : result;
10262 }
10263 return hasOwnProperty.call(data, key) ? data[key] : undefined;
10264 }
10265
10266 module.exports = hashGet;
10267
10268 /***/
10269 },
10270 /* 154 */
10271 /***/function (module, exports, __webpack_require__) {
10272
10273 var nativeCreate = __webpack_require__(25);
10274
10275 /** Used for built-in method references. */
10276 var objectProto = Object.prototype;
10277
10278 /** Used to check objects for own properties. */
10279 var hasOwnProperty = objectProto.hasOwnProperty;
10280
10281 /**
10282 * Checks if a hash value for `key` exists.
10283 *
10284 * @private
10285 * @name has
10286 * @memberOf Hash
10287 * @param {string} key The key of the entry to check.
10288 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
10289 */
10290 function hashHas(key) {
10291 var data = this.__data__;
10292 return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
10293 }
10294
10295 module.exports = hashHas;
10296
10297 /***/
10298 },
10299 /* 155 */
10300 /***/function (module, exports, __webpack_require__) {
10301
10302 var nativeCreate = __webpack_require__(25);
10303
10304 /** Used to stand-in for `undefined` hash values. */
10305 var HASH_UNDEFINED = '__lodash_hash_undefined__';
10306
10307 /**
10308 * Sets the hash `key` to `value`.
10309 *
10310 * @private
10311 * @name set
10312 * @memberOf Hash
10313 * @param {string} key The key of the value to set.
10314 * @param {*} value The value to set.
10315 * @returns {Object} Returns the hash instance.
10316 */
10317 function hashSet(key, value) {
10318 var data = this.__data__;
10319 this.size += this.has(key) ? 0 : 1;
10320 data[key] = nativeCreate && value === undefined ? HASH_UNDEFINED : value;
10321 return this;
10322 }
10323
10324 module.exports = hashSet;
10325
10326 /***/
10327 },
10328 /* 156 */
10329 /***/function (module, exports, __webpack_require__) {
10330
10331 var getMapData = __webpack_require__(26);
10332
10333 /**
10334 * Removes `key` and its value from the map.
10335 *
10336 * @private
10337 * @name delete
10338 * @memberOf MapCache
10339 * @param {string} key The key of the value to remove.
10340 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
10341 */
10342 function mapCacheDelete(key) {
10343 var result = getMapData(this, key)['delete'](key);
10344 this.size -= result ? 1 : 0;
10345 return result;
10346 }
10347
10348 module.exports = mapCacheDelete;
10349
10350 /***/
10351 },
10352 /* 157 */
10353 /***/function (module, exports) {
10354
10355 var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) {
10356 return typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
10357 } : function (obj) {
10358 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
10359 };
10360
10361 /**
10362 * Checks if `value` is suitable for use as unique object key.
10363 *
10364 * @private
10365 * @param {*} value The value to check.
10366 * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
10367 */
10368 function isKeyable(value) {
10369 var type = typeof value === 'undefined' ? 'undefined' : _typeof(value);
10370 return type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean' ? value !== '__proto__' : value === null;
10371 }
10372
10373 module.exports = isKeyable;
10374
10375 /***/
10376 },
10377 /* 158 */
10378 /***/function (module, exports, __webpack_require__) {
10379
10380 var getMapData = __webpack_require__(26);
10381
10382 /**
10383 * Gets the map value for `key`.
10384 *
10385 * @private
10386 * @name get
10387 * @memberOf MapCache
10388 * @param {string} key The key of the value to get.
10389 * @returns {*} Returns the entry value.
10390 */
10391 function mapCacheGet(key) {
10392 return getMapData(this, key).get(key);
10393 }
10394
10395 module.exports = mapCacheGet;
10396
10397 /***/
10398 },
10399 /* 159 */
10400 /***/function (module, exports, __webpack_require__) {
10401
10402 var getMapData = __webpack_require__(26);
10403
10404 /**
10405 * Checks if a map value for `key` exists.
10406 *
10407 * @private
10408 * @name has
10409 * @memberOf MapCache
10410 * @param {string} key The key of the entry to check.
10411 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
10412 */
10413 function mapCacheHas(key) {
10414 return getMapData(this, key).has(key);
10415 }
10416
10417 module.exports = mapCacheHas;
10418
10419 /***/
10420 },
10421 /* 160 */
10422 /***/function (module, exports, __webpack_require__) {
10423
10424 var getMapData = __webpack_require__(26);
10425
10426 /**
10427 * Sets the map `key` to `value`.
10428 *
10429 * @private
10430 * @name set
10431 * @memberOf MapCache
10432 * @param {string} key The key of the value to set.
10433 * @param {*} value The value to set.
10434 * @returns {Object} Returns the map cache instance.
10435 */
10436 function mapCacheSet(key, value) {
10437 var data = getMapData(this, key),
10438 size = data.size;
10439
10440 data.set(key, value);
10441 this.size += data.size == size ? 0 : 1;
10442 return this;
10443 }
10444
10445 module.exports = mapCacheSet;
10446
10447 /***/
10448 },
10449 /* 161 */
10450 /***/function (module, exports, __webpack_require__) {
10451
10452 var copyObject = __webpack_require__(12),
10453 keys = __webpack_require__(13);
10454
10455 /**
10456 * The base implementation of `_.assign` without support for multiple sources
10457 * or `customizer` functions.
10458 *
10459 * @private
10460 * @param {Object} object The destination object.
10461 * @param {Object} source The source object.
10462 * @returns {Object} Returns `object`.
10463 */
10464 function baseAssign(object, source) {
10465 return object && copyObject(source, keys(source), object);
10466 }
10467
10468 module.exports = baseAssign;
10469
10470 /***/
10471 },
10472 /* 162 */
10473 /***/function (module, exports) {
10474
10475 /**
10476 * The base implementation of `_.times` without support for iteratee shorthands
10477 * or max array length checks.
10478 *
10479 * @private
10480 * @param {number} n The number of times to invoke `iteratee`.
10481 * @param {Function} iteratee The function invoked per iteration.
10482 * @returns {Array} Returns the array of results.
10483 */
10484 function baseTimes(n, iteratee) {
10485 var index = -1,
10486 result = Array(n);
10487
10488 while (++index < n) {
10489 result[index] = iteratee(index);
10490 }
10491 return result;
10492 }
10493
10494 module.exports = baseTimes;
10495
10496 /***/
10497 },
10498 /* 163 */
10499 /***/function (module, exports, __webpack_require__) {
10500
10501 var copyObject = __webpack_require__(12),
10502 keysIn = __webpack_require__(27);
10503
10504 /**
10505 * The base implementation of `_.assignIn` without support for multiple sources
10506 * or `customizer` functions.
10507 *
10508 * @private
10509 * @param {Object} object The destination object.
10510 * @param {Object} source The source object.
10511 * @returns {Object} Returns `object`.
10512 */
10513 function baseAssignIn(object, source) {
10514 return object && copyObject(source, keysIn(source), object);
10515 }
10516
10517 module.exports = baseAssignIn;
10518
10519 /***/
10520 },
10521 /* 164 */
10522 /***/function (module, exports, __webpack_require__) {
10523
10524 var isObject = __webpack_require__(8),
10525 isPrototype = __webpack_require__(16),
10526 nativeKeysIn = __webpack_require__(165);
10527
10528 /** Used for built-in method references. */
10529 var objectProto = Object.prototype;
10530
10531 /** Used to check objects for own properties. */
10532 var hasOwnProperty = objectProto.hasOwnProperty;
10533
10534 /**
10535 * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
10536 *
10537 * @private
10538 * @param {Object} object The object to query.
10539 * @returns {Array} Returns the array of property names.
10540 */
10541 function baseKeysIn(object) {
10542 if (!isObject(object)) {
10543 return nativeKeysIn(object);
10544 }
10545 var isProto = isPrototype(object),
10546 result = [];
10547
10548 for (var key in object) {
10549 if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
10550 result.push(key);
10551 }
10552 }
10553 return result;
10554 }
10555
10556 module.exports = baseKeysIn;
10557
10558 /***/
10559 },
10560 /* 165 */
10561 /***/function (module, exports) {
10562
10563 /**
10564 * This function is like
10565 * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
10566 * except that it includes inherited enumerable properties.
10567 *
10568 * @private
10569 * @param {Object} object The object to query.
10570 * @returns {Array} Returns the array of property names.
10571 */
10572 function nativeKeysIn(object) {
10573 var result = [];
10574 if (object != null) {
10575 for (var key in Object(object)) {
10576 result.push(key);
10577 }
10578 }
10579 return result;
10580 }
10581
10582 module.exports = nativeKeysIn;
10583
10584 /***/
10585 },
10586 /* 166 */
10587 /***/function (module, exports, __webpack_require__) {
10588
10589 var copyObject = __webpack_require__(12),
10590 getSymbols = __webpack_require__(39);
10591
10592 /**
10593 * Copies own symbols of `source` to `object`.
10594 *
10595 * @private
10596 * @param {Object} source The object to copy symbols from.
10597 * @param {Object} [object={}] The object to copy symbols to.
10598 * @returns {Object} Returns `object`.
10599 */
10600 function copySymbols(source, object) {
10601 return copyObject(source, getSymbols(source), object);
10602 }
10603
10604 module.exports = copySymbols;
10605
10606 /***/
10607 },
10608 /* 167 */
10609 /***/function (module, exports) {
10610
10611 /**
10612 * A specialized version of `_.filter` for arrays without support for
10613 * iteratee shorthands.
10614 *
10615 * @private
10616 * @param {Array} [array] The array to iterate over.
10617 * @param {Function} predicate The function invoked per iteration.
10618 * @returns {Array} Returns the new filtered array.
10619 */
10620 function arrayFilter(array, predicate) {
10621 var index = -1,
10622 length = array == null ? 0 : array.length,
10623 resIndex = 0,
10624 result = [];
10625
10626 while (++index < length) {
10627 var value = array[index];
10628 if (predicate(value, index, array)) {
10629 result[resIndex++] = value;
10630 }
10631 }
10632 return result;
10633 }
10634
10635 module.exports = arrayFilter;
10636
10637 /***/
10638 },
10639 /* 168 */
10640 /***/function (module, exports, __webpack_require__) {
10641
10642 var copyObject = __webpack_require__(12),
10643 getSymbolsIn = __webpack_require__(70);
10644
10645 /**
10646 * Copies own and inherited symbols of `source` to `object`.
10647 *
10648 * @private
10649 * @param {Object} source The object to copy symbols from.
10650 * @param {Object} [object={}] The object to copy symbols to.
10651 * @returns {Object} Returns `object`.
10652 */
10653 function copySymbolsIn(source, object) {
10654 return copyObject(source, getSymbolsIn(source), object);
10655 }
10656
10657 module.exports = copySymbolsIn;
10658
10659 /***/
10660 },
10661 /* 169 */
10662 /***/function (module, exports, __webpack_require__) {
10663
10664 var baseGetAllKeys = __webpack_require__(73),
10665 getSymbolsIn = __webpack_require__(70),
10666 keysIn = __webpack_require__(27);
10667
10668 /**
10669 * Creates an array of own and inherited enumerable property names and
10670 * symbols of `object`.
10671 *
10672 * @private
10673 * @param {Object} object The object to query.
10674 * @returns {Array} Returns the array of property names and symbols.
10675 */
10676 function getAllKeysIn(object) {
10677 return baseGetAllKeys(object, keysIn, getSymbolsIn);
10678 }
10679
10680 module.exports = getAllKeysIn;
10681
10682 /***/
10683 },
10684 /* 170 */
10685 /***/function (module, exports) {
10686
10687 /** Used for built-in method references. */
10688 var objectProto = Object.prototype;
10689
10690 /** Used to check objects for own properties. */
10691 var hasOwnProperty = objectProto.hasOwnProperty;
10692
10693 /**
10694 * Initializes an array clone.
10695 *
10696 * @private
10697 * @param {Array} array The array to clone.
10698 * @returns {Array} Returns the initialized clone.
10699 */
10700 function initCloneArray(array) {
10701 var length = array.length,
10702 result = array.constructor(length);
10703
10704 // Add properties assigned by `RegExp#exec`.
10705 if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
10706 result.index = array.index;
10707 result.input = array.input;
10708 }
10709 return result;
10710 }
10711
10712 module.exports = initCloneArray;
10713
10714 /***/
10715 },
10716 /* 171 */
10717 /***/function (module, exports, __webpack_require__) {
10718
10719 var cloneArrayBuffer = __webpack_require__(41),
10720 cloneDataView = __webpack_require__(172),
10721 cloneMap = __webpack_require__(173),
10722 cloneRegExp = __webpack_require__(175),
10723 cloneSet = __webpack_require__(176),
10724 cloneSymbol = __webpack_require__(178),
10725 cloneTypedArray = __webpack_require__(76);
10726
10727 /** `Object#toString` result references. */
10728 var boolTag = '[object Boolean]',
10729 dateTag = '[object Date]',
10730 mapTag = '[object Map]',
10731 numberTag = '[object Number]',
10732 regexpTag = '[object RegExp]',
10733 setTag = '[object Set]',
10734 stringTag = '[object String]',
10735 symbolTag = '[object Symbol]';
10736
10737 var arrayBufferTag = '[object ArrayBuffer]',
10738 dataViewTag = '[object DataView]',
10739 float32Tag = '[object Float32Array]',
10740 float64Tag = '[object Float64Array]',
10741 int8Tag = '[object Int8Array]',
10742 int16Tag = '[object Int16Array]',
10743 int32Tag = '[object Int32Array]',
10744 uint8Tag = '[object Uint8Array]',
10745 uint8ClampedTag = '[object Uint8ClampedArray]',
10746 uint16Tag = '[object Uint16Array]',
10747 uint32Tag = '[object Uint32Array]';
10748
10749 /**
10750 * Initializes an object clone based on its `toStringTag`.
10751 *
10752 * **Note:** This function only supports cloning values with tags of
10753 * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
10754 *
10755 * @private
10756 * @param {Object} object The object to clone.
10757 * @param {string} tag The `toStringTag` of the object to clone.
10758 * @param {Function} cloneFunc The function to clone values.
10759 * @param {boolean} [isDeep] Specify a deep clone.
10760 * @returns {Object} Returns the initialized clone.
10761 */
10762 function initCloneByTag(object, tag, cloneFunc, isDeep) {
10763 var Ctor = object.constructor;
10764 switch (tag) {
10765 case arrayBufferTag:
10766 return cloneArrayBuffer(object);
10767
10768 case boolTag:
10769 case dateTag:
10770 return new Ctor(+object);
10771
10772 case dataViewTag:
10773 return cloneDataView(object, isDeep);
10774
10775 case float32Tag:case float64Tag:
10776 case int8Tag:case int16Tag:case int32Tag:
10777 case uint8Tag:case uint8ClampedTag:case uint16Tag:case uint32Tag:
10778 return cloneTypedArray(object, isDeep);
10779
10780 case mapTag:
10781 return cloneMap(object, isDeep, cloneFunc);
10782
10783 case numberTag:
10784 case stringTag:
10785 return new Ctor(object);
10786
10787 case regexpTag:
10788 return cloneRegExp(object);
10789
10790 case setTag:
10791 return cloneSet(object, isDeep, cloneFunc);
10792
10793 case symbolTag:
10794 return cloneSymbol(object);
10795 }
10796 }
10797
10798 module.exports = initCloneByTag;
10799
10800 /***/
10801 },
10802 /* 172 */
10803 /***/function (module, exports, __webpack_require__) {
10804
10805 var cloneArrayBuffer = __webpack_require__(41);
10806
10807 /**
10808 * Creates a clone of `dataView`.
10809 *
10810 * @private
10811 * @param {Object} dataView The data view to clone.
10812 * @param {boolean} [isDeep] Specify a deep clone.
10813 * @returns {Object} Returns the cloned data view.
10814 */
10815 function cloneDataView(dataView, isDeep) {
10816 var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
10817 return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
10818 }
10819
10820 module.exports = cloneDataView;
10821
10822 /***/
10823 },
10824 /* 173 */
10825 /***/function (module, exports, __webpack_require__) {
10826
10827 var addMapEntry = __webpack_require__(174),
10828 arrayReduce = __webpack_require__(75),
10829 mapToArray = __webpack_require__(42);
10830
10831 /** Used to compose bitmasks for cloning. */
10832 var CLONE_DEEP_FLAG = 1;
10833
10834 /**
10835 * Creates a clone of `map`.
10836 *
10837 * @private
10838 * @param {Object} map The map to clone.
10839 * @param {Function} cloneFunc The function to clone values.
10840 * @param {boolean} [isDeep] Specify a deep clone.
10841 * @returns {Object} Returns the cloned map.
10842 */
10843 function cloneMap(map, isDeep, cloneFunc) {
10844 var array = isDeep ? cloneFunc(mapToArray(map), CLONE_DEEP_FLAG) : mapToArray(map);
10845 return arrayReduce(array, addMapEntry, new map.constructor());
10846 }
10847
10848 module.exports = cloneMap;
10849
10850 /***/
10851 },
10852 /* 174 */
10853 /***/function (module, exports) {
10854
10855 /**
10856 * Adds the key-value `pair` to `map`.
10857 *
10858 * @private
10859 * @param {Object} map The map to modify.
10860 * @param {Array} pair The key-value pair to add.
10861 * @returns {Object} Returns `map`.
10862 */
10863 function addMapEntry(map, pair) {
10864 // Don't return `map.set` because it's not chainable in IE 11.
10865 map.set(pair[0], pair[1]);
10866 return map;
10867 }
10868
10869 module.exports = addMapEntry;
10870
10871 /***/
10872 },
10873 /* 175 */
10874 /***/function (module, exports) {
10875
10876 /** Used to match `RegExp` flags from their coerced string values. */
10877 var reFlags = /\w*$/;
10878
10879 /**
10880 * Creates a clone of `regexp`.
10881 *
10882 * @private
10883 * @param {Object} regexp The regexp to clone.
10884 * @returns {Object} Returns the cloned regexp.
10885 */
10886 function cloneRegExp(regexp) {
10887 var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
10888 result.lastIndex = regexp.lastIndex;
10889 return result;
10890 }
10891
10892 module.exports = cloneRegExp;
10893
10894 /***/
10895 },
10896 /* 176 */
10897 /***/function (module, exports, __webpack_require__) {
10898
10899 var addSetEntry = __webpack_require__(177),
10900 arrayReduce = __webpack_require__(75),
10901 setToArray = __webpack_require__(43);
10902
10903 /** Used to compose bitmasks for cloning. */
10904 var CLONE_DEEP_FLAG = 1;
10905
10906 /**
10907 * Creates a clone of `set`.
10908 *
10909 * @private
10910 * @param {Object} set The set to clone.
10911 * @param {Function} cloneFunc The function to clone values.
10912 * @param {boolean} [isDeep] Specify a deep clone.
10913 * @returns {Object} Returns the cloned set.
10914 */
10915 function cloneSet(set, isDeep, cloneFunc) {
10916 var array = isDeep ? cloneFunc(setToArray(set), CLONE_DEEP_FLAG) : setToArray(set);
10917 return arrayReduce(array, addSetEntry, new set.constructor());
10918 }
10919
10920 module.exports = cloneSet;
10921
10922 /***/
10923 },
10924 /* 177 */
10925 /***/function (module, exports) {
10926
10927 /**
10928 * Adds `value` to `set`.
10929 *
10930 * @private
10931 * @param {Object} set The set to modify.
10932 * @param {*} value The value to add.
10933 * @returns {Object} Returns `set`.
10934 */
10935 function addSetEntry(set, value) {
10936 // Don't return `set.add` because it's not chainable in IE 11.
10937 set.add(value);
10938 return set;
10939 }
10940
10941 module.exports = addSetEntry;
10942
10943 /***/
10944 },
10945 /* 178 */
10946 /***/function (module, exports, __webpack_require__) {
10947
10948 var _Symbol = __webpack_require__(11);
10949
10950 /** Used to convert symbols to primitives and strings. */
10951 var symbolProto = _Symbol ? _Symbol.prototype : undefined,
10952 symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
10953
10954 /**
10955 * Creates a clone of the `symbol` object.
10956 *
10957 * @private
10958 * @param {Object} symbol The symbol object to clone.
10959 * @returns {Object} Returns the cloned symbol object.
10960 */
10961 function cloneSymbol(symbol) {
10962 return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
10963 }
10964
10965 module.exports = cloneSymbol;
10966
10967 /***/
10968 },
10969 /* 179 */
10970 /***/function (module, exports, __webpack_require__) {
10971
10972 var isObject = __webpack_require__(8);
10973
10974 /** Built-in value references. */
10975 var objectCreate = Object.create;
10976
10977 /**
10978 * The base implementation of `_.create` without support for assigning
10979 * properties to the created object.
10980 *
10981 * @private
10982 * @param {Object} proto The object to inherit from.
10983 * @returns {Object} Returns the new object.
10984 */
10985 var baseCreate = function () {
10986 function object() {}
10987 return function (proto) {
10988 if (!isObject(proto)) {
10989 return {};
10990 }
10991 if (objectCreate) {
10992 return objectCreate(proto);
10993 }
10994 object.prototype = proto;
10995 var result = new object();
10996 object.prototype = undefined;
10997 return result;
10998 };
10999 }();
11000
11001 module.exports = baseCreate;
11002
11003 /***/
11004 },
11005 /* 180 */
11006 /***/function (module, exports, __webpack_require__) {
11007
11008 var assignValue = __webpack_require__(37),
11009 copyObject = __webpack_require__(12),
11010 createAssigner = __webpack_require__(78),
11011 isArrayLike = __webpack_require__(9),
11012 isPrototype = __webpack_require__(16),
11013 keys = __webpack_require__(13);
11014
11015 /** Used for built-in method references. */
11016 var objectProto = Object.prototype;
11017
11018 /** Used to check objects for own properties. */
11019 var hasOwnProperty = objectProto.hasOwnProperty;
11020
11021 /**
11022 * Assigns own enumerable string keyed properties of source objects to the
11023 * destination object. Source objects are applied from left to right.
11024 * Subsequent sources overwrite property assignments of previous sources.
11025 *
11026 * **Note:** This method mutates `object` and is loosely based on
11027 * [`Object.assign`](https://mdn.io/Object/assign).
11028 *
11029 * @static
11030 * @memberOf _
11031 * @since 0.10.0
11032 * @category Object
11033 * @param {Object} object The destination object.
11034 * @param {...Object} [sources] The source objects.
11035 * @returns {Object} Returns `object`.
11036 * @see _.assignIn
11037 * @example
11038 *
11039 * function Foo() {
11040 * this.a = 1;
11041 * }
11042 *
11043 * function Bar() {
11044 * this.c = 3;
11045 * }
11046 *
11047 * Foo.prototype.b = 2;
11048 * Bar.prototype.d = 4;
11049 *
11050 * _.assign({ 'a': 0 }, new Foo, new Bar);
11051 * // => { 'a': 1, 'c': 3 }
11052 */
11053 var assign = createAssigner(function (object, source) {
11054 if (isPrototype(source) || isArrayLike(source)) {
11055 copyObject(source, keys(source), object);
11056 return;
11057 }
11058 for (var key in source) {
11059 if (hasOwnProperty.call(source, key)) {
11060 assignValue(object, key, source[key]);
11061 }
11062 }
11063 });
11064
11065 module.exports = assign;
11066
11067 /***/
11068 },
11069 /* 181 */
11070 /***/function (module, exports, __webpack_require__) {
11071
11072 var apply = __webpack_require__(182);
11073
11074 /* Built-in method references for those with the same name as other `lodash` methods. */
11075 var nativeMax = Math.max;
11076
11077 /**
11078 * A specialized version of `baseRest` which transforms the rest array.
11079 *
11080 * @private
11081 * @param {Function} func The function to apply a rest parameter to.
11082 * @param {number} [start=func.length-1] The start position of the rest parameter.
11083 * @param {Function} transform The rest array transform.
11084 * @returns {Function} Returns the new function.
11085 */
11086 function overRest(func, start, transform) {
11087 start = nativeMax(start === undefined ? func.length - 1 : start, 0);
11088 return function () {
11089 var args = arguments,
11090 index = -1,
11091 length = nativeMax(args.length - start, 0),
11092 array = Array(length);
11093
11094 while (++index < length) {
11095 array[index] = args[start + index];
11096 }
11097 index = -1;
11098 var otherArgs = Array(start + 1);
11099 while (++index < start) {
11100 otherArgs[index] = args[index];
11101 }
11102 otherArgs[start] = transform(array);
11103 return apply(func, this, otherArgs);
11104 };
11105 }
11106
11107 module.exports = overRest;
11108
11109 /***/
11110 },
11111 /* 182 */
11112 /***/function (module, exports) {
11113
11114 /**
11115 * A faster alternative to `Function#apply`, this function invokes `func`
11116 * with the `this` binding of `thisArg` and the arguments of `args`.
11117 *
11118 * @private
11119 * @param {Function} func The function to invoke.
11120 * @param {*} thisArg The `this` binding of `func`.
11121 * @param {Array} args The arguments to invoke `func` with.
11122 * @returns {*} Returns the result of `func`.
11123 */
11124 function apply(func, thisArg, args) {
11125 switch (args.length) {
11126 case 0:
11127 return func.call(thisArg);
11128 case 1:
11129 return func.call(thisArg, args[0]);
11130 case 2:
11131 return func.call(thisArg, args[0], args[1]);
11132 case 3:
11133 return func.call(thisArg, args[0], args[1], args[2]);
11134 }
11135 return func.apply(thisArg, args);
11136 }
11137
11138 module.exports = apply;
11139
11140 /***/
11141 },
11142 /* 183 */
11143 /***/function (module, exports, __webpack_require__) {
11144
11145 var baseSetToString = __webpack_require__(184),
11146 shortOut = __webpack_require__(186);
11147
11148 /**
11149 * Sets the `toString` method of `func` to return `string`.
11150 *
11151 * @private
11152 * @param {Function} func The function to modify.
11153 * @param {Function} string The `toString` result.
11154 * @returns {Function} Returns `func`.
11155 */
11156 var setToString = shortOut(baseSetToString);
11157
11158 module.exports = setToString;
11159
11160 /***/
11161 },
11162 /* 184 */
11163 /***/function (module, exports, __webpack_require__) {
11164
11165 var constant = __webpack_require__(185),
11166 defineProperty = __webpack_require__(65),
11167 identity = __webpack_require__(44);
11168
11169 /**
11170 * The base implementation of `setToString` without support for hot loop shorting.
11171 *
11172 * @private
11173 * @param {Function} func The function to modify.
11174 * @param {Function} string The `toString` result.
11175 * @returns {Function} Returns `func`.
11176 */
11177 var baseSetToString = !defineProperty ? identity : function (func, string) {
11178 return defineProperty(func, 'toString', {
11179 'configurable': true,
11180 'enumerable': false,
11181 'value': constant(string),
11182 'writable': true
11183 });
11184 };
11185
11186 module.exports = baseSetToString;
11187
11188 /***/
11189 },
11190 /* 185 */
11191 /***/function (module, exports) {
11192
11193 /**
11194 * Creates a function that returns `value`.
11195 *
11196 * @static
11197 * @memberOf _
11198 * @since 2.4.0
11199 * @category Util
11200 * @param {*} value The value to return from the new function.
11201 * @returns {Function} Returns the new constant function.
11202 * @example
11203 *
11204 * var objects = _.times(2, _.constant({ 'a': 1 }));
11205 *
11206 * console.log(objects);
11207 * // => [{ 'a': 1 }, { 'a': 1 }]
11208 *
11209 * console.log(objects[0] === objects[1]);
11210 * // => true
11211 */
11212 function constant(value) {
11213 return function () {
11214 return value;
11215 };
11216 }
11217
11218 module.exports = constant;
11219
11220 /***/
11221 },
11222 /* 186 */
11223 /***/function (module, exports) {
11224
11225 /** Used to detect hot functions by number of calls within a span of milliseconds. */
11226 var HOT_COUNT = 800,
11227 HOT_SPAN = 16;
11228
11229 /* Built-in method references for those with the same name as other `lodash` methods. */
11230 var nativeNow = Date.now;
11231
11232 /**
11233 * Creates a function that'll short out and invoke `identity` instead
11234 * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
11235 * milliseconds.
11236 *
11237 * @private
11238 * @param {Function} func The function to restrict.
11239 * @returns {Function} Returns the new shortable function.
11240 */
11241 function shortOut(func) {
11242 var count = 0,
11243 lastCalled = 0;
11244
11245 return function () {
11246 var stamp = nativeNow(),
11247 remaining = HOT_SPAN - (stamp - lastCalled);
11248
11249 lastCalled = stamp;
11250 if (remaining > 0) {
11251 if (++count >= HOT_COUNT) {
11252 return arguments[0];
11253 }
11254 } else {
11255 count = 0;
11256 }
11257 return func.apply(undefined, arguments);
11258 };
11259 }
11260
11261 module.exports = shortOut;
11262
11263 /***/
11264 },
11265 /* 187 */
11266 /***/function (module, exports, __webpack_require__) {
11267
11268 var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) {
11269 return typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
11270 } : function (obj) {
11271 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
11272 };
11273
11274 var eq = __webpack_require__(18),
11275 isArrayLike = __webpack_require__(9),
11276 isIndex = __webpack_require__(67),
11277 isObject = __webpack_require__(8);
11278
11279 /**
11280 * Checks if the given arguments are from an iteratee call.
11281 *
11282 * @private
11283 * @param {*} value The potential iteratee value argument.
11284 * @param {*} index The potential iteratee index or key argument.
11285 * @param {*} object The potential iteratee object argument.
11286 * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
11287 * else `false`.
11288 */
11289 function isIterateeCall(value, index, object) {
11290 if (!isObject(object)) {
11291 return false;
11292 }
11293 var type = typeof index === 'undefined' ? 'undefined' : _typeof(index);
11294 if (type == 'number' ? isArrayLike(object) && isIndex(index, object.length) : type == 'string' && index in object) {
11295 return eq(object[index], value);
11296 }
11297 return false;
11298 }
11299
11300 module.exports = isIterateeCall;
11301
11302 /***/
11303 },
11304 /* 188 */
11305 /***/function (module, exports, __webpack_require__) {
11306
11307 var baseMerge = __webpack_require__(189),
11308 createAssigner = __webpack_require__(78);
11309
11310 /**
11311 * This method is like `_.assign` except that it recursively merges own and
11312 * inherited enumerable string keyed properties of source objects into the
11313 * destination object. Source properties that resolve to `undefined` are
11314 * skipped if a destination value exists. Array and plain object properties
11315 * are merged recursively. Other objects and value types are overridden by
11316 * assignment. Source objects are applied from left to right. Subsequent
11317 * sources overwrite property assignments of previous sources.
11318 *
11319 * **Note:** This method mutates `object`.
11320 *
11321 * @static
11322 * @memberOf _
11323 * @since 0.5.0
11324 * @category Object
11325 * @param {Object} object The destination object.
11326 * @param {...Object} [sources] The source objects.
11327 * @returns {Object} Returns `object`.
11328 * @example
11329 *
11330 * var object = {
11331 * 'a': [{ 'b': 2 }, { 'd': 4 }]
11332 * };
11333 *
11334 * var other = {
11335 * 'a': [{ 'c': 3 }, { 'e': 5 }]
11336 * };
11337 *
11338 * _.merge(object, other);
11339 * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
11340 */
11341 var merge = createAssigner(function (object, source, srcIndex) {
11342 baseMerge(object, source, srcIndex);
11343 });
11344
11345 module.exports = merge;
11346
11347 /***/
11348 },
11349 /* 189 */
11350 /***/function (module, exports, __webpack_require__) {
11351
11352 var Stack = __webpack_require__(36),
11353 assignMergeValue = __webpack_require__(80),
11354 baseFor = __webpack_require__(81),
11355 baseMergeDeep = __webpack_require__(191),
11356 isObject = __webpack_require__(8),
11357 keysIn = __webpack_require__(27);
11358
11359 /**
11360 * The base implementation of `_.merge` without support for multiple sources.
11361 *
11362 * @private
11363 * @param {Object} object The destination object.
11364 * @param {Object} source The source object.
11365 * @param {number} srcIndex The index of `source`.
11366 * @param {Function} [customizer] The function to customize merged values.
11367 * @param {Object} [stack] Tracks traversed source values and their merged
11368 * counterparts.
11369 */
11370 function baseMerge(object, source, srcIndex, customizer, stack) {
11371 if (object === source) {
11372 return;
11373 }
11374 baseFor(source, function (srcValue, key) {
11375 if (isObject(srcValue)) {
11376 stack || (stack = new Stack());
11377 baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
11378 } else {
11379 var newValue = customizer ? customizer(object[key], srcValue, key + '', object, source, stack) : undefined;
11380
11381 if (newValue === undefined) {
11382 newValue = srcValue;
11383 }
11384 assignMergeValue(object, key, newValue);
11385 }
11386 }, keysIn);
11387 }
11388
11389 module.exports = baseMerge;
11390
11391 /***/
11392 },
11393 /* 190 */
11394 /***/function (module, exports) {
11395
11396 /**
11397 * Creates a base function for methods like `_.forIn` and `_.forOwn`.
11398 *
11399 * @private
11400 * @param {boolean} [fromRight] Specify iterating from right to left.
11401 * @returns {Function} Returns the new base function.
11402 */
11403 function createBaseFor(fromRight) {
11404 return function (object, iteratee, keysFunc) {
11405 var index = -1,
11406 iterable = Object(object),
11407 props = keysFunc(object),
11408 length = props.length;
11409
11410 while (length--) {
11411 var key = props[fromRight ? length : ++index];
11412 if (iteratee(iterable[key], key, iterable) === false) {
11413 break;
11414 }
11415 }
11416 return object;
11417 };
11418 }
11419
11420 module.exports = createBaseFor;
11421
11422 /***/
11423 },
11424 /* 191 */
11425 /***/function (module, exports, __webpack_require__) {
11426
11427 var assignMergeValue = __webpack_require__(80),
11428 cloneBuffer = __webpack_require__(68),
11429 cloneTypedArray = __webpack_require__(76),
11430 copyArray = __webpack_require__(28),
11431 initCloneObject = __webpack_require__(77),
11432 isArguments = __webpack_require__(33),
11433 isArray = __webpack_require__(6),
11434 isArrayLikeObject = __webpack_require__(192),
11435 isBuffer = __webpack_require__(17),
11436 isFunction = __webpack_require__(20),
11437 isObject = __webpack_require__(8),
11438 isPlainObject = __webpack_require__(193),
11439 isTypedArray = __webpack_require__(22),
11440 toPlainObject = __webpack_require__(194);
11441
11442 /**
11443 * A specialized version of `baseMerge` for arrays and objects which performs
11444 * deep merges and tracks traversed objects enabling objects with circular
11445 * references to be merged.
11446 *
11447 * @private
11448 * @param {Object} object The destination object.
11449 * @param {Object} source The source object.
11450 * @param {string} key The key of the value to merge.
11451 * @param {number} srcIndex The index of `source`.
11452 * @param {Function} mergeFunc The function to merge values.
11453 * @param {Function} [customizer] The function to customize assigned values.
11454 * @param {Object} [stack] Tracks traversed source values and their merged
11455 * counterparts.
11456 */
11457 function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
11458 var objValue = object[key],
11459 srcValue = source[key],
11460 stacked = stack.get(srcValue);
11461
11462 if (stacked) {
11463 assignMergeValue(object, key, stacked);
11464 return;
11465 }
11466 var newValue = customizer ? customizer(objValue, srcValue, key + '', object, source, stack) : undefined;
11467
11468 var isCommon = newValue === undefined;
11469
11470 if (isCommon) {
11471 var isArr = isArray(srcValue),
11472 isBuff = !isArr && isBuffer(srcValue),
11473 isTyped = !isArr && !isBuff && isTypedArray(srcValue);
11474
11475 newValue = srcValue;
11476 if (isArr || isBuff || isTyped) {
11477 if (isArray(objValue)) {
11478 newValue = objValue;
11479 } else if (isArrayLikeObject(objValue)) {
11480 newValue = copyArray(objValue);
11481 } else if (isBuff) {
11482 isCommon = false;
11483 newValue = cloneBuffer(srcValue, true);
11484 } else if (isTyped) {
11485 isCommon = false;
11486 newValue = cloneTypedArray(srcValue, true);
11487 } else {
11488 newValue = [];
11489 }
11490 } else if (isPlainObject(srcValue) || isArguments(srcValue)) {
11491 newValue = objValue;
11492 if (isArguments(objValue)) {
11493 newValue = toPlainObject(objValue);
11494 } else if (!isObject(objValue) || srcIndex && isFunction(objValue)) {
11495 newValue = initCloneObject(srcValue);
11496 }
11497 } else {
11498 isCommon = false;
11499 }
11500 }
11501 if (isCommon) {
11502 // Recursively merge objects and arrays (susceptible to call stack limits).
11503 stack.set(srcValue, newValue);
11504 mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
11505 stack['delete'](srcValue);
11506 }
11507 assignMergeValue(object, key, newValue);
11508 }
11509
11510 module.exports = baseMergeDeep;
11511
11512 /***/
11513 },
11514 /* 192 */
11515 /***/function (module, exports, __webpack_require__) {
11516
11517 var isArrayLike = __webpack_require__(9),
11518 isObjectLike = __webpack_require__(5);
11519
11520 /**
11521 * This method is like `_.isArrayLike` except that it also checks if `value`
11522 * is an object.
11523 *
11524 * @static
11525 * @memberOf _
11526 * @since 4.0.0
11527 * @category Lang
11528 * @param {*} value The value to check.
11529 * @returns {boolean} Returns `true` if `value` is an array-like object,
11530 * else `false`.
11531 * @example
11532 *
11533 * _.isArrayLikeObject([1, 2, 3]);
11534 * // => true
11535 *
11536 * _.isArrayLikeObject(document.body.children);
11537 * // => true
11538 *
11539 * _.isArrayLikeObject('abc');
11540 * // => false
11541 *
11542 * _.isArrayLikeObject(_.noop);
11543 * // => false
11544 */
11545 function isArrayLikeObject(value) {
11546 return isObjectLike(value) && isArrayLike(value);
11547 }
11548
11549 module.exports = isArrayLikeObject;
11550
11551 /***/
11552 },
11553 /* 193 */
11554 /***/function (module, exports, __webpack_require__) {
11555
11556 var baseGetTag = __webpack_require__(7),
11557 getPrototype = __webpack_require__(40),
11558 isObjectLike = __webpack_require__(5);
11559
11560 /** `Object#toString` result references. */
11561 var objectTag = '[object Object]';
11562
11563 /** Used for built-in method references. */
11564 var funcProto = Function.prototype,
11565 objectProto = Object.prototype;
11566
11567 /** Used to resolve the decompiled source of functions. */
11568 var funcToString = funcProto.toString;
11569
11570 /** Used to check objects for own properties. */
11571 var hasOwnProperty = objectProto.hasOwnProperty;
11572
11573 /** Used to infer the `Object` constructor. */
11574 var objectCtorString = funcToString.call(Object);
11575
11576 /**
11577 * Checks if `value` is a plain object, that is, an object created by the
11578 * `Object` constructor or one with a `[[Prototype]]` of `null`.
11579 *
11580 * @static
11581 * @memberOf _
11582 * @since 0.8.0
11583 * @category Lang
11584 * @param {*} value The value to check.
11585 * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
11586 * @example
11587 *
11588 * function Foo() {
11589 * this.a = 1;
11590 * }
11591 *
11592 * _.isPlainObject(new Foo);
11593 * // => false
11594 *
11595 * _.isPlainObject([1, 2, 3]);
11596 * // => false
11597 *
11598 * _.isPlainObject({ 'x': 0, 'y': 0 });
11599 * // => true
11600 *
11601 * _.isPlainObject(Object.create(null));
11602 * // => true
11603 */
11604 function isPlainObject(value) {
11605 if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
11606 return false;
11607 }
11608 var proto = getPrototype(value);
11609 if (proto === null) {
11610 return true;
11611 }
11612 var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
11613 return typeof Ctor == 'function' && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
11614 }
11615
11616 module.exports = isPlainObject;
11617
11618 /***/
11619 },
11620 /* 194 */
11621 /***/function (module, exports, __webpack_require__) {
11622
11623 var copyObject = __webpack_require__(12),
11624 keysIn = __webpack_require__(27);
11625
11626 /**
11627 * Converts `value` to a plain object flattening inherited enumerable string
11628 * keyed properties of `value` to own properties of the plain object.
11629 *
11630 * @static
11631 * @memberOf _
11632 * @since 3.0.0
11633 * @category Lang
11634 * @param {*} value The value to convert.
11635 * @returns {Object} Returns the converted plain object.
11636 * @example
11637 *
11638 * function Foo() {
11639 * this.b = 2;
11640 * }
11641 *
11642 * Foo.prototype.c = 3;
11643 *
11644 * _.assign({ 'a': 1 }, new Foo);
11645 * // => { 'a': 1, 'b': 2 }
11646 *
11647 * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
11648 * // => { 'a': 1, 'b': 2, 'c': 3 }
11649 */
11650 function toPlainObject(value) {
11651 return copyObject(value, keysIn(value));
11652 }
11653
11654 module.exports = toPlainObject;
11655
11656 /***/
11657 },
11658 /* 195 */
11659 /***/function (module, exports, __webpack_require__) {
11660
11661 var createCaseFirst = __webpack_require__(196);
11662
11663 /**
11664 * Converts the first character of `string` to upper case.
11665 *
11666 * @static
11667 * @memberOf _
11668 * @since 4.0.0
11669 * @category String
11670 * @param {string} [string=''] The string to convert.
11671 * @returns {string} Returns the converted string.
11672 * @example
11673 *
11674 * _.upperFirst('fred');
11675 * // => 'Fred'
11676 *
11677 * _.upperFirst('FRED');
11678 * // => 'FRED'
11679 */
11680 var upperFirst = createCaseFirst('toUpperCase');
11681
11682 module.exports = upperFirst;
11683
11684 /***/
11685 },
11686 /* 196 */
11687 /***/function (module, exports, __webpack_require__) {
11688
11689 var castSlice = __webpack_require__(197),
11690 hasUnicode = __webpack_require__(82),
11691 stringToArray = __webpack_require__(83),
11692 toString = __webpack_require__(62);
11693
11694 /**
11695 * Creates a function like `_.lowerFirst`.
11696 *
11697 * @private
11698 * @param {string} methodName The name of the `String` case method to use.
11699 * @returns {Function} Returns the new case function.
11700 */
11701 function createCaseFirst(methodName) {
11702 return function (string) {
11703 string = toString(string);
11704
11705 var strSymbols = hasUnicode(string) ? stringToArray(string) : undefined;
11706
11707 var chr = strSymbols ? strSymbols[0] : string.charAt(0);
11708
11709 var trailing = strSymbols ? castSlice(strSymbols, 1).join('') : string.slice(1);
11710
11711 return chr[methodName]() + trailing;
11712 };
11713 }
11714
11715 module.exports = createCaseFirst;
11716
11717 /***/
11718 },
11719 /* 197 */
11720 /***/function (module, exports, __webpack_require__) {
11721
11722 var baseSlice = __webpack_require__(198);
11723
11724 /**
11725 * Casts `array` to a slice if it's needed.
11726 *
11727 * @private
11728 * @param {Array} array The array to inspect.
11729 * @param {number} start The start position.
11730 * @param {number} [end=array.length] The end position.
11731 * @returns {Array} Returns the cast slice.
11732 */
11733 function castSlice(array, start, end) {
11734 var length = array.length;
11735 end = end === undefined ? length : end;
11736 return !start && end >= length ? array : baseSlice(array, start, end);
11737 }
11738
11739 module.exports = castSlice;
11740
11741 /***/
11742 },
11743 /* 198 */
11744 /***/function (module, exports) {
11745
11746 /**
11747 * The base implementation of `_.slice` without an iteratee call guard.
11748 *
11749 * @private
11750 * @param {Array} array The array to slice.
11751 * @param {number} [start=0] The start position.
11752 * @param {number} [end=array.length] The end position.
11753 * @returns {Array} Returns the slice of `array`.
11754 */
11755 function baseSlice(array, start, end) {
11756 var index = -1,
11757 length = array.length;
11758
11759 if (start < 0) {
11760 start = -start > length ? 0 : length + start;
11761 }
11762 end = end > length ? length : end;
11763 if (end < 0) {
11764 end += length;
11765 }
11766 length = start > end ? 0 : end - start >>> 0;
11767 start >>>= 0;
11768
11769 var result = Array(length);
11770 while (++index < length) {
11771 result[index] = array[index + start];
11772 }
11773 return result;
11774 }
11775
11776 module.exports = baseSlice;
11777
11778 /***/
11779 },
11780 /* 199 */
11781 /***/function (module, exports) {
11782
11783 /**
11784 * Converts an ASCII `string` to an array.
11785 *
11786 * @private
11787 * @param {string} string The string to convert.
11788 * @returns {Array} Returns the converted array.
11789 */
11790 function asciiToArray(string) {
11791 return string.split('');
11792 }
11793
11794 module.exports = asciiToArray;
11795
11796 /***/
11797 },
11798 /* 200 */
11799 /***/function (module, exports) {
11800
11801 /** Used to compose unicode character classes. */
11802 var rsAstralRange = '\\ud800-\\udfff',
11803 rsComboMarksRange = '\\u0300-\\u036f',
11804 reComboHalfMarksRange = '\\ufe20-\\ufe2f',
11805 rsComboSymbolsRange = '\\u20d0-\\u20ff',
11806 rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
11807 rsVarRange = '\\ufe0e\\ufe0f';
11808
11809 /** Used to compose unicode capture groups. */
11810 var rsAstral = '[' + rsAstralRange + ']',
11811 rsCombo = '[' + rsComboRange + ']',
11812 rsFitz = '\\ud83c[\\udffb-\\udfff]',
11813 rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
11814 rsNonAstral = '[^' + rsAstralRange + ']',
11815 rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
11816 rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
11817 rsZWJ = '\\u200d';
11818
11819 /** Used to compose unicode regexes. */
11820 var reOptMod = rsModifier + '?',
11821 rsOptVar = '[' + rsVarRange + ']?',
11822 rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
11823 rsSeq = rsOptVar + reOptMod + rsOptJoin,
11824 rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
11825
11826 /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
11827 var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
11828
11829 /**
11830 * Converts a Unicode `string` to an array.
11831 *
11832 * @private
11833 * @param {string} string The string to convert.
11834 * @returns {Array} Returns the converted array.
11835 */
11836 function unicodeToArray(string) {
11837 return string.match(reUnicode) || [];
11838 }
11839
11840 module.exports = unicodeToArray;
11841
11842 /***/
11843 },
11844 /* 201 */
11845 /***/function (module, exports, __webpack_require__) {
11846
11847 var baseRest = __webpack_require__(79),
11848 pullAll = __webpack_require__(202);
11849
11850 /**
11851 * Removes all given values from `array` using
11852 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
11853 * for equality comparisons.
11854 *
11855 * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
11856 * to remove elements from an array by predicate.
11857 *
11858 * @static
11859 * @memberOf _
11860 * @since 2.0.0
11861 * @category Array
11862 * @param {Array} array The array to modify.
11863 * @param {...*} [values] The values to remove.
11864 * @returns {Array} Returns `array`.
11865 * @example
11866 *
11867 * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
11868 *
11869 * _.pull(array, 'a', 'c');
11870 * console.log(array);
11871 * // => ['b', 'b']
11872 */
11873 var pull = baseRest(pullAll);
11874
11875 module.exports = pull;
11876
11877 /***/
11878 },
11879 /* 202 */
11880 /***/function (module, exports, __webpack_require__) {
11881
11882 var basePullAll = __webpack_require__(203);
11883
11884 /**
11885 * This method is like `_.pull` except that it accepts an array of values to remove.
11886 *
11887 * **Note:** Unlike `_.difference`, this method mutates `array`.
11888 *
11889 * @static
11890 * @memberOf _
11891 * @since 4.0.0
11892 * @category Array
11893 * @param {Array} array The array to modify.
11894 * @param {Array} values The values to remove.
11895 * @returns {Array} Returns `array`.
11896 * @example
11897 *
11898 * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
11899 *
11900 * _.pullAll(array, ['a', 'c']);
11901 * console.log(array);
11902 * // => ['b', 'b']
11903 */
11904 function pullAll(array, values) {
11905 return array && array.length && values && values.length ? basePullAll(array, values) : array;
11906 }
11907
11908 module.exports = pullAll;
11909
11910 /***/
11911 },
11912 /* 203 */
11913 /***/function (module, exports, __webpack_require__) {
11914
11915 var arrayMap = __webpack_require__(35),
11916 baseIndexOf = __webpack_require__(204),
11917 baseIndexOfWith = __webpack_require__(208),
11918 baseUnary = __webpack_require__(61),
11919 copyArray = __webpack_require__(28);
11920
11921 /** Used for built-in method references. */
11922 var arrayProto = Array.prototype;
11923
11924 /** Built-in value references. */
11925 var splice = arrayProto.splice;
11926
11927 /**
11928 * The base implementation of `_.pullAllBy` without support for iteratee
11929 * shorthands.
11930 *
11931 * @private
11932 * @param {Array} array The array to modify.
11933 * @param {Array} values The values to remove.
11934 * @param {Function} [iteratee] The iteratee invoked per element.
11935 * @param {Function} [comparator] The comparator invoked per element.
11936 * @returns {Array} Returns `array`.
11937 */
11938 function basePullAll(array, values, iteratee, comparator) {
11939 var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
11940 index = -1,
11941 length = values.length,
11942 seen = array;
11943
11944 if (array === values) {
11945 values = copyArray(values);
11946 }
11947 if (iteratee) {
11948 seen = arrayMap(array, baseUnary(iteratee));
11949 }
11950 while (++index < length) {
11951 var fromIndex = 0,
11952 value = values[index],
11953 computed = iteratee ? iteratee(value) : value;
11954
11955 while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
11956 if (seen !== array) {
11957 splice.call(seen, fromIndex, 1);
11958 }
11959 splice.call(array, fromIndex, 1);
11960 }
11961 }
11962 return array;
11963 }
11964
11965 module.exports = basePullAll;
11966
11967 /***/
11968 },
11969 /* 204 */
11970 /***/function (module, exports, __webpack_require__) {
11971
11972 var baseFindIndex = __webpack_require__(205),
11973 baseIsNaN = __webpack_require__(206),
11974 strictIndexOf = __webpack_require__(207);
11975
11976 /**
11977 * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
11978 *
11979 * @private
11980 * @param {Array} array The array to inspect.
11981 * @param {*} value The value to search for.
11982 * @param {number} fromIndex The index to search from.
11983 * @returns {number} Returns the index of the matched value, else `-1`.
11984 */
11985 function baseIndexOf(array, value, fromIndex) {
11986 return value === value ? strictIndexOf(array, value, fromIndex) : baseFindIndex(array, baseIsNaN, fromIndex);
11987 }
11988
11989 module.exports = baseIndexOf;
11990
11991 /***/
11992 },
11993 /* 205 */
11994 /***/function (module, exports) {
11995
11996 /**
11997 * The base implementation of `_.findIndex` and `_.findLastIndex` without
11998 * support for iteratee shorthands.
11999 *
12000 * @private
12001 * @param {Array} array The array to inspect.
12002 * @param {Function} predicate The function invoked per iteration.
12003 * @param {number} fromIndex The index to search from.
12004 * @param {boolean} [fromRight] Specify iterating from right to left.
12005 * @returns {number} Returns the index of the matched value, else `-1`.
12006 */
12007 function baseFindIndex(array, predicate, fromIndex, fromRight) {
12008 var length = array.length,
12009 index = fromIndex + (fromRight ? 1 : -1);
12010
12011 while (fromRight ? index-- : ++index < length) {
12012 if (predicate(array[index], index, array)) {
12013 return index;
12014 }
12015 }
12016 return -1;
12017 }
12018
12019 module.exports = baseFindIndex;
12020
12021 /***/
12022 },
12023 /* 206 */
12024 /***/function (module, exports) {
12025
12026 /**
12027 * The base implementation of `_.isNaN` without support for number objects.
12028 *
12029 * @private
12030 * @param {*} value The value to check.
12031 * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
12032 */
12033 function baseIsNaN(value) {
12034 return value !== value;
12035 }
12036
12037 module.exports = baseIsNaN;
12038
12039 /***/
12040 },
12041 /* 207 */
12042 /***/function (module, exports) {
12043
12044 /**
12045 * A specialized version of `_.indexOf` which performs strict equality
12046 * comparisons of values, i.e. `===`.
12047 *
12048 * @private
12049 * @param {Array} array The array to inspect.
12050 * @param {*} value The value to search for.
12051 * @param {number} fromIndex The index to search from.
12052 * @returns {number} Returns the index of the matched value, else `-1`.
12053 */
12054 function strictIndexOf(array, value, fromIndex) {
12055 var index = fromIndex - 1,
12056 length = array.length;
12057
12058 while (++index < length) {
12059 if (array[index] === value) {
12060 return index;
12061 }
12062 }
12063 return -1;
12064 }
12065
12066 module.exports = strictIndexOf;
12067
12068 /***/
12069 },
12070 /* 208 */
12071 /***/function (module, exports) {
12072
12073 /**
12074 * This function is like `baseIndexOf` except that it accepts a comparator.
12075 *
12076 * @private
12077 * @param {Array} array The array to inspect.
12078 * @param {*} value The value to search for.
12079 * @param {number} fromIndex The index to search from.
12080 * @param {Function} comparator The comparator invoked per element.
12081 * @returns {number} Returns the index of the matched value, else `-1`.
12082 */
12083 function baseIndexOfWith(array, value, fromIndex, comparator) {
12084 var index = fromIndex - 1,
12085 length = array.length;
12086
12087 while (++index < length) {
12088 if (comparator(array[index], value)) {
12089 return index;
12090 }
12091 }
12092 return -1;
12093 }
12094
12095 module.exports = baseIndexOfWith;
12096
12097 /***/
12098 },
12099 /* 209 */
12100 /***/function (module, exports, __webpack_require__) {
12101
12102 var arrayEach = __webpack_require__(64),
12103 baseEach = __webpack_require__(210),
12104 castFunction = __webpack_require__(213),
12105 isArray = __webpack_require__(6);
12106
12107 /**
12108 * Iterates over elements of `collection` and invokes `iteratee` for each element.
12109 * The iteratee is invoked with three arguments: (value, index|key, collection).
12110 * Iteratee functions may exit iteration early by explicitly returning `false`.
12111 *
12112 * **Note:** As with other "Collections" methods, objects with a "length"
12113 * property are iterated like arrays. To avoid this behavior use `_.forIn`
12114 * or `_.forOwn` for object iteration.
12115 *
12116 * @static
12117 * @memberOf _
12118 * @since 0.1.0
12119 * @alias each
12120 * @category Collection
12121 * @param {Array|Object} collection The collection to iterate over.
12122 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
12123 * @returns {Array|Object} Returns `collection`.
12124 * @see _.forEachRight
12125 * @example
12126 *
12127 * _.forEach([1, 2], function(value) {
12128 * console.log(value);
12129 * });
12130 * // => Logs `1` then `2`.
12131 *
12132 * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
12133 * console.log(key);
12134 * });
12135 * // => Logs 'a' then 'b' (iteration order is not guaranteed).
12136 */
12137 function forEach(collection, iteratee) {
12138 var func = isArray(collection) ? arrayEach : baseEach;
12139 return func(collection, castFunction(iteratee));
12140 }
12141
12142 module.exports = forEach;
12143
12144 /***/
12145 },
12146 /* 210 */
12147 /***/function (module, exports, __webpack_require__) {
12148
12149 var baseForOwn = __webpack_require__(211),
12150 createBaseEach = __webpack_require__(212);
12151
12152 /**
12153 * The base implementation of `_.forEach` without support for iteratee shorthands.
12154 *
12155 * @private
12156 * @param {Array|Object} collection The collection to iterate over.
12157 * @param {Function} iteratee The function invoked per iteration.
12158 * @returns {Array|Object} Returns `collection`.
12159 */
12160 var baseEach = createBaseEach(baseForOwn);
12161
12162 module.exports = baseEach;
12163
12164 /***/
12165 },
12166 /* 211 */
12167 /***/function (module, exports, __webpack_require__) {
12168
12169 var baseFor = __webpack_require__(81),
12170 keys = __webpack_require__(13);
12171
12172 /**
12173 * The base implementation of `_.forOwn` without support for iteratee shorthands.
12174 *
12175 * @private
12176 * @param {Object} object The object to iterate over.
12177 * @param {Function} iteratee The function invoked per iteration.
12178 * @returns {Object} Returns `object`.
12179 */
12180 function baseForOwn(object, iteratee) {
12181 return object && baseFor(object, iteratee, keys);
12182 }
12183
12184 module.exports = baseForOwn;
12185
12186 /***/
12187 },
12188 /* 212 */
12189 /***/function (module, exports, __webpack_require__) {
12190
12191 var isArrayLike = __webpack_require__(9);
12192
12193 /**
12194 * Creates a `baseEach` or `baseEachRight` function.
12195 *
12196 * @private
12197 * @param {Function} eachFunc The function to iterate over a collection.
12198 * @param {boolean} [fromRight] Specify iterating from right to left.
12199 * @returns {Function} Returns the new base function.
12200 */
12201 function createBaseEach(eachFunc, fromRight) {
12202 return function (collection, iteratee) {
12203 if (collection == null) {
12204 return collection;
12205 }
12206 if (!isArrayLike(collection)) {
12207 return eachFunc(collection, iteratee);
12208 }
12209 var length = collection.length,
12210 index = fromRight ? length : -1,
12211 iterable = Object(collection);
12212
12213 while (fromRight ? index-- : ++index < length) {
12214 if (iteratee(iterable[index], index, iterable) === false) {
12215 break;
12216 }
12217 }
12218 return collection;
12219 };
12220 }
12221
12222 module.exports = createBaseEach;
12223
12224 /***/
12225 },
12226 /* 213 */
12227 /***/function (module, exports, __webpack_require__) {
12228
12229 var identity = __webpack_require__(44);
12230
12231 /**
12232 * Casts `value` to `identity` if it's not a function.
12233 *
12234 * @private
12235 * @param {*} value The value to inspect.
12236 * @returns {Function} Returns cast function.
12237 */
12238 function castFunction(value) {
12239 return typeof value == 'function' ? value : identity;
12240 }
12241
12242 module.exports = castFunction;
12243
12244 /***/
12245 },
12246 /* 214 */
12247 /***/function (module, exports, __webpack_require__) {
12248
12249 var baseIsEqual = __webpack_require__(215);
12250
12251 /**
12252 * Performs a deep comparison between two values to determine if they are
12253 * equivalent.
12254 *
12255 * **Note:** This method supports comparing arrays, array buffers, booleans,
12256 * date objects, error objects, maps, numbers, `Object` objects, regexes,
12257 * sets, strings, symbols, and typed arrays. `Object` objects are compared
12258 * by their own, not inherited, enumerable properties. Functions and DOM
12259 * nodes are compared by strict equality, i.e. `===`.
12260 *
12261 * @static
12262 * @memberOf _
12263 * @since 0.1.0
12264 * @category Lang
12265 * @param {*} value The value to compare.
12266 * @param {*} other The other value to compare.
12267 * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
12268 * @example
12269 *
12270 * var object = { 'a': 1 };
12271 * var other = { 'a': 1 };
12272 *
12273 * _.isEqual(object, other);
12274 * // => true
12275 *
12276 * object === other;
12277 * // => false
12278 */
12279 function isEqual(value, other) {
12280 return baseIsEqual(value, other);
12281 }
12282
12283 module.exports = isEqual;
12284
12285 /***/
12286 },
12287 /* 215 */
12288 /***/function (module, exports, __webpack_require__) {
12289
12290 var baseIsEqualDeep = __webpack_require__(216),
12291 isObjectLike = __webpack_require__(5);
12292
12293 /**
12294 * The base implementation of `_.isEqual` which supports partial comparisons
12295 * and tracks traversed objects.
12296 *
12297 * @private
12298 * @param {*} value The value to compare.
12299 * @param {*} other The other value to compare.
12300 * @param {boolean} bitmask The bitmask flags.
12301 * 1 - Unordered comparison
12302 * 2 - Partial comparison
12303 * @param {Function} [customizer] The function to customize comparisons.
12304 * @param {Object} [stack] Tracks traversed `value` and `other` objects.
12305 * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
12306 */
12307 function baseIsEqual(value, other, bitmask, customizer, stack) {
12308 if (value === other) {
12309 return true;
12310 }
12311 if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) {
12312 return value !== value && other !== other;
12313 }
12314 return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
12315 }
12316
12317 module.exports = baseIsEqual;
12318
12319 /***/
12320 },
12321 /* 216 */
12322 /***/function (module, exports, __webpack_require__) {
12323
12324 var Stack = __webpack_require__(36),
12325 equalArrays = __webpack_require__(84),
12326 equalByTag = __webpack_require__(222),
12327 equalObjects = __webpack_require__(223),
12328 getTag = __webpack_require__(21),
12329 isArray = __webpack_require__(6),
12330 isBuffer = __webpack_require__(17),
12331 isTypedArray = __webpack_require__(22);
12332
12333 /** Used to compose bitmasks for value comparisons. */
12334 var COMPARE_PARTIAL_FLAG = 1;
12335
12336 /** `Object#toString` result references. */
12337 var argsTag = '[object Arguments]',
12338 arrayTag = '[object Array]',
12339 objectTag = '[object Object]';
12340
12341 /** Used for built-in method references. */
12342 var objectProto = Object.prototype;
12343
12344 /** Used to check objects for own properties. */
12345 var hasOwnProperty = objectProto.hasOwnProperty;
12346
12347 /**
12348 * A specialized version of `baseIsEqual` for arrays and objects which performs
12349 * deep comparisons and tracks traversed objects enabling objects with circular
12350 * references to be compared.
12351 *
12352 * @private
12353 * @param {Object} object The object to compare.
12354 * @param {Object} other The other object to compare.
12355 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
12356 * @param {Function} customizer The function to customize comparisons.
12357 * @param {Function} equalFunc The function to determine equivalents of values.
12358 * @param {Object} [stack] Tracks traversed `object` and `other` objects.
12359 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
12360 */
12361 function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
12362 var objIsArr = isArray(object),
12363 othIsArr = isArray(other),
12364 objTag = objIsArr ? arrayTag : getTag(object),
12365 othTag = othIsArr ? arrayTag : getTag(other);
12366
12367 objTag = objTag == argsTag ? objectTag : objTag;
12368 othTag = othTag == argsTag ? objectTag : othTag;
12369
12370 var objIsObj = objTag == objectTag,
12371 othIsObj = othTag == objectTag,
12372 isSameTag = objTag == othTag;
12373
12374 if (isSameTag && isBuffer(object)) {
12375 if (!isBuffer(other)) {
12376 return false;
12377 }
12378 objIsArr = true;
12379 objIsObj = false;
12380 }
12381 if (isSameTag && !objIsObj) {
12382 stack || (stack = new Stack());
12383 return objIsArr || isTypedArray(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
12384 }
12385 if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
12386 var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
12387 othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
12388
12389 if (objIsWrapped || othIsWrapped) {
12390 var objUnwrapped = objIsWrapped ? object.value() : object,
12391 othUnwrapped = othIsWrapped ? other.value() : other;
12392
12393 stack || (stack = new Stack());
12394 return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
12395 }
12396 }
12397 if (!isSameTag) {
12398 return false;
12399 }
12400 stack || (stack = new Stack());
12401 return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
12402 }
12403
12404 module.exports = baseIsEqualDeep;
12405
12406 /***/
12407 },
12408 /* 217 */
12409 /***/function (module, exports, __webpack_require__) {
12410
12411 var MapCache = __webpack_require__(63),
12412 setCacheAdd = __webpack_require__(218),
12413 setCacheHas = __webpack_require__(219);
12414
12415 /**
12416 *
12417 * Creates an array cache object to store unique values.
12418 *
12419 * @private
12420 * @constructor
12421 * @param {Array} [values] The values to cache.
12422 */
12423 function SetCache(values) {
12424 var index = -1,
12425 length = values == null ? 0 : values.length;
12426
12427 this.__data__ = new MapCache();
12428 while (++index < length) {
12429 this.add(values[index]);
12430 }
12431 }
12432
12433 // Add methods to `SetCache`.
12434 SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
12435 SetCache.prototype.has = setCacheHas;
12436
12437 module.exports = SetCache;
12438
12439 /***/
12440 },
12441 /* 218 */
12442 /***/function (module, exports) {
12443
12444 /** Used to stand-in for `undefined` hash values. */
12445 var HASH_UNDEFINED = '__lodash_hash_undefined__';
12446
12447 /**
12448 * Adds `value` to the array cache.
12449 *
12450 * @private
12451 * @name add
12452 * @memberOf SetCache
12453 * @alias push
12454 * @param {*} value The value to cache.
12455 * @returns {Object} Returns the cache instance.
12456 */
12457 function setCacheAdd(value) {
12458 this.__data__.set(value, HASH_UNDEFINED);
12459 return this;
12460 }
12461
12462 module.exports = setCacheAdd;
12463
12464 /***/
12465 },
12466 /* 219 */
12467 /***/function (module, exports) {
12468
12469 /**
12470 * Checks if `value` is in the array cache.
12471 *
12472 * @private
12473 * @name has
12474 * @memberOf SetCache
12475 * @param {*} value The value to search for.
12476 * @returns {number} Returns `true` if `value` is found, else `false`.
12477 */
12478 function setCacheHas(value) {
12479 return this.__data__.has(value);
12480 }
12481
12482 module.exports = setCacheHas;
12483
12484 /***/
12485 },
12486 /* 220 */
12487 /***/function (module, exports) {
12488
12489 /**
12490 * A specialized version of `_.some` for arrays without support for iteratee
12491 * shorthands.
12492 *
12493 * @private
12494 * @param {Array} [array] The array to iterate over.
12495 * @param {Function} predicate The function invoked per iteration.
12496 * @returns {boolean} Returns `true` if any element passes the predicate check,
12497 * else `false`.
12498 */
12499 function arraySome(array, predicate) {
12500 var index = -1,
12501 length = array == null ? 0 : array.length;
12502
12503 while (++index < length) {
12504 if (predicate(array[index], index, array)) {
12505 return true;
12506 }
12507 }
12508 return false;
12509 }
12510
12511 module.exports = arraySome;
12512
12513 /***/
12514 },
12515 /* 221 */
12516 /***/function (module, exports) {
12517
12518 /**
12519 * Checks if a `cache` value for `key` exists.
12520 *
12521 * @private
12522 * @param {Object} cache The cache to query.
12523 * @param {string} key The key of the entry to check.
12524 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
12525 */
12526 function cacheHas(cache, key) {
12527 return cache.has(key);
12528 }
12529
12530 module.exports = cacheHas;
12531
12532 /***/
12533 },
12534 /* 222 */
12535 /***/function (module, exports, __webpack_require__) {
12536
12537 var _Symbol = __webpack_require__(11),
12538 Uint8Array = __webpack_require__(74),
12539 eq = __webpack_require__(18),
12540 equalArrays = __webpack_require__(84),
12541 mapToArray = __webpack_require__(42),
12542 setToArray = __webpack_require__(43);
12543
12544 /** Used to compose bitmasks for value comparisons. */
12545 var COMPARE_PARTIAL_FLAG = 1,
12546 COMPARE_UNORDERED_FLAG = 2;
12547
12548 /** `Object#toString` result references. */
12549 var boolTag = '[object Boolean]',
12550 dateTag = '[object Date]',
12551 errorTag = '[object Error]',
12552 mapTag = '[object Map]',
12553 numberTag = '[object Number]',
12554 regexpTag = '[object RegExp]',
12555 setTag = '[object Set]',
12556 stringTag = '[object String]',
12557 symbolTag = '[object Symbol]';
12558
12559 var arrayBufferTag = '[object ArrayBuffer]',
12560 dataViewTag = '[object DataView]';
12561
12562 /** Used to convert symbols to primitives and strings. */
12563 var symbolProto = _Symbol ? _Symbol.prototype : undefined,
12564 symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
12565
12566 /**
12567 * A specialized version of `baseIsEqualDeep` for comparing objects of
12568 * the same `toStringTag`.
12569 *
12570 * **Note:** This function only supports comparing values with tags of
12571 * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
12572 *
12573 * @private
12574 * @param {Object} object The object to compare.
12575 * @param {Object} other The other object to compare.
12576 * @param {string} tag The `toStringTag` of the objects to compare.
12577 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
12578 * @param {Function} customizer The function to customize comparisons.
12579 * @param {Function} equalFunc The function to determine equivalents of values.
12580 * @param {Object} stack Tracks traversed `object` and `other` objects.
12581 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
12582 */
12583 function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
12584 switch (tag) {
12585 case dataViewTag:
12586 if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
12587 return false;
12588 }
12589 object = object.buffer;
12590 other = other.buffer;
12591
12592 case arrayBufferTag:
12593 if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
12594 return false;
12595 }
12596 return true;
12597
12598 case boolTag:
12599 case dateTag:
12600 case numberTag:
12601 // Coerce booleans to `1` or `0` and dates to milliseconds.
12602 // Invalid dates are coerced to `NaN`.
12603 return eq(+object, +other);
12604
12605 case errorTag:
12606 return object.name == other.name && object.message == other.message;
12607
12608 case regexpTag:
12609 case stringTag:
12610 // Coerce regexes to strings and treat strings, primitives and objects,
12611 // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
12612 // for more details.
12613 return object == other + '';
12614
12615 case mapTag:
12616 var convert = mapToArray;
12617
12618 case setTag:
12619 var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
12620 convert || (convert = setToArray);
12621
12622 if (object.size != other.size && !isPartial) {
12623 return false;
12624 }
12625 // Assume cyclic values are equal.
12626 var stacked = stack.get(object);
12627 if (stacked) {
12628 return stacked == other;
12629 }
12630 bitmask |= COMPARE_UNORDERED_FLAG;
12631
12632 // Recursively compare objects (susceptible to call stack limits).
12633 stack.set(object, other);
12634 var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
12635 stack['delete'](object);
12636 return result;
12637
12638 case symbolTag:
12639 if (symbolValueOf) {
12640 return symbolValueOf.call(object) == symbolValueOf.call(other);
12641 }
12642 }
12643 return false;
12644 }
12645
12646 module.exports = equalByTag;
12647
12648 /***/
12649 },
12650 /* 223 */
12651 /***/function (module, exports, __webpack_require__) {
12652
12653 var getAllKeys = __webpack_require__(72);
12654
12655 /** Used to compose bitmasks for value comparisons. */
12656 var COMPARE_PARTIAL_FLAG = 1;
12657
12658 /** Used for built-in method references. */
12659 var objectProto = Object.prototype;
12660
12661 /** Used to check objects for own properties. */
12662 var hasOwnProperty = objectProto.hasOwnProperty;
12663
12664 /**
12665 * A specialized version of `baseIsEqualDeep` for objects with support for
12666 * partial deep comparisons.
12667 *
12668 * @private
12669 * @param {Object} object The object to compare.
12670 * @param {Object} other The other object to compare.
12671 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
12672 * @param {Function} customizer The function to customize comparisons.
12673 * @param {Function} equalFunc The function to determine equivalents of values.
12674 * @param {Object} stack Tracks traversed `object` and `other` objects.
12675 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
12676 */
12677 function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
12678 var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
12679 objProps = getAllKeys(object),
12680 objLength = objProps.length,
12681 othProps = getAllKeys(other),
12682 othLength = othProps.length;
12683
12684 if (objLength != othLength && !isPartial) {
12685 return false;
12686 }
12687 var index = objLength;
12688 while (index--) {
12689 var key = objProps[index];
12690 if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
12691 return false;
12692 }
12693 }
12694 // Assume cyclic values are equal.
12695 var stacked = stack.get(object);
12696 if (stacked && stack.get(other)) {
12697 return stacked == other;
12698 }
12699 var result = true;
12700 stack.set(object, other);
12701 stack.set(other, object);
12702
12703 var skipCtor = isPartial;
12704 while (++index < objLength) {
12705 key = objProps[index];
12706 var objValue = object[key],
12707 othValue = other[key];
12708
12709 if (customizer) {
12710 var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
12711 }
12712 // Recursively compare objects (susceptible to call stack limits).
12713 if (!(compared === undefined ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
12714 result = false;
12715 break;
12716 }
12717 skipCtor || (skipCtor = key == 'constructor');
12718 }
12719 if (result && !skipCtor) {
12720 var objCtor = object.constructor,
12721 othCtor = other.constructor;
12722
12723 // Non `Object` object instances with different constructors are not equal.
12724 if (objCtor != othCtor && 'constructor' in object && 'constructor' in other && !(typeof objCtor == 'function' && objCtor instanceof objCtor && typeof othCtor == 'function' && othCtor instanceof othCtor)) {
12725 result = false;
12726 }
12727 }
12728 stack['delete'](object);
12729 stack['delete'](other);
12730 return result;
12731 }
12732
12733 module.exports = equalObjects;
12734
12735 /***/
12736 },
12737 /* 224 */
12738 /***/function (module, exports, __webpack_require__) {
12739
12740 var _Symbol = __webpack_require__(11),
12741 copyArray = __webpack_require__(28),
12742 getTag = __webpack_require__(21),
12743 isArrayLike = __webpack_require__(9),
12744 isString = __webpack_require__(56),
12745 iteratorToArray = __webpack_require__(225),
12746 mapToArray = __webpack_require__(42),
12747 setToArray = __webpack_require__(43),
12748 stringToArray = __webpack_require__(83),
12749 values = __webpack_require__(226);
12750
12751 /** `Object#toString` result references. */
12752 var mapTag = '[object Map]',
12753 setTag = '[object Set]';
12754
12755 /** Built-in value references. */
12756 var symIterator = _Symbol ? _Symbol.iterator : undefined;
12757
12758 /**
12759 * Converts `value` to an array.
12760 *
12761 * @static
12762 * @since 0.1.0
12763 * @memberOf _
12764 * @category Lang
12765 * @param {*} value The value to convert.
12766 * @returns {Array} Returns the converted array.
12767 * @example
12768 *
12769 * _.toArray({ 'a': 1, 'b': 2 });
12770 * // => [1, 2]
12771 *
12772 * _.toArray('abc');
12773 * // => ['a', 'b', 'c']
12774 *
12775 * _.toArray(1);
12776 * // => []
12777 *
12778 * _.toArray(null);
12779 * // => []
12780 */
12781 function toArray(value) {
12782 if (!value) {
12783 return [];
12784 }
12785 if (isArrayLike(value)) {
12786 return isString(value) ? stringToArray(value) : copyArray(value);
12787 }
12788 if (symIterator && value[symIterator]) {
12789 return iteratorToArray(value[symIterator]());
12790 }
12791 var tag = getTag(value),
12792 func = tag == mapTag ? mapToArray : tag == setTag ? setToArray : values;
12793
12794 return func(value);
12795 }
12796
12797 module.exports = toArray;
12798
12799 /***/
12800 },
12801 /* 225 */
12802 /***/function (module, exports) {
12803
12804 /**
12805 * Converts `iterator` to an array.
12806 *
12807 * @private
12808 * @param {Object} iterator The iterator to convert.
12809 * @returns {Array} Returns the converted array.
12810 */
12811 function iteratorToArray(iterator) {
12812 var data,
12813 result = [];
12814
12815 while (!(data = iterator.next()).done) {
12816 result.push(data.value);
12817 }
12818 return result;
12819 }
12820
12821 module.exports = iteratorToArray;
12822
12823 /***/
12824 },
12825 /* 226 */
12826 /***/function (module, exports, __webpack_require__) {
12827
12828 var baseValues = __webpack_require__(227),
12829 keys = __webpack_require__(13);
12830
12831 /**
12832 * Creates an array of the own enumerable string keyed property values of `object`.
12833 *
12834 * **Note:** Non-object values are coerced to objects.
12835 *
12836 * @static
12837 * @since 0.1.0
12838 * @memberOf _
12839 * @category Object
12840 * @param {Object} object The object to query.
12841 * @returns {Array} Returns the array of property values.
12842 * @example
12843 *
12844 * function Foo() {
12845 * this.a = 1;
12846 * this.b = 2;
12847 * }
12848 *
12849 * Foo.prototype.c = 3;
12850 *
12851 * _.values(new Foo);
12852 * // => [1, 2] (iteration order is not guaranteed)
12853 *
12854 * _.values('hi');
12855 * // => ['h', 'i']
12856 */
12857 function values(object) {
12858 return object == null ? [] : baseValues(object, keys(object));
12859 }
12860
12861 module.exports = values;
12862
12863 /***/
12864 },
12865 /* 227 */
12866 /***/function (module, exports, __webpack_require__) {
12867
12868 var arrayMap = __webpack_require__(35);
12869
12870 /**
12871 * The base implementation of `_.values` and `_.valuesIn` which creates an
12872 * array of `object` property values corresponding to the property names
12873 * of `props`.
12874 *
12875 * @private
12876 * @param {Object} object The object to query.
12877 * @param {Array} props The property names to get values for.
12878 * @returns {Object} Returns the array of property values.
12879 */
12880 function baseValues(object, props) {
12881 return arrayMap(props, function (key) {
12882 return object[key];
12883 });
12884 }
12885
12886 module.exports = baseValues;
12887
12888 /***/
12889 },
12890 /* 228 */
12891 /***/function (module, exports, __webpack_require__) {
12892
12893 var Util = __webpack_require__(0);
12894
12895 var ALIAS_ATTRS = ['strokeStyle', 'fillStyle', 'globalAlpha'];
12896 var CLIP_SHAPES = ['circle', 'ellipse', 'fan', 'polygon', 'rect', 'path'];
12897 var CAPITALIZED_ATTRS_MAP = {
12898 r: 'R',
12899 opacity: 'Opacity',
12900 lineWidth: 'LineWidth',
12901 clip: 'Clip',
12902 stroke: 'Stroke',
12903 fill: 'Fill',
12904 strokeOpacity: 'Stroke',
12905 fillOpacity: 'Fill',
12906 x: 'X',
12907 y: 'Y',
12908 rx: 'Rx',
12909 ry: 'Ry',
12910 re: 'Re',
12911 rs: 'Rs',
12912 width: 'Width',
12913 height: 'Height',
12914 img: 'Img',
12915 x1: 'X1',
12916 x2: 'X2',
12917 y1: 'Y1',
12918 y2: 'Y2',
12919 points: 'Points',
12920 p1: 'P1',
12921 p2: 'P2',
12922 p3: 'P3',
12923 p4: 'P4',
12924 text: 'Text',
12925 radius: 'Radius',
12926 textAlign: 'TextAlign',
12927 textBaseline: 'TextBaseline',
12928 font: 'Font',
12929 fontSize: 'FontSize',
12930 fontStyle: 'FontStyle',
12931 fontVariant: 'FontVariant',
12932 fontWeight: 'FontWeight',
12933 fontFamily: 'FontFamily',
12934 clockwise: 'Clockwise',
12935 startAngle: 'StartAngle',
12936 endAngle: 'EndAngle',
12937 path: 'Path'
12938 };
12939 var ALIAS_ATTRS_MAP = {
12940 stroke: 'strokeStyle',
12941 fill: 'fillStyle',
12942 opacity: 'globalAlpha'
12943 };
12944
12945 module.exports = {
12946 canFill: false,
12947 canStroke: false,
12948 initAttrs: function initAttrs(attrs) {
12949 this.__attrs = {
12950 opacity: 1,
12951 fillOpacity: 1,
12952 strokeOpacity: 1
12953 };
12954 this.attr(Util.assign(this.getDefaultAttrs(), attrs));
12955 return this;
12956 },
12957 getDefaultAttrs: function getDefaultAttrs() {
12958 return {};
12959 },
12960
12961 /**
12962 * 设置或者设置属性,有以下 4 种情形:
12963 * - name 不存在, 则返回属性集合
12964 * - name 为字符串,value 为空,获取属性值
12965 * - name 为字符串,value 不为空,设置属性值,返回 this
12966 * - name 为键值对,value 为空,设置属性值
12967 *
12968 * @param {String | Object} name 属性名
12969 * @param {*} value 属性值
12970 * @return {*} 属性值
12971 */
12972 attr: function attr(name, value) {
12973 var self = this;
12974 if (arguments.length === 0) {
12975 return self.__attrs;
12976 }
12977
12978 if (Util.isObject(name)) {
12979 for (var k in name) {
12980 if (ALIAS_ATTRS.indexOf(k) === -1) {
12981 var v = name[k];
12982 self._setAttr(k, v);
12983 }
12984 }
12985 if (self.__afterSetAttrAll) {
12986 self.__afterSetAttrAll(name);
12987 }
12988 // self.setSilent('box', null);
12989 self.clearBBox();
12990 return self;
12991 }
12992 if (arguments.length === 2) {
12993 if (self._setAttr(name, value) !== false) {
12994 var m = '__afterSetAttr' + CAPITALIZED_ATTRS_MAP[name];
12995 if (self[m]) {
12996 self[m](value);
12997 }
12998 }
12999 // self.setSilent('box', null);
13000 self.clearBBox();
13001 return self;
13002 }
13003 return self._getAttr(name);
13004 },
13005 clearBBox: function clearBBox() {
13006 this.setSilent('box', null);
13007 },
13008 __afterSetAttrAll: function __afterSetAttrAll() {},
13009
13010 // 属性获取触发函数
13011 _getAttr: function _getAttr(name) {
13012 return this.__attrs[name];
13013 },
13014
13015 // 属性设置触发函数
13016 _setAttr: function _setAttr(name, value) {
13017 var self = this;
13018 if (name === 'clip') {
13019 self.__setAttrClip(value);
13020 self.__attrs.clip = value;
13021 } else if (name === 'transform') {
13022 self.__setAttrTrans(value);
13023 } else {
13024 self.__attrs[name] = value;
13025 var alias = ALIAS_ATTRS_MAP[name];
13026 if (alias) {
13027 self.__attrs[alias] = value;
13028 }
13029 }
13030 return self;
13031 },
13032 hasFill: function hasFill() {
13033 return this.canFill && this.__attrs.fillStyle;
13034 },
13035 hasStroke: function hasStroke() {
13036 return this.canStroke && this.__attrs.strokeStyle;
13037 },
13038
13039 // 设置透明度
13040 __setAttrOpacity: function __setAttrOpacity(v) {
13041 this.__attrs.globalAlpha = v;
13042 return v;
13043 },
13044 __setAttrClip: function __setAttrClip(clip) {
13045 var self = this;
13046 if (clip && CLIP_SHAPES.indexOf(clip.type) > -1) {
13047 if (clip.get('canvas') === null) {
13048 clip = Util.clone(clip);
13049 }
13050 clip.set('parent', self.get('parent'));
13051 clip.set('context', self.get('context'));
13052 clip.inside = function (x, y) {
13053 var v = [x, y, 1];
13054 clip.invert(v, self.get('canvas')); // 已经在外面转换
13055 return clip.__isPointInFill(v[0], v[1]);
13056 };
13057 return clip;
13058 }
13059 return null;
13060 },
13061 __setAttrTrans: function __setAttrTrans(value) {
13062 return this.transform(value);
13063 }
13064 };
13065
13066 /***/
13067 },
13068 /* 229 */
13069 /***/function (module, exports, __webpack_require__) {
13070
13071 var Util = __webpack_require__(0);
13072 var mat3 = __webpack_require__(3).mat3;
13073 var vec3 = __webpack_require__(3).vec3;
13074
13075 // 是否未改变
13076 function isUnchanged(m) {
13077 return m[0] === 1 && m[1] === 0 && m[3] === 0 && m[4] === 1 && m[6] === 0 && m[7] === 0;
13078 }
13079
13080 // 是否仅仅是scale
13081 function isScale(m) {
13082 return m[1] === 0 && m[3] === 0 && m[6] === 0 && m[7] === 0;
13083 }
13084
13085 function multiple(m1, m2) {
13086 if (!isUnchanged(m2)) {
13087 if (isScale(m2)) {
13088 m1[0] *= m2[0];
13089 m1[4] *= m2[4];
13090 } else {
13091 mat3.multiply(m1, m1, m2);
13092 }
13093 }
13094 }
13095
13096 module.exports = {
13097 initTransform: function initTransform() {
13098 this.attr('matrix', [1, 0, 0, 0, 1, 0, 0, 0, 1]);
13099 },
13100 translate: function translate(tx, ty) {
13101 var matrix = this.attr('matrix');
13102 mat3.translate(matrix, matrix, [tx, ty]);
13103 this.clearTotalMatrix();
13104 this.attr('matrix', matrix);
13105 return this;
13106 },
13107 rotate: function rotate(radian) {
13108 var matrix = this.attr('matrix');
13109 mat3.rotate(matrix, matrix, radian);
13110 this.clearTotalMatrix();
13111 this.attr('matrix', matrix);
13112 return this;
13113 },
13114 scale: function scale(s1, s2) {
13115 var matrix = this.attr('matrix');
13116 mat3.scale(matrix, matrix, [s1, s2]);
13117 this.clearTotalMatrix();
13118 this.attr('matrix', matrix);
13119 return this;
13120 },
13121
13122 /**
13123 * 绕起始点旋转
13124 * @param {Number} rotate 0~360
13125 */
13126 rotateAtStart: function rotateAtStart(rotate) {
13127 var x = this.attr('x');
13128 var y = this.attr('y');
13129 if (Math.abs(rotate) > Math.PI * 2) {
13130 rotate = rotate / 180 * Math.PI;
13131 }
13132 this.transform([['t', -x, -y], ['r', rotate], ['t', x, y]]);
13133 },
13134
13135 /**
13136 * 移动的到位置
13137 * @param {Number} x 移动到x
13138 * @param {Number} y 移动到y
13139 */
13140 move: function move(x, y) {
13141 var cx = this.get('x') || 0; // 当前的x
13142 var cy = this.get('y') || 0; // 当前的y
13143 this.translate(x - cx, y - cy);
13144 this.set('x', x);
13145 this.set('y', y);
13146 },
13147 transform: function transform(ts) {
13148 var self = this;
13149 var matrix = self.attr('matrix');
13150
13151 Util.each(ts, function (t) {
13152 switch (t[0]) {
13153 case 't':
13154 self.translate(t[1], t[2]);
13155 break;
13156 case 's':
13157 self.scale(t[1], t[2]);
13158 break;
13159 case 'r':
13160 self.rotate(t[1]);
13161 break;
13162 case 'm':
13163 self.attr('matrix', mat3.multiply([], matrix, t[1]));
13164 self.clearTotalMatrix();
13165 break;
13166 default:
13167 break;
13168 }
13169 });
13170 return self;
13171 },
13172 setTransform: function setTransform(ts) {
13173 this.attr('matrix', [1, 0, 0, 0, 1, 0, 0, 0, 1]);
13174 return this.transform(ts);
13175 },
13176 getMatrix: function getMatrix() {
13177 return this.attr('matrix');
13178 },
13179 setMatrix: function setMatrix(m) {
13180 this.attr('matrix', m);
13181 this.clearTotalMatrix();
13182 return this;
13183 },
13184 apply: function apply(v, root) {
13185 var m = void 0;
13186 if (root) {
13187 m = this._getMatrixByRoot(root);
13188 } else {
13189 m = this.attr('matrix');
13190 }
13191 vec3.transformMat3(v, v, m);
13192 return this;
13193 },
13194
13195 // 获取到达指定根节点的矩阵
13196 _getMatrixByRoot: function _getMatrixByRoot(root) {
13197 var self = this;
13198 root = root || self;
13199 var parent = self;
13200 var parents = [];
13201
13202 while (parent !== root) {
13203 parents.unshift(parent);
13204 parent = parent.get('parent');
13205 }
13206 parents.unshift(parent);
13207
13208 var m = [1, 0, 0, 0, 1, 0, 0, 0, 1];
13209 Util.each(parents, function (child) {
13210 mat3.multiply(m, child.attr('matrix'), m);
13211 });
13212 return m;
13213 },
13214
13215 /**
13216 * 应用到当前元素上的总的矩阵
13217 * @return {Matrix} 矩阵
13218 */
13219 getTotalMatrix: function getTotalMatrix() {
13220 var m = this.__cfg.totalMatrix;
13221 if (!m) {
13222 m = [1, 0, 0, 0, 1, 0, 0, 0, 1];
13223 var parent = this.__cfg.parent;
13224 if (parent) {
13225 var pm = parent.getTotalMatrix();
13226 multiple(m, pm);
13227 }
13228
13229 multiple(m, this.attr('matrix'));
13230 this.__cfg.totalMatrix = m;
13231 }
13232 return m;
13233 },
13234
13235 // 清除当前的矩阵
13236 clearTotalMatrix: function clearTotalMatrix() {
13237 // this.__cfg.totalMatrix = null;
13238 },
13239 invert: function invert(v) {
13240 var m = this.getTotalMatrix();
13241 // 单精屏幕下大多数矩阵没变化
13242 if (isScale(m)) {
13243 v[0] /= m[0];
13244 v[1] /= m[4];
13245 } else {
13246 var inm = mat3.invert([], m);
13247 vec3.transformMat3(v, v, inm);
13248 }
13249 return this;
13250 },
13251 resetTransform: function resetTransform(context) {
13252 var mo = this.attr('matrix');
13253 // 不改变时
13254 if (!isUnchanged(mo)) {
13255 context.transform(mo[0], mo[1], mo[3], mo[4], mo[6], mo[7]);
13256 }
13257 }
13258 };
13259
13260 /***/
13261 },
13262 /* 230 */
13263 /***/function (module, __webpack_exports__, __webpack_require__) {
13264
13265 "use strict";
13266
13267 Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
13268 /* harmony export (immutable) */__webpack_exports__["create"] = create;
13269 /* harmony export (immutable) */__webpack_exports__["fromMat4"] = fromMat4;
13270 /* harmony export (immutable) */__webpack_exports__["clone"] = clone;
13271 /* harmony export (immutable) */__webpack_exports__["copy"] = copy;
13272 /* harmony export (immutable) */__webpack_exports__["fromValues"] = fromValues;
13273 /* harmony export (immutable) */__webpack_exports__["set"] = set;
13274 /* harmony export (immutable) */__webpack_exports__["identity"] = identity;
13275 /* harmony export (immutable) */__webpack_exports__["transpose"] = transpose;
13276 /* harmony export (immutable) */__webpack_exports__["invert"] = invert;
13277 /* harmony export (immutable) */__webpack_exports__["adjoint"] = adjoint;
13278 /* harmony export (immutable) */__webpack_exports__["determinant"] = determinant;
13279 /* harmony export (immutable) */__webpack_exports__["multiply"] = multiply;
13280 /* harmony export (immutable) */__webpack_exports__["translate"] = translate;
13281 /* harmony export (immutable) */__webpack_exports__["rotate"] = rotate;
13282 /* harmony export (immutable) */__webpack_exports__["scale"] = scale;
13283 /* harmony export (immutable) */__webpack_exports__["fromTranslation"] = fromTranslation;
13284 /* harmony export (immutable) */__webpack_exports__["fromRotation"] = fromRotation;
13285 /* harmony export (immutable) */__webpack_exports__["fromScaling"] = fromScaling;
13286 /* harmony export (immutable) */__webpack_exports__["fromMat2d"] = fromMat2d;
13287 /* harmony export (immutable) */__webpack_exports__["fromQuat"] = fromQuat;
13288 /* harmony export (immutable) */__webpack_exports__["normalFromMat4"] = normalFromMat4;
13289 /* harmony export (immutable) */__webpack_exports__["projection"] = projection;
13290 /* harmony export (immutable) */__webpack_exports__["str"] = str;
13291 /* harmony export (immutable) */__webpack_exports__["frob"] = frob;
13292 /* harmony export (immutable) */__webpack_exports__["add"] = add;
13293 /* harmony export (immutable) */__webpack_exports__["subtract"] = subtract;
13294 /* harmony export (immutable) */__webpack_exports__["multiplyScalar"] = multiplyScalar;
13295 /* harmony export (immutable) */__webpack_exports__["multiplyScalarAndAdd"] = multiplyScalarAndAdd;
13296 /* harmony export (immutable) */__webpack_exports__["exactEquals"] = exactEquals;
13297 /* harmony export (immutable) */__webpack_exports__["equals"] = equals;
13298 /* harmony export (binding) */__webpack_require__.d(__webpack_exports__, "mul", function () {
13299 return mul;
13300 });
13301 /* harmony export (binding) */__webpack_require__.d(__webpack_exports__, "sub", function () {
13302 return sub;
13303 });
13304 /* harmony import */var __WEBPACK_IMPORTED_MODULE_0__common__ = __webpack_require__(45);
13305 /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.
13306
13307 Permission is hereby granted, free of charge, to any person obtaining a copy
13308 of this software and associated documentation files (the "Software"), to deal
13309 in the Software without restriction, including without limitation the rights
13310 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13311 copies of the Software, and to permit persons to whom the Software is
13312 furnished to do so, subject to the following conditions:
13313
13314 The above copyright notice and this permission notice shall be included in
13315 all copies or substantial portions of the Software.
13316
13317 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13318 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13319 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
13320 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
13321 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
13322 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
13323 THE SOFTWARE. */
13324
13325 /**
13326 * 3x3 Matrix
13327 * @module mat3
13328 */
13329
13330 /**
13331 * Creates a new identity mat3
13332 *
13333 * @returns {mat3} a new 3x3 matrix
13334 */
13335 function create() {
13336 var out = new __WEBPACK_IMPORTED_MODULE_0__common__["a" /* ARRAY_TYPE */](9);
13337 out[0] = 1;
13338 out[1] = 0;
13339 out[2] = 0;
13340 out[3] = 0;
13341 out[4] = 1;
13342 out[5] = 0;
13343 out[6] = 0;
13344 out[7] = 0;
13345 out[8] = 1;
13346 return out;
13347 }
13348
13349 /**
13350 * Copies the upper-left 3x3 values into the given mat3.
13351 *
13352 * @param {mat3} out the receiving 3x3 matrix
13353 * @param {mat4} a the source 4x4 matrix
13354 * @returns {mat3} out
13355 */
13356 function fromMat4(out, a) {
13357 out[0] = a[0];
13358 out[1] = a[1];
13359 out[2] = a[2];
13360 out[3] = a[4];
13361 out[4] = a[5];
13362 out[5] = a[6];
13363 out[6] = a[8];
13364 out[7] = a[9];
13365 out[8] = a[10];
13366 return out;
13367 }
13368
13369 /**
13370 * Creates a new mat3 initialized with values from an existing matrix
13371 *
13372 * @param {mat3} a matrix to clone
13373 * @returns {mat3} a new 3x3 matrix
13374 */
13375 function clone(a) {
13376 var out = new __WEBPACK_IMPORTED_MODULE_0__common__["a" /* ARRAY_TYPE */](9);
13377 out[0] = a[0];
13378 out[1] = a[1];
13379 out[2] = a[2];
13380 out[3] = a[3];
13381 out[4] = a[4];
13382 out[5] = a[5];
13383 out[6] = a[6];
13384 out[7] = a[7];
13385 out[8] = a[8];
13386 return out;
13387 }
13388
13389 /**
13390 * Copy the values from one mat3 to another
13391 *
13392 * @param {mat3} out the receiving matrix
13393 * @param {mat3} a the source matrix
13394 * @returns {mat3} out
13395 */
13396 function copy(out, a) {
13397 out[0] = a[0];
13398 out[1] = a[1];
13399 out[2] = a[2];
13400 out[3] = a[3];
13401 out[4] = a[4];
13402 out[5] = a[5];
13403 out[6] = a[6];
13404 out[7] = a[7];
13405 out[8] = a[8];
13406 return out;
13407 }
13408
13409 /**
13410 * Create a new mat3 with the given values
13411 *
13412 * @param {Number} m00 Component in column 0, row 0 position (index 0)
13413 * @param {Number} m01 Component in column 0, row 1 position (index 1)
13414 * @param {Number} m02 Component in column 0, row 2 position (index 2)
13415 * @param {Number} m10 Component in column 1, row 0 position (index 3)
13416 * @param {Number} m11 Component in column 1, row 1 position (index 4)
13417 * @param {Number} m12 Component in column 1, row 2 position (index 5)
13418 * @param {Number} m20 Component in column 2, row 0 position (index 6)
13419 * @param {Number} m21 Component in column 2, row 1 position (index 7)
13420 * @param {Number} m22 Component in column 2, row 2 position (index 8)
13421 * @returns {mat3} A new mat3
13422 */
13423 function fromValues(m00, m01, m02, m10, m11, m12, m20, m21, m22) {
13424 var out = new __WEBPACK_IMPORTED_MODULE_0__common__["a" /* ARRAY_TYPE */](9);
13425 out[0] = m00;
13426 out[1] = m01;
13427 out[2] = m02;
13428 out[3] = m10;
13429 out[4] = m11;
13430 out[5] = m12;
13431 out[6] = m20;
13432 out[7] = m21;
13433 out[8] = m22;
13434 return out;
13435 }
13436
13437 /**
13438 * Set the components of a mat3 to the given values
13439 *
13440 * @param {mat3} out the receiving matrix
13441 * @param {Number} m00 Component in column 0, row 0 position (index 0)
13442 * @param {Number} m01 Component in column 0, row 1 position (index 1)
13443 * @param {Number} m02 Component in column 0, row 2 position (index 2)
13444 * @param {Number} m10 Component in column 1, row 0 position (index 3)
13445 * @param {Number} m11 Component in column 1, row 1 position (index 4)
13446 * @param {Number} m12 Component in column 1, row 2 position (index 5)
13447 * @param {Number} m20 Component in column 2, row 0 position (index 6)
13448 * @param {Number} m21 Component in column 2, row 1 position (index 7)
13449 * @param {Number} m22 Component in column 2, row 2 position (index 8)
13450 * @returns {mat3} out
13451 */
13452 function set(out, m00, m01, m02, m10, m11, m12, m20, m21, m22) {
13453 out[0] = m00;
13454 out[1] = m01;
13455 out[2] = m02;
13456 out[3] = m10;
13457 out[4] = m11;
13458 out[5] = m12;
13459 out[6] = m20;
13460 out[7] = m21;
13461 out[8] = m22;
13462 return out;
13463 }
13464
13465 /**
13466 * Set a mat3 to the identity matrix
13467 *
13468 * @param {mat3} out the receiving matrix
13469 * @returns {mat3} out
13470 */
13471 function identity(out) {
13472 out[0] = 1;
13473 out[1] = 0;
13474 out[2] = 0;
13475 out[3] = 0;
13476 out[4] = 1;
13477 out[5] = 0;
13478 out[6] = 0;
13479 out[7] = 0;
13480 out[8] = 1;
13481 return out;
13482 }
13483
13484 /**
13485 * Transpose the values of a mat3
13486 *
13487 * @param {mat3} out the receiving matrix
13488 * @param {mat3} a the source matrix
13489 * @returns {mat3} out
13490 */
13491 function transpose(out, a) {
13492 // If we are transposing ourselves we can skip a few steps but have to cache some values
13493 if (out === a) {
13494 var a01 = a[1],
13495 a02 = a[2],
13496 a12 = a[5];
13497 out[1] = a[3];
13498 out[2] = a[6];
13499 out[3] = a01;
13500 out[5] = a[7];
13501 out[6] = a02;
13502 out[7] = a12;
13503 } else {
13504 out[0] = a[0];
13505 out[1] = a[3];
13506 out[2] = a[6];
13507 out[3] = a[1];
13508 out[4] = a[4];
13509 out[5] = a[7];
13510 out[6] = a[2];
13511 out[7] = a[5];
13512 out[8] = a[8];
13513 }
13514
13515 return out;
13516 }
13517
13518 /**
13519 * Inverts a mat3
13520 *
13521 * @param {mat3} out the receiving matrix
13522 * @param {mat3} a the source matrix
13523 * @returns {mat3} out
13524 */
13525 function invert(out, a) {
13526 var a00 = a[0],
13527 a01 = a[1],
13528 a02 = a[2];
13529 var a10 = a[3],
13530 a11 = a[4],
13531 a12 = a[5];
13532 var a20 = a[6],
13533 a21 = a[7],
13534 a22 = a[8];
13535
13536 var b01 = a22 * a11 - a12 * a21;
13537 var b11 = -a22 * a10 + a12 * a20;
13538 var b21 = a21 * a10 - a11 * a20;
13539
13540 // Calculate the determinant
13541 var det = a00 * b01 + a01 * b11 + a02 * b21;
13542
13543 if (!det) {
13544 return null;
13545 }
13546 det = 1.0 / det;
13547
13548 out[0] = b01 * det;
13549 out[1] = (-a22 * a01 + a02 * a21) * det;
13550 out[2] = (a12 * a01 - a02 * a11) * det;
13551 out[3] = b11 * det;
13552 out[4] = (a22 * a00 - a02 * a20) * det;
13553 out[5] = (-a12 * a00 + a02 * a10) * det;
13554 out[6] = b21 * det;
13555 out[7] = (-a21 * a00 + a01 * a20) * det;
13556 out[8] = (a11 * a00 - a01 * a10) * det;
13557 return out;
13558 }
13559
13560 /**
13561 * Calculates the adjugate of a mat3
13562 *
13563 * @param {mat3} out the receiving matrix
13564 * @param {mat3} a the source matrix
13565 * @returns {mat3} out
13566 */
13567 function adjoint(out, a) {
13568 var a00 = a[0],
13569 a01 = a[1],
13570 a02 = a[2];
13571 var a10 = a[3],
13572 a11 = a[4],
13573 a12 = a[5];
13574 var a20 = a[6],
13575 a21 = a[7],
13576 a22 = a[8];
13577
13578 out[0] = a11 * a22 - a12 * a21;
13579 out[1] = a02 * a21 - a01 * a22;
13580 out[2] = a01 * a12 - a02 * a11;
13581 out[3] = a12 * a20 - a10 * a22;
13582 out[4] = a00 * a22 - a02 * a20;
13583 out[5] = a02 * a10 - a00 * a12;
13584 out[6] = a10 * a21 - a11 * a20;
13585 out[7] = a01 * a20 - a00 * a21;
13586 out[8] = a00 * a11 - a01 * a10;
13587 return out;
13588 }
13589
13590 /**
13591 * Calculates the determinant of a mat3
13592 *
13593 * @param {mat3} a the source matrix
13594 * @returns {Number} determinant of a
13595 */
13596 function determinant(a) {
13597 var a00 = a[0],
13598 a01 = a[1],
13599 a02 = a[2];
13600 var a10 = a[3],
13601 a11 = a[4],
13602 a12 = a[5];
13603 var a20 = a[6],
13604 a21 = a[7],
13605 a22 = a[8];
13606
13607 return a00 * (a22 * a11 - a12 * a21) + a01 * (-a22 * a10 + a12 * a20) + a02 * (a21 * a10 - a11 * a20);
13608 }
13609
13610 /**
13611 * Multiplies two mat3's
13612 *
13613 * @param {mat3} out the receiving matrix
13614 * @param {mat3} a the first operand
13615 * @param {mat3} b the second operand
13616 * @returns {mat3} out
13617 */
13618 function multiply(out, a, b) {
13619 var a00 = a[0],
13620 a01 = a[1],
13621 a02 = a[2];
13622 var a10 = a[3],
13623 a11 = a[4],
13624 a12 = a[5];
13625 var a20 = a[6],
13626 a21 = a[7],
13627 a22 = a[8];
13628
13629 var b00 = b[0],
13630 b01 = b[1],
13631 b02 = b[2];
13632 var b10 = b[3],
13633 b11 = b[4],
13634 b12 = b[5];
13635 var b20 = b[6],
13636 b21 = b[7],
13637 b22 = b[8];
13638
13639 out[0] = b00 * a00 + b01 * a10 + b02 * a20;
13640 out[1] = b00 * a01 + b01 * a11 + b02 * a21;
13641 out[2] = b00 * a02 + b01 * a12 + b02 * a22;
13642
13643 out[3] = b10 * a00 + b11 * a10 + b12 * a20;
13644 out[4] = b10 * a01 + b11 * a11 + b12 * a21;
13645 out[5] = b10 * a02 + b11 * a12 + b12 * a22;
13646
13647 out[6] = b20 * a00 + b21 * a10 + b22 * a20;
13648 out[7] = b20 * a01 + b21 * a11 + b22 * a21;
13649 out[8] = b20 * a02 + b21 * a12 + b22 * a22;
13650 return out;
13651 }
13652
13653 /**
13654 * Translate a mat3 by the given vector
13655 *
13656 * @param {mat3} out the receiving matrix
13657 * @param {mat3} a the matrix to translate
13658 * @param {vec2} v vector to translate by
13659 * @returns {mat3} out
13660 */
13661 function translate(out, a, v) {
13662 var a00 = a[0],
13663 a01 = a[1],
13664 a02 = a[2],
13665 a10 = a[3],
13666 a11 = a[4],
13667 a12 = a[5],
13668 a20 = a[6],
13669 a21 = a[7],
13670 a22 = a[8],
13671 x = v[0],
13672 y = v[1];
13673
13674 out[0] = a00;
13675 out[1] = a01;
13676 out[2] = a02;
13677
13678 out[3] = a10;
13679 out[4] = a11;
13680 out[5] = a12;
13681
13682 out[6] = x * a00 + y * a10 + a20;
13683 out[7] = x * a01 + y * a11 + a21;
13684 out[8] = x * a02 + y * a12 + a22;
13685 return out;
13686 }
13687
13688 /**
13689 * Rotates a mat3 by the given angle
13690 *
13691 * @param {mat3} out the receiving matrix
13692 * @param {mat3} a the matrix to rotate
13693 * @param {Number} rad the angle to rotate the matrix by
13694 * @returns {mat3} out
13695 */
13696 function rotate(out, a, rad) {
13697 var a00 = a[0],
13698 a01 = a[1],
13699 a02 = a[2],
13700 a10 = a[3],
13701 a11 = a[4],
13702 a12 = a[5],
13703 a20 = a[6],
13704 a21 = a[7],
13705 a22 = a[8],
13706 s = Math.sin(rad),
13707 c = Math.cos(rad);
13708
13709 out[0] = c * a00 + s * a10;
13710 out[1] = c * a01 + s * a11;
13711 out[2] = c * a02 + s * a12;
13712
13713 out[3] = c * a10 - s * a00;
13714 out[4] = c * a11 - s * a01;
13715 out[5] = c * a12 - s * a02;
13716
13717 out[6] = a20;
13718 out[7] = a21;
13719 out[8] = a22;
13720 return out;
13721 };
13722
13723 /**
13724 * Scales the mat3 by the dimensions in the given vec2
13725 *
13726 * @param {mat3} out the receiving matrix
13727 * @param {mat3} a the matrix to rotate
13728 * @param {vec2} v the vec2 to scale the matrix by
13729 * @returns {mat3} out
13730 **/
13731 function scale(out, a, v) {
13732 var x = v[0],
13733 y = v[1];
13734
13735 out[0] = x * a[0];
13736 out[1] = x * a[1];
13737 out[2] = x * a[2];
13738
13739 out[3] = y * a[3];
13740 out[4] = y * a[4];
13741 out[5] = y * a[5];
13742
13743 out[6] = a[6];
13744 out[7] = a[7];
13745 out[8] = a[8];
13746 return out;
13747 }
13748
13749 /**
13750 * Creates a matrix from a vector translation
13751 * This is equivalent to (but much faster than):
13752 *
13753 * mat3.identity(dest);
13754 * mat3.translate(dest, dest, vec);
13755 *
13756 * @param {mat3} out mat3 receiving operation result
13757 * @param {vec2} v Translation vector
13758 * @returns {mat3} out
13759 */
13760 function fromTranslation(out, v) {
13761 out[0] = 1;
13762 out[1] = 0;
13763 out[2] = 0;
13764 out[3] = 0;
13765 out[4] = 1;
13766 out[5] = 0;
13767 out[6] = v[0];
13768 out[7] = v[1];
13769 out[8] = 1;
13770 return out;
13771 }
13772
13773 /**
13774 * Creates a matrix from a given angle
13775 * This is equivalent to (but much faster than):
13776 *
13777 * mat3.identity(dest);
13778 * mat3.rotate(dest, dest, rad);
13779 *
13780 * @param {mat3} out mat3 receiving operation result
13781 * @param {Number} rad the angle to rotate the matrix by
13782 * @returns {mat3} out
13783 */
13784 function fromRotation(out, rad) {
13785 var s = Math.sin(rad),
13786 c = Math.cos(rad);
13787
13788 out[0] = c;
13789 out[1] = s;
13790 out[2] = 0;
13791
13792 out[3] = -s;
13793 out[4] = c;
13794 out[5] = 0;
13795
13796 out[6] = 0;
13797 out[7] = 0;
13798 out[8] = 1;
13799 return out;
13800 }
13801
13802 /**
13803 * Creates a matrix from a vector scaling
13804 * This is equivalent to (but much faster than):
13805 *
13806 * mat3.identity(dest);
13807 * mat3.scale(dest, dest, vec);
13808 *
13809 * @param {mat3} out mat3 receiving operation result
13810 * @param {vec2} v Scaling vector
13811 * @returns {mat3} out
13812 */
13813 function fromScaling(out, v) {
13814 out[0] = v[0];
13815 out[1] = 0;
13816 out[2] = 0;
13817
13818 out[3] = 0;
13819 out[4] = v[1];
13820 out[5] = 0;
13821
13822 out[6] = 0;
13823 out[7] = 0;
13824 out[8] = 1;
13825 return out;
13826 }
13827
13828 /**
13829 * Copies the values from a mat2d into a mat3
13830 *
13831 * @param {mat3} out the receiving matrix
13832 * @param {mat2d} a the matrix to copy
13833 * @returns {mat3} out
13834 **/
13835 function fromMat2d(out, a) {
13836 out[0] = a[0];
13837 out[1] = a[1];
13838 out[2] = 0;
13839
13840 out[3] = a[2];
13841 out[4] = a[3];
13842 out[5] = 0;
13843
13844 out[6] = a[4];
13845 out[7] = a[5];
13846 out[8] = 1;
13847 return out;
13848 }
13849
13850 /**
13851 * Calculates a 3x3 matrix from the given quaternion
13852 *
13853 * @param {mat3} out mat3 receiving operation result
13854 * @param {quat} q Quaternion to create matrix from
13855 *
13856 * @returns {mat3} out
13857 */
13858 function fromQuat(out, q) {
13859 var x = q[0],
13860 y = q[1],
13861 z = q[2],
13862 w = q[3];
13863 var x2 = x + x;
13864 var y2 = y + y;
13865 var z2 = z + z;
13866
13867 var xx = x * x2;
13868 var yx = y * x2;
13869 var yy = y * y2;
13870 var zx = z * x2;
13871 var zy = z * y2;
13872 var zz = z * z2;
13873 var wx = w * x2;
13874 var wy = w * y2;
13875 var wz = w * z2;
13876
13877 out[0] = 1 - yy - zz;
13878 out[3] = yx - wz;
13879 out[6] = zx + wy;
13880
13881 out[1] = yx + wz;
13882 out[4] = 1 - xx - zz;
13883 out[7] = zy - wx;
13884
13885 out[2] = zx - wy;
13886 out[5] = zy + wx;
13887 out[8] = 1 - xx - yy;
13888
13889 return out;
13890 }
13891
13892 /**
13893 * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix
13894 *
13895 * @param {mat3} out mat3 receiving operation result
13896 * @param {mat4} a Mat4 to derive the normal matrix from
13897 *
13898 * @returns {mat3} out
13899 */
13900 function normalFromMat4(out, a) {
13901 var a00 = a[0],
13902 a01 = a[1],
13903 a02 = a[2],
13904 a03 = a[3];
13905 var a10 = a[4],
13906 a11 = a[5],
13907 a12 = a[6],
13908 a13 = a[7];
13909 var a20 = a[8],
13910 a21 = a[9],
13911 a22 = a[10],
13912 a23 = a[11];
13913 var a30 = a[12],
13914 a31 = a[13],
13915 a32 = a[14],
13916 a33 = a[15];
13917
13918 var b00 = a00 * a11 - a01 * a10;
13919 var b01 = a00 * a12 - a02 * a10;
13920 var b02 = a00 * a13 - a03 * a10;
13921 var b03 = a01 * a12 - a02 * a11;
13922 var b04 = a01 * a13 - a03 * a11;
13923 var b05 = a02 * a13 - a03 * a12;
13924 var b06 = a20 * a31 - a21 * a30;
13925 var b07 = a20 * a32 - a22 * a30;
13926 var b08 = a20 * a33 - a23 * a30;
13927 var b09 = a21 * a32 - a22 * a31;
13928 var b10 = a21 * a33 - a23 * a31;
13929 var b11 = a22 * a33 - a23 * a32;
13930
13931 // Calculate the determinant
13932 var det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;
13933
13934 if (!det) {
13935 return null;
13936 }
13937 det = 1.0 / det;
13938
13939 out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;
13940 out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det;
13941 out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det;
13942
13943 out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det;
13944 out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det;
13945 out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det;
13946
13947 out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det;
13948 out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det;
13949 out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det;
13950
13951 return out;
13952 }
13953
13954 /**
13955 * Generates a 2D projection matrix with the given bounds
13956 *
13957 * @param {mat3} out mat3 frustum matrix will be written into
13958 * @param {number} width Width of your gl context
13959 * @param {number} height Height of gl context
13960 * @returns {mat3} out
13961 */
13962 function projection(out, width, height) {
13963 out[0] = 2 / width;
13964 out[1] = 0;
13965 out[2] = 0;
13966 out[3] = 0;
13967 out[4] = -2 / height;
13968 out[5] = 0;
13969 out[6] = -1;
13970 out[7] = 1;
13971 out[8] = 1;
13972 return out;
13973 }
13974
13975 /**
13976 * Returns a string representation of a mat3
13977 *
13978 * @param {mat3} a matrix to represent as a string
13979 * @returns {String} string representation of the matrix
13980 */
13981 function str(a) {
13982 return 'mat3(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ', ' + a[4] + ', ' + a[5] + ', ' + a[6] + ', ' + a[7] + ', ' + a[8] + ')';
13983 }
13984
13985 /**
13986 * Returns Frobenius norm of a mat3
13987 *
13988 * @param {mat3} a the matrix to calculate Frobenius norm of
13989 * @returns {Number} Frobenius norm
13990 */
13991 function frob(a) {
13992 return Math.sqrt(Math.pow(a[0], 2) + Math.pow(a[1], 2) + Math.pow(a[2], 2) + Math.pow(a[3], 2) + Math.pow(a[4], 2) + Math.pow(a[5], 2) + Math.pow(a[6], 2) + Math.pow(a[7], 2) + Math.pow(a[8], 2));
13993 }
13994
13995 /**
13996 * Adds two mat3's
13997 *
13998 * @param {mat3} out the receiving matrix
13999 * @param {mat3} a the first operand
14000 * @param {mat3} b the second operand
14001 * @returns {mat3} out
14002 */
14003 function add(out, a, b) {
14004 out[0] = a[0] + b[0];
14005 out[1] = a[1] + b[1];
14006 out[2] = a[2] + b[2];
14007 out[3] = a[3] + b[3];
14008 out[4] = a[4] + b[4];
14009 out[5] = a[5] + b[5];
14010 out[6] = a[6] + b[6];
14011 out[7] = a[7] + b[7];
14012 out[8] = a[8] + b[8];
14013 return out;
14014 }
14015
14016 /**
14017 * Subtracts matrix b from matrix a
14018 *
14019 * @param {mat3} out the receiving matrix
14020 * @param {mat3} a the first operand
14021 * @param {mat3} b the second operand
14022 * @returns {mat3} out
14023 */
14024 function subtract(out, a, b) {
14025 out[0] = a[0] - b[0];
14026 out[1] = a[1] - b[1];
14027 out[2] = a[2] - b[2];
14028 out[3] = a[3] - b[3];
14029 out[4] = a[4] - b[4];
14030 out[5] = a[5] - b[5];
14031 out[6] = a[6] - b[6];
14032 out[7] = a[7] - b[7];
14033 out[8] = a[8] - b[8];
14034 return out;
14035 }
14036
14037 /**
14038 * Multiply each element of the matrix by a scalar.
14039 *
14040 * @param {mat3} out the receiving matrix
14041 * @param {mat3} a the matrix to scale
14042 * @param {Number} b amount to scale the matrix's elements by
14043 * @returns {mat3} out
14044 */
14045 function multiplyScalar(out, a, b) {
14046 out[0] = a[0] * b;
14047 out[1] = a[1] * b;
14048 out[2] = a[2] * b;
14049 out[3] = a[3] * b;
14050 out[4] = a[4] * b;
14051 out[5] = a[5] * b;
14052 out[6] = a[6] * b;
14053 out[7] = a[7] * b;
14054 out[8] = a[8] * b;
14055 return out;
14056 }
14057
14058 /**
14059 * Adds two mat3's after multiplying each element of the second operand by a scalar value.
14060 *
14061 * @param {mat3} out the receiving vector
14062 * @param {mat3} a the first operand
14063 * @param {mat3} b the second operand
14064 * @param {Number} scale the amount to scale b's elements by before adding
14065 * @returns {mat3} out
14066 */
14067 function multiplyScalarAndAdd(out, a, b, scale) {
14068 out[0] = a[0] + b[0] * scale;
14069 out[1] = a[1] + b[1] * scale;
14070 out[2] = a[2] + b[2] * scale;
14071 out[3] = a[3] + b[3] * scale;
14072 out[4] = a[4] + b[4] * scale;
14073 out[5] = a[5] + b[5] * scale;
14074 out[6] = a[6] + b[6] * scale;
14075 out[7] = a[7] + b[7] * scale;
14076 out[8] = a[8] + b[8] * scale;
14077 return out;
14078 }
14079
14080 /**
14081 * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)
14082 *
14083 * @param {mat3} a The first matrix.
14084 * @param {mat3} b The second matrix.
14085 * @returns {Boolean} True if the matrices are equal, false otherwise.
14086 */
14087 function exactEquals(a, b) {
14088 return a[0] === b[0] && a[1] === b[1] && a[2] === b[2] && a[3] === b[3] && a[4] === b[4] && a[5] === b[5] && a[6] === b[6] && a[7] === b[7] && a[8] === b[8];
14089 }
14090
14091 /**
14092 * Returns whether or not the matrices have approximately the same elements in the same position.
14093 *
14094 * @param {mat3} a The first matrix.
14095 * @param {mat3} b The second matrix.
14096 * @returns {Boolean} True if the matrices are equal, false otherwise.
14097 */
14098 function equals(a, b) {
14099 var a0 = a[0],
14100 a1 = a[1],
14101 a2 = a[2],
14102 a3 = a[3],
14103 a4 = a[4],
14104 a5 = a[5],
14105 a6 = a[6],
14106 a7 = a[7],
14107 a8 = a[8];
14108 var b0 = b[0],
14109 b1 = b[1],
14110 b2 = b[2],
14111 b3 = b[3],
14112 b4 = b[4],
14113 b5 = b[5],
14114 b6 = b[6],
14115 b7 = b[7],
14116 b8 = b[8];
14117 return Math.abs(a0 - b0) <= __WEBPACK_IMPORTED_MODULE_0__common__["b" /* EPSILON */] * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= __WEBPACK_IMPORTED_MODULE_0__common__["b" /* EPSILON */] * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= __WEBPACK_IMPORTED_MODULE_0__common__["b" /* EPSILON */] * Math.max(1.0, Math.abs(a2), Math.abs(b2)) && Math.abs(a3 - b3) <= __WEBPACK_IMPORTED_MODULE_0__common__["b" /* EPSILON */] * Math.max(1.0, Math.abs(a3), Math.abs(b3)) && Math.abs(a4 - b4) <= __WEBPACK_IMPORTED_MODULE_0__common__["b" /* EPSILON */] * Math.max(1.0, Math.abs(a4), Math.abs(b4)) && Math.abs(a5 - b5) <= __WEBPACK_IMPORTED_MODULE_0__common__["b" /* EPSILON */] * Math.max(1.0, Math.abs(a5), Math.abs(b5)) && Math.abs(a6 - b6) <= __WEBPACK_IMPORTED_MODULE_0__common__["b" /* EPSILON */] * Math.max(1.0, Math.abs(a6), Math.abs(b6)) && Math.abs(a7 - b7) <= __WEBPACK_IMPORTED_MODULE_0__common__["b" /* EPSILON */] * Math.max(1.0, Math.abs(a7), Math.abs(b7)) && Math.abs(a8 - b8) <= __WEBPACK_IMPORTED_MODULE_0__common__["b" /* EPSILON */] * Math.max(1.0, Math.abs(a8), Math.abs(b8));
14118 }
14119
14120 /**
14121 * Alias for {@link mat3.multiply}
14122 * @function
14123 */
14124 var mul = multiply;
14125
14126 /**
14127 * Alias for {@link mat3.subtract}
14128 * @function
14129 */
14130 var sub = subtract;
14131
14132 /***/
14133 },
14134 /* 231 */
14135 /***/function (module, __webpack_exports__, __webpack_require__) {
14136
14137 "use strict";
14138
14139 Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
14140 /* harmony export (immutable) */__webpack_exports__["create"] = create;
14141 /* harmony export (immutable) */__webpack_exports__["clone"] = clone;
14142 /* harmony export (immutable) */__webpack_exports__["length"] = length;
14143 /* harmony export (immutable) */__webpack_exports__["fromValues"] = fromValues;
14144 /* harmony export (immutable) */__webpack_exports__["copy"] = copy;
14145 /* harmony export (immutable) */__webpack_exports__["set"] = set;
14146 /* harmony export (immutable) */__webpack_exports__["add"] = add;
14147 /* harmony export (immutable) */__webpack_exports__["subtract"] = subtract;
14148 /* harmony export (immutable) */__webpack_exports__["multiply"] = multiply;
14149 /* harmony export (immutable) */__webpack_exports__["divide"] = divide;
14150 /* harmony export (immutable) */__webpack_exports__["ceil"] = ceil;
14151 /* harmony export (immutable) */__webpack_exports__["floor"] = floor;
14152 /* harmony export (immutable) */__webpack_exports__["min"] = min;
14153 /* harmony export (immutable) */__webpack_exports__["max"] = max;
14154 /* harmony export (immutable) */__webpack_exports__["round"] = round;
14155 /* harmony export (immutable) */__webpack_exports__["scale"] = scale;
14156 /* harmony export (immutable) */__webpack_exports__["scaleAndAdd"] = scaleAndAdd;
14157 /* harmony export (immutable) */__webpack_exports__["distance"] = distance;
14158 /* harmony export (immutable) */__webpack_exports__["squaredDistance"] = squaredDistance;
14159 /* harmony export (immutable) */__webpack_exports__["squaredLength"] = squaredLength;
14160 /* harmony export (immutable) */__webpack_exports__["negate"] = negate;
14161 /* harmony export (immutable) */__webpack_exports__["inverse"] = inverse;
14162 /* harmony export (immutable) */__webpack_exports__["normalize"] = normalize;
14163 /* harmony export (immutable) */__webpack_exports__["dot"] = dot;
14164 /* harmony export (immutable) */__webpack_exports__["cross"] = cross;
14165 /* harmony export (immutable) */__webpack_exports__["lerp"] = lerp;
14166 /* harmony export (immutable) */__webpack_exports__["hermite"] = hermite;
14167 /* harmony export (immutable) */__webpack_exports__["bezier"] = bezier;
14168 /* harmony export (immutable) */__webpack_exports__["random"] = random;
14169 /* harmony export (immutable) */__webpack_exports__["transformMat4"] = transformMat4;
14170 /* harmony export (immutable) */__webpack_exports__["transformMat3"] = transformMat3;
14171 /* harmony export (immutable) */__webpack_exports__["transformQuat"] = transformQuat;
14172 /* harmony export (immutable) */__webpack_exports__["rotateX"] = rotateX;
14173 /* harmony export (immutable) */__webpack_exports__["rotateY"] = rotateY;
14174 /* harmony export (immutable) */__webpack_exports__["rotateZ"] = rotateZ;
14175 /* harmony export (immutable) */__webpack_exports__["angle"] = angle;
14176 /* harmony export (immutable) */__webpack_exports__["str"] = str;
14177 /* harmony export (immutable) */__webpack_exports__["exactEquals"] = exactEquals;
14178 /* harmony export (immutable) */__webpack_exports__["equals"] = equals;
14179 /* harmony export (binding) */__webpack_require__.d(__webpack_exports__, "sub", function () {
14180 return sub;
14181 });
14182 /* harmony export (binding) */__webpack_require__.d(__webpack_exports__, "mul", function () {
14183 return mul;
14184 });
14185 /* harmony export (binding) */__webpack_require__.d(__webpack_exports__, "div", function () {
14186 return div;
14187 });
14188 /* harmony export (binding) */__webpack_require__.d(__webpack_exports__, "dist", function () {
14189 return dist;
14190 });
14191 /* harmony export (binding) */__webpack_require__.d(__webpack_exports__, "sqrDist", function () {
14192 return sqrDist;
14193 });
14194 /* harmony export (binding) */__webpack_require__.d(__webpack_exports__, "len", function () {
14195 return len;
14196 });
14197 /* harmony export (binding) */__webpack_require__.d(__webpack_exports__, "sqrLen", function () {
14198 return sqrLen;
14199 });
14200 /* harmony export (binding) */__webpack_require__.d(__webpack_exports__, "forEach", function () {
14201 return forEach;
14202 });
14203 /* harmony import */var __WEBPACK_IMPORTED_MODULE_0__common__ = __webpack_require__(45);
14204 /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.
14205
14206 Permission is hereby granted, free of charge, to any person obtaining a copy
14207 of this software and associated documentation files (the "Software"), to deal
14208 in the Software without restriction, including without limitation the rights
14209 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14210 copies of the Software, and to permit persons to whom the Software is
14211 furnished to do so, subject to the following conditions:
14212
14213 The above copyright notice and this permission notice shall be included in
14214 all copies or substantial portions of the Software.
14215
14216 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14217 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14218 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14219 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
14220 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
14221 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
14222 THE SOFTWARE. */
14223
14224 /**
14225 * 3 Dimensional Vector
14226 * @module vec3
14227 */
14228
14229 /**
14230 * Creates a new, empty vec3
14231 *
14232 * @returns {vec3} a new 3D vector
14233 */
14234 function create() {
14235 var out = new __WEBPACK_IMPORTED_MODULE_0__common__["a" /* ARRAY_TYPE */](3);
14236 out[0] = 0;
14237 out[1] = 0;
14238 out[2] = 0;
14239 return out;
14240 }
14241
14242 /**
14243 * Creates a new vec3 initialized with values from an existing vector
14244 *
14245 * @param {vec3} a vector to clone
14246 * @returns {vec3} a new 3D vector
14247 */
14248 function clone(a) {
14249 var out = new __WEBPACK_IMPORTED_MODULE_0__common__["a" /* ARRAY_TYPE */](3);
14250 out[0] = a[0];
14251 out[1] = a[1];
14252 out[2] = a[2];
14253 return out;
14254 }
14255
14256 /**
14257 * Calculates the length of a vec3
14258 *
14259 * @param {vec3} a vector to calculate length of
14260 * @returns {Number} length of a
14261 */
14262 function length(a) {
14263 var x = a[0];
14264 var y = a[1];
14265 var z = a[2];
14266 return Math.sqrt(x * x + y * y + z * z);
14267 }
14268
14269 /**
14270 * Creates a new vec3 initialized with the given values
14271 *
14272 * @param {Number} x X component
14273 * @param {Number} y Y component
14274 * @param {Number} z Z component
14275 * @returns {vec3} a new 3D vector
14276 */
14277 function fromValues(x, y, z) {
14278 var out = new __WEBPACK_IMPORTED_MODULE_0__common__["a" /* ARRAY_TYPE */](3);
14279 out[0] = x;
14280 out[1] = y;
14281 out[2] = z;
14282 return out;
14283 }
14284
14285 /**
14286 * Copy the values from one vec3 to another
14287 *
14288 * @param {vec3} out the receiving vector
14289 * @param {vec3} a the source vector
14290 * @returns {vec3} out
14291 */
14292 function copy(out, a) {
14293 out[0] = a[0];
14294 out[1] = a[1];
14295 out[2] = a[2];
14296 return out;
14297 }
14298
14299 /**
14300 * Set the components of a vec3 to the given values
14301 *
14302 * @param {vec3} out the receiving vector
14303 * @param {Number} x X component
14304 * @param {Number} y Y component
14305 * @param {Number} z Z component
14306 * @returns {vec3} out
14307 */
14308 function set(out, x, y, z) {
14309 out[0] = x;
14310 out[1] = y;
14311 out[2] = z;
14312 return out;
14313 }
14314
14315 /**
14316 * Adds two vec3's
14317 *
14318 * @param {vec3} out the receiving vector
14319 * @param {vec3} a the first operand
14320 * @param {vec3} b the second operand
14321 * @returns {vec3} out
14322 */
14323 function add(out, a, b) {
14324 out[0] = a[0] + b[0];
14325 out[1] = a[1] + b[1];
14326 out[2] = a[2] + b[2];
14327 return out;
14328 }
14329
14330 /**
14331 * Subtracts vector b from vector a
14332 *
14333 * @param {vec3} out the receiving vector
14334 * @param {vec3} a the first operand
14335 * @param {vec3} b the second operand
14336 * @returns {vec3} out
14337 */
14338 function subtract(out, a, b) {
14339 out[0] = a[0] - b[0];
14340 out[1] = a[1] - b[1];
14341 out[2] = a[2] - b[2];
14342 return out;
14343 }
14344
14345 /**
14346 * Multiplies two vec3's
14347 *
14348 * @param {vec3} out the receiving vector
14349 * @param {vec3} a the first operand
14350 * @param {vec3} b the second operand
14351 * @returns {vec3} out
14352 */
14353 function multiply(out, a, b) {
14354 out[0] = a[0] * b[0];
14355 out[1] = a[1] * b[1];
14356 out[2] = a[2] * b[2];
14357 return out;
14358 }
14359
14360 /**
14361 * Divides two vec3's
14362 *
14363 * @param {vec3} out the receiving vector
14364 * @param {vec3} a the first operand
14365 * @param {vec3} b the second operand
14366 * @returns {vec3} out
14367 */
14368 function divide(out, a, b) {
14369 out[0] = a[0] / b[0];
14370 out[1] = a[1] / b[1];
14371 out[2] = a[2] / b[2];
14372 return out;
14373 }
14374
14375 /**
14376 * Math.ceil the components of a vec3
14377 *
14378 * @param {vec3} out the receiving vector
14379 * @param {vec3} a vector to ceil
14380 * @returns {vec3} out
14381 */
14382 function ceil(out, a) {
14383 out[0] = Math.ceil(a[0]);
14384 out[1] = Math.ceil(a[1]);
14385 out[2] = Math.ceil(a[2]);
14386 return out;
14387 }
14388
14389 /**
14390 * Math.floor the components of a vec3
14391 *
14392 * @param {vec3} out the receiving vector
14393 * @param {vec3} a vector to floor
14394 * @returns {vec3} out
14395 */
14396 function floor(out, a) {
14397 out[0] = Math.floor(a[0]);
14398 out[1] = Math.floor(a[1]);
14399 out[2] = Math.floor(a[2]);
14400 return out;
14401 }
14402
14403 /**
14404 * Returns the minimum of two vec3's
14405 *
14406 * @param {vec3} out the receiving vector
14407 * @param {vec3} a the first operand
14408 * @param {vec3} b the second operand
14409 * @returns {vec3} out
14410 */
14411 function min(out, a, b) {
14412 out[0] = Math.min(a[0], b[0]);
14413 out[1] = Math.min(a[1], b[1]);
14414 out[2] = Math.min(a[2], b[2]);
14415 return out;
14416 }
14417
14418 /**
14419 * Returns the maximum of two vec3's
14420 *
14421 * @param {vec3} out the receiving vector
14422 * @param {vec3} a the first operand
14423 * @param {vec3} b the second operand
14424 * @returns {vec3} out
14425 */
14426 function max(out, a, b) {
14427 out[0] = Math.max(a[0], b[0]);
14428 out[1] = Math.max(a[1], b[1]);
14429 out[2] = Math.max(a[2], b[2]);
14430 return out;
14431 }
14432
14433 /**
14434 * Math.round the components of a vec3
14435 *
14436 * @param {vec3} out the receiving vector
14437 * @param {vec3} a vector to round
14438 * @returns {vec3} out
14439 */
14440 function round(out, a) {
14441 out[0] = Math.round(a[0]);
14442 out[1] = Math.round(a[1]);
14443 out[2] = Math.round(a[2]);
14444 return out;
14445 }
14446
14447 /**
14448 * Scales a vec3 by a scalar number
14449 *
14450 * @param {vec3} out the receiving vector
14451 * @param {vec3} a the vector to scale
14452 * @param {Number} b amount to scale the vector by
14453 * @returns {vec3} out
14454 */
14455 function scale(out, a, b) {
14456 out[0] = a[0] * b;
14457 out[1] = a[1] * b;
14458 out[2] = a[2] * b;
14459 return out;
14460 }
14461
14462 /**
14463 * Adds two vec3's after scaling the second operand by a scalar value
14464 *
14465 * @param {vec3} out the receiving vector
14466 * @param {vec3} a the first operand
14467 * @param {vec3} b the second operand
14468 * @param {Number} scale the amount to scale b by before adding
14469 * @returns {vec3} out
14470 */
14471 function scaleAndAdd(out, a, b, scale) {
14472 out[0] = a[0] + b[0] * scale;
14473 out[1] = a[1] + b[1] * scale;
14474 out[2] = a[2] + b[2] * scale;
14475 return out;
14476 }
14477
14478 /**
14479 * Calculates the euclidian distance between two vec3's
14480 *
14481 * @param {vec3} a the first operand
14482 * @param {vec3} b the second operand
14483 * @returns {Number} distance between a and b
14484 */
14485 function distance(a, b) {
14486 var x = b[0] - a[0];
14487 var y = b[1] - a[1];
14488 var z = b[2] - a[2];
14489 return Math.sqrt(x * x + y * y + z * z);
14490 }
14491
14492 /**
14493 * Calculates the squared euclidian distance between two vec3's
14494 *
14495 * @param {vec3} a the first operand
14496 * @param {vec3} b the second operand
14497 * @returns {Number} squared distance between a and b
14498 */
14499 function squaredDistance(a, b) {
14500 var x = b[0] - a[0];
14501 var y = b[1] - a[1];
14502 var z = b[2] - a[2];
14503 return x * x + y * y + z * z;
14504 }
14505
14506 /**
14507 * Calculates the squared length of a vec3
14508 *
14509 * @param {vec3} a vector to calculate squared length of
14510 * @returns {Number} squared length of a
14511 */
14512 function squaredLength(a) {
14513 var x = a[0];
14514 var y = a[1];
14515 var z = a[2];
14516 return x * x + y * y + z * z;
14517 }
14518
14519 /**
14520 * Negates the components of a vec3
14521 *
14522 * @param {vec3} out the receiving vector
14523 * @param {vec3} a vector to negate
14524 * @returns {vec3} out
14525 */
14526 function negate(out, a) {
14527 out[0] = -a[0];
14528 out[1] = -a[1];
14529 out[2] = -a[2];
14530 return out;
14531 }
14532
14533 /**
14534 * Returns the inverse of the components of a vec3
14535 *
14536 * @param {vec3} out the receiving vector
14537 * @param {vec3} a vector to invert
14538 * @returns {vec3} out
14539 */
14540 function inverse(out, a) {
14541 out[0] = 1.0 / a[0];
14542 out[1] = 1.0 / a[1];
14543 out[2] = 1.0 / a[2];
14544 return out;
14545 }
14546
14547 /**
14548 * Normalize a vec3
14549 *
14550 * @param {vec3} out the receiving vector
14551 * @param {vec3} a vector to normalize
14552 * @returns {vec3} out
14553 */
14554 function normalize(out, a) {
14555 var x = a[0];
14556 var y = a[1];
14557 var z = a[2];
14558 var len = x * x + y * y + z * z;
14559 if (len > 0) {
14560 //TODO: evaluate use of glm_invsqrt here?
14561 len = 1 / Math.sqrt(len);
14562 out[0] = a[0] * len;
14563 out[1] = a[1] * len;
14564 out[2] = a[2] * len;
14565 }
14566 return out;
14567 }
14568
14569 /**
14570 * Calculates the dot product of two vec3's
14571 *
14572 * @param {vec3} a the first operand
14573 * @param {vec3} b the second operand
14574 * @returns {Number} dot product of a and b
14575 */
14576 function dot(a, b) {
14577 return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
14578 }
14579
14580 /**
14581 * Computes the cross product of two vec3's
14582 *
14583 * @param {vec3} out the receiving vector
14584 * @param {vec3} a the first operand
14585 * @param {vec3} b the second operand
14586 * @returns {vec3} out
14587 */
14588 function cross(out, a, b) {
14589 var ax = a[0],
14590 ay = a[1],
14591 az = a[2];
14592 var bx = b[0],
14593 by = b[1],
14594 bz = b[2];
14595
14596 out[0] = ay * bz - az * by;
14597 out[1] = az * bx - ax * bz;
14598 out[2] = ax * by - ay * bx;
14599 return out;
14600 }
14601
14602 /**
14603 * Performs a linear interpolation between two vec3's
14604 *
14605 * @param {vec3} out the receiving vector
14606 * @param {vec3} a the first operand
14607 * @param {vec3} b the second operand
14608 * @param {Number} t interpolation amount between the two inputs
14609 * @returns {vec3} out
14610 */
14611 function lerp(out, a, b, t) {
14612 var ax = a[0];
14613 var ay = a[1];
14614 var az = a[2];
14615 out[0] = ax + t * (b[0] - ax);
14616 out[1] = ay + t * (b[1] - ay);
14617 out[2] = az + t * (b[2] - az);
14618 return out;
14619 }
14620
14621 /**
14622 * Performs a hermite interpolation with two control points
14623 *
14624 * @param {vec3} out the receiving vector
14625 * @param {vec3} a the first operand
14626 * @param {vec3} b the second operand
14627 * @param {vec3} c the third operand
14628 * @param {vec3} d the fourth operand
14629 * @param {Number} t interpolation amount between the two inputs
14630 * @returns {vec3} out
14631 */
14632 function hermite(out, a, b, c, d, t) {
14633 var factorTimes2 = t * t;
14634 var factor1 = factorTimes2 * (2 * t - 3) + 1;
14635 var factor2 = factorTimes2 * (t - 2) + t;
14636 var factor3 = factorTimes2 * (t - 1);
14637 var factor4 = factorTimes2 * (3 - 2 * t);
14638
14639 out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;
14640 out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;
14641 out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;
14642
14643 return out;
14644 }
14645
14646 /**
14647 * Performs a bezier interpolation with two control points
14648 *
14649 * @param {vec3} out the receiving vector
14650 * @param {vec3} a the first operand
14651 * @param {vec3} b the second operand
14652 * @param {vec3} c the third operand
14653 * @param {vec3} d the fourth operand
14654 * @param {Number} t interpolation amount between the two inputs
14655 * @returns {vec3} out
14656 */
14657 function bezier(out, a, b, c, d, t) {
14658 var inverseFactor = 1 - t;
14659 var inverseFactorTimesTwo = inverseFactor * inverseFactor;
14660 var factorTimes2 = t * t;
14661 var factor1 = inverseFactorTimesTwo * inverseFactor;
14662 var factor2 = 3 * t * inverseFactorTimesTwo;
14663 var factor3 = 3 * factorTimes2 * inverseFactor;
14664 var factor4 = factorTimes2 * t;
14665
14666 out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;
14667 out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;
14668 out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;
14669
14670 return out;
14671 }
14672
14673 /**
14674 * Generates a random vector with the given scale
14675 *
14676 * @param {vec3} out the receiving vector
14677 * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned
14678 * @returns {vec3} out
14679 */
14680 function random(out, scale) {
14681 scale = scale || 1.0;
14682
14683 var r = __WEBPACK_IMPORTED_MODULE_0__common__["c" /* RANDOM */]() * 2.0 * Math.PI;
14684 var z = __WEBPACK_IMPORTED_MODULE_0__common__["c" /* RANDOM */]() * 2.0 - 1.0;
14685 var zScale = Math.sqrt(1.0 - z * z) * scale;
14686
14687 out[0] = Math.cos(r) * zScale;
14688 out[1] = Math.sin(r) * zScale;
14689 out[2] = z * scale;
14690 return out;
14691 }
14692
14693 /**
14694 * Transforms the vec3 with a mat4.
14695 * 4th vector component is implicitly '1'
14696 *
14697 * @param {vec3} out the receiving vector
14698 * @param {vec3} a the vector to transform
14699 * @param {mat4} m matrix to transform with
14700 * @returns {vec3} out
14701 */
14702 function transformMat4(out, a, m) {
14703 var x = a[0],
14704 y = a[1],
14705 z = a[2];
14706 var w = m[3] * x + m[7] * y + m[11] * z + m[15];
14707 w = w || 1.0;
14708 out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;
14709 out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;
14710 out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;
14711 return out;
14712 }
14713
14714 /**
14715 * Transforms the vec3 with a mat3.
14716 *
14717 * @param {vec3} out the receiving vector
14718 * @param {vec3} a the vector to transform
14719 * @param {mat3} m the 3x3 matrix to transform with
14720 * @returns {vec3} out
14721 */
14722 function transformMat3(out, a, m) {
14723 var x = a[0],
14724 y = a[1],
14725 z = a[2];
14726 out[0] = x * m[0] + y * m[3] + z * m[6];
14727 out[1] = x * m[1] + y * m[4] + z * m[7];
14728 out[2] = x * m[2] + y * m[5] + z * m[8];
14729 return out;
14730 }
14731
14732 /**
14733 * Transforms the vec3 with a quat
14734 *
14735 * @param {vec3} out the receiving vector
14736 * @param {vec3} a the vector to transform
14737 * @param {quat} q quaternion to transform with
14738 * @returns {vec3} out
14739 */
14740 function transformQuat(out, a, q) {
14741 // benchmarks: http://jsperf.com/quaternion-transform-vec3-implementations
14742
14743 var x = a[0],
14744 y = a[1],
14745 z = a[2];
14746 var qx = q[0],
14747 qy = q[1],
14748 qz = q[2],
14749 qw = q[3];
14750
14751 // calculate quat * vec
14752 var ix = qw * x + qy * z - qz * y;
14753 var iy = qw * y + qz * x - qx * z;
14754 var iz = qw * z + qx * y - qy * x;
14755 var iw = -qx * x - qy * y - qz * z;
14756
14757 // calculate result * inverse quat
14758 out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;
14759 out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;
14760 out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;
14761 return out;
14762 }
14763
14764 /**
14765 * Rotate a 3D vector around the x-axis
14766 * @param {vec3} out The receiving vec3
14767 * @param {vec3} a The vec3 point to rotate
14768 * @param {vec3} b The origin of the rotation
14769 * @param {Number} c The angle of rotation
14770 * @returns {vec3} out
14771 */
14772 function rotateX(out, a, b, c) {
14773 var p = [],
14774 r = [];
14775 //Translate point to the origin
14776 p[0] = a[0] - b[0];
14777 p[1] = a[1] - b[1];
14778 p[2] = a[2] - b[2];
14779
14780 //perform rotation
14781 r[0] = p[0];
14782 r[1] = p[1] * Math.cos(c) - p[2] * Math.sin(c);
14783 r[2] = p[1] * Math.sin(c) + p[2] * Math.cos(c);
14784
14785 //translate to correct position
14786 out[0] = r[0] + b[0];
14787 out[1] = r[1] + b[1];
14788 out[2] = r[2] + b[2];
14789
14790 return out;
14791 }
14792
14793 /**
14794 * Rotate a 3D vector around the y-axis
14795 * @param {vec3} out The receiving vec3
14796 * @param {vec3} a The vec3 point to rotate
14797 * @param {vec3} b The origin of the rotation
14798 * @param {Number} c The angle of rotation
14799 * @returns {vec3} out
14800 */
14801 function rotateY(out, a, b, c) {
14802 var p = [],
14803 r = [];
14804 //Translate point to the origin
14805 p[0] = a[0] - b[0];
14806 p[1] = a[1] - b[1];
14807 p[2] = a[2] - b[2];
14808
14809 //perform rotation
14810 r[0] = p[2] * Math.sin(c) + p[0] * Math.cos(c);
14811 r[1] = p[1];
14812 r[2] = p[2] * Math.cos(c) - p[0] * Math.sin(c);
14813
14814 //translate to correct position
14815 out[0] = r[0] + b[0];
14816 out[1] = r[1] + b[1];
14817 out[2] = r[2] + b[2];
14818
14819 return out;
14820 }
14821
14822 /**
14823 * Rotate a 3D vector around the z-axis
14824 * @param {vec3} out The receiving vec3
14825 * @param {vec3} a The vec3 point to rotate
14826 * @param {vec3} b The origin of the rotation
14827 * @param {Number} c The angle of rotation
14828 * @returns {vec3} out
14829 */
14830 function rotateZ(out, a, b, c) {
14831 var p = [],
14832 r = [];
14833 //Translate point to the origin
14834 p[0] = a[0] - b[0];
14835 p[1] = a[1] - b[1];
14836 p[2] = a[2] - b[2];
14837
14838 //perform rotation
14839 r[0] = p[0] * Math.cos(c) - p[1] * Math.sin(c);
14840 r[1] = p[0] * Math.sin(c) + p[1] * Math.cos(c);
14841 r[2] = p[2];
14842
14843 //translate to correct position
14844 out[0] = r[0] + b[0];
14845 out[1] = r[1] + b[1];
14846 out[2] = r[2] + b[2];
14847
14848 return out;
14849 }
14850
14851 /**
14852 * Get the angle between two 3D vectors
14853 * @param {vec3} a The first operand
14854 * @param {vec3} b The second operand
14855 * @returns {Number} The angle in radians
14856 */
14857 function angle(a, b) {
14858 var tempA = fromValues(a[0], a[1], a[2]);
14859 var tempB = fromValues(b[0], b[1], b[2]);
14860
14861 normalize(tempA, tempA);
14862 normalize(tempB, tempB);
14863
14864 var cosine = dot(tempA, tempB);
14865
14866 if (cosine > 1.0) {
14867 return 0;
14868 } else if (cosine < -1.0) {
14869 return Math.PI;
14870 } else {
14871 return Math.acos(cosine);
14872 }
14873 }
14874
14875 /**
14876 * Returns a string representation of a vector
14877 *
14878 * @param {vec3} a vector to represent as a string
14879 * @returns {String} string representation of the vector
14880 */
14881 function str(a) {
14882 return 'vec3(' + a[0] + ', ' + a[1] + ', ' + a[2] + ')';
14883 }
14884
14885 /**
14886 * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===)
14887 *
14888 * @param {vec3} a The first vector.
14889 * @param {vec3} b The second vector.
14890 * @returns {Boolean} True if the vectors are equal, false otherwise.
14891 */
14892 function exactEquals(a, b) {
14893 return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];
14894 }
14895
14896 /**
14897 * Returns whether or not the vectors have approximately the same elements in the same position.
14898 *
14899 * @param {vec3} a The first vector.
14900 * @param {vec3} b The second vector.
14901 * @returns {Boolean} True if the vectors are equal, false otherwise.
14902 */
14903 function equals(a, b) {
14904 var a0 = a[0],
14905 a1 = a[1],
14906 a2 = a[2];
14907 var b0 = b[0],
14908 b1 = b[1],
14909 b2 = b[2];
14910 return Math.abs(a0 - b0) <= __WEBPACK_IMPORTED_MODULE_0__common__["b" /* EPSILON */] * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= __WEBPACK_IMPORTED_MODULE_0__common__["b" /* EPSILON */] * Math.max(1.0, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= __WEBPACK_IMPORTED_MODULE_0__common__["b" /* EPSILON */] * Math.max(1.0, Math.abs(a2), Math.abs(b2));
14911 }
14912
14913 /**
14914 * Alias for {@link vec3.subtract}
14915 * @function
14916 */
14917 var sub = subtract;
14918
14919 /**
14920 * Alias for {@link vec3.multiply}
14921 * @function
14922 */
14923 var mul = multiply;
14924
14925 /**
14926 * Alias for {@link vec3.divide}
14927 * @function
14928 */
14929 var div = divide;
14930
14931 /**
14932 * Alias for {@link vec3.distance}
14933 * @function
14934 */
14935 var dist = distance;
14936
14937 /**
14938 * Alias for {@link vec3.squaredDistance}
14939 * @function
14940 */
14941 var sqrDist = squaredDistance;
14942
14943 /**
14944 * Alias for {@link vec3.length}
14945 * @function
14946 */
14947 var len = length;
14948
14949 /**
14950 * Alias for {@link vec3.squaredLength}
14951 * @function
14952 */
14953 var sqrLen = squaredLength;
14954
14955 /**
14956 * Perform some operation over an array of vec3s.
14957 *
14958 * @param {Array} a the array of vectors to iterate over
14959 * @param {Number} stride Number of elements between the start of each vec3. If 0 assumes tightly packed
14960 * @param {Number} offset Number of elements to skip at the beginning of the array
14961 * @param {Number} count Number of vec3s to iterate over. If 0 iterates over entire array
14962 * @param {Function} fn Function to call for each vector in the array
14963 * @param {Object} [arg] additional argument to pass to fn
14964 * @returns {Array} a
14965 * @function
14966 */
14967 var forEach = function () {
14968 var vec = create();
14969
14970 return function (a, stride, offset, count, fn, arg) {
14971 var i = void 0,
14972 l = void 0;
14973 if (!stride) {
14974 stride = 3;
14975 }
14976
14977 if (!offset) {
14978 offset = 0;
14979 }
14980
14981 if (count) {
14982 l = Math.min(count * stride + offset, a.length);
14983 } else {
14984 l = a.length;
14985 }
14986
14987 for (i = offset; i < l; i += stride) {
14988 vec[0] = a[i];vec[1] = a[i + 1];vec[2] = a[i + 2];
14989 fn(vec, vec, arg);
14990 a[i] = vec[0];a[i + 1] = vec[1];a[i + 2] = vec[2];
14991 }
14992
14993 return a;
14994 };
14995 }();
14996
14997 /***/
14998 },
14999 /* 232 */
15000 /***/function (module, __webpack_exports__, __webpack_require__) {
15001
15002 "use strict";
15003
15004 Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
15005 /* harmony export (immutable) */__webpack_exports__["create"] = create;
15006 /* harmony export (immutable) */__webpack_exports__["clone"] = clone;
15007 /* harmony export (immutable) */__webpack_exports__["fromValues"] = fromValues;
15008 /* harmony export (immutable) */__webpack_exports__["copy"] = copy;
15009 /* harmony export (immutable) */__webpack_exports__["set"] = set;
15010 /* harmony export (immutable) */__webpack_exports__["add"] = add;
15011 /* harmony export (immutable) */__webpack_exports__["subtract"] = subtract;
15012 /* harmony export (immutable) */__webpack_exports__["multiply"] = multiply;
15013 /* harmony export (immutable) */__webpack_exports__["divide"] = divide;
15014 /* harmony export (immutable) */__webpack_exports__["ceil"] = ceil;
15015 /* harmony export (immutable) */__webpack_exports__["floor"] = floor;
15016 /* harmony export (immutable) */__webpack_exports__["min"] = min;
15017 /* harmony export (immutable) */__webpack_exports__["max"] = max;
15018 /* harmony export (immutable) */__webpack_exports__["round"] = round;
15019 /* harmony export (immutable) */__webpack_exports__["scale"] = scale;
15020 /* harmony export (immutable) */__webpack_exports__["scaleAndAdd"] = scaleAndAdd;
15021 /* harmony export (immutable) */__webpack_exports__["distance"] = distance;
15022 /* harmony export (immutable) */__webpack_exports__["squaredDistance"] = squaredDistance;
15023 /* harmony export (immutable) */__webpack_exports__["length"] = length;
15024 /* harmony export (immutable) */__webpack_exports__["squaredLength"] = squaredLength;
15025 /* harmony export (immutable) */__webpack_exports__["negate"] = negate;
15026 /* harmony export (immutable) */__webpack_exports__["inverse"] = inverse;
15027 /* harmony export (immutable) */__webpack_exports__["normalize"] = normalize;
15028 /* harmony export (immutable) */__webpack_exports__["dot"] = dot;
15029 /* harmony export (immutable) */__webpack_exports__["cross"] = cross;
15030 /* harmony export (immutable) */__webpack_exports__["lerp"] = lerp;
15031 /* harmony export (immutable) */__webpack_exports__["random"] = random;
15032 /* harmony export (immutable) */__webpack_exports__["transformMat2"] = transformMat2;
15033 /* harmony export (immutable) */__webpack_exports__["transformMat2d"] = transformMat2d;
15034 /* harmony export (immutable) */__webpack_exports__["transformMat3"] = transformMat3;
15035 /* harmony export (immutable) */__webpack_exports__["transformMat4"] = transformMat4;
15036 /* harmony export (immutable) */__webpack_exports__["str"] = str;
15037 /* harmony export (immutable) */__webpack_exports__["exactEquals"] = exactEquals;
15038 /* harmony export (immutable) */__webpack_exports__["equals"] = equals;
15039 /* harmony export (binding) */__webpack_require__.d(__webpack_exports__, "len", function () {
15040 return len;
15041 });
15042 /* harmony export (binding) */__webpack_require__.d(__webpack_exports__, "sub", function () {
15043 return sub;
15044 });
15045 /* harmony export (binding) */__webpack_require__.d(__webpack_exports__, "mul", function () {
15046 return mul;
15047 });
15048 /* harmony export (binding) */__webpack_require__.d(__webpack_exports__, "div", function () {
15049 return div;
15050 });
15051 /* harmony export (binding) */__webpack_require__.d(__webpack_exports__, "dist", function () {
15052 return dist;
15053 });
15054 /* harmony export (binding) */__webpack_require__.d(__webpack_exports__, "sqrDist", function () {
15055 return sqrDist;
15056 });
15057 /* harmony export (binding) */__webpack_require__.d(__webpack_exports__, "sqrLen", function () {
15058 return sqrLen;
15059 });
15060 /* harmony export (binding) */__webpack_require__.d(__webpack_exports__, "forEach", function () {
15061 return forEach;
15062 });
15063 /* harmony import */var __WEBPACK_IMPORTED_MODULE_0__common__ = __webpack_require__(45);
15064 /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.
15065
15066 Permission is hereby granted, free of charge, to any person obtaining a copy
15067 of this software and associated documentation files (the "Software"), to deal
15068 in the Software without restriction, including without limitation the rights
15069 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15070 copies of the Software, and to permit persons to whom the Software is
15071 furnished to do so, subject to the following conditions:
15072
15073 The above copyright notice and this permission notice shall be included in
15074 all copies or substantial portions of the Software.
15075
15076 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15077 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15078 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15079 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15080 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
15081 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
15082 THE SOFTWARE. */
15083
15084 /**
15085 * 2 Dimensional Vector
15086 * @module vec2
15087 */
15088
15089 /**
15090 * Creates a new, empty vec2
15091 *
15092 * @returns {vec2} a new 2D vector
15093 */
15094 function create() {
15095 var out = new __WEBPACK_IMPORTED_MODULE_0__common__["a" /* ARRAY_TYPE */](2);
15096 out[0] = 0;
15097 out[1] = 0;
15098 return out;
15099 }
15100
15101 /**
15102 * Creates a new vec2 initialized with values from an existing vector
15103 *
15104 * @param {vec2} a vector to clone
15105 * @returns {vec2} a new 2D vector
15106 */
15107 function clone(a) {
15108 var out = new __WEBPACK_IMPORTED_MODULE_0__common__["a" /* ARRAY_TYPE */](2);
15109 out[0] = a[0];
15110 out[1] = a[1];
15111 return out;
15112 }
15113
15114 /**
15115 * Creates a new vec2 initialized with the given values
15116 *
15117 * @param {Number} x X component
15118 * @param {Number} y Y component
15119 * @returns {vec2} a new 2D vector
15120 */
15121 function fromValues(x, y) {
15122 var out = new __WEBPACK_IMPORTED_MODULE_0__common__["a" /* ARRAY_TYPE */](2);
15123 out[0] = x;
15124 out[1] = y;
15125 return out;
15126 }
15127
15128 /**
15129 * Copy the values from one vec2 to another
15130 *
15131 * @param {vec2} out the receiving vector
15132 * @param {vec2} a the source vector
15133 * @returns {vec2} out
15134 */
15135 function copy(out, a) {
15136 out[0] = a[0];
15137 out[1] = a[1];
15138 return out;
15139 }
15140
15141 /**
15142 * Set the components of a vec2 to the given values
15143 *
15144 * @param {vec2} out the receiving vector
15145 * @param {Number} x X component
15146 * @param {Number} y Y component
15147 * @returns {vec2} out
15148 */
15149 function set(out, x, y) {
15150 out[0] = x;
15151 out[1] = y;
15152 return out;
15153 }
15154
15155 /**
15156 * Adds two vec2's
15157 *
15158 * @param {vec2} out the receiving vector
15159 * @param {vec2} a the first operand
15160 * @param {vec2} b the second operand
15161 * @returns {vec2} out
15162 */
15163 function add(out, a, b) {
15164 out[0] = a[0] + b[0];
15165 out[1] = a[1] + b[1];
15166 return out;
15167 }
15168
15169 /**
15170 * Subtracts vector b from vector a
15171 *
15172 * @param {vec2} out the receiving vector
15173 * @param {vec2} a the first operand
15174 * @param {vec2} b the second operand
15175 * @returns {vec2} out
15176 */
15177 function subtract(out, a, b) {
15178 out[0] = a[0] - b[0];
15179 out[1] = a[1] - b[1];
15180 return out;
15181 }
15182
15183 /**
15184 * Multiplies two vec2's
15185 *
15186 * @param {vec2} out the receiving vector
15187 * @param {vec2} a the first operand
15188 * @param {vec2} b the second operand
15189 * @returns {vec2} out
15190 */
15191 function multiply(out, a, b) {
15192 out[0] = a[0] * b[0];
15193 out[1] = a[1] * b[1];
15194 return out;
15195 };
15196
15197 /**
15198 * Divides two vec2's
15199 *
15200 * @param {vec2} out the receiving vector
15201 * @param {vec2} a the first operand
15202 * @param {vec2} b the second operand
15203 * @returns {vec2} out
15204 */
15205 function divide(out, a, b) {
15206 out[0] = a[0] / b[0];
15207 out[1] = a[1] / b[1];
15208 return out;
15209 };
15210
15211 /**
15212 * Math.ceil the components of a vec2
15213 *
15214 * @param {vec2} out the receiving vector
15215 * @param {vec2} a vector to ceil
15216 * @returns {vec2} out
15217 */
15218 function ceil(out, a) {
15219 out[0] = Math.ceil(a[0]);
15220 out[1] = Math.ceil(a[1]);
15221 return out;
15222 };
15223
15224 /**
15225 * Math.floor the components of a vec2
15226 *
15227 * @param {vec2} out the receiving vector
15228 * @param {vec2} a vector to floor
15229 * @returns {vec2} out
15230 */
15231 function floor(out, a) {
15232 out[0] = Math.floor(a[0]);
15233 out[1] = Math.floor(a[1]);
15234 return out;
15235 };
15236
15237 /**
15238 * Returns the minimum of two vec2's
15239 *
15240 * @param {vec2} out the receiving vector
15241 * @param {vec2} a the first operand
15242 * @param {vec2} b the second operand
15243 * @returns {vec2} out
15244 */
15245 function min(out, a, b) {
15246 out[0] = Math.min(a[0], b[0]);
15247 out[1] = Math.min(a[1], b[1]);
15248 return out;
15249 };
15250
15251 /**
15252 * Returns the maximum of two vec2's
15253 *
15254 * @param {vec2} out the receiving vector
15255 * @param {vec2} a the first operand
15256 * @param {vec2} b the second operand
15257 * @returns {vec2} out
15258 */
15259 function max(out, a, b) {
15260 out[0] = Math.max(a[0], b[0]);
15261 out[1] = Math.max(a[1], b[1]);
15262 return out;
15263 };
15264
15265 /**
15266 * Math.round the components of a vec2
15267 *
15268 * @param {vec2} out the receiving vector
15269 * @param {vec2} a vector to round
15270 * @returns {vec2} out
15271 */
15272 function round(out, a) {
15273 out[0] = Math.round(a[0]);
15274 out[1] = Math.round(a[1]);
15275 return out;
15276 };
15277
15278 /**
15279 * Scales a vec2 by a scalar number
15280 *
15281 * @param {vec2} out the receiving vector
15282 * @param {vec2} a the vector to scale
15283 * @param {Number} b amount to scale the vector by
15284 * @returns {vec2} out
15285 */
15286 function scale(out, a, b) {
15287 out[0] = a[0] * b;
15288 out[1] = a[1] * b;
15289 return out;
15290 };
15291
15292 /**
15293 * Adds two vec2's after scaling the second operand by a scalar value
15294 *
15295 * @param {vec2} out the receiving vector
15296 * @param {vec2} a the first operand
15297 * @param {vec2} b the second operand
15298 * @param {Number} scale the amount to scale b by before adding
15299 * @returns {vec2} out
15300 */
15301 function scaleAndAdd(out, a, b, scale) {
15302 out[0] = a[0] + b[0] * scale;
15303 out[1] = a[1] + b[1] * scale;
15304 return out;
15305 };
15306
15307 /**
15308 * Calculates the euclidian distance between two vec2's
15309 *
15310 * @param {vec2} a the first operand
15311 * @param {vec2} b the second operand
15312 * @returns {Number} distance between a and b
15313 */
15314 function distance(a, b) {
15315 var x = b[0] - a[0],
15316 y = b[1] - a[1];
15317 return Math.sqrt(x * x + y * y);
15318 };
15319
15320 /**
15321 * Calculates the squared euclidian distance between two vec2's
15322 *
15323 * @param {vec2} a the first operand
15324 * @param {vec2} b the second operand
15325 * @returns {Number} squared distance between a and b
15326 */
15327 function squaredDistance(a, b) {
15328 var x = b[0] - a[0],
15329 y = b[1] - a[1];
15330 return x * x + y * y;
15331 };
15332
15333 /**
15334 * Calculates the length of a vec2
15335 *
15336 * @param {vec2} a vector to calculate length of
15337 * @returns {Number} length of a
15338 */
15339 function length(a) {
15340 var x = a[0],
15341 y = a[1];
15342 return Math.sqrt(x * x + y * y);
15343 };
15344
15345 /**
15346 * Calculates the squared length of a vec2
15347 *
15348 * @param {vec2} a vector to calculate squared length of
15349 * @returns {Number} squared length of a
15350 */
15351 function squaredLength(a) {
15352 var x = a[0],
15353 y = a[1];
15354 return x * x + y * y;
15355 };
15356
15357 /**
15358 * Negates the components of a vec2
15359 *
15360 * @param {vec2} out the receiving vector
15361 * @param {vec2} a vector to negate
15362 * @returns {vec2} out
15363 */
15364 function negate(out, a) {
15365 out[0] = -a[0];
15366 out[1] = -a[1];
15367 return out;
15368 };
15369
15370 /**
15371 * Returns the inverse of the components of a vec2
15372 *
15373 * @param {vec2} out the receiving vector
15374 * @param {vec2} a vector to invert
15375 * @returns {vec2} out
15376 */
15377 function inverse(out, a) {
15378 out[0] = 1.0 / a[0];
15379 out[1] = 1.0 / a[1];
15380 return out;
15381 };
15382
15383 /**
15384 * Normalize a vec2
15385 *
15386 * @param {vec2} out the receiving vector
15387 * @param {vec2} a vector to normalize
15388 * @returns {vec2} out
15389 */
15390 function normalize(out, a) {
15391 var x = a[0],
15392 y = a[1];
15393 var len = x * x + y * y;
15394 if (len > 0) {
15395 //TODO: evaluate use of glm_invsqrt here?
15396 len = 1 / Math.sqrt(len);
15397 out[0] = a[0] * len;
15398 out[1] = a[1] * len;
15399 }
15400 return out;
15401 };
15402
15403 /**
15404 * Calculates the dot product of two vec2's
15405 *
15406 * @param {vec2} a the first operand
15407 * @param {vec2} b the second operand
15408 * @returns {Number} dot product of a and b
15409 */
15410 function dot(a, b) {
15411 return a[0] * b[0] + a[1] * b[1];
15412 };
15413
15414 /**
15415 * Computes the cross product of two vec2's
15416 * Note that the cross product must by definition produce a 3D vector
15417 *
15418 * @param {vec3} out the receiving vector
15419 * @param {vec2} a the first operand
15420 * @param {vec2} b the second operand
15421 * @returns {vec3} out
15422 */
15423 function cross(out, a, b) {
15424 var z = a[0] * b[1] - a[1] * b[0];
15425 out[0] = out[1] = 0;
15426 out[2] = z;
15427 return out;
15428 };
15429
15430 /**
15431 * Performs a linear interpolation between two vec2's
15432 *
15433 * @param {vec2} out the receiving vector
15434 * @param {vec2} a the first operand
15435 * @param {vec2} b the second operand
15436 * @param {Number} t interpolation amount between the two inputs
15437 * @returns {vec2} out
15438 */
15439 function lerp(out, a, b, t) {
15440 var ax = a[0],
15441 ay = a[1];
15442 out[0] = ax + t * (b[0] - ax);
15443 out[1] = ay + t * (b[1] - ay);
15444 return out;
15445 };
15446
15447 /**
15448 * Generates a random vector with the given scale
15449 *
15450 * @param {vec2} out the receiving vector
15451 * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned
15452 * @returns {vec2} out
15453 */
15454 function random(out, scale) {
15455 scale = scale || 1.0;
15456 var r = __WEBPACK_IMPORTED_MODULE_0__common__["c" /* RANDOM */]() * 2.0 * Math.PI;
15457 out[0] = Math.cos(r) * scale;
15458 out[1] = Math.sin(r) * scale;
15459 return out;
15460 };
15461
15462 /**
15463 * Transforms the vec2 with a mat2
15464 *
15465 * @param {vec2} out the receiving vector
15466 * @param {vec2} a the vector to transform
15467 * @param {mat2} m matrix to transform with
15468 * @returns {vec2} out
15469 */
15470 function transformMat2(out, a, m) {
15471 var x = a[0],
15472 y = a[1];
15473 out[0] = m[0] * x + m[2] * y;
15474 out[1] = m[1] * x + m[3] * y;
15475 return out;
15476 };
15477
15478 /**
15479 * Transforms the vec2 with a mat2d
15480 *
15481 * @param {vec2} out the receiving vector
15482 * @param {vec2} a the vector to transform
15483 * @param {mat2d} m matrix to transform with
15484 * @returns {vec2} out
15485 */
15486 function transformMat2d(out, a, m) {
15487 var x = a[0],
15488 y = a[1];
15489 out[0] = m[0] * x + m[2] * y + m[4];
15490 out[1] = m[1] * x + m[3] * y + m[5];
15491 return out;
15492 };
15493
15494 /**
15495 * Transforms the vec2 with a mat3
15496 * 3rd vector component is implicitly '1'
15497 *
15498 * @param {vec2} out the receiving vector
15499 * @param {vec2} a the vector to transform
15500 * @param {mat3} m matrix to transform with
15501 * @returns {vec2} out
15502 */
15503 function transformMat3(out, a, m) {
15504 var x = a[0],
15505 y = a[1];
15506 out[0] = m[0] * x + m[3] * y + m[6];
15507 out[1] = m[1] * x + m[4] * y + m[7];
15508 return out;
15509 };
15510
15511 /**
15512 * Transforms the vec2 with a mat4
15513 * 3rd vector component is implicitly '0'
15514 * 4th vector component is implicitly '1'
15515 *
15516 * @param {vec2} out the receiving vector
15517 * @param {vec2} a the vector to transform
15518 * @param {mat4} m matrix to transform with
15519 * @returns {vec2} out
15520 */
15521 function transformMat4(out, a, m) {
15522 var x = a[0];
15523 var y = a[1];
15524 out[0] = m[0] * x + m[4] * y + m[12];
15525 out[1] = m[1] * x + m[5] * y + m[13];
15526 return out;
15527 }
15528
15529 /**
15530 * Returns a string representation of a vector
15531 *
15532 * @param {vec2} a vector to represent as a string
15533 * @returns {String} string representation of the vector
15534 */
15535 function str(a) {
15536 return 'vec2(' + a[0] + ', ' + a[1] + ')';
15537 }
15538
15539 /**
15540 * Returns whether or not the vectors exactly have the same elements in the same position (when compared with ===)
15541 *
15542 * @param {vec2} a The first vector.
15543 * @param {vec2} b The second vector.
15544 * @returns {Boolean} True if the vectors are equal, false otherwise.
15545 */
15546 function exactEquals(a, b) {
15547 return a[0] === b[0] && a[1] === b[1];
15548 }
15549
15550 /**
15551 * Returns whether or not the vectors have approximately the same elements in the same position.
15552 *
15553 * @param {vec2} a The first vector.
15554 * @param {vec2} b The second vector.
15555 * @returns {Boolean} True if the vectors are equal, false otherwise.
15556 */
15557 function equals(a, b) {
15558 var a0 = a[0],
15559 a1 = a[1];
15560 var b0 = b[0],
15561 b1 = b[1];
15562 return Math.abs(a0 - b0) <= __WEBPACK_IMPORTED_MODULE_0__common__["b" /* EPSILON */] * Math.max(1.0, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= __WEBPACK_IMPORTED_MODULE_0__common__["b" /* EPSILON */] * Math.max(1.0, Math.abs(a1), Math.abs(b1));
15563 }
15564
15565 /**
15566 * Alias for {@link vec2.length}
15567 * @function
15568 */
15569 var len = length;
15570
15571 /**
15572 * Alias for {@link vec2.subtract}
15573 * @function
15574 */
15575 var sub = subtract;
15576
15577 /**
15578 * Alias for {@link vec2.multiply}
15579 * @function
15580 */
15581 var mul = multiply;
15582
15583 /**
15584 * Alias for {@link vec2.divide}
15585 * @function
15586 */
15587 var div = divide;
15588
15589 /**
15590 * Alias for {@link vec2.distance}
15591 * @function
15592 */
15593 var dist = distance;
15594
15595 /**
15596 * Alias for {@link vec2.squaredDistance}
15597 * @function
15598 */
15599 var sqrDist = squaredDistance;
15600
15601 /**
15602 * Alias for {@link vec2.squaredLength}
15603 * @function
15604 */
15605 var sqrLen = squaredLength;
15606
15607 /**
15608 * Perform some operation over an array of vec2s.
15609 *
15610 * @param {Array} a the array of vectors to iterate over
15611 * @param {Number} stride Number of elements between the start of each vec2. If 0 assumes tightly packed
15612 * @param {Number} offset Number of elements to skip at the beginning of the array
15613 * @param {Number} count Number of vec2s to iterate over. If 0 iterates over entire array
15614 * @param {Function} fn Function to call for each vector in the array
15615 * @param {Object} [arg] additional argument to pass to fn
15616 * @returns {Array} a
15617 * @function
15618 */
15619 var forEach = function () {
15620 var vec = create();
15621
15622 return function (a, stride, offset, count, fn, arg) {
15623 var i = void 0,
15624 l = void 0;
15625 if (!stride) {
15626 stride = 2;
15627 }
15628
15629 if (!offset) {
15630 offset = 0;
15631 }
15632
15633 if (count) {
15634 l = Math.min(count * stride + offset, a.length);
15635 } else {
15636 l = a.length;
15637 }
15638
15639 for (i = offset; i < l; i += stride) {
15640 vec[0] = a[i];vec[1] = a[i + 1];
15641 fn(vec, vec, arg);
15642 a[i] = vec[0];a[i + 1] = vec[1];
15643 }
15644
15645 return a;
15646 };
15647 }();
15648
15649 /***/
15650 },
15651 /* 233 */
15652 /***/function (module, exports, __webpack_require__) {
15653
15654 var MatrixUtil = __webpack_require__(3);
15655 var PathUtil = __webpack_require__(46);
15656 var Util = __webpack_require__(0);
15657 var d3Ease = __webpack_require__(234);
15658 var d3Timer = __webpack_require__(245);
15659
15660 var _require = __webpack_require__(248),
15661 interpolate = _require.interpolate,
15662 interpolateArray = _require.interpolateArray; // 目前整体动画只需要数值和数组的差值计算
15663
15664 module.exports = {
15665 /**
15666 * 执行动画
15667 * @param {Object} toProps 动画最终状态
15668 * @param {Number} duration 动画执行时间
15669 * @param {String} easing 动画缓动效果
15670 * @param {Function} callback 动画执行后的回调
15671 * @param {Number} delay 动画延迟时间
15672 */
15673 animate: function animate(toProps, duration, easing, callback) {
15674 var delay = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
15675
15676 var self = this;
15677 var canvas = self.get('canvas');
15678 var formatProps = getFormatProps(toProps);
15679 var toAttrs = formatProps.attrs;
15680 var toM = formatProps.M;
15681 var fromAttrs = getfromAttrs(toAttrs);
15682 var fromM = Util.clone(self.getMatrix());
15683 easing = easing ? easing : 'easeLinear';
15684
15685 self.setSilent('animating', true); // 处于动画状态
15686 // 执行动画
15687 var timer = d3Timer.timer(function (elapsed) {
15688 var ratio = elapsed / duration;
15689 if (ratio < 1) {
15690 ratio = d3Ease[easing](ratio);
15691 update(ratio);
15692 } else {
15693 update(1); // 保证最后一帧的绘制
15694 callback && callback();
15695 self.setSilent('animating', false); // 动画停止
15696 timer.stop();
15697 }
15698 }, delay);
15699
15700 function update(ratio) {
15701 var cProps = {}; // 此刻属性
15702 if (self.get('destroyed')) {
15703 return;
15704 }
15705 var interf = void 0; // 差值函数
15706
15707 for (var k in toAttrs) {
15708 if (!Util.isEqual(fromAttrs[k], toAttrs[k])) {
15709 if (k === 'path') {
15710 var toPath = PathUtil.parsePathString(toAttrs[k]); // 终点状态
15711 var fromPath = PathUtil.parsePathString(fromAttrs[k]); // 起始状态
15712 cProps[k] = [];
15713 for (var i = 0; i < toPath.length; i++) {
15714 var toPathPoint = toPath[i];
15715 var fromPathPoint = fromPath[i];
15716 var cPathPoint = [];
15717 for (var j = 0; j < toPathPoint.length; j++) {
15718 if (Util.isNumber(toPathPoint[j]) && fromPathPoint) {
15719 interf = interpolate(fromPathPoint[j], toPathPoint[j]);
15720 cPathPoint.push(interf(ratio));
15721 } else {
15722 cPathPoint.push(toPathPoint[j]);
15723 }
15724 }
15725 cProps[k].push(cPathPoint);
15726 }
15727 } else {
15728 interf = interpolate(fromAttrs[k], toAttrs[k]);
15729 cProps[k] = interf(ratio);
15730 }
15731 }
15732 }
15733 if (toM) {
15734 var mf = interpolateArray(fromM, toM);
15735 var cM = mf(ratio);
15736 self.setMatrix(cM);
15737 }
15738 self.attr(cProps);
15739 canvas.draw();
15740 }
15741
15742 function getFormatProps(props) {
15743 var rst = {
15744 M: null,
15745 attrs: {}
15746 };
15747 for (var k in props) {
15748 if (k === 'transform') {
15749 rst.M = MatrixUtil.transform(self.getMatrix(), props[k]);
15750 } else if (k === 'matrix') {
15751 rst.M = props[k];
15752 } else {
15753 rst.attrs[k] = props[k];
15754 }
15755 }
15756 return rst;
15757 }
15758
15759 function getfromAttrs(toAttrs) {
15760 var rst = {};
15761 for (var k in toAttrs) {
15762 rst[k] = self.attr(k);
15763 }
15764 return rst;
15765 }
15766 }
15767 };
15768
15769 /***/
15770 },
15771 /* 234 */
15772 /***/function (module, __webpack_exports__, __webpack_require__) {
15773
15774 "use strict";
15775
15776 Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
15777 /* harmony import */var __WEBPACK_IMPORTED_MODULE_0__src_linear__ = __webpack_require__(235);
15778 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "easeLinear", function () {
15779 return __WEBPACK_IMPORTED_MODULE_0__src_linear__["a"];
15780 });
15781 /* harmony import */var __WEBPACK_IMPORTED_MODULE_1__src_quad__ = __webpack_require__(236);
15782 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "easeQuad", function () {
15783 return __WEBPACK_IMPORTED_MODULE_1__src_quad__["b"];
15784 });
15785 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "easeQuadIn", function () {
15786 return __WEBPACK_IMPORTED_MODULE_1__src_quad__["a"];
15787 });
15788 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "easeQuadOut", function () {
15789 return __WEBPACK_IMPORTED_MODULE_1__src_quad__["c"];
15790 });
15791 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "easeQuadInOut", function () {
15792 return __WEBPACK_IMPORTED_MODULE_1__src_quad__["b"];
15793 });
15794 /* harmony import */var __WEBPACK_IMPORTED_MODULE_2__src_cubic__ = __webpack_require__(237);
15795 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "easeCubic", function () {
15796 return __WEBPACK_IMPORTED_MODULE_2__src_cubic__["b"];
15797 });
15798 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "easeCubicIn", function () {
15799 return __WEBPACK_IMPORTED_MODULE_2__src_cubic__["a"];
15800 });
15801 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "easeCubicOut", function () {
15802 return __WEBPACK_IMPORTED_MODULE_2__src_cubic__["c"];
15803 });
15804 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "easeCubicInOut", function () {
15805 return __WEBPACK_IMPORTED_MODULE_2__src_cubic__["b"];
15806 });
15807 /* harmony import */var __WEBPACK_IMPORTED_MODULE_3__src_poly__ = __webpack_require__(238);
15808 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "easePoly", function () {
15809 return __WEBPACK_IMPORTED_MODULE_3__src_poly__["b"];
15810 });
15811 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "easePolyIn", function () {
15812 return __WEBPACK_IMPORTED_MODULE_3__src_poly__["a"];
15813 });
15814 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "easePolyOut", function () {
15815 return __WEBPACK_IMPORTED_MODULE_3__src_poly__["c"];
15816 });
15817 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "easePolyInOut", function () {
15818 return __WEBPACK_IMPORTED_MODULE_3__src_poly__["b"];
15819 });
15820 /* harmony import */var __WEBPACK_IMPORTED_MODULE_4__src_sin__ = __webpack_require__(239);
15821 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "easeSin", function () {
15822 return __WEBPACK_IMPORTED_MODULE_4__src_sin__["b"];
15823 });
15824 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "easeSinIn", function () {
15825 return __WEBPACK_IMPORTED_MODULE_4__src_sin__["a"];
15826 });
15827 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "easeSinOut", function () {
15828 return __WEBPACK_IMPORTED_MODULE_4__src_sin__["c"];
15829 });
15830 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "easeSinInOut", function () {
15831 return __WEBPACK_IMPORTED_MODULE_4__src_sin__["b"];
15832 });
15833 /* harmony import */var __WEBPACK_IMPORTED_MODULE_5__src_exp__ = __webpack_require__(240);
15834 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "easeExp", function () {
15835 return __WEBPACK_IMPORTED_MODULE_5__src_exp__["b"];
15836 });
15837 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "easeExpIn", function () {
15838 return __WEBPACK_IMPORTED_MODULE_5__src_exp__["a"];
15839 });
15840 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "easeExpOut", function () {
15841 return __WEBPACK_IMPORTED_MODULE_5__src_exp__["c"];
15842 });
15843 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "easeExpInOut", function () {
15844 return __WEBPACK_IMPORTED_MODULE_5__src_exp__["b"];
15845 });
15846 /* harmony import */var __WEBPACK_IMPORTED_MODULE_6__src_circle__ = __webpack_require__(241);
15847 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "easeCircle", function () {
15848 return __WEBPACK_IMPORTED_MODULE_6__src_circle__["b"];
15849 });
15850 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "easeCircleIn", function () {
15851 return __WEBPACK_IMPORTED_MODULE_6__src_circle__["a"];
15852 });
15853 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "easeCircleOut", function () {
15854 return __WEBPACK_IMPORTED_MODULE_6__src_circle__["c"];
15855 });
15856 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "easeCircleInOut", function () {
15857 return __WEBPACK_IMPORTED_MODULE_6__src_circle__["b"];
15858 });
15859 /* harmony import */var __WEBPACK_IMPORTED_MODULE_7__src_bounce__ = __webpack_require__(242);
15860 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "easeBounce", function () {
15861 return __WEBPACK_IMPORTED_MODULE_7__src_bounce__["c"];
15862 });
15863 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "easeBounceIn", function () {
15864 return __WEBPACK_IMPORTED_MODULE_7__src_bounce__["a"];
15865 });
15866 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "easeBounceOut", function () {
15867 return __WEBPACK_IMPORTED_MODULE_7__src_bounce__["c"];
15868 });
15869 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "easeBounceInOut", function () {
15870 return __WEBPACK_IMPORTED_MODULE_7__src_bounce__["b"];
15871 });
15872 /* harmony import */var __WEBPACK_IMPORTED_MODULE_8__src_back__ = __webpack_require__(243);
15873 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "easeBack", function () {
15874 return __WEBPACK_IMPORTED_MODULE_8__src_back__["b"];
15875 });
15876 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "easeBackIn", function () {
15877 return __WEBPACK_IMPORTED_MODULE_8__src_back__["a"];
15878 });
15879 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "easeBackOut", function () {
15880 return __WEBPACK_IMPORTED_MODULE_8__src_back__["c"];
15881 });
15882 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "easeBackInOut", function () {
15883 return __WEBPACK_IMPORTED_MODULE_8__src_back__["b"];
15884 });
15885 /* harmony import */var __WEBPACK_IMPORTED_MODULE_9__src_elastic__ = __webpack_require__(244);
15886 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "easeElastic", function () {
15887 return __WEBPACK_IMPORTED_MODULE_9__src_elastic__["c"];
15888 });
15889 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "easeElasticIn", function () {
15890 return __WEBPACK_IMPORTED_MODULE_9__src_elastic__["a"];
15891 });
15892 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "easeElasticOut", function () {
15893 return __WEBPACK_IMPORTED_MODULE_9__src_elastic__["c"];
15894 });
15895 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "easeElasticInOut", function () {
15896 return __WEBPACK_IMPORTED_MODULE_9__src_elastic__["b"];
15897 });
15898
15899 /***/
15900 },
15901 /* 235 */
15902 /***/function (module, __webpack_exports__, __webpack_require__) {
15903
15904 "use strict";
15905 /* harmony export (immutable) */
15906 __webpack_exports__["a"] = linear;
15907 function linear(t) {
15908 return +t;
15909 }
15910
15911 /***/
15912 },
15913 /* 236 */
15914 /***/function (module, __webpack_exports__, __webpack_require__) {
15915
15916 "use strict";
15917 /* harmony export (immutable) */
15918 __webpack_exports__["a"] = quadIn;
15919 /* harmony export (immutable) */__webpack_exports__["c"] = quadOut;
15920 /* harmony export (immutable) */__webpack_exports__["b"] = quadInOut;
15921 function quadIn(t) {
15922 return t * t;
15923 }
15924
15925 function quadOut(t) {
15926 return t * (2 - t);
15927 }
15928
15929 function quadInOut(t) {
15930 return ((t *= 2) <= 1 ? t * t : --t * (2 - t) + 1) / 2;
15931 }
15932
15933 /***/
15934 },
15935 /* 237 */
15936 /***/function (module, __webpack_exports__, __webpack_require__) {
15937
15938 "use strict";
15939 /* harmony export (immutable) */
15940 __webpack_exports__["a"] = cubicIn;
15941 /* harmony export (immutable) */__webpack_exports__["c"] = cubicOut;
15942 /* harmony export (immutable) */__webpack_exports__["b"] = cubicInOut;
15943 function cubicIn(t) {
15944 return t * t * t;
15945 }
15946
15947 function cubicOut(t) {
15948 return --t * t * t + 1;
15949 }
15950
15951 function cubicInOut(t) {
15952 return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2;
15953 }
15954
15955 /***/
15956 },
15957 /* 238 */
15958 /***/function (module, __webpack_exports__, __webpack_require__) {
15959
15960 "use strict";
15961 /* harmony export (binding) */
15962 __webpack_require__.d(__webpack_exports__, "a", function () {
15963 return polyIn;
15964 });
15965 /* harmony export (binding) */__webpack_require__.d(__webpack_exports__, "c", function () {
15966 return polyOut;
15967 });
15968 /* harmony export (binding) */__webpack_require__.d(__webpack_exports__, "b", function () {
15969 return polyInOut;
15970 });
15971 var exponent = 3;
15972
15973 var polyIn = function custom(e) {
15974 e = +e;
15975
15976 function polyIn(t) {
15977 return Math.pow(t, e);
15978 }
15979
15980 polyIn.exponent = custom;
15981
15982 return polyIn;
15983 }(exponent);
15984
15985 var polyOut = function custom(e) {
15986 e = +e;
15987
15988 function polyOut(t) {
15989 return 1 - Math.pow(1 - t, e);
15990 }
15991
15992 polyOut.exponent = custom;
15993
15994 return polyOut;
15995 }(exponent);
15996
15997 var polyInOut = function custom(e) {
15998 e = +e;
15999
16000 function polyInOut(t) {
16001 return ((t *= 2) <= 1 ? Math.pow(t, e) : 2 - Math.pow(2 - t, e)) / 2;
16002 }
16003
16004 polyInOut.exponent = custom;
16005
16006 return polyInOut;
16007 }(exponent);
16008
16009 /***/
16010 },
16011 /* 239 */
16012 /***/function (module, __webpack_exports__, __webpack_require__) {
16013
16014 "use strict";
16015 /* harmony export (immutable) */
16016 __webpack_exports__["a"] = sinIn;
16017 /* harmony export (immutable) */__webpack_exports__["c"] = sinOut;
16018 /* harmony export (immutable) */__webpack_exports__["b"] = sinInOut;
16019 var pi = Math.PI,
16020 halfPi = pi / 2;
16021
16022 function sinIn(t) {
16023 return 1 - Math.cos(t * halfPi);
16024 }
16025
16026 function sinOut(t) {
16027 return Math.sin(t * halfPi);
16028 }
16029
16030 function sinInOut(t) {
16031 return (1 - Math.cos(pi * t)) / 2;
16032 }
16033
16034 /***/
16035 },
16036 /* 240 */
16037 /***/function (module, __webpack_exports__, __webpack_require__) {
16038
16039 "use strict";
16040 /* harmony export (immutable) */
16041 __webpack_exports__["a"] = expIn;
16042 /* harmony export (immutable) */__webpack_exports__["c"] = expOut;
16043 /* harmony export (immutable) */__webpack_exports__["b"] = expInOut;
16044 function expIn(t) {
16045 return Math.pow(2, 10 * t - 10);
16046 }
16047
16048 function expOut(t) {
16049 return 1 - Math.pow(2, -10 * t);
16050 }
16051
16052 function expInOut(t) {
16053 return ((t *= 2) <= 1 ? Math.pow(2, 10 * t - 10) : 2 - Math.pow(2, 10 - 10 * t)) / 2;
16054 }
16055
16056 /***/
16057 },
16058 /* 241 */
16059 /***/function (module, __webpack_exports__, __webpack_require__) {
16060
16061 "use strict";
16062 /* harmony export (immutable) */
16063 __webpack_exports__["a"] = circleIn;
16064 /* harmony export (immutable) */__webpack_exports__["c"] = circleOut;
16065 /* harmony export (immutable) */__webpack_exports__["b"] = circleInOut;
16066 function circleIn(t) {
16067 return 1 - Math.sqrt(1 - t * t);
16068 }
16069
16070 function circleOut(t) {
16071 return Math.sqrt(1 - --t * t);
16072 }
16073
16074 function circleInOut(t) {
16075 return ((t *= 2) <= 1 ? 1 - Math.sqrt(1 - t * t) : Math.sqrt(1 - (t -= 2) * t) + 1) / 2;
16076 }
16077
16078 /***/
16079 },
16080 /* 242 */
16081 /***/function (module, __webpack_exports__, __webpack_require__) {
16082
16083 "use strict";
16084 /* harmony export (immutable) */
16085 __webpack_exports__["a"] = bounceIn;
16086 /* harmony export (immutable) */__webpack_exports__["c"] = bounceOut;
16087 /* harmony export (immutable) */__webpack_exports__["b"] = bounceInOut;
16088 var b1 = 4 / 11,
16089 b2 = 6 / 11,
16090 b3 = 8 / 11,
16091 b4 = 3 / 4,
16092 b5 = 9 / 11,
16093 b6 = 10 / 11,
16094 b7 = 15 / 16,
16095 b8 = 21 / 22,
16096 b9 = 63 / 64,
16097 b0 = 1 / b1 / b1;
16098
16099 function bounceIn(t) {
16100 return 1 - bounceOut(1 - t);
16101 }
16102
16103 function bounceOut(t) {
16104 return (t = +t) < b1 ? b0 * t * t : t < b3 ? b0 * (t -= b2) * t + b4 : t < b6 ? b0 * (t -= b5) * t + b7 : b0 * (t -= b8) * t + b9;
16105 }
16106
16107 function bounceInOut(t) {
16108 return ((t *= 2) <= 1 ? 1 - bounceOut(1 - t) : bounceOut(t - 1) + 1) / 2;
16109 }
16110
16111 /***/
16112 },
16113 /* 243 */
16114 /***/function (module, __webpack_exports__, __webpack_require__) {
16115
16116 "use strict";
16117 /* harmony export (binding) */
16118 __webpack_require__.d(__webpack_exports__, "a", function () {
16119 return backIn;
16120 });
16121 /* harmony export (binding) */__webpack_require__.d(__webpack_exports__, "c", function () {
16122 return backOut;
16123 });
16124 /* harmony export (binding) */__webpack_require__.d(__webpack_exports__, "b", function () {
16125 return backInOut;
16126 });
16127 var overshoot = 1.70158;
16128
16129 var backIn = function custom(s) {
16130 s = +s;
16131
16132 function backIn(t) {
16133 return t * t * ((s + 1) * t - s);
16134 }
16135
16136 backIn.overshoot = custom;
16137
16138 return backIn;
16139 }(overshoot);
16140
16141 var backOut = function custom(s) {
16142 s = +s;
16143
16144 function backOut(t) {
16145 return --t * t * ((s + 1) * t + s) + 1;
16146 }
16147
16148 backOut.overshoot = custom;
16149
16150 return backOut;
16151 }(overshoot);
16152
16153 var backInOut = function custom(s) {
16154 s = +s;
16155
16156 function backInOut(t) {
16157 return ((t *= 2) < 1 ? t * t * ((s + 1) * t - s) : (t -= 2) * t * ((s + 1) * t + s) + 2) / 2;
16158 }
16159
16160 backInOut.overshoot = custom;
16161
16162 return backInOut;
16163 }(overshoot);
16164
16165 /***/
16166 },
16167 /* 244 */
16168 /***/function (module, __webpack_exports__, __webpack_require__) {
16169
16170 "use strict";
16171 /* harmony export (binding) */
16172 __webpack_require__.d(__webpack_exports__, "a", function () {
16173 return elasticIn;
16174 });
16175 /* harmony export (binding) */__webpack_require__.d(__webpack_exports__, "c", function () {
16176 return elasticOut;
16177 });
16178 /* harmony export (binding) */__webpack_require__.d(__webpack_exports__, "b", function () {
16179 return elasticInOut;
16180 });
16181 var tau = 2 * Math.PI,
16182 amplitude = 1,
16183 period = 0.3;
16184
16185 var elasticIn = function custom(a, p) {
16186 var s = Math.asin(1 / (a = Math.max(1, a))) * (p /= tau);
16187
16188 function elasticIn(t) {
16189 return a * Math.pow(2, 10 * --t) * Math.sin((s - t) / p);
16190 }
16191
16192 elasticIn.amplitude = function (a) {
16193 return custom(a, p * tau);
16194 };
16195 elasticIn.period = function (p) {
16196 return custom(a, p);
16197 };
16198
16199 return elasticIn;
16200 }(amplitude, period);
16201
16202 var elasticOut = function custom(a, p) {
16203 var s = Math.asin(1 / (a = Math.max(1, a))) * (p /= tau);
16204
16205 function elasticOut(t) {
16206 return 1 - a * Math.pow(2, -10 * (t = +t)) * Math.sin((t + s) / p);
16207 }
16208
16209 elasticOut.amplitude = function (a) {
16210 return custom(a, p * tau);
16211 };
16212 elasticOut.period = function (p) {
16213 return custom(a, p);
16214 };
16215
16216 return elasticOut;
16217 }(amplitude, period);
16218
16219 var elasticInOut = function custom(a, p) {
16220 var s = Math.asin(1 / (a = Math.max(1, a))) * (p /= tau);
16221
16222 function elasticInOut(t) {
16223 return ((t = t * 2 - 1) < 0 ? a * Math.pow(2, 10 * t) * Math.sin((s - t) / p) : 2 - a * Math.pow(2, -10 * t) * Math.sin((s + t) / p)) / 2;
16224 }
16225
16226 elasticInOut.amplitude = function (a) {
16227 return custom(a, p * tau);
16228 };
16229 elasticInOut.period = function (p) {
16230 return custom(a, p);
16231 };
16232
16233 return elasticInOut;
16234 }(amplitude, period);
16235
16236 /***/
16237 },
16238 /* 245 */
16239 /***/function (module, __webpack_exports__, __webpack_require__) {
16240
16241 "use strict";
16242
16243 Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
16244 /* harmony import */var __WEBPACK_IMPORTED_MODULE_0__src_timer__ = __webpack_require__(47);
16245 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "now", function () {
16246 return __WEBPACK_IMPORTED_MODULE_0__src_timer__["b"];
16247 });
16248 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "timer", function () {
16249 return __WEBPACK_IMPORTED_MODULE_0__src_timer__["c"];
16250 });
16251 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "timerFlush", function () {
16252 return __WEBPACK_IMPORTED_MODULE_0__src_timer__["d"];
16253 });
16254 /* harmony import */var __WEBPACK_IMPORTED_MODULE_1__src_timeout__ = __webpack_require__(246);
16255 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "timeout", function () {
16256 return __WEBPACK_IMPORTED_MODULE_1__src_timeout__["a"];
16257 });
16258 /* harmony import */var __WEBPACK_IMPORTED_MODULE_2__src_interval__ = __webpack_require__(247);
16259 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "interval", function () {
16260 return __WEBPACK_IMPORTED_MODULE_2__src_interval__["a"];
16261 });
16262
16263 /***/
16264 },
16265 /* 246 */
16266 /***/function (module, __webpack_exports__, __webpack_require__) {
16267
16268 "use strict";
16269 /* harmony import */
16270 var __WEBPACK_IMPORTED_MODULE_0__timer__ = __webpack_require__(47);
16271
16272 /* harmony default export */__webpack_exports__["a"] = function (callback, delay, time) {
16273 var t = new __WEBPACK_IMPORTED_MODULE_0__timer__["a" /* Timer */]();
16274 delay = delay == null ? 0 : +delay;
16275 t.restart(function (elapsed) {
16276 t.stop();
16277 callback(elapsed + delay);
16278 }, delay, time);
16279 return t;
16280 };
16281
16282 /***/
16283 },
16284 /* 247 */
16285 /***/function (module, __webpack_exports__, __webpack_require__) {
16286
16287 "use strict";
16288 /* harmony import */
16289 var __WEBPACK_IMPORTED_MODULE_0__timer__ = __webpack_require__(47);
16290
16291 /* harmony default export */__webpack_exports__["a"] = function (callback, delay, time) {
16292 var t = new __WEBPACK_IMPORTED_MODULE_0__timer__["a" /* Timer */](),
16293 total = delay;
16294 if (delay == null) return t.restart(callback, delay, time), t;
16295 delay = +delay, time = time == null ? Object(__WEBPACK_IMPORTED_MODULE_0__timer__["b" /* now */])() : +time;
16296 t.restart(function tick(elapsed) {
16297 elapsed += total;
16298 t.restart(tick, total += delay, time);
16299 callback(elapsed);
16300 }, delay, time);
16301 return t;
16302 };
16303
16304 /***/
16305 },
16306 /* 248 */
16307 /***/function (module, __webpack_exports__, __webpack_require__) {
16308
16309 "use strict";
16310
16311 Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
16312 /* harmony import */var __WEBPACK_IMPORTED_MODULE_0__src_value__ = __webpack_require__(48);
16313 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "interpolate", function () {
16314 return __WEBPACK_IMPORTED_MODULE_0__src_value__["a"];
16315 });
16316 /* harmony import */var __WEBPACK_IMPORTED_MODULE_1__src_array__ = __webpack_require__(93);
16317 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "interpolateArray", function () {
16318 return __WEBPACK_IMPORTED_MODULE_1__src_array__["a"];
16319 });
16320 /* harmony import */var __WEBPACK_IMPORTED_MODULE_2__src_basis__ = __webpack_require__(51);
16321 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "interpolateBasis", function () {
16322 return __WEBPACK_IMPORTED_MODULE_2__src_basis__["b"];
16323 });
16324 /* harmony import */var __WEBPACK_IMPORTED_MODULE_3__src_basisClosed__ = __webpack_require__(91);
16325 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "interpolateBasisClosed", function () {
16326 return __WEBPACK_IMPORTED_MODULE_3__src_basisClosed__["a"];
16327 });
16328 /* harmony import */var __WEBPACK_IMPORTED_MODULE_4__src_date__ = __webpack_require__(94);
16329 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "interpolateDate", function () {
16330 return __WEBPACK_IMPORTED_MODULE_4__src_date__["a"];
16331 });
16332 /* harmony import */var __WEBPACK_IMPORTED_MODULE_5__src_number__ = __webpack_require__(29);
16333 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "interpolateNumber", function () {
16334 return __WEBPACK_IMPORTED_MODULE_5__src_number__["a"];
16335 });
16336 /* harmony import */var __WEBPACK_IMPORTED_MODULE_6__src_object__ = __webpack_require__(95);
16337 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "interpolateObject", function () {
16338 return __WEBPACK_IMPORTED_MODULE_6__src_object__["a"];
16339 });
16340 /* harmony import */var __WEBPACK_IMPORTED_MODULE_7__src_round__ = __webpack_require__(251);
16341 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "interpolateRound", function () {
16342 return __WEBPACK_IMPORTED_MODULE_7__src_round__["a"];
16343 });
16344 /* harmony import */var __WEBPACK_IMPORTED_MODULE_8__src_string__ = __webpack_require__(96);
16345 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "interpolateString", function () {
16346 return __WEBPACK_IMPORTED_MODULE_8__src_string__["a"];
16347 });
16348 /* harmony import */var __WEBPACK_IMPORTED_MODULE_9__src_transform_index__ = __webpack_require__(252);
16349 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "interpolateTransformCss", function () {
16350 return __WEBPACK_IMPORTED_MODULE_9__src_transform_index__["a"];
16351 });
16352 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "interpolateTransformSvg", function () {
16353 return __WEBPACK_IMPORTED_MODULE_9__src_transform_index__["b"];
16354 });
16355 /* harmony import */var __WEBPACK_IMPORTED_MODULE_10__src_zoom__ = __webpack_require__(255);
16356 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "interpolateZoom", function () {
16357 return __WEBPACK_IMPORTED_MODULE_10__src_zoom__["a"];
16358 });
16359 /* harmony import */var __WEBPACK_IMPORTED_MODULE_11__src_rgb__ = __webpack_require__(90);
16360 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "interpolateRgb", function () {
16361 return __WEBPACK_IMPORTED_MODULE_11__src_rgb__["a"];
16362 });
16363 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "interpolateRgbBasis", function () {
16364 return __WEBPACK_IMPORTED_MODULE_11__src_rgb__["b"];
16365 });
16366 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "interpolateRgbBasisClosed", function () {
16367 return __WEBPACK_IMPORTED_MODULE_11__src_rgb__["c"];
16368 });
16369 /* harmony import */var __WEBPACK_IMPORTED_MODULE_12__src_hsl__ = __webpack_require__(256);
16370 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "interpolateHsl", function () {
16371 return __WEBPACK_IMPORTED_MODULE_12__src_hsl__["a"];
16372 });
16373 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "interpolateHslLong", function () {
16374 return __WEBPACK_IMPORTED_MODULE_12__src_hsl__["b"];
16375 });
16376 /* harmony import */var __WEBPACK_IMPORTED_MODULE_13__src_lab__ = __webpack_require__(257);
16377 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "interpolateLab", function () {
16378 return __WEBPACK_IMPORTED_MODULE_13__src_lab__["a"];
16379 });
16380 /* harmony import */var __WEBPACK_IMPORTED_MODULE_14__src_hcl__ = __webpack_require__(258);
16381 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "interpolateHcl", function () {
16382 return __WEBPACK_IMPORTED_MODULE_14__src_hcl__["a"];
16383 });
16384 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "interpolateHclLong", function () {
16385 return __WEBPACK_IMPORTED_MODULE_14__src_hcl__["b"];
16386 });
16387 /* harmony import */var __WEBPACK_IMPORTED_MODULE_15__src_cubehelix__ = __webpack_require__(259);
16388 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "interpolateCubehelix", function () {
16389 return __WEBPACK_IMPORTED_MODULE_15__src_cubehelix__["b"];
16390 });
16391 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "interpolateCubehelixLong", function () {
16392 return __WEBPACK_IMPORTED_MODULE_15__src_cubehelix__["a"];
16393 });
16394 /* harmony import */var __WEBPACK_IMPORTED_MODULE_16__src_quantize__ = __webpack_require__(260);
16395 /* harmony reexport (binding) */__webpack_require__.d(__webpack_exports__, "quantize", function () {
16396 return __WEBPACK_IMPORTED_MODULE_16__src_quantize__["a"];
16397 });
16398
16399 /***/
16400 },
16401 /* 249 */
16402 /***/function (module, __webpack_exports__, __webpack_require__) {
16403
16404 "use strict";
16405 /* harmony export (immutable) */
16406 __webpack_exports__["a"] = lab;
16407 /* unused harmony export Lab */
16408 /* harmony export (immutable) */__webpack_exports__["b"] = hcl;
16409 /* unused harmony export Hcl */
16410 /* harmony import */var __WEBPACK_IMPORTED_MODULE_0__define__ = __webpack_require__(50);
16411 /* harmony import */var __WEBPACK_IMPORTED_MODULE_1__color__ = __webpack_require__(49);
16412 /* harmony import */var __WEBPACK_IMPORTED_MODULE_2__math__ = __webpack_require__(89);
16413
16414 var Kn = 18,
16415 Xn = 0.950470,
16416
16417 // D65 standard referent
16418 Yn = 1,
16419 Zn = 1.088830,
16420 t0 = 4 / 29,
16421 t1 = 6 / 29,
16422 t2 = 3 * t1 * t1,
16423 t3 = t1 * t1 * t1;
16424
16425 function labConvert(o) {
16426 if (o instanceof Lab) return new Lab(o.l, o.a, o.b, o.opacity);
16427 if (o instanceof Hcl) {
16428 var h = o.h * __WEBPACK_IMPORTED_MODULE_2__math__["a" /* deg2rad */];
16429 return new Lab(o.l, Math.cos(h) * o.c, Math.sin(h) * o.c, o.opacity);
16430 }
16431 if (!(o instanceof __WEBPACK_IMPORTED_MODULE_1__color__["b" /* Rgb */])) o = Object(__WEBPACK_IMPORTED_MODULE_1__color__["h" /* rgbConvert */])(o);
16432 var b = rgb2xyz(o.r),
16433 a = rgb2xyz(o.g),
16434 l = rgb2xyz(o.b),
16435 x = xyz2lab((0.4124564 * b + 0.3575761 * a + 0.1804375 * l) / Xn),
16436 y = xyz2lab((0.2126729 * b + 0.7151522 * a + 0.0721750 * l) / Yn),
16437 z = xyz2lab((0.0193339 * b + 0.1191920 * a + 0.9503041 * l) / Zn);
16438 return new Lab(116 * y - 16, 500 * (x - y), 200 * (y - z), o.opacity);
16439 }
16440
16441 function lab(l, a, b, opacity) {
16442 return arguments.length === 1 ? labConvert(l) : new Lab(l, a, b, opacity == null ? 1 : opacity);
16443 }
16444
16445 function Lab(l, a, b, opacity) {
16446 this.l = +l;
16447 this.a = +a;
16448 this.b = +b;
16449 this.opacity = +opacity;
16450 }
16451
16452 Object(__WEBPACK_IMPORTED_MODULE_0__define__["a" /* default */])(Lab, lab, Object(__WEBPACK_IMPORTED_MODULE_0__define__["b" /* extend */])(__WEBPACK_IMPORTED_MODULE_1__color__["a" /* Color */], {
16453 brighter: function brighter(k) {
16454 return new Lab(this.l + Kn * (k == null ? 1 : k), this.a, this.b, this.opacity);
16455 },
16456 darker: function darker(k) {
16457 return new Lab(this.l - Kn * (k == null ? 1 : k), this.a, this.b, this.opacity);
16458 },
16459 rgb: function rgb() {
16460 var y = (this.l + 16) / 116,
16461 x = isNaN(this.a) ? y : y + this.a / 500,
16462 z = isNaN(this.b) ? y : y - this.b / 200;
16463 y = Yn * lab2xyz(y);
16464 x = Xn * lab2xyz(x);
16465 z = Zn * lab2xyz(z);
16466 return new __WEBPACK_IMPORTED_MODULE_1__color__["b" /* Rgb */](xyz2rgb(3.2404542 * x - 1.5371385 * y - 0.4985314 * z), // D65 -> sRGB
16467 xyz2rgb(-0.9692660 * x + 1.8760108 * y + 0.0415560 * z), xyz2rgb(0.0556434 * x - 0.2040259 * y + 1.0572252 * z), this.opacity);
16468 }
16469 }));
16470
16471 function xyz2lab(t) {
16472 return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0;
16473 }
16474
16475 function lab2xyz(t) {
16476 return t > t1 ? t * t * t : t2 * (t - t0);
16477 }
16478
16479 function xyz2rgb(x) {
16480 return 255 * (x <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055);
16481 }
16482
16483 function rgb2xyz(x) {
16484 return (x /= 255) <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4);
16485 }
16486
16487 function hclConvert(o) {
16488 if (o instanceof Hcl) return new Hcl(o.h, o.c, o.l, o.opacity);
16489 if (!(o instanceof Lab)) o = labConvert(o);
16490 var h = Math.atan2(o.b, o.a) * __WEBPACK_IMPORTED_MODULE_2__math__["b" /* rad2deg */];
16491 return new Hcl(h < 0 ? h + 360 : h, Math.sqrt(o.a * o.a + o.b * o.b), o.l, o.opacity);
16492 }
16493
16494 function hcl(h, c, l, opacity) {
16495 return arguments.length === 1 ? hclConvert(h) : new Hcl(h, c, l, opacity == null ? 1 : opacity);
16496 }
16497
16498 function Hcl(h, c, l, opacity) {
16499 this.h = +h;
16500 this.c = +c;
16501 this.l = +l;
16502 this.opacity = +opacity;
16503 }
16504
16505 Object(__WEBPACK_IMPORTED_MODULE_0__define__["a" /* default */])(Hcl, hcl, Object(__WEBPACK_IMPORTED_MODULE_0__define__["b" /* extend */])(__WEBPACK_IMPORTED_MODULE_1__color__["a" /* Color */], {
16506 brighter: function brighter(k) {
16507 return new Hcl(this.h, this.c, this.l + Kn * (k == null ? 1 : k), this.opacity);
16508 },
16509 darker: function darker(k) {
16510 return new Hcl(this.h, this.c, this.l - Kn * (k == null ? 1 : k), this.opacity);
16511 },
16512 rgb: function rgb() {
16513 return labConvert(this).rgb();
16514 }
16515 }));
16516
16517 /***/
16518 },
16519 /* 250 */
16520 /***/function (module, __webpack_exports__, __webpack_require__) {
16521
16522 "use strict";
16523 /* harmony export (immutable) */
16524 __webpack_exports__["a"] = cubehelix;
16525 /* unused harmony export Cubehelix */
16526 /* harmony import */var __WEBPACK_IMPORTED_MODULE_0__define__ = __webpack_require__(50);
16527 /* harmony import */var __WEBPACK_IMPORTED_MODULE_1__color__ = __webpack_require__(49);
16528 /* harmony import */var __WEBPACK_IMPORTED_MODULE_2__math__ = __webpack_require__(89);
16529
16530 var A = -0.14861,
16531 B = +1.78277,
16532 C = -0.29227,
16533 D = -0.90649,
16534 E = +1.97294,
16535 ED = E * D,
16536 EB = E * B,
16537 BC_DA = B * C - D * A;
16538
16539 function cubehelixConvert(o) {
16540 if (o instanceof Cubehelix) return new Cubehelix(o.h, o.s, o.l, o.opacity);
16541 if (!(o instanceof __WEBPACK_IMPORTED_MODULE_1__color__["b" /* Rgb */])) o = Object(__WEBPACK_IMPORTED_MODULE_1__color__["h" /* rgbConvert */])(o);
16542 var r = o.r / 255,
16543 g = o.g / 255,
16544 b = o.b / 255,
16545 l = (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB),
16546 bl = b - l,
16547 k = (E * (g - l) - C * bl) / D,
16548 s = Math.sqrt(k * k + bl * bl) / (E * l * (1 - l)),
16549
16550 // NaN if l=0 or l=1
16551 h = s ? Math.atan2(k, bl) * __WEBPACK_IMPORTED_MODULE_2__math__["b" /* rad2deg */] - 120 : NaN;
16552 return new Cubehelix(h < 0 ? h + 360 : h, s, l, o.opacity);
16553 }
16554
16555 function cubehelix(h, s, l, opacity) {
16556 return arguments.length === 1 ? cubehelixConvert(h) : new Cubehelix(h, s, l, opacity == null ? 1 : opacity);
16557 }
16558
16559 function Cubehelix(h, s, l, opacity) {
16560 this.h = +h;
16561 this.s = +s;
16562 this.l = +l;
16563 this.opacity = +opacity;
16564 }
16565
16566 Object(__WEBPACK_IMPORTED_MODULE_0__define__["a" /* default */])(Cubehelix, cubehelix, Object(__WEBPACK_IMPORTED_MODULE_0__define__["b" /* extend */])(__WEBPACK_IMPORTED_MODULE_1__color__["a" /* Color */], {
16567 brighter: function brighter(k) {
16568 k = k == null ? __WEBPACK_IMPORTED_MODULE_1__color__["c" /* brighter */] : Math.pow(__WEBPACK_IMPORTED_MODULE_1__color__["c" /* brighter */], k);
16569 return new Cubehelix(this.h, this.s, this.l * k, this.opacity);
16570 },
16571 darker: function darker(k) {
16572 k = k == null ? __WEBPACK_IMPORTED_MODULE_1__color__["d" /* darker */] : Math.pow(__WEBPACK_IMPORTED_MODULE_1__color__["d" /* darker */], k);
16573 return new Cubehelix(this.h, this.s, this.l * k, this.opacity);
16574 },
16575 rgb: function rgb() {
16576 var h = isNaN(this.h) ? 0 : (this.h + 120) * __WEBPACK_IMPORTED_MODULE_2__math__["a" /* deg2rad */],
16577 l = +this.l,
16578 a = isNaN(this.s) ? 0 : this.s * l * (1 - l),
16579 cosh = Math.cos(h),
16580 sinh = Math.sin(h);
16581 return new __WEBPACK_IMPORTED_MODULE_1__color__["b" /* Rgb */](255 * (l + a * (A * cosh + B * sinh)), 255 * (l + a * (C * cosh + D * sinh)), 255 * (l + a * (E * cosh)), this.opacity);
16582 }
16583 }));
16584
16585 /***/
16586 },
16587 /* 251 */
16588 /***/function (module, __webpack_exports__, __webpack_require__) {
16589
16590 "use strict";
16591 /* harmony default export */
16592 __webpack_exports__["a"] = function (a, b) {
16593 return a = +a, b -= a, function (t) {
16594 return Math.round(a + b * t);
16595 };
16596 };
16597
16598 /***/
16599 },
16600 /* 252 */
16601 /***/function (module, __webpack_exports__, __webpack_require__) {
16602
16603 "use strict";
16604 /* harmony export (binding) */
16605 __webpack_require__.d(__webpack_exports__, "a", function () {
16606 return interpolateTransformCss;
16607 });
16608 /* harmony export (binding) */__webpack_require__.d(__webpack_exports__, "b", function () {
16609 return interpolateTransformSvg;
16610 });
16611 /* harmony import */var __WEBPACK_IMPORTED_MODULE_0__number__ = __webpack_require__(29);
16612 /* harmony import */var __WEBPACK_IMPORTED_MODULE_1__parse__ = __webpack_require__(253);
16613
16614 function interpolateTransform(parse, pxComma, pxParen, degParen) {
16615
16616 function pop(s) {
16617 return s.length ? s.pop() + " " : "";
16618 }
16619
16620 function translate(xa, ya, xb, yb, s, q) {
16621 if (xa !== xb || ya !== yb) {
16622 var i = s.push("translate(", null, pxComma, null, pxParen);
16623 q.push({ i: i - 4, x: Object(__WEBPACK_IMPORTED_MODULE_0__number__["a" /* default */])(xa, xb) }, { i: i - 2, x: Object(__WEBPACK_IMPORTED_MODULE_0__number__["a" /* default */])(ya, yb) });
16624 } else if (xb || yb) {
16625 s.push("translate(" + xb + pxComma + yb + pxParen);
16626 }
16627 }
16628
16629 function rotate(a, b, s, q) {
16630 if (a !== b) {
16631 if (a - b > 180) b += 360;else if (b - a > 180) a += 360; // shortest path
16632 q.push({ i: s.push(pop(s) + "rotate(", null, degParen) - 2, x: Object(__WEBPACK_IMPORTED_MODULE_0__number__["a" /* default */])(a, b) });
16633 } else if (b) {
16634 s.push(pop(s) + "rotate(" + b + degParen);
16635 }
16636 }
16637
16638 function skewX(a, b, s, q) {
16639 if (a !== b) {
16640 q.push({ i: s.push(pop(s) + "skewX(", null, degParen) - 2, x: Object(__WEBPACK_IMPORTED_MODULE_0__number__["a" /* default */])(a, b) });
16641 } else if (b) {
16642 s.push(pop(s) + "skewX(" + b + degParen);
16643 }
16644 }
16645
16646 function scale(xa, ya, xb, yb, s, q) {
16647 if (xa !== xb || ya !== yb) {
16648 var i = s.push(pop(s) + "scale(", null, ",", null, ")");
16649 q.push({ i: i - 4, x: Object(__WEBPACK_IMPORTED_MODULE_0__number__["a" /* default */])(xa, xb) }, { i: i - 2, x: Object(__WEBPACK_IMPORTED_MODULE_0__number__["a" /* default */])(ya, yb) });
16650 } else if (xb !== 1 || yb !== 1) {
16651 s.push(pop(s) + "scale(" + xb + "," + yb + ")");
16652 }
16653 }
16654
16655 return function (a, b) {
16656 var s = [],
16657
16658 // string constants and placeholders
16659 q = []; // number interpolators
16660 a = parse(a), b = parse(b);
16661 translate(a.translateX, a.translateY, b.translateX, b.translateY, s, q);
16662 rotate(a.rotate, b.rotate, s, q);
16663 skewX(a.skewX, b.skewX, s, q);
16664 scale(a.scaleX, a.scaleY, b.scaleX, b.scaleY, s, q);
16665 a = b = null; // gc
16666 return function (t) {
16667 var i = -1,
16668 n = q.length,
16669 o;
16670 while (++i < n) {
16671 s[(o = q[i]).i] = o.x(t);
16672 }return s.join("");
16673 };
16674 };
16675 }
16676
16677 var interpolateTransformCss = interpolateTransform(__WEBPACK_IMPORTED_MODULE_1__parse__["a" /* parseCss */], "px, ", "px)", "deg)");
16678 var interpolateTransformSvg = interpolateTransform(__WEBPACK_IMPORTED_MODULE_1__parse__["b" /* parseSvg */], ", ", ")", ")");
16679
16680 /***/
16681 },
16682 /* 253 */
16683 /***/function (module, __webpack_exports__, __webpack_require__) {
16684
16685 "use strict";
16686 /* harmony export (immutable) */
16687 __webpack_exports__["a"] = parseCss;
16688 /* harmony export (immutable) */__webpack_exports__["b"] = parseSvg;
16689 /* harmony import */var __WEBPACK_IMPORTED_MODULE_0__decompose__ = __webpack_require__(254);
16690
16691 var cssNode, cssRoot, cssView, svgNode;
16692
16693 function parseCss(value) {
16694 if (value === "none") return __WEBPACK_IMPORTED_MODULE_0__decompose__["b" /* identity */];
16695 if (!cssNode) cssNode = document.createElement("DIV"), cssRoot = document.documentElement, cssView = document.defaultView;
16696 cssNode.style.transform = value;
16697 value = cssView.getComputedStyle(cssRoot.appendChild(cssNode), null).getPropertyValue("transform");
16698 cssRoot.removeChild(cssNode);
16699 value = value.slice(7, -1).split(",");
16700 return Object(__WEBPACK_IMPORTED_MODULE_0__decompose__["a" /* default */])(+value[0], +value[1], +value[2], +value[3], +value[4], +value[5]);
16701 }
16702
16703 function parseSvg(value) {
16704 if (value == null) return __WEBPACK_IMPORTED_MODULE_0__decompose__["b" /* identity */];
16705 if (!svgNode) svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g");
16706 svgNode.setAttribute("transform", value);
16707 if (!(value = svgNode.transform.baseVal.consolidate())) return __WEBPACK_IMPORTED_MODULE_0__decompose__["b" /* identity */];
16708 value = value.matrix;
16709 return Object(__WEBPACK_IMPORTED_MODULE_0__decompose__["a" /* default */])(value.a, value.b, value.c, value.d, value.e, value.f);
16710 }
16711
16712 /***/
16713 },
16714 /* 254 */
16715 /***/function (module, __webpack_exports__, __webpack_require__) {
16716
16717 "use strict";
16718 /* harmony export (binding) */
16719 __webpack_require__.d(__webpack_exports__, "b", function () {
16720 return identity;
16721 });
16722 var degrees = 180 / Math.PI;
16723
16724 var identity = {
16725 translateX: 0,
16726 translateY: 0,
16727 rotate: 0,
16728 skewX: 0,
16729 scaleX: 1,
16730 scaleY: 1
16731 };
16732
16733 /* harmony default export */__webpack_exports__["a"] = function (a, b, c, d, e, f) {
16734 var scaleX, scaleY, skewX;
16735 if (scaleX = Math.sqrt(a * a + b * b)) a /= scaleX, b /= scaleX;
16736 if (skewX = a * c + b * d) c -= a * skewX, d -= b * skewX;
16737 if (scaleY = Math.sqrt(c * c + d * d)) c /= scaleY, d /= scaleY, skewX /= scaleY;
16738 if (a * d < b * c) a = -a, b = -b, skewX = -skewX, scaleX = -scaleX;
16739 return {
16740 translateX: e,
16741 translateY: f,
16742 rotate: Math.atan2(b, a) * degrees,
16743 skewX: Math.atan(skewX) * degrees,
16744 scaleX: scaleX,
16745 scaleY: scaleY
16746 };
16747 };
16748
16749 /***/
16750 },
16751 /* 255 */
16752 /***/function (module, __webpack_exports__, __webpack_require__) {
16753
16754 "use strict";
16755
16756 var rho = Math.SQRT2,
16757 rho2 = 2,
16758 rho4 = 4,
16759 epsilon2 = 1e-12;
16760
16761 function cosh(x) {
16762 return ((x = Math.exp(x)) + 1 / x) / 2;
16763 }
16764
16765 function sinh(x) {
16766 return ((x = Math.exp(x)) - 1 / x) / 2;
16767 }
16768
16769 function tanh(x) {
16770 return ((x = Math.exp(2 * x)) - 1) / (x + 1);
16771 }
16772
16773 // p0 = [ux0, uy0, w0]
16774 // p1 = [ux1, uy1, w1]
16775 /* harmony default export */__webpack_exports__["a"] = function (p0, p1) {
16776 var ux0 = p0[0],
16777 uy0 = p0[1],
16778 w0 = p0[2],
16779 ux1 = p1[0],
16780 uy1 = p1[1],
16781 w1 = p1[2],
16782 dx = ux1 - ux0,
16783 dy = uy1 - uy0,
16784 d2 = dx * dx + dy * dy,
16785 i,
16786 S;
16787
16788 // Special case for u0 ≅ u1.
16789 if (d2 < epsilon2) {
16790 S = Math.log(w1 / w0) / rho;
16791 i = function i(t) {
16792 return [ux0 + t * dx, uy0 + t * dy, w0 * Math.exp(rho * t * S)];
16793 };
16794 }
16795
16796 // General case.
16797 else {
16798 var d1 = Math.sqrt(d2),
16799 b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1),
16800 b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1),
16801 r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0),
16802 r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1);
16803 S = (r1 - r0) / rho;
16804 i = function i(t) {
16805 var s = t * S,
16806 coshr0 = cosh(r0),
16807 u = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - sinh(r0));
16808 return [ux0 + u * dx, uy0 + u * dy, w0 * coshr0 / cosh(rho * s + r0)];
16809 };
16810 }
16811
16812 i.duration = S * 1000;
16813
16814 return i;
16815 };
16816
16817 /***/
16818 },
16819 /* 256 */
16820 /***/function (module, __webpack_exports__, __webpack_require__) {
16821
16822 "use strict";
16823 /* harmony export (binding) */
16824 __webpack_require__.d(__webpack_exports__, "b", function () {
16825 return hslLong;
16826 });
16827 /* harmony import */var __WEBPACK_IMPORTED_MODULE_0_d3_color__ = __webpack_require__(14);
16828 /* harmony import */var __WEBPACK_IMPORTED_MODULE_1__color__ = __webpack_require__(19);
16829
16830 function hsl(hue) {
16831 return function (start, end) {
16832 var h = hue((start = Object(__WEBPACK_IMPORTED_MODULE_0_d3_color__["d" /* hsl */])(start)).h, (end = Object(__WEBPACK_IMPORTED_MODULE_0_d3_color__["d" /* hsl */])(end)).h),
16833 s = Object(__WEBPACK_IMPORTED_MODULE_1__color__["a" /* default */])(start.s, end.s),
16834 l = Object(__WEBPACK_IMPORTED_MODULE_1__color__["a" /* default */])(start.l, end.l),
16835 opacity = Object(__WEBPACK_IMPORTED_MODULE_1__color__["a" /* default */])(start.opacity, end.opacity);
16836 return function (t) {
16837 start.h = h(t);
16838 start.s = s(t);
16839 start.l = l(t);
16840 start.opacity = opacity(t);
16841 return start + "";
16842 };
16843 };
16844 }
16845
16846 /* harmony default export */__webpack_exports__["a"] = hsl(__WEBPACK_IMPORTED_MODULE_1__color__["c" /* hue */]);
16847 var hslLong = hsl(__WEBPACK_IMPORTED_MODULE_1__color__["a" /* default */]);
16848
16849 /***/
16850 },
16851 /* 257 */
16852 /***/function (module, __webpack_exports__, __webpack_require__) {
16853
16854 "use strict";
16855 /* harmony export (immutable) */
16856 __webpack_exports__["a"] = lab;
16857 /* harmony import */var __WEBPACK_IMPORTED_MODULE_0_d3_color__ = __webpack_require__(14);
16858 /* harmony import */var __WEBPACK_IMPORTED_MODULE_1__color__ = __webpack_require__(19);
16859
16860 function lab(start, end) {
16861 var l = Object(__WEBPACK_IMPORTED_MODULE_1__color__["a" /* default */])((start = Object(__WEBPACK_IMPORTED_MODULE_0_d3_color__["e" /* lab */])(start)).l, (end = Object(__WEBPACK_IMPORTED_MODULE_0_d3_color__["e" /* lab */])(end)).l),
16862 a = Object(__WEBPACK_IMPORTED_MODULE_1__color__["a" /* default */])(start.a, end.a),
16863 b = Object(__WEBPACK_IMPORTED_MODULE_1__color__["a" /* default */])(start.b, end.b),
16864 opacity = Object(__WEBPACK_IMPORTED_MODULE_1__color__["a" /* default */])(start.opacity, end.opacity);
16865 return function (t) {
16866 start.l = l(t);
16867 start.a = a(t);
16868 start.b = b(t);
16869 start.opacity = opacity(t);
16870 return start + "";
16871 };
16872 }
16873
16874 /***/
16875 },
16876 /* 258 */
16877 /***/function (module, __webpack_exports__, __webpack_require__) {
16878
16879 "use strict";
16880 /* harmony export (binding) */
16881 __webpack_require__.d(__webpack_exports__, "b", function () {
16882 return hclLong;
16883 });
16884 /* harmony import */var __WEBPACK_IMPORTED_MODULE_0_d3_color__ = __webpack_require__(14);
16885 /* harmony import */var __WEBPACK_IMPORTED_MODULE_1__color__ = __webpack_require__(19);
16886
16887 function hcl(hue) {
16888 return function (start, end) {
16889 var h = hue((start = Object(__WEBPACK_IMPORTED_MODULE_0_d3_color__["c" /* hcl */])(start)).h, (end = Object(__WEBPACK_IMPORTED_MODULE_0_d3_color__["c" /* hcl */])(end)).h),
16890 c = Object(__WEBPACK_IMPORTED_MODULE_1__color__["a" /* default */])(start.c, end.c),
16891 l = Object(__WEBPACK_IMPORTED_MODULE_1__color__["a" /* default */])(start.l, end.l),
16892 opacity = Object(__WEBPACK_IMPORTED_MODULE_1__color__["a" /* default */])(start.opacity, end.opacity);
16893 return function (t) {
16894 start.h = h(t);
16895 start.c = c(t);
16896 start.l = l(t);
16897 start.opacity = opacity(t);
16898 return start + "";
16899 };
16900 };
16901 }
16902
16903 /* harmony default export */__webpack_exports__["a"] = hcl(__WEBPACK_IMPORTED_MODULE_1__color__["c" /* hue */]);
16904 var hclLong = hcl(__WEBPACK_IMPORTED_MODULE_1__color__["a" /* default */]);
16905
16906 /***/
16907 },
16908 /* 259 */
16909 /***/function (module, __webpack_exports__, __webpack_require__) {
16910
16911 "use strict";
16912 /* harmony export (binding) */
16913 __webpack_require__.d(__webpack_exports__, "a", function () {
16914 return cubehelixLong;
16915 });
16916 /* harmony import */var __WEBPACK_IMPORTED_MODULE_0_d3_color__ = __webpack_require__(14);
16917 /* harmony import */var __WEBPACK_IMPORTED_MODULE_1__color__ = __webpack_require__(19);
16918
16919 function cubehelix(hue) {
16920 return function cubehelixGamma(y) {
16921 y = +y;
16922
16923 function cubehelix(start, end) {
16924 var h = hue((start = Object(__WEBPACK_IMPORTED_MODULE_0_d3_color__["b" /* cubehelix */])(start)).h, (end = Object(__WEBPACK_IMPORTED_MODULE_0_d3_color__["b" /* cubehelix */])(end)).h),
16925 s = Object(__WEBPACK_IMPORTED_MODULE_1__color__["a" /* default */])(start.s, end.s),
16926 l = Object(__WEBPACK_IMPORTED_MODULE_1__color__["a" /* default */])(start.l, end.l),
16927 opacity = Object(__WEBPACK_IMPORTED_MODULE_1__color__["a" /* default */])(start.opacity, end.opacity);
16928 return function (t) {
16929 start.h = h(t);
16930 start.s = s(t);
16931 start.l = l(Math.pow(t, y));
16932 start.opacity = opacity(t);
16933 return start + "";
16934 };
16935 }
16936
16937 cubehelix.gamma = cubehelixGamma;
16938
16939 return cubehelix;
16940 }(1);
16941 }
16942
16943 /* harmony default export */__webpack_exports__["b"] = cubehelix(__WEBPACK_IMPORTED_MODULE_1__color__["c" /* hue */]);
16944 var cubehelixLong = cubehelix(__WEBPACK_IMPORTED_MODULE_1__color__["a" /* default */]);
16945
16946 /***/
16947 },
16948 /* 260 */
16949 /***/function (module, __webpack_exports__, __webpack_require__) {
16950
16951 "use strict";
16952 /* harmony default export */
16953 __webpack_exports__["a"] = function (interpolator, n) {
16954 var samples = new Array(n);
16955 for (var i = 0; i < n; ++i) {
16956 samples[i] = interpolator(i / (n - 1));
16957 }return samples;
16958 };
16959
16960 /***/
16961 },
16962 /* 261 */
16963 /***/function (module, exports, __webpack_require__) {
16964
16965 var __WEBPACK_AMD_DEFINE_RESULT__;var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) {
16966 return typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
16967 } : function (obj) {
16968 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj === 'undefined' ? 'undefined' : _typeof2(obj);
16969 };
16970
16971 /*!
16972 * EventEmitter v5.2.4 - git.io/ee
16973 * Unlicense - http://unlicense.org/
16974 * Oliver Caldwell - http://oli.me.uk/
16975 * @preserve
16976 */
16977
16978 ;(function (exports) {
16979 'use strict';
16980
16981 /**
16982 * Class for managing events.
16983 * Can be extended to provide event functionality in other classes.
16984 *
16985 * @class EventEmitter Manages event registering and emitting.
16986 */
16987
16988 function EventEmitter() {}
16989
16990 // Shortcuts to improve speed and size
16991 var proto = EventEmitter.prototype;
16992 var originalGlobalValue = exports.EventEmitter;
16993
16994 /**
16995 * Finds the index of the listener for the event in its storage array.
16996 *
16997 * @param {Function[]} listeners Array of listeners to search through.
16998 * @param {Function} listener Method to look for.
16999 * @return {Number} Index of the specified listener, -1 if not found
17000 * @api private
17001 */
17002 function indexOfListener(listeners, listener) {
17003 var i = listeners.length;
17004 while (i--) {
17005 if (listeners[i].listener === listener) {
17006 return i;
17007 }
17008 }
17009
17010 return -1;
17011 }
17012
17013 /**
17014 * Alias a method while keeping the context correct, to allow for overwriting of target method.
17015 *
17016 * @param {String} name The name of the target method.
17017 * @return {Function} The aliased method
17018 * @api private
17019 */
17020 function alias(name) {
17021 return function aliasClosure() {
17022 return this[name].apply(this, arguments);
17023 };
17024 }
17025
17026 /**
17027 * Returns the listener array for the specified event.
17028 * Will initialise the event object and listener arrays if required.
17029 * Will return an object if you use a regex search. The object contains keys for each matched event. So /ba[rz]/ might return an object containing bar and baz. But only if you have either defined them with defineEvent or added some listeners to them.
17030 * Each property in the object response is an array of listener functions.
17031 *
17032 * @param {String|RegExp} evt Name of the event to return the listeners from.
17033 * @return {Function[]|Object} All listener functions for the event.
17034 */
17035 proto.getListeners = function getListeners(evt) {
17036 var events = this._getEvents();
17037 var response;
17038 var key;
17039
17040 // Return a concatenated array of all matching events if
17041 // the selector is a regular expression.
17042 if (evt instanceof RegExp) {
17043 response = {};
17044 for (key in events) {
17045 if (events.hasOwnProperty(key) && evt.test(key)) {
17046 response[key] = events[key];
17047 }
17048 }
17049 } else {
17050 response = events[evt] || (events[evt] = []);
17051 }
17052
17053 return response;
17054 };
17055
17056 /**
17057 * Takes a list of listener objects and flattens it into a list of listener functions.
17058 *
17059 * @param {Object[]} listeners Raw listener objects.
17060 * @return {Function[]} Just the listener functions.
17061 */
17062 proto.flattenListeners = function flattenListeners(listeners) {
17063 var flatListeners = [];
17064 var i;
17065
17066 for (i = 0; i < listeners.length; i += 1) {
17067 flatListeners.push(listeners[i].listener);
17068 }
17069
17070 return flatListeners;
17071 };
17072
17073 /**
17074 * Fetches the requested listeners via getListeners but will always return the results inside an object. This is mainly for internal use but others may find it useful.
17075 *
17076 * @param {String|RegExp} evt Name of the event to return the listeners from.
17077 * @return {Object} All listener functions for an event in an object.
17078 */
17079 proto.getListenersAsObject = function getListenersAsObject(evt) {
17080 var listeners = this.getListeners(evt);
17081 var response;
17082
17083 if (listeners instanceof Array) {
17084 response = {};
17085 response[evt] = listeners;
17086 }
17087
17088 return response || listeners;
17089 };
17090
17091 function isValidListener(listener) {
17092 if (typeof listener === 'function' || listener instanceof RegExp) {
17093 return true;
17094 } else if (listener && (typeof listener === 'undefined' ? 'undefined' : _typeof(listener)) === 'object') {
17095 return isValidListener(listener.listener);
17096 } else {
17097 return false;
17098 }
17099 }
17100
17101 /**
17102 * Adds a listener function to the specified event.
17103 * The listener will not be added if it is a duplicate.
17104 * If the listener returns true then it will be removed after it is called.
17105 * If you pass a regular expression as the event name then the listener will be added to all events that match it.
17106 *
17107 * @param {String|RegExp} evt Name of the event to attach the listener to.
17108 * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.
17109 * @return {Object} Current instance of EventEmitter for chaining.
17110 */
17111 proto.addListener = function addListener(evt, listener) {
17112 if (!isValidListener(listener)) {
17113 throw new TypeError('listener must be a function');
17114 }
17115
17116 var listeners = this.getListenersAsObject(evt);
17117 var listenerIsWrapped = (typeof listener === 'undefined' ? 'undefined' : _typeof(listener)) === 'object';
17118 var key;
17119
17120 for (key in listeners) {
17121 if (listeners.hasOwnProperty(key) && indexOfListener(listeners[key], listener) === -1) {
17122 listeners[key].push(listenerIsWrapped ? listener : {
17123 listener: listener,
17124 once: false
17125 });
17126 }
17127 }
17128
17129 return this;
17130 };
17131
17132 /**
17133 * Alias of addListener
17134 */
17135 proto.on = alias('addListener');
17136
17137 /**
17138 * Semi-alias of addListener. It will add a listener that will be
17139 * automatically removed after its first execution.
17140 *
17141 * @param {String|RegExp} evt Name of the event to attach the listener to.
17142 * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.
17143 * @return {Object} Current instance of EventEmitter for chaining.
17144 */
17145 proto.addOnceListener = function addOnceListener(evt, listener) {
17146 return this.addListener(evt, {
17147 listener: listener,
17148 once: true
17149 });
17150 };
17151
17152 /**
17153 * Alias of addOnceListener.
17154 */
17155 proto.once = alias('addOnceListener');
17156
17157 /**
17158 * Defines an event name. This is required if you want to use a regex to add a listener to multiple events at once. If you don't do this then how do you expect it to know what event to add to? Should it just add to every possible match for a regex? No. That is scary and bad.
17159 * You need to tell it what event names should be matched by a regex.
17160 *
17161 * @param {String} evt Name of the event to create.
17162 * @return {Object} Current instance of EventEmitter for chaining.
17163 */
17164 proto.defineEvent = function defineEvent(evt) {
17165 this.getListeners(evt);
17166 return this;
17167 };
17168
17169 /**
17170 * Uses defineEvent to define multiple events.
17171 *
17172 * @param {String[]} evts An array of event names to define.
17173 * @return {Object} Current instance of EventEmitter for chaining.
17174 */
17175 proto.defineEvents = function defineEvents(evts) {
17176 for (var i = 0; i < evts.length; i += 1) {
17177 this.defineEvent(evts[i]);
17178 }
17179 return this;
17180 };
17181
17182 /**
17183 * Removes a listener function from the specified event.
17184 * When passed a regular expression as the event name, it will remove the listener from all events that match it.
17185 *
17186 * @param {String|RegExp} evt Name of the event to remove the listener from.
17187 * @param {Function} listener Method to remove from the event.
17188 * @return {Object} Current instance of EventEmitter for chaining.
17189 */
17190 proto.removeListener = function removeListener(evt, listener) {
17191 var listeners = this.getListenersAsObject(evt);
17192 var index;
17193 var key;
17194
17195 for (key in listeners) {
17196 if (listeners.hasOwnProperty(key)) {
17197 index = indexOfListener(listeners[key], listener);
17198
17199 if (index !== -1) {
17200 listeners[key].splice(index, 1);
17201 }
17202 }
17203 }
17204
17205 return this;
17206 };
17207
17208 /**
17209 * Alias of removeListener
17210 */
17211 proto.off = alias('removeListener');
17212
17213 /**
17214 * Adds listeners in bulk using the manipulateListeners method.
17215 * If you pass an object as the first argument you can add to multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. You can also pass it an event name and an array of listeners to be added.
17216 * You can also pass it a regular expression to add the array of listeners to all events that match it.
17217 * Yeah, this function does quite a bit. That's probably a bad thing.
17218 *
17219 * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add to multiple events at once.
17220 * @param {Function[]} [listeners] An optional array of listener functions to add.
17221 * @return {Object} Current instance of EventEmitter for chaining.
17222 */
17223 proto.addListeners = function addListeners(evt, listeners) {
17224 // Pass through to manipulateListeners
17225 return this.manipulateListeners(false, evt, listeners);
17226 };
17227
17228 /**
17229 * Removes listeners in bulk using the manipulateListeners method.
17230 * If you pass an object as the first argument you can remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.
17231 * You can also pass it an event name and an array of listeners to be removed.
17232 * You can also pass it a regular expression to remove the listeners from all events that match it.
17233 *
17234 * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to remove from multiple events at once.
17235 * @param {Function[]} [listeners] An optional array of listener functions to remove.
17236 * @return {Object} Current instance of EventEmitter for chaining.
17237 */
17238 proto.removeListeners = function removeListeners(evt, listeners) {
17239 // Pass through to manipulateListeners
17240 return this.manipulateListeners(true, evt, listeners);
17241 };
17242
17243 /**
17244 * Edits listeners in bulk. The addListeners and removeListeners methods both use this to do their job. You should really use those instead, this is a little lower level.
17245 * The first argument will determine if the listeners are removed (true) or added (false).
17246 * If you pass an object as the second argument you can add/remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.
17247 * You can also pass it an event name and an array of listeners to be added/removed.
17248 * You can also pass it a regular expression to manipulate the listeners of all events that match it.
17249 *
17250 * @param {Boolean} remove True if you want to remove listeners, false if you want to add.
17251 * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add/remove from multiple events at once.
17252 * @param {Function[]} [listeners] An optional array of listener functions to add/remove.
17253 * @return {Object} Current instance of EventEmitter for chaining.
17254 */
17255 proto.manipulateListeners = function manipulateListeners(remove, evt, listeners) {
17256 var i;
17257 var value;
17258 var single = remove ? this.removeListener : this.addListener;
17259 var multiple = remove ? this.removeListeners : this.addListeners;
17260
17261 // If evt is an object then pass each of its properties to this method
17262 if ((typeof evt === 'undefined' ? 'undefined' : _typeof(evt)) === 'object' && !(evt instanceof RegExp)) {
17263 for (i in evt) {
17264 if (evt.hasOwnProperty(i) && (value = evt[i])) {
17265 // Pass the single listener straight through to the singular method
17266 if (typeof value === 'function') {
17267 single.call(this, i, value);
17268 } else {
17269 // Otherwise pass back to the multiple function
17270 multiple.call(this, i, value);
17271 }
17272 }
17273 }
17274 } else {
17275 // So evt must be a string
17276 // And listeners must be an array of listeners
17277 // Loop over it and pass each one to the multiple method
17278 i = listeners.length;
17279 while (i--) {
17280 single.call(this, evt, listeners[i]);
17281 }
17282 }
17283
17284 return this;
17285 };
17286
17287 /**
17288 * Removes all listeners from a specified event.
17289 * If you do not specify an event then all listeners will be removed.
17290 * That means every event will be emptied.
17291 * You can also pass a regex to remove all events that match it.
17292 *
17293 * @param {String|RegExp} [evt] Optional name of the event to remove all listeners for. Will remove from every event if not passed.
17294 * @return {Object} Current instance of EventEmitter for chaining.
17295 */
17296 proto.removeEvent = function removeEvent(evt) {
17297 var type = typeof evt === 'undefined' ? 'undefined' : _typeof(evt);
17298 var events = this._getEvents();
17299 var key;
17300
17301 // Remove different things depending on the state of evt
17302 if (type === 'string') {
17303 // Remove all listeners for the specified event
17304 delete events[evt];
17305 } else if (evt instanceof RegExp) {
17306 // Remove all events matching the regex.
17307 for (key in events) {
17308 if (events.hasOwnProperty(key) && evt.test(key)) {
17309 delete events[key];
17310 }
17311 }
17312 } else {
17313 // Remove all listeners in all events
17314 delete this._events;
17315 }
17316
17317 return this;
17318 };
17319
17320 /**
17321 * Alias of removeEvent.
17322 *
17323 * Added to mirror the node API.
17324 */
17325 proto.removeAllListeners = alias('removeEvent');
17326
17327 /**
17328 * Emits an event of your choice.
17329 * When emitted, every listener attached to that event will be executed.
17330 * If you pass the optional argument array then those arguments will be passed to every listener upon execution.
17331 * Because it uses `apply`, your array of arguments will be passed as if you wrote them out separately.
17332 * So they will not arrive within the array on the other side, they will be separate.
17333 * You can also pass a regular expression to emit to all events that match it.
17334 *
17335 * @param {String|RegExp} evt Name of the event to emit and execute listeners for.
17336 * @param {Array} [args] Optional array of arguments to be passed to each listener.
17337 * @return {Object} Current instance of EventEmitter for chaining.
17338 */
17339 proto.emitEvent = function emitEvent(evt, args) {
17340 var listenersMap = this.getListenersAsObject(evt);
17341 var listeners;
17342 var listener;
17343 var i;
17344 var key;
17345 var response;
17346
17347 for (key in listenersMap) {
17348 if (listenersMap.hasOwnProperty(key)) {
17349 listeners = listenersMap[key].slice(0);
17350
17351 for (i = 0; i < listeners.length; i++) {
17352 // If the listener returns true then it shall be removed from the event
17353 // The function is executed either with a basic call or an apply if there is an args array
17354 listener = listeners[i];
17355
17356 if (listener.once === true) {
17357 this.removeListener(evt, listener.listener);
17358 }
17359
17360 response = listener.listener.apply(this, args || []);
17361
17362 if (response === this._getOnceReturnValue()) {
17363 this.removeListener(evt, listener.listener);
17364 }
17365 }
17366 }
17367 }
17368
17369 return this;
17370 };
17371
17372 /**
17373 * Alias of emitEvent
17374 */
17375 proto.trigger = alias('emitEvent');
17376
17377 /**
17378 * Subtly different from emitEvent in that it will pass its arguments on to the listeners, as opposed to taking a single array of arguments to pass on.
17379 * As with emitEvent, you can pass a regex in place of the event name to emit to all events that match it.
17380 *
17381 * @param {String|RegExp} evt Name of the event to emit and execute listeners for.
17382 * @param {...*} Optional additional arguments to be passed to each listener.
17383 * @return {Object} Current instance of EventEmitter for chaining.
17384 */
17385 proto.emit = function emit(evt) {
17386 var args = Array.prototype.slice.call(arguments, 1);
17387 return this.emitEvent(evt, args);
17388 };
17389
17390 /**
17391 * Sets the current value to check against when executing listeners. If a
17392 * listeners return value matches the one set here then it will be removed
17393 * after execution. This value defaults to true.
17394 *
17395 * @param {*} value The new value to check for when executing listeners.
17396 * @return {Object} Current instance of EventEmitter for chaining.
17397 */
17398 proto.setOnceReturnValue = function setOnceReturnValue(value) {
17399 this._onceReturnValue = value;
17400 return this;
17401 };
17402
17403 /**
17404 * Fetches the current value to check against when executing listeners. If
17405 * the listeners return value matches this one then it should be removed
17406 * automatically. It will return true by default.
17407 *
17408 * @return {*|Boolean} The current value to check for or the default, true.
17409 * @api private
17410 */
17411 proto._getOnceReturnValue = function _getOnceReturnValue() {
17412 if (this.hasOwnProperty('_onceReturnValue')) {
17413 return this._onceReturnValue;
17414 } else {
17415 return true;
17416 }
17417 };
17418
17419 /**
17420 * Fetches the events object and creates one if required.
17421 *
17422 * @return {Object} The events storage object.
17423 * @api private
17424 */
17425 proto._getEvents = function _getEvents() {
17426 return this._events || (this._events = {});
17427 };
17428
17429 /**
17430 * Reverts the global {@link EventEmitter} to its previous value and returns a reference to this version.
17431 *
17432 * @return {Function} Non conflicting EventEmitter class.
17433 */
17434 EventEmitter.noConflict = function noConflict() {
17435 exports.EventEmitter = originalGlobalValue;
17436 return EventEmitter;
17437 };
17438
17439 // Expose the class either via AMD, CommonJS or the global object
17440 if (true) {
17441 !(__WEBPACK_AMD_DEFINE_RESULT__ = function () {
17442 return EventEmitter;
17443 }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
17444 } else if ((typeof module === 'undefined' ? 'undefined' : _typeof(module)) === 'object' && module.exports) {
17445 module.exports = EventEmitter;
17446 } else {
17447 exports.EventEmitter = EventEmitter;
17448 }
17449 })(this || {});
17450
17451 /***/
17452 },
17453 /* 262 */
17454 /***/function (module, exports, __webpack_require__) {
17455
17456 var Shape = {
17457 Rect: __webpack_require__(98),
17458 Circle: __webpack_require__(99),
17459 Ellipse: __webpack_require__(100),
17460 Path: __webpack_require__(101),
17461 Text: __webpack_require__(102),
17462 Line: __webpack_require__(103),
17463 Image: __webpack_require__(104),
17464 Polygon: __webpack_require__(105),
17465 Polyline: __webpack_require__(106),
17466 Arc: __webpack_require__(107),
17467 Fan: __webpack_require__(108),
17468 Cubic: __webpack_require__(109),
17469 Quadratic: __webpack_require__(110),
17470 Marker: __webpack_require__(111)
17471 };
17472
17473 module.exports = Shape;
17474
17475 /***/
17476 },
17477 /* 263 */
17478 /***/function (module, exports, __webpack_require__) {
17479
17480 var Util = __webpack_require__(0);
17481 var Inside = __webpack_require__(2);
17482 var Cubic = __webpack_require__(30);
17483 var Quadratic = __webpack_require__(53);
17484 var Ellipse = __webpack_require__(264);
17485 var vec3 = __webpack_require__(3).vec3;
17486 var mat3 = __webpack_require__(3).mat3;
17487
17488 var ARR_CMD = ['m', 'l', 'c', 'a', 'q', 'h', 'v', 't', 's', 'z'];
17489
17490 function toAbsolute(x, y, curPoint) {
17491 // 获取绝对坐标
17492 return {
17493 x: curPoint.x + x,
17494 y: curPoint.y + y
17495 };
17496 }
17497
17498 function toSymmetry(point, center) {
17499 // 点对称
17500 return {
17501 x: center.x + (center.x - point.x),
17502 y: center.y + (center.y - point.y)
17503 };
17504 }
17505
17506 function vMag(v) {
17507 return Math.sqrt(v[0] * v[0] + v[1] * v[1]);
17508 }
17509
17510 function vRatio(u, v) {
17511 return (u[0] * v[0] + u[1] * v[1]) / (vMag(u) * vMag(v));
17512 }
17513
17514 function vAngle(u, v) {
17515 return (u[0] * v[1] < u[1] * v[0] ? -1 : 1) * Math.acos(vRatio(u, v));
17516 }
17517
17518 function getArcParams(point1, point2, fa, fs, rx, ry, psiDeg) {
17519 var psi = Util.mod(Util.toRadian(psiDeg), Math.PI * 2);
17520 var x1 = point1.x;
17521 var y1 = point1.y;
17522 var x2 = point2.x;
17523 var y2 = point2.y;
17524 var xp = Math.cos(psi) * (x1 - x2) / 2.0 + Math.sin(psi) * (y1 - y2) / 2.0;
17525 var yp = -1 * Math.sin(psi) * (x1 - x2) / 2.0 + Math.cos(psi) * (y1 - y2) / 2.0;
17526 var lambda = xp * xp / (rx * rx) + yp * yp / (ry * ry);
17527
17528 if (lambda > 1) {
17529 rx *= Math.sqrt(lambda);
17530 ry *= Math.sqrt(lambda);
17531 }
17532
17533 var f = Math.sqrt((rx * rx * (ry * ry) - rx * rx * (yp * yp) - ry * ry * (xp * xp)) / (rx * rx * (yp * yp) + ry * ry * (xp * xp)));
17534
17535 if (fa === fs) {
17536 f *= -1;
17537 }
17538 if (isNaN(f)) {
17539 f = 0;
17540 }
17541
17542 var cxp = f * rx * yp / ry;
17543 var cyp = f * -ry * xp / rx;
17544
17545 var cx = (x1 + x2) / 2.0 + Math.cos(psi) * cxp - Math.sin(psi) * cyp;
17546 var cy = (y1 + y2) / 2.0 + Math.sin(psi) * cxp + Math.cos(psi) * cyp;
17547
17548 var theta = vAngle([1, 0], [(xp - cxp) / rx, (yp - cyp) / ry]);
17549 var u = [(xp - cxp) / rx, (yp - cyp) / ry];
17550 var v = [(-1 * xp - cxp) / rx, (-1 * yp - cyp) / ry];
17551 var dTheta = vAngle(u, v);
17552
17553 if (vRatio(u, v) <= -1) {
17554 dTheta = Math.PI;
17555 }
17556 if (vRatio(u, v) >= 1) {
17557 dTheta = 0;
17558 }
17559 if (fs === 0 && dTheta > 0) {
17560 dTheta = dTheta - 2 * Math.PI;
17561 }
17562 if (fs === 1 && dTheta < 0) {
17563 dTheta = dTheta + 2 * Math.PI;
17564 }
17565 return [point1, cx, cy, rx, ry, theta, dTheta, psi, fs];
17566 }
17567
17568 var PathSegment = function PathSegment(item, preSegment, isLast) {
17569 this.preSegment = preSegment;
17570 this.isLast = isLast;
17571 this.init(item, preSegment);
17572 };
17573
17574 Util.augment(PathSegment, {
17575 init: function init(item, preSegment) {
17576 var command = item[0];
17577 preSegment = preSegment || {
17578 endPoint: {
17579 x: 0,
17580 y: 0
17581 }
17582 };
17583 var relative = ARR_CMD.indexOf(command) >= 0; // /[a-z]/.test(command);
17584 var cmd = relative ? command.toUpperCase() : command;
17585 var p = item;
17586 var point1 = void 0;
17587 var point2 = void 0;
17588 var point3 = void 0;
17589 var point = void 0;
17590 var preEndPoint = preSegment.endPoint;
17591
17592 var p1 = p[1];
17593 var p2 = p[2];
17594 switch (cmd) {
17595 default:
17596 break;
17597 case 'M':
17598 if (relative) {
17599 point = toAbsolute(p1, p2, preEndPoint);
17600 } else {
17601 point = {
17602 x: p1,
17603 y: p2
17604 };
17605 }
17606 this.command = 'M';
17607 this.params = [preEndPoint, point];
17608 this.subStart = point;
17609 this.endPoint = point;
17610 break;
17611 case 'L':
17612 if (relative) {
17613 point = toAbsolute(p1, p2, preEndPoint);
17614 } else {
17615 point = {
17616 x: p1,
17617 y: p2
17618 };
17619 }
17620 this.command = 'L';
17621 this.params = [preEndPoint, point];
17622 this.subStart = preSegment.subStart;
17623 this.endPoint = point;
17624 if (this.isLast) {
17625 this.endTangent = function () {
17626 return [point.x - preEndPoint.x, point.y - preEndPoint.y];
17627 };
17628 }
17629 break;
17630 case 'H':
17631 if (relative) {
17632 point = toAbsolute(p1, 0, preEndPoint);
17633 } else {
17634 point = {
17635 x: p1,
17636 y: preEndPoint.y
17637 };
17638 }
17639 this.command = 'L';
17640 this.params = [preEndPoint, point];
17641 this.subStart = preSegment.subStart;
17642 this.endPoint = point;
17643 this.endTangent = function () {
17644 return [point.x - preEndPoint.x, point.y - preEndPoint.y];
17645 };
17646 break;
17647 case 'V':
17648 if (relative) {
17649 point = toAbsolute(0, p1, preEndPoint);
17650 } else {
17651 point = {
17652 x: preEndPoint.x,
17653 y: p1
17654 };
17655 }
17656 this.command = 'L';
17657 this.params = [preEndPoint, point];
17658 this.subStart = preSegment.subStart;
17659 this.endPoint = point;
17660 this.endTangent = function () {
17661 return [point.x - preEndPoint.x, point.y - preEndPoint.y];
17662 };
17663 break;
17664 case 'Q':
17665 if (relative) {
17666 point1 = toAbsolute(p1, p2, preEndPoint);
17667 point2 = toAbsolute(p[3], p[4], preEndPoint);
17668 } else {
17669 point1 = {
17670 x: p1,
17671 y: p2
17672 };
17673 point2 = {
17674 x: p[3],
17675 y: p[4]
17676 };
17677 }
17678 this.command = 'Q';
17679 this.params = [preEndPoint, point1, point2];
17680 this.subStart = preSegment.subStart;
17681 this.endPoint = point2;
17682 this.endTangent = function () {
17683 return [point2.x - point1.x, point2.y - point1.y];
17684 };
17685 break;
17686 case 'T':
17687 if (relative) {
17688 point2 = toAbsolute(p1, p2, preEndPoint);
17689 } else {
17690 point2 = {
17691 x: p1,
17692 y: p2
17693 };
17694 }
17695 if (preSegment.command === 'Q') {
17696 point1 = toSymmetry(preSegment.params[1], preEndPoint);
17697 this.command = 'Q';
17698 this.params = [preEndPoint, point1, point2];
17699 this.subStart = preSegment.subStart;
17700 this.endPoint = point2;
17701 this.endTangent = function () {
17702 return [point2.x - point1.x, point2.y - point1.y];
17703 };
17704 } else {
17705 this.command = 'TL';
17706 this.params = [preEndPoint, point2];
17707 this.subStart = preSegment.subStart;
17708 this.endPoint = point2;
17709 this.endTangent = function () {
17710 return [point2.x - preEndPoint.x, point2.y - preEndPoint.y];
17711 };
17712 }
17713
17714 break;
17715 case 'C':
17716 if (relative) {
17717 point1 = toAbsolute(p1, p2, preEndPoint);
17718 point2 = toAbsolute(p[3], p[4], preEndPoint);
17719 point3 = toAbsolute(p[5], p[6], preEndPoint);
17720 } else {
17721 point1 = {
17722 x: p1,
17723 y: p2
17724 };
17725 point2 = {
17726 x: p[3],
17727 y: p[4]
17728 };
17729 point3 = {
17730 x: p[5],
17731 y: p[6]
17732 };
17733 }
17734 this.command = 'C';
17735 this.params = [preEndPoint, point1, point2, point3];
17736 this.subStart = preSegment.subStart;
17737 this.endPoint = point3;
17738 this.endTangent = function () {
17739 return [point3.x - point2.x, point3.y - point2.y];
17740 };
17741 break;
17742 case 'S':
17743 if (relative) {
17744 point2 = toAbsolute(p1, p2, preEndPoint);
17745 point3 = toAbsolute(p[3], p[4], preEndPoint);
17746 } else {
17747 point2 = {
17748 x: p1,
17749 y: p2
17750 };
17751 point3 = {
17752 x: p[3],
17753 y: p[4]
17754 };
17755 }
17756 if (preSegment.command === 'C') {
17757 point1 = toSymmetry(preSegment.params[2], preEndPoint);
17758 this.command = 'C';
17759 this.params = [preEndPoint, point1, point2, point3];
17760 this.subStart = preSegment.subStart;
17761 this.endPoint = point3;
17762 this.endTangent = function () {
17763 return [point3.x - point2.x, point3.y - point2.y];
17764 };
17765 } else {
17766 this.command = 'SQ';
17767 this.params = [preEndPoint, point2, point3];
17768 this.subStart = preSegment.subStart;
17769 this.endPoint = point3;
17770 this.endTangent = function () {
17771 return [point3.x - point2.x, point3.y - point2.y];
17772 };
17773 }
17774 break;
17775 case 'A':
17776 {
17777 var rx = p1;
17778 var ry = p2;
17779 var psi = p[3];
17780 var fa = p[4];
17781 var fs = p[5];
17782 if (relative) {
17783 point = toAbsolute(p[6], p[7], preEndPoint);
17784 } else {
17785 point = {
17786 x: p[6],
17787 y: p[7]
17788 };
17789 }
17790
17791 this.command = 'A';
17792 this.params = getArcParams(preEndPoint, point, fa, fs, rx, ry, psi);
17793 this.subStart = preSegment.subStart;
17794 this.endPoint = point;
17795 break;
17796 }
17797 case 'Z':
17798 {
17799 this.command = 'Z';
17800 this.params = [preEndPoint, preSegment.subStart];
17801 this.subStart = preSegment.subStart;
17802 this.endPoint = preSegment.subStart;
17803 }
17804 }
17805 },
17806 isInside: function isInside(x, y, lineWidth) {
17807 var self = this;
17808 var command = self.command;
17809 var params = self.params;
17810 var box = self.box;
17811 if (box) {
17812 if (!Inside.box(box.minX, box.maxX, box.minY, box.maxY, x, y)) {
17813 return false;
17814 }
17815 }
17816 switch (command) {
17817 default:
17818 break;
17819 case 'M':
17820 return false;
17821 case 'TL':
17822 case 'L':
17823 case 'Z':
17824 return Inside.line(params[0].x, params[0].y, params[1].x, params[1].y, lineWidth, x, y);
17825 case 'SQ':
17826 case 'Q':
17827 return Inside.quadraticline(params[0].x, params[0].y, params[1].x, params[1].y, params[2].x, params[2].y, lineWidth, x, y);
17828 case 'C':
17829 {
17830 return Inside.cubicline(params[0].x, params[0].y, params[1].x, params[1].y, params[2].x, params[2].y, params[3].x, params[3].y, lineWidth, x, y);
17831 }
17832 case 'A':
17833 {
17834 var p = params;
17835 var cx = p[1];
17836 var cy = p[2];
17837 var rx = p[3];
17838 var ry = p[4];
17839 var theta = p[5];
17840 var dTheta = p[6];
17841 var psi = p[7];
17842 var fs = p[8];
17843
17844 var r = rx > ry ? rx : ry;
17845 var scaleX = rx > ry ? 1 : rx / ry;
17846 var scaleY = rx > ry ? ry / rx : 1;
17847
17848 p = [x, y, 1];
17849 var m = [1, 0, 0, 0, 1, 0, 0, 0, 1];
17850 mat3.translate(m, m, [-cx, -cy]);
17851 mat3.rotate(m, m, -psi);
17852 mat3.scale(m, m, [1 / scaleX, 1 / scaleY]);
17853 vec3.transformMat3(p, p, m);
17854 return Inside.arcline(0, 0, r, theta, theta + dTheta, 1 - fs, lineWidth, p[0], p[1]);
17855 }
17856 }
17857 return false;
17858 },
17859 draw: function draw(context) {
17860 var command = this.command;
17861 var params = this.params;
17862 var point1 = void 0;
17863 var point2 = void 0;
17864 var point3 = void 0;
17865
17866 switch (command) {
17867 default:
17868 break;
17869 case 'M':
17870 context.moveTo(params[1].x, params[1].y);
17871 break;
17872 case 'TL':
17873 case 'L':
17874 context.lineTo(params[1].x, params[1].y);
17875 break;
17876 case 'SQ':
17877 case 'Q':
17878 point1 = params[1];
17879 point2 = params[2];
17880 context.quadraticCurveTo(point1.x, point1.y, point2.x, point2.y);
17881 break;
17882 case 'C':
17883 point1 = params[1];
17884 point2 = params[2];
17885 point3 = params[3];
17886 context.bezierCurveTo(point1.x, point1.y, point2.x, point2.y, point3.x, point3.y);
17887 break;
17888 case 'A':
17889 {
17890 var p = params;
17891 var p1 = p[1];
17892 var p2 = p[2];
17893 var cx = p1;
17894 var cy = p2;
17895 var rx = p[3];
17896 var ry = p[4];
17897 var theta = p[5];
17898 var dTheta = p[6];
17899 var psi = p[7];
17900 var fs = p[8];
17901
17902 var r = rx > ry ? rx : ry;
17903 var scaleX = rx > ry ? 1 : rx / ry;
17904 var scaleY = rx > ry ? ry / rx : 1;
17905
17906 context.translate(cx, cy);
17907 context.rotate(psi);
17908 context.scale(scaleX, scaleY);
17909 context.arc(0, 0, r, theta, theta + dTheta, 1 - fs);
17910 context.scale(1 / scaleX, 1 / scaleY);
17911 context.rotate(-psi);
17912 context.translate(-cx, -cy);
17913 break;
17914 }
17915 case 'Z':
17916 context.closePath();
17917 break;
17918 }
17919 },
17920 getBBox: function getBBox(lineWidth) {
17921 var halfWidth = lineWidth / 2;
17922 var params = this.params;
17923 var yDims = void 0;
17924 var xDims = void 0;
17925 var i = void 0;
17926 var l = void 0;
17927
17928 switch (this.command) {
17929 default:
17930 case 'M':
17931 case 'Z':
17932 break;
17933 case 'TL':
17934 case 'L':
17935 this.box = {
17936 minX: Math.min(params[0].x, params[1].x) - halfWidth,
17937 maxX: Math.max(params[0].x, params[1].x) + halfWidth,
17938 minY: Math.min(params[0].y, params[1].y) - halfWidth,
17939 maxY: Math.max(params[0].y, params[1].y) + halfWidth
17940 };
17941 break;
17942 case 'SQ':
17943 case 'Q':
17944 xDims = Quadratic.extrema(params[0].x, params[1].x, params[2].x);
17945 for (i = 0, l = xDims.length; i < l; i++) {
17946 xDims[i] = Quadratic.at(params[0].x, params[1].x, params[2].x, xDims[i]);
17947 }
17948 xDims.push(params[0].x, params[2].x);
17949 yDims = Quadratic.extrema(params[0].y, params[1].y, params[2].y);
17950 for (i = 0, l = yDims.length; i < l; i++) {
17951 yDims[i] = Quadratic.at(params[0].y, params[1].y, params[2].y, yDims);
17952 }
17953 yDims.push(params[0].y, params[2].y);
17954 this.box = {
17955 minX: Math.min.apply(Math, xDims) - halfWidth,
17956 maxX: Math.max.apply(Math, xDims) + halfWidth,
17957 minY: Math.min.apply(Math, yDims) - halfWidth,
17958 maxY: Math.max.apply(Math, yDims) + halfWidth
17959 };
17960 break;
17961 case 'C':
17962 xDims = Cubic.extrema(params[0].x, params[1].x, params[2].x, params[3].x);
17963 for (i = 0, l = xDims.length; i < l; i++) {
17964 xDims[i] = Cubic.at(params[0].x, params[1].x, params[2].x, params[3].x, xDims[i]);
17965 }
17966 yDims = Cubic.extrema(params[0].y, params[1].y, params[2].y, params[3].y);
17967 for (i = 0, l = yDims.length; i < l; i++) {
17968 yDims[i] = Cubic.at(params[0].y, params[1].y, params[2].y, params[3].y, yDims[i]);
17969 }
17970 xDims.push(params[0].x, params[3].x);
17971 yDims.push(params[0].y, params[3].y);
17972 this.box = {
17973 minX: Math.min.apply(Math, xDims) - halfWidth,
17974 maxX: Math.max.apply(Math, xDims) + halfWidth,
17975 minY: Math.min.apply(Math, yDims) - halfWidth,
17976 maxY: Math.max.apply(Math, yDims) + halfWidth
17977 };
17978 break;
17979 case 'A':
17980 {
17981 // todo 待优化
17982 var p = params;
17983 var cx = p[1];
17984 var cy = p[2];
17985 var rx = p[3];
17986 var ry = p[4];
17987 var theta = p[5];
17988 var dTheta = p[6];
17989 var psi = p[7];
17990 var fs = p[8];
17991 var start = theta;
17992 var end = theta + dTheta;
17993
17994 var xDim = Ellipse.xExtrema(psi, rx, ry);
17995 var minX = Infinity;
17996 var maxX = -Infinity;
17997 var xs = [start, end];
17998 for (i = -Math.PI * 2; i <= Math.PI * 2; i += Math.PI) {
17999 var xAngle = xDim + i;
18000 if (fs === 1) {
18001 if (start < xAngle && xAngle < end) {
18002 xs.push(xAngle);
18003 }
18004 } else {
18005 if (end < xAngle && xAngle < start) {
18006 xs.push(xAngle);
18007 }
18008 }
18009 }
18010
18011 for (i = 0, l = xs.length; i < l; i++) {
18012 var x = Ellipse.xAt(psi, rx, ry, cx, xs[i]);
18013 if (x < minX) {
18014 minX = x;
18015 }
18016 if (x > maxX) {
18017 maxX = x;
18018 }
18019 }
18020
18021 var yDim = Ellipse.yExtrema(psi, rx, ry);
18022 var minY = Infinity;
18023 var maxY = -Infinity;
18024 var ys = [start, end];
18025 for (i = -Math.PI * 2; i <= Math.PI * 2; i += Math.PI) {
18026 var yAngle = yDim + i;
18027 if (fs === 1) {
18028 if (start < yAngle && yAngle < end) {
18029 ys.push(yAngle);
18030 }
18031 } else {
18032 if (end < yAngle && yAngle < start) {
18033 ys.push(yAngle);
18034 }
18035 }
18036 }
18037
18038 for (i = 0, l = ys.length; i < l; i++) {
18039 var y = Ellipse.yAt(psi, rx, ry, cy, ys[i]);
18040 if (y < minY) {
18041 minY = y;
18042 }
18043 if (y > maxY) {
18044 maxY = y;
18045 }
18046 }
18047 this.box = {
18048 minX: minX - halfWidth,
18049 maxX: maxX + halfWidth,
18050 minY: minY - halfWidth,
18051 maxY: maxY + halfWidth
18052 };
18053 break;
18054 }
18055 }
18056 }
18057 });
18058
18059 module.exports = PathSegment;
18060
18061 /***/
18062 },
18063 /* 264 */
18064 /***/function (module, exports) {
18065
18066 module.exports = {
18067 xAt: function xAt(psi, rx, ry, cx, t) {
18068 return rx * Math.cos(psi) * Math.cos(t) - ry * Math.sin(psi) * Math.sin(t) + cx;
18069 },
18070 yAt: function yAt(psi, rx, ry, cy, t) {
18071 return rx * Math.sin(psi) * Math.cos(t) + ry * Math.cos(psi) * Math.sin(t) + cy;
18072 },
18073 xExtrema: function xExtrema(psi, rx, ry) {
18074 return Math.atan(-ry / rx * Math.tan(psi));
18075 },
18076 yExtrema: function yExtrema(psi, rx, ry) {
18077 return Math.atan(ry / (rx * Math.tan(psi)));
18078 }
18079 };
18080
18081 /***/
18082 }]
18083 /******/)
18084 );
18085});
18086/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(26)(module)))
18087
18088/***/ }),
18089/* 3 */
18090/***/ (function(module, exports) {
18091
18092/**
18093 * Checks if `value` is classified as an `Array` object.
18094 *
18095 * @static
18096 * @memberOf _
18097 * @since 0.1.0
18098 * @category Lang
18099 * @param {*} value The value to check.
18100 * @returns {boolean} Returns `true` if `value` is an array, else `false`.
18101 * @example
18102 *
18103 * _.isArray([1, 2, 3]);
18104 * // => true
18105 *
18106 * _.isArray(document.body.children);
18107 * // => false
18108 *
18109 * _.isArray('abc');
18110 * // => false
18111 *
18112 * _.isArray(_.noop);
18113 * // => false
18114 */
18115var isArray = Array.isArray;
18116
18117module.exports = isArray;
18118
18119/***/ }),
18120/* 4 */
18121/***/ (function(module, exports, __webpack_require__) {
18122
18123var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
18124
18125var freeGlobal = __webpack_require__(71);
18126
18127/** Detect free variable `self`. */
18128var freeSelf = (typeof self === 'undefined' ? 'undefined' : _typeof(self)) == 'object' && self && self.Object === Object && self;
18129
18130/** Used as a reference to the global object. */
18131var root = freeGlobal || freeSelf || Function('return this')();
18132
18133module.exports = root;
18134
18135/***/ }),
18136/* 5 */
18137/***/ (function(module, exports) {
18138
18139var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
18140
18141/**
18142 * Checks if `value` is object-like. A value is object-like if it's not `null`
18143 * and has a `typeof` result of "object".
18144 *
18145 * @static
18146 * @memberOf _
18147 * @since 4.0.0
18148 * @category Lang
18149 * @param {*} value The value to check.
18150 * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
18151 * @example
18152 *
18153 * _.isObjectLike({});
18154 * // => true
18155 *
18156 * _.isObjectLike([1, 2, 3]);
18157 * // => true
18158 *
18159 * _.isObjectLike(_.noop);
18160 * // => false
18161 *
18162 * _.isObjectLike(null);
18163 * // => false
18164 */
18165function isObjectLike(value) {
18166 return value != null && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) == 'object';
18167}
18168
18169module.exports = isObjectLike;
18170
18171/***/ }),
18172/* 6 */
18173/***/ (function(module, exports, __webpack_require__) {
18174
18175var _Symbol = __webpack_require__(12),
18176 getRawTag = __webpack_require__(135),
18177 objectToString = __webpack_require__(136);
18178
18179/** `Object#toString` result references. */
18180var nullTag = '[object Null]',
18181 undefinedTag = '[object Undefined]';
18182
18183/** Built-in value references. */
18184var symToStringTag = _Symbol ? _Symbol.toStringTag : undefined;
18185
18186/**
18187 * The base implementation of `getTag` without fallbacks for buggy environments.
18188 *
18189 * @private
18190 * @param {*} value The value to query.
18191 * @returns {string} Returns the `toStringTag`.
18192 */
18193function baseGetTag(value) {
18194 if (value == null) {
18195 return value === undefined ? undefinedTag : nullTag;
18196 }
18197 return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
18198}
18199
18200module.exports = baseGetTag;
18201
18202/***/ }),
18203/* 7 */
18204/***/ (function(module, exports) {
18205
18206var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
18207
18208/**
18209 * Checks if `value` is the
18210 * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
18211 * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
18212 *
18213 * @static
18214 * @memberOf _
18215 * @since 0.1.0
18216 * @category Lang
18217 * @param {*} value The value to check.
18218 * @returns {boolean} Returns `true` if `value` is an object, else `false`.
18219 * @example
18220 *
18221 * _.isObject({});
18222 * // => true
18223 *
18224 * _.isObject([1, 2, 3]);
18225 * // => true
18226 *
18227 * _.isObject(_.noop);
18228 * // => true
18229 *
18230 * _.isObject(null);
18231 * // => false
18232 */
18233function isObject(value) {
18234 var type = typeof value === 'undefined' ? 'undefined' : _typeof(value);
18235 return value != null && (type == 'object' || type == 'function');
18236}
18237
18238module.exports = isObject;
18239
18240/***/ }),
18241/* 8 */
18242/***/ (function(module, exports, __webpack_require__) {
18243
18244var isFunction = __webpack_require__(48),
18245 isLength = __webpack_require__(47);
18246
18247/**
18248 * Checks if `value` is array-like. A value is considered array-like if it's
18249 * not a function and has a `value.length` that's an integer greater than or
18250 * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
18251 *
18252 * @static
18253 * @memberOf _
18254 * @since 4.0.0
18255 * @category Lang
18256 * @param {*} value The value to check.
18257 * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
18258 * @example
18259 *
18260 * _.isArrayLike([1, 2, 3]);
18261 * // => true
18262 *
18263 * _.isArrayLike(document.body.children);
18264 * // => true
18265 *
18266 * _.isArrayLike('abc');
18267 * // => true
18268 *
18269 * _.isArrayLike(_.noop);
18270 * // => false
18271 */
18272function isArrayLike(value) {
18273 return value != null && isLength(value.length) && !isFunction(value);
18274}
18275
18276module.exports = isArrayLike;
18277
18278/***/ }),
18279/* 9 */
18280/***/ (function(module, exports, __webpack_require__) {
18281
18282function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
18283
18284function _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; }
18285
18286function _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; }
18287
18288/**
18289 * @fileOverview 所有 Geometry 的基类
18290 * @author dxq613@gmail.com
18291 */
18292
18293var Base = __webpack_require__(63);
18294var Attr = __webpack_require__(286);
18295var Util = __webpack_require__(0);
18296var Global = __webpack_require__(1);
18297var Adjust = __webpack_require__(294);
18298var Labels = __webpack_require__(299);
18299var Shape = __webpack_require__(66);
18300var TooltipMixin = __webpack_require__(310);
18301var ActiveMixin = __webpack_require__(311);
18302var SelectMixin = __webpack_require__(312);
18303var GROUP_ATTRS = ['color', 'shape', 'size'];
18304var FIELD_ORIGIN = '_origin';
18305
18306function parseFields(field) {
18307 if (Util.isArray(field)) {
18308 return field;
18309 }
18310 if (Util.isString(field)) {
18311 return field.split('*');
18312 }
18313 return [field];
18314}
18315
18316// 转换成对象的数组 [{type: 'adjust'}]
18317function parseAdjusts(adjusts) {
18318 if (Util.isString(adjusts)) {
18319 adjusts = [adjusts];
18320 }
18321 Util.each(adjusts, function (adjust, index) {
18322 if (!Util.isObject(adjust)) {
18323 adjusts[index] = { type: adjust };
18324 }
18325 });
18326 return adjusts;
18327}
18328
18329/**
18330 * 几何标记
18331 * @class Geom
18332 */
18333
18334var GeomBase = function (_Base) {
18335 _inherits(GeomBase, _Base);
18336
18337 /**
18338 * 获取默认的配置属性
18339 * @protected
18340 * @return {Object} 默认属性
18341 */
18342 GeomBase.prototype.getDefaultCfg = function getDefaultCfg() {
18343 return {
18344 /**
18345 * 标记 _id 用于区分执行动画
18346 * @type {String}
18347 */
18348 _id: null,
18349 /**
18350 * 类型
18351 * @type {String}
18352 */
18353 type: 'base',
18354
18355 /**
18356 * 坐标系
18357 * @type {Object}
18358 */
18359 coord: null,
18360
18361 /**
18362 * 属性映射集
18363 * @protected
18364 * @type {Object}
18365 */
18366 attrs: {},
18367
18368 /**
18369 * 所属的View
18370 * @type {View}
18371 */
18372 view: null,
18373
18374 /**
18375 * 几何标记显示的数据
18376 * @type {Array}
18377 */
18378 data: [],
18379
18380 /**
18381 * 相关的度量
18382 * @type {Object}
18383 */
18384 scales: {},
18385
18386 /**
18387 * 绘图容器
18388 * @type {Object}
18389 */
18390 container: null,
18391
18392 /**
18393 * 文本容器
18394 * @type {Object}
18395 */
18396 labelContainer: null,
18397
18398 /**
18399 * 图形容器
18400 * @type {Object}
18401 */
18402 shapeContainer: null,
18403
18404 /**
18405 * 几何标记的一些配置项,用于延迟生成图表
18406 * @type {Object}
18407 */
18408 attrOptions: {},
18409 styleOptions: null,
18410 selectedOptions: null,
18411 /**
18412 * 某些类存在默认的adjust,不能更改 adjust
18413 * @type {Boolean}
18414 */
18415 hasDefaultAdjust: false,
18416 adjusts: null,
18417 /**
18418 * 使用形状的类型
18419 * @protected
18420 * @type {String}
18421 */
18422 shapeType: null,
18423 /**
18424 * 是否生成多个点来绘制图形
18425 * @protected
18426 * @type {Boolean}
18427 */
18428 generatePoints: false,
18429
18430 /**
18431 * 数据是否进行排序
18432 * @type {Boolean}
18433 */
18434 sortable: false,
18435
18436 labelCfg: null,
18437 /**
18438 * 是否共享 tooltip
18439 * @type {Boolean}
18440 */
18441 shareTooltip: true,
18442 tooltipCfg: null,
18443 /**
18444 * 是否执行动画,默认执行
18445 * @type {Boolean}
18446 */
18447 animate: true,
18448 /**
18449 * 动画配置
18450 * @type {[type]}
18451 */
18452 animateCfg: null
18453 };
18454 };
18455
18456 function GeomBase(cfg) {
18457 _classCallCheck(this, GeomBase);
18458
18459 var _this = _possibleConstructorReturn(this, _Base.call(this, cfg));
18460
18461 Util.assign(_this, TooltipMixin, ActiveMixin, SelectMixin);
18462 if (_this.get('container')) {
18463 _this._initContainer();
18464 }
18465 _this._initOptions();
18466 return _this;
18467 }
18468
18469 // 初始化时对配置项的格式化
18470
18471
18472 GeomBase.prototype._initOptions = function _initOptions() {
18473 var adjusts = this.get('adjusts');
18474 if (adjusts) {
18475 adjusts = parseAdjusts(adjusts);
18476 this.set('adjusts', adjusts);
18477 }
18478 };
18479
18480 GeomBase.prototype._createScale = function _createScale(field) {
18481 var scales = this.get('scales');
18482 var scale = scales[field];
18483 if (!scale) {
18484 scale = this.get('view').createScale(field);
18485 scales[field] = scale;
18486 }
18487 return scale;
18488 };
18489
18490 GeomBase.prototype._setAttrOptions = function _setAttrOptions(attrName, attrCfg) {
18491 var options = this.get('attrOptions');
18492 options[attrName] = attrCfg;
18493 };
18494
18495 GeomBase.prototype._createAttrOption = function _createAttrOption(attrName, field, cfg, defaultValues) {
18496 var attrCfg = {};
18497 attrCfg.field = field;
18498 if (cfg) {
18499 if (Util.isFunction(cfg)) {
18500 attrCfg.callback = cfg;
18501 } else {
18502 attrCfg.values = cfg;
18503 }
18504 } else if (attrName !== 'color') {
18505 attrCfg.values = defaultValues;
18506 }
18507 this._setAttrOptions(attrName, attrCfg);
18508 };
18509
18510 /**
18511 * 位置属性映射
18512 * @chainable
18513 * @param {String} field 字段名
18514 * @return {Geom} geom 当前几何标记
18515 */
18516
18517
18518 GeomBase.prototype.position = function position(field) {
18519 this._setAttrOptions('position', {
18520 field: field
18521 });
18522 return this;
18523 };
18524
18525 /**
18526 * 颜色属性映射
18527 * @chainable
18528 * @param {String} field 字段名
18529 * @param {Array|Function} values 颜色的数组或者回调函数
18530 * @return {Geom} geom 当前几何标记
18531 */
18532
18533
18534 GeomBase.prototype.color = function color(field, values) {
18535 this._createAttrOption('color', field, values, Global.colors);
18536 return this;
18537 };
18538
18539 /**
18540 * 大小属性映射
18541 * @chainable
18542 * @param {String} field 字段名
18543 * @param {Array|Function} values 大小的数组或者回调函数
18544 * @return {Geom} geom 当前几何标记
18545 */
18546
18547
18548 GeomBase.prototype.size = function size(field, values) {
18549 this._createAttrOption('size', field, values, Global.sizes);
18550 return this;
18551 };
18552
18553 /**
18554 * 形状属性映射
18555 * @chainable
18556 * @param {String} field 字段名
18557 * @param {Array|Function} values 大小的数组或者回调函数
18558 * @return {Geom} geom 当前几何标记
18559 */
18560
18561
18562 GeomBase.prototype.shape = function shape(field, values) {
18563 var type = this.get('type');
18564 var shapes = Global.shapes[type] || [];
18565 this._createAttrOption('shape', field, values, shapes);
18566 return this;
18567 };
18568
18569 /**
18570 * 透明度属性映射
18571 * @chainable
18572 * @param {String} field 字段名
18573 * @param {Array|Function} values 透明度的数组或者回调函数
18574 * @return {Geom} geom 当前几何标记
18575 */
18576
18577
18578 GeomBase.prototype.opacity = function opacity(field, values) {
18579 this._createAttrOption('opacity', field, values, Global.opacities);
18580 return this;
18581 };
18582
18583 GeomBase.prototype.style = function style(field, cfg) {
18584 var styleOptions = this.get('styleOptions');
18585 if (!styleOptions) {
18586 styleOptions = {};
18587 this.set('styleOptions', styleOptions);
18588 }
18589 if (Util.isObject(field)) {
18590 cfg = field;
18591 field = null;
18592 }
18593 var fields = void 0;
18594 if (field) {
18595 fields = parseFields(field);
18596 }
18597 styleOptions.fields = fields;
18598 styleOptions.style = cfg;
18599 return this;
18600 };
18601
18602 GeomBase.prototype.label = function label(field, callback, cfg) {
18603 var self = this;
18604 var labelCfg = self.get('labelCfg');
18605 // const scales = Util.map(self.get('labelCfg').fields, field => self._createScale(field));
18606 if (!labelCfg) {
18607 labelCfg = {};
18608 self.set('labelCfg', labelCfg);
18609 }
18610 var fields = void 0;
18611 if (field) {
18612 fields = parseFields(field);
18613 }
18614 labelCfg.fields = fields;
18615 // 如果存在回调函数
18616 if (Util.isFunction(callback)) {
18617 if (!cfg) {
18618 cfg = {};
18619 }
18620 cfg.content = callback;
18621 } else if (Util.isObject(callback)) {
18622 // 如果没有设置回调函数
18623 cfg = callback;
18624 }
18625
18626 labelCfg.cfg = cfg;
18627
18628 return this;
18629 };
18630
18631 GeomBase.prototype.tooltip = function tooltip(field, cfg) {
18632 var tooltipCfg = this.get('tooltipCfg');
18633 if (!tooltipCfg) {
18634 tooltipCfg = {};
18635 }
18636 if (field === false) {
18637 // geom 关闭 tooltip
18638 this.set('tooltipCfg', false);
18639 } else {
18640 var tooltipFields = void 0;
18641 if (field) {
18642 tooltipFields = parseFields(field);
18643 }
18644 tooltipCfg.fields = tooltipFields;
18645 tooltipCfg.cfg = cfg;
18646 }
18647
18648 this.set('tooltipCfg', tooltipCfg);
18649 return this;
18650 };
18651
18652 GeomBase.prototype.animate = function animate(cfg) {
18653 this.set('animateCfg', cfg);
18654 return this;
18655 };
18656
18657 /**
18658 * 是否允许使用默认的图形激活交互
18659 * @param {Boolean} enable 是否允许激活开关
18660 * @return {Geom} 返回 geom 自身
18661 */
18662
18663
18664 GeomBase.prototype.active = function active(enable) {
18665 this.set('allowActive', enable);
18666 return this;
18667 };
18668
18669 /**
18670 * 对 geometry 进行数据调整
18671 * @chainable
18672 * @param {String|Array|null} adjusts 数据调整的类型
18673 * @return {Object} geometry 对象
18674 */
18675
18676
18677 GeomBase.prototype.adjust = function adjust(adjusts) {
18678 if (!this.get('hasDefaultAdjust')) {
18679 if (adjusts) {
18680 adjusts = parseAdjusts(adjusts);
18681 }
18682 this.set('adjusts', adjusts);
18683 }
18684 return this;
18685 };
18686
18687 /**
18688 * 设置图形的选中模式
18689 * @param {Boolean|Object} enable 布尔类型用于模式开关,对象类型用于配置
18690 * @param {Object} cfg 选中配置项
18691 * @return {Geom} 返回 geom 自身
18692 */
18693
18694
18695 GeomBase.prototype.select = function select(enable, cfg) {
18696 if (enable === false) {
18697 this.set('allowSelect', false);
18698 } else if (Util.isObject(enable)) {
18699 this.set('allowSelect', true);
18700 this.set('selectedOptions', enable);
18701 } else {
18702 this.set('allowSelect', true);
18703 this.set('selectedOptions', cfg);
18704 }
18705
18706 return this;
18707 };
18708
18709 GeomBase.prototype.hasAdjust = function hasAdjust(adjustType) {
18710 var self = this;
18711 var adjusts = self.get('adjusts');
18712 if (!adjustType) {
18713 return false;
18714 }
18715 var rst = false;
18716 Util.each(adjusts, function (adjust) {
18717 if (adjust.type === adjustType) {
18718 rst = true;
18719 return false;
18720 }
18721 });
18722 return rst;
18723 };
18724
18725 GeomBase.prototype.hasStack = function hasStack() {
18726 var isStacked = this.get('isStacked');
18727 if (Util.isNil(isStacked)) {
18728 isStacked = this.hasAdjust('stack');
18729 this.set('isStacked', isStacked);
18730 }
18731 return isStacked;
18732 };
18733
18734 GeomBase.prototype.isInCircle = function isInCircle() {
18735 var coord = this.get('coord');
18736 return coord && coord.isPolar;
18737 };
18738
18739 GeomBase.prototype._initContainer = function _initContainer() {
18740 var self = this;
18741 var shapeContainer = self.get('shapeContainer');
18742 if (!shapeContainer) {
18743 var container = self.get('container');
18744 var view = self.get('view');
18745 var viewId = view && view.get('_id');
18746 shapeContainer = container.addGroup({
18747 viewId: viewId
18748 });
18749 self.set('shapeContainer', shapeContainer);
18750 }
18751 };
18752
18753 GeomBase.prototype.init = function init() {
18754 var self = this;
18755 self._initContainer();
18756 self._initAttrs();
18757 if (self.get('tooltipCfg') && self.get('tooltipCfg').fields) {
18758 var tooltipFields = self.get('tooltipCfg').fields;
18759 Util.each(tooltipFields, function (field) {
18760 self._createScale(field);
18761 });
18762 }
18763 var dataArray = self._processData();
18764 if (self.get('adjusts')) {
18765 self._adjust(dataArray);
18766 }
18767 self.set('dataArray', dataArray);
18768 };
18769
18770 // step 1: init attrs
18771
18772
18773 GeomBase.prototype._initAttrs = function _initAttrs() {
18774 var self = this;
18775 var attrs = this.get('attrs');
18776 var attrOptions = this.get('attrOptions');
18777 var coord = self.get('coord');
18778 var isPie = false;
18779
18780 for (var type in attrOptions) {
18781 if (attrOptions.hasOwnProperty(type)) {
18782 var option = attrOptions[type];
18783 var className = Util.upperFirst(type);
18784 var fields = parseFields(option.field);
18785 if (type === 'position') {
18786 option.coord = coord;
18787 // 饼图坐标系下,填充一维
18788 if (fields.length === 1 && coord.type === 'theta') {
18789 fields.unshift('1');
18790 isPie = true;
18791 }
18792 }
18793 var scales = [];
18794 for (var i = 0; i < fields.length; i++) {
18795 var field = fields[i];
18796 var scale = self._createScale(field);
18797 if (type === 'color' && Util.isNil(option.values)) {
18798 // 设置 color 的默认色值
18799 if (scale.values.length <= 8) {
18800 option.values = isPie ? Global.colors_pie : Global.colors;
18801 } else if (scale.values.length <= 16) {
18802 option.values = isPie ? Global.colors_pie_16 : Global.colors_16;
18803 } else {
18804 option.values = Global.colors_24;
18805 }
18806
18807 if (Util.isNil(option.values)) {
18808 option.values = Global.colors; // 防止主题没有声明诸如 colors_pie 的属性
18809 }
18810 }
18811 scales.push(scale);
18812 }
18813 // 饼图需要填充满整个空间
18814 if (coord.type === 'theta' && type === 'position' && scales.length > 1) {
18815 var yScale = scales[1];
18816 yScale.change({
18817 nice: false,
18818 min: 0,
18819 max: Math.max.apply(null, yScale.values)
18820 });
18821 }
18822 option.scales = scales;
18823 var attr = new Attr[className](option);
18824 attrs[type] = attr;
18825 }
18826 }
18827 };
18828 // step 2: 处理数据
18829
18830
18831 GeomBase.prototype._processData = function _processData() {
18832 var self = this;
18833 var data = this.get('data');
18834 var dataArray = [];
18835 var groupedArray = this._groupData(data);
18836 for (var i = 0; i < groupedArray.length; i++) {
18837 var subData = groupedArray[i];
18838 var tempData = self._saveOrigin(subData);
18839 self._numberic(tempData);
18840 dataArray.push(tempData);
18841 }
18842 return dataArray;
18843 };
18844
18845 // step 2.1 数据分组
18846
18847
18848 GeomBase.prototype._groupData = function _groupData(data) {
18849 var groupScales = this._getGroupScales();
18850 var fields = groupScales.map(function (scale) {
18851 return scale.field;
18852 });
18853
18854 return Util.Array.group(data, fields);
18855 };
18856
18857 // step 2.2 数据调整前保存原始数据
18858
18859
18860 GeomBase.prototype._saveOrigin = function _saveOrigin(data) {
18861 var rst = [];
18862 for (var i = 0; i < data.length; i++) {
18863 var origin = data[i];
18864 var obj = {};
18865 for (var k in origin) {
18866 obj[k] = origin[k];
18867 }
18868 // const obj = Util.mix({}, origin);
18869 obj[FIELD_ORIGIN] = origin;
18870 rst.push(obj);
18871 }
18872 return rst;
18873 };
18874
18875 // step 2.3 将分类数据翻译成数据, 仅对位置相关的度量进行数字化处理
18876
18877
18878 GeomBase.prototype._numberic = function _numberic(data) {
18879 var positionAttr = this.getAttr('position');
18880 var scales = positionAttr.scales;
18881 for (var j = 0; j < data.length; j++) {
18882 var obj = data[j];
18883 for (var i = 0; i < Math.min(2, scales.length); i++) {
18884 var scale = scales[i];
18885 if (scale.isCategory) {
18886 var field = scale.field;
18887 obj[field] = scale.translate(obj[field]);
18888 }
18889 }
18890 }
18891 };
18892
18893 GeomBase.prototype._getGroupScales = function _getGroupScales() {
18894 var self = this;
18895 var scales = self.get('groupScales');
18896 if (!scales) {
18897 scales = [];
18898 var attrs = self.get('attrs');
18899 Util.each(attrs, function (attr) {
18900 if (GROUP_ATTRS.indexOf(attr.type) !== -1) {
18901 var attrScales = attr.scales;
18902 Util.each(attrScales, function (scale) {
18903 if (scale.isCategory && Util.indexOf(scales, scale) === -1) {
18904 scales.push(scale);
18905 }
18906 });
18907 }
18908 });
18909 self.set('groupScales', scales);
18910 }
18911 return scales;
18912 };
18913
18914 GeomBase.prototype._updateStackRange = function _updateStackRange(field, scale, dataArray) {
18915 var mergeArray = Util.Array.merge(dataArray);
18916 var min = scale.min;
18917 var max = scale.max;
18918 for (var i = 0; i < mergeArray.length; i++) {
18919 var obj = mergeArray[i];
18920 var tmpMin = Math.min.apply(null, obj[field]);
18921 var tmpMax = Math.max.apply(null, obj[field]);
18922 if (tmpMin < min) {
18923 min = tmpMin;
18924 }
18925 if (tmpMax > max) {
18926 max = tmpMax;
18927 }
18928 }
18929 if (min < scale.min || max > scale.max) {
18930 scale.change({
18931 min: min,
18932 max: max
18933 });
18934 }
18935 };
18936
18937 // step 2.2 调整数据
18938
18939
18940 GeomBase.prototype._adjust = function _adjust(dataArray) {
18941 var self = this;
18942 var adjusts = self.get('adjusts');
18943
18944 var yScale = self.getYScale();
18945 var xScale = self.getXScale();
18946 var xField = xScale.field;
18947 var yField = yScale ? yScale.field : null;
18948 Util.each(adjusts, function (adjust) {
18949 var adjustCfg = Util.mix({
18950 xField: xField,
18951 yField: yField
18952 }, adjust);
18953 var adjustType = Util.upperFirst(adjust.type);
18954 if (adjustType === 'Dodge') {
18955 var adjustNames = [];
18956 if (xScale.isCategory || xScale.isIdentity) {
18957 adjustNames.push('x');
18958 } else if (!yScale) {
18959 adjustNames.push('y');
18960 } else {
18961 throw new Error('dodge is not support linear attribute, please use category attribute!');
18962 }
18963 adjustCfg.adjustNames = adjustNames;
18964 /* if (self.isInCircle()) {
18965 adjustCfg.dodgeRatio = 1;
18966 adjustCfg.marginRatio = 0;
18967 }*/
18968 } else if (adjustType === 'Stack') {
18969 var coord = self.get('coord');
18970 if (!yScale) {
18971 // 一维的情况下获取高度和默认size
18972 adjustCfg.height = coord.getHeight();
18973 var size = self.getDefaultValue('size') || 3;
18974 adjustCfg.size = size;
18975 }
18976 if (!coord.isTransposed) {
18977 adjustCfg.reverseOrder = true;
18978 }
18979 }
18980 var adjustElement = new Adjust[adjustType](adjustCfg);
18981 adjustElement.processAdjust(dataArray);
18982 if (adjustType === 'Stack' && yScale) {
18983 self._updateStackRange(yField, yScale, dataArray);
18984 }
18985 });
18986 };
18987
18988 /**
18989 * @internal 设置coord,通常外部容器变化时,coord 会发生变化
18990 * @param {Object} coord 坐标系
18991 */
18992
18993
18994 GeomBase.prototype.setCoord = function setCoord(coord) {
18995 this.set('coord', coord);
18996 var position = this.getAttr('position');
18997 var shapeContainer = this.get('shapeContainer');
18998 shapeContainer.setMatrix(coord.matrix);
18999 if (position) {
19000 position.coord = coord;
19001 }
19002 };
19003
19004 // step 3 绘制
19005
19006
19007 GeomBase.prototype.paint = function paint() {
19008 var self = this;
19009 var dataArray = self.get('dataArray');
19010 var mappedArray = [];
19011 var shapeFactory = self.getShapeFactory();
19012 shapeFactory.setCoord(self.get('coord'));
19013 var shapeContainer = self.get('shapeContainer');
19014 self._beforeMapping(dataArray);
19015 for (var i = 0; i < dataArray.length; i++) {
19016 var data = dataArray[i];
19017 var index = i;
19018 data = self._mapping(data);
19019 mappedArray.push(data);
19020 self.draw(data, shapeContainer, shapeFactory, index);
19021 }
19022 if (self.get('labelCfg')) {
19023 self._addLabels(Util.union.apply(null, mappedArray));
19024 }
19025
19026 if (!self.get('sortable')) {
19027 self._sort(mappedArray); // 便于数据的查找,需要对数据进行排序,用于 geom.findPoint()
19028 } else {
19029 self.set('dataArray', mappedArray);
19030 }
19031 };
19032
19033 GeomBase.prototype._sort = function _sort(mappedArray) {
19034 var self = this;
19035 var xScale = self.getXScale();
19036 var xField = xScale.field;
19037 Util.each(mappedArray, function (itemArr) {
19038 itemArr.sort(function (obj1, obj2) {
19039 return xScale.translate(obj1[FIELD_ORIGIN][xField]) - xScale.translate(obj2[FIELD_ORIGIN][xField]);
19040 });
19041 });
19042
19043 self.set('dataArray', mappedArray);
19044 };
19045
19046 // step 3.1 before mapping
19047
19048
19049 GeomBase.prototype._beforeMapping = function _beforeMapping(dataArray) {
19050 var self = this;
19051 if (self.get('sortable')) {
19052 var xScale = self.getXScale();
19053 var field = xScale.field;
19054 Util.each(dataArray, function (data) {
19055 data.sort(function (v1, v2) {
19056 return xScale.translate(v1[field]) - xScale.translate(v2[field]);
19057 });
19058 });
19059 }
19060 if (self.get('generatePoints')) {
19061 Util.each(dataArray, function (data) {
19062 self._generatePoints(data);
19063 });
19064 Util.each(dataArray, function (data, index) {
19065 var nextData = dataArray[index + 1];
19066 if (nextData) {
19067 data[0].nextPoints = nextData[0].points;
19068 }
19069 });
19070 }
19071 };
19072
19073 // step 3.2 add labels
19074
19075
19076 GeomBase.prototype._addLabels = function _addLabels(points) {
19077 var self = this;
19078 var type = self.get('type');
19079 var coord = self.get('coord');
19080 var C = Labels.getLabelsClass(coord.type, type);
19081 var container = self.get('container');
19082 var scales = Util.map(self.get('labelCfg').fields, function (field) {
19083 return self._createScale(field);
19084 });
19085 var labelContainer = container.addGroup(C, {
19086 _id: this.get('_id'),
19087 labelCfg: Util.mix({
19088 scales: scales
19089 }, self.get('labelCfg')),
19090 coord: coord,
19091 geom: self,
19092 geomType: type
19093 });
19094 labelContainer.showLabels(points);
19095 self.set('labelContainer', labelContainer);
19096 };
19097
19098 /**
19099 * @protected
19100 * 获取图形的工厂类
19101 * @return {Object} 工厂类对象
19102 */
19103
19104
19105 GeomBase.prototype.getShapeFactory = function getShapeFactory() {
19106 var shapeFactory = this.get('shapeFactory');
19107 if (!shapeFactory) {
19108 var shapeType = this.get('shapeType');
19109 shapeFactory = Shape.getShapeFactory(shapeType);
19110 this.set('shapeFactory', shapeFactory);
19111 }
19112 return shapeFactory;
19113 };
19114
19115 // step 3.2 generate points
19116
19117
19118 GeomBase.prototype._generatePoints = function _generatePoints(data) {
19119 var self = this;
19120 var shapeFactory = self.getShapeFactory();
19121 var shapeAttr = self.getAttr('shape');
19122 for (var i = 0; i < data.length; i++) {
19123 var obj = data[i];
19124 var cfg = self.createShapePointsCfg(obj);
19125 var shape = shapeAttr ? self._getAttrValues(shapeAttr, obj) : null;
19126 var points = shapeFactory.getShapePoints(shape, cfg);
19127 obj.points = points;
19128 }
19129 };
19130
19131 /**
19132 * 获取图形对应点的配置项
19133 * @protected
19134 * @param {Object} obj 数据对象
19135 * @return {Object} cfg 获取图形对应点的配置项
19136 */
19137
19138
19139 GeomBase.prototype.createShapePointsCfg = function createShapePointsCfg(obj) {
19140 var xScale = this.getXScale();
19141 var yScale = this.getYScale();
19142 var x = this._normalizeValues(obj[xScale.field], xScale);
19143 var y = void 0; // 存在没有 y 的情况
19144
19145 if (yScale) {
19146 y = this._normalizeValues(obj[yScale.field], yScale);
19147 } else {
19148 y = obj.y ? obj.y : 0.1;
19149 }
19150
19151 return {
19152 x: x,
19153 y: y,
19154 y0: yScale ? yScale.scale(this.getYMinValue()) : undefined
19155 };
19156 };
19157
19158 /**
19159 * @protected
19160 * 如果y轴的最小值小于0则返回0,否则返回最小值
19161 * @return {Number} y轴上的最小值
19162 */
19163
19164
19165 GeomBase.prototype.getYMinValue = function getYMinValue() {
19166 var yScale = this.getYScale();
19167 var min = yScale.min;
19168 var value = void 0;
19169 if (min >= 0) {
19170 value = min;
19171 } else {
19172 value = 0;
19173 }
19174 return value;
19175 };
19176
19177 // 将数据归一化
19178
19179
19180 GeomBase.prototype._normalizeValues = function _normalizeValues(values, scale) {
19181 var rst = [];
19182 if (Util.isArray(values)) {
19183 for (var i = 0; i < values.length; i++) {
19184 var v = values[i];
19185 rst.push(scale.scale(v));
19186 }
19187 } else {
19188 rst = scale.scale(values);
19189 }
19190 return rst;
19191 };
19192
19193 // step 3.2 mapping
19194
19195
19196 GeomBase.prototype._mapping = function _mapping(data) {
19197 var self = this;
19198 var attrs = self.get('attrs');
19199 var mappedData = [];
19200 for (var i = 0; i < data.length; i++) {
19201 var record = data[i];
19202 var newRecord = {};
19203 newRecord[FIELD_ORIGIN] = record[FIELD_ORIGIN];
19204 newRecord.points = record.points;
19205 newRecord.nextPoints = record.nextPoints;
19206 for (var k in attrs) {
19207 if (attrs.hasOwnProperty(k)) {
19208 var attr = attrs[k];
19209 var names = attr.names;
19210 var values = self._getAttrValues(attr, record);
19211 if (names.length > 1) {
19212 // position 之类的生成多个字段的属性
19213 for (var j = 0; j < values.length; j++) {
19214 var val = values[j];
19215 var name = names[j];
19216 newRecord[name] = Util.isArray(val) && val.length === 1 ? val[0] : val; // 只有一个值时返回第一个属性值
19217 }
19218 } else {
19219 newRecord[names[0]] = values.length === 1 ? values[0] : values;
19220 }
19221 }
19222 }
19223 mappedData.push(newRecord);
19224 }
19225
19226 return mappedData;
19227 };
19228
19229 // 获取属性映射的值
19230
19231
19232 GeomBase.prototype._getAttrValues = function _getAttrValues(attr, record) {
19233 var scales = attr.scales;
19234 var params = [];
19235 for (var i = 0; i < scales.length; i++) {
19236 var scale = scales[i];
19237 var field = scale.field;
19238 if (scale.type === 'identity') {
19239 params.push(scale.value);
19240 } else {
19241 params.push(record[field]);
19242 }
19243 }
19244 var values = attr.mapping.apply(attr, params);
19245 return values;
19246 };
19247
19248 GeomBase.prototype.getAttrValue = function getAttrValue(attrName, record) {
19249 var attr = this.getAttr(attrName);
19250 var rst = null;
19251 if (attr) {
19252 var values = this._getAttrValues(attr, record);
19253 rst = values[0];
19254 }
19255 return rst;
19256 };
19257
19258 GeomBase.prototype.getDefaultValue = function getDefaultValue(attrName) {
19259 var value = this.get(attrName);
19260 var attr = this.getAttr(attrName);
19261 if (attr) {
19262 var scale = attr.getScale(attrName);
19263 if (scale.type === 'identity') {
19264 value = scale.value;
19265 }
19266 }
19267 return value;
19268 };
19269
19270 /**
19271 * step 3.3 draw
19272 * @protected
19273 * @param {Array} data 绘制图形
19274 * @param {Object} container 绘图容器
19275 * @param {Object} shapeFactory 绘制图形的工厂类
19276 * @param {Number} index 每个 shape 的索引值
19277 */
19278
19279
19280 GeomBase.prototype.draw = function draw(data, container, shapeFactory, index) {
19281 var self = this;
19282 for (var i = 0; i < data.length; i++) {
19283 var obj = data[i];
19284 self.drawPoint(obj, container, shapeFactory, index + i);
19285 }
19286 };
19287
19288 GeomBase.prototype.getCallbackCfg = function getCallbackCfg(fields, cfg, origin) {
19289 if (!fields) {
19290 return cfg;
19291 }
19292 var tmpCfg = {};
19293 var params = fields.map(function (field) {
19294 return origin[field];
19295 });
19296 Util.each(cfg, function (v, k) {
19297 if (Util.isFunction(v)) {
19298 tmpCfg[k] = v.apply(null, params);
19299 } else {
19300 tmpCfg[k] = v;
19301 }
19302 });
19303 return tmpCfg;
19304 };
19305
19306 GeomBase.prototype._getShapeId = function _getShapeId(dataObj) {
19307 var id = this.get('_id');
19308 var keyFields = this.get('keyFields');
19309 if (keyFields && keyFields.length > 0) {
19310 Util.each(keyFields, function (key) {
19311 id += '-' + dataObj[key];
19312 });
19313 } else {
19314 var type = this.get('type');
19315 var xScale = this.getXScale();
19316 var yScale = this.getYScale();
19317 var xField = xScale.field || 'x';
19318 var yField = yScale.field || 'y';
19319 var yVal = dataObj[yField];
19320 var xVal = void 0;
19321 if (xScale.isIdentity) {
19322 xVal = xScale.value;
19323 } else {
19324 xVal = dataObj[xField];
19325 }
19326
19327 if (type === 'interval' || type === 'schema') {
19328 id += '-' + xVal;
19329 } else if (type === 'line' || type === 'area' || type === 'path') {
19330 id += '-' + type;
19331 } else {
19332 id += '-' + xVal + '-' + yVal;
19333 }
19334
19335 var groupScales = this._getGroupScales();
19336 if (!Util.isEmpty(groupScales)) {
19337 Util.each(groupScales, function (groupScale) {
19338 var field = groupScale.field;
19339 if (groupScale.type !== 'identity') {
19340 id += '-' + dataObj[field];
19341 }
19342 });
19343 }
19344 }
19345
19346 return id;
19347 };
19348
19349 GeomBase.prototype.getDrawCfg = function getDrawCfg(obj) {
19350 var self = this;
19351 var cfg = {
19352 origin: obj,
19353 x: obj.x,
19354 y: obj.y,
19355 color: obj.color,
19356 size: obj.size,
19357 shape: obj.shape,
19358 isInCircle: self.isInCircle(),
19359 opacity: obj.opacity
19360 };
19361 var styleOptions = self.get('styleOptions');
19362 if (styleOptions && styleOptions.style) {
19363 cfg.style = self.getCallbackCfg(styleOptions.fields, styleOptions.style, obj[FIELD_ORIGIN]);
19364 }
19365 if (this.get('generatePoints')) {
19366 cfg.points = obj.points;
19367 cfg.nextPoints = obj.nextPoints;
19368 }
19369 if (this.get('animate')) {
19370 // _id 字段仅用于动画
19371 cfg._id = self._getShapeId(obj[FIELD_ORIGIN]);
19372 }
19373 return cfg;
19374 };
19375
19376 GeomBase.prototype.drawPoint = function drawPoint(obj, container, shapeFactory, index) {
19377 var shape = obj.shape;
19378 var cfg = this.getDrawCfg(obj);
19379 var geomShape = shapeFactory.drawShape(shape, cfg, container);
19380 geomShape.setSilent('index', index);
19381 geomShape.setSilent('coord', this.get('coord'));
19382
19383 if (this.get('animate') && this.get('animateCfg')) {
19384 geomShape.setSilent('animateCfg', this.get('animateCfg'));
19385 }
19386 };
19387
19388 /**
19389 * 获取属性
19390 * @protected
19391 * @param {String} name 属性名
19392 * @return {Scale} 度量
19393 */
19394
19395
19396 GeomBase.prototype.getAttr = function getAttr(name) {
19397 return this.get('attrs')[name];
19398 };
19399
19400 /**
19401 * 获取 x 对应的度量
19402 * @return {Scale} x 对应的度量
19403 */
19404
19405
19406 GeomBase.prototype.getXScale = function getXScale() {
19407 return this.getAttr('position').scales[0];
19408 };
19409
19410 /**
19411 * 获取 y 对应的度量
19412 * @return {Scale} y 对应的度量
19413 */
19414
19415
19416 GeomBase.prototype.getYScale = function getYScale() {
19417 return this.getAttr('position').scales[1];
19418 };
19419
19420 GeomBase.prototype.getShapes = function getShapes() {
19421 var result = [];
19422 var shapeContainer = this.get('shapeContainer');
19423 var children = shapeContainer.get('children');
19424 Util.each(children, function (child) {
19425 if (child.get('origin')) {
19426 // 过滤 label
19427 result.push(child);
19428 }
19429 });
19430 return result;
19431 };
19432
19433 GeomBase.prototype.getAttrsForLegend = function getAttrsForLegend() {
19434 var attrs = this.get('attrs');
19435 var rst = [];
19436 Util.each(attrs, function (attr) {
19437 if (GROUP_ATTRS.indexOf(attr.type) !== -1) {
19438 rst.push(attr);
19439 }
19440 });
19441 return rst;
19442 };
19443
19444 GeomBase.prototype.getFieldsForLegend = function getFieldsForLegend() {
19445 var fields = [];
19446 var attrOptions = this.get('attrOptions');
19447 Util.each(GROUP_ATTRS, function (attrName) {
19448 var attrCfg = attrOptions[attrName];
19449 if (attrCfg && attrCfg.field && Util.isString(attrCfg.field)) {
19450 fields = fields.concat(attrCfg.field.split('*'));
19451 }
19452 });
19453 return Util.uniq(fields);
19454 };
19455
19456 GeomBase.prototype.changeVisible = function changeVisible(visible, stopDraw) {
19457 var shapeContainer = this.get('shapeContainer');
19458 shapeContainer.set('visible', visible);
19459 var labelContainer = this.get('labelContainer');
19460 if (labelContainer) {
19461 labelContainer.set('visible', visible);
19462 }
19463 if (!stopDraw) {
19464 var canvas = shapeContainer.get('canvas');
19465 canvas.draw();
19466 }
19467 };
19468
19469 GeomBase.prototype.reset = function reset() {
19470 this.set('attrOptions', {});
19471 this.clearInner();
19472 };
19473
19474 GeomBase.prototype.clearInner = function clearInner() {
19475 this.clearActivedShapes();
19476 this.clearSelected();
19477 var shapeContainer = this.get('shapeContainer');
19478 shapeContainer && shapeContainer.clear();
19479
19480 // 由于 Labels 对应的模块需要生成group,所以这个地方需要删除
19481 var labelContainer = this.get('labelContainer');
19482 labelContainer && labelContainer.remove();
19483 this.set('attrs', {});
19484 this.set('groupScales', null);
19485 // if (!this.get('hasDefaultAdjust')) {
19486 // this.set('adjusts', null);
19487 // }
19488 this.set('labelContainer', null);
19489 this.set('xDistance', null);
19490 this.set('isStacked', null);
19491 };
19492
19493 GeomBase.prototype.clear = function clear() {
19494 this.clearInner();
19495 this.set('scales', {});
19496 };
19497
19498 GeomBase.prototype.destroy = function destroy() {
19499 this.clear();
19500 var shapeContainer = this.get('shapeContainer');
19501 shapeContainer && shapeContainer.remove();
19502 this.offEvents();
19503 _Base.prototype.destroy.call(this);
19504 };
19505
19506 GeomBase.prototype.bindEvents = function bindEvents() {
19507 if (this.get('view')) {
19508 this._bindActiveAction();
19509 this._bindSelectedAction();
19510 }
19511 };
19512
19513 GeomBase.prototype.offEvents = function offEvents() {
19514 if (this.get('view')) {
19515 this._offActiveAction();
19516 this._offSelectedAction();
19517 }
19518 };
19519
19520 return GeomBase;
19521}(Base);
19522
19523module.exports = GeomBase;
19524
19525/***/ }),
19526/* 10 */
19527/***/ (function(module, exports, __webpack_require__) {
19528
19529/**
19530 * @fileOverview 工厂类,管理各种类型的 shape
19531 * @author dxq613@gmail.com
19532 */
19533
19534var Util = __webpack_require__(0);
19535var PathUtil = __webpack_require__(14);
19536var GPath = __webpack_require__(2).PathUtil;
19537var Shape = {};
19538
19539var ShapeBase = {
19540 _coord: null,
19541 /**
19542 * 绘制图形
19543 * @param {Object} cfg 配置项
19544 * @param {Object} container 容器
19545 * @return {Object} shape 创建的 shape
19546 */
19547 draw: function draw(cfg, container) {
19548 if (this.drawShape) {
19549 return this.drawShape(cfg, container);
19550 }
19551 return null;
19552 },
19553
19554 /**
19555 * 获取绘制图形需要的点, 可以不定义,则使用默认的
19556 getPoints(cfg) {
19557 if (this.getShapePoints) {
19558 return this.getShapePoints(cfg);
19559 }
19560 return null;
19561 },*/
19562 /**
19563 * 设置坐标系
19564 * @param {Coord} coord 坐标系
19565 */
19566 setCoord: function setCoord(coord) {
19567 this._coord = coord;
19568 },
19569
19570 /**
19571 * 0~1 path 转 画布 path
19572 * @param {path} path 路径
19573 * @param {Boolean} islineToArc 是否转换成圆弧
19574 * @return {path} path 转换到画布坐标的path
19575 */
19576 parsePath: function parsePath(path, islineToArc) {
19577 var coord = this._coord;
19578 path = GPath.parsePathString(path);
19579 if (coord.isPolar && islineToArc !== false) {
19580 path = PathUtil.convertPolarPath(coord, path);
19581 } else {
19582 path = PathUtil.convertNormalPath(coord, path);
19583 }
19584 return path;
19585 },
19586
19587 /**
19588 * 0~1 point 转 画布 point
19589 * @param {point} point 节点
19590 * @return {point} point 转换后的点
19591 */
19592 parsePoint: function parsePoint(point) {
19593 var coord = this._coord;
19594 return coord.convertPoint(point);
19595 },
19596
19597 /**
19598 * 0~1 points 转 画布 points
19599 * @param {points} points 节点集合
19600 * @return {points} points 转换后的多个节点
19601 */
19602 parsePoints: function parsePoints(points) {
19603 var coord = this._coord;
19604 var rst = [];
19605 Util.each(points, function (point) {
19606 rst.push(coord.convertPoint(point));
19607 });
19608 return rst;
19609 }
19610};
19611
19612var ShapeFactoryBase = {
19613 defaultShapeType: null,
19614 setCoord: function setCoord(coord) {
19615 this._coord = coord;
19616 },
19617 getShape: function getShape(type) {
19618 var self = this;
19619 if (Util.isArray(type)) {
19620 type = type[0];
19621 }
19622 var shape = self[type] || self[self.defaultShapeType];
19623 shape._coord = self._coord;
19624 return shape;
19625 },
19626 getShapePoints: function getShapePoints(type, cfg) {
19627 var shape = this.getShape(type);
19628 var fn = shape.getPoints || shape.getShapePoints || this.getDefaultPoints;
19629 var points = fn(cfg);
19630 return points;
19631 },
19632 getDefaultPoints: function getDefaultPoints() /* cfg */{
19633 return [];
19634 },
19635 getMarkerCfg: function getMarkerCfg(type, cfg) {
19636 var shape = this.getShape(type);
19637 if (!shape.getMarkerCfg) {
19638 var defaultShapeType = this.defaultShapeType;
19639 shape = this.getShape(defaultShapeType);
19640 }
19641
19642 return shape.getMarkerCfg(cfg);
19643 },
19644 drawShape: function drawShape(type, cfg, container) {
19645 var shape = this.getShape(type);
19646 var gShape = shape.draw(cfg, container);
19647 if (gShape) {
19648 gShape.setSilent('origin', cfg.origin);
19649 gShape._id = cfg.yIndex ? cfg._id + cfg.yIndex : cfg._id;
19650 gShape.name = this.name;
19651 }
19652 return gShape;
19653 }
19654};
19655
19656// 注册 Geometry 获取图形的入口
19657Shape.registerFactory = function (factoryName, cfg) {
19658 var className = Util.upperFirst(factoryName);
19659 var geomObj = Util.assign({}, ShapeFactoryBase, cfg);
19660 Shape[className] = geomObj;
19661 geomObj.name = factoryName;
19662 return geomObj;
19663};
19664
19665// 注册图形
19666Shape.registerShape = function (factoryName, shapeType, cfg) {
19667 var className = Util.upperFirst(factoryName);
19668 var factory = Shape[className];
19669 var shapeObj = Util.assign({}, ShapeBase, cfg);
19670 factory[shapeType] = shapeObj;
19671 return shapeObj;
19672};
19673
19674// 获得Geom 对应的 shapeFactory
19675Shape.getShapeFactory = function (factoryName) {
19676 var self = this;
19677 factoryName = factoryName || 'point';
19678 var className = Util.upperFirst(factoryName);
19679 return self[className];
19680};
19681
19682module.exports = Shape;
19683
19684/***/ }),
19685/* 11 */
19686/***/ (function(module, exports, __webpack_require__) {
19687
19688var arrayLikeKeys = __webpack_require__(70),
19689 baseKeys = __webpack_require__(74),
19690 isArrayLike = __webpack_require__(8);
19691
19692/**
19693 * Creates an array of the own enumerable property names of `object`.
19694 *
19695 * **Note:** Non-object values are coerced to objects. See the
19696 * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
19697 * for more details.
19698 *
19699 * @static
19700 * @since 0.1.0
19701 * @memberOf _
19702 * @category Object
19703 * @param {Object} object The object to query.
19704 * @returns {Array} Returns the array of property names.
19705 * @example
19706 *
19707 * function Foo() {
19708 * this.a = 1;
19709 * this.b = 2;
19710 * }
19711 *
19712 * Foo.prototype.c = 3;
19713 *
19714 * _.keys(new Foo);
19715 * // => ['a', 'b'] (iteration order is not guaranteed)
19716 *
19717 * _.keys('hi');
19718 * // => ['0', '1']
19719 */
19720function keys(object) {
19721 return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
19722}
19723
19724module.exports = keys;
19725
19726/***/ }),
19727/* 12 */
19728/***/ (function(module, exports, __webpack_require__) {
19729
19730var root = __webpack_require__(4);
19731
19732/** Built-in value references. */
19733var _Symbol = root.Symbol;
19734
19735module.exports = _Symbol;
19736
19737/***/ }),
19738/* 13 */
19739/***/ (function(module, exports, __webpack_require__) {
19740
19741var baseIsNative = __webpack_require__(155),
19742 getValue = __webpack_require__(158);
19743
19744/**
19745 * Gets the native function at `key` of `object`.
19746 *
19747 * @private
19748 * @param {Object} object The object to query.
19749 * @param {string} key The key of the method to get.
19750 * @returns {*} Returns the function if it's native, else `undefined`.
19751 */
19752function getNative(object, key) {
19753 var value = getValue(object, key);
19754 return baseIsNative(value) ? value : undefined;
19755}
19756
19757module.exports = getNative;
19758
19759/***/ }),
19760/* 14 */
19761/***/ (function(module, exports, __webpack_require__) {
19762
19763/**
19764 * @fileOverview 计算path 使用的工具方法
19765 * @author dxq613@gmail.com
19766 */
19767var Util = __webpack_require__(0);
19768var Spline = __webpack_require__(301);
19769
19770function points2path(points, isInCircle) {
19771 if (!points.length) {
19772 return [];
19773 }
19774 var path = [];
19775
19776 for (var i = 0, length = points.length; i < length; i++) {
19777 var item = points[i];
19778 if (i === 0) {
19779 path.push(['M', item.x, item.y]);
19780 } else {
19781 path.push(['L', item.x, item.y]);
19782 }
19783 }
19784
19785 if (isInCircle) {
19786 path.push(['Z']);
19787 }
19788 return path;
19789}
19790
19791function _getPointRadius(coord, point) {
19792 var center = coord.getCenter();
19793 var r = Math.sqrt(Math.pow(point.x - center.x, 2) + Math.pow(point.y - center.y, 2));
19794 return r;
19795}
19796
19797function convertArr(arr, coord) {
19798 var len = arr.length;
19799 var tmp = [arr[0]];
19800 for (var i = 1; i < len; i = i + 2) {
19801 var point = coord.convertPoint({
19802 x: arr[i],
19803 y: arr[i + 1]
19804 });
19805 tmp.push(point.x, point.y);
19806 }
19807 return tmp;
19808}
19809
19810function _convertPolarPath(pre, cur, coord) {
19811 // const radius = coord.getRadius();
19812 // const inner = coord.innerRadius || 0;
19813 // let innerRadius = inner * radius;
19814 var transposed = coord.isTransposed;
19815 var startAngle = coord.startAngle;
19816 var endAngle = coord.endAngle;
19817
19818 var prePoint = {
19819 x: pre[1],
19820 y: pre[2]
19821 };
19822 var curPoint = {
19823 x: cur[1],
19824 y: cur[2]
19825 };
19826 var rst = [];
19827 // innerRadius = innerRadius || 0;
19828 var xDim = transposed ? 'y' : 'x';
19829 var angleRange = Math.abs(curPoint[xDim] - prePoint[xDim]) * (endAngle - startAngle);
19830 var direction = curPoint[xDim] >= prePoint[xDim] ? 1 : 0; // 圆弧的方向
19831 var flag = angleRange > Math.PI ? 1 : 0; // 大弧还是小弧标志位
19832 var convertPoint = coord.convertPoint(curPoint);
19833 var r = _getPointRadius(coord, convertPoint);
19834 if (r >= 0.5) {
19835 // 小于1像素的圆在图像上无法识别
19836 if (angleRange === Math.PI * 2) {
19837 var middlePoint = {
19838 x: (curPoint.x + prePoint.x) / 2,
19839 y: (curPoint.y + prePoint.y) / 2
19840 };
19841 var middleConvertPoint = coord.convertPoint(middlePoint);
19842 rst.push(['A', r, r, 0, flag, direction, middleConvertPoint.x, middleConvertPoint.y]);
19843 rst.push(['A', r, r, 0, flag, direction, convertPoint.x, convertPoint.y]);
19844 } else {
19845 rst.push(['A', r, r, 0, flag, direction, convertPoint.x, convertPoint.y]);
19846 }
19847 }
19848 return rst;
19849}
19850
19851// 当存在整体的圆时,去除圆前面和后面的线,防止出现直线穿过整个圆的情形
19852function filterFullCirleLine(path) {
19853 Util.each(path, function (subPath, index) {
19854 var cur = subPath;
19855 if (cur[0].toLowerCase() === 'a') {
19856 var pre = path[index - 1];
19857 var next = path[index + 1];
19858 if (next && next[0].toLowerCase() === 'a') {
19859 if (pre && pre[0].toLowerCase() === 'l') {
19860 pre[0] = 'M';
19861 }
19862 } else if (pre && pre[0].toLowerCase() === 'a') {
19863 if (next && next[0].toLowerCase() === 'l') {
19864 next[0] = 'M';
19865 }
19866 }
19867 }
19868 });
19869}
19870
19871var PathUtil = {
19872 // 线的path
19873 getLinePath: function getLinePath(points, isInCircle) {
19874 return points2path(points, isInCircle);
19875 },
19876
19877 // get spline: 限定了范围的平滑线
19878 getSplinePath: function getSplinePath(points, isInCircle, constaint) {
19879 var data = [];
19880 var first = points[0];
19881 var prePoint = null;
19882 if (points.length <= 2) {
19883 return PathUtil.getLinePath(points, isInCircle);
19884 }
19885 Util.each(points, function (point) {
19886 if (!prePoint || !(prePoint.x === point.x && prePoint.y === point.y)) {
19887 data.push(point.x);
19888 data.push(point.y);
19889 prePoint = point;
19890 }
19891 });
19892 constaint = constaint || [// 范围
19893 [0, 0], [1, 1]];
19894 var splinePath = Spline.catmullRom2bezier(data, isInCircle, constaint);
19895 splinePath.unshift(['M', first.x, first.y]);
19896 return splinePath;
19897 },
19898 getPointRadius: function getPointRadius(coord, point) {
19899 var result = _getPointRadius(coord, point);
19900 return result;
19901 },
19902 getPointAngle: function getPointAngle(coord, point) {
19903 var center = coord.getCenter();
19904 var angle = Math.atan2(point.y - center.y, point.x - center.x);
19905 return angle;
19906 },
19907 convertNormalPath: function convertNormalPath(coord, path) {
19908 var tmp = [];
19909 Util.each(path, function (subPath) {
19910 var action = subPath[0];
19911 switch (action.toLowerCase()) {
19912 case 'm':
19913 case 'l':
19914 case 'c':
19915 tmp.push(convertArr(subPath, coord));
19916 break;
19917 case 'z':
19918 default:
19919 tmp.push(subPath);
19920 break;
19921 }
19922 });
19923 return tmp;
19924 },
19925 convertPolarPath: function convertPolarPath(coord, path) {
19926 var tmp = [];
19927 var pre = void 0;
19928 var cur = void 0;
19929 var transposed = void 0;
19930 var equals = void 0;
19931 Util.each(path, function (subPath, index) {
19932 var action = subPath[0];
19933
19934 switch (action.toLowerCase()) {
19935 case 'm':
19936 case 'c':
19937 case 'q':
19938 tmp.push(convertArr(subPath, coord));
19939 break;
19940 case 'l':
19941 pre = path[index - 1];
19942 cur = subPath;
19943 transposed = coord.isTransposed;
19944 // 是否半径相同,转换成圆弧
19945 equals = transposed ? pre[pre.length - 2] === cur[1] : pre[pre.length - 1] === cur[2];
19946 if (equals) {
19947 tmp = tmp.concat(_convertPolarPath(pre, cur, coord));
19948 } else {
19949 // y 不相等,所以直接转换
19950 tmp.push(convertArr(subPath, coord));
19951 }
19952 break;
19953 case 'z':
19954 default:
19955 tmp.push(subPath);
19956 break;
19957 }
19958 });
19959 filterFullCirleLine(tmp); // 过滤多余的直线
19960 return tmp;
19961 }
19962};
19963
19964module.exports = PathUtil;
19965
19966/***/ }),
19967/* 15 */
19968/***/ (function(module, exports, __webpack_require__) {
19969
19970var baseToString = __webpack_require__(186);
19971
19972/**
19973 * Converts `value` to a string. An empty string is returned for `null`
19974 * and `undefined` values. The sign of `-0` is preserved.
19975 *
19976 * @static
19977 * @memberOf _
19978 * @since 4.0.0
19979 * @category Lang
19980 * @param {*} value The value to convert.
19981 * @returns {string} Returns the converted string.
19982 * @example
19983 *
19984 * _.toString(null);
19985 * // => ''
19986 *
19987 * _.toString(-0);
19988 * // => '-0'
19989 *
19990 * _.toString([1, 2, 3]);
19991 * // => '1,2,3'
19992 */
19993function toString(value) {
19994 return value == null ? '' : baseToString(value);
19995}
19996
19997module.exports = toString;
19998
19999/***/ }),
20000/* 16 */
20001/***/ (function(module, exports, __webpack_require__) {
20002
20003function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
20004
20005/**
20006 * @fileOverview the Attribute base class
20007 * @author huangtonger@aliyun.com
20008 */
20009
20010var Util = __webpack_require__(0);
20011
20012function toScaleString(scale, value) {
20013 if (Util.isString(value)) {
20014 return value;
20015 }
20016 return scale.invert(scale.scale(value));
20017}
20018/**
20019 * 所有视觉通道属性的基类
20020 * @class Attr
20021 */
20022
20023var AttributeBase = function () {
20024 function AttributeBase(cfg) {
20025 _classCallCheck(this, AttributeBase);
20026
20027 /**
20028 * 属性的类型
20029 * @type {String}
20030 */
20031 this.type = 'base';
20032
20033 /**
20034 * 属性的名称
20035 * @type {String}
20036 */
20037 this.name = null;
20038
20039 /**
20040 * 回调函数
20041 * @type {Function}
20042 */
20043 this.method = null;
20044
20045 /**
20046 * 备选的值数组
20047 * @type {Array}
20048 */
20049 this.values = [];
20050
20051 /**
20052 * 属性内部的度量
20053 * @type {Array}
20054 */
20055 this.scales = [];
20056
20057 /**
20058 * 是否通过线性取值, 如果未指定,则根据数值的类型判定
20059 * @type {Boolean}
20060 */
20061 this.linear = null;
20062
20063 Util.mix(this, cfg);
20064 }
20065
20066 AttributeBase.prototype.get = function get(name) {
20067 return this[name];
20068 };
20069
20070 AttributeBase.prototype.set = function set(name, value) {
20071 this[name] = value;
20072 };
20073
20074 // 获取属性值,将值映射到视觉通道
20075
20076
20077 AttributeBase.prototype._getAttrValue = function _getAttrValue(scale, value) {
20078 var values = this.values;
20079 if (scale.isCategory && !this.linear) {
20080 var index = scale.translate(value);
20081 return values[index % values.length];
20082 }
20083 var percent = scale.scale(value);
20084 return this.getLinearValue(percent);
20085 };
20086
20087 /**
20088 * 如果进行线性映射,返回对应的映射值
20089 * @protected
20090 * @param {Number} percent 百分比
20091 * @return {*} 颜色值、形状、大小等
20092 */
20093
20094
20095 AttributeBase.prototype.getLinearValue = function getLinearValue(percent) {
20096 var values = this.values;
20097 var steps = values.length - 1;
20098 var step = Math.floor(steps * percent);
20099 var leftPercent = steps * percent - step;
20100 var start = values[step];
20101 var end = step === steps ? start : values[step + 1];
20102 var rstValue = start + (end - start) * leftPercent;
20103 return rstValue;
20104 };
20105
20106 /**
20107 * 默认的回调函数
20108 * @param {*} value 回调函数的值
20109 * @type {Function}
20110 * @return {Array} 返回映射后的值
20111 */
20112
20113
20114 AttributeBase.prototype.callback = function callback(value) {
20115 var self = this;
20116 var scale = self.scales[0];
20117 var rstValue = null;
20118 if (scale.type === 'identity') {
20119 rstValue = scale.value;
20120 } else {
20121 rstValue = self._getAttrValue(scale, value);
20122 }
20123 return rstValue;
20124 };
20125
20126 /**
20127 * 根据度量获取属性名
20128 * @return {Array} dims of this Attribute
20129 */
20130
20131
20132 AttributeBase.prototype.getNames = function getNames() {
20133 var scales = this.scales;
20134 var names = this.names;
20135 var length = Math.min(scales.length, names.length);
20136 var rst = [];
20137 for (var i = 0; i < length; i++) {
20138 rst.push(names[i]);
20139 }
20140 return rst;
20141 };
20142
20143 /**
20144 * 根据度量获取维度名
20145 * @return {Array} dims of this Attribute
20146 */
20147
20148
20149 AttributeBase.prototype.getFields = function getFields() {
20150 var scales = this.scales;
20151 var rst = [];
20152 Util.each(scales, function (scale) {
20153 rst.push(scale.field);
20154 });
20155 return rst;
20156 };
20157
20158 /**
20159 * 根据名称获取度量
20160 * @param {String} name the name of scale
20161 * @return {Scale} scale
20162 */
20163
20164
20165 AttributeBase.prototype.getScale = function getScale(name) {
20166 var scales = this.scales;
20167 var names = this.names;
20168 var index = names.indexOf(name);
20169 return scales[index];
20170 };
20171
20172 /**
20173 * 映射数据
20174 * @param {*} param1...paramn 多个数值
20175 * @return {Array} 映射的值组成的数组
20176 */
20177
20178
20179 AttributeBase.prototype.mapping = function mapping() {
20180 var scales = this.scales;
20181 var callback = this.callback;
20182
20183 for (var _len = arguments.length, params = Array(_len), _key = 0; _key < _len; _key++) {
20184 params[_key] = arguments[_key];
20185 }
20186
20187 var values = params;
20188 if (callback) {
20189 for (var i = 0; i < params.length; i++) {
20190 params[i] = this._toOriginParam(params[i], scales[i]);
20191 }
20192 values = callback.apply(this, params);
20193 }
20194 if (!Util.isArray(values)) {
20195 values = [values];
20196 }
20197 return values;
20198 };
20199
20200 // 原始的参数
20201
20202
20203 AttributeBase.prototype._toOriginParam = function _toOriginParam(param, scale) {
20204 var rst = param;
20205 if (!scale.isLinear) {
20206 if (Util.isArray(param)) {
20207 rst = [];
20208 for (var i = 0; i < param.length; i++) {
20209 rst.push(toScaleString(scale, param[i]));
20210 }
20211 } else {
20212 rst = toScaleString(scale, param);
20213 }
20214 }
20215 return rst;
20216 };
20217
20218 return AttributeBase;
20219}();
20220
20221module.exports = AttributeBase;
20222
20223/***/ }),
20224/* 17 */
20225/***/ (function(module, exports, __webpack_require__) {
20226
20227function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
20228
20229/**
20230 * @fileOverview the base class of guide
20231 * @author sima.zhang
20232 */
20233var Util = __webpack_require__(0);
20234var KEYWORDS = ['min', 'max', 'median'];
20235
20236function getFirstScale(scales) {
20237 var firstScale = void 0;
20238 Util.each(scales, function (scale) {
20239 if (scale) {
20240 firstScale = scale;
20241 return false;
20242 }
20243 });
20244 return firstScale;
20245}
20246
20247var Base = function () {
20248 Base.prototype.getDefaultCfg = function getDefaultCfg() {
20249 return {
20250 zIndex: 1,
20251 xScales: null,
20252 yScales: null,
20253 el: null
20254 };
20255 };
20256
20257 function Base(cfg) {
20258 _classCallCheck(this, Base);
20259
20260 var defaultCfg = this.getDefaultCfg();
20261 cfg = Util.deepMix({}, defaultCfg, cfg);
20262 Util.mix(this, cfg);
20263 }
20264
20265 /**
20266 * 将原始数值归一化
20267 * @param {string | number} val 原始值
20268 * @param {Scale} scale 度量对象
20269 * @return {Number} 返回归一化后的数值
20270 */
20271
20272
20273 Base.prototype._getNormalizedValue = function _getNormalizedValue(val, scale) {
20274 var result = void 0;
20275 if (Util.indexOf(KEYWORDS, val) !== -1) {
20276 // 分类则对应索引值
20277 var scaleValue = void 0;
20278 if (val === 'median') {
20279 scaleValue = scale.isCategory ? (scale.values.length - 1) / 2 : (scale.min + scale.max) / 2;
20280 result = scale.scale(scaleValue);
20281 } else {
20282 if (scale.isCategory) {
20283 scaleValue = val === 'min' ? 0 : scale.values.length - 1;
20284 } else {
20285 scaleValue = scale[val];
20286 }
20287 result = scale.scale(scaleValue);
20288 }
20289 } else {
20290 result = scale.scale(val);
20291 }
20292
20293 return result;
20294 };
20295
20296 /**
20297 * 将原始数值转换成坐标系上的点
20298 * @protected
20299 * @param {Coord} coord 坐标系
20300 * @param {Object | Array | Function} position 位置点
20301 * @return {Object} 转换成坐标系上的点
20302 */
20303
20304
20305 Base.prototype.parsePoint = function parsePoint(coord, position) {
20306 var self = this;
20307 var xScales = self.xScales;
20308 var yScales = self.yScales;
20309 if (Util.isFunction(position)) {
20310 position = position(xScales, yScales); // position 必须是对象
20311 }
20312
20313 var x = void 0;
20314 var y = void 0;
20315
20316 // 如果数据格式是 ['50%', '50%'] 的格式
20317 if (Util.isArray(position) && Util.isString(position[0]) && position[0].indexOf('%') !== -1) {
20318 return this.parsePercentPoint(coord, position);
20319 }
20320
20321 if (Util.isArray(position)) {
20322 // 数组 [2, 1]
20323 x = self._getNormalizedValue(position[0], getFirstScale(xScales));
20324 y = self._getNormalizedValue(position[1], getFirstScale(yScales));
20325 } else {
20326 for (var field in position) {
20327 var value = position[field];
20328 if (xScales[field]) {
20329 x = self._getNormalizedValue(value, xScales[field]);
20330 }
20331
20332 if (yScales[field]) {
20333 y = self._getNormalizedValue(value, yScales[field]);
20334 }
20335 }
20336 }
20337
20338 if (!Util.isNil(x) && !Util.isNil(y)) {
20339 return coord.convert({
20340 x: x,
20341 y: y
20342 });
20343 }
20344 };
20345 // 如果传入的值是百分比的格式,根据坐标系的起始点和宽高计算
20346
20347
20348 Base.prototype.parsePercentPoint = function parsePercentPoint(coord, position) {
20349 var xPercent = parseFloat(position[0]) / 100;
20350 var yPercent = parseFloat(position[1]) / 100;
20351 var start = coord.start;
20352 var end = coord.end;
20353 var topLeft = {
20354 x: Math.min(start.x, end.x),
20355 y: Math.min(start.y, end.y)
20356 };
20357 var x = coord.width * xPercent + topLeft.x;
20358 var y = coord.height * yPercent + topLeft.y;
20359 return {
20360 x: x,
20361 y: y
20362 };
20363 };
20364
20365 /**
20366 * 设置显示、隐藏
20367 * @param {Boolean} visible 是否可见
20368 */
20369
20370
20371 Base.prototype.setVisible = function setVisible(visible) {
20372 var el = this.el;
20373 if (el) {
20374 if (el.set) {
20375 el.set('visible', visible);
20376 } else {
20377 el.style.display = visible ? '' : 'none';
20378 }
20379 }
20380 };
20381
20382 /**
20383 * 渲染辅助元素
20384 * @override
20385 */
20386
20387
20388 Base.prototype.render = function render() {};
20389
20390 /**
20391 * 清理图形、元素
20392 */
20393
20394
20395 Base.prototype.remove = function remove() {
20396 var self = this;
20397 var el = self.el;
20398 if (el) {
20399 el.remove();
20400 }
20401 };
20402
20403 return Base;
20404}();
20405
20406module.exports = Base;
20407
20408/***/ }),
20409/* 18 */
20410/***/ (function(module, exports) {
20411
20412/** Used for built-in method references. */
20413var objectProto = Object.prototype;
20414
20415/**
20416 * Checks if `value` is likely a prototype object.
20417 *
20418 * @private
20419 * @param {*} value The value to check.
20420 * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
20421 */
20422function isPrototype(value) {
20423 var Ctor = value && value.constructor,
20424 proto = typeof Ctor == 'function' && Ctor.prototype || objectProto;
20425
20426 return value === proto;
20427}
20428
20429module.exports = isPrototype;
20430
20431/***/ }),
20432/* 19 */
20433/***/ (function(module, exports, __webpack_require__) {
20434
20435var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
20436
20437var baseMatches = __webpack_require__(143),
20438 baseMatchesProperty = __webpack_require__(181),
20439 identity = __webpack_require__(31),
20440 isArray = __webpack_require__(3),
20441 property = __webpack_require__(189);
20442
20443/**
20444 * The base implementation of `_.iteratee`.
20445 *
20446 * @private
20447 * @param {*} [value=_.identity] The value to convert to an iteratee.
20448 * @returns {Function} Returns the iteratee.
20449 */
20450function baseIteratee(value) {
20451 // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
20452 // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
20453 if (typeof value == 'function') {
20454 return value;
20455 }
20456 if (value == null) {
20457 return identity;
20458 }
20459 if ((typeof value === 'undefined' ? 'undefined' : _typeof(value)) == 'object') {
20460 return isArray(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value);
20461 }
20462 return property(value);
20463}
20464
20465module.exports = baseIteratee;
20466
20467/***/ }),
20468/* 20 */
20469/***/ (function(module, exports) {
20470
20471/**
20472 * Converts `set` to an array of its values.
20473 *
20474 * @private
20475 * @param {Object} set The set to convert.
20476 * @returns {Array} Returns the values.
20477 */
20478function setToArray(set) {
20479 var index = -1,
20480 result = Array(set.size);
20481
20482 set.forEach(function (value) {
20483 result[++index] = value;
20484 });
20485 return result;
20486}
20487
20488module.exports = setToArray;
20489
20490/***/ }),
20491/* 21 */
20492/***/ (function(module, exports, __webpack_require__) {
20493
20494var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
20495
20496var baseGetTag = __webpack_require__(6),
20497 isObjectLike = __webpack_require__(5);
20498
20499/** `Object#toString` result references. */
20500var symbolTag = '[object Symbol]';
20501
20502/**
20503 * Checks if `value` is classified as a `Symbol` primitive or object.
20504 *
20505 * @static
20506 * @memberOf _
20507 * @since 4.0.0
20508 * @category Lang
20509 * @param {*} value The value to check.
20510 * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
20511 * @example
20512 *
20513 * _.isSymbol(Symbol.iterator);
20514 * // => true
20515 *
20516 * _.isSymbol('abc');
20517 * // => false
20518 */
20519function isSymbol(value) {
20520 return (typeof value === 'undefined' ? 'undefined' : _typeof(value)) == 'symbol' || isObjectLike(value) && baseGetTag(value) == symbolTag;
20521}
20522
20523module.exports = isSymbol;
20524
20525/***/ }),
20526/* 22 */
20527/***/ (function(module, exports, __webpack_require__) {
20528
20529var isSymbol = __webpack_require__(21);
20530
20531/** Used as references for various `Number` constants. */
20532var INFINITY = 1 / 0;
20533
20534/**
20535 * Converts `value` to a string key if it's not a string or symbol.
20536 *
20537 * @private
20538 * @param {*} value The value to inspect.
20539 * @returns {string|symbol} Returns the key.
20540 */
20541function toKey(value) {
20542 if (typeof value == 'string' || isSymbol(value)) {
20543 return value;
20544 }
20545 var result = value + '';
20546 return result == '0' && 1 / value == -INFINITY ? '-0' : result;
20547}
20548
20549module.exports = toKey;
20550
20551/***/ }),
20552/* 23 */
20553/***/ (function(module, exports, __webpack_require__) {
20554
20555var assignValue = __webpack_require__(40),
20556 baseAssignValue = __webpack_require__(61);
20557
20558/**
20559 * Copies properties of `source` to `object`.
20560 *
20561 * @private
20562 * @param {Object} source The object to copy properties from.
20563 * @param {Array} props The property identifiers to copy.
20564 * @param {Object} [object={}] The object to copy properties to.
20565 * @param {Function} [customizer] The function to customize copied values.
20566 * @returns {Object} Returns `object`.
20567 */
20568function copyObject(source, props, object, customizer) {
20569 var isNew = !object;
20570 object || (object = {});
20571
20572 var index = -1,
20573 length = props.length;
20574
20575 while (++index < length) {
20576 var key = props[index];
20577
20578 var newValue = customizer ? customizer(object[key], source[key], key, object, source) : undefined;
20579
20580 if (newValue === undefined) {
20581 newValue = source[key];
20582 }
20583 if (isNew) {
20584 baseAssignValue(object, key, newValue);
20585 } else {
20586 assignValue(object, key, newValue);
20587 }
20588 }
20589 return object;
20590}
20591
20592module.exports = copyObject;
20593
20594/***/ }),
20595/* 24 */
20596/***/ (function(module, exports, __webpack_require__) {
20597
20598function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
20599
20600/**
20601 * @fileOverview adjust the points position
20602 * @author dxq613@gmail.com
20603 */
20604
20605var Util = __webpack_require__(0);
20606var DEFAULT_Y = 0; // 默认的y的值
20607
20608/**
20609 * 数据调整的基类
20610 * @class Adjust
20611 */
20612
20613var Adjust = function () {
20614 /**
20615 * 获取默认的配置属性
20616 * @protected
20617 * @return {Object} 默认属性
20618 */
20619 Adjust.prototype.getDefaultCfg = function getDefaultCfg() {
20620 return {
20621 /**
20622 * 调整对应的x方向对应的字段名称
20623 * @type {Scale}
20624 */
20625 xField: null,
20626 /**
20627 * 调整对应的y方向对应的字段名称
20628 * @type {Scale}
20629 */
20630 yField: null,
20631
20632 /**
20633 * 调整的维度,默认,x,y都做调整
20634 * @type {Array}
20635 */
20636 adjustNames: ['x', 'y'], // 指x,y
20637
20638 /**
20639 * 参与分组的数据维度
20640 * @type {Array}
20641 */
20642 groupFields: null
20643 };
20644 };
20645
20646 function Adjust(cfg) {
20647 _classCallCheck(this, Adjust);
20648
20649 var defaultCfg = this.getDefaultCfg();
20650 Util.assign(this, defaultCfg, cfg);
20651 }
20652
20653 /**
20654 * 对应的维度是否可以调整
20655 * @protected
20656 * @param {String} dimName 可以调整的维度 x,y
20657 * @return {Boolean} 是否可以调整
20658 */
20659
20660
20661 Adjust.prototype.isAdjust = function isAdjust(dimName) {
20662 return this.adjustNames.indexOf(dimName) >= 0;
20663 };
20664
20665 /**
20666 * @protected
20667 * adjust data
20668 * @param {Array} dataArray data array
20669 */
20670
20671
20672 Adjust.prototype.processAdjust = function processAdjust(dataArray) {
20673 var self = this;
20674 var mergeData = Util.Array.merge(dataArray);
20675
20676 self.adjDataArray = dataArray;
20677 self.mergeData = mergeData;
20678 self.adjustData(dataArray, mergeData);
20679 self.adjFrames = null;
20680 self.mergeData = null;
20681 };
20682
20683 /**
20684 * @protected
20685 * 获取可调整度量对应的值
20686 * @param {Frame} mergeData 数据
20687 * @return {Object} 值的映射
20688 */
20689
20690
20691 Adjust.prototype._getDimValues = function _getDimValues(mergeData) {
20692 var self = this;
20693 var valuesMap = {};
20694 var dims = [];
20695 if (self.xField && self.isAdjust('x')) {
20696 dims.push(self.xField);
20697 }
20698 if (self.yField && self.isAdjust('y')) {
20699 dims.push(self.yField);
20700 }
20701 Util.each(dims, function (dim) {
20702 var values = Util.Array.values(mergeData, dim);
20703 values.sort(function (v1, v2) {
20704 return v1 - v2;
20705 });
20706 valuesMap[dim] = values;
20707 });
20708 if (!self.yField && self.isAdjust('y')) {
20709 // 只有一维的情况下,同时调整y
20710 var dim = 'y';
20711 var values = [DEFAULT_Y, 1]; // 默认分布在y轴的 0.1 与 0.2 之间
20712 valuesMap[dim] = values;
20713 }
20714 return valuesMap;
20715 };
20716
20717 Adjust.prototype.adjustData = function adjustData(dataArray, mergeData) {
20718 var self = this;
20719 var valuesMap = self._getDimValues(mergeData);
20720 Util.each(dataArray, function (data, index) {
20721 // 遍历所有数据集合
20722 Util.each(valuesMap, function (values, dim) {
20723 // 根据不同的度量分别调整位置
20724 self.adjustDim(dim, values, data, dataArray.length, index);
20725 });
20726 });
20727 };
20728
20729 Adjust.prototype.adjustDim = function adjustDim() /* dim, values, data, length, index */{};
20730
20731 Adjust.prototype.getAdjustRange = function getAdjustRange(dim, key, values) {
20732 var self = this;
20733 var index = values.indexOf(key);
20734 var length = values.length;
20735 var pre = void 0;
20736 var next = void 0;
20737 if (!self.yField && self.isAdjust('y')) {
20738 pre = 0;
20739 next = 1;
20740 } else if (length > 1) {
20741 pre = index === 0 ? values[0] : values[index - 1];
20742 next = index === length - 1 ? values[length - 1] : values[index + 1];
20743
20744 if (index !== 0) {
20745 pre += (key - pre) / 2;
20746 } else {
20747 pre -= (next - key) / 2;
20748 }
20749 if (index !== length - 1) {
20750 next -= (next - key) / 2;
20751 } else {
20752 next += (key - values[length - 2]) / 2;
20753 }
20754 } else {
20755 pre = key === 0 ? 0 : key - 0.5;
20756 next = key === 0 ? 1 : key + 0.5;
20757 }
20758
20759 return {
20760 pre: pre,
20761 next: next
20762 };
20763 };
20764
20765 /**
20766 * 对数据进行分组
20767 * @param {Array} data 数据
20768 * @param {String} dim 分组的字段
20769 * @return {Object} 分组的键值对映射
20770 */
20771
20772
20773 Adjust.prototype.groupData = function groupData(data, dim) {
20774 var groups = {};
20775
20776 Util.each(data, function (record) {
20777 var value = record[dim];
20778 if (value === undefined) {
20779 value = record[dim] = DEFAULT_Y;
20780 }
20781 if (!groups[value]) {
20782 groups[value] = [];
20783 }
20784 groups[value].push(record);
20785 });
20786
20787 return groups;
20788 };
20789
20790 return Adjust;
20791}();
20792
20793module.exports = Adjust;
20794
20795/***/ }),
20796/* 25 */
20797/***/ (function(module, exports, __webpack_require__) {
20798
20799/**
20800 * @fileOverview chart component module
20801 * @author sima.zhang1990@gmail.com
20802 */
20803module.exports = {
20804 Axis: __webpack_require__(335),
20805 Guide: __webpack_require__(341),
20806 Label: __webpack_require__(65),
20807 Legend: __webpack_require__(348),
20808 Plot: __webpack_require__(353),
20809 Tooltip: __webpack_require__(354)
20810};
20811
20812/***/ }),
20813/* 26 */
20814/***/ (function(module, exports) {
20815
20816module.exports = function (module) {
20817 if (!module.webpackPolyfill) {
20818 module.deprecate = function () {};
20819 module.paths = [];
20820 // module.parent = undefined by default
20821 if (!module.children) module.children = [];
20822 Object.defineProperty(module, "loaded", {
20823 enumerable: true,
20824 get: function get() {
20825 return module.l;
20826 }
20827 });
20828 Object.defineProperty(module, "id", {
20829 enumerable: true,
20830 get: function get() {
20831 return module.i;
20832 }
20833 });
20834 module.webpackPolyfill = 1;
20835 }
20836 return module;
20837};
20838
20839/***/ }),
20840/* 27 */
20841/***/ (function(module, exports, __webpack_require__) {
20842
20843var baseForOwn = __webpack_require__(129),
20844 createBaseEach = __webpack_require__(140);
20845
20846/**
20847 * The base implementation of `_.forEach` without support for iteratee shorthands.
20848 *
20849 * @private
20850 * @param {Array|Object} collection The collection to iterate over.
20851 * @param {Function} iteratee The function invoked per iteration.
20852 * @returns {Array|Object} Returns `collection`.
20853 */
20854var baseEach = createBaseEach(baseForOwn);
20855
20856module.exports = baseEach;
20857
20858/***/ }),
20859/* 28 */
20860/***/ (function(module, exports, __webpack_require__) {
20861
20862var baseIsArguments = __webpack_require__(133),
20863 isObjectLike = __webpack_require__(5);
20864
20865/** Used for built-in method references. */
20866var objectProto = Object.prototype;
20867
20868/** Used to check objects for own properties. */
20869var hasOwnProperty = objectProto.hasOwnProperty;
20870
20871/** Built-in value references. */
20872var propertyIsEnumerable = objectProto.propertyIsEnumerable;
20873
20874/**
20875 * Checks if `value` is likely an `arguments` object.
20876 *
20877 * @static
20878 * @memberOf _
20879 * @since 0.1.0
20880 * @category Lang
20881 * @param {*} value The value to check.
20882 * @returns {boolean} Returns `true` if `value` is an `arguments` object,
20883 * else `false`.
20884 * @example
20885 *
20886 * _.isArguments(function() { return arguments; }());
20887 * // => true
20888 *
20889 * _.isArguments([1, 2, 3]);
20890 * // => false
20891 */
20892var isArguments = baseIsArguments(function () {
20893 return arguments;
20894}()) ? baseIsArguments : function (value) {
20895 return isObjectLike(value) && hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee');
20896};
20897
20898module.exports = isArguments;
20899
20900/***/ }),
20901/* 29 */
20902/***/ (function(module, exports, __webpack_require__) {
20903
20904/* WEBPACK VAR INJECTION */(function(module) {var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
20905
20906var root = __webpack_require__(4),
20907 stubFalse = __webpack_require__(137);
20908
20909/** Detect free variable `exports`. */
20910var freeExports = ( false ? 'undefined' : _typeof(exports)) == 'object' && exports && !exports.nodeType && exports;
20911
20912/** Detect free variable `module`. */
20913var freeModule = freeExports && ( false ? 'undefined' : _typeof(module)) == 'object' && module && !module.nodeType && module;
20914
20915/** Detect the popular CommonJS extension `module.exports`. */
20916var moduleExports = freeModule && freeModule.exports === freeExports;
20917
20918/** Built-in value references. */
20919var Buffer = moduleExports ? root.Buffer : undefined;
20920
20921/* Built-in method references for those with the same name as other `lodash` methods. */
20922var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
20923
20924/**
20925 * Checks if `value` is a buffer.
20926 *
20927 * @static
20928 * @memberOf _
20929 * @since 4.3.0
20930 * @category Lang
20931 * @param {*} value The value to check.
20932 * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
20933 * @example
20934 *
20935 * _.isBuffer(new Buffer(2));
20936 * // => true
20937 *
20938 * _.isBuffer(new Uint8Array(2));
20939 * // => false
20940 */
20941var isBuffer = nativeIsBuffer || stubFalse;
20942
20943module.exports = isBuffer;
20944/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(26)(module)))
20945
20946/***/ }),
20947/* 30 */
20948/***/ (function(module, exports) {
20949
20950/** Used as references for various `Number` constants. */
20951var MAX_SAFE_INTEGER = 9007199254740991;
20952
20953/** Used to detect unsigned integer values. */
20954var reIsUint = /^(?:0|[1-9]\d*)$/;
20955
20956/**
20957 * Checks if `value` is a valid array-like index.
20958 *
20959 * @private
20960 * @param {*} value The value to check.
20961 * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
20962 * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
20963 */
20964function isIndex(value, length) {
20965 length = length == null ? MAX_SAFE_INTEGER : length;
20966 return !!length && (typeof value == 'number' || reIsUint.test(value)) && value > -1 && value % 1 == 0 && value < length;
20967}
20968
20969module.exports = isIndex;
20970
20971/***/ }),
20972/* 31 */
20973/***/ (function(module, exports) {
20974
20975/**
20976 * This method returns the first argument it receives.
20977 *
20978 * @static
20979 * @since 0.1.0
20980 * @memberOf _
20981 * @category Util
20982 * @param {*} value Any value.
20983 * @returns {*} Returns `value`.
20984 * @example
20985 *
20986 * var object = { 'a': 1 };
20987 *
20988 * console.log(_.identity(object) === object);
20989 * // => true
20990 */
20991function identity(value) {
20992 return value;
20993}
20994
20995module.exports = identity;
20996
20997/***/ }),
20998/* 32 */
20999/***/ (function(module, exports, __webpack_require__) {
21000
21001var listCacheClear = __webpack_require__(145),
21002 listCacheDelete = __webpack_require__(146),
21003 listCacheGet = __webpack_require__(147),
21004 listCacheHas = __webpack_require__(148),
21005 listCacheSet = __webpack_require__(149);
21006
21007/**
21008 * Creates an list cache object.
21009 *
21010 * @private
21011 * @constructor
21012 * @param {Array} [entries] The key-value pairs to cache.
21013 */
21014function ListCache(entries) {
21015 var index = -1,
21016 length = entries == null ? 0 : entries.length;
21017
21018 this.clear();
21019 while (++index < length) {
21020 var entry = entries[index];
21021 this.set(entry[0], entry[1]);
21022 }
21023}
21024
21025// Add methods to `ListCache`.
21026ListCache.prototype.clear = listCacheClear;
21027ListCache.prototype['delete'] = listCacheDelete;
21028ListCache.prototype.get = listCacheGet;
21029ListCache.prototype.has = listCacheHas;
21030ListCache.prototype.set = listCacheSet;
21031
21032module.exports = ListCache;
21033
21034/***/ }),
21035/* 33 */
21036/***/ (function(module, exports, __webpack_require__) {
21037
21038var eq = __webpack_require__(34);
21039
21040/**
21041 * Gets the index at which the `key` is found in `array` of key-value pairs.
21042 *
21043 * @private
21044 * @param {Array} array The array to inspect.
21045 * @param {*} key The key to search for.
21046 * @returns {number} Returns the index of the matched value, else `-1`.
21047 */
21048function assocIndexOf(array, key) {
21049 var length = array.length;
21050 while (length--) {
21051 if (eq(array[length][0], key)) {
21052 return length;
21053 }
21054 }
21055 return -1;
21056}
21057
21058module.exports = assocIndexOf;
21059
21060/***/ }),
21061/* 34 */
21062/***/ (function(module, exports) {
21063
21064/**
21065 * Performs a
21066 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
21067 * comparison between two values to determine if they are equivalent.
21068 *
21069 * @static
21070 * @memberOf _
21071 * @since 4.0.0
21072 * @category Lang
21073 * @param {*} value The value to compare.
21074 * @param {*} other The other value to compare.
21075 * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
21076 * @example
21077 *
21078 * var object = { 'a': 1 };
21079 * var other = { 'a': 1 };
21080 *
21081 * _.eq(object, object);
21082 * // => true
21083 *
21084 * _.eq(object, other);
21085 * // => false
21086 *
21087 * _.eq('a', 'a');
21088 * // => true
21089 *
21090 * _.eq('a', Object('a'));
21091 * // => false
21092 *
21093 * _.eq(NaN, NaN);
21094 * // => true
21095 */
21096function eq(value, other) {
21097 return value === other || value !== value && other !== other;
21098}
21099
21100module.exports = eq;
21101
21102/***/ }),
21103/* 35 */
21104/***/ (function(module, exports, __webpack_require__) {
21105
21106var getNative = __webpack_require__(13);
21107
21108/* Built-in method references that are verified to be native. */
21109var nativeCreate = getNative(Object, 'create');
21110
21111module.exports = nativeCreate;
21112
21113/***/ }),
21114/* 36 */
21115/***/ (function(module, exports, __webpack_require__) {
21116
21117var isKeyable = __webpack_require__(167);
21118
21119/**
21120 * Gets the data for `map`.
21121 *
21122 * @private
21123 * @param {Object} map The map to query.
21124 * @param {string} key The reference key.
21125 * @returns {*} Returns the map data.
21126 */
21127function getMapData(map, key) {
21128 var data = map.__data__;
21129 return isKeyable(key) ? data[typeof key == 'string' ? 'string' : 'hash'] : data.map;
21130}
21131
21132module.exports = getMapData;
21133
21134/***/ }),
21135/* 37 */
21136/***/ (function(module, exports, __webpack_require__) {
21137
21138var baseIsEqualDeep = __webpack_require__(171),
21139 isObjectLike = __webpack_require__(5);
21140
21141/**
21142 * The base implementation of `_.isEqual` which supports partial comparisons
21143 * and tracks traversed objects.
21144 *
21145 * @private
21146 * @param {*} value The value to compare.
21147 * @param {*} other The other value to compare.
21148 * @param {boolean} bitmask The bitmask flags.
21149 * 1 - Unordered comparison
21150 * 2 - Partial comparison
21151 * @param {Function} [customizer] The function to customize comparisons.
21152 * @param {Object} [stack] Tracks traversed `value` and `other` objects.
21153 * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
21154 */
21155function baseIsEqual(value, other, bitmask, customizer, stack) {
21156 if (value === other) {
21157 return true;
21158 }
21159 if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) {
21160 return value !== value && other !== other;
21161 }
21162 return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
21163}
21164
21165module.exports = baseIsEqual;
21166
21167/***/ }),
21168/* 38 */
21169/***/ (function(module, exports, __webpack_require__) {
21170
21171var DataView = __webpack_require__(177),
21172 Map = __webpack_require__(51),
21173 Promise = __webpack_require__(178),
21174 Set = __webpack_require__(85),
21175 WeakMap = __webpack_require__(179),
21176 baseGetTag = __webpack_require__(6),
21177 toSource = __webpack_require__(76);
21178
21179/** `Object#toString` result references. */
21180var mapTag = '[object Map]',
21181 objectTag = '[object Object]',
21182 promiseTag = '[object Promise]',
21183 setTag = '[object Set]',
21184 weakMapTag = '[object WeakMap]';
21185
21186var dataViewTag = '[object DataView]';
21187
21188/** Used to detect maps, sets, and weakmaps. */
21189var dataViewCtorString = toSource(DataView),
21190 mapCtorString = toSource(Map),
21191 promiseCtorString = toSource(Promise),
21192 setCtorString = toSource(Set),
21193 weakMapCtorString = toSource(WeakMap);
21194
21195/**
21196 * Gets the `toStringTag` of `value`.
21197 *
21198 * @private
21199 * @param {*} value The value to query.
21200 * @returns {string} Returns the `toStringTag`.
21201 */
21202var getTag = baseGetTag;
21203
21204// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
21205if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map && getTag(new Map()) != mapTag || Promise && getTag(Promise.resolve()) != promiseTag || Set && getTag(new Set()) != setTag || WeakMap && getTag(new WeakMap()) != weakMapTag) {
21206 getTag = function getTag(value) {
21207 var result = baseGetTag(value),
21208 Ctor = result == objectTag ? value.constructor : undefined,
21209 ctorString = Ctor ? toSource(Ctor) : '';
21210
21211 if (ctorString) {
21212 switch (ctorString) {
21213 case dataViewCtorString:
21214 return dataViewTag;
21215 case mapCtorString:
21216 return mapTag;
21217 case promiseCtorString:
21218 return promiseTag;
21219 case setCtorString:
21220 return setTag;
21221 case weakMapCtorString:
21222 return weakMapTag;
21223 }
21224 }
21225 return result;
21226 };
21227}
21228
21229module.exports = getTag;
21230
21231/***/ }),
21232/* 39 */
21233/***/ (function(module, exports, __webpack_require__) {
21234
21235var isArray = __webpack_require__(3),
21236 isKey = __webpack_require__(57),
21237 stringToPath = __webpack_require__(183),
21238 toString = __webpack_require__(15);
21239
21240/**
21241 * Casts `value` to a path array if it's not one.
21242 *
21243 * @private
21244 * @param {*} value The value to inspect.
21245 * @param {Object} [object] The object to query keys on.
21246 * @returns {Array} Returns the cast property path array.
21247 */
21248function castPath(value, object) {
21249 if (isArray(value)) {
21250 return value;
21251 }
21252 return isKey(value, object) ? [value] : stringToPath(toString(value));
21253}
21254
21255module.exports = castPath;
21256
21257/***/ }),
21258/* 40 */
21259/***/ (function(module, exports, __webpack_require__) {
21260
21261var baseAssignValue = __webpack_require__(61),
21262 eq = __webpack_require__(34);
21263
21264/** Used for built-in method references. */
21265var objectProto = Object.prototype;
21266
21267/** Used to check objects for own properties. */
21268var hasOwnProperty = objectProto.hasOwnProperty;
21269
21270/**
21271 * Assigns `value` to `key` of `object` if the existing value is not equivalent
21272 * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
21273 * for equality comparisons.
21274 *
21275 * @private
21276 * @param {Object} object The object to modify.
21277 * @param {string} key The key of the property to assign.
21278 * @param {*} value The value to assign.
21279 */
21280function assignValue(object, key, value) {
21281 var objValue = object[key];
21282 if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || value === undefined && !(key in object)) {
21283 baseAssignValue(object, key, value);
21284 }
21285}
21286
21287module.exports = assignValue;
21288
21289/***/ }),
21290/* 41 */
21291/***/ (function(module, exports, __webpack_require__) {
21292
21293function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
21294
21295/**
21296 * @fileOverview the base class of scale
21297 * @author dxq613@gmail.com
21298 */
21299
21300var Util = __webpack_require__(0);
21301
21302/**
21303 * 度量的构造函数
21304 * @class Scale
21305 */
21306
21307var Scale = function () {
21308
21309 /**
21310 * 获取默认的配置属性
21311 * @protected
21312 * @return {Object} 默认属性
21313 */
21314 Scale.prototype.getDefaultCfg = function getDefaultCfg() {
21315 return {
21316 /**
21317 * type of the scale
21318 * @type {String}
21319 */
21320 type: 'base',
21321
21322 /**
21323 * 格式化函数,输出文本或者tick时的格式化函数
21324 * @type {Function}
21325 */
21326 formatter: null,
21327
21328 /**
21329 * 输出的值域
21330 * @type {Array}
21331 */
21332 range: [0, 1],
21333
21334 /**
21335 * 度量的标记
21336 * @type {Array}
21337 */
21338 ticks: null,
21339
21340 /**
21341 * 参与度量计算的值,可选项
21342 * @type {Array}
21343 */
21344 values: []
21345 };
21346 };
21347
21348 function Scale(cfg) {
21349 _classCallCheck(this, Scale);
21350
21351 var defaultCfg = this.getDefaultCfg();
21352 Util.mix(this, defaultCfg, cfg);
21353 this.init();
21354 }
21355
21356 /**
21357 * 度量初始化
21358 * @protected
21359 */
21360
21361
21362 Scale.prototype.init = function init() {};
21363
21364 /**
21365 * 获取该度量的ticks,返回的是多个对象,
21366 * - text: tick 的文本
21367 * - value: 对应的度量转换后的值
21368 * <code>
21369 * [
21370 * {text: 0,value:0}
21371 * {text: 1,value:0.2}
21372 * {text: 2,value:0.4}
21373 * {text: 3,value:0.6}
21374 * {text: 4,value:0.8}
21375 * {text: 5,value:1}
21376 * ]
21377 * </code>
21378 * @param {Number} count 输出tick的个数的近似值,默认是 10
21379 * @return {Array} 返回 ticks 数组
21380 */
21381
21382
21383 Scale.prototype.getTicks = function getTicks() {
21384 var self = this;
21385 var ticks = self.ticks;
21386 var rst = [];
21387 Util.each(ticks, function (tick) {
21388 var obj = void 0;
21389 if (Util.isObject(tick)) {
21390 obj = tick;
21391 } else {
21392 obj = {
21393 text: self.getText(tick),
21394 tickValue: tick,
21395 value: self.scale(tick)
21396 };
21397 }
21398 rst.push(obj);
21399 });
21400 return rst;
21401 };
21402
21403 /**
21404 * 获取格式化后的文本
21405 * @param {*} value 输入的数据
21406 * @return {String} 格式化的文本
21407 */
21408
21409
21410 Scale.prototype.getText = function getText(value) {
21411 var formatter = this.formatter;
21412 value = formatter ? formatter(value) : value;
21413 if (Util.isNil(value) || !value.toString) {
21414 value = '';
21415 }
21416 return value.toString();
21417 };
21418 /**
21419 * 输出的值域最小值
21420 * @protected
21421 * @return {Number} 返回最小的值
21422 */
21423
21424
21425 Scale.prototype.rangeMin = function rangeMin() {
21426 return this.range[0];
21427 };
21428 /**
21429 * 输出的值域最大值
21430 * @protected
21431 * @return {Number} 返回最大的值
21432 */
21433
21434
21435 Scale.prototype.rangeMax = function rangeMax() {
21436 var range = this.range;
21437 return range[range.length - 1];
21438 };
21439
21440 /**
21441 * 度量转换后的结果,翻转回输入域
21442 * @param {Number} value 需要翻转的数值
21443 * @return {*} 度量的输入值
21444 */
21445
21446
21447 Scale.prototype.invert = function invert(value) {
21448 return value;
21449 };
21450 /**
21451 * 将传入的值从非数值转换成数值格式,如分类字符串、时间字符串等
21452 * @param {*} value 传入的值
21453 * @return {Number} 转换的值
21454 */
21455
21456
21457 Scale.prototype.translate = function translate(value) {
21458 return value;
21459 };
21460 /**
21461 * 进行度量转换
21462 * @param {*} value 输入值
21463 * @return {Number} 输出值,在设定的输出值域之间,默认[0,1]
21464 */
21465
21466
21467 Scale.prototype.scale = function scale(value) {
21468 return value;
21469 };
21470 /**
21471 * 克隆一个新的scale,拥有跟当前scale相同的输入域、输出域等
21472 * @return {Scale} 克隆的度量
21473 */
21474
21475
21476 Scale.prototype.clone = function clone() {
21477 var self = this;
21478 var constr = self.constructor;
21479 var cfg = {};
21480 Util.each(self, function (v, k) {
21481 cfg[k] = self[k];
21482 });
21483 return new constr(cfg);
21484 };
21485 /**
21486 * 更改度量的属性信息
21487 * @param {Object} info 属性信息
21488 * @chainable
21489 * @return {Scale} 返回自身的引用
21490 */
21491
21492
21493 Scale.prototype.change = function change(info) {
21494 this.ticks = null;
21495 Util.mix(this, info);
21496 this.init();
21497 return this;
21498 };
21499
21500 return Scale;
21501}();
21502
21503module.exports = Scale;
21504
21505/***/ }),
21506/* 42 */
21507/***/ (function(module, exports, __webpack_require__) {
21508
21509function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
21510
21511function _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; }
21512
21513function _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; }
21514
21515/**
21516 * @fileOverview The measurement of linear data scale function
21517 * @author dxq613@gmail.com
21518 */
21519
21520var Base = __webpack_require__(41);
21521var Util = __webpack_require__(0);
21522var numberAuto = __webpack_require__(322);
21523
21524/**
21525 * 线性度量
21526 * @class Scale.Linear
21527 */
21528
21529var Linear = function (_Base) {
21530 _inherits(Linear, _Base);
21531
21532 function Linear() {
21533 _classCallCheck(this, Linear);
21534
21535 return _possibleConstructorReturn(this, _Base.apply(this, arguments));
21536 }
21537
21538 /**
21539 * @override
21540 */
21541 Linear.prototype.getDefaultCfg = function getDefaultCfg() {
21542 var cfg = _Base.prototype.getDefaultCfg.call(this);
21543 return Util.mix({}, cfg, {
21544 /**
21545 * type of the scale
21546 * @type {String}
21547 */
21548 type: 'linear',
21549
21550 /**
21551 * 是否线性
21552 * @type {Boolean}
21553 * @readOnly
21554 * @default true
21555 */
21556 isLinear: true,
21557
21558 /**
21559 * min value of the scale
21560 * @type {Number}
21561 * @default null
21562 */
21563 min: null,
21564
21565 /**
21566 * min value limitted of the scale
21567 * @type {Number}
21568 * @default null
21569 */
21570 minLimit: null,
21571
21572 /**
21573 * max value of the scale
21574 * @type {Number}
21575 * @default null
21576 */
21577 max: null,
21578
21579 /**
21580 * max value limitted of the scale
21581 * @type {Number}
21582 * @default null
21583 */
21584 maxLimit: null,
21585
21586 /**
21587 * 是否为了用户习惯,优化min,max和ticks,如果进行优化,则会根据生成的ticks调整min,max,否则舍弃(min,max)范围之外的ticks
21588 * @type {Boolean}
21589 * @default false
21590 */
21591 nice: false,
21592
21593 /**
21594 * 自动生成标记时的个数
21595 * @type {Number}
21596 * @default null
21597 */
21598 tickCount: null,
21599
21600 /**
21601 * 坐标轴点之间的间距,指的是真实数据的差值
21602 * @type {Number}
21603 * @default null
21604 */
21605 tickInterval: null,
21606
21607 /**
21608 * 用于计算坐标点时逼近的数组
21609 * @type {Array}
21610 */
21611 snapArray: null
21612 });
21613 };
21614 /**
21615 * @protected
21616 * @override
21617 */
21618
21619
21620 Linear.prototype.init = function init() {
21621 var self = this;
21622 if (!self.ticks) {
21623 self.min = self.translate(self.min);
21624 self.max = self.translate(self.max);
21625 self.initTicks();
21626 } else {
21627 var ticks = self.ticks;
21628 var firstValue = self.translate(ticks[0]);
21629 var lastValue = self.translate(ticks[ticks.length - 1]);
21630 if (Util.isNil(self.min) || self.min > firstValue) {
21631 self.min = firstValue;
21632 }
21633 if (Util.isNil(self.max) || self.max < lastValue) {
21634 self.max = lastValue;
21635 }
21636 }
21637 };
21638
21639 /**
21640 * 计算坐标点
21641 * @protected
21642 * @return {Array} 计算完成的坐标点
21643 */
21644
21645
21646 Linear.prototype.calculateTicks = function calculateTicks() {
21647 var self = this;
21648 var min = self.min;
21649 var max = self.max;
21650 var count = self.tickCount;
21651 var interval = self.tickInterval;
21652 if (max < min) {
21653 throw new Error('max: ' + max + ' should not be less than min: ' + min);
21654 }
21655 var tmp = numberAuto({
21656 min: min,
21657 max: max,
21658 minLimit: self.minLimit,
21659 maxLimit: self.maxLimit,
21660 minCount: count,
21661 maxCount: count,
21662 interval: interval,
21663 snapArray: this.snapArray
21664 });
21665 return tmp.ticks;
21666 };
21667
21668 // 初始化ticks
21669
21670
21671 Linear.prototype.initTicks = function initTicks() {
21672 var self = this;
21673 var calTicks = self.calculateTicks();
21674 if (self.nice) {
21675 // 如果需要优化显示的tick
21676 self.ticks = calTicks;
21677 self.min = calTicks[0];
21678 self.max = calTicks[calTicks.length - 1];
21679 } else {
21680 var ticks = [];
21681 Util.each(calTicks, function (tick) {
21682 if (tick >= self.min && tick <= self.max) {
21683 ticks.push(tick);
21684 }
21685 });
21686 self.ticks = ticks;
21687 }
21688 };
21689
21690 /**
21691 * @override
21692 */
21693
21694
21695 Linear.prototype.scale = function scale(value) {
21696 if (value === null || value === undefined) {
21697 return NaN;
21698 }
21699 var max = this.max;
21700 var min = this.min;
21701 if (max === min) {
21702 return 0;
21703 }
21704
21705 var percent = (value - min) / (max - min);
21706 var rangeMin = this.rangeMin();
21707 var rangeMax = this.rangeMax();
21708 return rangeMin + percent * (rangeMax - rangeMin);
21709 };
21710
21711 /**
21712 * @override
21713 */
21714
21715
21716 Linear.prototype.invert = function invert(value) {
21717 var percent = (value - this.rangeMin()) / (this.rangeMax() - this.rangeMin());
21718 return this.min + percent * (this.max - this.min);
21719 };
21720
21721 return Linear;
21722}(Base);
21723
21724module.exports = Linear;
21725
21726/***/ }),
21727/* 43 */
21728/***/ (function(module, exports, __webpack_require__) {
21729
21730function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
21731
21732/**
21733 * @fileOverview the base class of Coordinate
21734 * @author sima.zhang
21735 */
21736var Util = __webpack_require__(0);
21737var MatrixUtil = __webpack_require__(2).MatrixUtil;
21738var mat3 = MatrixUtil.mat3;
21739var vec3 = MatrixUtil.vec3;
21740
21741var Coord = function () {
21742 /**
21743 * 获取默认的配置属性
21744 * @protected
21745 * @return {Object} 默认属性
21746 */
21747 Coord.prototype.getDefaultCfg = function getDefaultCfg() {
21748 return {
21749 /**
21750 * Mark x y is transposed.
21751 * @type {Boolean}
21752 */
21753 isTransposed: false,
21754 /**
21755 * The matrix of coordinate
21756 * @type {Array}
21757 */
21758 matrix: [1, 0, 0, 0, 1, 0, 0, 0, 1]
21759 };
21760 };
21761
21762 function Coord(cfg) {
21763 _classCallCheck(this, Coord);
21764
21765 var defaultCfg = this.getDefaultCfg();
21766 Util.mix(this, defaultCfg, cfg);
21767 this.init();
21768 }
21769
21770 Coord.prototype.init = function init() {
21771 var start = this.start;
21772 var end = this.end;
21773 var center = {
21774 x: (start.x + end.x) / 2,
21775 y: (start.y + end.y) / 2
21776 };
21777
21778 this.center = center;
21779 this.width = Math.abs(end.x - start.x);
21780 this.height = Math.abs(end.y - start.y);
21781 };
21782
21783 Coord.prototype._swapDim = function _swapDim(dim) {
21784 var dimRange = this[dim];
21785 if (dimRange) {
21786 var tmp = dimRange.start;
21787 dimRange.start = dimRange.end;
21788 dimRange.end = tmp;
21789 }
21790 };
21791
21792 Coord.prototype.getCenter = function getCenter() {
21793 return this.center;
21794 };
21795
21796 Coord.prototype.getWidth = function getWidth() {
21797 return this.width;
21798 };
21799
21800 Coord.prototype.getHeight = function getHeight() {
21801 return this.height;
21802 };
21803
21804 Coord.prototype.convertDim = function convertDim(percent, dim) {
21805 var _dim = this[dim],
21806 start = _dim.start,
21807 end = _dim.end;
21808
21809 return start + percent * (end - start);
21810 };
21811
21812 Coord.prototype.invertDim = function invertDim(value, dim) {
21813 var _dim2 = this[dim],
21814 start = _dim2.start,
21815 end = _dim2.end;
21816
21817 return (value - start) / (end - start);
21818 };
21819
21820 /**
21821 * 将归一化的坐标点数据转换为画布坐标
21822 * @override
21823 * @param {Object} point 归一化的坐标点
21824 * @return {Object} 返回画布坐标
21825 */
21826
21827
21828 Coord.prototype.convertPoint = function convertPoint(point) {
21829 return point;
21830 };
21831
21832 /**
21833 * 将画布坐标转换为归一化的坐标点数据
21834 * @override
21835 * @param {Object} point 画布坐标点数据
21836 * @return {Object} 归一化后的数据点
21837 */
21838
21839
21840 Coord.prototype.invertPoint = function invertPoint(point) {
21841 return point;
21842 };
21843
21844 /**
21845 * 将坐标点进行矩阵变换
21846 * @param {Number} x 对应 x 轴画布坐标
21847 * @param {Number} y 对应 y 轴画布坐标
21848 * @param {Number} tag 默认为 0,可取值 0, 1
21849 * @return {Array} 返回变换后的三阶向量 [x, y, z]
21850 */
21851
21852
21853 Coord.prototype.applyMatrix = function applyMatrix(x, y) {
21854 var tag = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
21855
21856 var matrix = this.matrix;
21857 var vector = [x, y, tag];
21858 vec3.transformMat3(vector, vector, matrix);
21859 return vector;
21860 };
21861
21862 /**
21863 * 将坐标点进行矩阵逆变换
21864 * @param {Number} x 对应 x 轴画布坐标
21865 * @param {Number} y 对应 y 轴画布坐标
21866 * @param {Number} tag 默认为 0,可取值 0, 1
21867 * @return {Array} 返回矩阵逆变换后的三阶向量 [x, y, z]
21868 */
21869
21870
21871 Coord.prototype.invertMatrix = function invertMatrix(x, y) {
21872 var tag = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
21873
21874 var matrix = this.matrix;
21875 var inversedMatrix = mat3.invert([], matrix);
21876 var vector = [x, y, tag];
21877 vec3.transformMat3(vector, vector, inversedMatrix);
21878 return vector;
21879 };
21880
21881 /**
21882 * 将归一化的坐标点数据转换为画布坐标,并根据坐标系当前矩阵进行变换
21883 * @param {Object} point 归一化的坐标点
21884 * @return {Object} 返回进行矩阵变换后的画布坐标
21885 */
21886
21887
21888 Coord.prototype.convert = function convert(point) {
21889 var _convertPoint = this.convertPoint(point),
21890 x = _convertPoint.x,
21891 y = _convertPoint.y;
21892
21893 var vector = this.applyMatrix(x, y, 1);
21894 return {
21895 x: vector[0],
21896 y: vector[1]
21897 };
21898 };
21899
21900 /**
21901 * 将进行过矩阵变换画布坐标转换为归一化坐标
21902 * @param {Object} point 画布坐标
21903 * @return {Object} 返回归一化的坐标点
21904 */
21905
21906
21907 Coord.prototype.invert = function invert(point) {
21908 var vector = this.invertMatrix(point.x, point.y, 1);
21909 return this.invertPoint({
21910 x: vector[0],
21911 y: vector[1]
21912 });
21913 };
21914
21915 /**
21916 * 坐标系旋转变换
21917 * @param {Number} radian 旋转弧度
21918 * @return {Object} 返回坐标系对象
21919 */
21920
21921
21922 Coord.prototype.rotate = function rotate(radian) {
21923 var matrix = this.matrix;
21924 var center = this.center;
21925 mat3.translate(matrix, matrix, [-center.x, -center.y]);
21926 mat3.rotate(matrix, matrix, radian);
21927 mat3.translate(matrix, matrix, [center.x, center.y]);
21928 return this;
21929 };
21930
21931 /**
21932 * 坐标系反射变换
21933 * @param {String} dim 反射维度
21934 * @return {Object} 返回坐标系对象
21935 */
21936
21937
21938 Coord.prototype.reflect = function reflect(dim) {
21939 switch (dim) {
21940 case 'x':
21941 this._swapDim('x');
21942 break;
21943 case 'y':
21944 this._swapDim('y');
21945 break;
21946 default:
21947 this._swapDim('y');
21948 }
21949 return this;
21950 };
21951
21952 /**
21953 * 坐标系比例变换
21954 * @param {Number} s1 x 方向缩放比例
21955 * @param {Number} s2 y 方向缩放比例
21956 * @return {Object} 返回坐标系对象
21957 */
21958
21959
21960 Coord.prototype.scale = function scale(s1, s2) {
21961 var matrix = this.matrix;
21962 var center = this.center;
21963 mat3.translate(matrix, matrix, [-center.x, -center.y]);
21964 mat3.scale(matrix, matrix, [s1, s2]);
21965 mat3.translate(matrix, matrix, [center.x, center.y]);
21966 return this;
21967 };
21968
21969 /**
21970 * 坐标系平移变换
21971 * @param {Number} x x 方向平移像素
21972 * @param {Number} y y 方向平移像素
21973 * @return {Object} 返回坐标系对象
21974 */
21975
21976
21977 Coord.prototype.translate = function translate(x, y) {
21978 var matrix = this.matrix;
21979 mat3.translate(matrix, matrix, [x, y]);
21980 return this;
21981 };
21982
21983 /**
21984 * 将坐标系 x y 两个轴进行转置
21985 * @return {Object} 返回坐标系对象
21986 */
21987
21988
21989 Coord.prototype.transpose = function transpose() {
21990 this.isTransposed = !this.isTransposed;
21991 return this;
21992 };
21993
21994 return Coord;
21995}();
21996
21997module.exports = Coord;
21998
21999/***/ }),
22000/* 44 */
22001/***/ (function(module, exports, __webpack_require__) {
22002
22003function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
22004
22005function _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; }
22006
22007function _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; }
22008
22009/**
22010 * @fileOverview the base class of Axis
22011 * @author sima.zhang
22012 */
22013var Util = __webpack_require__(0);
22014
22015var _require = __webpack_require__(65),
22016 LabelsRenderer = _require.LabelsRenderer;
22017
22018var _require2 = __webpack_require__(2),
22019 Group = _require2.Group;
22020
22021var Grid = __webpack_require__(337);
22022var Global = __webpack_require__(1);
22023
22024var Base = function (_Group) {
22025 _inherits(Base, _Group);
22026
22027 function Base() {
22028 _classCallCheck(this, Base);
22029
22030 return _possibleConstructorReturn(this, _Group.apply(this, arguments));
22031 }
22032
22033 Base.prototype.getDefaultCfg = function getDefaultCfg() {
22034 return {
22035 /**
22036 * 用于动画,唯一标识的 id
22037 * @type {[type]}
22038 */
22039 _id: null,
22040 zIndex: 4,
22041 /**
22042 * 坐标轴上的坐标点
22043 * @type {Array}
22044 */
22045 ticks: null,
22046 /**
22047 * 坐标轴线的配置信息,如果设置成null,则不显示轴线
22048 * @type {Object}
22049 */
22050 line: null,
22051 /**
22052 * 坐标轴刻度线的配置,如果设置成null,则不显示刻度线
22053 * @type {Object}
22054 */
22055 tickLine: null,
22056 /**
22057 * 次刻度线个数配置
22058 * @type {Number}
22059 */
22060 subTickCount: 0,
22061 /**
22062 * 次刻度线样式配置
22063 * @type {Object}
22064 */
22065 subTickLine: null,
22066 /**
22067 * 网格线配置,如果值为 null,则不显示
22068 * @type {Object}
22069 */
22070 grid: null,
22071 /**
22072 * 坐标轴文本配置
22073 * @type {Object}
22074 */
22075 label: {
22076 textStyle: {}, // 坐标轴文本样式
22077 autoRotate: true,
22078 formatter: null // 坐标轴文本格式化回调函数
22079 },
22080 /**
22081 * 坐标轴标题配置
22082 * @type {Object}
22083 */
22084 title: {
22085 autoRotate: true, // 文本是否自动旋转
22086 textStyle: {} // 坐标轴标题样式
22087 },
22088 autoPaint: true
22089 };
22090 };
22091
22092 Base.prototype._beforeRenderUI = function _beforeRenderUI() {
22093 var title = this.get('title');
22094 var label = this.get('label');
22095 var grid = this.get('grid');
22096 if (title) {
22097 this.setSilent('title', Util.deepMix({
22098 autoRotate: true,
22099 textStyle: {
22100 fontSize: 12,
22101 fill: '#ccc',
22102 textBaseline: 'middle',
22103 fontFamily: Global.fontFamily,
22104 textAlign: 'center'
22105 },
22106 offset: 48
22107 }, title));
22108 }
22109 if (label) {
22110 this.setSilent('label', Util.deepMix({
22111 autoRotate: true,
22112 textStyle: {
22113 fontSize: 12,
22114 fill: '#ccc',
22115 textBaseline: 'middle',
22116 fontFamily: Global.fontFamily
22117 },
22118 offset: 10
22119 }, label));
22120 }
22121 if (grid) {
22122 this.setSilent('grid', Util.deepMix({
22123 lineStyle: {
22124 lineWidth: 1,
22125 stroke: '#C0D0E0'
22126 }
22127 }, grid));
22128 }
22129 };
22130
22131 Base.prototype._renderUI = function _renderUI() {
22132 var labelCfg = this.get('label');
22133 if (labelCfg) {
22134 this.renderLabels();
22135 }
22136 if (this.get('autoPaint')) {
22137 this.paint();
22138 }
22139 if (!Util.isNil(this.get('title'))) {
22140 this.renderTitle();
22141 }
22142 this.sort();
22143 };
22144
22145 Base.prototype._parseTicks = function _parseTicks(ticks) {
22146 ticks = ticks || [];
22147 var ticksLength = ticks.length;
22148 for (var i = 0; i < ticksLength; i++) {
22149 var item = ticks[i];
22150 if (!Util.isObject(item)) {
22151 ticks[i] = this.parseTick(item, i, ticksLength);
22152 }
22153 }
22154 this.set('ticks', ticks);
22155 return ticks;
22156 };
22157
22158 Base.prototype._addTickItem = function _addTickItem(index, point, length) {
22159 var type = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
22160
22161 var tickItems = this.get('tickItems');
22162 var subTickItems = this.get('subTickItems');
22163 var end = this.getTickEnd(point, length, index);
22164
22165 var cfg = {
22166 x1: point.x,
22167 y1: point.y,
22168 x2: end.x,
22169 y2: end.y
22170 };
22171
22172 if (!tickItems) {
22173 tickItems = [];
22174 }
22175
22176 if (!subTickItems) {
22177 subTickItems = [];
22178 }
22179
22180 if (type === 'sub') {
22181 subTickItems.push(cfg);
22182 } else {
22183 tickItems.push(cfg);
22184 }
22185
22186 this.set('tickItems', tickItems);
22187 this.set('subTickItems', subTickItems);
22188 };
22189
22190 Base.prototype._renderLine = function _renderLine() {
22191 var lineCfg = this.get('line');
22192 var path = void 0;
22193 if (lineCfg) {
22194 path = this.getLinePath();
22195 lineCfg = Util.mix({
22196 path: path
22197 }, lineCfg);
22198 var lineShape = this.addShape('path', {
22199 attrs: lineCfg
22200 });
22201 lineShape.name = 'axis-line';
22202 this.get('appendInfo') && lineShape.setSilent('appendInfo', this.get('appendInfo'));
22203 this.set('lineShape', lineShape);
22204 }
22205 };
22206
22207 Base.prototype._processTicks = function _processTicks() {
22208 var self = this;
22209 var labelCfg = self.get('label');
22210 var subTickCount = self.get('subTickCount');
22211 var tickLineCfg = self.get('tickLine');
22212 var ticks = self.get('ticks');
22213 ticks = self._parseTicks(ticks);
22214
22215 Util.each(ticks, function (tick, index) {
22216 var tickPoint = self.getTickPoint(tick.value, index);
22217 if (tickLineCfg) {
22218 self._addTickItem(index, tickPoint, tickLineCfg.length);
22219 }
22220 if (labelCfg) {
22221 self.addLabel(tick, tickPoint, index);
22222 }
22223 });
22224
22225 if (subTickCount) {
22226 // 如果有设置次级分点,添加次级tick
22227 var subTickLineCfg = self.get('subTickLine');
22228 Util.each(ticks, function (tick, index) {
22229 if (index > 0) {
22230 var diff = tick.value - ticks[index - 1].value;
22231 diff = diff / (self.get('subTickCount') + 1);
22232
22233 for (var i = 1; i <= subTickCount; i++) {
22234 var subTick = {
22235 text: '',
22236 value: index ? ticks[index - 1].value + i * diff : i * diff
22237 };
22238
22239 var tickPoint = self.getTickPoint(subTick.value);
22240 var subTickLength = void 0;
22241 if (subTickLineCfg && subTickLineCfg.length) {
22242 subTickLength = subTickLineCfg.length;
22243 } else {
22244 subTickLength = parseInt(tickLineCfg.length * (3 / 5), 10);
22245 }
22246 self._addTickItem(i - 1, tickPoint, subTickLength, 'sub');
22247 }
22248 }
22249 });
22250 }
22251 };
22252
22253 Base.prototype._addTickLine = function _addTickLine(ticks, lineCfg) {
22254 var self = this;
22255 var cfg = Util.mix({}, lineCfg);
22256 var path = [];
22257 Util.each(ticks, function (item) {
22258 path.push(['M', item.x1, item.y1]);
22259 path.push(['L', item.x2, item.y2]);
22260 });
22261 delete cfg.length;
22262 cfg.path = path;
22263 var tickShape = self.addShape('path', {
22264 attrs: cfg
22265 });
22266 tickShape.name = 'axis-ticks';
22267 tickShape._id = self.get('_id') + '-ticks';
22268 tickShape.set('coord', self.get('coord'));
22269 self.get('appendInfo') && tickShape.setSilent('appendInfo', self.get('appendInfo'));
22270 };
22271
22272 Base.prototype._renderTicks = function _renderTicks() {
22273 var self = this;
22274 var tickItems = self.get('tickItems');
22275 var subTickItems = self.get('subTickItems');
22276
22277 if (!Util.isEmpty(tickItems)) {
22278 var tickLineCfg = self.get('tickLine');
22279 self._addTickLine(tickItems, tickLineCfg);
22280 }
22281
22282 if (!Util.isEmpty(subTickItems)) {
22283 var subTickLineCfg = self.get('subTickLine') || self.get('tickLine');
22284 self._addTickLine(subTickItems, subTickLineCfg);
22285 }
22286 };
22287
22288 Base.prototype._renderGrid = function _renderGrid() {
22289 var grid = this.get('grid');
22290 if (!grid) {
22291 return;
22292 }
22293 grid.coord = this.get('coord');
22294 grid.appendInfo = this.get('appendInfo');
22295 this.set('gridGroup', this.addGroup(Grid, grid));
22296 };
22297
22298 Base.prototype.paint = function paint() {
22299 this._renderLine();
22300 this._processTicks();
22301 this._renderTicks();
22302 this._renderGrid();
22303 var labelCfg = this.get('label');
22304 if (labelCfg && labelCfg.autoRotate) {
22305 this.autoRotateLabels();
22306 }
22307 };
22308
22309 Base.prototype.parseTick = function parseTick(tick, index, length) {
22310 return {
22311 text: tick,
22312 value: index / (length - 1)
22313 };
22314 };
22315
22316 Base.prototype.getTextAnchor = function getTextAnchor(vector) {
22317 var ratio = Math.abs(vector[1] / vector[0]);
22318 var align = void 0;
22319 if (ratio >= 1) {
22320 // 上面或者下面
22321 align = 'center';
22322 } else {
22323 if (vector[0] > 0) {
22324 // 右侧
22325 align = 'start';
22326 } else {
22327 // 左侧
22328 align = 'end';
22329 }
22330 }
22331 return align;
22332 };
22333
22334 Base.prototype.getMaxLabelWidth = function getMaxLabelWidth(labelsGroup) {
22335 var labels = labelsGroup.get('children');
22336 var max = 0;
22337 Util.each(labels, function (label) {
22338 var bbox = label.getBBox();
22339 var width = bbox.width;
22340 if (max < width) {
22341 max = width;
22342 }
22343 });
22344 return max;
22345 };
22346
22347 Base.prototype.remove = function remove() {
22348 _Group.prototype.remove.call(this);
22349 var gridGroup = this.get('gridGroup');
22350 gridGroup && gridGroup.remove();
22351 this.removeLabels();
22352 };
22353
22354 /**
22355 * 旋转文本
22356 * @abstract
22357 * @return {[type]} [description]
22358 */
22359
22360
22361 Base.prototype.autoRotateLabels = function autoRotateLabels() {};
22362
22363 /**
22364 * 渲染标题
22365 * @abstract
22366 * @return {[type]} [description]
22367 */
22368
22369
22370 Base.prototype.renderTitle = function renderTitle() {};
22371
22372 /**
22373 * 获取坐标轴线的 path
22374 * @abstract
22375 * @return {[type]} [description]
22376 */
22377
22378
22379 Base.prototype.getLinePath = function getLinePath() {};
22380
22381 /**
22382 * 获取 tick 在画布上的位置
22383 * @abstract
22384 * @return {[type]} [description]
22385 */
22386
22387
22388 Base.prototype.getTickPoint = function getTickPoint() {};
22389
22390 /**
22391 * 获取标示坐标点的线的终点
22392 * @abstract
22393 * @return {[type]} [description]
22394 */
22395
22396
22397 Base.prototype.getTickEnd = function getTickEnd() {};
22398
22399 /**
22400 * 获取距离坐标轴的向量
22401 * @abstract
22402 * @return {[type]} [description]
22403 */
22404
22405
22406 Base.prototype.getSideVector = function getSideVector() {};
22407
22408 return Base;
22409}(Group);
22410
22411Util.assign(Base.prototype, LabelsRenderer, {
22412 addLabel: function addLabel(tick, point, index) {
22413 var labelsGroup = this.get('labelsGroup');
22414 var label = {};
22415 var rst = void 0;
22416
22417 if (labelsGroup) {
22418 var offset = this.get('_labelOffset');
22419 if (!Util.isNil(this.get('label').offset)) {
22420 offset = this.get('label').offset;
22421 }
22422 var vector = this.getSideVector(offset, point, index);
22423 point = {
22424 x: point.x + vector[0],
22425 y: point.y + vector[1]
22426 };
22427 label.text = tick.text;
22428 label.x = point.x;
22429 label.y = point.y;
22430 label.textAlign = this.getTextAnchor(vector);
22431 rst = labelsGroup.addLabel(label);
22432 if (rst) {
22433 rst.name = 'axis-label';
22434 rst._id = this.get('_id') + '-' + tick.tickValue;
22435 rst.set('coord', this.get('coord'));
22436 this.get('appendInfo') && rst.setSilent('appendInfo', this.get('appendInfo'));
22437 }
22438 }
22439 return rst;
22440 }
22441});
22442
22443module.exports = Base;
22444
22445/***/ }),
22446/* 45 */
22447/***/ (function(module, exports, __webpack_require__) {
22448
22449function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
22450
22451/**
22452 * @fileOverview facets of chart
22453 * @author dxq613@gmail.com
22454 */
22455
22456var assign = __webpack_require__(60);
22457var isNil = __webpack_require__(93);
22458var isArray = __webpack_require__(3);
22459var cloneDeep = __webpack_require__(102);
22460var Global = __webpack_require__(1);
22461
22462// 绑定事件
22463function wrapBehavior(obj, action) {
22464 if (obj['_wrap_' + action]) {
22465 return obj['_wrap_' + action];
22466 }
22467 var method = function method(e) {
22468 obj[action](e);
22469 };
22470 obj['_wrap_' + action] = method;
22471 return method;
22472}
22473
22474// 获取绑定的事件
22475function getWrapBehavior(obj, action) {
22476 return obj['_wrap_' + action];
22477}
22478
22479var Base = function () {
22480 Base.prototype.getDefaultCfg = function getDefaultCfg() {
22481 return {
22482 chart: null,
22483 group: null,
22484
22485 /**
22486 * 是否默认显示每个分面的title
22487 * @type {Boolean}
22488 */
22489 showTitle: true,
22490
22491 /**
22492 * 是否自动修改坐标轴的信息
22493 * @type {Boolean}
22494 */
22495 autoSetAxis: true,
22496
22497 /**
22498 * View 的内边框
22499 * @type {Number|Array}
22500 */
22501 padding: 10,
22502
22503 /**
22504 * 遍历每个view 的回调函数
22505 * @type {Function}
22506 */
22507 eachView: null,
22508
22509 /**
22510 * 分面的字段名列表
22511 * @type {Array}
22512 */
22513 fields: [],
22514
22515 /**
22516 * 列值的的标题
22517 * @type {Object}
22518 */
22519 colTitle: {
22520 offsetY: -15,
22521 style: {
22522 fontSize: 14,
22523 textAlign: 'center',
22524 fill: '#444',
22525 fontFamily: Global.fontFamily
22526 }
22527 },
22528 rowTitle: {
22529 offsetX: 15,
22530 style: {
22531 fontSize: 14,
22532 textAlign: 'center',
22533 rotate: 90,
22534 fill: '#444',
22535 fontFamily: Global.fontFamily
22536 }
22537 }
22538 };
22539 };
22540
22541 function Base(cfg) {
22542 _classCallCheck(this, Base);
22543
22544 var defaultCfg = this.getDefaultCfg();
22545 assign(this, defaultCfg, cfg);
22546 this.init();
22547 }
22548
22549 Base.prototype.init = function init() {
22550 if (!this.chart) {
22551 throw new Error('Facets Error: please specify the chart!');
22552 }
22553 this._bindEvent();
22554 this.initContainer();
22555 if (this.chart.get('data')) {
22556 this.initViews();
22557 }
22558 };
22559
22560 Base.prototype.initContainer = function initContainer() {
22561 var chart = this.chart;
22562 var frontPlot = chart.get('frontPlot');
22563 var group = frontPlot.addGroup();
22564 this.group = group;
22565 };
22566
22567 Base.prototype.initViews = function initViews() {
22568 var chart = this.chart;
22569 var data = chart.get('data');
22570 var eachView = this.eachView;
22571 var facets = this.generateFacets(data);
22572 for (var i = 0; i < facets.length; i++) {
22573 var facet = facets[i];
22574 var region = facet.region;
22575 var view = chart.view({
22576 start: region.start,
22577 end: region.end,
22578 padding: this.padding
22579 });
22580 view.source(facet.data);
22581 this.beforeProcessView(view, facet);
22582 if (eachView) {
22583 eachView(view, facet);
22584 }
22585 this.afterProcessView(view, facet);
22586 facet.view = view;
22587 }
22588 this.facets = facets;
22589 };
22590
22591 /**
22592 * 处理 view 前
22593 * @protected
22594 */
22595
22596
22597 Base.prototype.beforeProcessView = function beforeProcessView() /* view, facet */{};
22598
22599 /**
22600 * 处理view
22601 * @param {Object} view 视图
22602 * @param {Object} facet 分面信息
22603 * @protected
22604 */
22605
22606
22607 Base.prototype.afterProcessView = function afterProcessView(view, facet) {
22608 if (this.autoSetAxis) {
22609 this.processAxis(view, facet);
22610 }
22611 };
22612
22613 Base.prototype.processAxis = function processAxis(view, facet) {
22614 var viewOptions = view.get('options');
22615 var geoms = view.get('geoms');
22616 if ((!viewOptions.coord.type || viewOptions.coord.type === 'rect') && geoms.length) {
22617 var field = geoms[0].get('attrOptions').position.field;
22618 var fields = isArray(field) ? field : field.split('*').map(function (str) {
22619 return str.trim();
22620 });
22621 var xField = fields[0];
22622 var yField = fields[1];
22623 if (isNil(viewOptions.axes)) {
22624 viewOptions.axes = {};
22625 }
22626 var axes = viewOptions.axes;
22627 if (axes !== false) {
22628 if (xField && axes[xField] !== false) {
22629 axes[xField] = axes[xField] || {};
22630 this.setXAxis(xField, axes, facet);
22631 }
22632 if (yField && axes[yField] !== false) {
22633 axes[yField] = axes[yField] || {};
22634 this.setYAxis(yField, axes, facet);
22635 }
22636 }
22637 }
22638 };
22639
22640 Base.prototype.setXAxis = function setXAxis() /* xField, axes, facet */{};
22641
22642 Base.prototype.setYAxis = function setYAxis() /* yField, axes, facet */{};
22643
22644 // 默认显示各列的标题
22645
22646
22647 Base.prototype.renderTitle = function renderTitle(view, facet) {
22648 this.drawColTitle(view, facet);
22649 };
22650
22651 Base.prototype.getScaleText = function getScaleText(field, value, view) {
22652 var rst = void 0;
22653 if (field) {
22654 var scales = view.get('scales');
22655 var scale = scales[field];
22656 if (!scale) {
22657 scale = view.createScale(field);
22658 }
22659 rst = scale.getText(value);
22660 } else {
22661 rst = value;
22662 }
22663 return rst;
22664 };
22665
22666 Base.prototype.drawColTitle = function drawColTitle(view, facet) {
22667 var text = this.getScaleText(facet.colField, facet.colValue, view);
22668 var colTextCfg = assign({
22669 position: ['50%', '0%'],
22670 content: text
22671 }, this.colTitle);
22672 view.guide().text(colTextCfg);
22673 };
22674
22675 Base.prototype.drawRowTitle = function drawRowTitle(view, facet) {
22676 var text = this.getScaleText(facet.rowField, facet.rowValue, view);
22677 var rowTextCfg = assign({
22678 position: ['100%', '50%'],
22679 content: text
22680 }, cloneDeep(this.rowTitle));
22681
22682 view.guide().text(rowTextCfg);
22683 };
22684
22685 /**
22686 * 数据过滤器
22687 * @protected
22688 * @param {Array} conditions 过滤条件
22689 * @return {Function} 过滤函数
22690 */
22691
22692
22693 Base.prototype.getFilter = function getFilter(conditions) {
22694 var filter = function filter(obj) {
22695 var filtered = true;
22696 conditions.forEach(function (cond) {
22697 var field = cond.field;
22698 var value = cond.value;
22699 // const values = cond.values;
22700 var tmp = true;
22701 if (!isNil(value) && field) {
22702 tmp = obj[field] === value;
22703 }
22704 filtered = filtered && tmp;
22705 });
22706 return filtered;
22707 };
22708 return filter;
22709 };
22710
22711 /**
22712 * 获取字段对应的值
22713 * @protected
22714 * @param {String} field 字段名
22715 * @param {Array} data 数据
22716 * @return {Array} 字段对应的值
22717 */
22718
22719
22720 Base.prototype.getFieldValues = function getFieldValues(field, data) {
22721 var rst = [];
22722 var tmpMap = {};
22723 for (var i = 0; i < data.length; i++) {
22724 var obj = data[i];
22725 var value = obj[field];
22726 if (!isNil(value) && !tmpMap[value]) {
22727 rst.push(value);
22728 tmpMap[value] = true;
22729 }
22730 }
22731 return rst;
22732 };
22733
22734 Base.prototype.getRegion = function getRegion(rows, cols, xIndex, yIndex) {
22735 var xWidth = 1 / cols; // x轴方向的每个分面的偏移
22736 var yWidth = 1 / rows; // y轴方向的每个分面的偏移
22737
22738 var start = {
22739 x: xWidth * xIndex,
22740 y: yWidth * yIndex
22741 };
22742
22743 var end = {
22744 x: start.x + xWidth,
22745 y: start.y + yWidth
22746 };
22747
22748 return {
22749 start: start,
22750 end: end
22751 };
22752 };
22753
22754 /**
22755 * 生成分面
22756 * @protected
22757 * @return {Array} 多个分面集合
22758 */
22759
22760
22761 Base.prototype.generateFacets = function generateFacets() /* data */{
22762 return [];
22763 };
22764
22765 Base.prototype._bindEvent = function _bindEvent() {
22766 var chart = this.chart;
22767 chart.on('afterchangedata', wrapBehavior(this, 'onDataChange'));
22768 chart.on('beforeclear', wrapBehavior(this, 'onClear'));
22769 chart.on('beforedestroy', wrapBehavior(this, 'destroy'));
22770 chart.on('beforepaint', wrapBehavior(this, 'onPaint'));
22771 chart.on('setdata', wrapBehavior(this, 'onDataChange'));
22772 };
22773
22774 Base.prototype._clearEvent = function _clearEvent() {
22775 var chart = this.chart;
22776 if (chart) {
22777 chart.off('afterchangedata', getWrapBehavior(this, 'onDataChange'));
22778 chart.off('beforeclear', getWrapBehavior(this, 'onClear'));
22779 chart.off('beforedestroy', getWrapBehavior(this, 'destroy'));
22780 chart.off('beforepaint', getWrapBehavior(this, 'onPaint'));
22781 chart.off('setdata', getWrapBehavior(this, 'onDataChange'));
22782 }
22783 };
22784
22785 Base.prototype._clearFacets = function _clearFacets() {
22786 var facets = this.facets;
22787 var chart = this.chart;
22788 if (facets) {
22789 for (var i = 0; i < facets.length; i++) {
22790 var facet = facets[i];
22791 chart.removeView(facet.view);
22792 }
22793 }
22794 this.facets = null;
22795 };
22796
22797 Base.prototype.onClear = function onClear() {
22798 this.onRemove();
22799 };
22800
22801 Base.prototype.onPaint = function onPaint() {
22802 if (this.showTitle) {
22803 var facets = this.facets;
22804 for (var i = 0; i < facets.length; i++) {
22805 var facet = facets[i];
22806 var view = facet.view;
22807 this.renderTitle(view, facet);
22808 }
22809 }
22810 };
22811
22812 Base.prototype.onDataChange = function onDataChange() {
22813 this._clearFacets();
22814 this.initViews();
22815 };
22816
22817 Base.prototype.onRemove = function onRemove() {
22818 this._clearFacets();
22819 this._clearEvent();
22820 this.group && this.group.remove();
22821 this.chart = null;
22822 this.facets = null;
22823 this.group = null;
22824 };
22825
22826 Base.prototype.destroy = function destroy() {
22827 this.onRemove();
22828 this.destroyed = true;
22829 };
22830
22831 return Base;
22832}();
22833
22834module.exports = Base;
22835
22836/***/ }),
22837/* 46 */
22838/***/ (function(module, exports, __webpack_require__) {
22839
22840var baseIsTypedArray = __webpack_require__(138),
22841 baseUnary = __webpack_require__(72),
22842 nodeUtil = __webpack_require__(73);
22843
22844/* Node.js helper references. */
22845var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
22846
22847/**
22848 * Checks if `value` is classified as a typed array.
22849 *
22850 * @static
22851 * @memberOf _
22852 * @since 3.0.0
22853 * @category Lang
22854 * @param {*} value The value to check.
22855 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
22856 * @example
22857 *
22858 * _.isTypedArray(new Uint8Array);
22859 * // => true
22860 *
22861 * _.isTypedArray([]);
22862 * // => false
22863 */
22864var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
22865
22866module.exports = isTypedArray;
22867
22868/***/ }),
22869/* 47 */
22870/***/ (function(module, exports) {
22871
22872/** Used as references for various `Number` constants. */
22873var MAX_SAFE_INTEGER = 9007199254740991;
22874
22875/**
22876 * Checks if `value` is a valid array-like length.
22877 *
22878 * **Note:** This method is loosely based on
22879 * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
22880 *
22881 * @static
22882 * @memberOf _
22883 * @since 4.0.0
22884 * @category Lang
22885 * @param {*} value The value to check.
22886 * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
22887 * @example
22888 *
22889 * _.isLength(3);
22890 * // => true
22891 *
22892 * _.isLength(Number.MIN_VALUE);
22893 * // => false
22894 *
22895 * _.isLength(Infinity);
22896 * // => false
22897 *
22898 * _.isLength('3');
22899 * // => false
22900 */
22901function isLength(value) {
22902 return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
22903}
22904
22905module.exports = isLength;
22906
22907/***/ }),
22908/* 48 */
22909/***/ (function(module, exports, __webpack_require__) {
22910
22911var baseGetTag = __webpack_require__(6),
22912 isObject = __webpack_require__(7);
22913
22914/** `Object#toString` result references. */
22915var asyncTag = '[object AsyncFunction]',
22916 funcTag = '[object Function]',
22917 genTag = '[object GeneratorFunction]',
22918 proxyTag = '[object Proxy]';
22919
22920/**
22921 * Checks if `value` is classified as a `Function` object.
22922 *
22923 * @static
22924 * @memberOf _
22925 * @since 0.1.0
22926 * @category Lang
22927 * @param {*} value The value to check.
22928 * @returns {boolean} Returns `true` if `value` is a function, else `false`.
22929 * @example
22930 *
22931 * _.isFunction(_);
22932 * // => true
22933 *
22934 * _.isFunction(/abc/);
22935 * // => false
22936 */
22937function isFunction(value) {
22938 if (!isObject(value)) {
22939 return false;
22940 }
22941 // The use of `Object#toString` avoids issues with the `typeof` operator
22942 // in Safari 9 which returns 'object' for typed arrays and other constructors.
22943 var tag = baseGetTag(value);
22944 return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
22945}
22946
22947module.exports = isFunction;
22948
22949/***/ }),
22950/* 49 */
22951/***/ (function(module, exports) {
22952
22953/**
22954 * A specialized version of `_.map` for arrays without support for iteratee
22955 * shorthands.
22956 *
22957 * @private
22958 * @param {Array} [array] The array to iterate over.
22959 * @param {Function} iteratee The function invoked per iteration.
22960 * @returns {Array} Returns the new mapped array.
22961 */
22962function arrayMap(array, iteratee) {
22963 var index = -1,
22964 length = array == null ? 0 : array.length,
22965 result = Array(length);
22966
22967 while (++index < length) {
22968 result[index] = iteratee(array[index], index, array);
22969 }
22970 return result;
22971}
22972
22973module.exports = arrayMap;
22974
22975/***/ }),
22976/* 50 */
22977/***/ (function(module, exports, __webpack_require__) {
22978
22979var ListCache = __webpack_require__(32),
22980 stackClear = __webpack_require__(150),
22981 stackDelete = __webpack_require__(151),
22982 stackGet = __webpack_require__(152),
22983 stackHas = __webpack_require__(153),
22984 stackSet = __webpack_require__(154);
22985
22986/**
22987 * Creates a stack cache object to store key-value pairs.
22988 *
22989 * @private
22990 * @constructor
22991 * @param {Array} [entries] The key-value pairs to cache.
22992 */
22993function Stack(entries) {
22994 var data = this.__data__ = new ListCache(entries);
22995 this.size = data.size;
22996}
22997
22998// Add methods to `Stack`.
22999Stack.prototype.clear = stackClear;
23000Stack.prototype['delete'] = stackDelete;
23001Stack.prototype.get = stackGet;
23002Stack.prototype.has = stackHas;
23003Stack.prototype.set = stackSet;
23004
23005module.exports = Stack;
23006
23007/***/ }),
23008/* 51 */
23009/***/ (function(module, exports, __webpack_require__) {
23010
23011var getNative = __webpack_require__(13),
23012 root = __webpack_require__(4);
23013
23014/* Built-in method references that are verified to be native. */
23015var Map = getNative(root, 'Map');
23016
23017module.exports = Map;
23018
23019/***/ }),
23020/* 52 */
23021/***/ (function(module, exports, __webpack_require__) {
23022
23023var mapCacheClear = __webpack_require__(159),
23024 mapCacheDelete = __webpack_require__(166),
23025 mapCacheGet = __webpack_require__(168),
23026 mapCacheHas = __webpack_require__(169),
23027 mapCacheSet = __webpack_require__(170);
23028
23029/**
23030 * Creates a map cache object to store key-value pairs.
23031 *
23032 * @private
23033 * @constructor
23034 * @param {Array} [entries] The key-value pairs to cache.
23035 */
23036function MapCache(entries) {
23037 var index = -1,
23038 length = entries == null ? 0 : entries.length;
23039
23040 this.clear();
23041 while (++index < length) {
23042 var entry = entries[index];
23043 this.set(entry[0], entry[1]);
23044 }
23045}
23046
23047// Add methods to `MapCache`.
23048MapCache.prototype.clear = mapCacheClear;
23049MapCache.prototype['delete'] = mapCacheDelete;
23050MapCache.prototype.get = mapCacheGet;
23051MapCache.prototype.has = mapCacheHas;
23052MapCache.prototype.set = mapCacheSet;
23053
23054module.exports = MapCache;
23055
23056/***/ }),
23057/* 53 */
23058/***/ (function(module, exports) {
23059
23060/**
23061 * Converts `map` to its key-value pairs.
23062 *
23063 * @private
23064 * @param {Object} map The map to convert.
23065 * @returns {Array} Returns the key-value pairs.
23066 */
23067function mapToArray(map) {
23068 var index = -1,
23069 result = Array(map.size);
23070
23071 map.forEach(function (value, key) {
23072 result[++index] = [key, value];
23073 });
23074 return result;
23075}
23076
23077module.exports = mapToArray;
23078
23079/***/ }),
23080/* 54 */
23081/***/ (function(module, exports) {
23082
23083/**
23084 * Appends the elements of `values` to `array`.
23085 *
23086 * @private
23087 * @param {Array} array The array to modify.
23088 * @param {Array} values The values to append.
23089 * @returns {Array} Returns `array`.
23090 */
23091function arrayPush(array, values) {
23092 var index = -1,
23093 length = values.length,
23094 offset = array.length;
23095
23096 while (++index < length) {
23097 array[offset + index] = values[index];
23098 }
23099 return array;
23100}
23101
23102module.exports = arrayPush;
23103
23104/***/ }),
23105/* 55 */
23106/***/ (function(module, exports, __webpack_require__) {
23107
23108var arrayFilter = __webpack_require__(83),
23109 stubArray = __webpack_require__(84);
23110
23111/** Used for built-in method references. */
23112var objectProto = Object.prototype;
23113
23114/** Built-in value references. */
23115var propertyIsEnumerable = objectProto.propertyIsEnumerable;
23116
23117/* Built-in method references for those with the same name as other `lodash` methods. */
23118var nativeGetSymbols = Object.getOwnPropertySymbols;
23119
23120/**
23121 * Creates an array of the own enumerable symbols of `object`.
23122 *
23123 * @private
23124 * @param {Object} object The object to query.
23125 * @returns {Array} Returns the array of symbols.
23126 */
23127var getSymbols = !nativeGetSymbols ? stubArray : function (object) {
23128 if (object == null) {
23129 return [];
23130 }
23131 object = Object(object);
23132 return arrayFilter(nativeGetSymbols(object), function (symbol) {
23133 return propertyIsEnumerable.call(object, symbol);
23134 });
23135};
23136
23137module.exports = getSymbols;
23138
23139/***/ }),
23140/* 56 */
23141/***/ (function(module, exports, __webpack_require__) {
23142
23143var castPath = __webpack_require__(39),
23144 toKey = __webpack_require__(22);
23145
23146/**
23147 * The base implementation of `_.get` without support for default values.
23148 *
23149 * @private
23150 * @param {Object} object The object to query.
23151 * @param {Array|string} path The path of the property to get.
23152 * @returns {*} Returns the resolved value.
23153 */
23154function baseGet(object, path) {
23155 path = castPath(path, object);
23156
23157 var index = 0,
23158 length = path.length;
23159
23160 while (object != null && index < length) {
23161 object = object[toKey(path[index++])];
23162 }
23163 return index && index == length ? object : undefined;
23164}
23165
23166module.exports = baseGet;
23167
23168/***/ }),
23169/* 57 */
23170/***/ (function(module, exports, __webpack_require__) {
23171
23172var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
23173
23174var isArray = __webpack_require__(3),
23175 isSymbol = __webpack_require__(21);
23176
23177/** Used to match property names within property paths. */
23178var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
23179 reIsPlainProp = /^\w*$/;
23180
23181/**
23182 * Checks if `value` is a property name and not a property path.
23183 *
23184 * @private
23185 * @param {*} value The value to check.
23186 * @param {Object} [object] The object to query keys on.
23187 * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
23188 */
23189function isKey(value, object) {
23190 if (isArray(value)) {
23191 return false;
23192 }
23193 var type = typeof value === 'undefined' ? 'undefined' : _typeof(value);
23194 if (type == 'number' || type == 'symbol' || type == 'boolean' || value == null || isSymbol(value)) {
23195 return true;
23196 }
23197 return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object);
23198}
23199
23200module.exports = isKey;
23201
23202/***/ }),
23203/* 58 */
23204/***/ (function(module, exports) {
23205
23206/**
23207 * A specialized version of `_.reduce` for arrays without support for
23208 * iteratee shorthands.
23209 *
23210 * @private
23211 * @param {Array} [array] The array to iterate over.
23212 * @param {Function} iteratee The function invoked per iteration.
23213 * @param {*} [accumulator] The initial value.
23214 * @param {boolean} [initAccum] Specify using the first element of `array` as
23215 * the initial value.
23216 * @returns {*} Returns the accumulated value.
23217 */
23218function arrayReduce(array, iteratee, accumulator, initAccum) {
23219 var index = -1,
23220 length = array == null ? 0 : array.length;
23221
23222 if (initAccum && length) {
23223 accumulator = array[++index];
23224 }
23225 while (++index < length) {
23226 accumulator = iteratee(accumulator, array[index], index, array);
23227 }
23228 return accumulator;
23229}
23230
23231module.exports = arrayReduce;
23232
23233/***/ }),
23234/* 59 */
23235/***/ (function(module, exports, __webpack_require__) {
23236
23237var overArg = __webpack_require__(75);
23238
23239/** Built-in value references. */
23240var getPrototype = overArg(Object.getPrototypeOf, Object);
23241
23242module.exports = getPrototype;
23243
23244/***/ }),
23245/* 60 */
23246/***/ (function(module, exports, __webpack_require__) {
23247
23248var assignValue = __webpack_require__(40),
23249 copyObject = __webpack_require__(23),
23250 createAssigner = __webpack_require__(225),
23251 isArrayLike = __webpack_require__(8),
23252 isPrototype = __webpack_require__(18),
23253 keys = __webpack_require__(11);
23254
23255/** Used for built-in method references. */
23256var objectProto = Object.prototype;
23257
23258/** Used to check objects for own properties. */
23259var hasOwnProperty = objectProto.hasOwnProperty;
23260
23261/**
23262 * Assigns own enumerable string keyed properties of source objects to the
23263 * destination object. Source objects are applied from left to right.
23264 * Subsequent sources overwrite property assignments of previous sources.
23265 *
23266 * **Note:** This method mutates `object` and is loosely based on
23267 * [`Object.assign`](https://mdn.io/Object/assign).
23268 *
23269 * @static
23270 * @memberOf _
23271 * @since 0.10.0
23272 * @category Object
23273 * @param {Object} object The destination object.
23274 * @param {...Object} [sources] The source objects.
23275 * @returns {Object} Returns `object`.
23276 * @see _.assignIn
23277 * @example
23278 *
23279 * function Foo() {
23280 * this.a = 1;
23281 * }
23282 *
23283 * function Bar() {
23284 * this.c = 3;
23285 * }
23286 *
23287 * Foo.prototype.b = 2;
23288 * Bar.prototype.d = 4;
23289 *
23290 * _.assign({ 'a': 0 }, new Foo, new Bar);
23291 * // => { 'a': 1, 'c': 3 }
23292 */
23293var assign = createAssigner(function (object, source) {
23294 if (isPrototype(source) || isArrayLike(source)) {
23295 copyObject(source, keys(source), object);
23296 return;
23297 }
23298 for (var key in source) {
23299 if (hasOwnProperty.call(source, key)) {
23300 assignValue(object, key, source[key]);
23301 }
23302 }
23303});
23304
23305module.exports = assign;
23306
23307/***/ }),
23308/* 61 */
23309/***/ (function(module, exports, __webpack_require__) {
23310
23311var defineProperty = __webpack_require__(98);
23312
23313/**
23314 * The base implementation of `assignValue` and `assignMergeValue` without
23315 * value checks.
23316 *
23317 * @private
23318 * @param {Object} object The object to modify.
23319 * @param {string} key The key of the property to assign.
23320 * @param {*} value The value to assign.
23321 */
23322function baseAssignValue(object, key, value) {
23323 if (key == '__proto__' && defineProperty) {
23324 defineProperty(object, key, {
23325 'configurable': true,
23326 'enumerable': true,
23327 'value': value,
23328 'writable': true
23329 });
23330 } else {
23331 object[key] = value;
23332 }
23333}
23334
23335module.exports = baseAssignValue;
23336
23337/***/ }),
23338/* 62 */
23339/***/ (function(module, exports, __webpack_require__) {
23340
23341var Uint8Array = __webpack_require__(80);
23342
23343/**
23344 * Creates a clone of `arrayBuffer`.
23345 *
23346 * @private
23347 * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
23348 * @returns {ArrayBuffer} Returns the cloned array buffer.
23349 */
23350function cloneArrayBuffer(arrayBuffer) {
23351 var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
23352 new Uint8Array(result).set(new Uint8Array(arrayBuffer));
23353 return result;
23354}
23355
23356module.exports = cloneArrayBuffer;
23357
23358/***/ }),
23359/* 63 */
23360/***/ (function(module, exports, __webpack_require__) {
23361
23362function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
23363
23364function _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; }
23365
23366function _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; }
23367
23368/**
23369 * @fileOverview Chart、View、Geometry 的基类
23370 * @author dxq613@gmail.com
23371 */
23372
23373var EventEmitter = __webpack_require__(284);
23374var Util = __webpack_require__(0);
23375
23376var Base = function (_EventEmitter) {
23377 _inherits(Base, _EventEmitter);
23378
23379 Base.prototype.getDefaultCfg = function getDefaultCfg() {
23380 return {};
23381 };
23382
23383 function Base(cfg) {
23384 _classCallCheck(this, Base);
23385
23386 var _this = _possibleConstructorReturn(this, _EventEmitter.call(this));
23387
23388 var attrs = {
23389 visible: true
23390 };
23391 var defaultCfg = _this.getDefaultCfg();
23392 _this._attrs = attrs;
23393 Util.assign(attrs, defaultCfg, cfg);
23394 return _this;
23395 }
23396
23397 Base.prototype.get = function get(name) {
23398 return this._attrs[name];
23399 };
23400
23401 Base.prototype.set = function set(name, value) {
23402 this._attrs[name] = value;
23403 };
23404
23405 Base.prototype.show = function show() {
23406 var visible = this.get('visible');
23407 if (!visible) {
23408 this.set('visible', true);
23409 this.changeVisible(true);
23410 }
23411 };
23412
23413 Base.prototype.hide = function hide() {
23414 var visible = this.get('visible');
23415 if (visible) {
23416 this.set('visible', false);
23417 this.changeVisible(false);
23418 }
23419 };
23420
23421 /**
23422 * @protected
23423 * @param {Boolean} visible 是否可见
23424 * 显示、隐藏
23425 */
23426
23427
23428 Base.prototype.changeVisible = function changeVisible() /* visible */{};
23429
23430 Base.prototype.destroy = function destroy() {
23431 this._attrs = {};
23432 this.removeAllListeners();
23433 this.destroyed = true;
23434 };
23435
23436 return Base;
23437}(EventEmitter);
23438
23439module.exports = Base;
23440
23441/***/ }),
23442/* 64 */
23443/***/ (function(module, exports, __webpack_require__) {
23444
23445/**
23446 * @fileOverview 颜色计算的辅助方法
23447 * @author dxq613@gmail.com
23448 */
23449
23450var Util = __webpack_require__(0);
23451var RGB_REG = /rgb\((\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/;
23452
23453// 创建辅助 tag 取颜色
23454function createTmp() {
23455 var i = document.createElement('i');
23456 i.title = 'Web Colour Picker';
23457 i.style.display = 'none';
23458 document.body.appendChild(i);
23459 return i;
23460}
23461
23462// 获取颜色之间的插值
23463function getValue(start, end, percent, index) {
23464 var value = start[index] + (end[index] - start[index]) * percent;
23465 return value;
23466}
23467
23468// 数组转换成颜色
23469function arr2rgb(arr) {
23470 return '#' + toHex(arr[0]) + toHex(arr[1]) + toHex(arr[2]);
23471}
23472
23473// 将数值从 0-255 转换成16进制字符串
23474function toHex(value) {
23475 value = Math.round(value);
23476 value = value.toString(16);
23477 if (value.length === 1) {
23478 value = '0' + value;
23479 }
23480 return value;
23481}
23482
23483function calColor(colors, percent) {
23484 var steps = colors.length - 1;
23485 var step = Math.floor(steps * percent);
23486 var left = steps * percent - step;
23487 var start = colors[step];
23488 var end = step === steps ? start : colors[step + 1];
23489 var rgb = arr2rgb([getValue(start, end, left, 0), getValue(start, end, left, 1), getValue(start, end, left, 2)]);
23490 return rgb;
23491}
23492
23493// rgb 颜色转换成数组
23494function rgb2arr(str) {
23495 var arr = [];
23496 arr.push(parseInt(str.substr(1, 2), 16));
23497 arr.push(parseInt(str.substr(3, 2), 16));
23498 arr.push(parseInt(str.substr(5, 2), 16));
23499 return arr;
23500}
23501
23502var colorCache = {};
23503var iEl = null;
23504var ColorUtil = {
23505 /**
23506 * 将颜色转换到 rgb 的格式
23507 * @param {String} color 颜色
23508 * @return {String} 将颜色转换到 '#ffffff' 的格式
23509 */
23510 toRGB: function toRGB(color) {
23511 // 如果已经是 rgb的格式
23512 if (color[0] === '#' && color.length === 7) {
23513 return color;
23514 }
23515 if (!iEl) {
23516 // 防止防止在页头报错
23517 iEl = createTmp();
23518 }
23519 var rst = void 0;
23520 if (colorCache[color]) {
23521 rst = colorCache[color];
23522 } else {
23523 iEl.style.color = color;
23524 rst = document.defaultView.getComputedStyle(iEl, '').getPropertyValue('color');
23525 var cArray = RGB_REG.exec(rst);
23526 cArray.shift();
23527 rst = arr2rgb(cArray);
23528 colorCache[color] = rst;
23529 }
23530 return rst;
23531 },
23532
23533
23534 rgb2arr: rgb2arr,
23535
23536 /**
23537 * 获取渐变函数
23538 * @param {Array} colors 多个颜色
23539 * @return {String} 颜色值
23540 */
23541 gradient: function gradient(colors) {
23542 var points = [];
23543 if (Util.isString(colors)) {
23544 colors = colors.split('-');
23545 }
23546 Util.each(colors, function (color) {
23547 if (color.indexOf('#') === -1) {
23548 color = ColorUtil.toRGB(color);
23549 }
23550 points.push(rgb2arr(color));
23551 });
23552 return function (percent) {
23553 return calColor(points, percent);
23554 };
23555 }
23556};
23557
23558module.exports = ColorUtil;
23559
23560/***/ }),
23561/* 65 */
23562/***/ (function(module, exports, __webpack_require__) {
23563
23564/**
23565 * @fileOverview the entry of labels
23566 * @author sima.zhang
23567 */
23568var Labels = __webpack_require__(110);
23569Labels.LabelsRenderer = __webpack_require__(300);
23570
23571module.exports = Labels;
23572
23573/***/ }),
23574/* 66 */
23575/***/ (function(module, exports, __webpack_require__) {
23576
23577var Shape = __webpack_require__(10);
23578
23579__webpack_require__(303);
23580__webpack_require__(304);
23581__webpack_require__(305);
23582__webpack_require__(306);
23583__webpack_require__(307);
23584__webpack_require__(308);
23585__webpack_require__(309);
23586
23587module.exports = Shape;
23588
23589/***/ }),
23590/* 67 */
23591/***/ (function(module, exports, __webpack_require__) {
23592
23593/**
23594 * @fileOverview shape 的辅助方法
23595 * @author dxq613@gmail.com
23596 */
23597var Util = __webpack_require__(0);
23598
23599var ShapeUtil = {
23600 splitPoints: function splitPoints(obj) {
23601 var points = [];
23602 var x = obj.x;
23603 var y = obj.y;
23604 y = Util.isArray(y) ? y : [y];
23605 Util.each(y, function (yItem, index) {
23606 var point = {
23607 x: Util.isArray(x) ? x[index] : x,
23608 y: yItem
23609 };
23610 points.push(point);
23611 });
23612 return points;
23613 }
23614};
23615
23616module.exports = ShapeUtil;
23617
23618/***/ }),
23619/* 68 */
23620/***/ (function(module, exports, __webpack_require__) {
23621
23622/**
23623 * @fileOverview Default animation configuration for geoms
23624 * @author sima.zhang
23625 */
23626var Util = __webpack_require__(0);
23627var Action = __webpack_require__(281);
23628
23629var defaultAnimationCfg = {
23630 appear: {
23631 duration: 450,
23632 easing: 'easeQuadOut'
23633 }, // 初始入场动画配置
23634 update: {
23635 duration: 450,
23636 easing: 'easeQuadInOut'
23637 }, // 更新时发生变更的动画配置
23638 enter: {
23639 duration: 400,
23640 easing: 'easeQuadInOut',
23641 delay: 100
23642 }, // 更新时新增元素的入场动画配置
23643 leave: {
23644 duration: 350,
23645 easing: 'easeQuadIn' // 更新时销毁动画配置
23646 } };
23647
23648var Animate = {
23649 line: {
23650 appear: function appear() {
23651 return Action.appear.clipIn;
23652 },
23653 enter: function enter() {
23654 return Action.enter.clipIn;
23655 },
23656 leave: function leave() {
23657 return Action.leave.lineWidthOut;
23658 }
23659 },
23660 path: {
23661 appear: function appear() {
23662 return Action.appear.clipIn;
23663 },
23664 enter: function enter() {
23665 return Action.enter.clipIn;
23666 },
23667 leave: function leave() {
23668 return Action.leave.lineWidthOut;
23669 }
23670 },
23671 area: {
23672 appear: function appear() {
23673 return Action.appear.clipIn;
23674 },
23675 enter: function enter() {
23676 return Action.enter.fadeIn;
23677 },
23678 leave: function leave() {
23679 return Action.leave.fadeOut;
23680 },
23681
23682 cfg: {
23683 appear: {
23684 duration: 500,
23685 easing: 'easeQuadOut'
23686 },
23687 update: {
23688 duration: 450,
23689 easing: 'easeQuadInOut'
23690 },
23691 enter: {
23692 duration: 600,
23693 delay: 150,
23694 easing: 'easeQuadInOut'
23695 },
23696 leave: {
23697 easing: 'easeQuadOut',
23698 duration: 350
23699 }
23700 }
23701 },
23702 polygon: {
23703 appear: function appear() {
23704 return Action.appear.zoomIn;
23705 },
23706 enter: function enter() {
23707 return Action.enter.zoomIn;
23708 },
23709 leave: function leave() {
23710 return Action.leave.zoomOut;
23711 }
23712 },
23713 edge: {
23714 appear: function appear() {
23715 return Action.appear.pathIn;
23716 },
23717 enter: function enter() {
23718 return Action.enter.pathIn;
23719 },
23720 leave: function leave() {
23721 return Action.leave.pathOut;
23722 }
23723 },
23724 interval: {
23725 appear: function appear(coord) {
23726 var result = void 0;
23727 if (coord.isPolar) {
23728 result = Action.appear.zoomIn;
23729 if (coord.isTransposed || coord.type === 'theta') {
23730 result = Action.appear.fanIn;
23731 }
23732 } else if (coord.isRect) {
23733 result = coord.isTransposed ? Action.appear.scaleInX : Action.appear.scaleInY;
23734 } else {
23735 result = Action.appear.zoomIn;
23736 }
23737 return result;
23738 },
23739 enter: function enter(coord) {
23740 if (coord.isRect || coord.isTransposed || coord.type === 'theta') {
23741 return Action.enter.fadeIn;
23742 }
23743 return Action.enter.zoomIn;
23744 },
23745 leave: function leave() {
23746 return Action.leave.fadeOut;
23747 },
23748 update: function update(coord) {
23749 if (coord.type === 'theta') {
23750 return Action.update.fanIn;
23751 }
23752 }
23753 },
23754 point: {
23755 appear: function appear() {
23756 return Action.appear.zoomIn;
23757 },
23758 enter: function enter() {
23759 return Action.enter.zoomIn;
23760 },
23761 leave: function leave() {
23762 return Action.leave.zoomOut;
23763 }
23764 },
23765 schema: {
23766 appear: function appear() {
23767 return Action.appear.clipIn;
23768 },
23769 enter: function enter() {
23770 return Action.enter.clipIn;
23771 },
23772 leave: function leave() {
23773 return Action.leave.lineWidthOut;
23774 }
23775 },
23776 contour: null,
23777 heatmap: null,
23778 label: {
23779 appear: function appear() {
23780 return Action.appear.fadeIn;
23781 },
23782 enter: function enter() {
23783 return Action.enter.fadeIn;
23784 },
23785 leave: function leave() {
23786 return Action.leave.fadeOut;
23787 },
23788
23789 cfg: {
23790 appear: {
23791 duration: 900
23792 }
23793 }
23794 },
23795 'axis-label': {
23796 enter: function enter() {
23797 return Action.appear.fadeIn;
23798 },
23799 leave: function leave() {
23800 return Action.leave.fadeOut;
23801 },
23802 update: function update(coord) {
23803 if (coord.isPolar) {
23804 return Action.appear.fadeIn;
23805 }
23806 }
23807 },
23808 'axis-ticks': {
23809 enter: function enter() {
23810 return Action.appear.fadeIn;
23811 },
23812 leave: function leave() {
23813 return Action.leave.fadeOut;
23814 },
23815 update: function update(coord) {
23816 if (coord.isPolar) {
23817 return Action.appear.fadeIn;
23818 }
23819 }
23820 },
23821 'axis-grid': {
23822 enter: function enter() {
23823 return Action.appear.fadeIn;
23824 },
23825 leave: function leave() {
23826 return Action.leave.fadeOut;
23827 },
23828 update: function update(coord) {
23829 if (coord.isPolar) {
23830 return Action.appear.fadeIn;
23831 }
23832 }
23833 },
23834 'axis-grid-rect': {
23835 enter: function enter() {
23836 return Action.appear.fadeIn;
23837 },
23838 leave: function leave() {
23839 return Action.leave.fadeOut;
23840 },
23841 update: function update() {
23842 return Action.leave.fadeIn;
23843 }
23844 },
23845 labelLine: {
23846 appear: function appear() {
23847 return Action.appear.pathIn;
23848 },
23849 enter: function enter() {
23850 return Action.enter.pathIn;
23851 },
23852 leave: function leave() {
23853 return Action.leave.pathOut;
23854 }
23855 }
23856};
23857
23858Animate.Action = Action;
23859Animate.defaultCfg = defaultAnimationCfg;
23860
23861// 获取动画
23862Animate.getAnimation = function (geomType, coord, animationType) {
23863 var geomAnimateCfg = this[geomType];
23864 if (geomAnimateCfg) {
23865 var animation = geomAnimateCfg[animationType];
23866 if (Util.isFunction(animation)) {
23867 return animation(coord);
23868 }
23869 }
23870 return false;
23871};
23872
23873// 获取动画配置
23874Animate.getAnimateCfg = function (geomType, animationType) {
23875 var defaultCfg = defaultAnimationCfg[animationType];
23876 if (this[geomType] && this[geomType].cfg && this[geomType].cfg[animationType]) {
23877 return Util.deepMix({}, defaultCfg, this[geomType].cfg[animationType]);
23878 }
23879 return defaultCfg;
23880};
23881
23882// 注册动画
23883Animate.registerAnimation = function (animationType, animationName, animationFun) {
23884 if (!this.Action[animationType]) {
23885 this.Action[animationType] = {};
23886 }
23887 this.Action[animationType][animationName] = animationFun;
23888};
23889
23890module.exports = Animate;
23891
23892/***/ }),
23893/* 69 */
23894/***/ (function(module, exports) {
23895
23896/**
23897 * A specialized version of `_.forEach` for arrays without support for
23898 * iteratee shorthands.
23899 *
23900 * @private
23901 * @param {Array} [array] The array to iterate over.
23902 * @param {Function} iteratee The function invoked per iteration.
23903 * @returns {Array} Returns `array`.
23904 */
23905function arrayEach(array, iteratee) {
23906 var index = -1,
23907 length = array == null ? 0 : array.length;
23908
23909 while (++index < length) {
23910 if (iteratee(array[index], index, array) === false) {
23911 break;
23912 }
23913 }
23914 return array;
23915}
23916
23917module.exports = arrayEach;
23918
23919/***/ }),
23920/* 70 */
23921/***/ (function(module, exports, __webpack_require__) {
23922
23923var baseTimes = __webpack_require__(132),
23924 isArguments = __webpack_require__(28),
23925 isArray = __webpack_require__(3),
23926 isBuffer = __webpack_require__(29),
23927 isIndex = __webpack_require__(30),
23928 isTypedArray = __webpack_require__(46);
23929
23930/** Used for built-in method references. */
23931var objectProto = Object.prototype;
23932
23933/** Used to check objects for own properties. */
23934var hasOwnProperty = objectProto.hasOwnProperty;
23935
23936/**
23937 * Creates an array of the enumerable property names of the array-like `value`.
23938 *
23939 * @private
23940 * @param {*} value The value to query.
23941 * @param {boolean} inherited Specify returning inherited property names.
23942 * @returns {Array} Returns the array of property names.
23943 */
23944function arrayLikeKeys(value, inherited) {
23945 var isArr = isArray(value),
23946 isArg = !isArr && isArguments(value),
23947 isBuff = !isArr && !isArg && isBuffer(value),
23948 isType = !isArr && !isArg && !isBuff && isTypedArray(value),
23949 skipIndexes = isArr || isArg || isBuff || isType,
23950 result = skipIndexes ? baseTimes(value.length, String) : [],
23951 length = result.length;
23952
23953 for (var key in value) {
23954 if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && (
23955 // Safari 9 has enumerable `arguments.length` in strict mode.
23956 key == 'length' ||
23957 // Node.js 0.10 has enumerable non-index properties on buffers.
23958 isBuff && (key == 'offset' || key == 'parent') ||
23959 // PhantomJS 2 has enumerable non-index properties on typed arrays.
23960 isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset') ||
23961 // Skip index properties.
23962 isIndex(key, length)))) {
23963 result.push(key);
23964 }
23965 }
23966 return result;
23967}
23968
23969module.exports = arrayLikeKeys;
23970
23971/***/ }),
23972/* 71 */
23973/***/ (function(module, exports, __webpack_require__) {
23974
23975/* WEBPACK VAR INJECTION */(function(global) {var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
23976
23977/** Detect free variable `global` from Node.js. */
23978var freeGlobal = (typeof global === 'undefined' ? 'undefined' : _typeof(global)) == 'object' && global && global.Object === Object && global;
23979
23980module.exports = freeGlobal;
23981/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(134)))
23982
23983/***/ }),
23984/* 72 */
23985/***/ (function(module, exports) {
23986
23987/**
23988 * The base implementation of `_.unary` without support for storing metadata.
23989 *
23990 * @private
23991 * @param {Function} func The function to cap arguments for.
23992 * @returns {Function} Returns the new capped function.
23993 */
23994function baseUnary(func) {
23995 return function (value) {
23996 return func(value);
23997 };
23998}
23999
24000module.exports = baseUnary;
24001
24002/***/ }),
24003/* 73 */
24004/***/ (function(module, exports, __webpack_require__) {
24005
24006/* WEBPACK VAR INJECTION */(function(module) {var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
24007
24008var freeGlobal = __webpack_require__(71);
24009
24010/** Detect free variable `exports`. */
24011var freeExports = ( false ? 'undefined' : _typeof(exports)) == 'object' && exports && !exports.nodeType && exports;
24012
24013/** Detect free variable `module`. */
24014var freeModule = freeExports && ( false ? 'undefined' : _typeof(module)) == 'object' && module && !module.nodeType && module;
24015
24016/** Detect the popular CommonJS extension `module.exports`. */
24017var moduleExports = freeModule && freeModule.exports === freeExports;
24018
24019/** Detect free variable `process` from Node.js. */
24020var freeProcess = moduleExports && freeGlobal.process;
24021
24022/** Used to access faster Node.js helpers. */
24023var nodeUtil = function () {
24024 try {
24025 return freeProcess && freeProcess.binding && freeProcess.binding('util');
24026 } catch (e) {}
24027}();
24028
24029module.exports = nodeUtil;
24030/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(26)(module)))
24031
24032/***/ }),
24033/* 74 */
24034/***/ (function(module, exports, __webpack_require__) {
24035
24036var isPrototype = __webpack_require__(18),
24037 nativeKeys = __webpack_require__(139);
24038
24039/** Used for built-in method references. */
24040var objectProto = Object.prototype;
24041
24042/** Used to check objects for own properties. */
24043var hasOwnProperty = objectProto.hasOwnProperty;
24044
24045/**
24046 * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
24047 *
24048 * @private
24049 * @param {Object} object The object to query.
24050 * @returns {Array} Returns the array of property names.
24051 */
24052function baseKeys(object) {
24053 if (!isPrototype(object)) {
24054 return nativeKeys(object);
24055 }
24056 var result = [];
24057 for (var key in Object(object)) {
24058 if (hasOwnProperty.call(object, key) && key != 'constructor') {
24059 result.push(key);
24060 }
24061 }
24062 return result;
24063}
24064
24065module.exports = baseKeys;
24066
24067/***/ }),
24068/* 75 */
24069/***/ (function(module, exports) {
24070
24071/**
24072 * Creates a unary function that invokes `func` with its argument transformed.
24073 *
24074 * @private
24075 * @param {Function} func The function to wrap.
24076 * @param {Function} transform The argument transform.
24077 * @returns {Function} Returns the new function.
24078 */
24079function overArg(func, transform) {
24080 return function (arg) {
24081 return func(transform(arg));
24082 };
24083}
24084
24085module.exports = overArg;
24086
24087/***/ }),
24088/* 76 */
24089/***/ (function(module, exports) {
24090
24091/** Used for built-in method references. */
24092var funcProto = Function.prototype;
24093
24094/** Used to resolve the decompiled source of functions. */
24095var funcToString = funcProto.toString;
24096
24097/**
24098 * Converts `func` to its source code.
24099 *
24100 * @private
24101 * @param {Function} func The function to convert.
24102 * @returns {string} Returns the source code.
24103 */
24104function toSource(func) {
24105 if (func != null) {
24106 try {
24107 return funcToString.call(func);
24108 } catch (e) {}
24109 try {
24110 return func + '';
24111 } catch (e) {}
24112 }
24113 return '';
24114}
24115
24116module.exports = toSource;
24117
24118/***/ }),
24119/* 77 */
24120/***/ (function(module, exports, __webpack_require__) {
24121
24122var SetCache = __webpack_require__(78),
24123 arraySome = __webpack_require__(174),
24124 cacheHas = __webpack_require__(79);
24125
24126/** Used to compose bitmasks for value comparisons. */
24127var COMPARE_PARTIAL_FLAG = 1,
24128 COMPARE_UNORDERED_FLAG = 2;
24129
24130/**
24131 * A specialized version of `baseIsEqualDeep` for arrays with support for
24132 * partial deep comparisons.
24133 *
24134 * @private
24135 * @param {Array} array The array to compare.
24136 * @param {Array} other The other array to compare.
24137 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
24138 * @param {Function} customizer The function to customize comparisons.
24139 * @param {Function} equalFunc The function to determine equivalents of values.
24140 * @param {Object} stack Tracks traversed `array` and `other` objects.
24141 * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
24142 */
24143function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
24144 var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
24145 arrLength = array.length,
24146 othLength = other.length;
24147
24148 if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
24149 return false;
24150 }
24151 // Assume cyclic values are equal.
24152 var stacked = stack.get(array);
24153 if (stacked && stack.get(other)) {
24154 return stacked == other;
24155 }
24156 var index = -1,
24157 result = true,
24158 seen = bitmask & COMPARE_UNORDERED_FLAG ? new SetCache() : undefined;
24159
24160 stack.set(array, other);
24161 stack.set(other, array);
24162
24163 // Ignore non-index properties.
24164 while (++index < arrLength) {
24165 var arrValue = array[index],
24166 othValue = other[index];
24167
24168 if (customizer) {
24169 var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack);
24170 }
24171 if (compared !== undefined) {
24172 if (compared) {
24173 continue;
24174 }
24175 result = false;
24176 break;
24177 }
24178 // Recursively compare arrays (susceptible to call stack limits).
24179 if (seen) {
24180 if (!arraySome(other, function (othValue, othIndex) {
24181 if (!cacheHas(seen, othIndex) && (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
24182 return seen.push(othIndex);
24183 }
24184 })) {
24185 result = false;
24186 break;
24187 }
24188 } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
24189 result = false;
24190 break;
24191 }
24192 }
24193 stack['delete'](array);
24194 stack['delete'](other);
24195 return result;
24196}
24197
24198module.exports = equalArrays;
24199
24200/***/ }),
24201/* 78 */
24202/***/ (function(module, exports, __webpack_require__) {
24203
24204var MapCache = __webpack_require__(52),
24205 setCacheAdd = __webpack_require__(172),
24206 setCacheHas = __webpack_require__(173);
24207
24208/**
24209 *
24210 * Creates an array cache object to store unique values.
24211 *
24212 * @private
24213 * @constructor
24214 * @param {Array} [values] The values to cache.
24215 */
24216function SetCache(values) {
24217 var index = -1,
24218 length = values == null ? 0 : values.length;
24219
24220 this.__data__ = new MapCache();
24221 while (++index < length) {
24222 this.add(values[index]);
24223 }
24224}
24225
24226// Add methods to `SetCache`.
24227SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
24228SetCache.prototype.has = setCacheHas;
24229
24230module.exports = SetCache;
24231
24232/***/ }),
24233/* 79 */
24234/***/ (function(module, exports) {
24235
24236/**
24237 * Checks if a `cache` value for `key` exists.
24238 *
24239 * @private
24240 * @param {Object} cache The cache to query.
24241 * @param {string} key The key of the entry to check.
24242 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
24243 */
24244function cacheHas(cache, key) {
24245 return cache.has(key);
24246}
24247
24248module.exports = cacheHas;
24249
24250/***/ }),
24251/* 80 */
24252/***/ (function(module, exports, __webpack_require__) {
24253
24254var root = __webpack_require__(4);
24255
24256/** Built-in value references. */
24257var Uint8Array = root.Uint8Array;
24258
24259module.exports = Uint8Array;
24260
24261/***/ }),
24262/* 81 */
24263/***/ (function(module, exports, __webpack_require__) {
24264
24265var baseGetAllKeys = __webpack_require__(82),
24266 getSymbols = __webpack_require__(55),
24267 keys = __webpack_require__(11);
24268
24269/**
24270 * Creates an array of own enumerable property names and symbols of `object`.
24271 *
24272 * @private
24273 * @param {Object} object The object to query.
24274 * @returns {Array} Returns the array of property names and symbols.
24275 */
24276function getAllKeys(object) {
24277 return baseGetAllKeys(object, keys, getSymbols);
24278}
24279
24280module.exports = getAllKeys;
24281
24282/***/ }),
24283/* 82 */
24284/***/ (function(module, exports, __webpack_require__) {
24285
24286var arrayPush = __webpack_require__(54),
24287 isArray = __webpack_require__(3);
24288
24289/**
24290 * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
24291 * `keysFunc` and `symbolsFunc` to get the enumerable property names and
24292 * symbols of `object`.
24293 *
24294 * @private
24295 * @param {Object} object The object to query.
24296 * @param {Function} keysFunc The function to get the keys of `object`.
24297 * @param {Function} symbolsFunc The function to get the symbols of `object`.
24298 * @returns {Array} Returns the array of property names and symbols.
24299 */
24300function baseGetAllKeys(object, keysFunc, symbolsFunc) {
24301 var result = keysFunc(object);
24302 return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
24303}
24304
24305module.exports = baseGetAllKeys;
24306
24307/***/ }),
24308/* 83 */
24309/***/ (function(module, exports) {
24310
24311/**
24312 * A specialized version of `_.filter` for arrays without support for
24313 * iteratee shorthands.
24314 *
24315 * @private
24316 * @param {Array} [array] The array to iterate over.
24317 * @param {Function} predicate The function invoked per iteration.
24318 * @returns {Array} Returns the new filtered array.
24319 */
24320function arrayFilter(array, predicate) {
24321 var index = -1,
24322 length = array == null ? 0 : array.length,
24323 resIndex = 0,
24324 result = [];
24325
24326 while (++index < length) {
24327 var value = array[index];
24328 if (predicate(value, index, array)) {
24329 result[resIndex++] = value;
24330 }
24331 }
24332 return result;
24333}
24334
24335module.exports = arrayFilter;
24336
24337/***/ }),
24338/* 84 */
24339/***/ (function(module, exports) {
24340
24341/**
24342 * This method returns a new empty array.
24343 *
24344 * @static
24345 * @memberOf _
24346 * @since 4.13.0
24347 * @category Util
24348 * @returns {Array} Returns the new empty array.
24349 * @example
24350 *
24351 * var arrays = _.times(2, _.stubArray);
24352 *
24353 * console.log(arrays);
24354 * // => [[], []]
24355 *
24356 * console.log(arrays[0] === arrays[1]);
24357 * // => false
24358 */
24359function stubArray() {
24360 return [];
24361}
24362
24363module.exports = stubArray;
24364
24365/***/ }),
24366/* 85 */
24367/***/ (function(module, exports, __webpack_require__) {
24368
24369var getNative = __webpack_require__(13),
24370 root = __webpack_require__(4);
24371
24372/* Built-in method references that are verified to be native. */
24373var Set = getNative(root, 'Set');
24374
24375module.exports = Set;
24376
24377/***/ }),
24378/* 86 */
24379/***/ (function(module, exports, __webpack_require__) {
24380
24381var isObject = __webpack_require__(7);
24382
24383/**
24384 * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
24385 *
24386 * @private
24387 * @param {*} value The value to check.
24388 * @returns {boolean} Returns `true` if `value` if suitable for strict
24389 * equality comparisons, else `false`.
24390 */
24391function isStrictComparable(value) {
24392 return value === value && !isObject(value);
24393}
24394
24395module.exports = isStrictComparable;
24396
24397/***/ }),
24398/* 87 */
24399/***/ (function(module, exports) {
24400
24401/**
24402 * A specialized version of `matchesProperty` for source values suitable
24403 * for strict equality comparisons, i.e. `===`.
24404 *
24405 * @private
24406 * @param {string} key The key of the property to get.
24407 * @param {*} srcValue The value to match.
24408 * @returns {Function} Returns the new spec function.
24409 */
24410function matchesStrictComparable(key, srcValue) {
24411 return function (object) {
24412 if (object == null) {
24413 return false;
24414 }
24415 return object[key] === srcValue && (srcValue !== undefined || key in Object(object));
24416 };
24417}
24418
24419module.exports = matchesStrictComparable;
24420
24421/***/ }),
24422/* 88 */
24423/***/ (function(module, exports, __webpack_require__) {
24424
24425var baseHasIn = __webpack_require__(187),
24426 hasPath = __webpack_require__(188);
24427
24428/**
24429 * Checks if `path` is a direct or inherited property of `object`.
24430 *
24431 * @static
24432 * @memberOf _
24433 * @since 4.0.0
24434 * @category Object
24435 * @param {Object} object The object to query.
24436 * @param {Array|string} path The path to check.
24437 * @returns {boolean} Returns `true` if `path` exists, else `false`.
24438 * @example
24439 *
24440 * var object = _.create({ 'a': _.create({ 'b': 2 }) });
24441 *
24442 * _.hasIn(object, 'a');
24443 * // => true
24444 *
24445 * _.hasIn(object, 'a.b');
24446 * // => true
24447 *
24448 * _.hasIn(object, ['a', 'b']);
24449 * // => true
24450 *
24451 * _.hasIn(object, 'b');
24452 * // => false
24453 */
24454function hasIn(object, path) {
24455 return object != null && hasPath(object, path, baseHasIn);
24456}
24457
24458module.exports = hasIn;
24459
24460/***/ }),
24461/* 89 */
24462/***/ (function(module, exports, __webpack_require__) {
24463
24464var baseGetTag = __webpack_require__(6),
24465 isArray = __webpack_require__(3),
24466 isObjectLike = __webpack_require__(5);
24467
24468/** `Object#toString` result references. */
24469var stringTag = '[object String]';
24470
24471/**
24472 * Checks if `value` is classified as a `String` primitive or object.
24473 *
24474 * @static
24475 * @since 0.1.0
24476 * @memberOf _
24477 * @category Lang
24478 * @param {*} value The value to check.
24479 * @returns {boolean} Returns `true` if `value` is a string, else `false`.
24480 * @example
24481 *
24482 * _.isString('abc');
24483 * // => true
24484 *
24485 * _.isString(1);
24486 * // => false
24487 */
24488function isString(value) {
24489 return typeof value == 'string' || !isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag;
24490}
24491
24492module.exports = isString;
24493
24494/***/ }),
24495/* 90 */
24496/***/ (function(module, exports, __webpack_require__) {
24497
24498var castSlice = __webpack_require__(198),
24499 hasUnicode = __webpack_require__(91),
24500 stringToArray = __webpack_require__(92),
24501 toString = __webpack_require__(15);
24502
24503/**
24504 * Creates a function like `_.lowerFirst`.
24505 *
24506 * @private
24507 * @param {string} methodName The name of the `String` case method to use.
24508 * @returns {Function} Returns the new case function.
24509 */
24510function createCaseFirst(methodName) {
24511 return function (string) {
24512 string = toString(string);
24513
24514 var strSymbols = hasUnicode(string) ? stringToArray(string) : undefined;
24515
24516 var chr = strSymbols ? strSymbols[0] : string.charAt(0);
24517
24518 var trailing = strSymbols ? castSlice(strSymbols, 1).join('') : string.slice(1);
24519
24520 return chr[methodName]() + trailing;
24521 };
24522}
24523
24524module.exports = createCaseFirst;
24525
24526/***/ }),
24527/* 91 */
24528/***/ (function(module, exports) {
24529
24530/** Used to compose unicode character classes. */
24531var rsAstralRange = '\\ud800-\\udfff',
24532 rsComboMarksRange = '\\u0300-\\u036f',
24533 reComboHalfMarksRange = '\\ufe20-\\ufe2f',
24534 rsComboSymbolsRange = '\\u20d0-\\u20ff',
24535 rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
24536 rsVarRange = '\\ufe0e\\ufe0f';
24537
24538/** Used to compose unicode capture groups. */
24539var rsZWJ = '\\u200d';
24540
24541/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
24542var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
24543
24544/**
24545 * Checks if `string` contains Unicode symbols.
24546 *
24547 * @private
24548 * @param {string} string The string to inspect.
24549 * @returns {boolean} Returns `true` if a symbol is found, else `false`.
24550 */
24551function hasUnicode(string) {
24552 return reHasUnicode.test(string);
24553}
24554
24555module.exports = hasUnicode;
24556
24557/***/ }),
24558/* 92 */
24559/***/ (function(module, exports, __webpack_require__) {
24560
24561var asciiToArray = __webpack_require__(200),
24562 hasUnicode = __webpack_require__(91),
24563 unicodeToArray = __webpack_require__(201);
24564
24565/**
24566 * Converts `string` to an array.
24567 *
24568 * @private
24569 * @param {string} string The string to convert.
24570 * @returns {Array} Returns the converted array.
24571 */
24572function stringToArray(string) {
24573 return hasUnicode(string) ? unicodeToArray(string) : asciiToArray(string);
24574}
24575
24576module.exports = stringToArray;
24577
24578/***/ }),
24579/* 93 */
24580/***/ (function(module, exports) {
24581
24582/**
24583 * Checks if `value` is `null` or `undefined`.
24584 *
24585 * @static
24586 * @memberOf _
24587 * @since 4.0.0
24588 * @category Lang
24589 * @param {*} value The value to check.
24590 * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
24591 * @example
24592 *
24593 * _.isNil(null);
24594 * // => true
24595 *
24596 * _.isNil(void 0);
24597 * // => true
24598 *
24599 * _.isNil(NaN);
24600 * // => false
24601 */
24602function isNil(value) {
24603 return value == null;
24604}
24605
24606module.exports = isNil;
24607
24608/***/ }),
24609/* 94 */
24610/***/ (function(module, exports) {
24611
24612/**
24613 * Copies the values of `source` to `array`.
24614 *
24615 * @private
24616 * @param {Array} source The array to copy values from.
24617 * @param {Array} [array=[]] The array to copy values to.
24618 * @returns {Array} Returns `array`.
24619 */
24620function copyArray(source, array) {
24621 var index = -1,
24622 length = source.length;
24623
24624 array || (array = Array(length));
24625 while (++index < length) {
24626 array[index] = source[index];
24627 }
24628 return array;
24629}
24630
24631module.exports = copyArray;
24632
24633/***/ }),
24634/* 95 */
24635/***/ (function(module, exports, __webpack_require__) {
24636
24637var baseFindIndex = __webpack_require__(221),
24638 baseIsNaN = __webpack_require__(222),
24639 strictIndexOf = __webpack_require__(223);
24640
24641/**
24642 * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
24643 *
24644 * @private
24645 * @param {Array} array The array to inspect.
24646 * @param {*} value The value to search for.
24647 * @param {number} fromIndex The index to search from.
24648 * @returns {number} Returns the index of the matched value, else `-1`.
24649 */
24650function baseIndexOf(array, value, fromIndex) {
24651 return value === value ? strictIndexOf(array, value, fromIndex) : baseFindIndex(array, baseIsNaN, fromIndex);
24652}
24653
24654module.exports = baseIndexOf;
24655
24656/***/ }),
24657/* 96 */
24658/***/ (function(module, exports, __webpack_require__) {
24659
24660var toFinite = __webpack_require__(224);
24661
24662/**
24663 * Converts `value` to an integer.
24664 *
24665 * **Note:** This method is loosely based on
24666 * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
24667 *
24668 * @static
24669 * @memberOf _
24670 * @since 4.0.0
24671 * @category Lang
24672 * @param {*} value The value to convert.
24673 * @returns {number} Returns the converted integer.
24674 * @example
24675 *
24676 * _.toInteger(3.2);
24677 * // => 3
24678 *
24679 * _.toInteger(Number.MIN_VALUE);
24680 * // => 0
24681 *
24682 * _.toInteger(Infinity);
24683 * // => 1.7976931348623157e+308
24684 *
24685 * _.toInteger('3.2');
24686 * // => 3
24687 */
24688function toInteger(value) {
24689 var result = toFinite(value),
24690 remainder = result % 1;
24691
24692 return result === result ? remainder ? result - remainder : result : 0;
24693}
24694
24695module.exports = toInteger;
24696
24697/***/ }),
24698/* 97 */
24699/***/ (function(module, exports, __webpack_require__) {
24700
24701var isObject = __webpack_require__(7),
24702 isSymbol = __webpack_require__(21);
24703
24704/** Used as references for various `Number` constants. */
24705var NAN = 0 / 0;
24706
24707/** Used to match leading and trailing whitespace. */
24708var reTrim = /^\s+|\s+$/g;
24709
24710/** Used to detect bad signed hexadecimal string values. */
24711var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
24712
24713/** Used to detect binary string values. */
24714var reIsBinary = /^0b[01]+$/i;
24715
24716/** Used to detect octal string values. */
24717var reIsOctal = /^0o[0-7]+$/i;
24718
24719/** Built-in method references without a dependency on `root`. */
24720var freeParseInt = parseInt;
24721
24722/**
24723 * Converts `value` to a number.
24724 *
24725 * @static
24726 * @memberOf _
24727 * @since 4.0.0
24728 * @category Lang
24729 * @param {*} value The value to process.
24730 * @returns {number} Returns the number.
24731 * @example
24732 *
24733 * _.toNumber(3.2);
24734 * // => 3.2
24735 *
24736 * _.toNumber(Number.MIN_VALUE);
24737 * // => 5e-324
24738 *
24739 * _.toNumber(Infinity);
24740 * // => Infinity
24741 *
24742 * _.toNumber('3.2');
24743 * // => 3.2
24744 */
24745function toNumber(value) {
24746 if (typeof value == 'number') {
24747 return value;
24748 }
24749 if (isSymbol(value)) {
24750 return NAN;
24751 }
24752 if (isObject(value)) {
24753 var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
24754 value = isObject(other) ? other + '' : other;
24755 }
24756 if (typeof value != 'string') {
24757 return value === 0 ? value : +value;
24758 }
24759 value = value.replace(reTrim, '');
24760 var isBinary = reIsBinary.test(value);
24761 return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
24762}
24763
24764module.exports = toNumber;
24765
24766/***/ }),
24767/* 98 */
24768/***/ (function(module, exports, __webpack_require__) {
24769
24770var getNative = __webpack_require__(13);
24771
24772var defineProperty = function () {
24773 try {
24774 var func = getNative(Object, 'defineProperty');
24775 func({}, '', {});
24776 return func;
24777 } catch (e) {}
24778}();
24779
24780module.exports = defineProperty;
24781
24782/***/ }),
24783/* 99 */
24784/***/ (function(module, exports, __webpack_require__) {
24785
24786var identity = __webpack_require__(31),
24787 overRest = __webpack_require__(100),
24788 setToString = __webpack_require__(101);
24789
24790/**
24791 * The base implementation of `_.rest` which doesn't validate or coerce arguments.
24792 *
24793 * @private
24794 * @param {Function} func The function to apply a rest parameter to.
24795 * @param {number} [start=func.length-1] The start position of the rest parameter.
24796 * @returns {Function} Returns the new function.
24797 */
24798function baseRest(func, start) {
24799 return setToString(overRest(func, start, identity), func + '');
24800}
24801
24802module.exports = baseRest;
24803
24804/***/ }),
24805/* 100 */
24806/***/ (function(module, exports, __webpack_require__) {
24807
24808var apply = __webpack_require__(226);
24809
24810/* Built-in method references for those with the same name as other `lodash` methods. */
24811var nativeMax = Math.max;
24812
24813/**
24814 * A specialized version of `baseRest` which transforms the rest array.
24815 *
24816 * @private
24817 * @param {Function} func The function to apply a rest parameter to.
24818 * @param {number} [start=func.length-1] The start position of the rest parameter.
24819 * @param {Function} transform The rest array transform.
24820 * @returns {Function} Returns the new function.
24821 */
24822function overRest(func, start, transform) {
24823 start = nativeMax(start === undefined ? func.length - 1 : start, 0);
24824 return function () {
24825 var args = arguments,
24826 index = -1,
24827 length = nativeMax(args.length - start, 0),
24828 array = Array(length);
24829
24830 while (++index < length) {
24831 array[index] = args[start + index];
24832 }
24833 index = -1;
24834 var otherArgs = Array(start + 1);
24835 while (++index < start) {
24836 otherArgs[index] = args[index];
24837 }
24838 otherArgs[start] = transform(array);
24839 return apply(func, this, otherArgs);
24840 };
24841}
24842
24843module.exports = overRest;
24844
24845/***/ }),
24846/* 101 */
24847/***/ (function(module, exports, __webpack_require__) {
24848
24849var baseSetToString = __webpack_require__(227),
24850 shortOut = __webpack_require__(229);
24851
24852/**
24853 * Sets the `toString` method of `func` to return `string`.
24854 *
24855 * @private
24856 * @param {Function} func The function to modify.
24857 * @param {Function} string The `toString` result.
24858 * @returns {Function} Returns `func`.
24859 */
24860var setToString = shortOut(baseSetToString);
24861
24862module.exports = setToString;
24863
24864/***/ }),
24865/* 102 */
24866/***/ (function(module, exports, __webpack_require__) {
24867
24868var baseClone = __webpack_require__(235);
24869
24870/** Used to compose bitmasks for cloning. */
24871var CLONE_DEEP_FLAG = 1,
24872 CLONE_SYMBOLS_FLAG = 4;
24873
24874/**
24875 * This method is like `_.clone` except that it recursively clones `value`.
24876 *
24877 * @static
24878 * @memberOf _
24879 * @since 1.0.0
24880 * @category Lang
24881 * @param {*} value The value to recursively clone.
24882 * @returns {*} Returns the deep cloned value.
24883 * @see _.clone
24884 * @example
24885 *
24886 * var objects = [{ 'a': 1 }, { 'b': 2 }];
24887 *
24888 * var deep = _.cloneDeep(objects);
24889 * console.log(deep[0] === objects[0]);
24890 * // => false
24891 */
24892function cloneDeep(value) {
24893 return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
24894}
24895
24896module.exports = cloneDeep;
24897
24898/***/ }),
24899/* 103 */
24900/***/ (function(module, exports, __webpack_require__) {
24901
24902var arrayLikeKeys = __webpack_require__(70),
24903 baseKeysIn = __webpack_require__(238),
24904 isArrayLike = __webpack_require__(8);
24905
24906/**
24907 * Creates an array of the own and inherited enumerable property names of `object`.
24908 *
24909 * **Note:** Non-object values are coerced to objects.
24910 *
24911 * @static
24912 * @memberOf _
24913 * @since 3.0.0
24914 * @category Object
24915 * @param {Object} object The object to query.
24916 * @returns {Array} Returns the array of property names.
24917 * @example
24918 *
24919 * function Foo() {
24920 * this.a = 1;
24921 * this.b = 2;
24922 * }
24923 *
24924 * Foo.prototype.c = 3;
24925 *
24926 * _.keysIn(new Foo);
24927 * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
24928 */
24929function keysIn(object) {
24930 return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
24931}
24932
24933module.exports = keysIn;
24934
24935/***/ }),
24936/* 104 */
24937/***/ (function(module, exports, __webpack_require__) {
24938
24939var arrayPush = __webpack_require__(54),
24940 getPrototype = __webpack_require__(59),
24941 getSymbols = __webpack_require__(55),
24942 stubArray = __webpack_require__(84);
24943
24944/* Built-in method references for those with the same name as other `lodash` methods. */
24945var nativeGetSymbols = Object.getOwnPropertySymbols;
24946
24947/**
24948 * Creates an array of the own and inherited enumerable symbols of `object`.
24949 *
24950 * @private
24951 * @param {Object} object The object to query.
24952 * @returns {Array} Returns the array of symbols.
24953 */
24954var getSymbolsIn = !nativeGetSymbols ? stubArray : function (object) {
24955 var result = [];
24956 while (object) {
24957 arrayPush(result, getSymbols(object));
24958 object = getPrototype(object);
24959 }
24960 return result;
24961};
24962
24963module.exports = getSymbolsIn;
24964
24965/***/ }),
24966/* 105 */
24967/***/ (function(module, exports, __webpack_require__) {
24968
24969var isSymbol = __webpack_require__(21);
24970
24971/**
24972 * The base implementation of methods like `_.max` and `_.min` which accepts a
24973 * `comparator` to determine the extremum value.
24974 *
24975 * @private
24976 * @param {Array} array The array to iterate over.
24977 * @param {Function} iteratee The iteratee invoked per iteration.
24978 * @param {Function} comparator The comparator used to compare values.
24979 * @returns {*} Returns the extremum value.
24980 */
24981function baseExtremum(array, iteratee, comparator) {
24982 var index = -1,
24983 length = array.length;
24984
24985 while (++index < length) {
24986 var value = array[index],
24987 current = iteratee(value);
24988
24989 if (current != null && (computed === undefined ? current === current && !isSymbol(current) : comparator(current, computed))) {
24990 var computed = current,
24991 result = value;
24992 }
24993 }
24994 return result;
24995}
24996
24997module.exports = baseExtremum;
24998
24999/***/ }),
25000/* 106 */
25001/***/ (function(module, exports, __webpack_require__) {
25002
25003var arrayPush = __webpack_require__(54),
25004 isFlattenable = __webpack_require__(268);
25005
25006/**
25007 * The base implementation of `_.flatten` with support for restricting flattening.
25008 *
25009 * @private
25010 * @param {Array} array The array to flatten.
25011 * @param {number} depth The maximum recursion depth.
25012 * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
25013 * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
25014 * @param {Array} [result=[]] The initial result value.
25015 * @returns {Array} Returns the new flattened array.
25016 */
25017function baseFlatten(array, depth, predicate, isStrict, result) {
25018 var index = -1,
25019 length = array.length;
25020
25021 predicate || (predicate = isFlattenable);
25022 result || (result = []);
25023
25024 while (++index < length) {
25025 var value = array[index];
25026 if (depth > 0 && predicate(value)) {
25027 if (depth > 1) {
25028 // Recursively flatten arrays (susceptible to call stack limits).
25029 baseFlatten(value, depth - 1, predicate, isStrict, result);
25030 } else {
25031 arrayPush(result, value);
25032 }
25033 } else if (!isStrict) {
25034 result[result.length] = value;
25035 }
25036 }
25037 return result;
25038}
25039
25040module.exports = baseFlatten;
25041
25042/***/ }),
25043/* 107 */
25044/***/ (function(module, exports, __webpack_require__) {
25045
25046var SetCache = __webpack_require__(78),
25047 arrayIncludes = __webpack_require__(269),
25048 arrayIncludesWith = __webpack_require__(270),
25049 cacheHas = __webpack_require__(79),
25050 createSet = __webpack_require__(271),
25051 setToArray = __webpack_require__(20);
25052
25053/** Used as the size to enable large array optimizations. */
25054var LARGE_ARRAY_SIZE = 200;
25055
25056/**
25057 * The base implementation of `_.uniqBy` without support for iteratee shorthands.
25058 *
25059 * @private
25060 * @param {Array} array The array to inspect.
25061 * @param {Function} [iteratee] The iteratee invoked per element.
25062 * @param {Function} [comparator] The comparator invoked per element.
25063 * @returns {Array} Returns the new duplicate free array.
25064 */
25065function baseUniq(array, iteratee, comparator) {
25066 var index = -1,
25067 includes = arrayIncludes,
25068 length = array.length,
25069 isCommon = true,
25070 result = [],
25071 seen = result;
25072
25073 if (comparator) {
25074 isCommon = false;
25075 includes = arrayIncludesWith;
25076 } else if (length >= LARGE_ARRAY_SIZE) {
25077 var set = iteratee ? null : createSet(array);
25078 if (set) {
25079 return setToArray(set);
25080 }
25081 isCommon = false;
25082 includes = cacheHas;
25083 seen = new SetCache();
25084 } else {
25085 seen = iteratee ? [] : result;
25086 }
25087 outer: while (++index < length) {
25088 var value = array[index],
25089 computed = iteratee ? iteratee(value) : value;
25090
25091 value = comparator || value !== 0 ? value : 0;
25092 if (isCommon && computed === computed) {
25093 var seenIndex = seen.length;
25094 while (seenIndex--) {
25095 if (seen[seenIndex] === computed) {
25096 continue outer;
25097 }
25098 }
25099 if (iteratee) {
25100 seen.push(computed);
25101 }
25102 result.push(value);
25103 } else if (!includes(seen, computed, comparator)) {
25104 if (seen !== result) {
25105 seen.push(computed);
25106 }
25107 result.push(value);
25108 }
25109 }
25110 return result;
25111}
25112
25113module.exports = baseUniq;
25114
25115/***/ }),
25116/* 108 */
25117/***/ (function(module, exports) {
25118
25119var _html, _tooltip;
25120
25121/**
25122 * @fileOverview G2 3.0 default theme
25123 * @author sima.zhang
25124 */
25125var DEFAULT_COLOR = '#1890FF';
25126var COLOR_PLATE_8 = ['#1890FF', '#2FC25B', '#FACC14', '#223273', '#8543E0', '#13C2C2', '#3436C7', '#F04864'];
25127var COLOR_PLATE_16 = ['#1890FF', '#41D9C7', '#2FC25B', '#FACC14', '#E6965C', '#223273', '#7564CC', '#8543E0', '#5C8EE6', '#13C2C2', '#5CA3E6', '#3436C7', '#B381E6', '#F04864', '#D598D9'];
25128var COLOR_PLATE_24 = ['#1890FF', '#66B5FF', '#41D9C7', '#2FC25B', '#6EDB8F', '#9AE65C', '#FACC14', '#E6965C', '#57AD71', '#223273', '#738AE6', '#7564CC', '#8543E0', '#A877ED', '#5C8EE6', '#13C2C2', '#70E0E0', '#5CA3E6', '#3436C7', '#8082FF', '#DD81E6', '#F04864', '#FA7D92', '#D598D9'];
25129var COLOR_PIE = ['#1890FF', '#13C2C2', '#2FC25B', '#FACC14', '#F04864', '#8543E0', '#3436C7', '#223273'];
25130var COLOR_PIE_16 = ['#1890FF', '#73C9E6', '#13C2C2', '#6CD9B3', '#2FC25B', '#9DD96C', '#FACC14', '#E6965C', '#F04864', '#D66BCA', '#8543E0', '#8E77ED', '#3436C7', '#737EE6', '#223273', '#7EA2E6'];
25131
25132var FONT_FAMILY = '"-apple-system", BlinkMacSystemFont, "Segoe UI", Roboto,"Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",SimSun, "sans-serif"';
25133// tooltip 相关 dom 的 css 类名
25134var TOOLTIP_CONTAINER_CLASS = 'g2-tooltip';
25135var TOOLTIP_TITLE_CLASS = 'g2-tooltip-title';
25136var TOOLTIP_LIST_CLASS = 'g2-tooltip-list';
25137var TOOLTIP_LIST_ITEM_CLASS = 'g2-tooltip-list-item';
25138var TOOLTIP_MARKER_CLASS = 'g2-tooltip-marker';
25139
25140// html 渲染的 legend 相关 dom 的 css 类型
25141var LEGEND_CONTAINER_CLASS = 'g2-legend';
25142var LEGEND_TITLE_CLASS = 'g2-legend-title';
25143var LEGEND_LIST_CLASS = 'g2-legend-list';
25144var LEGEND_LIST_ITEM_CLASS = 'g2-legend-list-item';
25145var LEGEND_MARKER_CLASS = 'g2-legend-marker';
25146
25147var Theme = {
25148 defaultColor: DEFAULT_COLOR, // 默认主题色
25149 plotCfg: {
25150 padding: [20, 20, 95, 80]
25151 },
25152 fontFamily: FONT_FAMILY,
25153 defaultLegendPosition: 'bottom', // 默认图例的展示位置
25154 colors: COLOR_PLATE_8,
25155 colors_16: COLOR_PLATE_16,
25156 colors_24: COLOR_PLATE_24,
25157 colors_pie: COLOR_PIE,
25158 colors_pie_16: COLOR_PIE_16,
25159 shapes: {
25160 point: ['hollowCircle', 'hollowSquare', 'hollowDiamond', 'hollowBowtie', 'hollowTriangle', 'hollowHexagon', 'cross', 'tick', 'plus', 'hyphen', 'line'],
25161 line: ['line', 'dash', 'dot'],
25162 area: ['area']
25163 },
25164 sizes: [1, 10],
25165 opacities: [0.1, 0.9],
25166 axis: {
25167 top: {
25168 // zIndex: 1, // 默认上下方向的坐标轴位于左右坐标轴的上方
25169 position: 'top',
25170 title: null,
25171 label: {
25172 offset: 14,
25173 textStyle: {
25174 fill: '#545454',
25175 fontSize: 12,
25176 lineHeight: 20,
25177 textBaseline: 'middle',
25178 fontFamily: FONT_FAMILY
25179 },
25180 autoRotate: true
25181 },
25182 line: {
25183 lineWidth: 1,
25184 stroke: '#BFBFBF'
25185 },
25186 tickLine: {
25187 lineWidth: 1,
25188 stroke: '#BFBFBF',
25189 length: 4
25190 }
25191 },
25192 bottom: {
25193 position: 'bottom',
25194 title: null,
25195 label: {
25196 offset: 22,
25197 autoRotate: true,
25198 textStyle: {
25199 fill: '#545454',
25200 fontSize: 12,
25201 lineHeight: 20,
25202 textBaseline: 'middle',
25203 fontFamily: FONT_FAMILY
25204 }
25205 },
25206 line: {
25207 lineWidth: 1,
25208 stroke: '#BFBFBF'
25209 },
25210 tickLine: {
25211 lineWidth: 1,
25212 stroke: '#BFBFBF',
25213 length: 4
25214 }
25215 },
25216 left: {
25217 position: 'left',
25218 title: null,
25219 label: {
25220 offset: 12,
25221 autoRotate: true,
25222 textStyle: {
25223 fill: '#545454',
25224 fontSize: 12,
25225 lineHeight: 20,
25226 textBaseline: 'middle',
25227 fontFamily: FONT_FAMILY
25228 }
25229 },
25230 line: null,
25231 tickLine: null,
25232 grid: {
25233 lineStyle: {
25234 stroke: '#E9E9E9',
25235 lineWidth: 1,
25236 lineDash: [3, 3]
25237 },
25238 hideFirstLine: true
25239 }
25240 },
25241 right: {
25242 position: 'right',
25243 title: null,
25244 label: {
25245 offset: 12,
25246 autoRotate: true,
25247 textStyle: {
25248 fill: '#545454',
25249 fontSize: 12,
25250 lineHeight: 20,
25251 textBaseline: 'middle',
25252 fontFamily: FONT_FAMILY
25253 }
25254 },
25255 line: null,
25256 tickLine: null,
25257 grid: {
25258 lineStyle: {
25259 stroke: '#E9E9E9',
25260 lineWidth: 1,
25261 lineDash: [3, 3]
25262 },
25263 hideFirstLine: true
25264 }
25265 },
25266 circle: {
25267 zIndex: 1,
25268 title: null,
25269 label: {
25270 offset: 12,
25271 textStyle: {
25272 fill: '#545454',
25273 fontSize: 12,
25274 lineHeight: 20,
25275 fontFamily: FONT_FAMILY
25276 }
25277 },
25278 line: {
25279 lineWidth: 1,
25280 stroke: '#BFBFBF'
25281 },
25282 tickLine: {
25283 lineWidth: 1,
25284 stroke: '#BFBFBF',
25285 length: 4
25286 },
25287 grid: {
25288 lineStyle: {
25289 stroke: '#E9E9E9',
25290 lineWidth: 1,
25291 lineDash: [3, 3]
25292 },
25293 hideFirstLine: true
25294 }
25295 },
25296 radius: {
25297 zIndex: 0,
25298 label: {
25299 offset: 12,
25300 textStyle: {
25301 fill: '#545454',
25302 fontSize: 12,
25303 textBaseline: 'middle',
25304 lineHeight: 20,
25305 fontFamily: FONT_FAMILY
25306 }
25307 },
25308 line: {
25309 lineWidth: 1,
25310 stroke: '#BFBFBF'
25311 },
25312 tickLine: {
25313 lineWidth: 1,
25314 stroke: '#BFBFBF',
25315 length: 4
25316 },
25317 grid: {
25318 lineStyle: {
25319 stroke: '#E9E9E9',
25320 lineWidth: 1,
25321 lineDash: [3, 3]
25322 },
25323 type: 'circle'
25324 }
25325 },
25326 helix: {
25327 grid: null,
25328 label: null,
25329 title: null,
25330 line: {
25331 lineWidth: 1,
25332 stroke: '#BFBFBF'
25333 },
25334 tickLine: {
25335 lineWidth: 1,
25336 length: 4,
25337 stroke: '#BFBFBF'
25338 }
25339 }
25340 },
25341 label: {
25342 offset: 20,
25343 textStyle: {
25344 fill: '#545454',
25345 fontSize: 12,
25346 textBaseline: 'middle',
25347 fontFamily: FONT_FAMILY
25348 }
25349 },
25350 treemapLabels: {
25351 offset: 10,
25352 textStyle: {
25353 fill: '#fff',
25354 fontSize: 12,
25355 textBaseline: 'top',
25356 fontStyle: 'bold',
25357 fontFamily: FONT_FAMILY
25358 }
25359 },
25360 innerLabels: {
25361 textStyle: {
25362 fill: '#fff',
25363 fontSize: 12,
25364 textBaseline: 'middle',
25365 fontFamily: FONT_FAMILY
25366 }
25367 },
25368 // 在theta坐标系下的饼图文本内部的样式
25369 thetaLabels: {
25370 labelLine: {
25371 lineWidth: 1
25372 },
25373 labelHeight: 14,
25374 offset: 30
25375 // 在theta坐标系下的饼图文本的样式
25376 },
25377 legend: {
25378 right: {
25379 position: 'right',
25380 layout: 'vertical',
25381 itemMarginBottom: 8, // layout 为 vertical 时各个图例项的间距
25382 width: 16,
25383 height: 156,
25384 title: null,
25385 textStyle: {
25386 fill: '#8C8C8C',
25387 fontSize: 12,
25388 textAlign: 'start',
25389 textBaseline: 'middle',
25390 lineHeight: 20,
25391 fontFamily: FONT_FAMILY
25392 }, // 图例项文本的样式
25393 unCheckColor: '#bfbfbf'
25394 },
25395 left: {
25396 position: 'left',
25397 layout: 'vertical',
25398 itemMarginBottom: 8,
25399 width: 16,
25400 height: 156,
25401 title: null,
25402 textStyle: {
25403 fill: '#8C8C8C',
25404 fontSize: 12,
25405 textAlign: 'start',
25406 textBaseline: 'middle',
25407 lineHeight: 20,
25408 fontFamily: FONT_FAMILY
25409 }, // 图例项文本的样式
25410 unCheckColor: '#bfbfbf'
25411 },
25412 top: {
25413 position: 'top',
25414 offset: 6,
25415 layout: 'horizontal',
25416 title: null,
25417 itemGap: 10,
25418 width: 156,
25419 height: 16,
25420 textStyle: {
25421 fill: '#8C8C8C',
25422 fontSize: 12,
25423 textAlign: 'start',
25424 textBaseline: 'middle',
25425 lineHeight: 20,
25426 fontFamily: FONT_FAMILY
25427 }, // 图例项文本的样式
25428 unCheckColor: '#bfbfbf'
25429 },
25430 bottom: {
25431 position: 'bottom',
25432 offset: 58,
25433 layout: 'horizontal',
25434 title: null,
25435 itemGap: 24,
25436 width: 156,
25437 height: 16,
25438 textStyle: {
25439 fill: '#8C8C8C',
25440 fontSize: 12,
25441 textAlign: 'start',
25442 textBaseline: 'middle',
25443 lineHeight: 20,
25444 fontFamily: FONT_FAMILY
25445 }, // 图例项文本的样式
25446 unCheckColor: '#bfbfbf'
25447 },
25448 // 定义 html 渲染图例的样式
25449 html: (_html = {}, _html['' + LEGEND_CONTAINER_CLASS] = {
25450 height: 'auto',
25451 width: 'auto',
25452 position: 'absolute',
25453 overflow: 'scroll',
25454 fontSize: '12px',
25455 fontFamily: FONT_FAMILY,
25456 lineHeight: '20px',
25457 color: '#8C8C8C'
25458 }, _html['' + LEGEND_TITLE_CLASS] = {
25459 marginBottom: '4px'
25460 }, _html['' + LEGEND_LIST_CLASS] = {
25461 listStyleType: 'none',
25462 margin: 0,
25463 padding: 0
25464 }, _html['' + LEGEND_LIST_ITEM_CLASS] = {
25465 cursor: 'pointer',
25466 marginBottom: '5px',
25467 marginRight: '24px'
25468 }, _html['' + LEGEND_MARKER_CLASS] = {
25469 width: '9px',
25470 height: '9px',
25471 borderRadius: '50%',
25472 display: 'inline-block',
25473 marginRight: '8px',
25474 verticalAlign: 'middle'
25475 }, _html),
25476 // 不能滑动的连续图例样式
25477 gradient: {
25478 textStyle: {
25479 fill: '#8C8C8C',
25480 fontSize: 12,
25481 textAlign: 'center',
25482 textBaseline: 'middle',
25483 lineHeight: 20,
25484 fontFamily: FONT_FAMILY
25485 }, // 图例项文本的样式
25486 lineStyle: {
25487 lineWidth: 1,
25488 stroke: '#fff'
25489 },
25490 unCheckColor: '#bfbfbf'
25491 }
25492 },
25493 tooltip: (_tooltip = {
25494 crosshairs: false,
25495 offset: 15
25496 }, _tooltip['' + TOOLTIP_CONTAINER_CLASS] = {
25497 position: 'absolute',
25498 visibility: 'hidden',
25499 whiteSpace: 'nowrap',
25500 zIndex: 999,
25501 transition: 'visibility 0.2s cubic-bezier(0.23, 1, 0.32, 1), left 0.4s cubic-bezier(0.23, 1, 0.32, 1), top 0.4s cubic-bezier(0.23, 1, 0.32, 1)',
25502 backgroundColor: 'rgba(0, 0, 0, 0.65)',
25503 borderRadius: '4px',
25504 color: 'rgb(255, 255, 255)',
25505 fontSize: '12px',
25506 fontFamily: FONT_FAMILY,
25507 lineHeight: '20px',
25508 padding: '10px 10px 6px 10px'
25509 }, _tooltip['' + TOOLTIP_TITLE_CLASS] = {
25510 marginBottom: '4px'
25511 }, _tooltip['' + TOOLTIP_LIST_CLASS] = {
25512 margin: 0,
25513 listStyleType: 'none',
25514 padding: 0
25515 }, _tooltip['' + TOOLTIP_LIST_ITEM_CLASS] = {
25516 marginBottom: '4px'
25517 }, _tooltip['' + TOOLTIP_MARKER_CLASS] = {
25518 width: '7px',
25519 height: '7px',
25520 borderRadius: '50%',
25521 border: '1px solid #fff',
25522 display: 'inline-block',
25523 marginRight: '8px'
25524 }, _tooltip),
25525 tooltipMarker: {
25526 symbol: function symbol(x, y, r, ctx, marker) {
25527 var color = marker.get('color');
25528 ctx.fillStyle = color;
25529 ctx.lineWidth = 1;
25530 ctx.strokeStyle = '#fff';
25531 ctx.beginPath();
25532 ctx.arc(x, y, r, 0, Math.PI * 2, false);
25533 ctx.fill();
25534 ctx.stroke();
25535
25536 ctx.save();
25537 ctx.beginPath();
25538 ctx.fillStyle = '#fff';
25539 ctx.strokeStyle = color;
25540 ctx.globalAlpha = 0.2;
25541 ctx.lineWidth = 3;
25542 ctx.arc(x, y, 6, 0, Math.PI * 2, false);
25543 ctx.stroke();
25544 ctx.restore();
25545 },
25546 radius: 4
25547 }, // 提示信息在折线图、区域图上形成点的样式
25548 tooltipCrosshairsRect: {
25549 type: 'rect',
25550 style: {
25551 fill: '#CCD6EC',
25552 opacity: 0.3
25553 }
25554 }, // tooltip 辅助背景框样式
25555 tooltipCrosshairsLine: {
25556 style: {
25557 stroke: 'rgba(0, 0, 0, 0.25)',
25558 lineWidth: 1
25559 }
25560 },
25561 shape: {
25562 point: {
25563 lineWidth: 1,
25564 fill: DEFAULT_COLOR,
25565 radius: 4
25566 },
25567 hollowPoint: {
25568 fill: '#fff',
25569 lineWidth: 1,
25570 stroke: DEFAULT_COLOR,
25571 radius: 3
25572 },
25573 interval: {
25574 lineWidth: 0,
25575 fill: DEFAULT_COLOR,
25576 fillOpacity: 0.85
25577 },
25578 hollowInterval: {
25579 fill: '#fff',
25580 stroke: DEFAULT_COLOR,
25581 fillOpacity: 0,
25582 lineWidth: 2
25583 },
25584 area: {
25585 lineWidth: 0,
25586 fill: DEFAULT_COLOR,
25587 fillOpacity: 0.3
25588 },
25589 polygon: {
25590 lineWidth: 0,
25591 fill: DEFAULT_COLOR,
25592 fillOpacity: 1
25593 },
25594 hollowPolygon: {
25595 fill: '#fff',
25596 stroke: DEFAULT_COLOR,
25597 fillOpacity: 0,
25598 lineWidth: 2
25599 },
25600 hollowArea: {
25601 fill: '#fff',
25602 stroke: DEFAULT_COLOR,
25603 fillOpacity: 0,
25604 lineWidth: 2
25605 },
25606 line: {
25607 stroke: DEFAULT_COLOR,
25608 lineWidth: 2,
25609 fill: null
25610 },
25611 edge: {
25612 stroke: DEFAULT_COLOR,
25613 lineWidth: 1,
25614 fill: null
25615 },
25616 schema: {
25617 stroke: DEFAULT_COLOR,
25618 lineWidth: 1,
25619 fill: null
25620 }
25621 },
25622 guide: {
25623 line: {
25624 lineStyle: {
25625 stroke: DEFAULT_COLOR,
25626 lineDash: [0, 2, 2],
25627 lineWidth: 1
25628 },
25629 text: {
25630 position: 'end',
25631 autoRotate: true,
25632 style: {
25633 fill: '#545454',
25634 fontSize: 12,
25635 textAlign: 'center',
25636 fontFamily: FONT_FAMILY
25637 }
25638 }
25639 },
25640 text: {
25641 style: {
25642 fill: '#545454',
25643 fontSize: 12,
25644 textBaseline: 'middle',
25645 textAlign: 'start',
25646 fontFamily: FONT_FAMILY
25647
25648 }
25649 },
25650 region: {
25651 style: {
25652 lineWidth: 0, // 辅助框的边框宽度
25653 fill: '#000', // 辅助框填充的颜色
25654 fillOpacity: 0.04 // 辅助框的背景透明度
25655 // 辅助框的图形样式属性
25656 } },
25657 html: {
25658 alignX: 'middle',
25659 alignY: 'middle'
25660 }
25661 },
25662 pixelRatio: null
25663};
25664
25665module.exports = Theme;
25666
25667/***/ }),
25668/* 109 */
25669/***/ (function(module, exports, __webpack_require__) {
25670
25671function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
25672
25673function _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; }
25674
25675function _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; }
25676
25677var _require = __webpack_require__(2),
25678 Group = _require.Group;
25679
25680var Labels = __webpack_require__(65);
25681var Global = __webpack_require__(1);
25682var Util = __webpack_require__(0);
25683var IGNORE_ARR = ['line', 'point', 'path'];
25684var ORIGIN = '_origin';
25685
25686function avg(arr) {
25687 var sum = 0;
25688 Util.each(arr, function (value) {
25689 sum += value;
25690 });
25691 return sum / arr.length;
25692}
25693
25694var GeomLabels = function (_Group) {
25695 _inherits(GeomLabels, _Group);
25696
25697 function GeomLabels() {
25698 _classCallCheck(this, GeomLabels);
25699
25700 return _possibleConstructorReturn(this, _Group.apply(this, arguments));
25701 }
25702
25703 GeomLabels.prototype.getDefaultCfg = function getDefaultCfg() {
25704 return {
25705 label: Global.label,
25706 /**
25707 * 用户传入的文本配置信息
25708 * @type {Object}
25709 */
25710 labelCfg: null,
25711 /**
25712 * 所在的坐标系
25713 * @type {Object}
25714 */
25715 coord: null,
25716 /**
25717 * 图表的类型
25718 * @type {String}
25719 */
25720 geomType: null,
25721 zIndex: 6
25722 };
25723 };
25724
25725 GeomLabels.prototype._renderUI = function _renderUI() {
25726 _Group.prototype._renderUI.call(this);
25727 this.initLabelsCfg();
25728 this.renderLabels(); // 调用入口文件
25729 };
25730
25731 // 获取显示的 label 文本值
25732
25733
25734 GeomLabels.prototype._getLabelValue = function _getLabelValue(record) {
25735 var self = this;
25736 var originRecord = record[ORIGIN];
25737 var labelCfg = self.get('labelCfg');
25738 var scales = labelCfg.scales;
25739 var callback = labelCfg.cfg && labelCfg.cfg.content;
25740 var value = void 0;
25741 if (callback) {
25742 var params = [];
25743 Util.each(scales, function (scale) {
25744 params.push(originRecord[scale.field]);
25745 });
25746 value = callback.apply(null, params);
25747 } else {
25748 var scale = scales[0];
25749 value = originRecord[scale.field];
25750 if (Util.isArray(value)) {
25751 var tmp = [];
25752 Util.each(value, function (subVal) {
25753 tmp.push(scale.getText(subVal));
25754 });
25755 value = tmp;
25756 } else {
25757 value = scale.getText(value);
25758 }
25759 }
25760 return value;
25761 };
25762
25763 // 初始化labels的配置项
25764
25765
25766 GeomLabels.prototype.initLabelsCfg = function initLabelsCfg() {
25767 var self = this;
25768 var labels = self.getDefaultLabelCfg();
25769 var labelCfg = self.get('labelCfg');
25770 // Util.merge(labels, labelCfg.cfg);
25771 Util.deepMix(labels, labelCfg.cfg);
25772 self.set('label', labels);
25773 };
25774
25775 /**
25776 * @protected
25777 * 默认的文本样式
25778 * @return {Object} default label config
25779 */
25780
25781
25782 GeomLabels.prototype.getDefaultLabelCfg = function getDefaultLabelCfg() {
25783 var self = this;
25784 var labelCfg = self.get('labelCfg').cfg;
25785 var geomType = self.get('geomType');
25786 if (geomType === 'polygon' || labelCfg && labelCfg.offset < 0 && Util.indexOf(IGNORE_ARR, geomType) === -1) {
25787 // return Util.merge({}, self.get('label'), Global.innerLabels);
25788 return Util.deepMix({}, self.get('label'), Global.innerLabels);
25789 }
25790 // return Util.merge({}, Global.label, self.get('label'));
25791 return Util.deepMix({}, Global.label, self.get('label'));
25792 };
25793
25794 /**
25795 * @protected
25796 * 获取labels
25797 * @param {Array} points points
25798 * @return {Array} label items
25799 */
25800
25801
25802 GeomLabels.prototype.getLabelsItems = function getLabelsItems(points) {
25803 var self = this;
25804 var items = [];
25805 var labels = self.get('label');
25806 var geom = self.get('geom');
25807 var origin = void 0;
25808
25809 // 获取label相关的x,y的值,获取具体的x,y,防止存在数组
25810 Util.each(points, function (point) {
25811 origin = point._origin;
25812 var label = self._getLabelValue(point);
25813 if (!Util.isArray(label)) {
25814 label = [label];
25815 }
25816 var total = label.length;
25817
25818 Util.each(label, function (sub, subIdx) {
25819 var obj = self.getLabelPoint(label, point, subIdx);
25820 if (obj) {
25821 obj = Util.mix({}, origin, obj); // 为了格式化输出
25822 var align = void 0;
25823 if (labels && labels.label && labels.label.textAlign) {
25824 align = labels.label.textAlign;
25825 } else {
25826 align = self.getLabelAlign(obj, subIdx, total);
25827 }
25828 obj.textAlign = align;
25829 if (geom) {
25830 obj._id = geom._getShapeId(origin) + '-glabel-' + subIdx + '-' + obj.text;
25831 }
25832 obj.coord = self.get('coord');
25833 items.push(obj);
25834 }
25835 });
25836 });
25837 return items;
25838 };
25839
25840 /**
25841 * @protected
25842 * 如果发生冲突则会调整文本的位置
25843 * @param {Array} items 文本的集合
25844 * @return {Array} adjusted items
25845 */
25846
25847
25848 GeomLabels.prototype.adjustItems = function adjustItems(items) {
25849 return items;
25850 };
25851
25852 /**
25853 * drawing lines to labels
25854 * @param {Array} items labels
25855 * @param {Object} labelLine configuration for label lines
25856 */
25857
25858
25859 GeomLabels.prototype.drawLines = function drawLines(items, labelLine) {
25860 var self = this;
25861 var offset = self.getDefaultOffset();
25862 if (offset > 0) {
25863 Util.each(items, function (point) {
25864 self.lineToLabel(point, labelLine);
25865 });
25866 }
25867 };
25868
25869 // 连接线
25870
25871
25872 GeomLabels.prototype.lineToLabel = function lineToLabel(label, labelLine) {
25873 var self = this;
25874 var coord = self.get('coord');
25875 var start = {
25876 x: label.x - label._offset.x,
25877 y: label.y - label._offset.y
25878 };
25879 var inner = {
25880 x: (start.x + label.x) / 2,
25881 y: (start.y + label.y) / 2
25882 };
25883 var lineGroup = self.get('lineGroup');
25884 // var lineShape;
25885 if (!lineGroup) {
25886 lineGroup = self.addGroup({
25887 elCls: 'x-line-group'
25888 });
25889 self.set('lineGroup', lineGroup);
25890 }
25891 var lineShape = lineGroup.addShape('path', {
25892 attrs: Util.mix({
25893 path: ['M' + start.x, start.y + ' Q' + inner.x, inner.y + ' ' + label.x, label.y].join(','),
25894 fill: null,
25895 stroke: label.color
25896 }, labelLine)
25897 });
25898 // label 对应线的动画关闭
25899 lineShape.name = 'labelLine';
25900 // generate labelLine id according to label id
25901 lineShape._id = label._id && label._id.replace('glabel', 'glabelline');
25902 lineShape.set('coord', coord);
25903 };
25904
25905 /**
25906 * @protected
25907 * 获取文本的位置信息
25908 * @param {Array} labels labels
25909 * @param {Object} point point
25910 * @param {Number} index index
25911 * @return {Object} point
25912 */
25913
25914
25915 GeomLabels.prototype.getLabelPoint = function getLabelPoint(labels, point, index) {
25916 var self = this;
25917 var coord = self.get('coord');
25918
25919 function getDimValue(value, idx) {
25920 if (Util.isArray(value)) {
25921 if (labels.length === 1) {
25922 // 如果仅一个label,多个y,取最后一个y
25923 if (value.length <= 2) {
25924 value = value[value.length - 1];
25925 // value = value[0];
25926 } else {
25927 value = avg(value);
25928 }
25929 } else {
25930 value = value[idx];
25931 }
25932 }
25933 return value;
25934 }
25935
25936 var labelPoint = {
25937 x: getDimValue(point.x, index),
25938 y: getDimValue(point.y, index),
25939 text: labels[index]
25940 };
25941
25942 // get nearest point of the shape as the label line start point
25943 if (point && point.nextPoints && (point.shape === 'funnel' || point.shape === 'pyramid')) {
25944 var maxX = -Infinity;
25945 point.nextPoints.forEach(function (p) {
25946 p = coord.convert(p);
25947 if (p.x > maxX) {
25948 maxX = p.x;
25949 }
25950 });
25951 labelPoint.x = (labelPoint.x + maxX) / 2;
25952 }
25953 // sharp edge of the pyramid
25954 if (point.shape === 'pyramid' && !point.nextPoints && point.points) {
25955 point.points.forEach(function (p) {
25956 p = coord.convert(p);
25957 if (point.x.indexOf(p.x) === -1) {
25958 labelPoint.x = (labelPoint.x + p.x) / 2;
25959 }
25960 });
25961 }
25962
25963 var offsetPoint = self.getLabelOffset(labelPoint, index, labels.length);
25964 self.transLabelPoint(labelPoint);
25965 labelPoint.x += offsetPoint.x;
25966 labelPoint.y += offsetPoint.y;
25967 labelPoint.color = point.color;
25968 labelPoint._offset = offsetPoint;
25969 return labelPoint;
25970 };
25971
25972 GeomLabels.prototype.transLabelPoint = function transLabelPoint(point) {
25973 var self = this;
25974 var coord = self.get('coord');
25975 var tmpPoint = coord.applyMatrix(point.x, point.y, 1);
25976 point.x = tmpPoint[0];
25977 point.y = tmpPoint[1];
25978 };
25979
25980 GeomLabels.prototype.getOffsetVector = function getOffsetVector() {
25981 var self = this;
25982 var labelCfg = self.get('label');
25983 var offset = labelCfg.offset || 0;
25984 var coord = self.get('coord');
25985 var vector = void 0;
25986 if (coord.isTransposed) {
25987 // 如果x,y翻转,则偏移x
25988 vector = coord.applyMatrix(offset, 0);
25989 } else {
25990 // 否则,偏转y
25991 vector = coord.applyMatrix(0, offset);
25992 }
25993 return vector;
25994 };
25995
25996 // 获取默认的偏移量
25997
25998
25999 GeomLabels.prototype.getDefaultOffset = function getDefaultOffset() {
26000 var self = this;
26001 var offset = 0; // Global.labels.offset;
26002
26003 var coord = self.get('coord');
26004 var vector = self.getOffsetVector();
26005 if (coord.isTransposed) {
26006 // 如果x,y翻转,则偏移x
26007 offset = vector[0];
26008 } else {
26009 // 否则,偏转y
26010 offset = vector[1];
26011 }
26012 return offset;
26013 };
26014
26015 // 获取文本的偏移位置,x,y
26016
26017
26018 GeomLabels.prototype.getLabelOffset = function getLabelOffset(point, index, total) {
26019 var self = this;
26020 var offset = self.getDefaultOffset();
26021 var coord = self.get('coord');
26022 var transposed = coord.isTransposed;
26023 var yField = transposed ? 'x' : 'y';
26024 var factor = transposed ? 1 : -1; // y 方向上越大,像素的坐标越小,所以transposed时将系数变成
26025 var offsetPoint = {
26026 x: 0,
26027 y: 0
26028 };
26029 if (index > 0 || total === 1) {
26030 // 判断是否小于0
26031 offsetPoint[yField] = offset * factor;
26032 } else {
26033 offsetPoint[yField] = offset * factor * -1;
26034 }
26035 return offsetPoint;
26036 };
26037
26038 GeomLabels.prototype.getLabelAlign = function getLabelAlign(point, index, total) {
26039 var self = this;
26040 var align = 'center';
26041 var coord = self.get('coord');
26042 if (coord.isTransposed) {
26043 var offset = self.getDefaultOffset();
26044 // var vector = coord.applyMatrix(offset,0);
26045 if (offset < 0) {
26046 align = 'right';
26047 } else if (offset === 0) {
26048 align = 'center';
26049 } else {
26050 align = 'left';
26051 }
26052 if (total > 1 && index === 0) {
26053 if (align === 'right') {
26054 align = 'left';
26055 } else if (align === 'left') {
26056 align = 'right';
26057 }
26058 }
26059 }
26060 return align;
26061 };
26062
26063 GeomLabels.prototype.showLabels = function showLabels(points) {
26064 var self = this;
26065 var items = self.getLabelsItems(points);
26066 var labels = self.get('label');
26067 items = self.adjustItems(items);
26068 self.resetLabels(items);
26069 if (labels.labelLine) {
26070 self.drawLines(items, labels.labelLine);
26071 }
26072 };
26073
26074 GeomLabels.prototype.destroy = function destroy() {
26075 this.removeLabels(); // 清理文本
26076 _Group.prototype.destroy.call(this);
26077 };
26078
26079 return GeomLabels;
26080}(Group);
26081
26082Util.assign(GeomLabels.prototype, Labels.LabelsRenderer);
26083
26084module.exports = GeomLabels;
26085
26086/***/ }),
26087/* 110 */
26088/***/ (function(module, exports, __webpack_require__) {
26089
26090function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
26091
26092function _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; }
26093
26094function _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; }
26095
26096/**
26097 * @fileOverview The Label class
26098 * @author sima.zhang
26099 */
26100var Util = __webpack_require__(0);
26101
26102var _require = __webpack_require__(2),
26103 DomUtil = _require.DomUtil,
26104 Group = _require.Group;
26105
26106var Labels = function (_Group) {
26107 _inherits(Labels, _Group);
26108
26109 function Labels() {
26110 _classCallCheck(this, Labels);
26111
26112 return _possibleConstructorReturn(this, _Group.apply(this, arguments));
26113 }
26114
26115 Labels.prototype.getDefaultCfg = function getDefaultCfg() {
26116 return {
26117 zIndex: 6,
26118 /**
26119 * 显示的文本集合
26120 * @type {Array}
26121 */
26122 items: null,
26123 /**
26124 * 文本样式
26125 * @type {(Object|Function)}
26126 */
26127 textStyle: null,
26128 /**
26129 * 文本显示格式化回调函数
26130 * @type {Function}
26131 */
26132 formatter: null,
26133 /**
26134 * 使用 html 渲染文本
26135 * @type {(String|Function)}
26136 */
26137 htmlTemplate: null,
26138 /**
26139 * html 渲染时用的容器的模板,必须存在 class = "g-labels"
26140 * @type {String}
26141 */
26142 _containerTpl: '<div class="g-labels" style="position:absolute;top:0;left:0;"></div>',
26143 /**
26144 * html 渲染时单个 label 的模板,必须存在 class = "g-label",如果 htmlTemplate 为字符串,则使用 htmlTemplate
26145 * @type {String}
26146 */
26147 _itemTpl: '<div class="g-label" style="position:absolute;">{text}</div>'
26148 };
26149 };
26150
26151 Labels.prototype._renderUI = function _renderUI() {
26152 this._drawLabels();
26153 };
26154
26155 Labels.prototype._drawLabels = function _drawLabels() {
26156 var self = this;
26157 var items = self.get('items');
26158 Util.each(items, function (item, index) {
26159 self._addLabel(item, index);
26160 });
26161 };
26162
26163 Labels.prototype._addLabel = function _addLabel(item, index) {
26164 var cfg = this._getLabelCfg(item, index);
26165 return this._createText(cfg);
26166 };
26167
26168 Labels.prototype._getLabelCfg = function _getLabelCfg(item, index) {
26169 var textStyle = this.get('textStyle') || {};
26170 var formatter = this.get('formatter');
26171 var htmlTemplate = this.get('htmlTemplate');
26172
26173 if (!Util.isObject(item)) {
26174 var tmp = item;
26175 item = {};
26176 item.text = tmp;
26177 }
26178
26179 if (Util.isFunction(textStyle)) {
26180 textStyle = textStyle(item.text, item, index);
26181 }
26182
26183 if (formatter) {
26184 item.text = formatter(item.text, item, index);
26185 }
26186
26187 if (Util.isFunction(htmlTemplate)) {
26188 item.text = htmlTemplate(item.text, item, index);
26189 }
26190
26191 if (Util.isNil(item.text)) {
26192 item.text = '';
26193 }
26194
26195 item.text = item.text + ''; // ? 为什么转换为字符串
26196
26197 var cfg = Util.mix({}, item, textStyle, {
26198 x: item.x || 0,
26199 y: item.y || 0
26200 });
26201
26202 return cfg;
26203 };
26204
26205 Labels.prototype._createText = function _createText(cfg) {
26206 var htmlTemplate = this.get('htmlTemplate');
26207 var customDiv = this.get('customDiv');
26208 var labelShape = void 0;
26209
26210 if (htmlTemplate) {
26211 if (!customDiv) {
26212 var containerTpl = this.get('_containerTpl');
26213 var wrapper = this.get('canvas').get('el').parentNode;
26214 customDiv = DomUtil.createDom(containerTpl);
26215 wrapper.style.position = 'relative';
26216 wrapper.appendChild(customDiv);
26217 this.set('customDiv', customDiv);
26218 }
26219
26220 var node = this._createDom(cfg);
26221 customDiv.appendChild(node);
26222 this._setCustomPosition(cfg, node);
26223 } else {
26224 var origin = cfg.point;
26225 delete cfg.point; // 临时解决,否则影响动画
26226 labelShape = this.addShape('text', {
26227 attrs: cfg
26228 });
26229 labelShape.setSilent('origin', origin);
26230 labelShape.name = 'label'; // 用于事件标注
26231 this.get('appendInfo') && labelShape.setSilent('appendInfo', this.get('appendInfo'));
26232 return labelShape;
26233 }
26234 };
26235
26236 Labels.prototype._setCustomPosition = function _setCustomPosition(cfg, htmlDom) {
26237 var textAlign = cfg.textAlign || 'left';
26238 var top = cfg.y;
26239 var left = cfg.x;
26240 var width = DomUtil.getOuterWidth(htmlDom);
26241 var height = DomUtil.getOuterHeight(htmlDom);
26242
26243 top = top - height / 2;
26244 if (textAlign === 'center') {
26245 left = left - width / 2;
26246 } else if (textAlign === 'right') {
26247 left = left - width;
26248 }
26249
26250 htmlDom.style.top = parseInt(top, 10) + 'px';
26251 htmlDom.style.left = parseInt(left, 10) + 'px';
26252 };
26253
26254 Labels.prototype._createDom = function _createDom(cfg) {
26255 var itemTpl = this.get('_itemTpl');
26256 var htmlTemplate = this.get('htmlTemplate');
26257
26258 if (Util.isString(htmlTemplate)) {
26259 cfg.text = Util.substitute(htmlTemplate, { text: cfg.text });
26260 }
26261
26262 var str = Util.substitute(itemTpl, { text: cfg.text });
26263
26264 return DomUtil.createDom(str);
26265 };
26266
26267 Labels.prototype.getLabels = function getLabels() {
26268 var customDiv = this.get('customDiv');
26269 if (customDiv) {
26270 return Util.toArray(customDiv.childNodes);
26271 }
26272 return this.get('children');
26273 };
26274
26275 Labels.prototype.addLabel = function addLabel(item) {
26276 var items = this.get('items');
26277 var count = items.length;
26278 items.push(item);
26279 return this._addLabel(item, count);
26280 };
26281
26282 Labels.prototype.changeLabel = function changeLabel(oldLabel, newLabel) {
26283 if (!oldLabel) {
26284 return;
26285 }
26286 var htmlTemplate = this.get('htmlTemplate');
26287 var index = Util.indexOf(this.getLabels(), oldLabel);
26288 var cfg = this._getLabelCfg(newLabel, index);
26289 if (htmlTemplate) {
26290 var node = this._createDom(cfg);
26291 oldLabel.innerHTML = node.innerHTML;
26292 this._setCustomPosition(cfg, oldLabel);
26293 } else {
26294 oldLabel._id = newLabel._id;
26295 oldLabel.attr('text', cfg.text);
26296 if (oldLabel.attr('x') !== cfg.x || oldLabel.attr('y') !== cfg.y) {
26297 var rotate = oldLabel.get('attrs').rotate;
26298 if (rotate) {
26299 oldLabel.rotateAtStart(-rotate);
26300 oldLabel.attr(cfg);
26301 oldLabel.rotateAtStart(rotate);
26302 } else {
26303 oldLabel.attr(cfg);
26304 }
26305 }
26306 }
26307 };
26308
26309 Labels.prototype.clear = function clear() {
26310 var customDiv = this.get('customDiv');
26311 if (customDiv) {
26312 customDiv.innerHTML = '';
26313 }
26314 _Group.prototype.clear.call(this);
26315 };
26316
26317 Labels.prototype.setItems = function setItems(items) {
26318 this.clear();
26319 this.set('items', items);
26320 this._drawLabels();
26321 };
26322
26323 Labels.prototype.remove = function remove() {
26324 var customDiv = this.get('customDiv');
26325 if (customDiv) {
26326 customDiv.parentNode.removeChild(customDiv);
26327 }
26328 _Group.prototype.remove.call(this);
26329 };
26330
26331 return Labels;
26332}(Group);
26333
26334module.exports = Labels;
26335
26336/***/ }),
26337/* 111 */
26338/***/ (function(module, exports, __webpack_require__) {
26339
26340function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
26341
26342function _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; }
26343
26344function _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; }
26345
26346var Labels = __webpack_require__(109);
26347var PathUtil = __webpack_require__(14);
26348var Util = __webpack_require__(0);
26349
26350var PolarLabels = function (_Labels) {
26351 _inherits(PolarLabels, _Labels);
26352
26353 function PolarLabels() {
26354 _classCallCheck(this, PolarLabels);
26355
26356 return _possibleConstructorReturn(this, _Labels.apply(this, arguments));
26357 }
26358
26359 PolarLabels.prototype.getPointRauis = function getPointRauis(coord, point) {
26360 return PathUtil.getPointRadius(coord, point);
26361 };
26362
26363 PolarLabels.prototype.getCirclePoint = function getCirclePoint(angle, offset, point) {
26364 var self = this;
26365 var coord = self.get('coord');
26366 var center = coord.getCenter();
26367 var labelEmit = self._isEmitLabels();
26368 var r = self.getPointRauis(coord, point);
26369 if (coord.isTransposed && r > offset && !labelEmit) {
26370 var appendAngle = Math.asin(offset / (2 * r));
26371 angle = angle + appendAngle * 2;
26372 } else {
26373 r = r + offset;
26374 }
26375
26376 return {
26377 x: center.x + r * Math.cos(angle),
26378 y: center.y + r * Math.sin(angle),
26379 angle: angle,
26380 r: r
26381 };
26382 };
26383
26384 PolarLabels.prototype.getArcPoint = function getArcPoint(point, index) {
26385 var self = this;
26386
26387 var outerPoint = void 0; // 圆弧上的中点
26388 // var coord = self.get('coord');
26389 index = index || 0;
26390 if (Util.isArray(point.x) || Util.isArray(point.y)) {
26391 outerPoint = {
26392 x: Util.isArray(point.x) ? point.x[index] : point.x,
26393 y: Util.isArray(point.y) ? point.y[index] : point.y
26394 };
26395 } else {
26396 outerPoint = point;
26397 }
26398 self.transLabelPoint(outerPoint);
26399 return outerPoint;
26400 };
26401
26402 // 获取点所在的角度
26403
26404
26405 PolarLabels.prototype.getPointAngle = function getPointAngle(point) {
26406 var self = this;
26407 var coord = self.get('coord');
26408 return PathUtil.getPointAngle(coord, point);
26409 };
26410
26411 // 获取中心的位置
26412
26413
26414 PolarLabels.prototype.getMiddlePoint = function getMiddlePoint(points) {
26415 var self = this;
26416 var coord = self.get('coord');
26417 var count = points.length;
26418 var middlePoint = {
26419 x: 0,
26420 y: 0
26421 };
26422 Util.each(points, function (point) {
26423 middlePoint.x += point.x;
26424 middlePoint.y += point.y;
26425 });
26426 middlePoint.x /= count;
26427 middlePoint.y /= count;
26428
26429 middlePoint = coord.convert(middlePoint);
26430 return middlePoint;
26431 };
26432
26433 // 是否居中
26434
26435
26436 PolarLabels.prototype._isToMiddle = function _isToMiddle(point) {
26437 return point.x.length > 2;
26438 };
26439
26440 /**
26441 * @protected
26442 * 获取文本的位置信息
26443 * @param {Array} labels labels
26444 * @param {Object} point point
26445 * @param {Number} index index
26446 * @return {Object} point
26447 */
26448
26449
26450 PolarLabels.prototype.getLabelPoint = function getLabelPoint(labels, point, index) {
26451 var self = this;
26452 var text = labels[index];
26453 var factor = 1;
26454 var arcPoint = void 0;
26455 if (self._isToMiddle(point)) {
26456 arcPoint = self.getMiddlePoint(point.points);
26457 } else {
26458 if (labels.length === 1 && index === 0) {
26459 index = 1;
26460 } else if (index === 0) {
26461 factor = -1;
26462 }
26463 arcPoint = self.getArcPoint(point, index);
26464 }
26465
26466 var offset = self.getDefaultOffset();
26467 offset = offset * factor;
26468 var middleAngle = self.getPointAngle(arcPoint);
26469 var labelPoint = self.getCirclePoint(middleAngle, offset, arcPoint);
26470 labelPoint.text = text;
26471 labelPoint.angle = middleAngle;
26472 labelPoint.color = point.color;
26473
26474 labelPoint.rotate = self.getLabelRotate(middleAngle, offset, point);
26475 return labelPoint;
26476 };
26477
26478 PolarLabels.prototype._isEmitLabels = function _isEmitLabels() {
26479 var labels = this.get('label');
26480 return labels.labelEmit;
26481 };
26482
26483 /**
26484 * @protected
26485 * 获取文本旋转的方向
26486 * @param {Number} angle angle
26487 * @return {Number} angle
26488 */
26489
26490
26491 PolarLabels.prototype.getLabelRotate = function getLabelRotate(angle) {
26492 var self = this;
26493 var rotate = void 0;
26494 rotate = angle * 180 / Math.PI;
26495 rotate += 90;
26496
26497 if (self._isEmitLabels()) {
26498 rotate -= 90;
26499 }
26500 if (rotate) {
26501 if (rotate > 90) {
26502 rotate = rotate - 180;
26503 } else if (rotate < -90) {
26504 rotate = rotate + 180;
26505 }
26506 }
26507 return rotate / 180 * Math.PI;
26508 };
26509
26510 // override
26511
26512
26513 PolarLabels.prototype.getLabelAlign = function getLabelAlign(point) {
26514 var self = this;
26515 var coord = self.get('coord');
26516 var align = void 0;
26517 if (self._isEmitLabels()) {
26518 if (point.angle <= Math.PI / 2 && point.angle > -Math.PI / 2) {
26519 align = 'left';
26520 } else {
26521 align = 'right';
26522 }
26523 } else if (!coord.isTransposed) {
26524 align = 'center';
26525 } else {
26526 var center = coord.getCenter();
26527 var offset = self.getDefaultOffset();
26528 if (Math.abs(point.x - center.x) < 1) {
26529 align = 'center';
26530 } else if (point.angle > Math.PI || point.angle <= 0) {
26531 if (offset > 0) {
26532 align = 'left';
26533 } else {
26534 align = 'right';
26535 }
26536 } else {
26537 if (offset > 0) {
26538 align = 'right';
26539 } else {
26540 align = 'left';
26541 }
26542 }
26543 }
26544 return align;
26545 };
26546
26547 return PolarLabels;
26548}(Labels);
26549
26550module.exports = PolarLabels;
26551
26552/***/ }),
26553/* 112 */
26554/***/ (function(module, exports, __webpack_require__) {
26555
26556function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
26557
26558function _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; }
26559
26560function _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; }
26561
26562/**
26563 * @fileOverview 路径图,无序的线图
26564 * @author dxq613@gmail.com
26565 */
26566
26567var GeomBase = __webpack_require__(9);
26568var SplitMixin = __webpack_require__(113);
26569var Util = __webpack_require__(0);
26570
26571var Path = function (_GeomBase) {
26572 _inherits(Path, _GeomBase);
26573
26574 /**
26575 * 获取默认的配置属性
26576 * @protected
26577 * @return {Object} 默认属性
26578 */
26579 Path.prototype.getDefaultCfg = function getDefaultCfg() {
26580 var cfg = _GeomBase.prototype.getDefaultCfg.call(this);
26581 cfg.type = 'path';
26582 cfg.shapeType = 'line';
26583 return cfg;
26584 };
26585
26586 function Path(cfg) {
26587 _classCallCheck(this, Path);
26588
26589 var _this = _possibleConstructorReturn(this, _GeomBase.call(this, cfg));
26590
26591 Util.assign(_this, SplitMixin);
26592 return _this;
26593 }
26594
26595 Path.prototype.getDrawCfg = function getDrawCfg(obj) {
26596 var cfg = _GeomBase.prototype.getDrawCfg.call(this, obj);
26597 cfg.isStack = this.hasStack();
26598 return cfg;
26599 };
26600
26601 Path.prototype.draw = function draw(data, container, shapeFactory, index) {
26602 var self = this;
26603 var splitArray = this.splitData(data);
26604
26605 var cfg = this.getDrawCfg(data[0]);
26606 cfg.origin = data; // path,line 等图的origin 是整个序列
26607 Util.each(splitArray, function (subData, splitedIndex) {
26608 if (!Util.isEmpty(subData)) {
26609 cfg.splitedIndex = splitedIndex; // 传入分割片段索引 用于生成id
26610 cfg.points = subData;
26611 var geomShape = shapeFactory.drawShape(cfg.shape, cfg, container);
26612 geomShape.setSilent('index', index + splitedIndex);
26613 geomShape.setSilent('coord', self.get('coord'));
26614
26615 if (self.get('animate') && self.get('animateCfg')) {
26616 geomShape.setSilent('animateCfg', self.get('animateCfg'));
26617 }
26618 }
26619 });
26620 };
26621
26622 return Path;
26623}(GeomBase);
26624
26625module.exports = Path;
26626
26627/***/ }),
26628/* 113 */
26629/***/ (function(module, exports, __webpack_require__) {
26630
26631/**
26632 * @fileOverview 分割数据用于处理存在 null 值的折线图、区域图
26633 * @author dxq613@gmail.com
26634 */
26635
26636var Util = __webpack_require__(0);
26637
26638module.exports = {
26639 splitData: function splitData(data) {
26640 if (!data.length) return [];
26641 var arr = [];
26642 var tmp = [];
26643 var yScale = this.getYScale();
26644 var yDim = yScale.field;
26645 var yValue = void 0;
26646 Util.each(data, function (obj) {
26647 yValue = obj._origin ? obj._origin[yDim] : obj[yDim];
26648 if (Util.isArray(yValue) && Util.isNil(yValue[0]) || Util.isNil(yValue)) {
26649 if (tmp.length) {
26650 arr.push(tmp);
26651 tmp = [];
26652 }
26653 } else {
26654 tmp.push(obj);
26655 }
26656 });
26657 if (tmp.length) {
26658 arr.push(tmp);
26659 }
26660 return arr;
26661 }
26662};
26663
26664/***/ }),
26665/* 114 */
26666/***/ (function(module, exports, __webpack_require__) {
26667
26668/**
26669 * @fileOverview 需要计算所占x轴上的宽度的辅助类
26670 * @author sima.zhang1990@gmail.com
26671 * @author dxq613@gmail.com
26672 */
26673
26674var Global = __webpack_require__(1);
26675var Util = __webpack_require__(0);
26676
26677// 已经排序后的数据查找距离最小的
26678function findMinDistance(arr, scale) {
26679 var count = arr.length;
26680 // 日期类型的 values 经常上文本类型,所以需要转换一下
26681 if (Util.isString(arr[0])) {
26682 arr = arr.map(function (v) {
26683 return scale.translate(v);
26684 });
26685 }
26686 var distance = arr[1] - arr[0];
26687 for (var i = 2; i < count; i++) {
26688 var tmp = arr[i] - arr[i - 1];
26689 if (distance > tmp) {
26690 distance = tmp;
26691 }
26692 }
26693 return distance;
26694}
26695
26696var SizeMixin = {
26697 getDefalutSize: function getDefalutSize() {
26698 var defaultSize = this.get('defaultSize');
26699 if (!defaultSize) {
26700 var coord = this.get('coord');
26701 var xScale = this.getXScale();
26702 var xValues = xScale.values;
26703 var dataArray = this.get('dataArray');
26704 var count = void 0;
26705 if (xScale.isLinear && xValues.length > 1) {
26706 xValues.sort();
26707 var interval = findMinDistance(xValues, xScale);
26708 count = (xScale.max - xScale.min) / interval;
26709 if (xValues.length > count) {
26710 count = xValues.length;
26711 }
26712 } else {
26713 count = xValues.length;
26714 }
26715 var range = xScale.range;
26716 var normalizeSize = 1 / count;
26717 var widthRatio = 1;
26718
26719 if (this.isInCircle()) {
26720 if (coord.isTransposed && count > 1) {
26721 // 极坐标下多层环图
26722 widthRatio = Global.widthRatio.multiplePie;
26723 } else {
26724 widthRatio = Global.widthRatio.rose;
26725 }
26726 /* if (dataArray.length > 1) {
26727 normalizeSize *= (range[1] - range[0]);
26728 } */
26729 } else {
26730 if (xScale.isLinear) {
26731 normalizeSize *= range[1] - range[0];
26732 }
26733 widthRatio = Global.widthRatio.column; // 柱状图要除以2
26734 }
26735 normalizeSize *= widthRatio;
26736 if (this.hasAdjust('dodge')) {
26737 var dodgeCount = this._getDodgeCount(dataArray);
26738 normalizeSize = normalizeSize / dodgeCount;
26739 }
26740 defaultSize = normalizeSize;
26741 this.set('defaultSize', defaultSize);
26742 }
26743 return defaultSize;
26744 },
26745 _getDodgeCount: function _getDodgeCount(dataArray) {
26746 var adjusts = this.get('adjusts');
26747 var dodgeBy = void 0;
26748 var count = dataArray.length;
26749 Util.each(adjusts, function (adjust) {
26750 if (adjust.type === 'dodge') {
26751 dodgeBy = adjust.dodgeBy;
26752 }
26753 });
26754
26755 if (dodgeBy) {
26756 var mergeData = Util.Array.merge(dataArray);
26757 var values = Util.Array.values(mergeData, dodgeBy);
26758 count = values.length;
26759 }
26760
26761 return count;
26762 },
26763 getDimWidth: function getDimWidth(dimName) {
26764 var coord = this.get('coord');
26765 var start = coord.convertPoint({
26766 x: 0,
26767 y: 0
26768 });
26769 var end = coord.convertPoint({
26770 x: dimName === 'x' ? 1 : 0,
26771 y: dimName === 'x' ? 0 : 1
26772 });
26773 var width = 0;
26774 if (start && end) {
26775 width = Math.sqrt(Math.pow(end.x - start.x, 2) + Math.pow(end.y - start.y, 2));
26776 }
26777 return width;
26778 },
26779 _getWidth: function _getWidth() {
26780 var coord = this.get('coord');
26781 var width = void 0; // x轴的长度
26782 if (this.isInCircle() && !coord.isTransposed) {
26783 // 极坐标下 width 为弧长
26784 width = (coord.endAngle - coord.startAngle) * coord.radius;
26785 } else {
26786 width = this.getDimWidth('x'); // 不需要判断transpose
26787 }
26788 return width;
26789 },
26790 _toNormalizedSize: function _toNormalizedSize(size) {
26791 var width = this._getWidth();
26792 return size / width;
26793 },
26794 _toCoordSize: function _toCoordSize(normalizeSize) {
26795 var width = this._getWidth();
26796 return width * normalizeSize;
26797 },
26798 getNormalizedSize: function getNormalizedSize(obj) {
26799 var size = this.getAttrValue('size', obj);
26800 if (Util.isNil(size)) {
26801 size = this.getDefalutSize();
26802 } else {
26803 size = this._toNormalizedSize(size);
26804 }
26805 return size;
26806 },
26807 getSize: function getSize(obj) {
26808 var size = this.getAttrValue('size', obj);
26809 if (Util.isNil(size)) {
26810 var normalizeSize = this.getDefalutSize();
26811 size = this._toCoordSize(normalizeSize);
26812 }
26813 return size;
26814 }
26815};
26816
26817module.exports = SizeMixin;
26818
26819/***/ }),
26820/* 115 */
26821/***/ (function(module, exports, __webpack_require__) {
26822
26823module.exports = {
26824 Scale: __webpack_require__(321),
26825 Coord: __webpack_require__(329),
26826 Axis: __webpack_require__(334),
26827 Guide: __webpack_require__(355),
26828 Legend: __webpack_require__(356),
26829 Tooltip: __webpack_require__(357),
26830 Event: __webpack_require__(358)
26831};
26832
26833/***/ }),
26834/* 116 */
26835/***/ (function(module, exports, __webpack_require__) {
26836
26837/**
26838 * @fileOverview Scale entry, used to reference all the scales
26839 * @author dxq613@gmail.com
26840 */
26841
26842var Util = __webpack_require__(0);
26843var Base = __webpack_require__(41);
26844Base.Linear = __webpack_require__(42);
26845Base.Identity = __webpack_require__(323);
26846Base.Cat = __webpack_require__(118);
26847Base.Time = __webpack_require__(324);
26848Base.TimeCat = __webpack_require__(326);
26849Base.Log = __webpack_require__(327);
26850Base.Pow = __webpack_require__(328);
26851
26852var _loop = function _loop(k) {
26853 if (Base.hasOwnProperty(k)) {
26854 var methodName = Util.lowerFirst(k);
26855 Base[methodName] = function (cfg) {
26856 return new Base[k](cfg);
26857 };
26858 }
26859};
26860
26861for (var k in Base) {
26862 _loop(k);
26863}
26864
26865var CAT_ARR = ['cat', 'timeCat'];
26866
26867Base.isCategory = function (type) {
26868 return CAT_ARR.indexOf(type) >= 0;
26869};
26870
26871module.exports = Base;
26872
26873/***/ }),
26874/* 117 */
26875/***/ (function(module, exports) {
26876
26877/**
26878 * @fileOverview 计算方法
26879 * @author dxq613@gmail.com
26880 */
26881
26882// 如果小数点后面超过 10 位浮点数时进行一下处理
26883var DECIMAL_LENGTH = 12;
26884// 获取系数
26885function getFactor(v) {
26886 var factor = 1;
26887 if (v < 1) {
26888 var count = 0;
26889 while (v < 1) {
26890 factor = factor / 10;
26891 v = v * 10;
26892 count++;
26893 }
26894 // 浮点数计算出现问题
26895 if (factor.toString().length > DECIMAL_LENGTH) {
26896 factor = parseFloat(factor.toFixed(count));
26897 }
26898 } else {
26899 while (v > 10) {
26900 factor = factor * 10;
26901 v = v / 10;
26902 }
26903 }
26904
26905 return factor;
26906}
26907
26908// 取小于当前值的
26909function arrayFloor(values, value) {
26910 var length = values.length;
26911 if (length === 0) {
26912 return NaN;
26913 }
26914
26915 var pre = values[0];
26916
26917 if (value < values[0]) {
26918 return NaN;
26919 }
26920
26921 if (value >= values[length - 1]) {
26922 return values[length - 1];
26923 }
26924 for (var i = 1; i < values.length; i++) {
26925 if (value < values[i]) {
26926 break;
26927 }
26928 pre = values[i];
26929 }
26930
26931 return pre;
26932}
26933
26934// 大于当前值的第一个
26935function arrayCeiling(values, value) {
26936 var length = values.length;
26937 if (length === 0) {
26938 return NaN;
26939 }
26940 // var pre = values[0];
26941 var rst = void 0;
26942 if (value > values[length - 1]) {
26943 return NaN;
26944 }
26945 if (value < values[0]) {
26946 return values[0];
26947 }
26948
26949 for (var i = 1; i < values.length; i++) {
26950 if (value <= values[i]) {
26951 rst = values[i];
26952 break;
26953 }
26954 }
26955
26956 return rst;
26957}
26958
26959var Util = {
26960 // 获取逼近的数值
26961 snapFactorTo: function snapFactorTo(v, arr, snapType) {
26962 // 假设 v = -512,isFloor = true
26963 if (isNaN(v)) {
26964 return NaN;
26965 }
26966 var factor = 1; // 计算系数
26967 if (v !== 0) {
26968 if (v < 0) {
26969 factor = -1;
26970 }
26971 v = v * factor; // v = 512
26972 var tmpFactor = getFactor(v);
26973 factor = factor * tmpFactor; // factor = -100
26974
26975 v = v / tmpFactor; // v = 5.12
26976 }
26977 if (snapType === 'floor') {
26978 v = Util.snapFloor(arr, v); // v = 5
26979 } else if (snapType === 'ceil') {
26980 v = Util.snapCeiling(arr, v); // v = 6
26981 } else {
26982 v = Util.snapTo(arr, v); // 四舍五入 5
26983 }
26984 var rst = v * factor;
26985 // 如果出现浮点数计算问题,需要处理一下
26986 if (Math.abs(factor) < 1 && rst.toString().length > DECIMAL_LENGTH) {
26987 var decimalVal = parseInt(1 / factor);
26988 var symbol = factor > 0 ? 1 : -1;
26989 rst = v / decimalVal * symbol;
26990 }
26991 return rst;
26992 },
26993
26994 // 获取逼近的倍数
26995 snapMultiple: function snapMultiple(v, base, snapType) {
26996 var div = void 0;
26997 if (snapType === 'ceil') {
26998 div = Math.ceil(v / base);
26999 } else if (snapType === 'floor') {
27000 div = Math.floor(v / base);
27001 } else {
27002 div = Math.round(v / base);
27003 }
27004 return div * base;
27005 },
27006
27007 /**
27008 * 获取逼近的值,用于对齐数据
27009 * @param {Array} values 数据集合
27010 * @param {Number} value 数值
27011 * @return {Number} 逼近的值
27012 */
27013 snapTo: function snapTo(values, value) {
27014 // 这里假定values是升序排列
27015 var floorVal = arrayFloor(values, value);
27016 var ceilingVal = arrayCeiling(values, value);
27017 if (isNaN(floorVal) || isNaN(ceilingVal)) {
27018 if (values[0] >= value) {
27019 return values[0];
27020 }
27021 var last = values[values.length - 1];
27022 if (last <= value) {
27023 return last;
27024 }
27025 }
27026 if (Math.abs(value - floorVal) < Math.abs(ceilingVal - value)) {
27027 return floorVal;
27028 }
27029 return ceilingVal;
27030 },
27031
27032 /**
27033 * 获取逼近的最小值,用于对齐数据
27034 * @param {Array} values 数据集合
27035 * @param {Number} value 数值
27036 * @return {Number} 逼近的最小值
27037 */
27038 snapFloor: function snapFloor(values, value) {
27039 // 这里假定values是升序排列
27040 return arrayFloor(values, value);
27041 },
27042
27043 /**
27044 * 获取逼近的最大值,用于对齐数据
27045 * @param {Array} values 数据集合
27046 * @param {Number} value 数值
27047 * @return {Number} 逼近的最大值
27048 */
27049 snapCeiling: function snapCeiling(values, value) {
27050 // 这里假定values是升序排列
27051 return arrayCeiling(values, value);
27052 }
27053};
27054
27055module.exports = Util;
27056
27057/***/ }),
27058/* 118 */
27059/***/ (function(module, exports, __webpack_require__) {
27060
27061function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
27062
27063function _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; }
27064
27065function _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; }
27066
27067/**
27068 * @fileOverview the scale function to process the categories
27069 * @author dxq613@gmail.com
27070 */
27071
27072var Base = __webpack_require__(41);
27073var Util = __webpack_require__(0);
27074var catAuto = __webpack_require__(119);
27075
27076/**
27077 * 度量的构造函数
27078 * @class Scale.Category
27079 */
27080
27081var Category = function (_Base) {
27082 _inherits(Category, _Base);
27083
27084 function Category() {
27085 _classCallCheck(this, Category);
27086
27087 return _possibleConstructorReturn(this, _Base.apply(this, arguments));
27088 }
27089
27090 /**
27091 * @override
27092 */
27093 Category.prototype.getDefaultCfg = function getDefaultCfg() {
27094 var cfg = _Base.prototype.getDefaultCfg.call(this);
27095 return Util.mix({}, cfg, {
27096 /**
27097 * type of the scale
27098 * @type {String}
27099 */
27100 type: 'cat',
27101
27102 /**
27103 * 自动生成标记时的个数
27104 * @type {Number}
27105 * @default null
27106 */
27107 tickCount: null,
27108
27109 /**
27110 * 是否分类度量
27111 * @type {Boolean}
27112 */
27113 isCategory: true
27114 });
27115 };
27116
27117 /**
27118 * @override
27119 */
27120
27121
27122 Category.prototype.init = function init() {
27123 var self = this;
27124 var values = self.values;
27125 var tickCount = self.tickCount;
27126
27127 Util.each(values, function (v, i) {
27128 values[i] = v.toString();
27129 });
27130 if (!self.ticks) {
27131 var ticks = values;
27132 if (tickCount) {
27133 var temp = catAuto({
27134 maxCount: tickCount,
27135 data: values
27136 });
27137 ticks = temp.ticks;
27138 }
27139 this.ticks = ticks;
27140 }
27141 };
27142
27143 /**
27144 * @override
27145 */
27146
27147
27148 Category.prototype.getText = function getText(value) {
27149
27150 if (this.values.indexOf(value) === -1 && Util.isNumber(value)) {
27151 value = this.values[Math.round(value)];
27152 }
27153
27154 return _Base.prototype.getText.call(this, value);
27155 };
27156
27157 /**
27158 * @override
27159 */
27160
27161
27162 Category.prototype.translate = function translate(value) {
27163 var index = this.values.indexOf(value);
27164 if (index === -1 && Util.isNumber(value)) {
27165 index = value;
27166 } else if (index === -1) {
27167 index = NaN;
27168 }
27169 return index;
27170 };
27171 /**
27172 * @override
27173 */
27174
27175
27176 Category.prototype.scale = function scale(value) {
27177 var rangeMin = this.rangeMin();
27178 var rangeMax = this.rangeMax();
27179 var percent = void 0;
27180
27181 if (Util.isString(value) || this.values.indexOf(value) !== -1) {
27182 value = this.translate(value);
27183 }
27184 if (this.values.length > 1) {
27185 percent = value / (this.values.length - 1);
27186 } else {
27187 percent = value;
27188 }
27189 return rangeMin + percent * (rangeMax - rangeMin);
27190 };
27191
27192 /**
27193 * @override
27194 */
27195
27196
27197 Category.prototype.invert = function invert(value) {
27198 if (Util.isString(value)) {
27199 // 如果已经是字符串
27200 return value;
27201 }
27202 var min = this.rangeMin();
27203 var max = this.rangeMax();
27204
27205 // 归一到 范围内
27206 if (value < min) {
27207 value = min;
27208 }
27209 if (value > max) {
27210 value = max;
27211 }
27212 var percent = (value - min) / (max - min);
27213 var index = Math.round(percent * (this.values.length - 1)) % this.values.length;
27214 index = index || 0;
27215 return this.values[index];
27216 };
27217
27218 return Category;
27219}(Base);
27220
27221module.exports = Category;
27222
27223/***/ }),
27224/* 119 */
27225/***/ (function(module, exports, __webpack_require__) {
27226
27227/**
27228 * @fileOverview 计算分类的的坐标点
27229 * @author dxq613@gmail.com
27230 */
27231
27232var Util = __webpack_require__(0);
27233var MAX_COUNT = 8;
27234
27235function getSimpleArray(data) {
27236 var arr = [];
27237 Util.each(data, function (sub) {
27238 if (Util.isArray(sub)) {
27239 arr = arr.concat(sub);
27240 } else {
27241 arr.push(sub);
27242 }
27243 });
27244 return arr;
27245}
27246
27247module.exports = function (info) {
27248 var rst = {};
27249 var ticks = [];
27250 var tickCount = info.maxCount || MAX_COUNT;
27251
27252 var categories = getSimpleArray(info.data);
27253 if (categories.length <= tickCount + tickCount / 2) {
27254 ticks = [].concat(categories);
27255 } else {
27256 var length = categories.length;
27257 var step = parseInt(length / (tickCount - 1), 10);
27258
27259 var groups = categories.map(function (e, i) {
27260 return i % step === 0 ? categories.slice(i, i + step) : null;
27261 }).filter(function (e) {
27262 return e;
27263 });
27264
27265 ticks.push(categories[0]);
27266 for (var i = 1; i < groups.length && i < tickCount - 1; i++) {
27267 ticks.push(groups[i][0]);
27268 }
27269
27270 ticks.push(categories[length - 1]);
27271 }
27272
27273 rst.categories = categories;
27274 rst.ticks = ticks;
27275 return rst;
27276};
27277
27278/***/ }),
27279/* 120 */
27280/***/ (function(module, exports, __webpack_require__) {
27281
27282var __WEBPACK_AMD_DEFINE_RESULT__;(function (main) {
27283 'use strict';
27284
27285 /**
27286 * Parse or format dates
27287 * @class fecha
27288 */
27289
27290 var fecha = {};
27291 var token = /d{1,4}|M{1,4}|YY(?:YY)?|S{1,3}|Do|ZZ|([HhMsDm])\1?|[aA]|"[^"]*"|'[^']*'/g;
27292 var twoDigits = /\d\d?/;
27293 var threeDigits = /\d{3}/;
27294 var fourDigits = /\d{4}/;
27295 var word = /[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i;
27296 var literal = /\[([^]*?)\]/gm;
27297 var noop = function noop() {};
27298
27299 function shorten(arr, sLen) {
27300 var newArr = [];
27301 for (var i = 0, len = arr.length; i < len; i++) {
27302 newArr.push(arr[i].substr(0, sLen));
27303 }
27304 return newArr;
27305 }
27306
27307 function monthUpdate(arrName) {
27308 return function (d, v, i18n) {
27309 var index = i18n[arrName].indexOf(v.charAt(0).toUpperCase() + v.substr(1).toLowerCase());
27310 if (~index) {
27311 d.month = index;
27312 }
27313 };
27314 }
27315
27316 function pad(val, len) {
27317 val = String(val);
27318 len = len || 2;
27319 while (val.length < len) {
27320 val = '0' + val;
27321 }
27322 return val;
27323 }
27324
27325 var dayNames = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
27326 var monthNames = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
27327 var monthNamesShort = shorten(monthNames, 3);
27328 var dayNamesShort = shorten(dayNames, 3);
27329 fecha.i18n = {
27330 dayNamesShort: dayNamesShort,
27331 dayNames: dayNames,
27332 monthNamesShort: monthNamesShort,
27333 monthNames: monthNames,
27334 amPm: ['am', 'pm'],
27335 DoFn: function DoFn(D) {
27336 return D + ['th', 'st', 'nd', 'rd'][D % 10 > 3 ? 0 : (D - D % 10 !== 10) * D % 10];
27337 }
27338 };
27339
27340 var formatFlags = {
27341 D: function D(dateObj) {
27342 return dateObj.getDate();
27343 },
27344 DD: function DD(dateObj) {
27345 return pad(dateObj.getDate());
27346 },
27347 Do: function Do(dateObj, i18n) {
27348 return i18n.DoFn(dateObj.getDate());
27349 },
27350 d: function d(dateObj) {
27351 return dateObj.getDay();
27352 },
27353 dd: function dd(dateObj) {
27354 return pad(dateObj.getDay());
27355 },
27356 ddd: function ddd(dateObj, i18n) {
27357 return i18n.dayNamesShort[dateObj.getDay()];
27358 },
27359 dddd: function dddd(dateObj, i18n) {
27360 return i18n.dayNames[dateObj.getDay()];
27361 },
27362 M: function M(dateObj) {
27363 return dateObj.getMonth() + 1;
27364 },
27365 MM: function MM(dateObj) {
27366 return pad(dateObj.getMonth() + 1);
27367 },
27368 MMM: function MMM(dateObj, i18n) {
27369 return i18n.monthNamesShort[dateObj.getMonth()];
27370 },
27371 MMMM: function MMMM(dateObj, i18n) {
27372 return i18n.monthNames[dateObj.getMonth()];
27373 },
27374 YY: function YY(dateObj) {
27375 return String(dateObj.getFullYear()).substr(2);
27376 },
27377 YYYY: function YYYY(dateObj) {
27378 return dateObj.getFullYear();
27379 },
27380 h: function h(dateObj) {
27381 return dateObj.getHours() % 12 || 12;
27382 },
27383 hh: function hh(dateObj) {
27384 return pad(dateObj.getHours() % 12 || 12);
27385 },
27386 H: function H(dateObj) {
27387 return dateObj.getHours();
27388 },
27389 HH: function HH(dateObj) {
27390 return pad(dateObj.getHours());
27391 },
27392 m: function m(dateObj) {
27393 return dateObj.getMinutes();
27394 },
27395 mm: function mm(dateObj) {
27396 return pad(dateObj.getMinutes());
27397 },
27398 s: function s(dateObj) {
27399 return dateObj.getSeconds();
27400 },
27401 ss: function ss(dateObj) {
27402 return pad(dateObj.getSeconds());
27403 },
27404 S: function S(dateObj) {
27405 return Math.round(dateObj.getMilliseconds() / 100);
27406 },
27407 SS: function SS(dateObj) {
27408 return pad(Math.round(dateObj.getMilliseconds() / 10), 2);
27409 },
27410 SSS: function SSS(dateObj) {
27411 return pad(dateObj.getMilliseconds(), 3);
27412 },
27413 a: function a(dateObj, i18n) {
27414 return dateObj.getHours() < 12 ? i18n.amPm[0] : i18n.amPm[1];
27415 },
27416 A: function A(dateObj, i18n) {
27417 return dateObj.getHours() < 12 ? i18n.amPm[0].toUpperCase() : i18n.amPm[1].toUpperCase();
27418 },
27419 ZZ: function ZZ(dateObj) {
27420 var o = dateObj.getTimezoneOffset();
27421 return (o > 0 ? '-' : '+') + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4);
27422 }
27423 };
27424
27425 var parseFlags = {
27426 D: [twoDigits, function (d, v) {
27427 d.day = v;
27428 }],
27429 Do: [new RegExp(twoDigits.source + word.source), function (d, v) {
27430 d.day = parseInt(v, 10);
27431 }],
27432 M: [twoDigits, function (d, v) {
27433 d.month = v - 1;
27434 }],
27435 YY: [twoDigits, function (d, v) {
27436 var da = new Date(),
27437 cent = +('' + da.getFullYear()).substr(0, 2);
27438 d.year = '' + (v > 68 ? cent - 1 : cent) + v;
27439 }],
27440 h: [twoDigits, function (d, v) {
27441 d.hour = v;
27442 }],
27443 m: [twoDigits, function (d, v) {
27444 d.minute = v;
27445 }],
27446 s: [twoDigits, function (d, v) {
27447 d.second = v;
27448 }],
27449 YYYY: [fourDigits, function (d, v) {
27450 d.year = v;
27451 }],
27452 S: [/\d/, function (d, v) {
27453 d.millisecond = v * 100;
27454 }],
27455 SS: [/\d{2}/, function (d, v) {
27456 d.millisecond = v * 10;
27457 }],
27458 SSS: [threeDigits, function (d, v) {
27459 d.millisecond = v;
27460 }],
27461 d: [twoDigits, noop],
27462 ddd: [word, noop],
27463 MMM: [word, monthUpdate('monthNamesShort')],
27464 MMMM: [word, monthUpdate('monthNames')],
27465 a: [word, function (d, v, i18n) {
27466 var val = v.toLowerCase();
27467 if (val === i18n.amPm[0]) {
27468 d.isPm = false;
27469 } else if (val === i18n.amPm[1]) {
27470 d.isPm = true;
27471 }
27472 }],
27473 ZZ: [/([\+\-]\d\d:?\d\d|Z)/, function (d, v) {
27474 if (v === 'Z') v = '+00:00';
27475 var parts = (v + '').match(/([\+\-]|\d\d)/gi),
27476 minutes;
27477
27478 if (parts) {
27479 minutes = +(parts[1] * 60) + parseInt(parts[2], 10);
27480 d.timezoneOffset = parts[0] === '+' ? minutes : -minutes;
27481 }
27482 }]
27483 };
27484 parseFlags.dd = parseFlags.d;
27485 parseFlags.dddd = parseFlags.ddd;
27486 parseFlags.DD = parseFlags.D;
27487 parseFlags.mm = parseFlags.m;
27488 parseFlags.hh = parseFlags.H = parseFlags.HH = parseFlags.h;
27489 parseFlags.MM = parseFlags.M;
27490 parseFlags.ss = parseFlags.s;
27491 parseFlags.A = parseFlags.a;
27492
27493 // Some common format strings
27494 fecha.masks = {
27495 default: 'ddd MMM DD YYYY HH:mm:ss',
27496 shortDate: 'M/D/YY',
27497 mediumDate: 'MMM D, YYYY',
27498 longDate: 'MMMM D, YYYY',
27499 fullDate: 'dddd, MMMM D, YYYY',
27500 shortTime: 'HH:mm',
27501 mediumTime: 'HH:mm:ss',
27502 longTime: 'HH:mm:ss.SSS'
27503 };
27504
27505 /***
27506 * Format a date
27507 * @method format
27508 * @param {Date|number} dateObj
27509 * @param {string} mask Format of the date, i.e. 'mm-dd-yy' or 'shortDate'
27510 */
27511 fecha.format = function (dateObj, mask, i18nSettings) {
27512 var i18n = i18nSettings || fecha.i18n;
27513
27514 if (typeof dateObj === 'number') {
27515 dateObj = new Date(dateObj);
27516 }
27517
27518 if (Object.prototype.toString.call(dateObj) !== '[object Date]' || isNaN(dateObj.getTime())) {
27519 throw new Error('Invalid Date in fecha.format');
27520 }
27521
27522 mask = fecha.masks[mask] || mask || fecha.masks['default'];
27523
27524 var literals = [];
27525
27526 // Make literals inactive by replacing them with ??
27527 mask = mask.replace(literal, function ($0, $1) {
27528 literals.push($1);
27529 return '??';
27530 });
27531 // Apply formatting rules
27532 mask = mask.replace(token, function ($0) {
27533 return $0 in formatFlags ? formatFlags[$0](dateObj, i18n) : $0.slice(1, $0.length - 1);
27534 });
27535 // Inline literal values back into the formatted value
27536 return mask.replace(/\?\?/g, function () {
27537 return literals.shift();
27538 });
27539 };
27540
27541 /**
27542 * Parse a date string into an object, changes - into /
27543 * @method parse
27544 * @param {string} dateStr Date string
27545 * @param {string} format Date parse format
27546 * @returns {Date|boolean}
27547 */
27548 fecha.parse = function (dateStr, format, i18nSettings) {
27549 var i18n = i18nSettings || fecha.i18n;
27550
27551 if (typeof format !== 'string') {
27552 throw new Error('Invalid format in fecha.parse');
27553 }
27554
27555 format = fecha.masks[format] || format;
27556
27557 // Avoid regular expression denial of service, fail early for really long strings
27558 // https://www.owasp.org/index.php/Regular_expression_Denial_of_Service_-_ReDoS
27559 if (dateStr.length > 1000) {
27560 return false;
27561 }
27562
27563 var isValid = true;
27564 var dateInfo = {};
27565 format.replace(token, function ($0) {
27566 if (parseFlags[$0]) {
27567 var info = parseFlags[$0];
27568 var index = dateStr.search(info[0]);
27569 if (!~index) {
27570 isValid = false;
27571 } else {
27572 dateStr.replace(info[0], function (result) {
27573 info[1](dateInfo, result, i18n);
27574 dateStr = dateStr.substr(index + result.length);
27575 return result;
27576 });
27577 }
27578 }
27579
27580 return parseFlags[$0] ? '' : $0.slice(1, $0.length - 1);
27581 });
27582
27583 if (!isValid) {
27584 return false;
27585 }
27586
27587 var today = new Date();
27588 if (dateInfo.isPm === true && dateInfo.hour != null && +dateInfo.hour !== 12) {
27589 dateInfo.hour = +dateInfo.hour + 12;
27590 } else if (dateInfo.isPm === false && +dateInfo.hour === 12) {
27591 dateInfo.hour = 0;
27592 }
27593
27594 var date;
27595 if (dateInfo.timezoneOffset != null) {
27596 dateInfo.minute = +(dateInfo.minute || 0) - +dateInfo.timezoneOffset;
27597 date = new Date(Date.UTC(dateInfo.year || today.getFullYear(), dateInfo.month || 0, dateInfo.day || 1, dateInfo.hour || 0, dateInfo.minute || 0, dateInfo.second || 0, dateInfo.millisecond || 0));
27598 } else {
27599 date = new Date(dateInfo.year || today.getFullYear(), dateInfo.month || 0, dateInfo.day || 1, dateInfo.hour || 0, dateInfo.minute || 0, dateInfo.second || 0, dateInfo.millisecond || 0);
27600 }
27601 return date;
27602 };
27603
27604 /* istanbul ignore next */
27605 if (typeof module !== 'undefined' && module.exports) {
27606 module.exports = fecha;
27607 } else if (true) {
27608 !(__WEBPACK_AMD_DEFINE_RESULT__ = (function () {
27609 return fecha;
27610 }).call(exports, __webpack_require__, exports, module),
27611 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
27612 } else {
27613 main.fecha = fecha;
27614 }
27615})(this);
27616
27617/***/ }),
27618/* 121 */
27619/***/ (function(module, exports, __webpack_require__) {
27620
27621/**
27622 * @fileOverview 提取公共代码到util方法
27623 * @author dxq613@gmail.com
27624 */
27625
27626var Util = __webpack_require__(0);
27627
27628module.exports = {
27629 toTimeStamp: function toTimeStamp(value) {
27630 if (Util.isString(value)) {
27631 if (value.indexOf('T') > 0) {
27632 value = new Date(value).getTime();
27633 } else {
27634 value = new Date(value.replace(/-/ig, '/')).getTime();
27635 }
27636 }
27637 if (Util.isDate(value)) {
27638 value = value.getTime();
27639 }
27640 return value;
27641 }
27642};
27643
27644/***/ }),
27645/* 122 */
27646/***/ (function(module, exports, __webpack_require__) {
27647
27648function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
27649
27650function _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; }
27651
27652function _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; }
27653
27654/**
27655 * @fileOverview The base class of legend
27656 * @author sima.zhang
27657 */
27658var Util = __webpack_require__(0);
27659var Global = __webpack_require__(1);
27660
27661var _require = __webpack_require__(2),
27662 Group = _require.Group;
27663
27664var Base = function (_Group) {
27665 _inherits(Base, _Group);
27666
27667 function Base() {
27668 _classCallCheck(this, Base);
27669
27670 return _possibleConstructorReturn(this, _Group.apply(this, arguments));
27671 }
27672
27673 Base.prototype.getDefaultCfg = function getDefaultCfg() {
27674 return {
27675 /**
27676 * 图例标题配置
27677 * @type {Object}
27678 */
27679 title: {
27680 fill: '#333',
27681 textBaseline: 'middle'
27682 },
27683 /**
27684 * 图例项文本格式化
27685 * @type {Function}
27686 */
27687 itemFormatter: null,
27688 /**
27689 * 是否使用 html 进行渲染
27690 * @type {Boolean}
27691 */
27692 useHtml: false,
27693 /**
27694 * 图例是否绘制在绘图区域内
27695 * @type {Boolean}
27696 */
27697 inPlot: false,
27698 /**
27699 * 鼠标 hover 到图例上的默认交互是否开启
27700 * @type {Boolean}
27701 */
27702 hoverable: true
27703 };
27704 };
27705
27706 Base.prototype._beforeRenderUI = function _beforeRenderUI() {
27707 this.set('itemsGroup', this.addGroup());
27708 };
27709
27710 Base.prototype._renderUI = function _renderUI() {
27711 this._renderTitle();
27712 };
27713
27714 Base.prototype._renderTitle = function _renderTitle() {
27715 var title = this.get('title');
27716 if (title && title.text) {
27717 var titleShape = this.addShape('text', {
27718 attrs: Util.mix({
27719 x: 0,
27720 y: 0,
27721 fill: '#333', // 默认样式
27722 textBaseline: 'middle',
27723 fontFamily: Global.fontFamily
27724 }, title)
27725 });
27726 titleShape.name = 'legend-title';
27727 this.get('appendInfo') && titleShape.setSilent('appendInfo', this.get('appendInfo'));
27728 this.set('titleShape', titleShape);
27729 }
27730 };
27731
27732 Base.prototype.getCheckedCount = function getCheckedCount() {
27733 var itemsGroup = this.get('itemsGroup');
27734 var items = itemsGroup.get('children');
27735 var checkedArr = Util.filter(items, function (item) {
27736 return item.get('checked');
27737 });
27738 return checkedArr.length;
27739 };
27740
27741 Base.prototype.setItems = function setItems(items) {
27742 this.set('items', items);
27743 this.clearItems();
27744 this._renderUI();
27745 };
27746
27747 Base.prototype.addItem = function addItem(item) {
27748 var items = this.get('items');
27749 items.push(item);
27750 this.clearItems();
27751 this._renderUI();
27752 };
27753
27754 Base.prototype.clearItems = function clearItems() {
27755 var itemsGroup = this.get('itemsGroup');
27756 itemsGroup.clear();
27757 };
27758
27759 Base.prototype.getWidth = function getWidth() {
27760 var bbox = this.getBBox();
27761 return bbox.width;
27762 };
27763
27764 Base.prototype.getHeight = function getHeight() {
27765 var bbox = this.getBBox();
27766 return bbox.height;
27767 };
27768
27769 return Base;
27770}(Group);
27771
27772module.exports = Base;
27773
27774/***/ }),
27775/* 123 */
27776/***/ (function(module, exports, __webpack_require__) {
27777
27778function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
27779
27780function _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; }
27781
27782function _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; }
27783
27784/**
27785 * @fileOverview The base class of continuous legend
27786 * @author sima.zhang
27787 */
27788var Util = __webpack_require__(0);
27789var Global = __webpack_require__(1);
27790var Base = __webpack_require__(122);
27791
27792var _require = __webpack_require__(2),
27793 Event = _require.Event,
27794 Group = _require.Group;
27795
27796var Slider = __webpack_require__(351);
27797var TRIGGER_WIDTH = 12;
27798
27799var Continuous = function (_Base) {
27800 _inherits(Continuous, _Base);
27801
27802 function Continuous() {
27803 _classCallCheck(this, Continuous);
27804
27805 return _possibleConstructorReturn(this, _Base.apply(this, arguments));
27806 }
27807
27808 Continuous.prototype.getDefaultCfg = function getDefaultCfg() {
27809 var cfg = _Base.prototype.getDefaultCfg.call(this);
27810 return Util.mix({}, cfg, {
27811 /**
27812 * 类型
27813 * @type {String}
27814 */
27815 type: 'continuous-legend',
27816 /**
27817 * 子项
27818 * @type {Array}
27819 */
27820 items: null,
27821 /**
27822 * 布局方式
27823 * horizontal 水平
27824 * vertical 垂直
27825 * @type {String}
27826 */
27827 layout: 'vertical',
27828 /**
27829 * 宽度
27830 * @type {Number}
27831 */
27832 width: 156,
27833 /**
27834 * 高度
27835 * @type {Number}
27836 */
27837 height: 20,
27838 /**
27839 * 标题偏移量
27840 * @type {Number}
27841 */
27842 titleGap: 22,
27843 /**
27844 * 默认文本图形属性
27845 * @type {ATTRS}
27846 */
27847 textStyle: {
27848 fill: '#333',
27849 textAlign: 'center',
27850 textBaseline: 'middle',
27851 fontFamily: Global.fontFamily
27852 },
27853 /**
27854 * 连续图例是否可滑动
27855 * @type {Boolean}
27856 */
27857 slidable: true,
27858 /**
27859 * 范围内颜色
27860 * @type {ATTRS}
27861 */
27862 inRange: {
27863 fill: '#4E7CCC'
27864 },
27865 _range: [0, 100],
27866 /**
27867 * 中滑块属性
27868 * @type {ATTRS}
27869 */
27870 middleAttr: {
27871 fill: '#fff',
27872 fillOpacity: 0
27873 },
27874 outRangeStyle: {
27875 fill: '#D9D9D9'
27876 },
27877 labelOffset: 10 // ToDO: 文本同渐变背景的距离
27878 });
27879 };
27880
27881 Continuous.prototype._calStartPoint = function _calStartPoint() {
27882 var start = {
27883 x: 0,
27884 y: this.get('titleGap') - TRIGGER_WIDTH
27885 };
27886 var titleShape = this.get('titleShape');
27887 if (titleShape) {
27888 var titleBox = titleShape.getBBox();
27889 start.y += titleBox.height;
27890 }
27891
27892 return start;
27893 };
27894
27895 Continuous.prototype._beforeRenderUI = function _beforeRenderUI() {
27896 var items = this.get('items');
27897 if (!Util.isArray(items) || Util.isEmpty(items)) {
27898 return;
27899 }
27900
27901 _Base.prototype._beforeRenderUI.call(this);
27902 this.set('firstItem', items[0]);
27903 this.set('lastItem', items[items.length - 1]);
27904 };
27905
27906 Continuous.prototype._formatItemValue = function _formatItemValue(value) {
27907 var formatter = this.get('itemFormatter');
27908 if (formatter) {
27909 value = formatter.call(this, value);
27910 }
27911 return value;
27912 };
27913
27914 Continuous.prototype._renderUI = function _renderUI() {
27915 _Base.prototype._renderUI.call(this);
27916
27917 if (this.get('slidable')) {
27918 this._renderSlider();
27919 } else {
27920 this._renderBackground();
27921 }
27922 };
27923
27924 Continuous.prototype._renderSlider = function _renderSlider() {
27925 var minHandleElement = new Group();
27926 var maxHandleElement = new Group();
27927 var backgroundElement = new Group();
27928 var start = this._calStartPoint();
27929 var slider = this.addGroup(Slider, {
27930 minHandleElement: minHandleElement,
27931 maxHandleElement: maxHandleElement,
27932 backgroundElement: backgroundElement,
27933 middleAttr: this.get('middleAttr'),
27934 layout: this.get('layout'),
27935 range: this.get('_range'),
27936 width: this.get('width'),
27937 height: this.get('height')
27938 });
27939 slider.translate(start.x, start.y);
27940 this.set('slider', slider);
27941
27942 var shape = this._renderSliderShape();
27943 shape.attr('clip', slider.get('middleHandleElement'));
27944 this._renderTrigger();
27945 };
27946
27947 Continuous.prototype._addBackground = function _addBackground(parent, name, attrs) {
27948 parent.addShape(name, {
27949 attrs: Util.mix({}, attrs, this.get('outRangeStyle'))
27950 });
27951 return parent.addShape(name, {
27952 attrs: attrs
27953 });
27954 };
27955
27956 Continuous.prototype._renderTrigger = function _renderTrigger() {
27957 var min = this.get('firstItem');
27958 var max = this.get('lastItem');
27959 var layout = this.get('layout');
27960 var textStyle = this.get('textStyle');
27961 var inRange = this.get('inRange');
27962 var attrType = this.get('type');
27963 var minBlockAttr = void 0;
27964 var maxBlockAttr = void 0;
27965
27966 if (attrType === 'color-legend') {
27967 minBlockAttr = {
27968 fill: min.attrValue
27969 };
27970 maxBlockAttr = {
27971 fill: max.attrValue
27972 };
27973 } else {
27974 minBlockAttr = Util.mix({}, inRange);
27975 maxBlockAttr = Util.mix({}, inRange);
27976 }
27977 var minTextAttr = Util.mix({
27978 text: this._formatItemValue(min.value) + ''
27979 }, textStyle);
27980 var maxTextAttr = Util.mix({
27981 text: this._formatItemValue(max.value) + ''
27982 }, textStyle);
27983 if (layout === 'vertical') {
27984 this._addVerticalTrigger('min', minBlockAttr, minTextAttr);
27985 this._addVerticalTrigger('max', maxBlockAttr, maxTextAttr);
27986 } else {
27987 this._addHorizontalTrigger('min', minBlockAttr, minTextAttr);
27988 this._addHorizontalTrigger('max', maxBlockAttr, maxTextAttr);
27989 }
27990 };
27991
27992 Continuous.prototype._addVerticalTrigger = function _addVerticalTrigger(type, blockAttr, textAttr) {
27993 var slider = this.get('slider');
27994 var trigger = slider.get(type + 'HandleElement');
27995 var width = this.get('width');
27996 var button = trigger.addShape('polygon', {
27997 attrs: Util.mix({
27998 points: [[width / 2 + TRIGGER_WIDTH, 0], [width / 2 + 1, 0], [width / 2 + TRIGGER_WIDTH, type === 'min' ? TRIGGER_WIDTH : -TRIGGER_WIDTH]]
27999 }, blockAttr)
28000 });
28001 var text = trigger.addShape('text', {
28002 attrs: Util.mix(textAttr, {
28003 x: width + 8,
28004 y: type === 'max' ? -4 : 4,
28005 textAlign: 'start',
28006 lineHeight: 1,
28007 textBaseline: 'middle'
28008 })
28009 });
28010 var layout = this.get('layout');
28011 var trigerCursor = layout === 'vertical' ? 'ns-resize' : 'ew-resize';
28012 button.attr('cursor', trigerCursor);
28013 text.attr('cursor', trigerCursor);
28014 this.set(type + 'ButtonElement', button);
28015 this.set(type + 'TextElement', text);
28016 };
28017
28018 Continuous.prototype._addHorizontalTrigger = function _addHorizontalTrigger(type, blockAttr, textAttr) {
28019 var slider = this.get('slider');
28020 var trigger = slider.get(type + 'HandleElement');
28021 var button = trigger.addShape('polygon', {
28022 attrs: Util.mix({
28023 points: [[0, 0], [0, TRIGGER_WIDTH], [type === 'min' ? -TRIGGER_WIDTH : TRIGGER_WIDTH, TRIGGER_WIDTH]]
28024 }, blockAttr)
28025 });
28026 var text = trigger.addShape('text', {
28027 attrs: Util.mix(textAttr, {
28028 x: type === 'min' ? -TRIGGER_WIDTH - 4 : TRIGGER_WIDTH + 4,
28029 y: TRIGGER_WIDTH / 2,
28030 textAlign: type === 'min' ? 'end' : 'start',
28031 textBaseline: 'middle'
28032 })
28033 });
28034 var layout = this.get('layout');
28035 var trigerCursor = layout === 'vertical' ? 'ns-resize' : 'ew-resize';
28036 button.attr('cursor', trigerCursor);
28037 text.attr('cursor', trigerCursor);
28038 this.set(type + 'ButtonElement', button);
28039 this.set(type + 'TextElement', text);
28040 };
28041
28042 Continuous.prototype._bindUI = function _bindUI() {
28043 var self = this;
28044 if (self.get('slidable')) {
28045 // const canvas = self.get('canvas');
28046 var slider = self.get('slider');
28047 slider.on('sliderchange', function (ev) {
28048 var range = ev.range;
28049 var firstItemValue = self.get('firstItem').value * 1;
28050 var lastItemValue = self.get('lastItem').value * 1;
28051 var minValue = firstItemValue + range[0] / 100 * (lastItemValue - firstItemValue);
28052 var maxValue = firstItemValue + range[1] / 100 * (lastItemValue - firstItemValue);
28053 self._updateElement(minValue, maxValue);
28054 var itemFiltered = new Event('itemfilter', ev, true, true);
28055 itemFiltered.range = [minValue, maxValue];
28056 self.emit('itemfilter', itemFiltered);
28057 });
28058 }
28059 };
28060
28061 Continuous.prototype._updateElement = function _updateElement(min, max) {
28062 var minTextElement = this.get('minTextElement');
28063 var maxTextElement = this.get('maxTextElement');
28064 if (max > 1) {
28065 // 对于大于 1 的值,默认显示为整数
28066 min = parseInt(min, 10);
28067 max = parseInt(max, 10);
28068 }
28069 minTextElement.attr('text', this._formatItemValue(min) + '');
28070 maxTextElement.attr('text', this._formatItemValue(max) + '');
28071 if (this.get('type') === 'color-legend' && this.get('attr')) {
28072 var attr = this.get('attr'); // 图形属性,为了更新滑块颜色
28073 var minButtonElement = this.get('minButtonElement');
28074 var maxButtonElement = this.get('maxButtonElement');
28075 minButtonElement.attr('fill', attr.mapping(min).join(''));
28076 maxButtonElement.attr('fill', attr.mapping(max).join(''));
28077 }
28078 };
28079
28080 return Continuous;
28081}(Base);
28082
28083module.exports = Continuous;
28084
28085/***/ }),
28086/* 124 */
28087/***/ (function(module, exports, __webpack_require__) {
28088
28089function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
28090
28091function _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; }
28092
28093function _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; }
28094
28095/**
28096 * @fileOverview 分面的基类
28097 * @author dxq613@gmail.com
28098 */
28099
28100var Base = __webpack_require__(45);
28101
28102/**
28103 * 矩形的 facet 有以下属性:
28104 * - colField 列的字段
28105 * - rowField 行的字段
28106 * - colValue 列字段的值
28107 * - rowValue 行字段的值
28108 * - cols 列数
28109 * - rows 行数
28110 * - colIndex 列的序号
28111 * - rowIndex 行的序号
28112 */
28113
28114/**
28115 * 用于生成分面的类
28116 * @class Facets.Rect
28117 */
28118
28119var Rect = function (_Base) {
28120 _inherits(Rect, _Base);
28121
28122 function Rect() {
28123 _classCallCheck(this, Rect);
28124
28125 return _possibleConstructorReturn(this, _Base.apply(this, arguments));
28126 }
28127
28128 Rect.prototype.getDefaultCfg = function getDefaultCfg() {
28129 var cfg = _Base.prototype.getDefaultCfg.call(this);
28130 cfg.type = 'rect';
28131 return cfg;
28132 };
28133
28134 Rect.prototype.generateFacets = function generateFacets(data) {
28135 var self = this;
28136 var fields = self.fields;
28137 // var defs = self.defs;
28138 var rst = [];
28139 var rows = 1;
28140 var cols = 1;
28141 var colField = fields[0];
28142 var rowField = fields[1];
28143 var colValues = [''];
28144 var rowValues = [''];
28145 if (colField) {
28146 colValues = self.getFieldValues(colField, data);
28147 cols = colValues.length;
28148 }
28149 if (rowField) {
28150 rowValues = self.getFieldValues(rowField, data);
28151 rows = rowValues.length;
28152 }
28153
28154 // 获取每个维度对应的frame
28155 colValues.forEach(function (xVal, xIndex) {
28156 rowValues.forEach(function (yVal, yIndex) {
28157 var conditions = [{ field: colField, value: xVal, values: colValues }, { field: rowField, value: yVal, values: rowValues }];
28158 var filter = self.getFilter(conditions);
28159 var subData = data.filter(filter);
28160 var facet = {
28161 type: self.type,
28162 colValue: xVal,
28163 rowValue: yVal,
28164 colField: colField,
28165 rowField: rowField,
28166 colIndex: xIndex,
28167 rowIndex: yIndex,
28168 cols: cols,
28169 rows: rows,
28170 data: subData,
28171 region: self.getRegion(rows, cols, xIndex, yIndex)
28172 };
28173 rst.push(facet);
28174 });
28175 });
28176
28177 return rst;
28178 };
28179
28180 // 设置 x 坐标轴的文本、title 是否显示
28181
28182
28183 Rect.prototype.setXAxis = function setXAxis(xField, axes, facet) {
28184 if (facet.rowIndex !== facet.rows - 1) {
28185 axes[xField].title = null;
28186 axes[xField].label = null;
28187 } else if (facet.colIndex !== parseInt((facet.cols - 1) / 2)) {
28188 axes[xField].title = null;
28189 }
28190 };
28191 // 设置 y 坐标轴的文本、title 是否显示
28192
28193
28194 Rect.prototype.setYAxis = function setYAxis(yField, axes, facet) {
28195 if (facet.colIndex !== 0) {
28196 axes[yField].title = null;
28197 axes[yField].label = null;
28198 } else if (facet.rowIndex !== parseInt((facet.rows - 1) / 2)) {
28199 axes[yField].title = null;
28200 }
28201 };
28202
28203 Rect.prototype.renderTitle = function renderTitle(view, facet) {
28204 if (facet.rowIndex === 0) {
28205 this.drawColTitle(view, facet);
28206 }
28207 if (facet.colIndex === facet.cols - 1) {
28208 this.drawRowTitle(view, facet);
28209 }
28210 };
28211
28212 return Rect;
28213}(Base);
28214
28215module.exports = Rect;
28216
28217/***/ }),
28218/* 125 */
28219/***/ (function(module, exports, __webpack_require__) {
28220
28221function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
28222
28223function _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; }
28224
28225function _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; }
28226
28227/**
28228 * @fileOverview list facets, support cols
28229 */
28230
28231var Base = __webpack_require__(45);
28232
28233/**
28234 * 用于生成分面的类
28235 * @class Facets.List
28236 */
28237
28238var List = function (_Base) {
28239 _inherits(List, _Base);
28240
28241 function List() {
28242 _classCallCheck(this, List);
28243
28244 return _possibleConstructorReturn(this, _Base.apply(this, arguments));
28245 }
28246
28247 List.prototype.getDefaultCfg = function getDefaultCfg() {
28248 var cfg = _Base.prototype.getDefaultCfg.call(this);
28249 cfg.type = 'list';
28250 cfg.cols = null; // 用户不设置时就显示一行
28251 return cfg;
28252 };
28253
28254 List.prototype.generateFacets = function generateFacets(data) {
28255 var self = this;
28256 var fields = self.fields;
28257 var colField = fields[0];
28258 if (!colField) {
28259 throw 'Please specify for the field for facet!';
28260 }
28261 var colValues = self.getFieldValues(colField, data);
28262 var count = colValues.length;
28263 var cols = self.cols || count;
28264 var rows = parseInt((count + cols - 1) / cols);
28265 var rst = [];
28266 colValues.forEach(function (xVal, index) {
28267 var row = parseInt(index / cols);
28268 var col = index % cols;
28269 var conditions = [{ field: colField, value: xVal, values: colValues }];
28270 var filter = self.getFilter(conditions);
28271 var subData = data.filter(filter);
28272 var facet = {
28273 type: self.type,
28274 count: count,
28275 colValue: xVal,
28276 colField: colField,
28277 rowField: null,
28278 rowValue: xVal,
28279 colIndex: col,
28280 rowIndex: row,
28281 cols: cols,
28282 rows: rows,
28283 data: subData,
28284 region: self.getRegion(rows, cols, col, row)
28285 };
28286 rst.push(facet);
28287 });
28288 return rst;
28289 };
28290
28291 // 设置 x 坐标轴的文本、title 是否显示
28292
28293
28294 List.prototype.setXAxis = function setXAxis(xField, axes, facet) {
28295 // 当是最后一行或者下面没有 view 时文本不显示
28296 if (facet.rowIndex !== facet.rows - 1 && facet.cols * facet.rowIndex + facet.colIndex + 1 + facet.cols <= facet.count) {
28297 axes[xField].label = null;
28298 axes[xField].title = null;
28299 }
28300 };
28301
28302 // 设置 y 坐标轴的文本、title 是否显示
28303
28304
28305 List.prototype.setYAxis = function setYAxis(yField, axes, facet) {
28306 if (facet.colIndex !== 0) {
28307 axes[yField].title = null;
28308 axes[yField].label = null;
28309 }
28310 };
28311
28312 return List;
28313}(Base);
28314
28315module.exports = List;
28316
28317/***/ }),
28318/* 126 */
28319/***/ (function(module, exports, __webpack_require__) {
28320
28321var G = __webpack_require__(2);
28322var Animate = __webpack_require__(68);
28323var Chart = __webpack_require__(282);
28324var Global = __webpack_require__(1);
28325var Scale = __webpack_require__(116);
28326var Shape = __webpack_require__(66);
28327var Util = __webpack_require__(0);
28328
28329var G2 = {
28330 // version
28331 version: Global.version,
28332 // visual encoding
28333 Animate: Animate,
28334 Chart: Chart,
28335 Global: Global,
28336 Scale: Scale,
28337 Shape: Shape,
28338 Util: Util,
28339 // render engine
28340 G: G,
28341 DomUtil: G.DomUtil,
28342 MatrixUtil: G.MatrixUtil,
28343 PathUtil: G.PathUtil
28344};
28345
28346G2.track = function (enable) {
28347 Global.trackable = enable;
28348};
28349__webpack_require__(365);
28350
28351// 保证两个版本共存
28352if (typeof window !== 'undefined') {
28353 if (window.G2) {
28354 console.warn('There are multiple versions of G2. Version ' + G2.version + '\'s reference is \'window.G2_3\'');
28355 } else {
28356 window.G2 = G2;
28357 }
28358}
28359
28360module.exports = G2;
28361
28362/***/ }),
28363/* 127 */
28364/***/ (function(module, exports, __webpack_require__) {
28365
28366module.exports = __webpack_require__(128);
28367
28368/***/ }),
28369/* 128 */
28370/***/ (function(module, exports, __webpack_require__) {
28371
28372var arrayEach = __webpack_require__(69),
28373 baseEach = __webpack_require__(27),
28374 castFunction = __webpack_require__(141),
28375 isArray = __webpack_require__(3);
28376
28377/**
28378 * Iterates over elements of `collection` and invokes `iteratee` for each element.
28379 * The iteratee is invoked with three arguments: (value, index|key, collection).
28380 * Iteratee functions may exit iteration early by explicitly returning `false`.
28381 *
28382 * **Note:** As with other "Collections" methods, objects with a "length"
28383 * property are iterated like arrays. To avoid this behavior use `_.forIn`
28384 * or `_.forOwn` for object iteration.
28385 *
28386 * @static
28387 * @memberOf _
28388 * @since 0.1.0
28389 * @alias each
28390 * @category Collection
28391 * @param {Array|Object} collection The collection to iterate over.
28392 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
28393 * @returns {Array|Object} Returns `collection`.
28394 * @see _.forEachRight
28395 * @example
28396 *
28397 * _.forEach([1, 2], function(value) {
28398 * console.log(value);
28399 * });
28400 * // => Logs `1` then `2`.
28401 *
28402 * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
28403 * console.log(key);
28404 * });
28405 * // => Logs 'a' then 'b' (iteration order is not guaranteed).
28406 */
28407function forEach(collection, iteratee) {
28408 var func = isArray(collection) ? arrayEach : baseEach;
28409 return func(collection, castFunction(iteratee));
28410}
28411
28412module.exports = forEach;
28413
28414/***/ }),
28415/* 129 */
28416/***/ (function(module, exports, __webpack_require__) {
28417
28418var baseFor = __webpack_require__(130),
28419 keys = __webpack_require__(11);
28420
28421/**
28422 * The base implementation of `_.forOwn` without support for iteratee shorthands.
28423 *
28424 * @private
28425 * @param {Object} object The object to iterate over.
28426 * @param {Function} iteratee The function invoked per iteration.
28427 * @returns {Object} Returns `object`.
28428 */
28429function baseForOwn(object, iteratee) {
28430 return object && baseFor(object, iteratee, keys);
28431}
28432
28433module.exports = baseForOwn;
28434
28435/***/ }),
28436/* 130 */
28437/***/ (function(module, exports, __webpack_require__) {
28438
28439var createBaseFor = __webpack_require__(131);
28440
28441/**
28442 * The base implementation of `baseForOwn` which iterates over `object`
28443 * properties returned by `keysFunc` and invokes `iteratee` for each property.
28444 * Iteratee functions may exit iteration early by explicitly returning `false`.
28445 *
28446 * @private
28447 * @param {Object} object The object to iterate over.
28448 * @param {Function} iteratee The function invoked per iteration.
28449 * @param {Function} keysFunc The function to get the keys of `object`.
28450 * @returns {Object} Returns `object`.
28451 */
28452var baseFor = createBaseFor();
28453
28454module.exports = baseFor;
28455
28456/***/ }),
28457/* 131 */
28458/***/ (function(module, exports) {
28459
28460/**
28461 * Creates a base function for methods like `_.forIn` and `_.forOwn`.
28462 *
28463 * @private
28464 * @param {boolean} [fromRight] Specify iterating from right to left.
28465 * @returns {Function} Returns the new base function.
28466 */
28467function createBaseFor(fromRight) {
28468 return function (object, iteratee, keysFunc) {
28469 var index = -1,
28470 iterable = Object(object),
28471 props = keysFunc(object),
28472 length = props.length;
28473
28474 while (length--) {
28475 var key = props[fromRight ? length : ++index];
28476 if (iteratee(iterable[key], key, iterable) === false) {
28477 break;
28478 }
28479 }
28480 return object;
28481 };
28482}
28483
28484module.exports = createBaseFor;
28485
28486/***/ }),
28487/* 132 */
28488/***/ (function(module, exports) {
28489
28490/**
28491 * The base implementation of `_.times` without support for iteratee shorthands
28492 * or max array length checks.
28493 *
28494 * @private
28495 * @param {number} n The number of times to invoke `iteratee`.
28496 * @param {Function} iteratee The function invoked per iteration.
28497 * @returns {Array} Returns the array of results.
28498 */
28499function baseTimes(n, iteratee) {
28500 var index = -1,
28501 result = Array(n);
28502
28503 while (++index < n) {
28504 result[index] = iteratee(index);
28505 }
28506 return result;
28507}
28508
28509module.exports = baseTimes;
28510
28511/***/ }),
28512/* 133 */
28513/***/ (function(module, exports, __webpack_require__) {
28514
28515var baseGetTag = __webpack_require__(6),
28516 isObjectLike = __webpack_require__(5);
28517
28518/** `Object#toString` result references. */
28519var argsTag = '[object Arguments]';
28520
28521/**
28522 * The base implementation of `_.isArguments`.
28523 *
28524 * @private
28525 * @param {*} value The value to check.
28526 * @returns {boolean} Returns `true` if `value` is an `arguments` object,
28527 */
28528function baseIsArguments(value) {
28529 return isObjectLike(value) && baseGetTag(value) == argsTag;
28530}
28531
28532module.exports = baseIsArguments;
28533
28534/***/ }),
28535/* 134 */
28536/***/ (function(module, exports) {
28537
28538var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
28539
28540var g;
28541
28542// This works in non-strict mode
28543g = function () {
28544 return this;
28545}();
28546
28547try {
28548 // This works if eval is allowed (see CSP)
28549 g = g || Function("return this")() || (1, eval)("this");
28550} catch (e) {
28551 // This works if the window reference is available
28552 if ((typeof window === "undefined" ? "undefined" : _typeof(window)) === "object") g = window;
28553}
28554
28555// g can still be undefined, but nothing to do about it...
28556// We return undefined, instead of nothing here, so it's
28557// easier to handle this case. if(!global) { ...}
28558
28559module.exports = g;
28560
28561/***/ }),
28562/* 135 */
28563/***/ (function(module, exports, __webpack_require__) {
28564
28565var _Symbol = __webpack_require__(12);
28566
28567/** Used for built-in method references. */
28568var objectProto = Object.prototype;
28569
28570/** Used to check objects for own properties. */
28571var hasOwnProperty = objectProto.hasOwnProperty;
28572
28573/**
28574 * Used to resolve the
28575 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
28576 * of values.
28577 */
28578var nativeObjectToString = objectProto.toString;
28579
28580/** Built-in value references. */
28581var symToStringTag = _Symbol ? _Symbol.toStringTag : undefined;
28582
28583/**
28584 * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
28585 *
28586 * @private
28587 * @param {*} value The value to query.
28588 * @returns {string} Returns the raw `toStringTag`.
28589 */
28590function getRawTag(value) {
28591 var isOwn = hasOwnProperty.call(value, symToStringTag),
28592 tag = value[symToStringTag];
28593
28594 try {
28595 value[symToStringTag] = undefined;
28596 var unmasked = true;
28597 } catch (e) {}
28598
28599 var result = nativeObjectToString.call(value);
28600 if (unmasked) {
28601 if (isOwn) {
28602 value[symToStringTag] = tag;
28603 } else {
28604 delete value[symToStringTag];
28605 }
28606 }
28607 return result;
28608}
28609
28610module.exports = getRawTag;
28611
28612/***/ }),
28613/* 136 */
28614/***/ (function(module, exports) {
28615
28616/** Used for built-in method references. */
28617var objectProto = Object.prototype;
28618
28619/**
28620 * Used to resolve the
28621 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
28622 * of values.
28623 */
28624var nativeObjectToString = objectProto.toString;
28625
28626/**
28627 * Converts `value` to a string using `Object.prototype.toString`.
28628 *
28629 * @private
28630 * @param {*} value The value to convert.
28631 * @returns {string} Returns the converted string.
28632 */
28633function objectToString(value) {
28634 return nativeObjectToString.call(value);
28635}
28636
28637module.exports = objectToString;
28638
28639/***/ }),
28640/* 137 */
28641/***/ (function(module, exports) {
28642
28643/**
28644 * This method returns `false`.
28645 *
28646 * @static
28647 * @memberOf _
28648 * @since 4.13.0
28649 * @category Util
28650 * @returns {boolean} Returns `false`.
28651 * @example
28652 *
28653 * _.times(2, _.stubFalse);
28654 * // => [false, false]
28655 */
28656function stubFalse() {
28657 return false;
28658}
28659
28660module.exports = stubFalse;
28661
28662/***/ }),
28663/* 138 */
28664/***/ (function(module, exports, __webpack_require__) {
28665
28666var baseGetTag = __webpack_require__(6),
28667 isLength = __webpack_require__(47),
28668 isObjectLike = __webpack_require__(5);
28669
28670/** `Object#toString` result references. */
28671var argsTag = '[object Arguments]',
28672 arrayTag = '[object Array]',
28673 boolTag = '[object Boolean]',
28674 dateTag = '[object Date]',
28675 errorTag = '[object Error]',
28676 funcTag = '[object Function]',
28677 mapTag = '[object Map]',
28678 numberTag = '[object Number]',
28679 objectTag = '[object Object]',
28680 regexpTag = '[object RegExp]',
28681 setTag = '[object Set]',
28682 stringTag = '[object String]',
28683 weakMapTag = '[object WeakMap]';
28684
28685var arrayBufferTag = '[object ArrayBuffer]',
28686 dataViewTag = '[object DataView]',
28687 float32Tag = '[object Float32Array]',
28688 float64Tag = '[object Float64Array]',
28689 int8Tag = '[object Int8Array]',
28690 int16Tag = '[object Int16Array]',
28691 int32Tag = '[object Int32Array]',
28692 uint8Tag = '[object Uint8Array]',
28693 uint8ClampedTag = '[object Uint8ClampedArray]',
28694 uint16Tag = '[object Uint16Array]',
28695 uint32Tag = '[object Uint32Array]';
28696
28697/** Used to identify `toStringTag` values of typed arrays. */
28698var typedArrayTags = {};
28699typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
28700typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
28701
28702/**
28703 * The base implementation of `_.isTypedArray` without Node.js optimizations.
28704 *
28705 * @private
28706 * @param {*} value The value to check.
28707 * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
28708 */
28709function baseIsTypedArray(value) {
28710 return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
28711}
28712
28713module.exports = baseIsTypedArray;
28714
28715/***/ }),
28716/* 139 */
28717/***/ (function(module, exports, __webpack_require__) {
28718
28719var overArg = __webpack_require__(75);
28720
28721/* Built-in method references for those with the same name as other `lodash` methods. */
28722var nativeKeys = overArg(Object.keys, Object);
28723
28724module.exports = nativeKeys;
28725
28726/***/ }),
28727/* 140 */
28728/***/ (function(module, exports, __webpack_require__) {
28729
28730var isArrayLike = __webpack_require__(8);
28731
28732/**
28733 * Creates a `baseEach` or `baseEachRight` function.
28734 *
28735 * @private
28736 * @param {Function} eachFunc The function to iterate over a collection.
28737 * @param {boolean} [fromRight] Specify iterating from right to left.
28738 * @returns {Function} Returns the new base function.
28739 */
28740function createBaseEach(eachFunc, fromRight) {
28741 return function (collection, iteratee) {
28742 if (collection == null) {
28743 return collection;
28744 }
28745 if (!isArrayLike(collection)) {
28746 return eachFunc(collection, iteratee);
28747 }
28748 var length = collection.length,
28749 index = fromRight ? length : -1,
28750 iterable = Object(collection);
28751
28752 while (fromRight ? index-- : ++index < length) {
28753 if (iteratee(iterable[index], index, iterable) === false) {
28754 break;
28755 }
28756 }
28757 return collection;
28758 };
28759}
28760
28761module.exports = createBaseEach;
28762
28763/***/ }),
28764/* 141 */
28765/***/ (function(module, exports, __webpack_require__) {
28766
28767var identity = __webpack_require__(31);
28768
28769/**
28770 * Casts `value` to `identity` if it's not a function.
28771 *
28772 * @private
28773 * @param {*} value The value to inspect.
28774 * @returns {Function} Returns cast function.
28775 */
28776function castFunction(value) {
28777 return typeof value == 'function' ? value : identity;
28778}
28779
28780module.exports = castFunction;
28781
28782/***/ }),
28783/* 142 */
28784/***/ (function(module, exports, __webpack_require__) {
28785
28786var arrayMap = __webpack_require__(49),
28787 baseIteratee = __webpack_require__(19),
28788 baseMap = __webpack_require__(192),
28789 isArray = __webpack_require__(3);
28790
28791/**
28792 * Creates an array of values by running each element in `collection` thru
28793 * `iteratee`. The iteratee is invoked with three arguments:
28794 * (value, index|key, collection).
28795 *
28796 * Many lodash methods are guarded to work as iteratees for methods like
28797 * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
28798 *
28799 * The guarded methods are:
28800 * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
28801 * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
28802 * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
28803 * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
28804 *
28805 * @static
28806 * @memberOf _
28807 * @since 0.1.0
28808 * @category Collection
28809 * @param {Array|Object} collection The collection to iterate over.
28810 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
28811 * @returns {Array} Returns the new mapped array.
28812 * @example
28813 *
28814 * function square(n) {
28815 * return n * n;
28816 * }
28817 *
28818 * _.map([4, 8], square);
28819 * // => [16, 64]
28820 *
28821 * _.map({ 'a': 4, 'b': 8 }, square);
28822 * // => [16, 64] (iteration order is not guaranteed)
28823 *
28824 * var users = [
28825 * { 'user': 'barney' },
28826 * { 'user': 'fred' }
28827 * ];
28828 *
28829 * // The `_.property` iteratee shorthand.
28830 * _.map(users, 'user');
28831 * // => ['barney', 'fred']
28832 */
28833function map(collection, iteratee) {
28834 var func = isArray(collection) ? arrayMap : baseMap;
28835 return func(collection, baseIteratee(iteratee, 3));
28836}
28837
28838module.exports = map;
28839
28840/***/ }),
28841/* 143 */
28842/***/ (function(module, exports, __webpack_require__) {
28843
28844var baseIsMatch = __webpack_require__(144),
28845 getMatchData = __webpack_require__(180),
28846 matchesStrictComparable = __webpack_require__(87);
28847
28848/**
28849 * The base implementation of `_.matches` which doesn't clone `source`.
28850 *
28851 * @private
28852 * @param {Object} source The object of property values to match.
28853 * @returns {Function} Returns the new spec function.
28854 */
28855function baseMatches(source) {
28856 var matchData = getMatchData(source);
28857 if (matchData.length == 1 && matchData[0][2]) {
28858 return matchesStrictComparable(matchData[0][0], matchData[0][1]);
28859 }
28860 return function (object) {
28861 return object === source || baseIsMatch(object, source, matchData);
28862 };
28863}
28864
28865module.exports = baseMatches;
28866
28867/***/ }),
28868/* 144 */
28869/***/ (function(module, exports, __webpack_require__) {
28870
28871var Stack = __webpack_require__(50),
28872 baseIsEqual = __webpack_require__(37);
28873
28874/** Used to compose bitmasks for value comparisons. */
28875var COMPARE_PARTIAL_FLAG = 1,
28876 COMPARE_UNORDERED_FLAG = 2;
28877
28878/**
28879 * The base implementation of `_.isMatch` without support for iteratee shorthands.
28880 *
28881 * @private
28882 * @param {Object} object The object to inspect.
28883 * @param {Object} source The object of property values to match.
28884 * @param {Array} matchData The property names, values, and compare flags to match.
28885 * @param {Function} [customizer] The function to customize comparisons.
28886 * @returns {boolean} Returns `true` if `object` is a match, else `false`.
28887 */
28888function baseIsMatch(object, source, matchData, customizer) {
28889 var index = matchData.length,
28890 length = index,
28891 noCustomizer = !customizer;
28892
28893 if (object == null) {
28894 return !length;
28895 }
28896 object = Object(object);
28897 while (index--) {
28898 var data = matchData[index];
28899 if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) {
28900 return false;
28901 }
28902 }
28903 while (++index < length) {
28904 data = matchData[index];
28905 var key = data[0],
28906 objValue = object[key],
28907 srcValue = data[1];
28908
28909 if (noCustomizer && data[2]) {
28910 if (objValue === undefined && !(key in object)) {
28911 return false;
28912 }
28913 } else {
28914 var stack = new Stack();
28915 if (customizer) {
28916 var result = customizer(objValue, srcValue, key, object, source, stack);
28917 }
28918 if (!(result === undefined ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) : result)) {
28919 return false;
28920 }
28921 }
28922 }
28923 return true;
28924}
28925
28926module.exports = baseIsMatch;
28927
28928/***/ }),
28929/* 145 */
28930/***/ (function(module, exports) {
28931
28932/**
28933 * Removes all key-value entries from the list cache.
28934 *
28935 * @private
28936 * @name clear
28937 * @memberOf ListCache
28938 */
28939function listCacheClear() {
28940 this.__data__ = [];
28941 this.size = 0;
28942}
28943
28944module.exports = listCacheClear;
28945
28946/***/ }),
28947/* 146 */
28948/***/ (function(module, exports, __webpack_require__) {
28949
28950var assocIndexOf = __webpack_require__(33);
28951
28952/** Used for built-in method references. */
28953var arrayProto = Array.prototype;
28954
28955/** Built-in value references. */
28956var splice = arrayProto.splice;
28957
28958/**
28959 * Removes `key` and its value from the list cache.
28960 *
28961 * @private
28962 * @name delete
28963 * @memberOf ListCache
28964 * @param {string} key The key of the value to remove.
28965 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
28966 */
28967function listCacheDelete(key) {
28968 var data = this.__data__,
28969 index = assocIndexOf(data, key);
28970
28971 if (index < 0) {
28972 return false;
28973 }
28974 var lastIndex = data.length - 1;
28975 if (index == lastIndex) {
28976 data.pop();
28977 } else {
28978 splice.call(data, index, 1);
28979 }
28980 --this.size;
28981 return true;
28982}
28983
28984module.exports = listCacheDelete;
28985
28986/***/ }),
28987/* 147 */
28988/***/ (function(module, exports, __webpack_require__) {
28989
28990var assocIndexOf = __webpack_require__(33);
28991
28992/**
28993 * Gets the list cache value for `key`.
28994 *
28995 * @private
28996 * @name get
28997 * @memberOf ListCache
28998 * @param {string} key The key of the value to get.
28999 * @returns {*} Returns the entry value.
29000 */
29001function listCacheGet(key) {
29002 var data = this.__data__,
29003 index = assocIndexOf(data, key);
29004
29005 return index < 0 ? undefined : data[index][1];
29006}
29007
29008module.exports = listCacheGet;
29009
29010/***/ }),
29011/* 148 */
29012/***/ (function(module, exports, __webpack_require__) {
29013
29014var assocIndexOf = __webpack_require__(33);
29015
29016/**
29017 * Checks if a list cache value for `key` exists.
29018 *
29019 * @private
29020 * @name has
29021 * @memberOf ListCache
29022 * @param {string} key The key of the entry to check.
29023 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
29024 */
29025function listCacheHas(key) {
29026 return assocIndexOf(this.__data__, key) > -1;
29027}
29028
29029module.exports = listCacheHas;
29030
29031/***/ }),
29032/* 149 */
29033/***/ (function(module, exports, __webpack_require__) {
29034
29035var assocIndexOf = __webpack_require__(33);
29036
29037/**
29038 * Sets the list cache `key` to `value`.
29039 *
29040 * @private
29041 * @name set
29042 * @memberOf ListCache
29043 * @param {string} key The key of the value to set.
29044 * @param {*} value The value to set.
29045 * @returns {Object} Returns the list cache instance.
29046 */
29047function listCacheSet(key, value) {
29048 var data = this.__data__,
29049 index = assocIndexOf(data, key);
29050
29051 if (index < 0) {
29052 ++this.size;
29053 data.push([key, value]);
29054 } else {
29055 data[index][1] = value;
29056 }
29057 return this;
29058}
29059
29060module.exports = listCacheSet;
29061
29062/***/ }),
29063/* 150 */
29064/***/ (function(module, exports, __webpack_require__) {
29065
29066var ListCache = __webpack_require__(32);
29067
29068/**
29069 * Removes all key-value entries from the stack.
29070 *
29071 * @private
29072 * @name clear
29073 * @memberOf Stack
29074 */
29075function stackClear() {
29076 this.__data__ = new ListCache();
29077 this.size = 0;
29078}
29079
29080module.exports = stackClear;
29081
29082/***/ }),
29083/* 151 */
29084/***/ (function(module, exports) {
29085
29086/**
29087 * Removes `key` and its value from the stack.
29088 *
29089 * @private
29090 * @name delete
29091 * @memberOf Stack
29092 * @param {string} key The key of the value to remove.
29093 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
29094 */
29095function stackDelete(key) {
29096 var data = this.__data__,
29097 result = data['delete'](key);
29098
29099 this.size = data.size;
29100 return result;
29101}
29102
29103module.exports = stackDelete;
29104
29105/***/ }),
29106/* 152 */
29107/***/ (function(module, exports) {
29108
29109/**
29110 * Gets the stack value for `key`.
29111 *
29112 * @private
29113 * @name get
29114 * @memberOf Stack
29115 * @param {string} key The key of the value to get.
29116 * @returns {*} Returns the entry value.
29117 */
29118function stackGet(key) {
29119 return this.__data__.get(key);
29120}
29121
29122module.exports = stackGet;
29123
29124/***/ }),
29125/* 153 */
29126/***/ (function(module, exports) {
29127
29128/**
29129 * Checks if a stack value for `key` exists.
29130 *
29131 * @private
29132 * @name has
29133 * @memberOf Stack
29134 * @param {string} key The key of the entry to check.
29135 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
29136 */
29137function stackHas(key) {
29138 return this.__data__.has(key);
29139}
29140
29141module.exports = stackHas;
29142
29143/***/ }),
29144/* 154 */
29145/***/ (function(module, exports, __webpack_require__) {
29146
29147var ListCache = __webpack_require__(32),
29148 Map = __webpack_require__(51),
29149 MapCache = __webpack_require__(52);
29150
29151/** Used as the size to enable large array optimizations. */
29152var LARGE_ARRAY_SIZE = 200;
29153
29154/**
29155 * Sets the stack `key` to `value`.
29156 *
29157 * @private
29158 * @name set
29159 * @memberOf Stack
29160 * @param {string} key The key of the value to set.
29161 * @param {*} value The value to set.
29162 * @returns {Object} Returns the stack cache instance.
29163 */
29164function stackSet(key, value) {
29165 var data = this.__data__;
29166 if (data instanceof ListCache) {
29167 var pairs = data.__data__;
29168 if (!Map || pairs.length < LARGE_ARRAY_SIZE - 1) {
29169 pairs.push([key, value]);
29170 this.size = ++data.size;
29171 return this;
29172 }
29173 data = this.__data__ = new MapCache(pairs);
29174 }
29175 data.set(key, value);
29176 this.size = data.size;
29177 return this;
29178}
29179
29180module.exports = stackSet;
29181
29182/***/ }),
29183/* 155 */
29184/***/ (function(module, exports, __webpack_require__) {
29185
29186var isFunction = __webpack_require__(48),
29187 isMasked = __webpack_require__(156),
29188 isObject = __webpack_require__(7),
29189 toSource = __webpack_require__(76);
29190
29191/**
29192 * Used to match `RegExp`
29193 * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
29194 */
29195var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
29196
29197/** Used to detect host constructors (Safari). */
29198var reIsHostCtor = /^\[object .+?Constructor\]$/;
29199
29200/** Used for built-in method references. */
29201var funcProto = Function.prototype,
29202 objectProto = Object.prototype;
29203
29204/** Used to resolve the decompiled source of functions. */
29205var funcToString = funcProto.toString;
29206
29207/** Used to check objects for own properties. */
29208var hasOwnProperty = objectProto.hasOwnProperty;
29209
29210/** Used to detect if a method is native. */
29211var reIsNative = RegExp('^' + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&').replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$');
29212
29213/**
29214 * The base implementation of `_.isNative` without bad shim checks.
29215 *
29216 * @private
29217 * @param {*} value The value to check.
29218 * @returns {boolean} Returns `true` if `value` is a native function,
29219 * else `false`.
29220 */
29221function baseIsNative(value) {
29222 if (!isObject(value) || isMasked(value)) {
29223 return false;
29224 }
29225 var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
29226 return pattern.test(toSource(value));
29227}
29228
29229module.exports = baseIsNative;
29230
29231/***/ }),
29232/* 156 */
29233/***/ (function(module, exports, __webpack_require__) {
29234
29235var coreJsData = __webpack_require__(157);
29236
29237/** Used to detect methods masquerading as native. */
29238var maskSrcKey = function () {
29239 var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
29240 return uid ? 'Symbol(src)_1.' + uid : '';
29241}();
29242
29243/**
29244 * Checks if `func` has its source masked.
29245 *
29246 * @private
29247 * @param {Function} func The function to check.
29248 * @returns {boolean} Returns `true` if `func` is masked, else `false`.
29249 */
29250function isMasked(func) {
29251 return !!maskSrcKey && maskSrcKey in func;
29252}
29253
29254module.exports = isMasked;
29255
29256/***/ }),
29257/* 157 */
29258/***/ (function(module, exports, __webpack_require__) {
29259
29260var root = __webpack_require__(4);
29261
29262/** Used to detect overreaching core-js shims. */
29263var coreJsData = root['__core-js_shared__'];
29264
29265module.exports = coreJsData;
29266
29267/***/ }),
29268/* 158 */
29269/***/ (function(module, exports) {
29270
29271/**
29272 * Gets the value at `key` of `object`.
29273 *
29274 * @private
29275 * @param {Object} [object] The object to query.
29276 * @param {string} key The key of the property to get.
29277 * @returns {*} Returns the property value.
29278 */
29279function getValue(object, key) {
29280 return object == null ? undefined : object[key];
29281}
29282
29283module.exports = getValue;
29284
29285/***/ }),
29286/* 159 */
29287/***/ (function(module, exports, __webpack_require__) {
29288
29289var Hash = __webpack_require__(160),
29290 ListCache = __webpack_require__(32),
29291 Map = __webpack_require__(51);
29292
29293/**
29294 * Removes all key-value entries from the map.
29295 *
29296 * @private
29297 * @name clear
29298 * @memberOf MapCache
29299 */
29300function mapCacheClear() {
29301 this.size = 0;
29302 this.__data__ = {
29303 'hash': new Hash(),
29304 'map': new (Map || ListCache)(),
29305 'string': new Hash()
29306 };
29307}
29308
29309module.exports = mapCacheClear;
29310
29311/***/ }),
29312/* 160 */
29313/***/ (function(module, exports, __webpack_require__) {
29314
29315var hashClear = __webpack_require__(161),
29316 hashDelete = __webpack_require__(162),
29317 hashGet = __webpack_require__(163),
29318 hashHas = __webpack_require__(164),
29319 hashSet = __webpack_require__(165);
29320
29321/**
29322 * Creates a hash object.
29323 *
29324 * @private
29325 * @constructor
29326 * @param {Array} [entries] The key-value pairs to cache.
29327 */
29328function Hash(entries) {
29329 var index = -1,
29330 length = entries == null ? 0 : entries.length;
29331
29332 this.clear();
29333 while (++index < length) {
29334 var entry = entries[index];
29335 this.set(entry[0], entry[1]);
29336 }
29337}
29338
29339// Add methods to `Hash`.
29340Hash.prototype.clear = hashClear;
29341Hash.prototype['delete'] = hashDelete;
29342Hash.prototype.get = hashGet;
29343Hash.prototype.has = hashHas;
29344Hash.prototype.set = hashSet;
29345
29346module.exports = Hash;
29347
29348/***/ }),
29349/* 161 */
29350/***/ (function(module, exports, __webpack_require__) {
29351
29352var nativeCreate = __webpack_require__(35);
29353
29354/**
29355 * Removes all key-value entries from the hash.
29356 *
29357 * @private
29358 * @name clear
29359 * @memberOf Hash
29360 */
29361function hashClear() {
29362 this.__data__ = nativeCreate ? nativeCreate(null) : {};
29363 this.size = 0;
29364}
29365
29366module.exports = hashClear;
29367
29368/***/ }),
29369/* 162 */
29370/***/ (function(module, exports) {
29371
29372/**
29373 * Removes `key` and its value from the hash.
29374 *
29375 * @private
29376 * @name delete
29377 * @memberOf Hash
29378 * @param {Object} hash The hash to modify.
29379 * @param {string} key The key of the value to remove.
29380 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
29381 */
29382function hashDelete(key) {
29383 var result = this.has(key) && delete this.__data__[key];
29384 this.size -= result ? 1 : 0;
29385 return result;
29386}
29387
29388module.exports = hashDelete;
29389
29390/***/ }),
29391/* 163 */
29392/***/ (function(module, exports, __webpack_require__) {
29393
29394var nativeCreate = __webpack_require__(35);
29395
29396/** Used to stand-in for `undefined` hash values. */
29397var HASH_UNDEFINED = '__lodash_hash_undefined__';
29398
29399/** Used for built-in method references. */
29400var objectProto = Object.prototype;
29401
29402/** Used to check objects for own properties. */
29403var hasOwnProperty = objectProto.hasOwnProperty;
29404
29405/**
29406 * Gets the hash value for `key`.
29407 *
29408 * @private
29409 * @name get
29410 * @memberOf Hash
29411 * @param {string} key The key of the value to get.
29412 * @returns {*} Returns the entry value.
29413 */
29414function hashGet(key) {
29415 var data = this.__data__;
29416 if (nativeCreate) {
29417 var result = data[key];
29418 return result === HASH_UNDEFINED ? undefined : result;
29419 }
29420 return hasOwnProperty.call(data, key) ? data[key] : undefined;
29421}
29422
29423module.exports = hashGet;
29424
29425/***/ }),
29426/* 164 */
29427/***/ (function(module, exports, __webpack_require__) {
29428
29429var nativeCreate = __webpack_require__(35);
29430
29431/** Used for built-in method references. */
29432var objectProto = Object.prototype;
29433
29434/** Used to check objects for own properties. */
29435var hasOwnProperty = objectProto.hasOwnProperty;
29436
29437/**
29438 * Checks if a hash value for `key` exists.
29439 *
29440 * @private
29441 * @name has
29442 * @memberOf Hash
29443 * @param {string} key The key of the entry to check.
29444 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
29445 */
29446function hashHas(key) {
29447 var data = this.__data__;
29448 return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
29449}
29450
29451module.exports = hashHas;
29452
29453/***/ }),
29454/* 165 */
29455/***/ (function(module, exports, __webpack_require__) {
29456
29457var nativeCreate = __webpack_require__(35);
29458
29459/** Used to stand-in for `undefined` hash values. */
29460var HASH_UNDEFINED = '__lodash_hash_undefined__';
29461
29462/**
29463 * Sets the hash `key` to `value`.
29464 *
29465 * @private
29466 * @name set
29467 * @memberOf Hash
29468 * @param {string} key The key of the value to set.
29469 * @param {*} value The value to set.
29470 * @returns {Object} Returns the hash instance.
29471 */
29472function hashSet(key, value) {
29473 var data = this.__data__;
29474 this.size += this.has(key) ? 0 : 1;
29475 data[key] = nativeCreate && value === undefined ? HASH_UNDEFINED : value;
29476 return this;
29477}
29478
29479module.exports = hashSet;
29480
29481/***/ }),
29482/* 166 */
29483/***/ (function(module, exports, __webpack_require__) {
29484
29485var getMapData = __webpack_require__(36);
29486
29487/**
29488 * Removes `key` and its value from the map.
29489 *
29490 * @private
29491 * @name delete
29492 * @memberOf MapCache
29493 * @param {string} key The key of the value to remove.
29494 * @returns {boolean} Returns `true` if the entry was removed, else `false`.
29495 */
29496function mapCacheDelete(key) {
29497 var result = getMapData(this, key)['delete'](key);
29498 this.size -= result ? 1 : 0;
29499 return result;
29500}
29501
29502module.exports = mapCacheDelete;
29503
29504/***/ }),
29505/* 167 */
29506/***/ (function(module, exports) {
29507
29508var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
29509
29510/**
29511 * Checks if `value` is suitable for use as unique object key.
29512 *
29513 * @private
29514 * @param {*} value The value to check.
29515 * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
29516 */
29517function isKeyable(value) {
29518 var type = typeof value === 'undefined' ? 'undefined' : _typeof(value);
29519 return type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean' ? value !== '__proto__' : value === null;
29520}
29521
29522module.exports = isKeyable;
29523
29524/***/ }),
29525/* 168 */
29526/***/ (function(module, exports, __webpack_require__) {
29527
29528var getMapData = __webpack_require__(36);
29529
29530/**
29531 * Gets the map value for `key`.
29532 *
29533 * @private
29534 * @name get
29535 * @memberOf MapCache
29536 * @param {string} key The key of the value to get.
29537 * @returns {*} Returns the entry value.
29538 */
29539function mapCacheGet(key) {
29540 return getMapData(this, key).get(key);
29541}
29542
29543module.exports = mapCacheGet;
29544
29545/***/ }),
29546/* 169 */
29547/***/ (function(module, exports, __webpack_require__) {
29548
29549var getMapData = __webpack_require__(36);
29550
29551/**
29552 * Checks if a map value for `key` exists.
29553 *
29554 * @private
29555 * @name has
29556 * @memberOf MapCache
29557 * @param {string} key The key of the entry to check.
29558 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
29559 */
29560function mapCacheHas(key) {
29561 return getMapData(this, key).has(key);
29562}
29563
29564module.exports = mapCacheHas;
29565
29566/***/ }),
29567/* 170 */
29568/***/ (function(module, exports, __webpack_require__) {
29569
29570var getMapData = __webpack_require__(36);
29571
29572/**
29573 * Sets the map `key` to `value`.
29574 *
29575 * @private
29576 * @name set
29577 * @memberOf MapCache
29578 * @param {string} key The key of the value to set.
29579 * @param {*} value The value to set.
29580 * @returns {Object} Returns the map cache instance.
29581 */
29582function mapCacheSet(key, value) {
29583 var data = getMapData(this, key),
29584 size = data.size;
29585
29586 data.set(key, value);
29587 this.size += data.size == size ? 0 : 1;
29588 return this;
29589}
29590
29591module.exports = mapCacheSet;
29592
29593/***/ }),
29594/* 171 */
29595/***/ (function(module, exports, __webpack_require__) {
29596
29597var Stack = __webpack_require__(50),
29598 equalArrays = __webpack_require__(77),
29599 equalByTag = __webpack_require__(175),
29600 equalObjects = __webpack_require__(176),
29601 getTag = __webpack_require__(38),
29602 isArray = __webpack_require__(3),
29603 isBuffer = __webpack_require__(29),
29604 isTypedArray = __webpack_require__(46);
29605
29606/** Used to compose bitmasks for value comparisons. */
29607var COMPARE_PARTIAL_FLAG = 1;
29608
29609/** `Object#toString` result references. */
29610var argsTag = '[object Arguments]',
29611 arrayTag = '[object Array]',
29612 objectTag = '[object Object]';
29613
29614/** Used for built-in method references. */
29615var objectProto = Object.prototype;
29616
29617/** Used to check objects for own properties. */
29618var hasOwnProperty = objectProto.hasOwnProperty;
29619
29620/**
29621 * A specialized version of `baseIsEqual` for arrays and objects which performs
29622 * deep comparisons and tracks traversed objects enabling objects with circular
29623 * references to be compared.
29624 *
29625 * @private
29626 * @param {Object} object The object to compare.
29627 * @param {Object} other The other object to compare.
29628 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
29629 * @param {Function} customizer The function to customize comparisons.
29630 * @param {Function} equalFunc The function to determine equivalents of values.
29631 * @param {Object} [stack] Tracks traversed `object` and `other` objects.
29632 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
29633 */
29634function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
29635 var objIsArr = isArray(object),
29636 othIsArr = isArray(other),
29637 objTag = objIsArr ? arrayTag : getTag(object),
29638 othTag = othIsArr ? arrayTag : getTag(other);
29639
29640 objTag = objTag == argsTag ? objectTag : objTag;
29641 othTag = othTag == argsTag ? objectTag : othTag;
29642
29643 var objIsObj = objTag == objectTag,
29644 othIsObj = othTag == objectTag,
29645 isSameTag = objTag == othTag;
29646
29647 if (isSameTag && isBuffer(object)) {
29648 if (!isBuffer(other)) {
29649 return false;
29650 }
29651 objIsArr = true;
29652 objIsObj = false;
29653 }
29654 if (isSameTag && !objIsObj) {
29655 stack || (stack = new Stack());
29656 return objIsArr || isTypedArray(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
29657 }
29658 if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
29659 var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
29660 othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
29661
29662 if (objIsWrapped || othIsWrapped) {
29663 var objUnwrapped = objIsWrapped ? object.value() : object,
29664 othUnwrapped = othIsWrapped ? other.value() : other;
29665
29666 stack || (stack = new Stack());
29667 return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
29668 }
29669 }
29670 if (!isSameTag) {
29671 return false;
29672 }
29673 stack || (stack = new Stack());
29674 return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
29675}
29676
29677module.exports = baseIsEqualDeep;
29678
29679/***/ }),
29680/* 172 */
29681/***/ (function(module, exports) {
29682
29683/** Used to stand-in for `undefined` hash values. */
29684var HASH_UNDEFINED = '__lodash_hash_undefined__';
29685
29686/**
29687 * Adds `value` to the array cache.
29688 *
29689 * @private
29690 * @name add
29691 * @memberOf SetCache
29692 * @alias push
29693 * @param {*} value The value to cache.
29694 * @returns {Object} Returns the cache instance.
29695 */
29696function setCacheAdd(value) {
29697 this.__data__.set(value, HASH_UNDEFINED);
29698 return this;
29699}
29700
29701module.exports = setCacheAdd;
29702
29703/***/ }),
29704/* 173 */
29705/***/ (function(module, exports) {
29706
29707/**
29708 * Checks if `value` is in the array cache.
29709 *
29710 * @private
29711 * @name has
29712 * @memberOf SetCache
29713 * @param {*} value The value to search for.
29714 * @returns {number} Returns `true` if `value` is found, else `false`.
29715 */
29716function setCacheHas(value) {
29717 return this.__data__.has(value);
29718}
29719
29720module.exports = setCacheHas;
29721
29722/***/ }),
29723/* 174 */
29724/***/ (function(module, exports) {
29725
29726/**
29727 * A specialized version of `_.some` for arrays without support for iteratee
29728 * shorthands.
29729 *
29730 * @private
29731 * @param {Array} [array] The array to iterate over.
29732 * @param {Function} predicate The function invoked per iteration.
29733 * @returns {boolean} Returns `true` if any element passes the predicate check,
29734 * else `false`.
29735 */
29736function arraySome(array, predicate) {
29737 var index = -1,
29738 length = array == null ? 0 : array.length;
29739
29740 while (++index < length) {
29741 if (predicate(array[index], index, array)) {
29742 return true;
29743 }
29744 }
29745 return false;
29746}
29747
29748module.exports = arraySome;
29749
29750/***/ }),
29751/* 175 */
29752/***/ (function(module, exports, __webpack_require__) {
29753
29754var _Symbol = __webpack_require__(12),
29755 Uint8Array = __webpack_require__(80),
29756 eq = __webpack_require__(34),
29757 equalArrays = __webpack_require__(77),
29758 mapToArray = __webpack_require__(53),
29759 setToArray = __webpack_require__(20);
29760
29761/** Used to compose bitmasks for value comparisons. */
29762var COMPARE_PARTIAL_FLAG = 1,
29763 COMPARE_UNORDERED_FLAG = 2;
29764
29765/** `Object#toString` result references. */
29766var boolTag = '[object Boolean]',
29767 dateTag = '[object Date]',
29768 errorTag = '[object Error]',
29769 mapTag = '[object Map]',
29770 numberTag = '[object Number]',
29771 regexpTag = '[object RegExp]',
29772 setTag = '[object Set]',
29773 stringTag = '[object String]',
29774 symbolTag = '[object Symbol]';
29775
29776var arrayBufferTag = '[object ArrayBuffer]',
29777 dataViewTag = '[object DataView]';
29778
29779/** Used to convert symbols to primitives and strings. */
29780var symbolProto = _Symbol ? _Symbol.prototype : undefined,
29781 symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
29782
29783/**
29784 * A specialized version of `baseIsEqualDeep` for comparing objects of
29785 * the same `toStringTag`.
29786 *
29787 * **Note:** This function only supports comparing values with tags of
29788 * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
29789 *
29790 * @private
29791 * @param {Object} object The object to compare.
29792 * @param {Object} other The other object to compare.
29793 * @param {string} tag The `toStringTag` of the objects to compare.
29794 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
29795 * @param {Function} customizer The function to customize comparisons.
29796 * @param {Function} equalFunc The function to determine equivalents of values.
29797 * @param {Object} stack Tracks traversed `object` and `other` objects.
29798 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
29799 */
29800function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
29801 switch (tag) {
29802 case dataViewTag:
29803 if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
29804 return false;
29805 }
29806 object = object.buffer;
29807 other = other.buffer;
29808
29809 case arrayBufferTag:
29810 if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
29811 return false;
29812 }
29813 return true;
29814
29815 case boolTag:
29816 case dateTag:
29817 case numberTag:
29818 // Coerce booleans to `1` or `0` and dates to milliseconds.
29819 // Invalid dates are coerced to `NaN`.
29820 return eq(+object, +other);
29821
29822 case errorTag:
29823 return object.name == other.name && object.message == other.message;
29824
29825 case regexpTag:
29826 case stringTag:
29827 // Coerce regexes to strings and treat strings, primitives and objects,
29828 // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
29829 // for more details.
29830 return object == other + '';
29831
29832 case mapTag:
29833 var convert = mapToArray;
29834
29835 case setTag:
29836 var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
29837 convert || (convert = setToArray);
29838
29839 if (object.size != other.size && !isPartial) {
29840 return false;
29841 }
29842 // Assume cyclic values are equal.
29843 var stacked = stack.get(object);
29844 if (stacked) {
29845 return stacked == other;
29846 }
29847 bitmask |= COMPARE_UNORDERED_FLAG;
29848
29849 // Recursively compare objects (susceptible to call stack limits).
29850 stack.set(object, other);
29851 var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
29852 stack['delete'](object);
29853 return result;
29854
29855 case symbolTag:
29856 if (symbolValueOf) {
29857 return symbolValueOf.call(object) == symbolValueOf.call(other);
29858 }
29859 }
29860 return false;
29861}
29862
29863module.exports = equalByTag;
29864
29865/***/ }),
29866/* 176 */
29867/***/ (function(module, exports, __webpack_require__) {
29868
29869var getAllKeys = __webpack_require__(81);
29870
29871/** Used to compose bitmasks for value comparisons. */
29872var COMPARE_PARTIAL_FLAG = 1;
29873
29874/** Used for built-in method references. */
29875var objectProto = Object.prototype;
29876
29877/** Used to check objects for own properties. */
29878var hasOwnProperty = objectProto.hasOwnProperty;
29879
29880/**
29881 * A specialized version of `baseIsEqualDeep` for objects with support for
29882 * partial deep comparisons.
29883 *
29884 * @private
29885 * @param {Object} object The object to compare.
29886 * @param {Object} other The other object to compare.
29887 * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
29888 * @param {Function} customizer The function to customize comparisons.
29889 * @param {Function} equalFunc The function to determine equivalents of values.
29890 * @param {Object} stack Tracks traversed `object` and `other` objects.
29891 * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
29892 */
29893function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
29894 var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
29895 objProps = getAllKeys(object),
29896 objLength = objProps.length,
29897 othProps = getAllKeys(other),
29898 othLength = othProps.length;
29899
29900 if (objLength != othLength && !isPartial) {
29901 return false;
29902 }
29903 var index = objLength;
29904 while (index--) {
29905 var key = objProps[index];
29906 if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
29907 return false;
29908 }
29909 }
29910 // Assume cyclic values are equal.
29911 var stacked = stack.get(object);
29912 if (stacked && stack.get(other)) {
29913 return stacked == other;
29914 }
29915 var result = true;
29916 stack.set(object, other);
29917 stack.set(other, object);
29918
29919 var skipCtor = isPartial;
29920 while (++index < objLength) {
29921 key = objProps[index];
29922 var objValue = object[key],
29923 othValue = other[key];
29924
29925 if (customizer) {
29926 var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
29927 }
29928 // Recursively compare objects (susceptible to call stack limits).
29929 if (!(compared === undefined ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
29930 result = false;
29931 break;
29932 }
29933 skipCtor || (skipCtor = key == 'constructor');
29934 }
29935 if (result && !skipCtor) {
29936 var objCtor = object.constructor,
29937 othCtor = other.constructor;
29938
29939 // Non `Object` object instances with different constructors are not equal.
29940 if (objCtor != othCtor && 'constructor' in object && 'constructor' in other && !(typeof objCtor == 'function' && objCtor instanceof objCtor && typeof othCtor == 'function' && othCtor instanceof othCtor)) {
29941 result = false;
29942 }
29943 }
29944 stack['delete'](object);
29945 stack['delete'](other);
29946 return result;
29947}
29948
29949module.exports = equalObjects;
29950
29951/***/ }),
29952/* 177 */
29953/***/ (function(module, exports, __webpack_require__) {
29954
29955var getNative = __webpack_require__(13),
29956 root = __webpack_require__(4);
29957
29958/* Built-in method references that are verified to be native. */
29959var DataView = getNative(root, 'DataView');
29960
29961module.exports = DataView;
29962
29963/***/ }),
29964/* 178 */
29965/***/ (function(module, exports, __webpack_require__) {
29966
29967var getNative = __webpack_require__(13),
29968 root = __webpack_require__(4);
29969
29970/* Built-in method references that are verified to be native. */
29971var Promise = getNative(root, 'Promise');
29972
29973module.exports = Promise;
29974
29975/***/ }),
29976/* 179 */
29977/***/ (function(module, exports, __webpack_require__) {
29978
29979var getNative = __webpack_require__(13),
29980 root = __webpack_require__(4);
29981
29982/* Built-in method references that are verified to be native. */
29983var WeakMap = getNative(root, 'WeakMap');
29984
29985module.exports = WeakMap;
29986
29987/***/ }),
29988/* 180 */
29989/***/ (function(module, exports, __webpack_require__) {
29990
29991var isStrictComparable = __webpack_require__(86),
29992 keys = __webpack_require__(11);
29993
29994/**
29995 * Gets the property names, values, and compare flags of `object`.
29996 *
29997 * @private
29998 * @param {Object} object The object to query.
29999 * @returns {Array} Returns the match data of `object`.
30000 */
30001function getMatchData(object) {
30002 var result = keys(object),
30003 length = result.length;
30004
30005 while (length--) {
30006 var key = result[length],
30007 value = object[key];
30008
30009 result[length] = [key, value, isStrictComparable(value)];
30010 }
30011 return result;
30012}
30013
30014module.exports = getMatchData;
30015
30016/***/ }),
30017/* 181 */
30018/***/ (function(module, exports, __webpack_require__) {
30019
30020var baseIsEqual = __webpack_require__(37),
30021 get = __webpack_require__(182),
30022 hasIn = __webpack_require__(88),
30023 isKey = __webpack_require__(57),
30024 isStrictComparable = __webpack_require__(86),
30025 matchesStrictComparable = __webpack_require__(87),
30026 toKey = __webpack_require__(22);
30027
30028/** Used to compose bitmasks for value comparisons. */
30029var COMPARE_PARTIAL_FLAG = 1,
30030 COMPARE_UNORDERED_FLAG = 2;
30031
30032/**
30033 * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
30034 *
30035 * @private
30036 * @param {string} path The path of the property to get.
30037 * @param {*} srcValue The value to match.
30038 * @returns {Function} Returns the new spec function.
30039 */
30040function baseMatchesProperty(path, srcValue) {
30041 if (isKey(path) && isStrictComparable(srcValue)) {
30042 return matchesStrictComparable(toKey(path), srcValue);
30043 }
30044 return function (object) {
30045 var objValue = get(object, path);
30046 return objValue === undefined && objValue === srcValue ? hasIn(object, path) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
30047 };
30048}
30049
30050module.exports = baseMatchesProperty;
30051
30052/***/ }),
30053/* 182 */
30054/***/ (function(module, exports, __webpack_require__) {
30055
30056var baseGet = __webpack_require__(56);
30057
30058/**
30059 * Gets the value at `path` of `object`. If the resolved value is
30060 * `undefined`, the `defaultValue` is returned in its place.
30061 *
30062 * @static
30063 * @memberOf _
30064 * @since 3.7.0
30065 * @category Object
30066 * @param {Object} object The object to query.
30067 * @param {Array|string} path The path of the property to get.
30068 * @param {*} [defaultValue] The value returned for `undefined` resolved values.
30069 * @returns {*} Returns the resolved value.
30070 * @example
30071 *
30072 * var object = { 'a': [{ 'b': { 'c': 3 } }] };
30073 *
30074 * _.get(object, 'a[0].b.c');
30075 * // => 3
30076 *
30077 * _.get(object, ['a', '0', 'b', 'c']);
30078 * // => 3
30079 *
30080 * _.get(object, 'a.b.c', 'default');
30081 * // => 'default'
30082 */
30083function get(object, path, defaultValue) {
30084 var result = object == null ? undefined : baseGet(object, path);
30085 return result === undefined ? defaultValue : result;
30086}
30087
30088module.exports = get;
30089
30090/***/ }),
30091/* 183 */
30092/***/ (function(module, exports, __webpack_require__) {
30093
30094var memoizeCapped = __webpack_require__(184);
30095
30096/** Used to match property names within property paths. */
30097var reLeadingDot = /^\./,
30098 rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
30099
30100/** Used to match backslashes in property paths. */
30101var reEscapeChar = /\\(\\)?/g;
30102
30103/**
30104 * Converts `string` to a property path array.
30105 *
30106 * @private
30107 * @param {string} string The string to convert.
30108 * @returns {Array} Returns the property path array.
30109 */
30110var stringToPath = memoizeCapped(function (string) {
30111 var result = [];
30112 if (reLeadingDot.test(string)) {
30113 result.push('');
30114 }
30115 string.replace(rePropName, function (match, number, quote, string) {
30116 result.push(quote ? string.replace(reEscapeChar, '$1') : number || match);
30117 });
30118 return result;
30119});
30120
30121module.exports = stringToPath;
30122
30123/***/ }),
30124/* 184 */
30125/***/ (function(module, exports, __webpack_require__) {
30126
30127var memoize = __webpack_require__(185);
30128
30129/** Used as the maximum memoize cache size. */
30130var MAX_MEMOIZE_SIZE = 500;
30131
30132/**
30133 * A specialized version of `_.memoize` which clears the memoized function's
30134 * cache when it exceeds `MAX_MEMOIZE_SIZE`.
30135 *
30136 * @private
30137 * @param {Function} func The function to have its output memoized.
30138 * @returns {Function} Returns the new memoized function.
30139 */
30140function memoizeCapped(func) {
30141 var result = memoize(func, function (key) {
30142 if (cache.size === MAX_MEMOIZE_SIZE) {
30143 cache.clear();
30144 }
30145 return key;
30146 });
30147
30148 var cache = result.cache;
30149 return result;
30150}
30151
30152module.exports = memoizeCapped;
30153
30154/***/ }),
30155/* 185 */
30156/***/ (function(module, exports, __webpack_require__) {
30157
30158var MapCache = __webpack_require__(52);
30159
30160/** Error message constants. */
30161var FUNC_ERROR_TEXT = 'Expected a function';
30162
30163/**
30164 * Creates a function that memoizes the result of `func`. If `resolver` is
30165 * provided, it determines the cache key for storing the result based on the
30166 * arguments provided to the memoized function. By default, the first argument
30167 * provided to the memoized function is used as the map cache key. The `func`
30168 * is invoked with the `this` binding of the memoized function.
30169 *
30170 * **Note:** The cache is exposed as the `cache` property on the memoized
30171 * function. Its creation may be customized by replacing the `_.memoize.Cache`
30172 * constructor with one whose instances implement the
30173 * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
30174 * method interface of `clear`, `delete`, `get`, `has`, and `set`.
30175 *
30176 * @static
30177 * @memberOf _
30178 * @since 0.1.0
30179 * @category Function
30180 * @param {Function} func The function to have its output memoized.
30181 * @param {Function} [resolver] The function to resolve the cache key.
30182 * @returns {Function} Returns the new memoized function.
30183 * @example
30184 *
30185 * var object = { 'a': 1, 'b': 2 };
30186 * var other = { 'c': 3, 'd': 4 };
30187 *
30188 * var values = _.memoize(_.values);
30189 * values(object);
30190 * // => [1, 2]
30191 *
30192 * values(other);
30193 * // => [3, 4]
30194 *
30195 * object.a = 2;
30196 * values(object);
30197 * // => [1, 2]
30198 *
30199 * // Modify the result cache.
30200 * values.cache.set(object, ['a', 'b']);
30201 * values(object);
30202 * // => ['a', 'b']
30203 *
30204 * // Replace `_.memoize.Cache`.
30205 * _.memoize.Cache = WeakMap;
30206 */
30207function memoize(func, resolver) {
30208 if (typeof func != 'function' || resolver != null && typeof resolver != 'function') {
30209 throw new TypeError(FUNC_ERROR_TEXT);
30210 }
30211 var memoized = function memoized() {
30212 var args = arguments,
30213 key = resolver ? resolver.apply(this, args) : args[0],
30214 cache = memoized.cache;
30215
30216 if (cache.has(key)) {
30217 return cache.get(key);
30218 }
30219 var result = func.apply(this, args);
30220 memoized.cache = cache.set(key, result) || cache;
30221 return result;
30222 };
30223 memoized.cache = new (memoize.Cache || MapCache)();
30224 return memoized;
30225}
30226
30227// Expose `MapCache`.
30228memoize.Cache = MapCache;
30229
30230module.exports = memoize;
30231
30232/***/ }),
30233/* 186 */
30234/***/ (function(module, exports, __webpack_require__) {
30235
30236var _Symbol = __webpack_require__(12),
30237 arrayMap = __webpack_require__(49),
30238 isArray = __webpack_require__(3),
30239 isSymbol = __webpack_require__(21);
30240
30241/** Used as references for various `Number` constants. */
30242var INFINITY = 1 / 0;
30243
30244/** Used to convert symbols to primitives and strings. */
30245var symbolProto = _Symbol ? _Symbol.prototype : undefined,
30246 symbolToString = symbolProto ? symbolProto.toString : undefined;
30247
30248/**
30249 * The base implementation of `_.toString` which doesn't convert nullish
30250 * values to empty strings.
30251 *
30252 * @private
30253 * @param {*} value The value to process.
30254 * @returns {string} Returns the string.
30255 */
30256function baseToString(value) {
30257 // Exit early for strings to avoid a performance hit in some environments.
30258 if (typeof value == 'string') {
30259 return value;
30260 }
30261 if (isArray(value)) {
30262 // Recursively convert values (susceptible to call stack limits).
30263 return arrayMap(value, baseToString) + '';
30264 }
30265 if (isSymbol(value)) {
30266 return symbolToString ? symbolToString.call(value) : '';
30267 }
30268 var result = value + '';
30269 return result == '0' && 1 / value == -INFINITY ? '-0' : result;
30270}
30271
30272module.exports = baseToString;
30273
30274/***/ }),
30275/* 187 */
30276/***/ (function(module, exports) {
30277
30278/**
30279 * The base implementation of `_.hasIn` without support for deep paths.
30280 *
30281 * @private
30282 * @param {Object} [object] The object to query.
30283 * @param {Array|string} key The key to check.
30284 * @returns {boolean} Returns `true` if `key` exists, else `false`.
30285 */
30286function baseHasIn(object, key) {
30287 return object != null && key in Object(object);
30288}
30289
30290module.exports = baseHasIn;
30291
30292/***/ }),
30293/* 188 */
30294/***/ (function(module, exports, __webpack_require__) {
30295
30296var castPath = __webpack_require__(39),
30297 isArguments = __webpack_require__(28),
30298 isArray = __webpack_require__(3),
30299 isIndex = __webpack_require__(30),
30300 isLength = __webpack_require__(47),
30301 toKey = __webpack_require__(22);
30302
30303/**
30304 * Checks if `path` exists on `object`.
30305 *
30306 * @private
30307 * @param {Object} object The object to query.
30308 * @param {Array|string} path The path to check.
30309 * @param {Function} hasFunc The function to check properties.
30310 * @returns {boolean} Returns `true` if `path` exists, else `false`.
30311 */
30312function hasPath(object, path, hasFunc) {
30313 path = castPath(path, object);
30314
30315 var index = -1,
30316 length = path.length,
30317 result = false;
30318
30319 while (++index < length) {
30320 var key = toKey(path[index]);
30321 if (!(result = object != null && hasFunc(object, key))) {
30322 break;
30323 }
30324 object = object[key];
30325 }
30326 if (result || ++index != length) {
30327 return result;
30328 }
30329 length = object == null ? 0 : object.length;
30330 return !!length && isLength(length) && isIndex(key, length) && (isArray(object) || isArguments(object));
30331}
30332
30333module.exports = hasPath;
30334
30335/***/ }),
30336/* 189 */
30337/***/ (function(module, exports, __webpack_require__) {
30338
30339var baseProperty = __webpack_require__(190),
30340 basePropertyDeep = __webpack_require__(191),
30341 isKey = __webpack_require__(57),
30342 toKey = __webpack_require__(22);
30343
30344/**
30345 * Creates a function that returns the value at `path` of a given object.
30346 *
30347 * @static
30348 * @memberOf _
30349 * @since 2.4.0
30350 * @category Util
30351 * @param {Array|string} path The path of the property to get.
30352 * @returns {Function} Returns the new accessor function.
30353 * @example
30354 *
30355 * var objects = [
30356 * { 'a': { 'b': 2 } },
30357 * { 'a': { 'b': 1 } }
30358 * ];
30359 *
30360 * _.map(objects, _.property('a.b'));
30361 * // => [2, 1]
30362 *
30363 * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
30364 * // => [1, 2]
30365 */
30366function property(path) {
30367 return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
30368}
30369
30370module.exports = property;
30371
30372/***/ }),
30373/* 190 */
30374/***/ (function(module, exports) {
30375
30376/**
30377 * The base implementation of `_.property` without support for deep paths.
30378 *
30379 * @private
30380 * @param {string} key The key of the property to get.
30381 * @returns {Function} Returns the new accessor function.
30382 */
30383function baseProperty(key) {
30384 return function (object) {
30385 return object == null ? undefined : object[key];
30386 };
30387}
30388
30389module.exports = baseProperty;
30390
30391/***/ }),
30392/* 191 */
30393/***/ (function(module, exports, __webpack_require__) {
30394
30395var baseGet = __webpack_require__(56);
30396
30397/**
30398 * A specialized version of `baseProperty` which supports deep paths.
30399 *
30400 * @private
30401 * @param {Array|string} path The path of the property to get.
30402 * @returns {Function} Returns the new accessor function.
30403 */
30404function basePropertyDeep(path) {
30405 return function (object) {
30406 return baseGet(object, path);
30407 };
30408}
30409
30410module.exports = basePropertyDeep;
30411
30412/***/ }),
30413/* 192 */
30414/***/ (function(module, exports, __webpack_require__) {
30415
30416var baseEach = __webpack_require__(27),
30417 isArrayLike = __webpack_require__(8);
30418
30419/**
30420 * The base implementation of `_.map` without support for iteratee shorthands.
30421 *
30422 * @private
30423 * @param {Array|Object} collection The collection to iterate over.
30424 * @param {Function} iteratee The function invoked per iteration.
30425 * @returns {Array} Returns the new mapped array.
30426 */
30427function baseMap(collection, iteratee) {
30428 var index = -1,
30429 result = isArrayLike(collection) ? Array(collection.length) : [];
30430
30431 baseEach(collection, function (value, key, collection) {
30432 result[++index] = iteratee(value, key, collection);
30433 });
30434 return result;
30435}
30436
30437module.exports = baseMap;
30438
30439/***/ }),
30440/* 193 */
30441/***/ (function(module, exports, __webpack_require__) {
30442
30443var baseGetTag = __webpack_require__(6),
30444 isObjectLike = __webpack_require__(5);
30445
30446/** `Object#toString` result references. */
30447var numberTag = '[object Number]';
30448
30449/**
30450 * Checks if `value` is classified as a `Number` primitive or object.
30451 *
30452 * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
30453 * classified as numbers, use the `_.isFinite` method.
30454 *
30455 * @static
30456 * @memberOf _
30457 * @since 0.1.0
30458 * @category Lang
30459 * @param {*} value The value to check.
30460 * @returns {boolean} Returns `true` if `value` is a number, else `false`.
30461 * @example
30462 *
30463 * _.isNumber(3);
30464 * // => true
30465 *
30466 * _.isNumber(Number.MIN_VALUE);
30467 * // => true
30468 *
30469 * _.isNumber(Infinity);
30470 * // => true
30471 *
30472 * _.isNumber('3');
30473 * // => false
30474 */
30475function isNumber(value) {
30476 return typeof value == 'number' || isObjectLike(value) && baseGetTag(value) == numberTag;
30477}
30478
30479module.exports = isNumber;
30480
30481/***/ }),
30482/* 194 */
30483/***/ (function(module, exports, __webpack_require__) {
30484
30485var root = __webpack_require__(4);
30486
30487/* Built-in method references for those with the same name as other `lodash` methods. */
30488var nativeIsFinite = root.isFinite;
30489
30490/**
30491 * Checks if `value` is a finite primitive number.
30492 *
30493 * **Note:** This method is based on
30494 * [`Number.isFinite`](https://mdn.io/Number/isFinite).
30495 *
30496 * @static
30497 * @memberOf _
30498 * @since 0.1.0
30499 * @category Lang
30500 * @param {*} value The value to check.
30501 * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
30502 * @example
30503 *
30504 * _.isFinite(3);
30505 * // => true
30506 *
30507 * _.isFinite(Number.MIN_VALUE);
30508 * // => true
30509 *
30510 * _.isFinite(Infinity);
30511 * // => false
30512 *
30513 * _.isFinite('3');
30514 * // => false
30515 */
30516function isFinite(value) {
30517 return typeof value == 'number' && nativeIsFinite(value);
30518}
30519
30520module.exports = isFinite;
30521
30522/***/ }),
30523/* 195 */
30524/***/ (function(module, exports, __webpack_require__) {
30525
30526var baseGetTag = __webpack_require__(6),
30527 isObjectLike = __webpack_require__(5);
30528
30529/** `Object#toString` result references. */
30530var boolTag = '[object Boolean]';
30531
30532/**
30533 * Checks if `value` is classified as a boolean primitive or object.
30534 *
30535 * @static
30536 * @memberOf _
30537 * @since 0.1.0
30538 * @category Lang
30539 * @param {*} value The value to check.
30540 * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
30541 * @example
30542 *
30543 * _.isBoolean(false);
30544 * // => true
30545 *
30546 * _.isBoolean(null);
30547 * // => false
30548 */
30549function isBoolean(value) {
30550 return value === true || value === false || isObjectLike(value) && baseGetTag(value) == boolTag;
30551}
30552
30553module.exports = isBoolean;
30554
30555/***/ }),
30556/* 196 */
30557/***/ (function(module, exports, __webpack_require__) {
30558
30559var baseKeys = __webpack_require__(74),
30560 getTag = __webpack_require__(38),
30561 isArguments = __webpack_require__(28),
30562 isArray = __webpack_require__(3),
30563 isArrayLike = __webpack_require__(8),
30564 isBuffer = __webpack_require__(29),
30565 isPrototype = __webpack_require__(18),
30566 isTypedArray = __webpack_require__(46);
30567
30568/** `Object#toString` result references. */
30569var mapTag = '[object Map]',
30570 setTag = '[object Set]';
30571
30572/** Used for built-in method references. */
30573var objectProto = Object.prototype;
30574
30575/** Used to check objects for own properties. */
30576var hasOwnProperty = objectProto.hasOwnProperty;
30577
30578/**
30579 * Checks if `value` is an empty object, collection, map, or set.
30580 *
30581 * Objects are considered empty if they have no own enumerable string keyed
30582 * properties.
30583 *
30584 * Array-like values such as `arguments` objects, arrays, buffers, strings, or
30585 * jQuery-like collections are considered empty if they have a `length` of `0`.
30586 * Similarly, maps and sets are considered empty if they have a `size` of `0`.
30587 *
30588 * @static
30589 * @memberOf _
30590 * @since 0.1.0
30591 * @category Lang
30592 * @param {*} value The value to check.
30593 * @returns {boolean} Returns `true` if `value` is empty, else `false`.
30594 * @example
30595 *
30596 * _.isEmpty(null);
30597 * // => true
30598 *
30599 * _.isEmpty(true);
30600 * // => true
30601 *
30602 * _.isEmpty(1);
30603 * // => true
30604 *
30605 * _.isEmpty([1, 2, 3]);
30606 * // => false
30607 *
30608 * _.isEmpty({ 'a': 1 });
30609 * // => false
30610 */
30611function isEmpty(value) {
30612 if (value == null) {
30613 return true;
30614 }
30615 if (isArrayLike(value) && (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' || isBuffer(value) || isTypedArray(value) || isArguments(value))) {
30616 return !value.length;
30617 }
30618 var tag = getTag(value);
30619 if (tag == mapTag || tag == setTag) {
30620 return !value.size;
30621 }
30622 if (isPrototype(value)) {
30623 return !baseKeys(value).length;
30624 }
30625 for (var key in value) {
30626 if (hasOwnProperty.call(value, key)) {
30627 return false;
30628 }
30629 }
30630 return true;
30631}
30632
30633module.exports = isEmpty;
30634
30635/***/ }),
30636/* 197 */
30637/***/ (function(module, exports, __webpack_require__) {
30638
30639var createCaseFirst = __webpack_require__(90);
30640
30641/**
30642 * Converts the first character of `string` to lower case.
30643 *
30644 * @static
30645 * @memberOf _
30646 * @since 4.0.0
30647 * @category String
30648 * @param {string} [string=''] The string to convert.
30649 * @returns {string} Returns the converted string.
30650 * @example
30651 *
30652 * _.lowerFirst('Fred');
30653 * // => 'fred'
30654 *
30655 * _.lowerFirst('FRED');
30656 * // => 'fRED'
30657 */
30658var lowerFirst = createCaseFirst('toLowerCase');
30659
30660module.exports = lowerFirst;
30661
30662/***/ }),
30663/* 198 */
30664/***/ (function(module, exports, __webpack_require__) {
30665
30666var baseSlice = __webpack_require__(199);
30667
30668/**
30669 * Casts `array` to a slice if it's needed.
30670 *
30671 * @private
30672 * @param {Array} array The array to inspect.
30673 * @param {number} start The start position.
30674 * @param {number} [end=array.length] The end position.
30675 * @returns {Array} Returns the cast slice.
30676 */
30677function castSlice(array, start, end) {
30678 var length = array.length;
30679 end = end === undefined ? length : end;
30680 return !start && end >= length ? array : baseSlice(array, start, end);
30681}
30682
30683module.exports = castSlice;
30684
30685/***/ }),
30686/* 199 */
30687/***/ (function(module, exports) {
30688
30689/**
30690 * The base implementation of `_.slice` without an iteratee call guard.
30691 *
30692 * @private
30693 * @param {Array} array The array to slice.
30694 * @param {number} [start=0] The start position.
30695 * @param {number} [end=array.length] The end position.
30696 * @returns {Array} Returns the slice of `array`.
30697 */
30698function baseSlice(array, start, end) {
30699 var index = -1,
30700 length = array.length;
30701
30702 if (start < 0) {
30703 start = -start > length ? 0 : length + start;
30704 }
30705 end = end > length ? length : end;
30706 if (end < 0) {
30707 end += length;
30708 }
30709 length = start > end ? 0 : end - start >>> 0;
30710 start >>>= 0;
30711
30712 var result = Array(length);
30713 while (++index < length) {
30714 result[index] = array[index + start];
30715 }
30716 return result;
30717}
30718
30719module.exports = baseSlice;
30720
30721/***/ }),
30722/* 200 */
30723/***/ (function(module, exports) {
30724
30725/**
30726 * Converts an ASCII `string` to an array.
30727 *
30728 * @private
30729 * @param {string} string The string to convert.
30730 * @returns {Array} Returns the converted array.
30731 */
30732function asciiToArray(string) {
30733 return string.split('');
30734}
30735
30736module.exports = asciiToArray;
30737
30738/***/ }),
30739/* 201 */
30740/***/ (function(module, exports) {
30741
30742/** Used to compose unicode character classes. */
30743var rsAstralRange = '\\ud800-\\udfff',
30744 rsComboMarksRange = '\\u0300-\\u036f',
30745 reComboHalfMarksRange = '\\ufe20-\\ufe2f',
30746 rsComboSymbolsRange = '\\u20d0-\\u20ff',
30747 rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
30748 rsVarRange = '\\ufe0e\\ufe0f';
30749
30750/** Used to compose unicode capture groups. */
30751var rsAstral = '[' + rsAstralRange + ']',
30752 rsCombo = '[' + rsComboRange + ']',
30753 rsFitz = '\\ud83c[\\udffb-\\udfff]',
30754 rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
30755 rsNonAstral = '[^' + rsAstralRange + ']',
30756 rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
30757 rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
30758 rsZWJ = '\\u200d';
30759
30760/** Used to compose unicode regexes. */
30761var reOptMod = rsModifier + '?',
30762 rsOptVar = '[' + rsVarRange + ']?',
30763 rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
30764 rsSeq = rsOptVar + reOptMod + rsOptJoin,
30765 rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
30766
30767/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
30768var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
30769
30770/**
30771 * Converts a Unicode `string` to an array.
30772 *
30773 * @private
30774 * @param {string} string The string to convert.
30775 * @returns {Array} Returns the converted array.
30776 */
30777function unicodeToArray(string) {
30778 return string.match(reUnicode) || [];
30779}
30780
30781module.exports = unicodeToArray;
30782
30783/***/ }),
30784/* 202 */
30785/***/ (function(module, exports, __webpack_require__) {
30786
30787var createCaseFirst = __webpack_require__(90);
30788
30789/**
30790 * Converts the first character of `string` to upper case.
30791 *
30792 * @static
30793 * @memberOf _
30794 * @since 4.0.0
30795 * @category String
30796 * @param {string} [string=''] The string to convert.
30797 * @returns {string} Returns the converted string.
30798 * @example
30799 *
30800 * _.upperFirst('fred');
30801 * // => 'Fred'
30802 *
30803 * _.upperFirst('FRED');
30804 * // => 'FRED'
30805 */
30806var upperFirst = createCaseFirst('toUpperCase');
30807
30808module.exports = upperFirst;
30809
30810/***/ }),
30811/* 203 */
30812/***/ (function(module, exports, __webpack_require__) {
30813
30814var createCompounder = __webpack_require__(204);
30815
30816/**
30817 * Converts `string`, as space separated words, to upper case.
30818 *
30819 * @static
30820 * @memberOf _
30821 * @since 4.0.0
30822 * @category String
30823 * @param {string} [string=''] The string to convert.
30824 * @returns {string} Returns the upper cased string.
30825 * @example
30826 *
30827 * _.upperCase('--foo-bar');
30828 * // => 'FOO BAR'
30829 *
30830 * _.upperCase('fooBar');
30831 * // => 'FOO BAR'
30832 *
30833 * _.upperCase('__foo_bar__');
30834 * // => 'FOO BAR'
30835 */
30836var upperCase = createCompounder(function (result, word, index) {
30837 return result + (index ? ' ' : '') + word.toUpperCase();
30838});
30839
30840module.exports = upperCase;
30841
30842/***/ }),
30843/* 204 */
30844/***/ (function(module, exports, __webpack_require__) {
30845
30846var arrayReduce = __webpack_require__(58),
30847 deburr = __webpack_require__(205),
30848 words = __webpack_require__(208);
30849
30850/** Used to compose unicode capture groups. */
30851var rsApos = '[\'\u2019]';
30852
30853/** Used to match apostrophes. */
30854var reApos = RegExp(rsApos, 'g');
30855
30856/**
30857 * Creates a function like `_.camelCase`.
30858 *
30859 * @private
30860 * @param {Function} callback The function to combine each word.
30861 * @returns {Function} Returns the new compounder function.
30862 */
30863function createCompounder(callback) {
30864 return function (string) {
30865 return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
30866 };
30867}
30868
30869module.exports = createCompounder;
30870
30871/***/ }),
30872/* 205 */
30873/***/ (function(module, exports, __webpack_require__) {
30874
30875var deburrLetter = __webpack_require__(206),
30876 toString = __webpack_require__(15);
30877
30878/** Used to match Latin Unicode letters (excluding mathematical operators). */
30879var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
30880
30881/** Used to compose unicode character classes. */
30882var rsComboMarksRange = '\\u0300-\\u036f',
30883 reComboHalfMarksRange = '\\ufe20-\\ufe2f',
30884 rsComboSymbolsRange = '\\u20d0-\\u20ff',
30885 rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange;
30886
30887/** Used to compose unicode capture groups. */
30888var rsCombo = '[' + rsComboRange + ']';
30889
30890/**
30891 * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
30892 * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
30893 */
30894var reComboMark = RegExp(rsCombo, 'g');
30895
30896/**
30897 * Deburrs `string` by converting
30898 * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
30899 * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
30900 * letters to basic Latin letters and removing
30901 * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
30902 *
30903 * @static
30904 * @memberOf _
30905 * @since 3.0.0
30906 * @category String
30907 * @param {string} [string=''] The string to deburr.
30908 * @returns {string} Returns the deburred string.
30909 * @example
30910 *
30911 * _.deburr('déjà vu');
30912 * // => 'deja vu'
30913 */
30914function deburr(string) {
30915 string = toString(string);
30916 return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
30917}
30918
30919module.exports = deburr;
30920
30921/***/ }),
30922/* 206 */
30923/***/ (function(module, exports, __webpack_require__) {
30924
30925var basePropertyOf = __webpack_require__(207);
30926
30927/** Used to map Latin Unicode letters to basic Latin letters. */
30928var deburredLetters = {
30929 // Latin-1 Supplement block.
30930 '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
30931 '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
30932 '\xc7': 'C', '\xe7': 'c',
30933 '\xd0': 'D', '\xf0': 'd',
30934 '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
30935 '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
30936 '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
30937 '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
30938 '\xd1': 'N', '\xf1': 'n',
30939 '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
30940 '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
30941 '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
30942 '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
30943 '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
30944 '\xc6': 'Ae', '\xe6': 'ae',
30945 '\xde': 'Th', '\xfe': 'th',
30946 '\xdf': 'ss',
30947 // Latin Extended-A block.
30948 '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
30949 '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
30950 '\u0106': 'C', '\u0108': 'C', '\u010A': 'C', '\u010C': 'C',
30951 '\u0107': 'c', '\u0109': 'c', '\u010B': 'c', '\u010D': 'c',
30952 '\u010E': 'D', '\u0110': 'D', '\u010F': 'd', '\u0111': 'd',
30953 '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011A': 'E',
30954 '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011B': 'e',
30955 '\u011C': 'G', '\u011E': 'G', '\u0120': 'G', '\u0122': 'G',
30956 '\u011D': 'g', '\u011F': 'g', '\u0121': 'g', '\u0123': 'g',
30957 '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
30958 '\u0128': 'I', '\u012A': 'I', '\u012C': 'I', '\u012E': 'I', '\u0130': 'I',
30959 '\u0129': 'i', '\u012B': 'i', '\u012D': 'i', '\u012F': 'i', '\u0131': 'i',
30960 '\u0134': 'J', '\u0135': 'j',
30961 '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
30962 '\u0139': 'L', '\u013B': 'L', '\u013D': 'L', '\u013F': 'L', '\u0141': 'L',
30963 '\u013A': 'l', '\u013C': 'l', '\u013E': 'l', '\u0140': 'l', '\u0142': 'l',
30964 '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014A': 'N',
30965 '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014B': 'n',
30966 '\u014C': 'O', '\u014E': 'O', '\u0150': 'O',
30967 '\u014D': 'o', '\u014F': 'o', '\u0151': 'o',
30968 '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
30969 '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
30970 '\u015A': 'S', '\u015C': 'S', '\u015E': 'S', '\u0160': 'S',
30971 '\u015B': 's', '\u015D': 's', '\u015F': 's', '\u0161': 's',
30972 '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
30973 '\u0163': 't', '\u0165': 't', '\u0167': 't',
30974 '\u0168': 'U', '\u016A': 'U', '\u016C': 'U', '\u016E': 'U', '\u0170': 'U', '\u0172': 'U',
30975 '\u0169': 'u', '\u016B': 'u', '\u016D': 'u', '\u016F': 'u', '\u0171': 'u', '\u0173': 'u',
30976 '\u0174': 'W', '\u0175': 'w',
30977 '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
30978 '\u0179': 'Z', '\u017B': 'Z', '\u017D': 'Z',
30979 '\u017A': 'z', '\u017C': 'z', '\u017E': 'z',
30980 '\u0132': 'IJ', '\u0133': 'ij',
30981 '\u0152': 'Oe', '\u0153': 'oe',
30982 '\u0149': "'n", '\u017F': 's'
30983};
30984
30985/**
30986 * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
30987 * letters to basic Latin letters.
30988 *
30989 * @private
30990 * @param {string} letter The matched letter to deburr.
30991 * @returns {string} Returns the deburred letter.
30992 */
30993var deburrLetter = basePropertyOf(deburredLetters);
30994
30995module.exports = deburrLetter;
30996
30997/***/ }),
30998/* 207 */
30999/***/ (function(module, exports) {
31000
31001/**
31002 * The base implementation of `_.propertyOf` without support for deep paths.
31003 *
31004 * @private
31005 * @param {Object} object The object to query.
31006 * @returns {Function} Returns the new accessor function.
31007 */
31008function basePropertyOf(object) {
31009 return function (key) {
31010 return object == null ? undefined : object[key];
31011 };
31012}
31013
31014module.exports = basePropertyOf;
31015
31016/***/ }),
31017/* 208 */
31018/***/ (function(module, exports, __webpack_require__) {
31019
31020var asciiWords = __webpack_require__(209),
31021 hasUnicodeWord = __webpack_require__(210),
31022 toString = __webpack_require__(15),
31023 unicodeWords = __webpack_require__(211);
31024
31025/**
31026 * Splits `string` into an array of its words.
31027 *
31028 * @static
31029 * @memberOf _
31030 * @since 3.0.0
31031 * @category String
31032 * @param {string} [string=''] The string to inspect.
31033 * @param {RegExp|string} [pattern] The pattern to match words.
31034 * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
31035 * @returns {Array} Returns the words of `string`.
31036 * @example
31037 *
31038 * _.words('fred, barney, & pebbles');
31039 * // => ['fred', 'barney', 'pebbles']
31040 *
31041 * _.words('fred, barney, & pebbles', /[^, ]+/g);
31042 * // => ['fred', 'barney', '&', 'pebbles']
31043 */
31044function words(string, pattern, guard) {
31045 string = toString(string);
31046 pattern = guard ? undefined : pattern;
31047
31048 if (pattern === undefined) {
31049 return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
31050 }
31051 return string.match(pattern) || [];
31052}
31053
31054module.exports = words;
31055
31056/***/ }),
31057/* 209 */
31058/***/ (function(module, exports) {
31059
31060/** Used to match words composed of alphanumeric characters. */
31061var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
31062
31063/**
31064 * Splits an ASCII `string` into an array of its words.
31065 *
31066 * @private
31067 * @param {string} The string to inspect.
31068 * @returns {Array} Returns the words of `string`.
31069 */
31070function asciiWords(string) {
31071 return string.match(reAsciiWord) || [];
31072}
31073
31074module.exports = asciiWords;
31075
31076/***/ }),
31077/* 210 */
31078/***/ (function(module, exports) {
31079
31080/** Used to detect strings that need a more robust regexp to match words. */
31081var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
31082
31083/**
31084 * Checks if `string` contains a word composed of Unicode symbols.
31085 *
31086 * @private
31087 * @param {string} string The string to inspect.
31088 * @returns {boolean} Returns `true` if a word is found, else `false`.
31089 */
31090function hasUnicodeWord(string) {
31091 return reHasUnicodeWord.test(string);
31092}
31093
31094module.exports = hasUnicodeWord;
31095
31096/***/ }),
31097/* 211 */
31098/***/ (function(module, exports) {
31099
31100/** Used to compose unicode character classes. */
31101var rsAstralRange = '\\ud800-\\udfff',
31102 rsComboMarksRange = '\\u0300-\\u036f',
31103 reComboHalfMarksRange = '\\ufe20-\\ufe2f',
31104 rsComboSymbolsRange = '\\u20d0-\\u20ff',
31105 rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
31106 rsDingbatRange = '\\u2700-\\u27bf',
31107 rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
31108 rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
31109 rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
31110 rsPunctuationRange = '\\u2000-\\u206f',
31111 rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000',
31112 rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
31113 rsVarRange = '\\ufe0e\\ufe0f',
31114 rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
31115
31116/** Used to compose unicode capture groups. */
31117var rsApos = '[\'\u2019]',
31118 rsBreak = '[' + rsBreakRange + ']',
31119 rsCombo = '[' + rsComboRange + ']',
31120 rsDigits = '\\d+',
31121 rsDingbat = '[' + rsDingbatRange + ']',
31122 rsLower = '[' + rsLowerRange + ']',
31123 rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
31124 rsFitz = '\\ud83c[\\udffb-\\udfff]',
31125 rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
31126 rsNonAstral = '[^' + rsAstralRange + ']',
31127 rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
31128 rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
31129 rsUpper = '[' + rsUpperRange + ']',
31130 rsZWJ = '\\u200d';
31131
31132/** Used to compose unicode regexes. */
31133var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
31134 rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
31135 rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
31136 rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
31137 reOptMod = rsModifier + '?',
31138 rsOptVar = '[' + rsVarRange + ']?',
31139 rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
31140 rsOrdLower = '\\d*(?:(?:1st|2nd|3rd|(?![123])\\dth)\\b)',
31141 rsOrdUpper = '\\d*(?:(?:1ST|2ND|3RD|(?![123])\\dTH)\\b)',
31142 rsSeq = rsOptVar + reOptMod + rsOptJoin,
31143 rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq;
31144
31145/** Used to match complex or compound words. */
31146var reUnicodeWord = RegExp([rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')', rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')', rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower, rsUpper + '+' + rsOptContrUpper, rsOrdUpper, rsOrdLower, rsDigits, rsEmoji].join('|'), 'g');
31147
31148/**
31149 * Splits a Unicode `string` into an array of its words.
31150 *
31151 * @private
31152 * @param {string} The string to inspect.
31153 * @returns {Array} Returns the words of `string`.
31154 */
31155function unicodeWords(string) {
31156 return string.match(reUnicodeWord) || [];
31157}
31158
31159module.exports = unicodeWords;
31160
31161/***/ }),
31162/* 212 */
31163/***/ (function(module, exports) {
31164
31165/**
31166 * Checks if `value` is `null`.
31167 *
31168 * @static
31169 * @memberOf _
31170 * @since 0.1.0
31171 * @category Lang
31172 * @param {*} value The value to check.
31173 * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
31174 * @example
31175 *
31176 * _.isNull(null);
31177 * // => true
31178 *
31179 * _.isNull(void 0);
31180 * // => false
31181 */
31182function isNull(value) {
31183 return value === null;
31184}
31185
31186module.exports = isNull;
31187
31188/***/ }),
31189/* 213 */
31190/***/ (function(module, exports, __webpack_require__) {
31191
31192var baseIsDate = __webpack_require__(214),
31193 baseUnary = __webpack_require__(72),
31194 nodeUtil = __webpack_require__(73);
31195
31196/* Node.js helper references. */
31197var nodeIsDate = nodeUtil && nodeUtil.isDate;
31198
31199/**
31200 * Checks if `value` is classified as a `Date` object.
31201 *
31202 * @static
31203 * @memberOf _
31204 * @since 0.1.0
31205 * @category Lang
31206 * @param {*} value The value to check.
31207 * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
31208 * @example
31209 *
31210 * _.isDate(new Date);
31211 * // => true
31212 *
31213 * _.isDate('Mon April 23 2012');
31214 * // => false
31215 */
31216var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
31217
31218module.exports = isDate;
31219
31220/***/ }),
31221/* 214 */
31222/***/ (function(module, exports, __webpack_require__) {
31223
31224var baseGetTag = __webpack_require__(6),
31225 isObjectLike = __webpack_require__(5);
31226
31227/** `Object#toString` result references. */
31228var dateTag = '[object Date]';
31229
31230/**
31231 * The base implementation of `_.isDate` without Node.js optimizations.
31232 *
31233 * @private
31234 * @param {*} value The value to check.
31235 * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
31236 */
31237function baseIsDate(value) {
31238 return isObjectLike(value) && baseGetTag(value) == dateTag;
31239}
31240
31241module.exports = baseIsDate;
31242
31243/***/ }),
31244/* 215 */
31245/***/ (function(module, exports, __webpack_require__) {
31246
31247var baseGetTag = __webpack_require__(6),
31248 getPrototype = __webpack_require__(59),
31249 isObjectLike = __webpack_require__(5);
31250
31251/** `Object#toString` result references. */
31252var objectTag = '[object Object]';
31253
31254/** Used for built-in method references. */
31255var funcProto = Function.prototype,
31256 objectProto = Object.prototype;
31257
31258/** Used to resolve the decompiled source of functions. */
31259var funcToString = funcProto.toString;
31260
31261/** Used to check objects for own properties. */
31262var hasOwnProperty = objectProto.hasOwnProperty;
31263
31264/** Used to infer the `Object` constructor. */
31265var objectCtorString = funcToString.call(Object);
31266
31267/**
31268 * Checks if `value` is a plain object, that is, an object created by the
31269 * `Object` constructor or one with a `[[Prototype]]` of `null`.
31270 *
31271 * @static
31272 * @memberOf _
31273 * @since 0.8.0
31274 * @category Lang
31275 * @param {*} value The value to check.
31276 * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
31277 * @example
31278 *
31279 * function Foo() {
31280 * this.a = 1;
31281 * }
31282 *
31283 * _.isPlainObject(new Foo);
31284 * // => false
31285 *
31286 * _.isPlainObject([1, 2, 3]);
31287 * // => false
31288 *
31289 * _.isPlainObject({ 'x': 0, 'y': 0 });
31290 * // => true
31291 *
31292 * _.isPlainObject(Object.create(null));
31293 * // => true
31294 */
31295function isPlainObject(value) {
31296 if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
31297 return false;
31298 }
31299 var proto = getPrototype(value);
31300 if (proto === null) {
31301 return true;
31302 }
31303 var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
31304 return typeof Ctor == 'function' && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
31305}
31306
31307module.exports = isPlainObject;
31308
31309/***/ }),
31310/* 216 */
31311/***/ (function(module, exports, __webpack_require__) {
31312
31313var _Symbol = __webpack_require__(12),
31314 copyArray = __webpack_require__(94),
31315 getTag = __webpack_require__(38),
31316 isArrayLike = __webpack_require__(8),
31317 isString = __webpack_require__(89),
31318 iteratorToArray = __webpack_require__(217),
31319 mapToArray = __webpack_require__(53),
31320 setToArray = __webpack_require__(20),
31321 stringToArray = __webpack_require__(92),
31322 values = __webpack_require__(218);
31323
31324/** `Object#toString` result references. */
31325var mapTag = '[object Map]',
31326 setTag = '[object Set]';
31327
31328/** Built-in value references. */
31329var symIterator = _Symbol ? _Symbol.iterator : undefined;
31330
31331/**
31332 * Converts `value` to an array.
31333 *
31334 * @static
31335 * @since 0.1.0
31336 * @memberOf _
31337 * @category Lang
31338 * @param {*} value The value to convert.
31339 * @returns {Array} Returns the converted array.
31340 * @example
31341 *
31342 * _.toArray({ 'a': 1, 'b': 2 });
31343 * // => [1, 2]
31344 *
31345 * _.toArray('abc');
31346 * // => ['a', 'b', 'c']
31347 *
31348 * _.toArray(1);
31349 * // => []
31350 *
31351 * _.toArray(null);
31352 * // => []
31353 */
31354function toArray(value) {
31355 if (!value) {
31356 return [];
31357 }
31358 if (isArrayLike(value)) {
31359 return isString(value) ? stringToArray(value) : copyArray(value);
31360 }
31361 if (symIterator && value[symIterator]) {
31362 return iteratorToArray(value[symIterator]());
31363 }
31364 var tag = getTag(value),
31365 func = tag == mapTag ? mapToArray : tag == setTag ? setToArray : values;
31366
31367 return func(value);
31368}
31369
31370module.exports = toArray;
31371
31372/***/ }),
31373/* 217 */
31374/***/ (function(module, exports) {
31375
31376/**
31377 * Converts `iterator` to an array.
31378 *
31379 * @private
31380 * @param {Object} iterator The iterator to convert.
31381 * @returns {Array} Returns the converted array.
31382 */
31383function iteratorToArray(iterator) {
31384 var data,
31385 result = [];
31386
31387 while (!(data = iterator.next()).done) {
31388 result.push(data.value);
31389 }
31390 return result;
31391}
31392
31393module.exports = iteratorToArray;
31394
31395/***/ }),
31396/* 218 */
31397/***/ (function(module, exports, __webpack_require__) {
31398
31399var baseValues = __webpack_require__(219),
31400 keys = __webpack_require__(11);
31401
31402/**
31403 * Creates an array of the own enumerable string keyed property values of `object`.
31404 *
31405 * **Note:** Non-object values are coerced to objects.
31406 *
31407 * @static
31408 * @since 0.1.0
31409 * @memberOf _
31410 * @category Object
31411 * @param {Object} object The object to query.
31412 * @returns {Array} Returns the array of property values.
31413 * @example
31414 *
31415 * function Foo() {
31416 * this.a = 1;
31417 * this.b = 2;
31418 * }
31419 *
31420 * Foo.prototype.c = 3;
31421 *
31422 * _.values(new Foo);
31423 * // => [1, 2] (iteration order is not guaranteed)
31424 *
31425 * _.values('hi');
31426 * // => ['h', 'i']
31427 */
31428function values(object) {
31429 return object == null ? [] : baseValues(object, keys(object));
31430}
31431
31432module.exports = values;
31433
31434/***/ }),
31435/* 219 */
31436/***/ (function(module, exports, __webpack_require__) {
31437
31438var arrayMap = __webpack_require__(49);
31439
31440/**
31441 * The base implementation of `_.values` and `_.valuesIn` which creates an
31442 * array of `object` property values corresponding to the property names
31443 * of `props`.
31444 *
31445 * @private
31446 * @param {Object} object The object to query.
31447 * @param {Array} props The property names to get values for.
31448 * @returns {Object} Returns the array of property values.
31449 */
31450function baseValues(object, props) {
31451 return arrayMap(props, function (key) {
31452 return object[key];
31453 });
31454}
31455
31456module.exports = baseValues;
31457
31458/***/ }),
31459/* 220 */
31460/***/ (function(module, exports, __webpack_require__) {
31461
31462var baseIndexOf = __webpack_require__(95),
31463 toInteger = __webpack_require__(96);
31464
31465/* Built-in method references for those with the same name as other `lodash` methods. */
31466var nativeMax = Math.max;
31467
31468/**
31469 * Gets the index at which the first occurrence of `value` is found in `array`
31470 * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
31471 * for equality comparisons. If `fromIndex` is negative, it's used as the
31472 * offset from the end of `array`.
31473 *
31474 * @static
31475 * @memberOf _
31476 * @since 0.1.0
31477 * @category Array
31478 * @param {Array} array The array to inspect.
31479 * @param {*} value The value to search for.
31480 * @param {number} [fromIndex=0] The index to search from.
31481 * @returns {number} Returns the index of the matched value, else `-1`.
31482 * @example
31483 *
31484 * _.indexOf([1, 2, 1, 2], 2);
31485 * // => 1
31486 *
31487 * // Search from the `fromIndex`.
31488 * _.indexOf([1, 2, 1, 2], 2, 2);
31489 * // => 3
31490 */
31491function indexOf(array, value, fromIndex) {
31492 var length = array == null ? 0 : array.length;
31493 if (!length) {
31494 return -1;
31495 }
31496 var index = fromIndex == null ? 0 : toInteger(fromIndex);
31497 if (index < 0) {
31498 index = nativeMax(length + index, 0);
31499 }
31500 return baseIndexOf(array, value, index);
31501}
31502
31503module.exports = indexOf;
31504
31505/***/ }),
31506/* 221 */
31507/***/ (function(module, exports) {
31508
31509/**
31510 * The base implementation of `_.findIndex` and `_.findLastIndex` without
31511 * support for iteratee shorthands.
31512 *
31513 * @private
31514 * @param {Array} array The array to inspect.
31515 * @param {Function} predicate The function invoked per iteration.
31516 * @param {number} fromIndex The index to search from.
31517 * @param {boolean} [fromRight] Specify iterating from right to left.
31518 * @returns {number} Returns the index of the matched value, else `-1`.
31519 */
31520function baseFindIndex(array, predicate, fromIndex, fromRight) {
31521 var length = array.length,
31522 index = fromIndex + (fromRight ? 1 : -1);
31523
31524 while (fromRight ? index-- : ++index < length) {
31525 if (predicate(array[index], index, array)) {
31526 return index;
31527 }
31528 }
31529 return -1;
31530}
31531
31532module.exports = baseFindIndex;
31533
31534/***/ }),
31535/* 222 */
31536/***/ (function(module, exports) {
31537
31538/**
31539 * The base implementation of `_.isNaN` without support for number objects.
31540 *
31541 * @private
31542 * @param {*} value The value to check.
31543 * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
31544 */
31545function baseIsNaN(value) {
31546 return value !== value;
31547}
31548
31549module.exports = baseIsNaN;
31550
31551/***/ }),
31552/* 223 */
31553/***/ (function(module, exports) {
31554
31555/**
31556 * A specialized version of `_.indexOf` which performs strict equality
31557 * comparisons of values, i.e. `===`.
31558 *
31559 * @private
31560 * @param {Array} array The array to inspect.
31561 * @param {*} value The value to search for.
31562 * @param {number} fromIndex The index to search from.
31563 * @returns {number} Returns the index of the matched value, else `-1`.
31564 */
31565function strictIndexOf(array, value, fromIndex) {
31566 var index = fromIndex - 1,
31567 length = array.length;
31568
31569 while (++index < length) {
31570 if (array[index] === value) {
31571 return index;
31572 }
31573 }
31574 return -1;
31575}
31576
31577module.exports = strictIndexOf;
31578
31579/***/ }),
31580/* 224 */
31581/***/ (function(module, exports, __webpack_require__) {
31582
31583var toNumber = __webpack_require__(97);
31584
31585/** Used as references for various `Number` constants. */
31586var INFINITY = 1 / 0,
31587 MAX_INTEGER = 1.7976931348623157e+308;
31588
31589/**
31590 * Converts `value` to a finite number.
31591 *
31592 * @static
31593 * @memberOf _
31594 * @since 4.12.0
31595 * @category Lang
31596 * @param {*} value The value to convert.
31597 * @returns {number} Returns the converted number.
31598 * @example
31599 *
31600 * _.toFinite(3.2);
31601 * // => 3.2
31602 *
31603 * _.toFinite(Number.MIN_VALUE);
31604 * // => 5e-324
31605 *
31606 * _.toFinite(Infinity);
31607 * // => 1.7976931348623157e+308
31608 *
31609 * _.toFinite('3.2');
31610 * // => 3.2
31611 */
31612function toFinite(value) {
31613 if (!value) {
31614 return value === 0 ? value : 0;
31615 }
31616 value = toNumber(value);
31617 if (value === INFINITY || value === -INFINITY) {
31618 var sign = value < 0 ? -1 : 1;
31619 return sign * MAX_INTEGER;
31620 }
31621 return value === value ? value : 0;
31622}
31623
31624module.exports = toFinite;
31625
31626/***/ }),
31627/* 225 */
31628/***/ (function(module, exports, __webpack_require__) {
31629
31630var baseRest = __webpack_require__(99),
31631 isIterateeCall = __webpack_require__(230);
31632
31633/**
31634 * Creates a function like `_.assign`.
31635 *
31636 * @private
31637 * @param {Function} assigner The function to assign values.
31638 * @returns {Function} Returns the new assigner function.
31639 */
31640function createAssigner(assigner) {
31641 return baseRest(function (object, sources) {
31642 var index = -1,
31643 length = sources.length,
31644 customizer = length > 1 ? sources[length - 1] : undefined,
31645 guard = length > 2 ? sources[2] : undefined;
31646
31647 customizer = assigner.length > 3 && typeof customizer == 'function' ? (length--, customizer) : undefined;
31648
31649 if (guard && isIterateeCall(sources[0], sources[1], guard)) {
31650 customizer = length < 3 ? undefined : customizer;
31651 length = 1;
31652 }
31653 object = Object(object);
31654 while (++index < length) {
31655 var source = sources[index];
31656 if (source) {
31657 assigner(object, source, index, customizer);
31658 }
31659 }
31660 return object;
31661 });
31662}
31663
31664module.exports = createAssigner;
31665
31666/***/ }),
31667/* 226 */
31668/***/ (function(module, exports) {
31669
31670/**
31671 * A faster alternative to `Function#apply`, this function invokes `func`
31672 * with the `this` binding of `thisArg` and the arguments of `args`.
31673 *
31674 * @private
31675 * @param {Function} func The function to invoke.
31676 * @param {*} thisArg The `this` binding of `func`.
31677 * @param {Array} args The arguments to invoke `func` with.
31678 * @returns {*} Returns the result of `func`.
31679 */
31680function apply(func, thisArg, args) {
31681 switch (args.length) {
31682 case 0:
31683 return func.call(thisArg);
31684 case 1:
31685 return func.call(thisArg, args[0]);
31686 case 2:
31687 return func.call(thisArg, args[0], args[1]);
31688 case 3:
31689 return func.call(thisArg, args[0], args[1], args[2]);
31690 }
31691 return func.apply(thisArg, args);
31692}
31693
31694module.exports = apply;
31695
31696/***/ }),
31697/* 227 */
31698/***/ (function(module, exports, __webpack_require__) {
31699
31700var constant = __webpack_require__(228),
31701 defineProperty = __webpack_require__(98),
31702 identity = __webpack_require__(31);
31703
31704/**
31705 * The base implementation of `setToString` without support for hot loop shorting.
31706 *
31707 * @private
31708 * @param {Function} func The function to modify.
31709 * @param {Function} string The `toString` result.
31710 * @returns {Function} Returns `func`.
31711 */
31712var baseSetToString = !defineProperty ? identity : function (func, string) {
31713 return defineProperty(func, 'toString', {
31714 'configurable': true,
31715 'enumerable': false,
31716 'value': constant(string),
31717 'writable': true
31718 });
31719};
31720
31721module.exports = baseSetToString;
31722
31723/***/ }),
31724/* 228 */
31725/***/ (function(module, exports) {
31726
31727/**
31728 * Creates a function that returns `value`.
31729 *
31730 * @static
31731 * @memberOf _
31732 * @since 2.4.0
31733 * @category Util
31734 * @param {*} value The value to return from the new function.
31735 * @returns {Function} Returns the new constant function.
31736 * @example
31737 *
31738 * var objects = _.times(2, _.constant({ 'a': 1 }));
31739 *
31740 * console.log(objects);
31741 * // => [{ 'a': 1 }, { 'a': 1 }]
31742 *
31743 * console.log(objects[0] === objects[1]);
31744 * // => true
31745 */
31746function constant(value) {
31747 return function () {
31748 return value;
31749 };
31750}
31751
31752module.exports = constant;
31753
31754/***/ }),
31755/* 229 */
31756/***/ (function(module, exports) {
31757
31758/** Used to detect hot functions by number of calls within a span of milliseconds. */
31759var HOT_COUNT = 800,
31760 HOT_SPAN = 16;
31761
31762/* Built-in method references for those with the same name as other `lodash` methods. */
31763var nativeNow = Date.now;
31764
31765/**
31766 * Creates a function that'll short out and invoke `identity` instead
31767 * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
31768 * milliseconds.
31769 *
31770 * @private
31771 * @param {Function} func The function to restrict.
31772 * @returns {Function} Returns the new shortable function.
31773 */
31774function shortOut(func) {
31775 var count = 0,
31776 lastCalled = 0;
31777
31778 return function () {
31779 var stamp = nativeNow(),
31780 remaining = HOT_SPAN - (stamp - lastCalled);
31781
31782 lastCalled = stamp;
31783 if (remaining > 0) {
31784 if (++count >= HOT_COUNT) {
31785 return arguments[0];
31786 }
31787 } else {
31788 count = 0;
31789 }
31790 return func.apply(undefined, arguments);
31791 };
31792}
31793
31794module.exports = shortOut;
31795
31796/***/ }),
31797/* 230 */
31798/***/ (function(module, exports, __webpack_require__) {
31799
31800var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
31801
31802var eq = __webpack_require__(34),
31803 isArrayLike = __webpack_require__(8),
31804 isIndex = __webpack_require__(30),
31805 isObject = __webpack_require__(7);
31806
31807/**
31808 * Checks if the given arguments are from an iteratee call.
31809 *
31810 * @private
31811 * @param {*} value The potential iteratee value argument.
31812 * @param {*} index The potential iteratee index or key argument.
31813 * @param {*} object The potential iteratee object argument.
31814 * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
31815 * else `false`.
31816 */
31817function isIterateeCall(value, index, object) {
31818 if (!isObject(object)) {
31819 return false;
31820 }
31821 var type = typeof index === 'undefined' ? 'undefined' : _typeof(index);
31822 if (type == 'number' ? isArrayLike(object) && isIndex(index, object.length) : type == 'string' && index in object) {
31823 return eq(object[index], value);
31824 }
31825 return false;
31826}
31827
31828module.exports = isIterateeCall;
31829
31830/***/ }),
31831/* 231 */
31832/***/ (function(module, exports, __webpack_require__) {
31833
31834var baseAssignValue = __webpack_require__(61),
31835 createAggregator = __webpack_require__(232);
31836
31837/** Used for built-in method references. */
31838var objectProto = Object.prototype;
31839
31840/** Used to check objects for own properties. */
31841var hasOwnProperty = objectProto.hasOwnProperty;
31842
31843/**
31844 * Creates an object composed of keys generated from the results of running
31845 * each element of `collection` thru `iteratee`. The order of grouped values
31846 * is determined by the order they occur in `collection`. The corresponding
31847 * value of each key is an array of elements responsible for generating the
31848 * key. The iteratee is invoked with one argument: (value).
31849 *
31850 * @static
31851 * @memberOf _
31852 * @since 0.1.0
31853 * @category Collection
31854 * @param {Array|Object} collection The collection to iterate over.
31855 * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
31856 * @returns {Object} Returns the composed aggregate object.
31857 * @example
31858 *
31859 * _.groupBy([6.1, 4.2, 6.3], Math.floor);
31860 * // => { '4': [4.2], '6': [6.1, 6.3] }
31861 *
31862 * // The `_.property` iteratee shorthand.
31863 * _.groupBy(['one', 'two', 'three'], 'length');
31864 * // => { '3': ['one', 'two'], '5': ['three'] }
31865 */
31866var groupBy = createAggregator(function (result, value, key) {
31867 if (hasOwnProperty.call(result, key)) {
31868 result[key].push(value);
31869 } else {
31870 baseAssignValue(result, key, [value]);
31871 }
31872});
31873
31874module.exports = groupBy;
31875
31876/***/ }),
31877/* 232 */
31878/***/ (function(module, exports, __webpack_require__) {
31879
31880var arrayAggregator = __webpack_require__(233),
31881 baseAggregator = __webpack_require__(234),
31882 baseIteratee = __webpack_require__(19),
31883 isArray = __webpack_require__(3);
31884
31885/**
31886 * Creates a function like `_.groupBy`.
31887 *
31888 * @private
31889 * @param {Function} setter The function to set accumulator values.
31890 * @param {Function} [initializer] The accumulator object initializer.
31891 * @returns {Function} Returns the new aggregator function.
31892 */
31893function createAggregator(setter, initializer) {
31894 return function (collection, iteratee) {
31895 var func = isArray(collection) ? arrayAggregator : baseAggregator,
31896 accumulator = initializer ? initializer() : {};
31897
31898 return func(collection, setter, baseIteratee(iteratee, 2), accumulator);
31899 };
31900}
31901
31902module.exports = createAggregator;
31903
31904/***/ }),
31905/* 233 */
31906/***/ (function(module, exports) {
31907
31908/**
31909 * A specialized version of `baseAggregator` for arrays.
31910 *
31911 * @private
31912 * @param {Array} [array] The array to iterate over.
31913 * @param {Function} setter The function to set `accumulator` values.
31914 * @param {Function} iteratee The iteratee to transform keys.
31915 * @param {Object} accumulator The initial aggregated object.
31916 * @returns {Function} Returns `accumulator`.
31917 */
31918function arrayAggregator(array, setter, iteratee, accumulator) {
31919 var index = -1,
31920 length = array == null ? 0 : array.length;
31921
31922 while (++index < length) {
31923 var value = array[index];
31924 setter(accumulator, value, iteratee(value), array);
31925 }
31926 return accumulator;
31927}
31928
31929module.exports = arrayAggregator;
31930
31931/***/ }),
31932/* 234 */
31933/***/ (function(module, exports, __webpack_require__) {
31934
31935var baseEach = __webpack_require__(27);
31936
31937/**
31938 * Aggregates elements of `collection` on `accumulator` with keys transformed
31939 * by `iteratee` and values set by `setter`.
31940 *
31941 * @private
31942 * @param {Array|Object} collection The collection to iterate over.
31943 * @param {Function} setter The function to set `accumulator` values.
31944 * @param {Function} iteratee The iteratee to transform keys.
31945 * @param {Object} accumulator The initial aggregated object.
31946 * @returns {Function} Returns `accumulator`.
31947 */
31948function baseAggregator(collection, setter, iteratee, accumulator) {
31949 baseEach(collection, function (value, key, collection) {
31950 setter(accumulator, value, iteratee(value), collection);
31951 });
31952 return accumulator;
31953}
31954
31955module.exports = baseAggregator;
31956
31957/***/ }),
31958/* 235 */
31959/***/ (function(module, exports, __webpack_require__) {
31960
31961var Stack = __webpack_require__(50),
31962 arrayEach = __webpack_require__(69),
31963 assignValue = __webpack_require__(40),
31964 baseAssign = __webpack_require__(236),
31965 baseAssignIn = __webpack_require__(237),
31966 cloneBuffer = __webpack_require__(240),
31967 copyArray = __webpack_require__(94),
31968 copySymbols = __webpack_require__(241),
31969 copySymbolsIn = __webpack_require__(242),
31970 getAllKeys = __webpack_require__(81),
31971 getAllKeysIn = __webpack_require__(243),
31972 getTag = __webpack_require__(38),
31973 initCloneArray = __webpack_require__(244),
31974 initCloneByTag = __webpack_require__(245),
31975 initCloneObject = __webpack_require__(254),
31976 isArray = __webpack_require__(3),
31977 isBuffer = __webpack_require__(29),
31978 isObject = __webpack_require__(7),
31979 keys = __webpack_require__(11);
31980
31981/** Used to compose bitmasks for cloning. */
31982var CLONE_DEEP_FLAG = 1,
31983 CLONE_FLAT_FLAG = 2,
31984 CLONE_SYMBOLS_FLAG = 4;
31985
31986/** `Object#toString` result references. */
31987var argsTag = '[object Arguments]',
31988 arrayTag = '[object Array]',
31989 boolTag = '[object Boolean]',
31990 dateTag = '[object Date]',
31991 errorTag = '[object Error]',
31992 funcTag = '[object Function]',
31993 genTag = '[object GeneratorFunction]',
31994 mapTag = '[object Map]',
31995 numberTag = '[object Number]',
31996 objectTag = '[object Object]',
31997 regexpTag = '[object RegExp]',
31998 setTag = '[object Set]',
31999 stringTag = '[object String]',
32000 symbolTag = '[object Symbol]',
32001 weakMapTag = '[object WeakMap]';
32002
32003var arrayBufferTag = '[object ArrayBuffer]',
32004 dataViewTag = '[object DataView]',
32005 float32Tag = '[object Float32Array]',
32006 float64Tag = '[object Float64Array]',
32007 int8Tag = '[object Int8Array]',
32008 int16Tag = '[object Int16Array]',
32009 int32Tag = '[object Int32Array]',
32010 uint8Tag = '[object Uint8Array]',
32011 uint8ClampedTag = '[object Uint8ClampedArray]',
32012 uint16Tag = '[object Uint16Array]',
32013 uint32Tag = '[object Uint32Array]';
32014
32015/** Used to identify `toStringTag` values supported by `_.clone`. */
32016var cloneableTags = {};
32017cloneableTags[argsTag] = cloneableTags[arrayTag] = cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = cloneableTags[boolTag] = cloneableTags[dateTag] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag] = cloneableTags[numberTag] = cloneableTags[objectTag] = cloneableTags[regexpTag] = cloneableTags[setTag] = cloneableTags[stringTag] = cloneableTags[symbolTag] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
32018cloneableTags[errorTag] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false;
32019
32020/**
32021 * The base implementation of `_.clone` and `_.cloneDeep` which tracks
32022 * traversed objects.
32023 *
32024 * @private
32025 * @param {*} value The value to clone.
32026 * @param {boolean} bitmask The bitmask flags.
32027 * 1 - Deep clone
32028 * 2 - Flatten inherited properties
32029 * 4 - Clone symbols
32030 * @param {Function} [customizer] The function to customize cloning.
32031 * @param {string} [key] The key of `value`.
32032 * @param {Object} [object] The parent object of `value`.
32033 * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
32034 * @returns {*} Returns the cloned value.
32035 */
32036function baseClone(value, bitmask, customizer, key, object, stack) {
32037 var result,
32038 isDeep = bitmask & CLONE_DEEP_FLAG,
32039 isFlat = bitmask & CLONE_FLAT_FLAG,
32040 isFull = bitmask & CLONE_SYMBOLS_FLAG;
32041
32042 if (customizer) {
32043 result = object ? customizer(value, key, object, stack) : customizer(value);
32044 }
32045 if (result !== undefined) {
32046 return result;
32047 }
32048 if (!isObject(value)) {
32049 return value;
32050 }
32051 var isArr = isArray(value);
32052 if (isArr) {
32053 result = initCloneArray(value);
32054 if (!isDeep) {
32055 return copyArray(value, result);
32056 }
32057 } else {
32058 var tag = getTag(value),
32059 isFunc = tag == funcTag || tag == genTag;
32060
32061 if (isBuffer(value)) {
32062 return cloneBuffer(value, isDeep);
32063 }
32064 if (tag == objectTag || tag == argsTag || isFunc && !object) {
32065 result = isFlat || isFunc ? {} : initCloneObject(value);
32066 if (!isDeep) {
32067 return isFlat ? copySymbolsIn(value, baseAssignIn(result, value)) : copySymbols(value, baseAssign(result, value));
32068 }
32069 } else {
32070 if (!cloneableTags[tag]) {
32071 return object ? value : {};
32072 }
32073 result = initCloneByTag(value, tag, baseClone, isDeep);
32074 }
32075 }
32076 // Check for circular references and return its corresponding clone.
32077 stack || (stack = new Stack());
32078 var stacked = stack.get(value);
32079 if (stacked) {
32080 return stacked;
32081 }
32082 stack.set(value, result);
32083
32084 var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys;
32085
32086 var props = isArr ? undefined : keysFunc(value);
32087 arrayEach(props || value, function (subValue, key) {
32088 if (props) {
32089 key = subValue;
32090 subValue = value[key];
32091 }
32092 // Recursively populate clone (susceptible to call stack limits).
32093 assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
32094 });
32095 return result;
32096}
32097
32098module.exports = baseClone;
32099
32100/***/ }),
32101/* 236 */
32102/***/ (function(module, exports, __webpack_require__) {
32103
32104var copyObject = __webpack_require__(23),
32105 keys = __webpack_require__(11);
32106
32107/**
32108 * The base implementation of `_.assign` without support for multiple sources
32109 * or `customizer` functions.
32110 *
32111 * @private
32112 * @param {Object} object The destination object.
32113 * @param {Object} source The source object.
32114 * @returns {Object} Returns `object`.
32115 */
32116function baseAssign(object, source) {
32117 return object && copyObject(source, keys(source), object);
32118}
32119
32120module.exports = baseAssign;
32121
32122/***/ }),
32123/* 237 */
32124/***/ (function(module, exports, __webpack_require__) {
32125
32126var copyObject = __webpack_require__(23),
32127 keysIn = __webpack_require__(103);
32128
32129/**
32130 * The base implementation of `_.assignIn` without support for multiple sources
32131 * or `customizer` functions.
32132 *
32133 * @private
32134 * @param {Object} object The destination object.
32135 * @param {Object} source The source object.
32136 * @returns {Object} Returns `object`.
32137 */
32138function baseAssignIn(object, source) {
32139 return object && copyObject(source, keysIn(source), object);
32140}
32141
32142module.exports = baseAssignIn;
32143
32144/***/ }),
32145/* 238 */
32146/***/ (function(module, exports, __webpack_require__) {
32147
32148var isObject = __webpack_require__(7),
32149 isPrototype = __webpack_require__(18),
32150 nativeKeysIn = __webpack_require__(239);
32151
32152/** Used for built-in method references. */
32153var objectProto = Object.prototype;
32154
32155/** Used to check objects for own properties. */
32156var hasOwnProperty = objectProto.hasOwnProperty;
32157
32158/**
32159 * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
32160 *
32161 * @private
32162 * @param {Object} object The object to query.
32163 * @returns {Array} Returns the array of property names.
32164 */
32165function baseKeysIn(object) {
32166 if (!isObject(object)) {
32167 return nativeKeysIn(object);
32168 }
32169 var isProto = isPrototype(object),
32170 result = [];
32171
32172 for (var key in object) {
32173 if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
32174 result.push(key);
32175 }
32176 }
32177 return result;
32178}
32179
32180module.exports = baseKeysIn;
32181
32182/***/ }),
32183/* 239 */
32184/***/ (function(module, exports) {
32185
32186/**
32187 * This function is like
32188 * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
32189 * except that it includes inherited enumerable properties.
32190 *
32191 * @private
32192 * @param {Object} object The object to query.
32193 * @returns {Array} Returns the array of property names.
32194 */
32195function nativeKeysIn(object) {
32196 var result = [];
32197 if (object != null) {
32198 for (var key in Object(object)) {
32199 result.push(key);
32200 }
32201 }
32202 return result;
32203}
32204
32205module.exports = nativeKeysIn;
32206
32207/***/ }),
32208/* 240 */
32209/***/ (function(module, exports, __webpack_require__) {
32210
32211/* WEBPACK VAR INJECTION */(function(module) {var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
32212
32213var root = __webpack_require__(4);
32214
32215/** Detect free variable `exports`. */
32216var freeExports = ( false ? 'undefined' : _typeof(exports)) == 'object' && exports && !exports.nodeType && exports;
32217
32218/** Detect free variable `module`. */
32219var freeModule = freeExports && ( false ? 'undefined' : _typeof(module)) == 'object' && module && !module.nodeType && module;
32220
32221/** Detect the popular CommonJS extension `module.exports`. */
32222var moduleExports = freeModule && freeModule.exports === freeExports;
32223
32224/** Built-in value references. */
32225var Buffer = moduleExports ? root.Buffer : undefined,
32226 allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined;
32227
32228/**
32229 * Creates a clone of `buffer`.
32230 *
32231 * @private
32232 * @param {Buffer} buffer The buffer to clone.
32233 * @param {boolean} [isDeep] Specify a deep clone.
32234 * @returns {Buffer} Returns the cloned buffer.
32235 */
32236function cloneBuffer(buffer, isDeep) {
32237 if (isDeep) {
32238 return buffer.slice();
32239 }
32240 var length = buffer.length,
32241 result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
32242
32243 buffer.copy(result);
32244 return result;
32245}
32246
32247module.exports = cloneBuffer;
32248/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(26)(module)))
32249
32250/***/ }),
32251/* 241 */
32252/***/ (function(module, exports, __webpack_require__) {
32253
32254var copyObject = __webpack_require__(23),
32255 getSymbols = __webpack_require__(55);
32256
32257/**
32258 * Copies own symbols of `source` to `object`.
32259 *
32260 * @private
32261 * @param {Object} source The object to copy symbols from.
32262 * @param {Object} [object={}] The object to copy symbols to.
32263 * @returns {Object} Returns `object`.
32264 */
32265function copySymbols(source, object) {
32266 return copyObject(source, getSymbols(source), object);
32267}
32268
32269module.exports = copySymbols;
32270
32271/***/ }),
32272/* 242 */
32273/***/ (function(module, exports, __webpack_require__) {
32274
32275var copyObject = __webpack_require__(23),
32276 getSymbolsIn = __webpack_require__(104);
32277
32278/**
32279 * Copies own and inherited symbols of `source` to `object`.
32280 *
32281 * @private
32282 * @param {Object} source The object to copy symbols from.
32283 * @param {Object} [object={}] The object to copy symbols to.
32284 * @returns {Object} Returns `object`.
32285 */
32286function copySymbolsIn(source, object) {
32287 return copyObject(source, getSymbolsIn(source), object);
32288}
32289
32290module.exports = copySymbolsIn;
32291
32292/***/ }),
32293/* 243 */
32294/***/ (function(module, exports, __webpack_require__) {
32295
32296var baseGetAllKeys = __webpack_require__(82),
32297 getSymbolsIn = __webpack_require__(104),
32298 keysIn = __webpack_require__(103);
32299
32300/**
32301 * Creates an array of own and inherited enumerable property names and
32302 * symbols of `object`.
32303 *
32304 * @private
32305 * @param {Object} object The object to query.
32306 * @returns {Array} Returns the array of property names and symbols.
32307 */
32308function getAllKeysIn(object) {
32309 return baseGetAllKeys(object, keysIn, getSymbolsIn);
32310}
32311
32312module.exports = getAllKeysIn;
32313
32314/***/ }),
32315/* 244 */
32316/***/ (function(module, exports) {
32317
32318/** Used for built-in method references. */
32319var objectProto = Object.prototype;
32320
32321/** Used to check objects for own properties. */
32322var hasOwnProperty = objectProto.hasOwnProperty;
32323
32324/**
32325 * Initializes an array clone.
32326 *
32327 * @private
32328 * @param {Array} array The array to clone.
32329 * @returns {Array} Returns the initialized clone.
32330 */
32331function initCloneArray(array) {
32332 var length = array.length,
32333 result = array.constructor(length);
32334
32335 // Add properties assigned by `RegExp#exec`.
32336 if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
32337 result.index = array.index;
32338 result.input = array.input;
32339 }
32340 return result;
32341}
32342
32343module.exports = initCloneArray;
32344
32345/***/ }),
32346/* 245 */
32347/***/ (function(module, exports, __webpack_require__) {
32348
32349var cloneArrayBuffer = __webpack_require__(62),
32350 cloneDataView = __webpack_require__(246),
32351 cloneMap = __webpack_require__(247),
32352 cloneRegExp = __webpack_require__(249),
32353 cloneSet = __webpack_require__(250),
32354 cloneSymbol = __webpack_require__(252),
32355 cloneTypedArray = __webpack_require__(253);
32356
32357/** `Object#toString` result references. */
32358var boolTag = '[object Boolean]',
32359 dateTag = '[object Date]',
32360 mapTag = '[object Map]',
32361 numberTag = '[object Number]',
32362 regexpTag = '[object RegExp]',
32363 setTag = '[object Set]',
32364 stringTag = '[object String]',
32365 symbolTag = '[object Symbol]';
32366
32367var arrayBufferTag = '[object ArrayBuffer]',
32368 dataViewTag = '[object DataView]',
32369 float32Tag = '[object Float32Array]',
32370 float64Tag = '[object Float64Array]',
32371 int8Tag = '[object Int8Array]',
32372 int16Tag = '[object Int16Array]',
32373 int32Tag = '[object Int32Array]',
32374 uint8Tag = '[object Uint8Array]',
32375 uint8ClampedTag = '[object Uint8ClampedArray]',
32376 uint16Tag = '[object Uint16Array]',
32377 uint32Tag = '[object Uint32Array]';
32378
32379/**
32380 * Initializes an object clone based on its `toStringTag`.
32381 *
32382 * **Note:** This function only supports cloning values with tags of
32383 * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
32384 *
32385 * @private
32386 * @param {Object} object The object to clone.
32387 * @param {string} tag The `toStringTag` of the object to clone.
32388 * @param {Function} cloneFunc The function to clone values.
32389 * @param {boolean} [isDeep] Specify a deep clone.
32390 * @returns {Object} Returns the initialized clone.
32391 */
32392function initCloneByTag(object, tag, cloneFunc, isDeep) {
32393 var Ctor = object.constructor;
32394 switch (tag) {
32395 case arrayBufferTag:
32396 return cloneArrayBuffer(object);
32397
32398 case boolTag:
32399 case dateTag:
32400 return new Ctor(+object);
32401
32402 case dataViewTag:
32403 return cloneDataView(object, isDeep);
32404
32405 case float32Tag:case float64Tag:
32406 case int8Tag:case int16Tag:case int32Tag:
32407 case uint8Tag:case uint8ClampedTag:case uint16Tag:case uint32Tag:
32408 return cloneTypedArray(object, isDeep);
32409
32410 case mapTag:
32411 return cloneMap(object, isDeep, cloneFunc);
32412
32413 case numberTag:
32414 case stringTag:
32415 return new Ctor(object);
32416
32417 case regexpTag:
32418 return cloneRegExp(object);
32419
32420 case setTag:
32421 return cloneSet(object, isDeep, cloneFunc);
32422
32423 case symbolTag:
32424 return cloneSymbol(object);
32425 }
32426}
32427
32428module.exports = initCloneByTag;
32429
32430/***/ }),
32431/* 246 */
32432/***/ (function(module, exports, __webpack_require__) {
32433
32434var cloneArrayBuffer = __webpack_require__(62);
32435
32436/**
32437 * Creates a clone of `dataView`.
32438 *
32439 * @private
32440 * @param {Object} dataView The data view to clone.
32441 * @param {boolean} [isDeep] Specify a deep clone.
32442 * @returns {Object} Returns the cloned data view.
32443 */
32444function cloneDataView(dataView, isDeep) {
32445 var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
32446 return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
32447}
32448
32449module.exports = cloneDataView;
32450
32451/***/ }),
32452/* 247 */
32453/***/ (function(module, exports, __webpack_require__) {
32454
32455var addMapEntry = __webpack_require__(248),
32456 arrayReduce = __webpack_require__(58),
32457 mapToArray = __webpack_require__(53);
32458
32459/** Used to compose bitmasks for cloning. */
32460var CLONE_DEEP_FLAG = 1;
32461
32462/**
32463 * Creates a clone of `map`.
32464 *
32465 * @private
32466 * @param {Object} map The map to clone.
32467 * @param {Function} cloneFunc The function to clone values.
32468 * @param {boolean} [isDeep] Specify a deep clone.
32469 * @returns {Object} Returns the cloned map.
32470 */
32471function cloneMap(map, isDeep, cloneFunc) {
32472 var array = isDeep ? cloneFunc(mapToArray(map), CLONE_DEEP_FLAG) : mapToArray(map);
32473 return arrayReduce(array, addMapEntry, new map.constructor());
32474}
32475
32476module.exports = cloneMap;
32477
32478/***/ }),
32479/* 248 */
32480/***/ (function(module, exports) {
32481
32482/**
32483 * Adds the key-value `pair` to `map`.
32484 *
32485 * @private
32486 * @param {Object} map The map to modify.
32487 * @param {Array} pair The key-value pair to add.
32488 * @returns {Object} Returns `map`.
32489 */
32490function addMapEntry(map, pair) {
32491 // Don't return `map.set` because it's not chainable in IE 11.
32492 map.set(pair[0], pair[1]);
32493 return map;
32494}
32495
32496module.exports = addMapEntry;
32497
32498/***/ }),
32499/* 249 */
32500/***/ (function(module, exports) {
32501
32502/** Used to match `RegExp` flags from their coerced string values. */
32503var reFlags = /\w*$/;
32504
32505/**
32506 * Creates a clone of `regexp`.
32507 *
32508 * @private
32509 * @param {Object} regexp The regexp to clone.
32510 * @returns {Object} Returns the cloned regexp.
32511 */
32512function cloneRegExp(regexp) {
32513 var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
32514 result.lastIndex = regexp.lastIndex;
32515 return result;
32516}
32517
32518module.exports = cloneRegExp;
32519
32520/***/ }),
32521/* 250 */
32522/***/ (function(module, exports, __webpack_require__) {
32523
32524var addSetEntry = __webpack_require__(251),
32525 arrayReduce = __webpack_require__(58),
32526 setToArray = __webpack_require__(20);
32527
32528/** Used to compose bitmasks for cloning. */
32529var CLONE_DEEP_FLAG = 1;
32530
32531/**
32532 * Creates a clone of `set`.
32533 *
32534 * @private
32535 * @param {Object} set The set to clone.
32536 * @param {Function} cloneFunc The function to clone values.
32537 * @param {boolean} [isDeep] Specify a deep clone.
32538 * @returns {Object} Returns the cloned set.
32539 */
32540function cloneSet(set, isDeep, cloneFunc) {
32541 var array = isDeep ? cloneFunc(setToArray(set), CLONE_DEEP_FLAG) : setToArray(set);
32542 return arrayReduce(array, addSetEntry, new set.constructor());
32543}
32544
32545module.exports = cloneSet;
32546
32547/***/ }),
32548/* 251 */
32549/***/ (function(module, exports) {
32550
32551/**
32552 * Adds `value` to `set`.
32553 *
32554 * @private
32555 * @param {Object} set The set to modify.
32556 * @param {*} value The value to add.
32557 * @returns {Object} Returns `set`.
32558 */
32559function addSetEntry(set, value) {
32560 // Don't return `set.add` because it's not chainable in IE 11.
32561 set.add(value);
32562 return set;
32563}
32564
32565module.exports = addSetEntry;
32566
32567/***/ }),
32568/* 252 */
32569/***/ (function(module, exports, __webpack_require__) {
32570
32571var _Symbol = __webpack_require__(12);
32572
32573/** Used to convert symbols to primitives and strings. */
32574var symbolProto = _Symbol ? _Symbol.prototype : undefined,
32575 symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
32576
32577/**
32578 * Creates a clone of the `symbol` object.
32579 *
32580 * @private
32581 * @param {Object} symbol The symbol object to clone.
32582 * @returns {Object} Returns the cloned symbol object.
32583 */
32584function cloneSymbol(symbol) {
32585 return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
32586}
32587
32588module.exports = cloneSymbol;
32589
32590/***/ }),
32591/* 253 */
32592/***/ (function(module, exports, __webpack_require__) {
32593
32594var cloneArrayBuffer = __webpack_require__(62);
32595
32596/**
32597 * Creates a clone of `typedArray`.
32598 *
32599 * @private
32600 * @param {Object} typedArray The typed array to clone.
32601 * @param {boolean} [isDeep] Specify a deep clone.
32602 * @returns {Object} Returns the cloned typed array.
32603 */
32604function cloneTypedArray(typedArray, isDeep) {
32605 var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
32606 return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
32607}
32608
32609module.exports = cloneTypedArray;
32610
32611/***/ }),
32612/* 254 */
32613/***/ (function(module, exports, __webpack_require__) {
32614
32615var baseCreate = __webpack_require__(255),
32616 getPrototype = __webpack_require__(59),
32617 isPrototype = __webpack_require__(18);
32618
32619/**
32620 * Initializes an object clone.
32621 *
32622 * @private
32623 * @param {Object} object The object to clone.
32624 * @returns {Object} Returns the initialized clone.
32625 */
32626function initCloneObject(object) {
32627 return typeof object.constructor == 'function' && !isPrototype(object) ? baseCreate(getPrototype(object)) : {};
32628}
32629
32630module.exports = initCloneObject;
32631
32632/***/ }),
32633/* 255 */
32634/***/ (function(module, exports, __webpack_require__) {
32635
32636var isObject = __webpack_require__(7);
32637
32638/** Built-in value references. */
32639var objectCreate = Object.create;
32640
32641/**
32642 * The base implementation of `_.create` without support for assigning
32643 * properties to the created object.
32644 *
32645 * @private
32646 * @param {Object} proto The object to inherit from.
32647 * @returns {Object} Returns the new object.
32648 */
32649var baseCreate = function () {
32650 function object() {}
32651 return function (proto) {
32652 if (!isObject(proto)) {
32653 return {};
32654 }
32655 if (objectCreate) {
32656 return objectCreate(proto);
32657 }
32658 object.prototype = proto;
32659 var result = new object();
32660 object.prototype = undefined;
32661 return result;
32662 };
32663}();
32664
32665module.exports = baseCreate;
32666
32667/***/ }),
32668/* 256 */
32669/***/ (function(module, exports, __webpack_require__) {
32670
32671var baseExtremum = __webpack_require__(105),
32672 baseGt = __webpack_require__(257),
32673 baseIteratee = __webpack_require__(19);
32674
32675/**
32676 * This method is like `_.max` except that it accepts `iteratee` which is
32677 * invoked for each element in `array` to generate the criterion by which
32678 * the value is ranked. The iteratee is invoked with one argument: (value).
32679 *
32680 * @static
32681 * @memberOf _
32682 * @since 4.0.0
32683 * @category Math
32684 * @param {Array} array The array to iterate over.
32685 * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
32686 * @returns {*} Returns the maximum value.
32687 * @example
32688 *
32689 * var objects = [{ 'n': 1 }, { 'n': 2 }];
32690 *
32691 * _.maxBy(objects, function(o) { return o.n; });
32692 * // => { 'n': 2 }
32693 *
32694 * // The `_.property` iteratee shorthand.
32695 * _.maxBy(objects, 'n');
32696 * // => { 'n': 2 }
32697 */
32698function maxBy(array, iteratee) {
32699 return array && array.length ? baseExtremum(array, baseIteratee(iteratee, 2), baseGt) : undefined;
32700}
32701
32702module.exports = maxBy;
32703
32704/***/ }),
32705/* 257 */
32706/***/ (function(module, exports) {
32707
32708/**
32709 * The base implementation of `_.gt` which doesn't coerce arguments.
32710 *
32711 * @private
32712 * @param {*} value The value to compare.
32713 * @param {*} other The other value to compare.
32714 * @returns {boolean} Returns `true` if `value` is greater than `other`,
32715 * else `false`.
32716 */
32717function baseGt(value, other) {
32718 return value > other;
32719}
32720
32721module.exports = baseGt;
32722
32723/***/ }),
32724/* 258 */
32725/***/ (function(module, exports, __webpack_require__) {
32726
32727var baseExtremum = __webpack_require__(105),
32728 baseIteratee = __webpack_require__(19),
32729 baseLt = __webpack_require__(259);
32730
32731/**
32732 * This method is like `_.min` except that it accepts `iteratee` which is
32733 * invoked for each element in `array` to generate the criterion by which
32734 * the value is ranked. The iteratee is invoked with one argument: (value).
32735 *
32736 * @static
32737 * @memberOf _
32738 * @since 4.0.0
32739 * @category Math
32740 * @param {Array} array The array to iterate over.
32741 * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
32742 * @returns {*} Returns the minimum value.
32743 * @example
32744 *
32745 * var objects = [{ 'n': 1 }, { 'n': 2 }];
32746 *
32747 * _.minBy(objects, function(o) { return o.n; });
32748 * // => { 'n': 1 }
32749 *
32750 * // The `_.property` iteratee shorthand.
32751 * _.minBy(objects, 'n');
32752 * // => { 'n': 1 }
32753 */
32754function minBy(array, iteratee) {
32755 return array && array.length ? baseExtremum(array, baseIteratee(iteratee, 2), baseLt) : undefined;
32756}
32757
32758module.exports = minBy;
32759
32760/***/ }),
32761/* 259 */
32762/***/ (function(module, exports) {
32763
32764/**
32765 * The base implementation of `_.lt` which doesn't coerce arguments.
32766 *
32767 * @private
32768 * @param {*} value The value to compare.
32769 * @param {*} other The other value to compare.
32770 * @returns {boolean} Returns `true` if `value` is less than `other`,
32771 * else `false`.
32772 */
32773function baseLt(value, other) {
32774 return value < other;
32775}
32776
32777module.exports = baseLt;
32778
32779/***/ }),
32780/* 260 */
32781/***/ (function(module, exports, __webpack_require__) {
32782
32783var createRound = __webpack_require__(261);
32784
32785/**
32786 * Computes `number` rounded to `precision`.
32787 *
32788 * @static
32789 * @memberOf _
32790 * @since 3.10.0
32791 * @category Math
32792 * @param {number} number The number to round.
32793 * @param {number} [precision=0] The precision to round to.
32794 * @returns {number} Returns the rounded number.
32795 * @example
32796 *
32797 * _.round(4.006);
32798 * // => 4
32799 *
32800 * _.round(4.006, 2);
32801 * // => 4.01
32802 *
32803 * _.round(4060, -2);
32804 * // => 4100
32805 */
32806var round = createRound('round');
32807
32808module.exports = round;
32809
32810/***/ }),
32811/* 261 */
32812/***/ (function(module, exports, __webpack_require__) {
32813
32814var toInteger = __webpack_require__(96),
32815 toNumber = __webpack_require__(97),
32816 toString = __webpack_require__(15);
32817
32818/* Built-in method references for those with the same name as other `lodash` methods. */
32819var nativeMin = Math.min;
32820
32821/**
32822 * Creates a function like `_.round`.
32823 *
32824 * @private
32825 * @param {string} methodName The name of the `Math` method to use when rounding.
32826 * @returns {Function} Returns the new round function.
32827 */
32828function createRound(methodName) {
32829 var func = Math[methodName];
32830 return function (number, precision) {
32831 number = toNumber(number);
32832 precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
32833 if (precision) {
32834 // Shift with exponential notation to avoid floating-point issues.
32835 // See [MDN](https://mdn.io/round#Examples) for more details.
32836 var pair = (toString(number) + 'e').split('e'),
32837 value = func(pair[0] + 'e' + (+pair[1] + precision));
32838
32839 pair = (toString(value) + 'e').split('e');
32840 return +(pair[0] + 'e' + (+pair[1] - precision));
32841 }
32842 return func(number);
32843 };
32844}
32845
32846module.exports = createRound;
32847
32848/***/ }),
32849/* 262 */
32850/***/ (function(module, exports, __webpack_require__) {
32851
32852var arrayFilter = __webpack_require__(83),
32853 baseFilter = __webpack_require__(263),
32854 baseIteratee = __webpack_require__(19),
32855 isArray = __webpack_require__(3);
32856
32857/**
32858 * Iterates over elements of `collection`, returning an array of all elements
32859 * `predicate` returns truthy for. The predicate is invoked with three
32860 * arguments: (value, index|key, collection).
32861 *
32862 * **Note:** Unlike `_.remove`, this method returns a new array.
32863 *
32864 * @static
32865 * @memberOf _
32866 * @since 0.1.0
32867 * @category Collection
32868 * @param {Array|Object} collection The collection to iterate over.
32869 * @param {Function} [predicate=_.identity] The function invoked per iteration.
32870 * @returns {Array} Returns the new filtered array.
32871 * @see _.reject
32872 * @example
32873 *
32874 * var users = [
32875 * { 'user': 'barney', 'age': 36, 'active': true },
32876 * { 'user': 'fred', 'age': 40, 'active': false }
32877 * ];
32878 *
32879 * _.filter(users, function(o) { return !o.active; });
32880 * // => objects for ['fred']
32881 *
32882 * // The `_.matches` iteratee shorthand.
32883 * _.filter(users, { 'age': 36, 'active': true });
32884 * // => objects for ['barney']
32885 *
32886 * // The `_.matchesProperty` iteratee shorthand.
32887 * _.filter(users, ['active', false]);
32888 * // => objects for ['fred']
32889 *
32890 * // The `_.property` iteratee shorthand.
32891 * _.filter(users, 'active');
32892 * // => objects for ['barney']
32893 */
32894function filter(collection, predicate) {
32895 var func = isArray(collection) ? arrayFilter : baseFilter;
32896 return func(collection, baseIteratee(predicate, 3));
32897}
32898
32899module.exports = filter;
32900
32901/***/ }),
32902/* 263 */
32903/***/ (function(module, exports, __webpack_require__) {
32904
32905var baseEach = __webpack_require__(27);
32906
32907/**
32908 * The base implementation of `_.filter` without support for iteratee shorthands.
32909 *
32910 * @private
32911 * @param {Array|Object} collection The collection to iterate over.
32912 * @param {Function} predicate The function invoked per iteration.
32913 * @returns {Array} Returns the new filtered array.
32914 */
32915function baseFilter(collection, predicate) {
32916 var result = [];
32917 baseEach(collection, function (value, index, collection) {
32918 if (predicate(value, index, collection)) {
32919 result.push(value);
32920 }
32921 });
32922 return result;
32923}
32924
32925module.exports = baseFilter;
32926
32927/***/ }),
32928/* 264 */
32929/***/ (function(module, exports, __webpack_require__) {
32930
32931var baseIsEqual = __webpack_require__(37);
32932
32933/**
32934 * This method is like `_.isEqual` except that it accepts `customizer` which
32935 * is invoked to compare values. If `customizer` returns `undefined`, comparisons
32936 * are handled by the method instead. The `customizer` is invoked with up to
32937 * six arguments: (objValue, othValue [, index|key, object, other, stack]).
32938 *
32939 * @static
32940 * @memberOf _
32941 * @since 4.0.0
32942 * @category Lang
32943 * @param {*} value The value to compare.
32944 * @param {*} other The other value to compare.
32945 * @param {Function} [customizer] The function to customize comparisons.
32946 * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
32947 * @example
32948 *
32949 * function isGreeting(value) {
32950 * return /^h(?:i|ello)$/.test(value);
32951 * }
32952 *
32953 * function customizer(objValue, othValue) {
32954 * if (isGreeting(objValue) && isGreeting(othValue)) {
32955 * return true;
32956 * }
32957 * }
32958 *
32959 * var array = ['hello', 'goodbye'];
32960 * var other = ['hi', 'goodbye'];
32961 *
32962 * _.isEqualWith(array, other, customizer);
32963 * // => true
32964 */
32965function isEqualWith(value, other, customizer) {
32966 customizer = typeof customizer == 'function' ? customizer : undefined;
32967 var result = customizer ? customizer(value, other) : undefined;
32968 return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
32969}
32970
32971module.exports = isEqualWith;
32972
32973/***/ }),
32974/* 265 */
32975/***/ (function(module, exports, __webpack_require__) {
32976
32977var baseIsEqual = __webpack_require__(37);
32978
32979/**
32980 * Performs a deep comparison between two values to determine if they are
32981 * equivalent.
32982 *
32983 * **Note:** This method supports comparing arrays, array buffers, booleans,
32984 * date objects, error objects, maps, numbers, `Object` objects, regexes,
32985 * sets, strings, symbols, and typed arrays. `Object` objects are compared
32986 * by their own, not inherited, enumerable properties. Functions and DOM
32987 * nodes are compared by strict equality, i.e. `===`.
32988 *
32989 * @static
32990 * @memberOf _
32991 * @since 0.1.0
32992 * @category Lang
32993 * @param {*} value The value to compare.
32994 * @param {*} other The other value to compare.
32995 * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
32996 * @example
32997 *
32998 * var object = { 'a': 1 };
32999 * var other = { 'a': 1 };
33000 *
33001 * _.isEqual(object, other);
33002 * // => true
33003 *
33004 * object === other;
33005 * // => false
33006 */
33007function isEqual(value, other) {
33008 return baseIsEqual(value, other);
33009}
33010
33011module.exports = isEqual;
33012
33013/***/ }),
33014/* 266 */
33015/***/ (function(module, exports, __webpack_require__) {
33016
33017var toString = __webpack_require__(15);
33018
33019/**
33020 * Replaces matches for `pattern` in `string` with `replacement`.
33021 *
33022 * **Note:** This method is based on
33023 * [`String#replace`](https://mdn.io/String/replace).
33024 *
33025 * @static
33026 * @memberOf _
33027 * @since 4.0.0
33028 * @category String
33029 * @param {string} [string=''] The string to modify.
33030 * @param {RegExp|string} pattern The pattern to replace.
33031 * @param {Function|string} replacement The match replacement.
33032 * @returns {string} Returns the modified string.
33033 * @example
33034 *
33035 * _.replace('Hi Fred', 'Fred', 'Barney');
33036 * // => 'Hi Barney'
33037 */
33038function replace() {
33039 var args = arguments,
33040 string = toString(args[0]);
33041
33042 return args.length < 3 ? string : string.replace(args[1], args[2]);
33043}
33044
33045module.exports = replace;
33046
33047/***/ }),
33048/* 267 */
33049/***/ (function(module, exports, __webpack_require__) {
33050
33051var baseFlatten = __webpack_require__(106),
33052 baseRest = __webpack_require__(99),
33053 baseUniq = __webpack_require__(107),
33054 isArrayLikeObject = __webpack_require__(273);
33055
33056/**
33057 * Creates an array of unique values, in order, from all given arrays using
33058 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
33059 * for equality comparisons.
33060 *
33061 * @static
33062 * @memberOf _
33063 * @since 0.1.0
33064 * @category Array
33065 * @param {...Array} [arrays] The arrays to inspect.
33066 * @returns {Array} Returns the new array of combined values.
33067 * @example
33068 *
33069 * _.union([2], [1, 2]);
33070 * // => [2, 1]
33071 */
33072var union = baseRest(function (arrays) {
33073 return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
33074});
33075
33076module.exports = union;
33077
33078/***/ }),
33079/* 268 */
33080/***/ (function(module, exports, __webpack_require__) {
33081
33082var _Symbol = __webpack_require__(12),
33083 isArguments = __webpack_require__(28),
33084 isArray = __webpack_require__(3);
33085
33086/** Built-in value references. */
33087var spreadableSymbol = _Symbol ? _Symbol.isConcatSpreadable : undefined;
33088
33089/**
33090 * Checks if `value` is a flattenable `arguments` object or array.
33091 *
33092 * @private
33093 * @param {*} value The value to check.
33094 * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
33095 */
33096function isFlattenable(value) {
33097 return isArray(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
33098}
33099
33100module.exports = isFlattenable;
33101
33102/***/ }),
33103/* 269 */
33104/***/ (function(module, exports, __webpack_require__) {
33105
33106var baseIndexOf = __webpack_require__(95);
33107
33108/**
33109 * A specialized version of `_.includes` for arrays without support for
33110 * specifying an index to search from.
33111 *
33112 * @private
33113 * @param {Array} [array] The array to inspect.
33114 * @param {*} target The value to search for.
33115 * @returns {boolean} Returns `true` if `target` is found, else `false`.
33116 */
33117function arrayIncludes(array, value) {
33118 var length = array == null ? 0 : array.length;
33119 return !!length && baseIndexOf(array, value, 0) > -1;
33120}
33121
33122module.exports = arrayIncludes;
33123
33124/***/ }),
33125/* 270 */
33126/***/ (function(module, exports) {
33127
33128/**
33129 * This function is like `arrayIncludes` except that it accepts a comparator.
33130 *
33131 * @private
33132 * @param {Array} [array] The array to inspect.
33133 * @param {*} target The value to search for.
33134 * @param {Function} comparator The comparator invoked per element.
33135 * @returns {boolean} Returns `true` if `target` is found, else `false`.
33136 */
33137function arrayIncludesWith(array, value, comparator) {
33138 var index = -1,
33139 length = array == null ? 0 : array.length;
33140
33141 while (++index < length) {
33142 if (comparator(value, array[index])) {
33143 return true;
33144 }
33145 }
33146 return false;
33147}
33148
33149module.exports = arrayIncludesWith;
33150
33151/***/ }),
33152/* 271 */
33153/***/ (function(module, exports, __webpack_require__) {
33154
33155var Set = __webpack_require__(85),
33156 noop = __webpack_require__(272),
33157 setToArray = __webpack_require__(20);
33158
33159/** Used as references for various `Number` constants. */
33160var INFINITY = 1 / 0;
33161
33162/**
33163 * Creates a set object of `values`.
33164 *
33165 * @private
33166 * @param {Array} values The values to add to the set.
33167 * @returns {Object} Returns the new set.
33168 */
33169var createSet = !(Set && 1 / setToArray(new Set([, -0]))[1] == INFINITY) ? noop : function (values) {
33170 return new Set(values);
33171};
33172
33173module.exports = createSet;
33174
33175/***/ }),
33176/* 272 */
33177/***/ (function(module, exports) {
33178
33179/**
33180 * This method returns `undefined`.
33181 *
33182 * @static
33183 * @memberOf _
33184 * @since 2.3.0
33185 * @category Util
33186 * @example
33187 *
33188 * _.times(2, _.noop);
33189 * // => [undefined, undefined]
33190 */
33191function noop() {
33192 // No operation performed.
33193}
33194
33195module.exports = noop;
33196
33197/***/ }),
33198/* 273 */
33199/***/ (function(module, exports, __webpack_require__) {
33200
33201var isArrayLike = __webpack_require__(8),
33202 isObjectLike = __webpack_require__(5);
33203
33204/**
33205 * This method is like `_.isArrayLike` except that it also checks if `value`
33206 * is an object.
33207 *
33208 * @static
33209 * @memberOf _
33210 * @since 4.0.0
33211 * @category Lang
33212 * @param {*} value The value to check.
33213 * @returns {boolean} Returns `true` if `value` is an array-like object,
33214 * else `false`.
33215 * @example
33216 *
33217 * _.isArrayLikeObject([1, 2, 3]);
33218 * // => true
33219 *
33220 * _.isArrayLikeObject(document.body.children);
33221 * // => true
33222 *
33223 * _.isArrayLikeObject('abc');
33224 * // => false
33225 *
33226 * _.isArrayLikeObject(_.noop);
33227 * // => false
33228 */
33229function isArrayLikeObject(value) {
33230 return isObjectLike(value) && isArrayLike(value);
33231}
33232
33233module.exports = isArrayLikeObject;
33234
33235/***/ }),
33236/* 274 */
33237/***/ (function(module, exports, __webpack_require__) {
33238
33239var basePick = __webpack_require__(275),
33240 flatRest = __webpack_require__(278);
33241
33242/**
33243 * Creates an object composed of the picked `object` properties.
33244 *
33245 * @static
33246 * @since 0.1.0
33247 * @memberOf _
33248 * @category Object
33249 * @param {Object} object The source object.
33250 * @param {...(string|string[])} [paths] The property paths to pick.
33251 * @returns {Object} Returns the new object.
33252 * @example
33253 *
33254 * var object = { 'a': 1, 'b': '2', 'c': 3 };
33255 *
33256 * _.pick(object, ['a', 'c']);
33257 * // => { 'a': 1, 'c': 3 }
33258 */
33259var pick = flatRest(function (object, paths) {
33260 return object == null ? {} : basePick(object, paths);
33261});
33262
33263module.exports = pick;
33264
33265/***/ }),
33266/* 275 */
33267/***/ (function(module, exports, __webpack_require__) {
33268
33269var basePickBy = __webpack_require__(276),
33270 hasIn = __webpack_require__(88);
33271
33272/**
33273 * The base implementation of `_.pick` without support for individual
33274 * property identifiers.
33275 *
33276 * @private
33277 * @param {Object} object The source object.
33278 * @param {string[]} paths The property paths to pick.
33279 * @returns {Object} Returns the new object.
33280 */
33281function basePick(object, paths) {
33282 return basePickBy(object, paths, function (value, path) {
33283 return hasIn(object, path);
33284 });
33285}
33286
33287module.exports = basePick;
33288
33289/***/ }),
33290/* 276 */
33291/***/ (function(module, exports, __webpack_require__) {
33292
33293var baseGet = __webpack_require__(56),
33294 baseSet = __webpack_require__(277),
33295 castPath = __webpack_require__(39);
33296
33297/**
33298 * The base implementation of `_.pickBy` without support for iteratee shorthands.
33299 *
33300 * @private
33301 * @param {Object} object The source object.
33302 * @param {string[]} paths The property paths to pick.
33303 * @param {Function} predicate The function invoked per property.
33304 * @returns {Object} Returns the new object.
33305 */
33306function basePickBy(object, paths, predicate) {
33307 var index = -1,
33308 length = paths.length,
33309 result = {};
33310
33311 while (++index < length) {
33312 var path = paths[index],
33313 value = baseGet(object, path);
33314
33315 if (predicate(value, path)) {
33316 baseSet(result, castPath(path, object), value);
33317 }
33318 }
33319 return result;
33320}
33321
33322module.exports = basePickBy;
33323
33324/***/ }),
33325/* 277 */
33326/***/ (function(module, exports, __webpack_require__) {
33327
33328var assignValue = __webpack_require__(40),
33329 castPath = __webpack_require__(39),
33330 isIndex = __webpack_require__(30),
33331 isObject = __webpack_require__(7),
33332 toKey = __webpack_require__(22);
33333
33334/**
33335 * The base implementation of `_.set`.
33336 *
33337 * @private
33338 * @param {Object} object The object to modify.
33339 * @param {Array|string} path The path of the property to set.
33340 * @param {*} value The value to set.
33341 * @param {Function} [customizer] The function to customize path creation.
33342 * @returns {Object} Returns `object`.
33343 */
33344function baseSet(object, path, value, customizer) {
33345 if (!isObject(object)) {
33346 return object;
33347 }
33348 path = castPath(path, object);
33349
33350 var index = -1,
33351 length = path.length,
33352 lastIndex = length - 1,
33353 nested = object;
33354
33355 while (nested != null && ++index < length) {
33356 var key = toKey(path[index]),
33357 newValue = value;
33358
33359 if (index != lastIndex) {
33360 var objValue = nested[key];
33361 newValue = customizer ? customizer(objValue, key, nested) : undefined;
33362 if (newValue === undefined) {
33363 newValue = isObject(objValue) ? objValue : isIndex(path[index + 1]) ? [] : {};
33364 }
33365 }
33366 assignValue(nested, key, newValue);
33367 nested = nested[key];
33368 }
33369 return object;
33370}
33371
33372module.exports = baseSet;
33373
33374/***/ }),
33375/* 278 */
33376/***/ (function(module, exports, __webpack_require__) {
33377
33378var flatten = __webpack_require__(279),
33379 overRest = __webpack_require__(100),
33380 setToString = __webpack_require__(101);
33381
33382/**
33383 * A specialized version of `baseRest` which flattens the rest array.
33384 *
33385 * @private
33386 * @param {Function} func The function to apply a rest parameter to.
33387 * @returns {Function} Returns the new function.
33388 */
33389function flatRest(func) {
33390 return setToString(overRest(func, undefined, flatten), func + '');
33391}
33392
33393module.exports = flatRest;
33394
33395/***/ }),
33396/* 279 */
33397/***/ (function(module, exports, __webpack_require__) {
33398
33399var baseFlatten = __webpack_require__(106);
33400
33401/**
33402 * Flattens `array` a single level deep.
33403 *
33404 * @static
33405 * @memberOf _
33406 * @since 0.1.0
33407 * @category Array
33408 * @param {Array} array The array to flatten.
33409 * @returns {Array} Returns the new flattened array.
33410 * @example
33411 *
33412 * _.flatten([1, [2, [3, [4]], 5]]);
33413 * // => [1, 2, [3, [4]], 5]
33414 */
33415function flatten(array) {
33416 var length = array == null ? 0 : array.length;
33417 return length ? baseFlatten(array, 1) : [];
33418}
33419
33420module.exports = flatten;
33421
33422/***/ }),
33423/* 280 */
33424/***/ (function(module, exports, __webpack_require__) {
33425
33426var baseUniq = __webpack_require__(107);
33427
33428/**
33429 * Creates a duplicate-free version of an array, using
33430 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
33431 * for equality comparisons, in which only the first occurrence of each element
33432 * is kept. The order of result values is determined by the order they occur
33433 * in the array.
33434 *
33435 * @static
33436 * @memberOf _
33437 * @since 0.1.0
33438 * @category Array
33439 * @param {Array} array The array to inspect.
33440 * @returns {Array} Returns the new duplicate free array.
33441 * @example
33442 *
33443 * _.uniq([2, 1, 2]);
33444 * // => [2, 1]
33445 */
33446function uniq(array) {
33447 return array && array.length ? baseUniq(array) : [];
33448}
33449
33450module.exports = uniq;
33451
33452/***/ }),
33453/* 281 */
33454/***/ (function(module, exports, __webpack_require__) {
33455
33456/**
33457 * @fileOverview Default animation funciton
33458 * @author sima.zhang
33459 */
33460var Util = __webpack_require__(0);
33461var G = __webpack_require__(2);
33462var PathUtil = G.PathUtil;
33463
33464function getClip(coord) {
33465 var start = coord.start;
33466 var end = coord.end;
33467 var width = coord.getWidth();
33468 var height = coord.getHeight();
33469 var margin = 200;
33470 var startAngle = void 0;
33471 var endAngle = void 0;
33472 var center = void 0;
33473 var radius = void 0;
33474 var clip = void 0;
33475
33476 if (coord.isPolar) {
33477 radius = coord.getRadius();
33478 center = coord.getCenter();
33479 startAngle = coord.startAngle;
33480 endAngle = coord.endAngle;
33481 clip = new G.Fan({
33482 attrs: {
33483 x: center.x,
33484 y: center.y,
33485 rs: 0,
33486 re: radius + margin,
33487 startAngle: startAngle,
33488 endAngle: startAngle
33489 }
33490 });
33491 clip.endState = {
33492 endAngle: endAngle
33493 };
33494 } else {
33495 clip = new G.Rect({
33496 attrs: {
33497 x: start.x - margin,
33498 y: end.y - margin,
33499 width: coord.isTransposed ? width + margin * 2 : 0,
33500 height: coord.isTransposed ? 0 : height + margin * 2
33501 }
33502 });
33503
33504 if (coord.isTransposed) {
33505 clip.endState = {
33506 height: height + margin * 2
33507 };
33508 } else {
33509 clip.endState = {
33510 width: width + margin * 2
33511 };
33512 }
33513 }
33514 clip.isClip = true;
33515 return clip;
33516}
33517
33518// 获取图形的包围盒
33519function getPointsBox(points) {
33520 if (Util.isEmpty(points)) {
33521 return null;
33522 }
33523
33524 var minX = points[0].x;
33525 var maxX = points[0].x;
33526 var minY = points[0].y;
33527 var maxY = points[0].y;
33528 Util.each(points, function (point) {
33529 minX = minX > point.x ? point.x : minX;
33530 maxX = maxX < point.x ? point.x : maxX;
33531 minY = minY > point.y ? point.y : minY;
33532 maxY = maxY < point.y ? point.y : maxY;
33533 });
33534 return {
33535 minX: minX,
33536 maxX: maxX,
33537 minY: minY,
33538 maxY: maxY,
33539 centerX: (minX + maxX) / 2,
33540 centerY: (minY + maxY) / 2
33541 };
33542}
33543
33544function getAngle(shape, coord) {
33545 var points = shape.points || shape.get('origin').points;
33546 var box = getPointsBox(points);
33547 var endAngle = void 0;
33548 var startAngle = void 0;
33549 var coordStartAngle = coord.startAngle;
33550 var coordEndAngle = coord.endAngle;
33551 var diffAngle = coordEndAngle - coordStartAngle;
33552
33553 if (coord.isTransposed) {
33554 endAngle = box.maxY * diffAngle;
33555 startAngle = box.minY * diffAngle;
33556 } else {
33557 endAngle = box.maxX * diffAngle;
33558 startAngle = box.minX * diffAngle;
33559 }
33560 endAngle += coordStartAngle;
33561 startAngle += coordStartAngle;
33562 return {
33563 startAngle: startAngle,
33564 endAngle: endAngle
33565 };
33566}
33567
33568function getAnimateParam(animateCfg, index, id) {
33569 var result = {};
33570 if (animateCfg.delay) {
33571 result.delay = Util.isFunction(animateCfg.delay) ? animateCfg.delay(index, id) : animateCfg.delay;
33572 }
33573 result.easing = Util.isFunction(animateCfg.easing) ? animateCfg.easing(index, id) : animateCfg.easing;
33574 result.duration = Util.isFunction(animateCfg.duration) ? animateCfg.duration(index, id) : animateCfg.duration;
33575 result.callback = animateCfg.callback;
33576 return result;
33577}
33578
33579function scaleInY(shape, animateCfg) {
33580 var id = shape._id;
33581 var index = shape.get('index');
33582 var box = shape.getBBox();
33583 var points = shape.get('origin').points;
33584 var x = (box.minX + box.maxX) / 2;
33585 var y = void 0;
33586
33587 if (points[0].y - points[1].y <= 0) {
33588 // 当顶点在零点之下
33589 y = box.maxY;
33590 } else {
33591 y = box.minY;
33592 }
33593 var v = [x, y, 1];
33594 shape.apply(v);
33595 shape.attr('transform', [['t', -x, -y], ['s', 1, 0.01], ['t', x, y]]);
33596 var endState = {
33597 transform: [['t', -x, -y], ['s', 1, 100], ['t', x, y]]
33598 };
33599 var animateParam = getAnimateParam(animateCfg, index, id, endState);
33600 shape.animate(endState, animateParam.duration, animateParam.easing, animateParam.callback, animateParam.delay);
33601}
33602
33603function scaleInX(shape, animateCfg) {
33604 var id = shape._id;
33605 var index = shape.get('index');
33606 var box = shape.getBBox();
33607 var points = shape.get('origin').points;
33608 var x = void 0;
33609 var y = (box.minY + box.maxY) / 2;
33610
33611 if (points[0].y - points[1].y > 0) {
33612 // 当顶点在零点之下
33613 x = box.maxX;
33614 } else {
33615 x = box.minX;
33616 }
33617 var v = [x, y, 1];
33618 shape.apply(v);
33619 shape.attr({
33620 transform: [['t', -x, -y], ['s', 0.01, 1], ['t', x, y]]
33621 });
33622 var endState = {
33623 transform: [['t', -x, -y], ['s', 100, 1], ['t', x, y]]
33624 };
33625 var animateParam = getAnimateParam(animateCfg, index, id, endState);
33626 shape.animate(endState, animateParam.duration, animateParam.easing, animateParam.callback, animateParam.delay);
33627}
33628
33629function lineWidthOut(shape, animateCfg) {
33630 var endState = {
33631 lineWidth: 0,
33632 opacity: 0
33633 };
33634 var id = shape._id;
33635 var index = shape.get('index');
33636 var animateParam = getAnimateParam(animateCfg, index, id, endState);
33637 shape.animate(endState, animateParam.duration, animateParam.easing, function () {
33638 shape.remove();
33639 }, animateParam.delay);
33640}
33641
33642function zoomIn(shape, animateCfg, coord) {
33643 var id = shape._id;
33644 var index = shape.get('index');
33645 var x = void 0;
33646 var y = void 0;
33647 if (coord.isPolar && shape.name !== 'point') {
33648 x = coord.getCenter().x;
33649 y = coord.getCenter().y;
33650 } else {
33651 var box = shape.getBBox();
33652 x = (box.minX + box.maxX) / 2;
33653 y = (box.minY + box.maxY) / 2;
33654 }
33655 var v = [x, y, 1];
33656 shape.apply(v);
33657 shape.attr({
33658 transform: [['t', -x, -y], ['s', 0.01, 0.01], ['t', x, y]]
33659 });
33660 var endState = {
33661 transform: [['t', -x, -y], ['s', 100, 100], ['t', x, y]]
33662 };
33663 var animateParam = getAnimateParam(animateCfg, index, id, endState);
33664 shape.animate(endState, animateParam.duration, animateParam.easing, animateParam.callback, animateParam.delay);
33665}
33666
33667function zoomOut(shape, animateCfg, coord) {
33668 var id = shape._id;
33669 var index = shape.get('index');
33670 var x = void 0;
33671 var y = void 0;
33672 if (coord.isPolar && shape.name !== 'point') {
33673 x = coord.getCenter().x;
33674 y = coord.getCenter().y;
33675 } else {
33676 var box = shape.getBBox();
33677 x = (box.minX + box.maxX) / 2;
33678 y = (box.minY + box.maxY) / 2;
33679 }
33680 var v = [x, y, 1];
33681 shape.apply(v);
33682 var endState = {
33683 transform: [['t', -x, -y], ['s', 0.01, 0.01], ['t', x, y]]
33684 };
33685 var animateParam = getAnimateParam(animateCfg, index, id, endState);
33686 shape.animate(endState, animateParam.duration, animateParam.easing, function () {
33687 shape.remove();
33688 }, animateParam.delay);
33689}
33690
33691function pathIn(shape, animateCfg) {
33692 if (shape.get('type') !== 'path') return;
33693 var id = shape._id;
33694 var index = shape.get('index');
33695 var path = PathUtil.pathToAbsolute(shape.attr('path'));
33696 shape.attr('path', [path[0]]);
33697 var endState = {
33698 path: path
33699 };
33700 var animateParam = getAnimateParam(animateCfg, index, id, endState);
33701 shape.animate(endState, animateParam.duration, animateParam.easing, animateParam.callback, animateParam.delay);
33702}
33703
33704function pathOut(shape, animateCfg) {
33705 if (shape.get('type') !== 'path') return;
33706 var id = shape._id;
33707 var index = shape.get('index');
33708 var path = PathUtil.pathToAbsolute(shape.attr('path'));
33709 var endState = {
33710 path: [path[0]]
33711 };
33712 var animateParam = getAnimateParam(animateCfg, index, id, endState);
33713 shape.animate(endState, animateParam.duration, animateParam.easing, function () {
33714 shape.remove();
33715 }, animateParam.delay);
33716}
33717
33718function clipIn(shape, animateCfg, coord, startAngle, endAngle) {
33719 var clip = getClip(coord);
33720 var canvas = shape.get('canvas');
33721 var id = shape._id;
33722 var index = shape.get('index');
33723 var endState = void 0;
33724 if (startAngle) {
33725 clip.attr('startAngle', startAngle);
33726 clip.attr('endAngle', startAngle);
33727 endState = {
33728 endAngle: endAngle
33729 };
33730 } else {
33731 endState = clip.endState;
33732 }
33733 clip.set('canvas', canvas);
33734 shape.attr('clip', clip);
33735 shape.setSilent('animating', true);
33736 var animateParam = getAnimateParam(animateCfg, index, id, endState);
33737 clip.animate(endState, animateParam.duration, animateParam.easing, function () {
33738 if (shape && !shape.get('destroyed')) {
33739 shape.attr('clip', null);
33740 shape.setSilent('cacheShape', null);
33741 shape.setSilent('animating', false);
33742 clip.remove();
33743 }
33744 }, animateParam.delay);
33745}
33746
33747function fadeIn(shape, animateCfg) {
33748 var id = shape._id;
33749 var index = shape.get('index');
33750 var fillOpacity = Util.isNil(shape.attr('fillOpacity')) ? 1 : shape.attr('fillOpacity');
33751 var strokeOpacity = Util.isNil(shape.attr('strokeOpacity')) ? 1 : shape.attr('strokeOpacity');
33752 shape.attr('fillOpacity', 0);
33753 shape.attr('strokeOpacity', 0);
33754 var endState = {
33755 fillOpacity: fillOpacity,
33756 strokeOpacity: strokeOpacity
33757 };
33758 var animateParam = getAnimateParam(animateCfg, index, id, endState);
33759 shape.animate(endState, animateParam.duration, animateParam.easing, animateParam.callback, animateParam.delay);
33760}
33761
33762function fadeOut(shape, animateCfg) {
33763 var id = shape._id;
33764 var index = shape.get('index');
33765 var endState = {
33766 fillOpacity: 0,
33767 strokeOpacity: 0
33768 };
33769 var animateParam = getAnimateParam(animateCfg, index, id, endState);
33770 shape.animate(endState, animateParam.duration, animateParam.easing, function () {
33771 shape.remove();
33772 }, animateParam.delay);
33773}
33774
33775function fanIn(shape, animateCfg, coord) {
33776 var angle = getAngle(shape, coord);
33777 var endAngle = angle.endAngle;
33778 var startAngle = angle.startAngle;
33779 clipIn(shape, animateCfg, coord, startAngle, endAngle);
33780}
33781
33782// 默认动画库
33783module.exports = {
33784 enter: {
33785 clipIn: clipIn,
33786 zoomIn: zoomIn,
33787 pathIn: pathIn,
33788 scaleInY: scaleInY,
33789 scaleInX: scaleInX,
33790 fanIn: fanIn,
33791 fadeIn: fadeIn
33792 },
33793 leave: {
33794 lineWidthOut: lineWidthOut,
33795 zoomOut: zoomOut,
33796 pathOut: pathOut,
33797 fadeOut: fadeOut
33798 },
33799 appear: {
33800 clipIn: clipIn,
33801 zoomIn: zoomIn,
33802 pathIn: pathIn,
33803 scaleInY: scaleInY,
33804 scaleInX: scaleInX,
33805 fanIn: fanIn,
33806 fadeIn: fadeIn
33807 },
33808 update: {
33809 fadeIn: fadeIn,
33810 fanIn: fanIn
33811 }
33812};
33813
33814/***/ }),
33815/* 282 */
33816/***/ (function(module, exports, __webpack_require__) {
33817
33818function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
33819
33820function _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; }
33821
33822function _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; }
33823
33824/**
33825 * @fileOverview G2 图表的入口文件
33826 * @author dxq613@gmail.com
33827 */
33828
33829var Util = __webpack_require__(0);
33830var View = __webpack_require__(283);
33831var G = __webpack_require__(2);
33832var Canvas = G.Canvas;
33833var DomUtil = G.DomUtil;
33834var Component = __webpack_require__(25);
33835var Controller = __webpack_require__(115);
33836var Facets = __webpack_require__(360);
33837var Global = __webpack_require__(1);
33838
33839function _isScaleExist(scales, compareScale) {
33840 var flag = false;
33841 Util.each(scales, function (scale) {
33842 var scaleValues = [].concat(scale.values);
33843 var compareScaleValues = [].concat(compareScale.values);
33844 if (scale.type === compareScale.type && scale.field === compareScale.field && scaleValues.sort().toString() === compareScaleValues.sort().toString()) {
33845 flag = true;
33846 return;
33847 }
33848 });
33849
33850 return flag;
33851}
33852
33853/**
33854 * 图表的入口
33855 * @class Chart
33856 */
33857
33858var Chart = function (_View) {
33859 _inherits(Chart, _View);
33860
33861 function Chart() {
33862 _classCallCheck(this, Chart);
33863
33864 return _possibleConstructorReturn(this, _View.apply(this, arguments));
33865 }
33866
33867 /**
33868 * 获取默认的配置属性
33869 * @protected
33870 * @return {Object} 默认属性
33871 */
33872 Chart.prototype.getDefaultCfg = function getDefaultCfg() {
33873 var viewCfg = _View.prototype.getDefaultCfg.call(this);
33874 return Util.mix(viewCfg, {
33875 id: null,
33876 forceFit: false,
33877 container: null,
33878 wrapperEl: null,
33879 canvas: null,
33880 width: 500,
33881 height: 500,
33882 pixelRatio: null,
33883 padding: Global.plotCfg.padding,
33884 backPlot: null,
33885 frontPlot: null,
33886 plotBackground: null,
33887 background: null,
33888 views: []
33889 });
33890 };
33891
33892 Chart.prototype.init = function init() {
33893 this._initCanvas();
33894 this._initPlot();
33895 this._initEvents();
33896 _View.prototype.init.call(this);
33897
33898 var tooltipController = new Controller.Tooltip({
33899 chart: this,
33900 options: {}
33901 });
33902 this.set('tooltipController', tooltipController);
33903
33904 var legendController = new Controller.Legend({
33905 chart: this
33906 });
33907 this.set('legendController', legendController);
33908 this.set('_id', 'chart'); // 防止同用户设定的 id 同名
33909 this.emit('afterinit'); // 初始化完毕
33910 };
33911 // 初始化画布
33912
33913
33914 Chart.prototype._initCanvas = function _initCanvas() {
33915 var container = this.get('container');
33916 var id = this.get('id');
33917 // 如果未设置 container 使用 ID, 兼容 2.x 版本
33918 if (!container && id) {
33919 container = id;
33920 this.set('container', id);
33921 }
33922 var width = this.get('width');
33923 var height = this.get('height');
33924 if (Util.isString(container)) {
33925 container = document.getElementById(container);
33926 if (!container) {
33927 throw new Error('Please specify the container for the chart!');
33928 }
33929 this.set('container', container);
33930 }
33931 var wrapperEl = DomUtil.createDom('<div style="position:relative;"></div>');
33932 container.appendChild(wrapperEl);
33933 this.set('wrapperEl', wrapperEl);
33934 if (this.get('forceFit')) {
33935 width = DomUtil.getWidth(container);
33936 this.set('width', width);
33937 }
33938 var canvas = new Canvas({
33939 containerDOM: wrapperEl,
33940 width: width,
33941 height: height,
33942 pixelRatio: this.get('pixelRatio')
33943 });
33944 this.set('canvas', canvas);
33945 };
33946
33947 // 初始化绘图区间
33948
33949
33950 Chart.prototype._initPlot = function _initPlot() {
33951 this._initPlotBack(); // 最底层的是背景相关的 group
33952 var canvas = this.get('canvas');
33953 var backPlot = canvas.addGroup({
33954 zIndex: 1
33955 }); // 图表最后面的容器
33956 var plotContainer = canvas.addGroup({
33957 zIndex: 2
33958 }); // 图表所在的容器
33959 var frontPlot = canvas.addGroup({
33960 zIndex: 3
33961 }); // 图表前面的容器
33962
33963 this.set('backPlot', backPlot);
33964 this.set('middlePlot', plotContainer);
33965 this.set('frontPlot', frontPlot);
33966 };
33967
33968 // 初始化背景
33969
33970
33971 Chart.prototype._initPlotBack = function _initPlotBack() {
33972 var canvas = this.get('canvas');
33973 var plot = canvas.addGroup(Component.Plot, {
33974 padding: this.get('padding'),
33975 plotBackground: Util.mix({}, Global.plotBackground, this.get('plotBackground')),
33976 background: Util.mix({}, Global.background, this.get('background'))
33977 });
33978 this.set('plot', plot);
33979 this.set('plotRange', plot.get('plotRange'));
33980 };
33981
33982 Chart.prototype._initEvents = function _initEvents() {
33983 if (this.get('forceFit')) {
33984 window.addEventListener('resize', Util.wrapBehavior(this, '_initForceFitEvent'));
33985 }
33986 };
33987
33988 Chart.prototype._initForceFitEvent = function _initForceFitEvent() {
33989 var timer = setTimeout(Util.wrapBehavior(this, 'forceFit'), 200);
33990 clearTimeout(this.get('resizeTimer'));
33991 this.set('resizeTimer', timer);
33992 };
33993
33994 // 绘制图例
33995
33996
33997 Chart.prototype._renderLegends = function _renderLegends() {
33998 var options = this.get('options');
33999 var legendOptions = options.legends;
34000 if (Util.isNil(legendOptions) || legendOptions !== false) {
34001 // 没有关闭图例
34002 var legendController = this.get('legendController');
34003 legendController.options = legendOptions || {};
34004 legendController.plotRange = this.get('plotRange');
34005
34006 if (legendOptions && legendOptions.custom) {
34007 // 用户自定义图例
34008 legendController.addCustomLegend();
34009 } else {
34010 var geoms = this.getAllGeoms();
34011 var scales = [];
34012 Util.each(geoms, function (geom) {
34013 var view = geom.get('view');
34014 var attrs = geom.getAttrsForLegend();
34015 Util.each(attrs, function (attr) {
34016 var type = attr.type;
34017 var scale = attr.getScale(type);
34018 if (scale.type !== 'identity' && !_isScaleExist(scales, scale)) {
34019 scales.push(scale);
34020 var filteredValues = view.getFilteredValues(scale.field);
34021 legendController.addLegend(scale, attr, geom, filteredValues);
34022 }
34023 });
34024 });
34025 }
34026
34027 legendController.alignLegends();
34028 }
34029 };
34030
34031 // 绘制 tooltip
34032
34033
34034 Chart.prototype._renderTooltips = function _renderTooltips() {
34035 var options = this.get('options');
34036 if (Util.isNil(options.tooltip) || options.tooltip !== false) {
34037 // 用户没有关闭 tooltip
34038 var tooltipController = this.get('tooltipController');
34039 tooltipController.options = options.tooltip || {};
34040 tooltipController.renderTooltip();
34041 }
34042 };
34043
34044 /**
34045 * 获取所有的几何标记
34046 * @return {Array} 所有的几何标记
34047 */
34048
34049
34050 Chart.prototype.getAllGeoms = function getAllGeoms() {
34051 var geoms = [];
34052 geoms = geoms.concat(this.get('geoms'));
34053
34054 var views = this.get('views');
34055 Util.each(views, function (view) {
34056 geoms = geoms.concat(view.get('geoms'));
34057 });
34058
34059 return geoms;
34060 };
34061
34062 /**
34063 * 自适应宽度
34064 * @chainable
34065 * @return {Chart} 图表对象
34066 */
34067
34068
34069 Chart.prototype.forceFit = function forceFit() {
34070 var self = this;
34071 var container = self.get('container');
34072 var width = DomUtil.getWidth(container);
34073 if (width !== this.get('width')) {
34074 var height = this.get('height');
34075 this.changeSize(width, height);
34076 }
34077 return self;
34078 };
34079
34080 /**
34081 * 改变大小
34082 * @param {Number} width 图表宽度
34083 * @param {Number} height 图表高度
34084 * @return {Chart} 图表对象
34085 */
34086
34087
34088 Chart.prototype.changeSize = function changeSize(width, height) {
34089 var self = this;
34090 var canvas = self.get('canvas');
34091 canvas.changeSize(width, height);
34092
34093 self.set('width', width);
34094 self.set('height', height);
34095 var plot = self.get('plot');
34096 plot.repaint();
34097
34098 self.repaint();
34099 this.emit('afterchangesize');
34100 return self;
34101 };
34102 /**
34103 * 改变宽度
34104 * @param {Number} width 图表宽度
34105 * @return {Chart} 图表对象
34106 */
34107
34108
34109 Chart.prototype.changeWidth = function changeWidth(width) {
34110 return this.changeSize(width, this.get('height'));
34111 };
34112 /**
34113 * 改变宽度
34114 * @param {Number} height 图表高度
34115 * @return {Chart} 图表对象
34116 */
34117
34118
34119 Chart.prototype.changeHeight = function changeHeight(height) {
34120 return this.changeSize(this.get('width'), height);
34121 };
34122
34123 Chart.prototype.facet = function facet(type, cfg) {
34124 var cls = Facets[Util.upperFirst(type)];
34125 if (!cls) {
34126 throw new Error('Not support such type of facets as: ' + type);
34127 }
34128 var preFacets = this.get('facets');
34129 if (preFacets) {
34130 preFacets.destroy();
34131 }
34132 cfg.chart = this;
34133 var facets = new cls(cfg);
34134 this.set('facets', facets);
34135 };
34136
34137 /**
34138 * 创建一个视图
34139 * @param {Object} cfg 视图的配置项
34140 * @return {View} 视图对象
34141 */
34142
34143
34144 Chart.prototype.view = function view(cfg) {
34145 cfg = cfg || {};
34146 cfg.parent = this;
34147 cfg.backPlot = this.get('backPlot');
34148 cfg.middlePlot = this.get('middlePlot');
34149 cfg.frontPlot = this.get('frontPlot');
34150 cfg.canvas = this.get('canvas');
34151 if (Util.isNil(cfg.animate)) {
34152 cfg.animate = this.get('animate');
34153 }
34154 cfg.options = Util.mix({}, this._getSharedOptions(), cfg.options);
34155 var view = new View(cfg);
34156 view.set('_id', 'view' + this.get('views').length); // 标识 ID,防止同用户设定的 id 重名
34157 this.get('views').push(view);
34158 this.emit('addview', { view: view });
34159 return view;
34160 };
34161
34162 Chart.prototype.isShapeInView = function isShapeInView() {
34163 return true;
34164 };
34165
34166 Chart.prototype.removeView = function removeView(view) {
34167 var views = this.get('views');
34168 Util.Array.remove(views, view);
34169 view.destroy();
34170 };
34171
34172 Chart.prototype._getSharedOptions = function _getSharedOptions() {
34173 var options = this.get('options');
34174 var sharedOptions = {};
34175 Util.each(['scales', 'coord', 'axes'], function (name) {
34176 sharedOptions[name] = Util.cloneDeep(options[name]);
34177 });
34178 return sharedOptions;
34179 };
34180
34181 /**
34182 * @override
34183 * 当前chart 的范围
34184 */
34185
34186
34187 Chart.prototype.getViewRegion = function getViewRegion() {
34188 var plotRange = this.get('plotRange');
34189 return {
34190 start: plotRange.bl,
34191 end: plotRange.tr
34192 };
34193 };
34194
34195 /**
34196 * 设置图例配置信息
34197 * @param {String|Object} field 字段名
34198 * @param {Object} [cfg] 图例的配置项
34199 * @return {Chart} 当前的图表对象
34200 */
34201
34202
34203 Chart.prototype.legend = function legend(field, cfg) {
34204 var options = this.get('options');
34205 if (!options.legends) {
34206 options.legends = {};
34207 }
34208
34209 var legends = {};
34210 if (field === false) {
34211 options.legends = false;
34212 } else if (Util.isObject(field)) {
34213 legends = field;
34214 } else if (Util.isString(field)) {
34215 legends[field] = cfg;
34216 } else {
34217 legends = cfg;
34218 }
34219 Util.mix(options.legends, legends);
34220
34221 return this;
34222 };
34223
34224 /**
34225 * 设置提示信息
34226 * @param {String|Object} visible 是否可见
34227 * @param {Object} [cfg] 提示信息的配置项
34228 * @return {Chart} 当前的图表对象
34229 */
34230
34231
34232 Chart.prototype.tooltip = function tooltip(visible, cfg) {
34233 var options = this.get('options');
34234 if (!options.tooltip) {
34235 options.tooltip = {};
34236 }
34237
34238 if (visible === false) {
34239 options.tooltip = false;
34240 } else if (Util.isObject(visible)) {
34241 Util.mix(options.tooltip, visible);
34242 } else {
34243 Util.mix(options.tooltip, cfg);
34244 }
34245
34246 return this;
34247 };
34248
34249 /**
34250 * 清空图表
34251 * @return {Chart} 当前的图表对象
34252 */
34253
34254
34255 Chart.prototype.clear = function clear() {
34256 this.emit('beforeclear');
34257 var views = this.get('views');
34258 while (views.length > 0) {
34259 var view = views.shift();
34260 view.destroy();
34261 }
34262 _View.prototype.clear.call(this);
34263 var canvas = this.get('canvas');
34264 canvas.draw();
34265 this.emit('afterclear');
34266 return this;
34267 };
34268
34269 Chart.prototype.clearInner = function clearInner() {
34270 var views = this.get('views');
34271 Util.each(views, function (view) {
34272 view.clearInner();
34273 });
34274
34275 var tooltipController = this.get('tooltipController');
34276 tooltipController && tooltipController.clear();
34277
34278 if (!this.get('keepLegend')) {
34279 var legendController = this.get('legendController');
34280 legendController && legendController.clear();
34281 }
34282
34283 _View.prototype.clearInner.call(this);
34284 };
34285
34286 /**
34287 * 绘制图表
34288 * @override
34289 */
34290
34291
34292 Chart.prototype.paint = function paint() {
34293 _View.prototype.paint.call(this);
34294 !this.get('keepLegend') && this._renderLegends(); // 渲染图例
34295 this._renderTooltips(); // 渲染 tooltip
34296 this.set('keepLegend', false);
34297 };
34298
34299 /**
34300 * @override
34301 * 显示或者隐藏
34302 */
34303
34304
34305 Chart.prototype.changeVisible = function changeVisible(visible) {
34306 var wrapperEl = this.get('wrapperEl');
34307 var visibleStr = visible ? '' : 'none';
34308 wrapperEl.style.display = visibleStr;
34309 };
34310
34311 /**
34312 * 返回图表的 dataUrl 用于生成图片
34313 * @return {String} dataUrl 路径
34314 */
34315
34316
34317 Chart.prototype.toDataURL = function toDataURL() {
34318 var canvas = this.get('canvas');
34319 var canvasDom = canvas.get('el');
34320 var dataURL = canvasDom.toDataURL('image/png');
34321 return dataURL;
34322 };
34323
34324 /**
34325 * 图表导出功能
34326 * @param {String} [name] 图片的名称,默认为 chart.png
34327 * @return {String} 返回生成图片的 dataUrl 路径
34328 */
34329
34330
34331 Chart.prototype.downloadImage = function downloadImage(name) {
34332 var dataURL = this.toDataURL();
34333 var link = document.createElement('a');
34334 link.download = (name || 'chart') + '.png';
34335 link.href = dataURL.replace('image/png', 'image/octet-stream');
34336 link.click();
34337 return dataURL;
34338 };
34339
34340 /**
34341 * 根据坐标点显示对应的 tooltip
34342 * @param {Object} point 画布上的点
34343 * @return {Chart} 返回 chart 实例
34344 */
34345
34346
34347 Chart.prototype.showTooltip = function showTooltip(point) {
34348 var views = this.getViewsByPoint(point);
34349 if (views.length) {
34350 var tooltipController = this.get('tooltipController');
34351 tooltipController.showTooltip(point, views);
34352 }
34353 return this;
34354 };
34355
34356 /**
34357 * 隐藏 tooltip
34358 * @return {Chart} 返回 chart 实例
34359 */
34360
34361
34362 Chart.prototype.hideTooltip = function hideTooltip() {
34363 var tooltipController = this.get('tooltipController');
34364 tooltipController.hideTooltip();
34365 return this;
34366 };
34367
34368 /**
34369 * 根据传入的画布坐标,获取该处的 tooltip 上的记录信息
34370 * @param {Object} point 画布坐标点
34371 * @return {Array} 返回结果
34372 */
34373
34374
34375 Chart.prototype.getTooltipItems = function getTooltipItems(point) {
34376 var self = this;
34377 var views = self.getViewsByPoint(point);
34378 var rst = [];
34379 Util.each(views, function (view) {
34380 var geoms = view.get('geoms');
34381 Util.each(geoms, function (geom) {
34382 var dataArray = geom.get('dataArray');
34383 var items = [];
34384 Util.each(dataArray, function (data) {
34385 var tmpPoint = geom.findPoint(point, data);
34386 if (tmpPoint) {
34387 var subItems = geom.getTipItems(tmpPoint);
34388 items = items.concat(subItems);
34389 }
34390 });
34391 rst = rst.concat(items);
34392 });
34393 });
34394 return rst;
34395 };
34396
34397 /**
34398 * @override
34399 * 销毁图表
34400 */
34401
34402
34403 Chart.prototype.destroy = function destroy() {
34404 this.emit('beforedestroy');
34405 var canvas = this.get('canvas');
34406 var wrapperEl = this.get('wrapperEl');
34407 wrapperEl.parentNode.removeChild(wrapperEl);
34408 _View.prototype.destroy.call(this);
34409 canvas.destroy();
34410 window.removeEventListener('resize', Util.getWrapBehavior(this, '_initForceFitEvent'));
34411 this.emit('afterdestroy');
34412 };
34413
34414 return Chart;
34415}(View);
34416
34417module.exports = Chart;
34418
34419/***/ }),
34420/* 283 */
34421/***/ (function(module, exports, __webpack_require__) {
34422
34423function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
34424
34425function _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; }
34426
34427function _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; }
34428
34429/**
34430 * @fileOverview view
34431 * @author dxq613@gmail.com
34432 */
34433
34434var Base = __webpack_require__(63);
34435var Geom = __webpack_require__(285);
34436var Util = __webpack_require__(0);
34437var Controller = __webpack_require__(115);
34438var Global = __webpack_require__(1);
34439var FIELD_ORIGIN = '_origin';
34440var Animate = __webpack_require__(359);
34441
34442function isFullCircle(coord) {
34443 var startAngle = coord.startAngle;
34444 var endAngle = coord.endAngle;
34445 if (!Util.isNil(startAngle) && !Util.isNil(endAngle) && endAngle - startAngle < Math.PI * 2) {
34446 return false;
34447 }
34448 return true;
34449}
34450
34451function isBetween(value, start, end) {
34452 var tmp = (value - start) / (end - start);
34453 return tmp >= 0 && tmp <= 1;
34454}
34455
34456function isPointInCoord(coord, point) {
34457 var result = false;
34458 if (coord) {
34459 var type = coord.type;
34460 if (type === 'theta') {
34461 var start = coord.start;
34462 var end = coord.end;
34463 result = isBetween(point.x, start.x, end.x) && isBetween(point.y, start.y, end.y);
34464 } else {
34465 var invertPoint = coord.invert(point);
34466 result = invertPoint.x >= 0 && invertPoint.y >= 0 && invertPoint.x <= 1 && invertPoint.y <= 1;
34467 }
34468 }
34469 return result;
34470}
34471
34472var ViewGeoms = {};
34473Util.each(Geom, function (geomConstructor, className) {
34474 var methodName = Util.lowerFirst(className);
34475 ViewGeoms[methodName] = function (cfg) {
34476 var geom = new geomConstructor(cfg);
34477 this.addGeom(geom);
34478 return geom;
34479 };
34480});
34481
34482/**
34483 * 图表中的视图
34484 * @class View
34485 */
34486
34487var View = function (_Base) {
34488 _inherits(View, _Base);
34489
34490 /**
34491 * 获取默认的配置属性
34492 * @protected
34493 * @return {Object} 默认属性
34494 */
34495 View.prototype.getDefaultCfg = function getDefaultCfg() {
34496 return {
34497 viewContainer: null,
34498 coord: null,
34499 start: { x: 0, y: 0 },
34500 end: { x: 1, y: 1 },
34501 geoms: [],
34502 scales: {},
34503 options: {},
34504 scaleController: null,
34505 padding: 0,
34506 parent: null,
34507 tooltipEnable: true, // 是否展示 tooltip
34508 animate: true
34509 };
34510 };
34511
34512 function View(cfg) {
34513 _classCallCheck(this, View);
34514
34515 var _this = _possibleConstructorReturn(this, _Base.call(this, cfg));
34516
34517 Util.mix(_this, ViewGeoms);
34518 _this.init();
34519 return _this;
34520 }
34521
34522 /**
34523 * @protected
34524 * 初始化
34525 */
34526
34527
34528 View.prototype.init = function init() {
34529 this._initViewPlot(); // 先创建容器
34530 if (this.get('data')) {
34531 this._initData(this.get('data'));
34532 }
34533 this._initOptions();
34534 this._initControllers();
34535 this._bindEvents();
34536 };
34537
34538 // 初始化配置项
34539
34540
34541 View.prototype._initOptions = function _initOptions() {
34542 var self = this;
34543 var options = Util.mix({}, self.get('options')); // 防止修改原始值
34544 if (!options.scales) {
34545 options.scales = {};
34546 }
34547 if (!options.coord) {
34548 options.coord = {};
34549 }
34550
34551 if (options.animate === false) {
34552 this.set('animate', false);
34553 }
34554
34555 if (options.tooltip === false || Util.isNull(options.tooltip)) {
34556 // 配置项方式关闭 tooltip
34557 this.set('tooltipEnable', false);
34558 }
34559
34560 if (options.geoms && options.geoms.length) {
34561 Util.each(options.geoms, function (geomOption) {
34562 self._createGeom(geomOption);
34563 });
34564 }
34565 var scaleController = self.get('scaleController');
34566 if (scaleController) {
34567 scaleController.defs = options.scales;
34568 }
34569 var coordController = self.get('coordController');
34570 if (coordController) {
34571 coordController.reset(options.coord);
34572 }
34573 this.set('options', options);
34574 };
34575
34576 View.prototype._createGeom = function _createGeom(cfg) {
34577 var type = cfg.type;
34578 var geom = void 0;
34579 if (this[type]) {
34580 geom = this[type]();
34581 Util.each(cfg, function (v, k) {
34582 if (geom[k]) {
34583
34584 if (Util.isObject(v) && v.field) {
34585 // 配置项传入
34586 if (v === 'label') {
34587 geom[k](v.field, v.callback, v.cfg);
34588 } else {
34589 var _cfg = void 0;
34590 Util.each(v, function (value, key) {
34591 if (key !== 'field') {
34592 _cfg = value;
34593 }
34594 });
34595 geom[k](v.field, _cfg);
34596 }
34597 } else {
34598 geom[k](v);
34599 }
34600 }
34601 });
34602 }
34603 };
34604
34605 // 初始化所有的控制器
34606
34607
34608 View.prototype._initControllers = function _initControllers() {
34609 var options = this.get('options');
34610
34611 var scaleController = new Controller.Scale({
34612 defs: options.scales
34613 });
34614 var coordController = new Controller.Coord(options.coord);
34615 this.set('scaleController', scaleController);
34616 this.set('coordController', coordController);
34617
34618 var axisController = new Controller.Axis();
34619 this.set('axisController', axisController);
34620
34621 var guideController = new Controller.Guide({
34622 options: options.guides || []
34623 });
34624 this.set('guideController', guideController);
34625 };
34626
34627 View.prototype._initViewPlot = function _initViewPlot() {
34628 if (!this.get('viewContainer')) {
34629 // 用于 geom 的绘制
34630 this.set('viewContainer', this.get('middlePlot'));
34631 }
34632 };
34633
34634 View.prototype._initGeoms = function _initGeoms() {
34635 var geoms = this.get('geoms');
34636 var filteredData = this.get('filteredData');
34637 var coord = this.get('coord');
34638 var viewId = this.get('_id');
34639 for (var i = 0; i < geoms.length; i++) {
34640 var geom = geoms[i];
34641 geom.set('data', filteredData);
34642 geom.set('coord', coord);
34643 geom.set('_id', viewId + '-geom' + i);
34644 geom.set('keyFields', this.get('keyFields'));
34645 geom.init();
34646 }
34647 };
34648
34649 View.prototype._clearGeoms = function _clearGeoms() {
34650 var self = this;
34651 var geoms = self.get('geoms');
34652 for (var i = 0; i < geoms.length; i++) {
34653 var geom = geoms[i];
34654 geom.clear();
34655 }
34656 };
34657
34658 View.prototype._removeGeoms = function _removeGeoms() {
34659 var self = this;
34660 var geoms = self.get('geoms');
34661 while (geoms.length > 0) {
34662 var geom = geoms.shift();
34663 geom.destroy();
34664 }
34665 };
34666
34667 View.prototype._drawGeoms = function _drawGeoms() {
34668 var geoms = this.get('geoms');
34669 var coord = this.get('coord');
34670 for (var i = 0; i < geoms.length; i++) {
34671 var geom = geoms[i];
34672 geom.setCoord(coord);
34673 geom.paint();
34674 }
34675 };
34676
34677 View.prototype.isShapeInView = function isShapeInView(shape) {
34678 var id = this.get('_id');
34679 var shapeId = shape._id;
34680 if (!shapeId) {
34681 return shape.get('parent').get('viewId') === id;
34682 }
34683 return shapeId.split('-')[0] === id;
34684 };
34685
34686 /**
34687 * View 所在的范围
34688 * @protected
34689 * @return {Object} View 所在的范围
34690 */
34691
34692
34693 View.prototype.getViewRegion = function getViewRegion() {
34694 var self = this;
34695 var parent = self.get('parent');
34696 var start = void 0;
34697 var end = void 0;
34698 if (parent) {
34699 var region = parent.getViewRegion();
34700 var viewRegion = self._getViewRegion(region.start, region.end);
34701 start = viewRegion.start;
34702 end = viewRegion.end;
34703 } else {
34704 start = self.get('start');
34705 end = self.get('end');
34706 }
34707 return {
34708 start: start,
34709 end: end
34710 };
34711 };
34712
34713 // 获取 range 所在的范围
34714
34715
34716 View.prototype._getViewRegion = function _getViewRegion(plotStart, plotEnd) {
34717 var start = this.get('start');
34718 var end = this.get('end');
34719 var startX = start.x;
34720 var startY = 1 - end.y;
34721 var endX = end.x;
34722 var endY = 1 - start.y;
34723 var padding = this.get('padding');
34724 // 转换成 上、右、下、左的模式
34725 var allPadding = Util.toAllPadding(padding);
34726 var top = allPadding[0];
34727 var right = allPadding[1];
34728 var bottom = allPadding[2];
34729 var left = allPadding[3];
34730
34731 var startPoint = {
34732 x: startX * (plotEnd.x - plotStart.x) + plotStart.x + left,
34733 y: startY * (plotEnd.y - plotStart.y) + plotStart.y - bottom
34734
34735 };
34736 var endPoint = {
34737 x: endX * (plotEnd.x - plotStart.x) + plotStart.x - right,
34738 y: endY * (plotEnd.y - plotStart.y) + plotStart.y + top
34739 };
34740
34741 return {
34742 start: startPoint,
34743 end: endPoint
34744 };
34745 };
34746
34747 View.prototype._createCoord = function _createCoord() {
34748 var coordController = this.get('coordController');
34749 var region = this.getViewRegion();
34750 var coord = coordController.createCoord(region.start, region.end);
34751 this.set('coord', coord);
34752 };
34753
34754 View.prototype._renderAxes = function _renderAxes() {
34755 var options = this.get('options');
34756 var axesOptions = options.axes;
34757 if (axesOptions === false) {
34758 // 不渲染坐标轴
34759 return;
34760 }
34761 var axisController = this.get('axisController');
34762 axisController.container = this.get('backPlot');
34763 axisController.coord = this.get('coord');
34764 axisController.options = axesOptions || {};
34765 var xScale = this.getXScale();
34766 var yScales = this.getYScales();
34767 var viewId = this.get('_id');
34768 axisController.createAxis(xScale, yScales, viewId);
34769 };
34770
34771 View.prototype._renderGuides = function _renderGuides() {
34772 var guideController = this.get('guideController');
34773 if (!Util.isEmpty(guideController.options)) {
34774 var coord = this.get('coord');
34775 guideController.backContainer = this.get('backPlot');
34776 guideController.frontContainer = this.get('frontPlot');
34777 guideController.xScales = this._getScales('x');
34778 guideController.yScales = this._getScales('y');
34779 guideController.render(coord);
34780 }
34781 };
34782 // 注册事件
34783
34784
34785 View.prototype._bindEvents = function _bindEvents() {
34786 var eventController = new Controller.Event({
34787 view: this,
34788 canvas: this.get('canvas')
34789 });
34790 eventController.bindEvents();
34791 this.set('eventController', eventController);
34792 };
34793 // 清理时间
34794
34795
34796 View.prototype._clearEvents = function _clearEvents() {
34797 var eventController = this.get('eventController');
34798 eventController && eventController.clearEvents();
34799 };
34800
34801 View.prototype._getScales = function _getScales(dimType) {
34802 var geoms = this.get('geoms');
34803 var result = {};
34804 for (var i = 0; i < geoms.length; i++) {
34805 var geom = geoms[i];
34806 var scale = dimType === 'x' ? geom.getXScale() : geom.getYScale();
34807 if (scale && !result[scale.field]) {
34808 result[scale.field] = scale;
34809 }
34810 }
34811 return result;
34812 };
34813
34814 View.prototype._adjustScale = function _adjustScale() {
34815 this._setCatScalesRange();
34816 var geoms = this.get('geoms');
34817 var scaleController = this.get('scaleController');
34818 var colDefs = scaleController.defs;
34819
34820 for (var i = 0; i < geoms.length; i++) {
34821 var geom = geoms[i];
34822 if (geom.get('type') === 'interval') {
34823 var yScale = geom.getYScale();
34824 var field = yScale.field;
34825 if (!(colDefs[field] && colDefs[field].min) && yScale.min > 0) {
34826 yScale.change({
34827 min: 0
34828 });
34829 }
34830 }
34831 }
34832 };
34833
34834 View.prototype._setCatScalesRange = function _setCatScalesRange() {
34835 var self = this;
34836 var coord = self.get('coord');
34837 var xScale = self.getXScale();
34838 var yScales = self.getYScales();
34839 var scales = [];
34840
34841 xScale && scales.push(xScale);
34842 scales = scales.concat(yScales);
34843 var inFullCircle = coord.isPolar && isFullCircle(coord);
34844 var scaleController = self.get('scaleController');
34845 var colDefs = scaleController.defs;
34846 Util.each(scales, function (scale) {
34847 if ((scale.isCategory || scale.isIdentity) && scale.values && !(colDefs[scale.field] && colDefs[scale.field].range)) {
34848 var count = scale.values.length;
34849 var range = void 0;
34850 if (count === 1) {
34851 range = [0.5, 1]; // 只有一个分类时,防止计算出现 [0.5,0.5]的状态
34852 } else {
34853 var widthRatio = 1;
34854 var offset = 0;
34855 if (inFullCircle) {
34856 if (!coord.isTransposed) {
34857 range = [0, 1 - 1 / count];
34858 } else {
34859 widthRatio = Global.widthRatio.multiplePie;
34860 offset = 1 / count * widthRatio;
34861 range = [offset / 2, 1 - offset / 2];
34862 }
34863 } else {
34864 offset = 1 / count * 1 / 2; // 两边留下分类空间的一半
34865 range = [offset, 1 - offset]; // 坐标轴最前面和最后面留下空白防止绘制柱状图时
34866 }
34867 }
34868 scale.range = range;
34869 }
34870 });
34871 };
34872
34873 View.prototype.getXScale = function getXScale() {
34874 var geoms = this.get('geoms').filter(function (geom) {
34875 return geom.get('visible');
34876 });
34877 var xScale = null;
34878 if (!Util.isEmpty(geoms)) {
34879 xScale = geoms[0].getXScale();
34880 }
34881 return xScale;
34882 };
34883
34884 View.prototype.getYScales = function getYScales() {
34885 var geoms = this.get('geoms').filter(function (geom) {
34886 return geom.get('visible');
34887 });
34888 var rst = [];
34889
34890 for (var i = 0; i < geoms.length; i++) {
34891 var geom = geoms[i];
34892 var yScale = geom.getYScale();
34893 if (yScale && Util.indexOf(rst, yScale) === -1) {
34894 rst.push(yScale);
34895 }
34896 }
34897 return rst;
34898 };
34899
34900 /**
34901 * 获取数据对应在画布空间的坐标
34902 * @param {Object} item 原始数据
34903 * @return {Object} 返回对应的画布上的坐标点
34904 */
34905
34906
34907 View.prototype.getXY = function getXY(item) {
34908 var self = this;
34909 var coord = self.get('coord');
34910 var xScales = self._getScales('x');
34911 var yScales = self._getScales('y');
34912 var x = void 0;
34913 var y = void 0;
34914
34915 for (var field in item) {
34916 if (xScales[field]) {
34917 x = xScales[field].scale(item[field]);
34918 }
34919 if (yScales[field]) {
34920 y = yScales[field].scale(item[field]);
34921 }
34922 }
34923
34924 if (!Util.isNil(x) && !Util.isNil(y)) {
34925 return coord.convert({
34926 x: x,
34927 y: y
34928 });
34929 }
34930
34931 return null;
34932 };
34933
34934 /**
34935 * 获取逼近的点的数据集合
34936 * @param {Object} point 画布上的像素点
34937 * @return {Array} 数据
34938 */
34939
34940
34941 View.prototype.getSnapRecords = function getSnapRecords(point) {
34942 var self = this;
34943 var geoms = self.get('geoms');
34944 var rst = [];
34945 Util.each(geoms, function (geom) {
34946 var dataArray = geom.get('dataArray');
34947 var record = void 0;
34948 Util.each(dataArray, function (data) {
34949 record = geom.findPoint(point, data);
34950 record && rst.push(record);
34951 });
34952 });
34953 return rst;
34954 };
34955
34956 /**
34957 * @protected
34958 * 添加几何标记
34959 * @param {Geom} geom 几何标记
34960 */
34961
34962
34963 View.prototype.addGeom = function addGeom(geom) {
34964 var self = this;
34965 var geoms = self.get('geoms');
34966 geoms.push(geom);
34967 geom.set('view', self);
34968 var container = self.get('viewContainer');
34969 geom.set('container', container);
34970 geom.set('animate', self.get('animate'));
34971 geom.bindEvents();
34972 };
34973
34974 /**
34975 * @protected
34976 * 移除几何标记
34977 * @param {Geom} geom 几何标记
34978 */
34979
34980
34981 View.prototype.removeGeom = function removeGeom(geom) {
34982 var geoms = this.get('geoms');
34983 Util.Array.remove(geoms, geom);
34984 geom.destroy();
34985 };
34986
34987 View.prototype.createScale = function createScale(field, data) {
34988 var scales = this.get('scales');
34989 var parent = this.get('parent');
34990 var scale = scales[field];
34991 // const filters = this._getFilters();
34992 if (!data) {
34993 var filteredData = this.get('filteredData');
34994 var legendFields = this._getFieldsForLegend();
34995 // 过滤导致数据为空时,需要使用全局数据
34996 // 参与过滤的字段的度量也根据全局数据来生成
34997 if (filteredData.length && legendFields.indexOf(field) === -1) {
34998 data = filteredData;
34999 } else {
35000 data = this.get('data');
35001 }
35002 }
35003 var scaleController = this.get('scaleController');
35004 if (!scale) {
35005 scale = scaleController.createScale(field, data);
35006 if (scale.sync && parent) {
35007 var parentScale = parent.createScale(field, data);
35008 scale = this._getSyncScale(parentScale, scale);
35009 }
35010 scales[field] = scale;
35011 } else if (scale.sync) {
35012 // 防止 view 内部创建的scale,Chart 上的scale 范围更大
35013 var newScale = scaleController.createScale(field, data);
35014 this._syncScale(scale, newScale);
35015 }
35016 return scale;
35017 };
35018
35019 View.prototype._getFieldsForLegend = function _getFieldsForLegend() {
35020 var fields = [];
35021 var geoms = this.get('geoms');
35022 Util.each(geoms, function (geom) {
35023 var geomFields = geom.getFieldsForLegend();
35024 fields = fields.concat(geomFields);
35025 });
35026 return Util.uniq(fields);
35027 };
35028
35029 // 如果需要同步度量,则使得 values,min,max的范围最大
35030
35031
35032 View.prototype._getSyncScale = function _getSyncScale(parentScale, scale) {
35033 if (parentScale.type !== scale.type) {
35034 return scale;
35035 }
35036 this._syncScale(parentScale, scale);
35037 return parentScale;
35038 };
35039
35040 View.prototype._syncScale = function _syncScale(distScale, sourceScale) {
35041 var mergeValues = Util.union(distScale.values, sourceScale.values);
35042 if (sourceScale.isLinear) {
35043 var max = Math.max(distScale.max, sourceScale.max);
35044 var min = Math.min(distScale.min, sourceScale.min);
35045 if (distScale.max !== max || distScale.min !== min) {
35046 distScale.change({
35047 min: min,
35048 max: max,
35049 values: mergeValues
35050 });
35051 }
35052 }
35053
35054 if (mergeValues.length !== distScale.values.length) {
35055 distScale.change({
35056 values: mergeValues
35057 });
35058 }
35059 };
35060
35061 View.prototype.getFilteredValues = function getFilteredValues(field) {
35062 var scale = this.get('scales')[field];
35063 var values = scale.values;
35064 var filters = this._getFilters();
35065 var rst = void 0;
35066 if (filters && filters[field]) {
35067 rst = values.filter(filters[field]);
35068 } else {
35069 rst = values.slice(0);
35070 }
35071 return rst;
35072 };
35073
35074 View.prototype.filter = function filter(field, condition) {
35075 var options = this.get('options');
35076 if (!options.filters) {
35077 options.filters = {};
35078 }
35079 options.filters[field] = condition;
35080 };
35081
35082 // 获取 filters
35083
35084
35085 View.prototype._getFilters = function _getFilters() {
35086 var options = this.get('options');
35087 return options.filters;
35088 };
35089
35090 // 执行 filter 数据
35091
35092
35093 View.prototype.execFilter = function execFilter(data) {
35094 var self = this;
35095 var filters = self._getFilters();
35096 if (filters) {
35097 data = data.filter(function (obj) {
35098 var rst = true;
35099 Util.each(filters, function (fn, k) {
35100 if (fn) {
35101 rst = fn(obj[k], obj);
35102 if (!rst) {
35103 return false;
35104 }
35105 }
35106 });
35107 return rst;
35108 });
35109 }
35110 return data;
35111 };
35112
35113 View.prototype.axis = function axis(field, cfg) {
35114 var options = this.get('options');
35115 if (field === false) {
35116 options.axes = false;
35117 } else {
35118 if (!options.axes) {
35119 options.axes = {};
35120 }
35121 var axisOptions = options.axes;
35122 axisOptions[field] = cfg;
35123 }
35124
35125 return this;
35126 };
35127
35128 View.prototype.guide = function guide() {
35129 return this.get('guideController');
35130 };
35131
35132 View.prototype._getKeyFields = function _getKeyFields(scaleDefs) {
35133 var keyFields = [];
35134 Util.each(scaleDefs, function (def, field) {
35135 if (def.key) {
35136 keyFields.push(field);
35137 }
35138 });
35139 this.set('keyFields', keyFields);
35140 };
35141
35142 View.prototype.scale = function scale(field, cfg) {
35143 var options = this.get('options');
35144 var scaleDefs = options.scales;
35145 if (Util.isObject(field)) {
35146 Util.mix(scaleDefs, field);
35147 } else {
35148 scaleDefs[field] = cfg;
35149 }
35150
35151 this._getKeyFields(scaleDefs);
35152 return this;
35153 };
35154
35155 View.prototype.tooltip = function tooltip(visible) {
35156 this.set('tooltipEnable', visible);
35157 return this;
35158 };
35159
35160 View.prototype.animate = function animate(enable) {
35161 var options = this.get('options');
35162 options.animate = enable;
35163 this.set('animate', enable);
35164 return this;
35165 };
35166
35167 View.prototype.changeOptions = function changeOptions(options) {
35168 this.set('options', options);
35169 this._initOptions(options);
35170 return this;
35171 };
35172
35173 /**
35174 * @internal 查找包含指定点的视图
35175 * @param {Object} point 点的位置
35176 * @return {Array} 多个视图
35177 */
35178
35179
35180 View.prototype.getViewsByPoint = function getViewsByPoint(point) {
35181 var rst = [];
35182 var views = this.get('views');
35183
35184 if (isPointInCoord(this.get('coord'), point)) {
35185 rst.push(this);
35186 }
35187
35188 Util.each(views, function (view) {
35189 if (view.get('visible') && isPointInCoord(view.get('coord'), point)) {
35190 rst.push(view);
35191 }
35192 });
35193 return rst;
35194 };
35195
35196 /**
35197 * 遍历所有的 shape ,用户更改 shape 后进行刷新
35198 * @param {Function} fn 回调函数包含参数:record,shape,geom,view
35199 * @return {View} 当前视图
35200 */
35201
35202
35203 View.prototype.eachShape = function eachShape(fn) {
35204 var self = this;
35205 var views = self.get('views');
35206 var canvas = self.get('canvas');
35207 Util.each(views, function (view) {
35208 view.eachShape(fn);
35209 });
35210 var geoms = this.get('geoms');
35211 Util.each(geoms, function (geom) {
35212 var shapes = geom.getShapes();
35213 Util.each(shapes, function (shape) {
35214 var origin = shape.get('origin');
35215 if (Util.isArray(origin)) {
35216 var arr = origin.map(function (subOrigin) {
35217 return subOrigin[FIELD_ORIGIN];
35218 });
35219 fn(arr, shape, geom, self);
35220 } else {
35221 var obj = origin[FIELD_ORIGIN];
35222 fn(obj, shape, geom, self);
35223 }
35224 });
35225 });
35226 canvas.draw();
35227 return this;
35228 };
35229
35230 /**
35231 * 遍历所有的 shape ,回调函数中 true / false 控制图形是否显示
35232 * @param {Function} fn 回调函数包含参数:record,shape,geom,view
35233 * @return {View} 当前视图
35234 */
35235
35236
35237 View.prototype.filterShape = function filterShape(fn) {
35238 var callback = function callback(record, shape, geom, view) {
35239 if (!fn(record, shape, geom, view)) {
35240 shape.set('visible', false);
35241 } else {
35242 shape.set('visible', true);
35243 }
35244 };
35245 this.eachShape(callback);
35246 return this;
35247 };
35248
35249 View.prototype.clearInner = function clearInner() {
35250 this.set('scales', {});
35251 var options = this.get('options');
35252 options.geoms = null;
35253 this._clearGeoms();
35254 // reset guide
35255 this.get('guideController') && this.get('guideController').reset();
35256 // clear axis
35257 this.get('axisController') && this.get('axisController').clear();
35258 };
35259
35260 /**
35261 * 清除视图内容,包括 geoms
35262 * @return {View} 当前视图
35263 */
35264
35265
35266 View.prototype.clear = function clear() {
35267 var options = this.get('options');
35268 options.filters = null;
35269 this._removeGeoms();
35270 // const container = this.get('viewContainer');
35271 // container.clear();
35272 this.clearInner();
35273 this.get('guideController') && this.get('guideController').clear();
35274 this.set('isUpdate', false);
35275 this.set('keyFields', []);
35276 return this;
35277 };
35278
35279 /**
35280 * 设置坐标系信息
35281 * @param {String} type 类型
35282 * @param {Object} cfg 配置项
35283 * @return {Object} coordController 坐标系的管理器
35284 */
35285
35286
35287 View.prototype.coord = function coord(type, cfg) {
35288 var coordController = this.get('coordController');
35289 coordController.reset({
35290 type: type,
35291 cfg: cfg
35292 });
35293 return coordController;
35294 };
35295
35296 /**
35297 * 当父元素边框发生改变时坐标系需要重新调整
35298 * @protected
35299 */
35300
35301
35302 View.prototype.resetCoord = function resetCoord() {
35303 this._createCoord();
35304 };
35305
35306 /**
35307 * 绘制 geometry 前处理一些度量统一
35308 * @protected
35309 */
35310
35311
35312 View.prototype.beforeDraw = function beforeDraw() {};
35313
35314 View.prototype.source = function source(data, scales) {
35315 this._initData(data);
35316 if (scales) {
35317 this.scale(scales);
35318 }
35319 this.emit('setdata');
35320 return this;
35321 };
35322
35323 View.prototype.changeData = function changeData(data) {
35324 this.emit('beforechangedata');
35325 this._initData(data);
35326 this.emit('afterchangedata');
35327 this.repaint();
35328 return this;
35329 };
35330
35331 View.prototype._initData = function _initData(data) {
35332 var dataView = this.get('dataView');
35333 if (dataView) {
35334 dataView.off('change', Util.getWrapBehavior(this, '_onViewChange'));
35335 this.set('dataView', null);
35336 }
35337 if (data && data.isDataView) {
35338 data.on('change', Util.wrapBehavior(this, '_onViewChange'));
35339 this.set('dataView', data);
35340 data = data.rows;
35341 }
35342 this.set('data', data);
35343 };
35344
35345 View.prototype._onViewChange = function _onViewChange() {
35346 this.emit('beforechangedata');
35347 var dataView = this.get('dataView');
35348 var rows = dataView.rows;
35349 this.set('data', rows);
35350 this.emit('afterchangedata');
35351 this.repaint();
35352 };
35353
35354 View.prototype.render = function render(stopDraw) {
35355 this.emit('beforerender');
35356 var views = this.get('views');
35357 var animate = this.get('animate');
35358 // 初始化 View 的数据
35359 Util.each(views, function (view) {
35360 view.initView();
35361 });
35362 this.initView();
35363 this.emit('beforepaint');
35364 // 绘制
35365 Util.each(views, function (view) {
35366 view.paint();
35367 });
35368 this.paint();
35369 this.emit('afterpaint');
35370 if (!stopDraw) {
35371 var backPlot = this.get('backPlot');
35372 backPlot.sort();
35373 var canvas = this.get('canvas');
35374
35375 if (animate) {
35376 var isUpdate = this.get('isUpdate');
35377 Util.each(views, function (view) {
35378 Animate.execAnimation(view, isUpdate);
35379 });
35380 Animate.execAnimation(this, isUpdate);
35381 } else {
35382 canvas.draw();
35383 }
35384 }
35385 this.emit('afterrender');
35386 return this;
35387 };
35388
35389 View.prototype.initView = function initView() {
35390 var data = this.get('data') || [];
35391 var filteredData = this.execFilter(data);
35392 this.set('filteredData', filteredData);
35393 // if (!Util.isEmpty(data)) {
35394 this._createCoord(); // draw geometry 前绘制区域可能会发生改变
35395 this._initGeoms();
35396 this._adjustScale();
35397 // }
35398 };
35399
35400 View.prototype.paint = function paint() {
35401 var data = this.get('data');
35402 if (!Util.isEmpty(data)) {
35403 this.beforeDraw();
35404 this._drawGeoms();
35405 this._renderGuides();
35406 }
35407 this._renderAxes();
35408 };
35409
35410 View.prototype.changeVisible = function changeVisible(visible) {
35411 var geoms = this.get('geoms');
35412 Util.each(geoms, function (geom) {
35413 if (geom.get('visible')) {
35414 // geom 隐藏时不受
35415 geom.changeVisible(visible, true);
35416 }
35417 });
35418 this.get('axisController') && this.get('axisController').changeVisible(visible);
35419 this.get('guideController') && this.get('guideController').changeVisible(visible);
35420 var canvas = this.get('canvas');
35421
35422 canvas.draw();
35423 };
35424
35425 View.prototype.repaint = function repaint() {
35426 this.set('isUpdate', true);
35427 this.clearInner();
35428 this.render();
35429 };
35430
35431 View.prototype.destroy = function destroy() {
35432 this._clearEvents();
35433 var dataView = this.get('dataView');
35434 dataView && dataView.off('change', Util.getWrapBehavior(this, '_onViewChange'));
35435 this.clear();
35436 _Base.prototype.destroy.call(this);
35437 };
35438
35439 return View;
35440}(Base);
35441
35442module.exports = View;
35443
35444/***/ }),
35445/* 284 */
35446/***/ (function(module, exports, __webpack_require__) {
35447
35448var __WEBPACK_AMD_DEFINE_RESULT__;var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
35449
35450/*!
35451 * EventEmitter v5.2.4 - git.io/ee
35452 * Unlicense - http://unlicense.org/
35453 * Oliver Caldwell - http://oli.me.uk/
35454 * @preserve
35455 */
35456
35457;(function (exports) {
35458 'use strict';
35459
35460 /**
35461 * Class for managing events.
35462 * Can be extended to provide event functionality in other classes.
35463 *
35464 * @class EventEmitter Manages event registering and emitting.
35465 */
35466
35467 function EventEmitter() {}
35468
35469 // Shortcuts to improve speed and size
35470 var proto = EventEmitter.prototype;
35471 var originalGlobalValue = exports.EventEmitter;
35472
35473 /**
35474 * Finds the index of the listener for the event in its storage array.
35475 *
35476 * @param {Function[]} listeners Array of listeners to search through.
35477 * @param {Function} listener Method to look for.
35478 * @return {Number} Index of the specified listener, -1 if not found
35479 * @api private
35480 */
35481 function indexOfListener(listeners, listener) {
35482 var i = listeners.length;
35483 while (i--) {
35484 if (listeners[i].listener === listener) {
35485 return i;
35486 }
35487 }
35488
35489 return -1;
35490 }
35491
35492 /**
35493 * Alias a method while keeping the context correct, to allow for overwriting of target method.
35494 *
35495 * @param {String} name The name of the target method.
35496 * @return {Function} The aliased method
35497 * @api private
35498 */
35499 function alias(name) {
35500 return function aliasClosure() {
35501 return this[name].apply(this, arguments);
35502 };
35503 }
35504
35505 /**
35506 * Returns the listener array for the specified event.
35507 * Will initialise the event object and listener arrays if required.
35508 * Will return an object if you use a regex search. The object contains keys for each matched event. So /ba[rz]/ might return an object containing bar and baz. But only if you have either defined them with defineEvent or added some listeners to them.
35509 * Each property in the object response is an array of listener functions.
35510 *
35511 * @param {String|RegExp} evt Name of the event to return the listeners from.
35512 * @return {Function[]|Object} All listener functions for the event.
35513 */
35514 proto.getListeners = function getListeners(evt) {
35515 var events = this._getEvents();
35516 var response;
35517 var key;
35518
35519 // Return a concatenated array of all matching events if
35520 // the selector is a regular expression.
35521 if (evt instanceof RegExp) {
35522 response = {};
35523 for (key in events) {
35524 if (events.hasOwnProperty(key) && evt.test(key)) {
35525 response[key] = events[key];
35526 }
35527 }
35528 } else {
35529 response = events[evt] || (events[evt] = []);
35530 }
35531
35532 return response;
35533 };
35534
35535 /**
35536 * Takes a list of listener objects and flattens it into a list of listener functions.
35537 *
35538 * @param {Object[]} listeners Raw listener objects.
35539 * @return {Function[]} Just the listener functions.
35540 */
35541 proto.flattenListeners = function flattenListeners(listeners) {
35542 var flatListeners = [];
35543 var i;
35544
35545 for (i = 0; i < listeners.length; i += 1) {
35546 flatListeners.push(listeners[i].listener);
35547 }
35548
35549 return flatListeners;
35550 };
35551
35552 /**
35553 * Fetches the requested listeners via getListeners but will always return the results inside an object. This is mainly for internal use but others may find it useful.
35554 *
35555 * @param {String|RegExp} evt Name of the event to return the listeners from.
35556 * @return {Object} All listener functions for an event in an object.
35557 */
35558 proto.getListenersAsObject = function getListenersAsObject(evt) {
35559 var listeners = this.getListeners(evt);
35560 var response;
35561
35562 if (listeners instanceof Array) {
35563 response = {};
35564 response[evt] = listeners;
35565 }
35566
35567 return response || listeners;
35568 };
35569
35570 function isValidListener(listener) {
35571 if (typeof listener === 'function' || listener instanceof RegExp) {
35572 return true;
35573 } else if (listener && (typeof listener === 'undefined' ? 'undefined' : _typeof(listener)) === 'object') {
35574 return isValidListener(listener.listener);
35575 } else {
35576 return false;
35577 }
35578 }
35579
35580 /**
35581 * Adds a listener function to the specified event.
35582 * The listener will not be added if it is a duplicate.
35583 * If the listener returns true then it will be removed after it is called.
35584 * If you pass a regular expression as the event name then the listener will be added to all events that match it.
35585 *
35586 * @param {String|RegExp} evt Name of the event to attach the listener to.
35587 * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.
35588 * @return {Object} Current instance of EventEmitter for chaining.
35589 */
35590 proto.addListener = function addListener(evt, listener) {
35591 if (!isValidListener(listener)) {
35592 throw new TypeError('listener must be a function');
35593 }
35594
35595 var listeners = this.getListenersAsObject(evt);
35596 var listenerIsWrapped = (typeof listener === 'undefined' ? 'undefined' : _typeof(listener)) === 'object';
35597 var key;
35598
35599 for (key in listeners) {
35600 if (listeners.hasOwnProperty(key) && indexOfListener(listeners[key], listener) === -1) {
35601 listeners[key].push(listenerIsWrapped ? listener : {
35602 listener: listener,
35603 once: false
35604 });
35605 }
35606 }
35607
35608 return this;
35609 };
35610
35611 /**
35612 * Alias of addListener
35613 */
35614 proto.on = alias('addListener');
35615
35616 /**
35617 * Semi-alias of addListener. It will add a listener that will be
35618 * automatically removed after its first execution.
35619 *
35620 * @param {String|RegExp} evt Name of the event to attach the listener to.
35621 * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.
35622 * @return {Object} Current instance of EventEmitter for chaining.
35623 */
35624 proto.addOnceListener = function addOnceListener(evt, listener) {
35625 return this.addListener(evt, {
35626 listener: listener,
35627 once: true
35628 });
35629 };
35630
35631 /**
35632 * Alias of addOnceListener.
35633 */
35634 proto.once = alias('addOnceListener');
35635
35636 /**
35637 * Defines an event name. This is required if you want to use a regex to add a listener to multiple events at once. If you don't do this then how do you expect it to know what event to add to? Should it just add to every possible match for a regex? No. That is scary and bad.
35638 * You need to tell it what event names should be matched by a regex.
35639 *
35640 * @param {String} evt Name of the event to create.
35641 * @return {Object} Current instance of EventEmitter for chaining.
35642 */
35643 proto.defineEvent = function defineEvent(evt) {
35644 this.getListeners(evt);
35645 return this;
35646 };
35647
35648 /**
35649 * Uses defineEvent to define multiple events.
35650 *
35651 * @param {String[]} evts An array of event names to define.
35652 * @return {Object} Current instance of EventEmitter for chaining.
35653 */
35654 proto.defineEvents = function defineEvents(evts) {
35655 for (var i = 0; i < evts.length; i += 1) {
35656 this.defineEvent(evts[i]);
35657 }
35658 return this;
35659 };
35660
35661 /**
35662 * Removes a listener function from the specified event.
35663 * When passed a regular expression as the event name, it will remove the listener from all events that match it.
35664 *
35665 * @param {String|RegExp} evt Name of the event to remove the listener from.
35666 * @param {Function} listener Method to remove from the event.
35667 * @return {Object} Current instance of EventEmitter for chaining.
35668 */
35669 proto.removeListener = function removeListener(evt, listener) {
35670 var listeners = this.getListenersAsObject(evt);
35671 var index;
35672 var key;
35673
35674 for (key in listeners) {
35675 if (listeners.hasOwnProperty(key)) {
35676 index = indexOfListener(listeners[key], listener);
35677
35678 if (index !== -1) {
35679 listeners[key].splice(index, 1);
35680 }
35681 }
35682 }
35683
35684 return this;
35685 };
35686
35687 /**
35688 * Alias of removeListener
35689 */
35690 proto.off = alias('removeListener');
35691
35692 /**
35693 * Adds listeners in bulk using the manipulateListeners method.
35694 * If you pass an object as the first argument you can add to multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. You can also pass it an event name and an array of listeners to be added.
35695 * You can also pass it a regular expression to add the array of listeners to all events that match it.
35696 * Yeah, this function does quite a bit. That's probably a bad thing.
35697 *
35698 * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add to multiple events at once.
35699 * @param {Function[]} [listeners] An optional array of listener functions to add.
35700 * @return {Object} Current instance of EventEmitter for chaining.
35701 */
35702 proto.addListeners = function addListeners(evt, listeners) {
35703 // Pass through to manipulateListeners
35704 return this.manipulateListeners(false, evt, listeners);
35705 };
35706
35707 /**
35708 * Removes listeners in bulk using the manipulateListeners method.
35709 * If you pass an object as the first argument you can remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.
35710 * You can also pass it an event name and an array of listeners to be removed.
35711 * You can also pass it a regular expression to remove the listeners from all events that match it.
35712 *
35713 * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to remove from multiple events at once.
35714 * @param {Function[]} [listeners] An optional array of listener functions to remove.
35715 * @return {Object} Current instance of EventEmitter for chaining.
35716 */
35717 proto.removeListeners = function removeListeners(evt, listeners) {
35718 // Pass through to manipulateListeners
35719 return this.manipulateListeners(true, evt, listeners);
35720 };
35721
35722 /**
35723 * Edits listeners in bulk. The addListeners and removeListeners methods both use this to do their job. You should really use those instead, this is a little lower level.
35724 * The first argument will determine if the listeners are removed (true) or added (false).
35725 * If you pass an object as the second argument you can add/remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.
35726 * You can also pass it an event name and an array of listeners to be added/removed.
35727 * You can also pass it a regular expression to manipulate the listeners of all events that match it.
35728 *
35729 * @param {Boolean} remove True if you want to remove listeners, false if you want to add.
35730 * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add/remove from multiple events at once.
35731 * @param {Function[]} [listeners] An optional array of listener functions to add/remove.
35732 * @return {Object} Current instance of EventEmitter for chaining.
35733 */
35734 proto.manipulateListeners = function manipulateListeners(remove, evt, listeners) {
35735 var i;
35736 var value;
35737 var single = remove ? this.removeListener : this.addListener;
35738 var multiple = remove ? this.removeListeners : this.addListeners;
35739
35740 // If evt is an object then pass each of its properties to this method
35741 if ((typeof evt === 'undefined' ? 'undefined' : _typeof(evt)) === 'object' && !(evt instanceof RegExp)) {
35742 for (i in evt) {
35743 if (evt.hasOwnProperty(i) && (value = evt[i])) {
35744 // Pass the single listener straight through to the singular method
35745 if (typeof value === 'function') {
35746 single.call(this, i, value);
35747 } else {
35748 // Otherwise pass back to the multiple function
35749 multiple.call(this, i, value);
35750 }
35751 }
35752 }
35753 } else {
35754 // So evt must be a string
35755 // And listeners must be an array of listeners
35756 // Loop over it and pass each one to the multiple method
35757 i = listeners.length;
35758 while (i--) {
35759 single.call(this, evt, listeners[i]);
35760 }
35761 }
35762
35763 return this;
35764 };
35765
35766 /**
35767 * Removes all listeners from a specified event.
35768 * If you do not specify an event then all listeners will be removed.
35769 * That means every event will be emptied.
35770 * You can also pass a regex to remove all events that match it.
35771 *
35772 * @param {String|RegExp} [evt] Optional name of the event to remove all listeners for. Will remove from every event if not passed.
35773 * @return {Object} Current instance of EventEmitter for chaining.
35774 */
35775 proto.removeEvent = function removeEvent(evt) {
35776 var type = typeof evt === 'undefined' ? 'undefined' : _typeof(evt);
35777 var events = this._getEvents();
35778 var key;
35779
35780 // Remove different things depending on the state of evt
35781 if (type === 'string') {
35782 // Remove all listeners for the specified event
35783 delete events[evt];
35784 } else if (evt instanceof RegExp) {
35785 // Remove all events matching the regex.
35786 for (key in events) {
35787 if (events.hasOwnProperty(key) && evt.test(key)) {
35788 delete events[key];
35789 }
35790 }
35791 } else {
35792 // Remove all listeners in all events
35793 delete this._events;
35794 }
35795
35796 return this;
35797 };
35798
35799 /**
35800 * Alias of removeEvent.
35801 *
35802 * Added to mirror the node API.
35803 */
35804 proto.removeAllListeners = alias('removeEvent');
35805
35806 /**
35807 * Emits an event of your choice.
35808 * When emitted, every listener attached to that event will be executed.
35809 * If you pass the optional argument array then those arguments will be passed to every listener upon execution.
35810 * Because it uses `apply`, your array of arguments will be passed as if you wrote them out separately.
35811 * So they will not arrive within the array on the other side, they will be separate.
35812 * You can also pass a regular expression to emit to all events that match it.
35813 *
35814 * @param {String|RegExp} evt Name of the event to emit and execute listeners for.
35815 * @param {Array} [args] Optional array of arguments to be passed to each listener.
35816 * @return {Object} Current instance of EventEmitter for chaining.
35817 */
35818 proto.emitEvent = function emitEvent(evt, args) {
35819 var listenersMap = this.getListenersAsObject(evt);
35820 var listeners;
35821 var listener;
35822 var i;
35823 var key;
35824 var response;
35825
35826 for (key in listenersMap) {
35827 if (listenersMap.hasOwnProperty(key)) {
35828 listeners = listenersMap[key].slice(0);
35829
35830 for (i = 0; i < listeners.length; i++) {
35831 // If the listener returns true then it shall be removed from the event
35832 // The function is executed either with a basic call or an apply if there is an args array
35833 listener = listeners[i];
35834
35835 if (listener.once === true) {
35836 this.removeListener(evt, listener.listener);
35837 }
35838
35839 response = listener.listener.apply(this, args || []);
35840
35841 if (response === this._getOnceReturnValue()) {
35842 this.removeListener(evt, listener.listener);
35843 }
35844 }
35845 }
35846 }
35847
35848 return this;
35849 };
35850
35851 /**
35852 * Alias of emitEvent
35853 */
35854 proto.trigger = alias('emitEvent');
35855
35856 /**
35857 * Subtly different from emitEvent in that it will pass its arguments on to the listeners, as opposed to taking a single array of arguments to pass on.
35858 * As with emitEvent, you can pass a regex in place of the event name to emit to all events that match it.
35859 *
35860 * @param {String|RegExp} evt Name of the event to emit and execute listeners for.
35861 * @param {...*} Optional additional arguments to be passed to each listener.
35862 * @return {Object} Current instance of EventEmitter for chaining.
35863 */
35864 proto.emit = function emit(evt) {
35865 var args = Array.prototype.slice.call(arguments, 1);
35866 return this.emitEvent(evt, args);
35867 };
35868
35869 /**
35870 * Sets the current value to check against when executing listeners. If a
35871 * listeners return value matches the one set here then it will be removed
35872 * after execution. This value defaults to true.
35873 *
35874 * @param {*} value The new value to check for when executing listeners.
35875 * @return {Object} Current instance of EventEmitter for chaining.
35876 */
35877 proto.setOnceReturnValue = function setOnceReturnValue(value) {
35878 this._onceReturnValue = value;
35879 return this;
35880 };
35881
35882 /**
35883 * Fetches the current value to check against when executing listeners. If
35884 * the listeners return value matches this one then it should be removed
35885 * automatically. It will return true by default.
35886 *
35887 * @return {*|Boolean} The current value to check for or the default, true.
35888 * @api private
35889 */
35890 proto._getOnceReturnValue = function _getOnceReturnValue() {
35891 if (this.hasOwnProperty('_onceReturnValue')) {
35892 return this._onceReturnValue;
35893 } else {
35894 return true;
35895 }
35896 };
35897
35898 /**
35899 * Fetches the events object and creates one if required.
35900 *
35901 * @return {Object} The events storage object.
35902 * @api private
35903 */
35904 proto._getEvents = function _getEvents() {
35905 return this._events || (this._events = {});
35906 };
35907
35908 /**
35909 * Reverts the global {@link EventEmitter} to its previous value and returns a reference to this version.
35910 *
35911 * @return {Function} Non conflicting EventEmitter class.
35912 */
35913 EventEmitter.noConflict = function noConflict() {
35914 exports.EventEmitter = originalGlobalValue;
35915 return EventEmitter;
35916 };
35917
35918 // Expose the class either via AMD, CommonJS or the global object
35919 if (true) {
35920 !(__WEBPACK_AMD_DEFINE_RESULT__ = (function () {
35921 return EventEmitter;
35922 }).call(exports, __webpack_require__, exports, module),
35923 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
35924 } else if ((typeof module === 'undefined' ? 'undefined' : _typeof(module)) === 'object' && module.exports) {
35925 module.exports = EventEmitter;
35926 } else {
35927 exports.EventEmitter = EventEmitter;
35928 }
35929})(this || {});
35930
35931/***/ }),
35932/* 285 */
35933/***/ (function(module, exports, __webpack_require__) {
35934
35935
35936var Geom = __webpack_require__(9);
35937Geom.Point = __webpack_require__(313);
35938Geom.PointJitter = Geom.Point.Jitter;
35939Geom.Path = __webpack_require__(112);
35940Geom.Line = __webpack_require__(314);
35941Geom.LineStack = Geom.Line.Stack;
35942Geom.Interval = __webpack_require__(315);
35943Geom.IntervalStack = Geom.Interval.Stack;
35944Geom.IntervalDodge = Geom.Interval.Dodge;
35945Geom.IntervalSymmetric = Geom.Interval.Symmetric;
35946
35947Geom.Area = __webpack_require__(316);
35948Geom.AreaStack = Geom.Area.Stack;
35949Geom.Polygon = __webpack_require__(317);
35950Geom.Schema = __webpack_require__(318);
35951Geom.SchemaDodge = Geom.Schema.Dodge;
35952Geom.Edge = __webpack_require__(319);
35953Geom.Heatmap = __webpack_require__(320);
35954
35955module.exports = Geom;
35956
35957/***/ }),
35958/* 286 */
35959/***/ (function(module, exports, __webpack_require__) {
35960
35961
35962var Base = __webpack_require__(16);
35963Base.Color = __webpack_require__(287);
35964Base.Size = __webpack_require__(288);
35965Base.Opacity = __webpack_require__(289);
35966Base.Shape = __webpack_require__(290);
35967Base.Position = __webpack_require__(291);
35968module.exports = Base;
35969
35970/***/ }),
35971/* 287 */
35972/***/ (function(module, exports, __webpack_require__) {
35973
35974function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
35975
35976function _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; }
35977
35978function _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; }
35979
35980/**
35981 * @fileOverview the color attribute of core
35982 * @author huangtonger@aliyun.com
35983 */
35984
35985var ColorUtil = __webpack_require__(64);
35986var Base = __webpack_require__(16);
35987var Util = __webpack_require__(0);
35988
35989/**
35990 * 视觉通道 color
35991 * @class Attr.Color
35992 */
35993
35994var Color = function (_Base) {
35995 _inherits(Color, _Base);
35996
35997 function Color(cfg) {
35998 _classCallCheck(this, Color);
35999
36000 var _this = _possibleConstructorReturn(this, _Base.call(this, cfg));
36001
36002 _this.names = ['color'];
36003 _this.type = 'color';
36004 _this.gradient = null;
36005 if (Util.isString(_this.values)) {
36006 _this.linear = true;
36007 }
36008 return _this;
36009 }
36010
36011 /**
36012 * @override
36013 */
36014
36015
36016 Color.prototype.getLinearValue = function getLinearValue(percent) {
36017 var gradient = this.gradient;
36018 if (!gradient) {
36019 var values = this.values;
36020 gradient = ColorUtil.gradient(values);
36021 this.gradient = gradient;
36022 }
36023 return gradient(percent);
36024 };
36025
36026 return Color;
36027}(Base);
36028
36029module.exports = Color;
36030
36031/***/ }),
36032/* 288 */
36033/***/ (function(module, exports, __webpack_require__) {
36034
36035function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
36036
36037function _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; }
36038
36039function _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; }
36040
36041/**
36042 * @fileOverview the size attribute of core
36043 * @author huangtonger@aliyun.com
36044 */
36045
36046var Base = __webpack_require__(16);
36047
36048/**
36049 * 视觉通道 size
36050 * @class Attr.Size
36051 */
36052
36053var Size = function (_Base) {
36054 _inherits(Size, _Base);
36055
36056 function Size(cfg) {
36057 _classCallCheck(this, Size);
36058
36059 var _this = _possibleConstructorReturn(this, _Base.call(this, cfg));
36060
36061 _this.names = ['size'];
36062 _this.type = 'size';
36063 _this.gradient = null;
36064 return _this;
36065 }
36066
36067 return Size;
36068}(Base);
36069
36070module.exports = Size;
36071
36072/***/ }),
36073/* 289 */
36074/***/ (function(module, exports, __webpack_require__) {
36075
36076function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
36077
36078function _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; }
36079
36080function _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; }
36081
36082/**
36083 * @fileOverview the opacity attribute of core
36084 * @author huangtonger@aliyun.com
36085 */
36086
36087var Base = __webpack_require__(16);
36088
36089/**
36090 * 视觉通道 Opacity
36091 * @class Attr.Opacity
36092 */
36093
36094var Opacity = function (_Base) {
36095 _inherits(Opacity, _Base);
36096
36097 function Opacity(cfg) {
36098 _classCallCheck(this, Opacity);
36099
36100 var _this = _possibleConstructorReturn(this, _Base.call(this, cfg));
36101
36102 _this.names = ['opacity'];
36103 _this.type = 'opacity';
36104 _this.gradient = null;
36105 return _this;
36106 }
36107
36108 return Opacity;
36109}(Base);
36110
36111module.exports = Opacity;
36112
36113/***/ }),
36114/* 290 */
36115/***/ (function(module, exports, __webpack_require__) {
36116
36117function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
36118
36119function _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; }
36120
36121function _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; }
36122
36123/**
36124 * @fileOverview the shape attribute of core
36125 * @author huangtonger@aliyun.com
36126 */
36127
36128var Base = __webpack_require__(16);
36129
36130/**
36131 * 视觉通道 Shape
36132 * @class Attr.Shape
36133 */
36134
36135var Shape = function (_Base) {
36136 _inherits(Shape, _Base);
36137
36138 function Shape(cfg) {
36139 _classCallCheck(this, Shape);
36140
36141 var _this = _possibleConstructorReturn(this, _Base.call(this, cfg));
36142
36143 _this.names = ['shape'];
36144 _this.type = 'shape';
36145 _this.gradient = null;
36146 return _this;
36147 }
36148
36149 /**
36150 * @override
36151 */
36152
36153
36154 Shape.prototype.getLinearValue = function getLinearValue(percent) {
36155 var values = this.values;
36156 var index = Math.round((values.length - 1) * percent);
36157 return values[index];
36158 };
36159
36160 return Shape;
36161}(Base);
36162
36163module.exports = Shape;
36164
36165/***/ }),
36166/* 291 */
36167/***/ (function(module, exports, __webpack_require__) {
36168
36169function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
36170
36171function _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; }
36172
36173function _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; }
36174
36175/**
36176 * @fileOverview the position attribute of core
36177 * @author huangtonger@aliyun.com
36178 */
36179
36180var Util = __webpack_require__(0);
36181var Base = __webpack_require__(16);
36182
36183var Position = function (_Base) {
36184 _inherits(Position, _Base);
36185
36186 function Position(cfg) {
36187 _classCallCheck(this, Position);
36188
36189 var _this = _possibleConstructorReturn(this, _Base.call(this, cfg));
36190
36191 _this.names = ['x', 'y'];
36192 _this.type = 'position';
36193 return _this;
36194 }
36195
36196 Position.prototype.mapping = function mapping(x, y) {
36197 var scales = this.scales;
36198 var coord = this.coord;
36199 var scaleX = scales[0];
36200 var scaleY = scales[1];
36201 var rstX = void 0;
36202 var rstY = void 0;
36203 var obj = void 0;
36204 if (Util.isNil(x) || Util.isNil(y)) {
36205 return [];
36206 }
36207 if (Util.isArray(y) && Util.isArray(x)) {
36208 rstX = [];
36209 rstY = [];
36210 for (var i = 0, j = 0; i < x.length && j < y.length; i++, j++) {
36211 obj = coord.convertPoint({
36212 x: scaleX.scale(x[i]),
36213 y: scaleY.scale(y[j])
36214 });
36215 rstX.push(obj.x);
36216 rstY.push(obj.y);
36217 }
36218 } else if (Util.isArray(y)) {
36219 x = scaleX.scale(x);
36220 rstY = [];
36221 Util.each(y, function (yVal) {
36222 yVal = scaleY.scale(yVal);
36223 obj = coord.convertPoint({
36224 x: x,
36225 y: yVal
36226 });
36227 if (rstX && rstX !== obj.x) {
36228 if (!Util.isArray(rstX)) {
36229 rstX = [rstX];
36230 }
36231 rstX.push(obj.x);
36232 } else {
36233 rstX = obj.x;
36234 }
36235 rstY.push(obj.y);
36236 });
36237 } else if (Util.isArray(x)) {
36238 y = scaleY.scale(y);
36239 rstX = [];
36240 Util.each(x, function (xVal) {
36241 xVal = scaleX.scale(xVal);
36242 obj = coord.convertPoint({
36243 x: xVal,
36244 y: y
36245 });
36246 if (rstY && rstY !== obj.y) {
36247 if (!Util.isArray(rstY)) {
36248 rstY = [rstY];
36249 }
36250 rstY.push(obj.y);
36251 } else {
36252 rstY = obj.y;
36253 }
36254 rstX.push(obj.x);
36255 });
36256 } else {
36257 x = scaleX.scale(x);
36258 y = scaleY.scale(y);
36259 var point = coord.convertPoint({
36260 x: x,
36261 y: y
36262 });
36263 rstX = point.x;
36264 rstY = point.y;
36265 }
36266 return [rstX, rstY];
36267 };
36268
36269 return Position;
36270}(Base);
36271
36272module.exports = Position;
36273
36274/***/ }),
36275/* 292 */
36276/***/ (function(module, exports, __webpack_require__) {
36277
36278/**
36279 * @fileOverview Theme entry
36280 * @author sima.zhang
36281 */
36282var Theme = {
36283 default: __webpack_require__(108),
36284 dark: __webpack_require__(293)
36285};
36286
36287module.exports = Theme;
36288
36289/***/ }),
36290/* 293 */
36291/***/ (function(module, exports, __webpack_require__) {
36292
36293var _html, _tooltip;
36294
36295/**
36296 * @fileOverview G2 3.0 dark theme
36297 * @author sima.zhang
36298 */
36299var Util = __webpack_require__(0);
36300var BasicTheme = __webpack_require__(108);
36301
36302// tooltip 相关 dom 的 css 类名
36303var TOOLTIP_CONTAINER_CLASS = 'g2-tooltip';
36304var LEGEND_CONTAINER_CLASS = 'g2-legend';
36305
36306var DarkTheme = Util.deepMix({}, BasicTheme, {
36307 background: {
36308 fill: '#1F1F1F',
36309 radius: 2
36310 }, // 容器区域
36311 plotBackground: {
36312 fill: '#1F1F1F'
36313 }, // 绘图区域
36314 axis: {
36315 top: {
36316 label: {
36317 textStyle: {
36318 fill: '#A6A6A6'
36319 }
36320 },
36321 line: {
36322 stroke: '#737373'
36323 },
36324 tickLine: {
36325 stroke: '#737373'
36326 }
36327 },
36328 bottom: {
36329 label: {
36330 textStyle: {
36331 fill: '#A6A6A6'
36332 }
36333 },
36334 line: {
36335 stroke: '#737373'
36336 },
36337 tickLine: {
36338 stroke: '#737373'
36339 }
36340 },
36341 left: {
36342 label: {
36343 textStyle: {
36344 fill: '#A6A6A6'
36345 }
36346 },
36347 grid: {
36348 lineStyle: {
36349 stroke: '#404040'
36350 }
36351 }
36352 },
36353 right: {
36354 label: {
36355 textStyle: {
36356 fill: '#A6A6A6'
36357 }
36358 },
36359 grid: {
36360 lineStyle: {
36361 stroke: '#404040'
36362 }
36363 }
36364 },
36365 circle: {
36366 label: {
36367 textStyle: {
36368 fill: '#A6A6A6'
36369 }
36370 },
36371 line: {
36372 stroke: '#737373'
36373 },
36374 tickLine: {
36375 stroke: '#737373'
36376 },
36377 grid: {
36378 lineStyle: {
36379 stroke: '#404040'
36380 }
36381 }
36382 },
36383 radius: {
36384 label: {
36385 textStyle: {
36386 fill: '#A6A6A6'
36387 }
36388 },
36389 line: {
36390 stroke: '#737373'
36391 },
36392 tickLine: {
36393 stroke: '#737373'
36394 },
36395 grid: {
36396 lineStyle: {
36397 stroke: '#404040'
36398 }
36399 }
36400 },
36401 helix: {
36402 line: {
36403 stroke: '#737373'
36404 },
36405 tickLine: {
36406 stroke: '#737373'
36407 }
36408 }
36409 },
36410 label: {
36411 textStyle: {
36412 fill: '#A6A6A6'
36413 }
36414 },
36415 legend: {
36416 right: {
36417 textStyle: {
36418 fill: '#737373'
36419 },
36420 unCheckColor: '#bfbfbf'
36421 },
36422 left: {
36423 textStyle: {
36424 fill: '#737373'
36425 }, // 图例项文本的样式
36426 unCheckColor: '#bfbfbf'
36427 },
36428 top: {
36429 textStyle: {
36430 fill: '#737373'
36431 }, // 图例项文本的样式
36432 unCheckColor: '#bfbfbf'
36433 },
36434 bottom: {
36435 textStyle: {
36436 fill: '#737373'
36437 }, // 图例项文本的样式
36438 unCheckColor: '#bfbfbf'
36439 },
36440 html: (_html = {}, _html['' + LEGEND_CONTAINER_CLASS] = {
36441 color: '#D9D9D9'
36442 }, _html),
36443 gradient: {
36444 textStyle: {
36445 fill: '#D9D9D9'
36446 },
36447 lineStyle: {
36448 stroke: '#404040'
36449 }
36450 }
36451 },
36452 tooltip: (_tooltip = {}, _tooltip['' + TOOLTIP_CONTAINER_CLASS] = {
36453 color: '#D9D9D9'
36454 }, _tooltip),
36455 tooltipCrosshairsRect: {
36456 type: 'rect',
36457 style: {
36458 fill: '#fff',
36459 opacity: 0.1
36460 }
36461 }, // tooltip 辅助背景框样式
36462 tooltipCrosshairsLine: {
36463 style: {
36464 stroke: 'rgba(255, 255, 255, 0.45)'
36465 }
36466 },
36467 guide: {
36468 line: {
36469 text: {
36470 style: {
36471 fill: '#A6A6A6'
36472 }
36473 }
36474 },
36475 text: {
36476 style: {
36477 fill: '#A6A6A6'
36478 }
36479 },
36480 region: {
36481 // TODO
36482 style: {
36483 lineWidth: 0, // 辅助框的边框宽度
36484 fill: '#000', // 辅助框填充的颜色
36485 fillOpacity: 0.04 // 辅助框的背景透明度
36486 // 辅助框的图形样式属性
36487 } }
36488 }
36489});
36490
36491module.exports = DarkTheme;
36492
36493/***/ }),
36494/* 294 */
36495/***/ (function(module, exports, __webpack_require__) {
36496
36497
36498var Adjust = __webpack_require__(24);
36499Adjust.Stack = __webpack_require__(295);
36500Adjust.Jitter = __webpack_require__(296);
36501Adjust.Symmetric = __webpack_require__(297);
36502Adjust.Dodge = __webpack_require__(298);
36503
36504module.exports = Adjust;
36505
36506/***/ }),
36507/* 295 */
36508/***/ (function(module, exports, __webpack_require__) {
36509
36510function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
36511
36512function _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; }
36513
36514function _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; }
36515
36516/**
36517 * @fileOverview The extension function of stack ,which mixin to geom
36518 * @author dxq613@gmail.com
36519 */
36520
36521var Util = __webpack_require__(0);
36522var Adjust = __webpack_require__(24);
36523
36524/**
36525 * 数据调整的基类
36526 * @class Adjust.Stack
36527 */
36528
36529var Stack = function (_Adjust) {
36530 _inherits(Stack, _Adjust);
36531
36532 function Stack() {
36533 _classCallCheck(this, Stack);
36534
36535 return _possibleConstructorReturn(this, _Adjust.apply(this, arguments));
36536 }
36537
36538 /**
36539 * @override
36540 */
36541 Stack.prototype.getDefaultCfg = function getDefaultCfg() {
36542 var cfg = _Adjust.prototype.getDefaultCfg.call(this);
36543 return Util.assign(cfg, {
36544 /**
36545 * 仅有一个维度调整时,总的高度
36546 * @type {Number}
36547 */
36548 height: null,
36549 /**
36550 * 单个点的大小
36551 * @type {Number}
36552 */
36553 size: 10,
36554 /**
36555 * 是否反序进行层叠
36556 * @type {Boolean}
36557 */
36558 reverseOrder: false,
36559
36560 /**
36561 * @override
36562 */
36563 adjustNames: ['y'] // Only support stack y
36564 });
36565 };
36566
36567 Stack.prototype.processOneDimStack = function processOneDimStack(dataArray) {
36568 var self = this;
36569 var xField = self.xField;
36570 var yField = self.yField || 'y';
36571 var height = self.height;
36572
36573 var stackY = {};
36574 // 如果层叠的顺序翻转
36575 if (self.reverseOrder) {
36576 dataArray = dataArray.slice(0).reverse();
36577 }
36578 for (var i = 0; i < dataArray.length; i++) {
36579 // var preY = stackHeight;
36580 var data = dataArray[i];
36581 // cates
36582 for (var j = 0; j < data.length; j++) {
36583 var item = data[j];
36584 var size = item.size || self.size;
36585 var stackHeight = size * 2 / height;
36586 var x = item[xField];
36587 if (!stackY[x]) {
36588 stackY[x] = stackHeight / 2;
36589 }
36590 item[yField] = stackY[x];
36591 stackY[x] += stackHeight;
36592 }
36593 }
36594 };
36595
36596 Stack.prototype.processAdjust = function processAdjust(dataArray) {
36597 var self = this;
36598 if (self.yField) {
36599 self.processStack(dataArray);
36600 } else {
36601 self.processOneDimStack(dataArray);
36602 }
36603 };
36604
36605 Stack.prototype.processStack = function processStack(dataArray) {
36606 var self = this;
36607 var xField = self.xField;
36608 var yField = self.yField;
36609 var count = dataArray.length;
36610 var stackCache = {
36611 positive: {},
36612 negative: {}
36613 };
36614 // 层叠顺序翻转
36615 if (self.reverseOrder) {
36616 dataArray = dataArray.slice(0).reverse();
36617 }
36618 for (var i = 0; i < count; i++) {
36619 var data = dataArray[i];
36620 for (var j = 0; j < data.length; j++) {
36621 var item = data[j];
36622 var x = item[xField] || 0;
36623 var y = item[yField] || 0;
36624 var xkey = x.toString();
36625 y = Util.isArray(y) ? y[1] : y;
36626 var direction = y >= 0 ? 'positive' : 'negative';
36627 if (!stackCache[direction][xkey]) {
36628 stackCache[direction][xkey] = 0;
36629 }
36630 item[yField] = [stackCache[direction][xkey], y + stackCache[direction][xkey]];
36631 stackCache[direction][xkey] += y;
36632 }
36633 }
36634 };
36635
36636 return Stack;
36637}(Adjust);
36638
36639module.exports = Stack;
36640
36641/***/ }),
36642/* 296 */
36643/***/ (function(module, exports, __webpack_require__) {
36644
36645function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
36646
36647function _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; }
36648
36649function _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; }
36650
36651/**
36652 * @fileOverview Repositions graphic elements randomly using a normal or uniform distribution
36653 * @author dxq613@gmail.com
36654 * reference: http://www-01.ibm.com/support/knowledgecenter/SSLVMB_21.0.0/com.ibm.spss.statistics.help/gpl_statement_element_jitter.htm
36655 */
36656
36657var Util = __webpack_require__(0);
36658var Adjust = __webpack_require__(24);
36659
36660/**
36661 * 数据调整的基类
36662 * @class Adjust.Jitter
36663 */
36664
36665var Jitter = function (_Adjust) {
36666 _inherits(Jitter, _Adjust);
36667
36668 function Jitter() {
36669 _classCallCheck(this, Jitter);
36670
36671 return _possibleConstructorReturn(this, _Adjust.apply(this, arguments));
36672 }
36673
36674 Jitter.prototype.getAdjustOffset = function getAdjustOffset(pre, next) {
36675 var r = Math.random(); // 随机位置,均匀分布
36676 var avg = next - pre; // * length
36677 var append = avg * 0.05;
36678 return pre + append + avg * 0.9 * r;
36679 };
36680
36681 // adjust group data
36682
36683
36684 Jitter.prototype._adjustGroup = function _adjustGroup(group, dim, key, values) {
36685 var self = this;
36686 var range = self.getAdjustRange(dim, key, values);
36687
36688 Util.each(group, function (record) {
36689 record[dim] = self.getAdjustOffset(range.pre, range.next); // 获取调整的位置
36690 });
36691 };
36692
36693 Jitter.prototype.adjustDim = function adjustDim(dim, values, data) {
36694 var self = this;
36695 var groupData = self.groupData(data, dim);
36696 Util.each(groupData, function (group, key) {
36697 key = parseFloat(key);
36698 self._adjustGroup(group, dim, key, values);
36699 });
36700 };
36701
36702 return Jitter;
36703}(Adjust);
36704
36705module.exports = Jitter;
36706
36707/***/ }),
36708/* 297 */
36709/***/ (function(module, exports, __webpack_require__) {
36710
36711function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
36712
36713function _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; }
36714
36715function _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; }
36716
36717/**
36718 * @fileOverview The extension function of symmetric ,which mixin to geom
36719 * @author huangtonger@aliyun.com
36720 */
36721
36722var Util = __webpack_require__(0);
36723var Adjust = __webpack_require__(24);
36724
36725/**
36726 * 数据调整的基类
36727 * @class Adjust.Symmetric
36728 */
36729
36730var Symmetric = function (_Adjust) {
36731 _inherits(Symmetric, _Adjust);
36732
36733 function Symmetric() {
36734 _classCallCheck(this, Symmetric);
36735
36736 return _possibleConstructorReturn(this, _Adjust.apply(this, arguments));
36737 }
36738
36739 /**
36740 * @override
36741 */
36742 Symmetric.prototype.getDefaultCfg = function getDefaultCfg() {
36743 var cfg = _Adjust.prototype.getDefaultCfg.call(this);
36744 return Util.assign(cfg, {
36745 // 缓存的最大值
36746 cacheMax: null,
36747 /**
36748 * @override
36749 */
36750 adjustNames: ['y'] // Only support stack y
36751 });
36752 };
36753 // 获取最大的y值
36754
36755
36756 Symmetric.prototype._getMax = function _getMax(dim) {
36757 var self = this;
36758 var mergeData = self.mergeData;
36759 var maxRecord = Util.maxBy(mergeData, function (obj) {
36760 var value = obj[dim];
36761 if (Util.isArray(value)) {
36762 return Math.max.apply(null, value);
36763 }
36764 return value;
36765 });
36766 var maxValue = maxRecord[dim];
36767 var max = Util.isArray(maxValue) ? Math.max.apply(null, maxValue) : maxValue;
36768 return max;
36769 };
36770
36771 // 获取每个字段最大的值
36772
36773
36774 Symmetric.prototype._getXValuesMax = function _getXValuesMax() {
36775 var self = this;
36776 var yField = self.yField;
36777 var xField = self.xField;
36778 var cache = {};
36779 var mergeData = self.mergeData;
36780 Util.each(mergeData, function (obj) {
36781 var xValue = obj[xField];
36782 var yValue = obj[yField];
36783 var max = Util.isArray(yValue) ? Math.max.apply(null, yValue) : yValue;
36784 cache[xValue] = cache[xValue] || 0;
36785 if (cache[xValue] < max) {
36786 cache[xValue] = max;
36787 }
36788 });
36789 return cache;
36790 };
36791
36792 // 入口函数
36793
36794
36795 Symmetric.prototype.processAdjust = function processAdjust(dataArray) {
36796 var self = this;
36797 var mergeData = Util.Array.merge(dataArray);
36798 self.mergeData = mergeData;
36799 self._processSymmetric(dataArray);
36800 self.mergeData = null;
36801 };
36802
36803 // 处理对称
36804
36805
36806 Symmetric.prototype._processSymmetric = function _processSymmetric(dataArray) {
36807 var self = this;
36808 var xField = self.xField;
36809 var yField = self.yField;
36810 var max = self._getMax(yField);
36811 var first = dataArray[0][0];
36812
36813 var cache = void 0;
36814 if (first && Util.isArray(first[yField])) {
36815 cache = self._getXValuesMax();
36816 }
36817 Util.each(dataArray, function (data) {
36818 Util.each(data, function (obj) {
36819 var value = obj[yField];
36820 var offset = void 0;
36821 if (Util.isArray(value)) {
36822 var xValue = obj[xField];
36823 var valueMax = cache[xValue];
36824 offset = (max - valueMax) / 2;
36825 var tmp = [];
36826 /* eslint-disable no-loop-func */
36827 Util.each(value, function (subVal) {
36828 // 多个字段
36829 tmp.push(offset + subVal);
36830 });
36831 /* eslint-enable no-loop-func */
36832 obj[yField] = tmp;
36833 } else {
36834 offset = (max - value) / 2;
36835 obj[yField] = [offset, value + offset];
36836 }
36837 });
36838 });
36839 };
36840
36841 return Symmetric;
36842}(Adjust);
36843
36844module.exports = Symmetric;
36845
36846/***/ }),
36847/* 298 */
36848/***/ (function(module, exports, __webpack_require__) {
36849
36850function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
36851
36852function _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; }
36853
36854function _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; }
36855
36856/**
36857 * @fileOverview Moves graphic elements next to other graphic elements that appear at the same value, rather than superimposing them.
36858 * @fileOverview dxq613@gmail.com
36859 */
36860
36861var Util = __webpack_require__(0);
36862var Adjust = __webpack_require__(24);
36863var Global = __webpack_require__(1);
36864/**
36865 * 数据调整的基类
36866 * @class Adjust.Dodge
36867 */
36868
36869var Dodge = function (_Adjust) {
36870 _inherits(Dodge, _Adjust);
36871
36872 function Dodge() {
36873 _classCallCheck(this, Dodge);
36874
36875 return _possibleConstructorReturn(this, _Adjust.apply(this, arguments));
36876 }
36877
36878 Dodge.prototype.getDefaultCfg = function getDefaultCfg() {
36879 var cfg = _Adjust.prototype.getDefaultCfg.call(this);
36880 return Util.assign(cfg, {
36881 /**
36882 * 调整过程中,2个数据的间距
36883 * @type {Number}
36884 */
36885 marginRatio: 1 / 2,
36886
36887 /**
36888 * 调整占单位宽度的比例,例如:占2个分类间距的 1/2
36889 * @type {Number}
36890 */
36891 dodgeRatio: Global.widthRatio.column,
36892
36893 dodgeBy: null
36894 });
36895 };
36896
36897 /**
36898 * @protected
36899 * @override
36900 */
36901
36902
36903 Dodge.prototype.processAdjust = function processAdjust(dataArray) {
36904 var self = this;
36905 var mergeData = Util.Array.merge(dataArray);
36906 var dodgeDim = self.dodgeBy;
36907 var adjDataArray = dataArray;
36908 if (dodgeDim) {
36909 // 如果指定了分组dim的字段
36910 adjDataArray = Util.Array.group(mergeData, dodgeDim);
36911 }
36912 self.cacheMap = {};
36913 self.adjDataArray = adjDataArray;
36914 self.mergeData = mergeData;
36915 self.adjustData(adjDataArray, mergeData);
36916
36917 self.adjDataArray = null;
36918 self.mergeData = null;
36919 };
36920
36921 Dodge.prototype.getDistribution = function getDistribution(dim) {
36922 var self = this;
36923 var dataArray = self.adjDataArray;
36924 var cacheMap = self.cacheMap;
36925 var map = cacheMap[dim];
36926 if (!map) {
36927 map = {};
36928 Util.each(dataArray, function (data, index) {
36929 var values = Util.Array.values(data, dim);
36930 if (!values.length) {
36931 values.push(0);
36932 }
36933 Util.each(values, function (val) {
36934 if (!map[val]) {
36935 map[val] = [];
36936 }
36937 map[val].push(index);
36938 });
36939 });
36940 cacheMap[dim] = map;
36941 }
36942
36943 return map;
36944 };
36945
36946 Dodge.prototype.adjustDim = function adjustDim(dim, values, data, frameCount, frameIndex) {
36947 var self = this;
36948 var map = self.getDistribution(dim);
36949 var groupData = self.groupData(data, dim); // 根据值分组
36950
36951 Util.each(groupData, function (group, key) {
36952 key = parseFloat(key);
36953 var range = void 0;
36954 if (values.length === 1) {
36955 range = {
36956 pre: values[0] - 1,
36957 next: values[0] + 1
36958 };
36959 } else {
36960 range = self.getAdjustRange(dim, key, values);
36961 }
36962 Util.each(group, function (record) {
36963 var value = record[dim];
36964 var valueArr = map[value];
36965 var valIndex = valueArr.indexOf(frameIndex);
36966 record[dim] = self.getDodgeOffset(range, valIndex, valueArr.length);
36967 });
36968 });
36969 };
36970
36971 Dodge.prototype.getDodgeOffset = function getDodgeOffset(range, index, count) {
36972 var self = this;
36973 var pre = range.pre;
36974 var next = range.next;
36975 var tickLength = next - pre;
36976 var dodgeRatio = self.dodgeRatio;
36977 var width = tickLength * dodgeRatio / count;
36978 var margin = self.marginRatio * width;
36979 var offset = 1 / 2 * (tickLength - count * width - (count - 1) * margin) + ((index + 1) * width + index * margin) - 1 / 2 * width - 1 / 2 * tickLength;
36980 return (pre + next) / 2 + offset;
36981 };
36982
36983 return Dodge;
36984}(Adjust);
36985
36986module.exports = Dodge;
36987
36988/***/ }),
36989/* 299 */
36990/***/ (function(module, exports, __webpack_require__) {
36991
36992var GeomLabels = __webpack_require__(109);
36993var PolarLabels = __webpack_require__(111);
36994var PieLabels = __webpack_require__(302);
36995
36996var Labels = {
36997 getLabelsClass: function getLabelsClass(coordType) {
36998 var rst = GeomLabels;
36999 if (coordType === 'polar') {
37000 rst = PolarLabels;
37001 } else if (coordType === 'theta') {
37002 // pie chart
37003 rst = PieLabels;
37004 }
37005 return rst;
37006 }
37007};
37008
37009module.exports = Labels;
37010
37011/***/ }),
37012/* 300 */
37013/***/ (function(module, exports, __webpack_require__) {
37014
37015/**
37016 * @fileOverview The class that performs label rendering
37017 * @author sima.zhang
37018 */
37019var Util = __webpack_require__(0);
37020var Labels = __webpack_require__(110);
37021
37022module.exports = {
37023 renderLabels: function renderLabels() {
37024 var labelCfg = this.get('label');
37025
37026 if (Util.isNil(labelCfg)) {
37027 return;
37028 }
37029
37030 if (Util.isNil(labelCfg.items)) {
37031 labelCfg.items = [];
37032 }
37033
37034 var labelsGroup = this.addGroup(Labels, labelCfg);
37035 this.set('labelsGroup', labelsGroup);
37036 },
37037 resetLabels: function resetLabels(items) {
37038 var self = this;
37039 var labelCfg = self.get('label');
37040
37041 if (!labelCfg) {
37042 return;
37043 }
37044
37045 var labelsGroup = self.get('labelsGroup');
37046 var children = labelsGroup.getLabels();
37047 var count = children.length;
37048 items = items || labelCfg.items;
37049 Util.each(items, function (item, index) {
37050 if (index < count) {
37051 var label = children[index];
37052 labelsGroup.changeLabel(label, item);
37053 } else {
37054 var labelShape = self.addLabel(item.text, item);
37055 if (labelShape) {
37056 labelShape._id = item._id;
37057 labelShape.set('coord', item.coord);
37058 }
37059 }
37060 });
37061 for (var i = count - 1; i >= items.length; i--) {
37062 children[i].remove();
37063 }
37064 },
37065 addLabel: function addLabel(value, offsetPoint) {
37066 var self = this;
37067 var labelsGroup = self.get('labelsGroup');
37068 var label = {};
37069 var rst = void 0;
37070 if (labelsGroup) {
37071 label.text = value;
37072 label.x = offsetPoint.x;
37073 label.y = offsetPoint.y;
37074 label.point = offsetPoint;
37075 label.textAlign = offsetPoint.textAlign;
37076 if (offsetPoint.rotate) {
37077 label.rotate = offsetPoint.rotate;
37078 }
37079 rst = labelsGroup.addLabel(label);
37080 }
37081 return rst;
37082 },
37083 removeLabels: function removeLabels() {
37084 var labelsGroup = this.get('labelsGroup');
37085 labelsGroup && labelsGroup.remove();
37086 this.set('labelsGroup', null);
37087 }
37088};
37089
37090/***/ }),
37091/* 301 */
37092/***/ (function(module, exports, __webpack_require__) {
37093
37094var MatrixUtil = __webpack_require__(2).MatrixUtil;
37095var Vector2 = MatrixUtil.vec2;
37096
37097function smoothBezier(points, smooth, isLoop, constraint) {
37098 var cps = [];
37099
37100 var prevPoint = void 0;
37101 var nextPoint = void 0;
37102 var hasConstraint = !!constraint;
37103 var min = void 0,
37104 max = void 0;
37105 if (hasConstraint) {
37106 min = [Infinity, Infinity];
37107 max = [-Infinity, -Infinity];
37108
37109 for (var i = 0, l = points.length; i < l; i++) {
37110 var point = points[i];
37111 min = Vector2.min([], min, point);
37112 max = Vector2.max([], max, point);
37113 }
37114 min = Vector2.min([], min, constraint[0]);
37115 max = Vector2.max([], max, constraint[1]);
37116 }
37117
37118 for (var _i = 0, len = points.length; _i < len; _i++) {
37119 var _point = points[_i];
37120 if (isLoop) {
37121 prevPoint = points[_i ? _i - 1 : len - 1];
37122 nextPoint = points[(_i + 1) % len];
37123 } else {
37124 if (_i === 0 || _i === len - 1) {
37125 cps.push(_point);
37126 continue;
37127 } else {
37128 prevPoint = points[_i - 1];
37129 nextPoint = points[_i + 1];
37130 }
37131 }
37132 var v = [];
37133 v = Vector2.sub(v, nextPoint, prevPoint);
37134 v = Vector2.scale(v, v, smooth);
37135
37136 var d0 = Vector2.distance(_point, prevPoint);
37137 var d1 = Vector2.distance(_point, nextPoint);
37138
37139 var sum = d0 + d1;
37140 if (sum !== 0) {
37141 d0 /= sum;
37142 d1 /= sum;
37143 }
37144
37145 var v1 = Vector2.scale([], v, -d0);
37146 var v2 = Vector2.scale([], v, d1);
37147
37148 var cp0 = Vector2.add([], _point, v1);
37149 var cp1 = Vector2.add([], _point, v2);
37150
37151 if (hasConstraint) {
37152 cp0 = Vector2.max([], cp0, min);
37153 cp0 = Vector2.min([], cp0, max);
37154 cp1 = Vector2.max([], cp1, min);
37155 cp1 = Vector2.min([], cp1, max);
37156 }
37157
37158 cps.push(cp0);
37159 cps.push(cp1);
37160 }
37161
37162 if (isLoop) {
37163 cps.push(cps.shift());
37164 }
37165 return cps;
37166}
37167
37168function catmullRom2bezier(crp, z, constraint) {
37169 var isLoop = !!z;
37170
37171 var pointList = [];
37172
37173 for (var i = 0, l = crp.length; i < l; i += 2) {
37174 pointList.push([crp[i], crp[i + 1]]);
37175 }
37176
37177 var controlPointList = smoothBezier(pointList, 0.4, isLoop, constraint);
37178 var len = pointList.length;
37179 var d1 = [];
37180
37181 var cp1 = void 0;
37182 var cp2 = void 0;
37183 var p = void 0;
37184
37185 for (var _i2 = 0; _i2 < len - 1; _i2++) {
37186 cp1 = controlPointList[_i2 * 2];
37187 cp2 = controlPointList[_i2 * 2 + 1];
37188 p = pointList[_i2 + 1];
37189
37190 d1.push(['C', cp1[0], cp1[1], cp2[0], cp2[1], p[0], p[1]]);
37191 }
37192
37193 if (isLoop) {
37194 cp1 = controlPointList[len];
37195 cp2 = controlPointList[len + 1];
37196 p = pointList[0];
37197
37198 d1.push(['C', cp1[0], cp1[1], cp2[0], cp2[1], p[0], p[1]]);
37199 }
37200 return d1;
37201}
37202
37203module.exports = {
37204 catmullRom2bezier: catmullRom2bezier
37205};
37206
37207/***/ }),
37208/* 302 */
37209/***/ (function(module, exports, __webpack_require__) {
37210
37211function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
37212
37213function _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; }
37214
37215function _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; }
37216
37217var Util = __webpack_require__(0);
37218var PolarLabels = __webpack_require__(111);
37219var PathUtil = __webpack_require__(14);
37220var Global = __webpack_require__(1);
37221var MARGIN = 5;
37222
37223function getEndPoint(center, angle, r) {
37224 return {
37225 x: center.x + r * Math.cos(angle),
37226 y: center.y + r * Math.sin(angle)
37227 };
37228}
37229
37230function antiCollision(labels, lineHeight, plotRange, center, isRight) {
37231 // adjust y position of labels to avoid overlapping
37232 var overlapping = true;
37233 var start = plotRange.start;
37234 var end = plotRange.end;
37235 var startY = Math.min(start.y, end.y);
37236 var totalHeight = Math.abs(start.y - end.y);
37237 var i = void 0;
37238
37239 var maxY = 0;
37240 var minY = Number.MIN_VALUE;
37241 var boxes = labels.map(function (label) {
37242 if (label.y > maxY) {
37243 maxY = label.y;
37244 }
37245 if (label.y < minY) {
37246 minY = label.y;
37247 }
37248 return {
37249 size: lineHeight,
37250 targets: [label.y - startY]
37251 };
37252 });
37253 minY -= startY;
37254 if (maxY - startY > totalHeight) {
37255 totalHeight = maxY - startY;
37256 }
37257
37258 while (overlapping) {
37259 /* eslint no-loop-func: 0 */
37260 boxes.forEach(function (box) {
37261 var target = (Math.min.apply(minY, box.targets) + Math.max.apply(minY, box.targets)) / 2;
37262 box.pos = Math.min(Math.max(minY, target - box.size / 2), totalHeight - box.size);
37263 // box.pos = Math.max(0, target - box.size / 2);
37264 });
37265
37266 // detect overlapping and join boxes
37267 overlapping = false;
37268 i = boxes.length;
37269 while (i--) {
37270 if (i > 0) {
37271 var previousBox = boxes[i - 1];
37272 var box = boxes[i];
37273 if (previousBox.pos + previousBox.size > box.pos) {
37274 // overlapping
37275 previousBox.size += box.size;
37276 previousBox.targets = previousBox.targets.concat(box.targets);
37277
37278 // overflow, shift up
37279 if (previousBox.pos + previousBox.size > totalHeight) {
37280 previousBox.pos = totalHeight - previousBox.size;
37281 }
37282 boxes.splice(i, 1); // removing box
37283 overlapping = true;
37284 }
37285 }
37286 }
37287 }
37288
37289 i = 0;
37290 // step 4: normalize y and adjust x
37291 boxes.forEach(function (b) {
37292 var posInCompositeBox = startY + lineHeight / 2; // middle of the label
37293 b.targets.forEach(function () {
37294 labels[i].y = b.pos + posInCompositeBox;
37295 posInCompositeBox += lineHeight;
37296 i++;
37297 });
37298 });
37299
37300 // (x - cx)^2 + (y - cy)^2 = totalR^2
37301 labels.forEach(function (label) {
37302 var rPow2 = label.r * label.r;
37303 var dyPow2 = Math.pow(Math.abs(label.y - center.y), 2);
37304 if (rPow2 < dyPow2) {
37305 label.x = center.x;
37306 } else {
37307 var dx = Math.sqrt(rPow2 - dyPow2);
37308 if (!isRight) {
37309 // left
37310 label.x = center.x - dx;
37311 } else {
37312 // right
37313 label.x = center.x + dx;
37314 }
37315 }
37316 });
37317}
37318
37319var PieLabels = function (_PolarLabels) {
37320 _inherits(PieLabels, _PolarLabels);
37321
37322 function PieLabels() {
37323 _classCallCheck(this, PieLabels);
37324
37325 return _possibleConstructorReturn(this, _PolarLabels.apply(this, arguments));
37326 }
37327
37328 PieLabels.prototype.getDefaultCfg = function getDefaultCfg() {
37329 return {
37330 label: Global.thetaLabels
37331 };
37332 };
37333
37334 /**
37335 * @protected
37336 * to avoid overlapping
37337 * @param {Array} items labels to be placed
37338 * @return {Array} items
37339 */
37340
37341
37342 PieLabels.prototype.adjustItems = function adjustItems(items) {
37343 var self = this;
37344 var offset = self.getDefaultOffset();
37345 if (offset > 0) {
37346 items = self._distribute(items, offset);
37347 }
37348 return items;
37349 };
37350
37351 /**
37352 * @private
37353 * distribute labels
37354 * @param {Array} labels labels
37355 * @param {Number} offset offset
37356 * @return {Array} labels
37357 */
37358
37359
37360 PieLabels.prototype._distribute = function _distribute(labels, offset) {
37361 var self = this;
37362 var coord = self.get('coord');
37363 // console.log(coord);
37364 var radius = coord.getRadius();
37365 var lineHeight = self.get('label').labelHeight;
37366 var center = coord.getCenter();
37367 var totalR = radius + offset;
37368 var totalHeight = totalR * 2 + lineHeight * 2;
37369 var plotRange = {
37370 start: coord.start,
37371 end: coord.end
37372 };
37373 var geom = self.get('geom');
37374 if (geom) {
37375 var view = geom.get('view');
37376 plotRange = view.getViewRegion();
37377 }
37378
37379 // step 1: separate labels
37380 var halves = [[], // left
37381 [] // right
37382 ];
37383 labels.forEach(function (label) {
37384 if (label.textAlign === 'right') {
37385 // left
37386 halves[0].push(label);
37387 } else {
37388 // right or center will be put on the right side
37389 halves[1].push(label);
37390 }
37391 });
37392
37393 halves.forEach(function (half, index) {
37394 // step 2: reduce labels
37395 var maxLabelsCountForOneSide = parseInt(totalHeight / lineHeight, 10);
37396 if (half.length > maxLabelsCountForOneSide) {
37397 half.sort(function (a, b) {
37398 // sort by percentage DESC
37399 return b['..percent'] - a['..percent'];
37400 });
37401 half.splice(maxLabelsCountForOneSide, half.length - maxLabelsCountForOneSide);
37402 }
37403
37404 // step 3: distribute position (x and y)
37405 half.sort(function (a, b) {
37406 // sort by y ASC
37407 return a.y - b.y;
37408 });
37409 antiCollision(half, lineHeight, plotRange, center, index);
37410 });
37411
37412 return halves[0].concat(halves[1]);
37413 };
37414
37415 // 连接线
37416
37417
37418 PieLabels.prototype.lineToLabel = function lineToLabel(label, labelLine) {
37419 var self = this;
37420 var coord = self.get('coord');
37421 var r = coord.getRadius();
37422 var distance = self.getDefaultOffset();
37423 var angle = label.orignAngle || label.angle;
37424 var center = coord.getCenter();
37425 var start = getEndPoint(center, angle, r + MARGIN / 2);
37426 var inner = getEndPoint(center, angle, r + distance / 2);
37427 var lineGroup = self.get('lineGroup');
37428 // var lineShape;
37429 if (!lineGroup) {
37430 lineGroup = self.addGroup({
37431 elCls: 'x-line-group'
37432 });
37433 self.set('lineGroup', lineGroup);
37434 }
37435 // lineShape =
37436 var lineShape = lineGroup.addShape('path', {
37437 attrs: Util.mix({
37438 path: ['M' + start.x, start.y + ' Q' + inner.x, inner.y + ' ' + label.x, label.y].join(','),
37439 fill: null,
37440 stroke: label.color
37441 }, labelLine)
37442 });
37443 // label 对应线的动画关闭
37444 lineShape.name = 'labelLine';
37445 lineShape._id = label._id && label._id.replace('glabel', 'glabelline'); // generate labelLine id according to label id
37446 lineShape.set('coord', coord);
37447 };
37448
37449 /**
37450 * @protected
37451 * get rotation for label
37452 * @param {Number} angle angle
37453 * @param {Number} offset offset
37454 * @return {Number} rotate
37455 */
37456
37457
37458 PieLabels.prototype.getLabelRotate = function getLabelRotate(angle, offset) {
37459 var rotate = void 0;
37460 if (offset < 0) {
37461 rotate = angle * 180 / Math.PI;
37462 if (rotate > 90) {
37463 rotate = rotate - 180;
37464 }
37465 if (rotate < -90) {
37466 rotate = rotate + 180;
37467 }
37468 }
37469 return rotate / 180 * Math.PI;
37470 };
37471
37472 /**
37473 * @protected
37474 * get text align for label
37475 * @param {Object} point point
37476 * @return {String} align
37477 */
37478
37479
37480 PieLabels.prototype.getLabelAlign = function getLabelAlign(point) {
37481 var self = this;
37482 var coord = self.get('coord');
37483 var center = coord.getCenter();
37484 var align = void 0;
37485 if (point.angle <= Math.PI / 2 && point.x >= center.x) {
37486 align = 'left';
37487 } else {
37488 align = 'right';
37489 }
37490
37491 var offset = self.getDefaultOffset();
37492 if (offset <= 0) {
37493 if (align === 'right') {
37494 align = 'left';
37495 } else {
37496 align = 'right';
37497 }
37498 }
37499 return align;
37500 };
37501
37502 PieLabels.prototype.getArcPoint = function getArcPoint(point) {
37503 return point;
37504 };
37505
37506 PieLabels.prototype.getPointAngle = function getPointAngle(point) {
37507 var self = this;
37508 var coord = self.get('coord');
37509 var startPoint = {
37510 x: Util.isArray(point.x) ? point.x[0] : point.x,
37511 y: point.y[0]
37512 };
37513 var endPoint = {
37514 x: Util.isArray(point.x) ? point.x[1] : point.x,
37515 y: point.y[1]
37516 };
37517 var angle = void 0;
37518 var startAngle = PathUtil.getPointAngle(coord, startPoint);
37519 if (point.points && point.points[0].y === point.points[1].y) {
37520 angle = startAngle;
37521 } else {
37522 var endAngle = PathUtil.getPointAngle(coord, endPoint);
37523 if (startAngle >= endAngle) {
37524 // 100% pie slice
37525 endAngle = endAngle + Math.PI * 2;
37526 }
37527 angle = startAngle + (endAngle - startAngle) / 2;
37528 }
37529 return angle;
37530 };
37531
37532 PieLabels.prototype.getCirclePoint = function getCirclePoint(angle, offset) {
37533 var self = this;
37534 var coord = self.get('coord');
37535 var center = coord.getCenter();
37536 var r = coord.getRadius() + offset;
37537 var point = getEndPoint(center, angle, r);
37538 point.angle = angle;
37539 point.r = r;
37540 return point;
37541 };
37542
37543 return PieLabels;
37544}(PolarLabels);
37545
37546module.exports = PieLabels;
37547
37548/***/ }),
37549/* 303 */
37550/***/ (function(module, exports, __webpack_require__) {
37551
37552/**
37553 * @fileOverview area shape
37554 * @author dxq613@gmail.com
37555 * @author sima.zhang1990@gmail.com
37556 */
37557
37558var Util = __webpack_require__(0);
37559var Shape = __webpack_require__(10);
37560var PathUtil = __webpack_require__(14);
37561var Global = __webpack_require__(1);
37562
37563function getLineAttrs(cfg) {
37564 var defaultAttrs = Global.shape.hollowArea;
37565 var lineAttrs = Util.mix({}, defaultAttrs, {
37566 stroke: cfg.color,
37567 lineWidth: cfg.size,
37568 strokeOpacity: cfg.opacity
37569 }, cfg.style);
37570 return lineAttrs;
37571}
37572
37573function getFillAttrs(cfg) {
37574 var defaultAttrs = Global.shape.area;
37575 var areaAttrs = Util.mix({}, defaultAttrs, {
37576 fill: cfg.color,
37577 stroke: cfg.color,
37578 lineWidth: cfg.size,
37579 fillOpacity: cfg.opacity
37580 }, cfg.style);
37581 return areaAttrs;
37582}
37583
37584function getPath(cfg, smooth, shape) {
37585 var path = [];
37586 var pointsArr = [];
37587 var topLinePoints = []; // area 区域上部分
37588 var bottomLinePoints = []; // area 区域下部分
37589 var isInCircle = cfg.isInCircle;
37590 Util.each(cfg.points, function (point) {
37591 topLinePoints.push(point[1]);
37592 bottomLinePoints.push(point[0]);
37593 });
37594 if (!isInCircle) {
37595 bottomLinePoints = bottomLinePoints.reverse();
37596 }
37597 pointsArr.push(topLinePoints, bottomLinePoints);
37598 Util.each(pointsArr, function (points, index) {
37599 var subPath = [];
37600 points = shape.parsePoints(points);
37601 var p1 = points[0];
37602 if (isInCircle) {
37603 points.push({ x: p1.x, y: p1.y });
37604 }
37605 if (smooth) {
37606 subPath = PathUtil.getSplinePath(points, false, cfg.constraint);
37607 } else {
37608 subPath = PathUtil.getLinePath(points, false);
37609 }
37610 if (!isInCircle && index > 0) {
37611 subPath[0][0] = 'L';
37612 }
37613 path = path.concat(subPath);
37614 });
37615 path.push(['Z']);
37616 return path;
37617}
37618
37619// get marker cfg
37620function _getMarkerCfg(cfg) {
37621 return {
37622 symbol: function symbol(x, y, r, ctx) {
37623 // 11px * 9px
37624 ctx.save();
37625 ctx.lineWidth = 2;
37626 ctx.strokeStyle = ctx.fillStyle;
37627 ctx.moveTo(x - 5.5, y - 4);
37628 ctx.lineTo(x + 5.5, y - 4);
37629 ctx.stroke();
37630 ctx.restore();
37631 ctx.moveTo(x - 5.5, y - 4);
37632 ctx.lineTo(x + 5.5, y - 4);
37633 ctx.lineTo(x + 5.5, y + 4);
37634 ctx.lineTo(x - 5.5, y + 4);
37635 ctx.closePath();
37636 },
37637
37638 radius: 5,
37639 fill: cfg.color,
37640 fillOpacity: 0.3
37641 };
37642}
37643
37644// 鼠标悬浮触发active状态
37645function _getActiveCfg(type, cfg) {
37646 if (type === 'line' || type === 'smoothLine') {
37647 // 线加粗
37648 var lineWidth = cfg.lineWidth || 0;
37649 return {
37650 lineWidth: lineWidth + 1
37651 };
37652 }
37653 var opacity = cfg.fillOpacity || cfg.opacity || 1;
37654 return {
37655 fillOpacity: opacity - 0.15,
37656 strokeOpacity: opacity - 0.15
37657 };
37658}
37659
37660// 当只有一个数据时绘制点
37661function drawPointShape(shapeObj, cfg, container) {
37662 var coord = shapeObj._coord;
37663 var point = coord.convertPoint(cfg.points[0][1]);
37664 return container.addShape('circle', {
37665 attrs: Util.mix({
37666 x: point.x,
37667 y: point.y,
37668 r: 2,
37669 fill: cfg.color
37670 }, cfg.style)
37671 });
37672}
37673
37674var Area = Shape.registerFactory('area', {
37675 defaultShapeType: 'area',
37676 /**
37677 * @override
37678 * @protected
37679 * 计算点 如果存在多个点,分割成单个的点, 不考虑多个x对应一个y的情况
37680 * 单点则补上y0点
37681 */
37682 getDefaultPoints: function getDefaultPoints(pointInfo) {
37683 var points = [];
37684 var x = pointInfo.x;
37685 var y = pointInfo.y;
37686 var y0 = pointInfo.y0;
37687 y = Util.isArray(y) ? y : [y0, y];
37688
37689 Util.each(y, function (yItem) {
37690 points.push({
37691 x: x,
37692 y: yItem
37693 });
37694 });
37695 return points;
37696 },
37697
37698 // 获取激活的图形属性
37699 getActiveCfg: function getActiveCfg(type, cfg) {
37700 return _getActiveCfg(type, cfg);
37701 },
37702 drawShape: function drawShape(type, cfg, container) {
37703 var shape = this.getShape(type);
37704 var gShape = void 0;
37705 if (cfg.points.length === 1 && Global.showSinglePoint) {
37706 gShape = drawPointShape(this, cfg, container);
37707 } else {
37708 gShape = shape.draw(cfg, container);
37709 }
37710 if (gShape) {
37711 gShape.set('origin', cfg.origin);
37712 gShape._id = cfg.splitedIndex ? cfg._id + cfg.splitedIndex : cfg._id;
37713 gShape.name = this.name;
37714 }
37715 return gShape;
37716 },
37717 getSelectedCfg: function getSelectedCfg(type, cfg) {
37718 if (cfg && cfg.style) {
37719 return cfg.style;
37720 }
37721 return this.getActiveCfg(type, cfg);
37722 }
37723});
37724
37725// 默认:填充区域图
37726Shape.registerShape('area', 'area', {
37727 draw: function draw(cfg, container) {
37728 var attrs = getFillAttrs(cfg);
37729 var path = getPath(cfg, false, this);
37730 // path = this.parsePath(path, false);
37731 return container.addShape('path', {
37732 attrs: Util.mix(attrs, {
37733 path: path
37734 })
37735 });
37736 },
37737 getMarkerCfg: function getMarkerCfg(cfg) {
37738 return _getMarkerCfg(cfg);
37739 }
37740});
37741
37742// 填充平滑区域图
37743Shape.registerShape('area', 'smooth', {
37744 draw: function draw(cfg, container) {
37745 var attrs = getFillAttrs(cfg);
37746 var coord = this._coord;
37747 // 曲线的限制
37748 cfg.constraint = [[coord.start.x, coord.end.y], [coord.end.x, coord.start.y]];
37749 var path = getPath(cfg, true, this);
37750 // path = this.parsePath(path, false);
37751 return container.addShape('path', {
37752 attrs: Util.mix(attrs, {
37753 path: path
37754 })
37755 });
37756 },
37757 getMarkerCfg: function getMarkerCfg(cfg) {
37758 return _getMarkerCfg(cfg);
37759 }
37760});
37761
37762// 封闭的折线
37763Shape.registerShape('area', 'line', {
37764 draw: function draw(cfg, container) {
37765 var attrs = getLineAttrs(cfg);
37766 var path = getPath(cfg, false, this);
37767 // path = this.parsePath(path, false);
37768 return container.addShape('path', {
37769 attrs: Util.mix(attrs, {
37770 path: path
37771 })
37772 });
37773 },
37774 getMarkerCfg: function getMarkerCfg(cfg) {
37775 return _getMarkerCfg(cfg);
37776 }
37777});
37778
37779// 封闭的平滑线
37780Shape.registerShape('area', 'smoothLine', {
37781 draw: function draw(cfg, container) {
37782 var attrs = getLineAttrs(cfg);
37783 var path = getPath(cfg, true, this);
37784 return container.addShape('path', {
37785 attrs: Util.mix(attrs, {
37786 path: path
37787 })
37788 });
37789 },
37790 getMarkerCfg: function getMarkerCfg(cfg) {
37791 return _getMarkerCfg(cfg);
37792 }
37793});
37794
37795Area.spline = Area.smooth;
37796
37797module.exports = Area;
37798
37799/***/ }),
37800/* 304 */
37801/***/ (function(module, exports, __webpack_require__) {
37802
37803/**
37804 * @fileOverview 边的 shape
37805 * @author dxq613@gmail.com
37806 */
37807
37808var Util = __webpack_require__(0);
37809var Shape = __webpack_require__(10);
37810var ShapeUtil = __webpack_require__(67);
37811var Global = __webpack_require__(1);
37812var PathUtil = __webpack_require__(14);
37813var CORNER_PERCENT = 1 / 3;
37814
37815function getAttrs(cfg) {
37816 var defaultCfg = Global.shape.edge;
37817 var shapeCfg = Util.mix({}, defaultCfg, {
37818 stroke: cfg.color,
37819 lineWidth: cfg.size,
37820 strokeOpacity: cfg.opacity,
37821 opacity: cfg.opacity
37822 }, cfg.style);
37823 return shapeCfg;
37824}
37825
37826var Edge = Shape.registerFactory('edge', {
37827 defaultShapeType: 'line',
37828 getDefaultPoints: function getDefaultPoints(pointInfo) {
37829 return ShapeUtil.splitPoints(pointInfo);
37830 },
37831 getActiveCfg: function getActiveCfg(type, cfg) {
37832 var lineWidth = cfg.lineWidth || 0;
37833 return {
37834 lineWidth: lineWidth + 1
37835 };
37836 }
37837});
37838
37839function getCPath(from, to) {
37840 var points = [];
37841 points.push({
37842 x: from.x,
37843 y: from.y * (1 - 1 / 2) + to.y * 1 / 2
37844 });
37845
37846 points.push({
37847 y: from.y * (1 - 1 / 2) + to.y * 1 / 2,
37848 x: to.x
37849 });
37850 points.push(to);
37851 var sub = ['C'];
37852
37853 Util.each(points, function (point) {
37854 sub.push(point.x, point.y);
37855 });
37856 return sub;
37857}
37858
37859function getQPath(to, center) {
37860 var points = [];
37861 points.push({
37862 x: center.x,
37863 y: center.y
37864 });
37865 points.push(to);
37866
37867 var sub = ['Q'];
37868 Util.each(points, function (point) {
37869 sub.push(point.x, point.y);
37870 });
37871 return sub;
37872}
37873
37874function createSmoothPath(from, to) {
37875 var sub = getCPath(from, to);
37876 var path = [['M', from.x, from.y]];
37877
37878 path.push(sub);
37879 return path;
37880}
37881
37882function createArcPath(from, to, center) {
37883 var sub = getQPath(to, center);
37884 var path = [['M', from.x, from.y]];
37885 path.push(sub);
37886 return path;
37887}
37888
37889function createArcWeightPath(points, center) {
37890 var arc1 = getQPath(points[1], center);
37891 var arc2 = getQPath(points[3], center);
37892 var path = [['M', points[0].x, points[0].y]];
37893 path.push(arc2);
37894 path.push(['L', points[3].x, points[3].y]);
37895 path.push(['L', points[2].x, points[2].y]);
37896 path.push(arc1);
37897 path.push(['L', points[1].x, points[1].y]);
37898 path.push(['L', points[0].x, points[0].y]);
37899 path.push(['Z']);
37900 return path;
37901}
37902
37903function createRectPath(from, to) {
37904 var points = [];
37905 points.push({
37906 y: from.y * (1 - CORNER_PERCENT) + to.y * CORNER_PERCENT,
37907 x: from.x
37908 });
37909 points.push({
37910 y: from.y * (1 - CORNER_PERCENT) + to.y * CORNER_PERCENT,
37911 x: to.x
37912 });
37913 points.push(to);
37914 var path = [['M', from.x, from.y]];
37915 Util.each(points, function (point) {
37916 path.push(['L', point.x, point.y]);
37917 });
37918 return path;
37919}
37920
37921Shape.registerShape('edge', 'line', {
37922 draw: function draw(cfg, container) {
37923 var points = this.parsePoints(cfg.points);
37924 var attrCfg = getAttrs(cfg);
37925 var path = PathUtil.getLinePath(points);
37926 var line = container.addShape('path', {
37927 attrs: Util.mix(attrCfg, {
37928 path: path
37929 })
37930 });
37931 return line;
37932 },
37933 getMarkerCfg: function getMarkerCfg(cfg) {
37934 return Util.mix({
37935 symbol: 'circle',
37936 radius: 4.5
37937 }, getAttrs(cfg));
37938 }
37939});
37940
37941Shape.registerShape('edge', 'vhv', {
37942 draw: function draw(cfg, container) {
37943 var points = cfg.points;
37944 var attrCfg = getAttrs(cfg);
37945 var path = createRectPath(points[0], points[1]);
37946 path = this.parsePath(path);
37947 var line = container.addShape('path', {
37948 attrs: Util.mix(attrCfg, {
37949 path: path
37950 })
37951 });
37952 return line;
37953 },
37954 getMarkerCfg: function getMarkerCfg(cfg) {
37955 return Util.mix({
37956 symbol: 'circle',
37957 radius: 4.5
37958 }, getAttrs(cfg));
37959 }
37960});
37961
37962Shape.registerShape('edge', 'smooth', {
37963 draw: function draw(cfg, container) {
37964 var points = cfg.points;
37965 var attrCfg = getAttrs(cfg);
37966 var path = createSmoothPath(points[0], points[1]);
37967 path = this.parsePath(path);
37968
37969 var line = container.addShape('path', {
37970 attrs: Util.mix(attrCfg, {
37971 path: path
37972 })
37973 });
37974 return line;
37975 },
37976 getMarkerCfg: function getMarkerCfg(cfg) {
37977 return Util.mix({
37978 symbol: 'circle',
37979 radius: 4.5
37980 }, getAttrs(cfg));
37981 }
37982});
37983
37984// 弧线包括笛卡尔坐标系下的半圆弧线、极坐标系下以圆心为控制点的二阶曲线、笛卡尔坐标系下带权重的三阶曲线、极坐标系下带权重的以圆心为控制点的二阶曲线
37985Shape.registerShape('edge', 'arc', {
37986 draw: function draw(cfg, container) {
37987 var points = cfg.points;
37988 var type = points.length > 2 ? 'weight' : 'normal';
37989 var attrCfg = getAttrs(cfg);
37990 var line = void 0;
37991 var path = void 0;
37992 if (cfg.isInCircle) {
37993 var center = {
37994 x: 0,
37995 y: 1
37996 };
37997 if (type === 'normal') {
37998 path = createArcPath(points[0], points[1], center);
37999 } else {
38000 attrCfg.fill = attrCfg.stroke;
38001 path = createArcWeightPath(points, center);
38002 }
38003 path = this.parsePath(path);
38004 line = container.addShape('path', {
38005 attrs: Util.mix(attrCfg, {
38006 path: path
38007 })
38008 });
38009 } else {
38010 if (type === 'normal') {
38011 points = this.parsePoints(points);
38012 line = container.addShape('arc', {
38013 attrs: Util.mix(attrCfg, {
38014 x: (points[1].x + points[0].x) / 2,
38015 y: points[0].y,
38016 r: Math.abs(points[1].x - points[0].x) / 2,
38017 startAngle: Math.PI,
38018 endAngle: Math.PI * 2
38019 })
38020 });
38021 } else {
38022 path = [['M', points[0].x, points[0].y], ['L', points[1].x, points[1].y]];
38023 var c1 = getCPath(points[1], points[3]);
38024 var c2 = getCPath(points[2], points[0]);
38025 path.push(c1);
38026 path.push(['L', points[3].x, points[3].y]);
38027 path.push(['L', points[2].x, points[2].y]);
38028 path.push(c2);
38029 path.push(['Z']);
38030 path = this.parsePath(path);
38031 attrCfg.fill = attrCfg.stroke;
38032 line = container.addShape('path', {
38033 attrs: Util.mix(attrCfg, {
38034 path: path
38035 })
38036 });
38037 }
38038 }
38039 return line;
38040 },
38041 getMarkerCfg: function getMarkerCfg(cfg) {
38042 return Util.mix({
38043 symbol: 'circle',
38044 radius: 4.5
38045 }, getAttrs(cfg));
38046 }
38047});
38048
38049module.exports = Edge;
38050
38051/***/ }),
38052/* 305 */
38053/***/ (function(module, exports, __webpack_require__) {
38054
38055/**
38056 * @fileOverview interval shapes
38057 * @author dxq613@gmail.com
38058 * @author sima.zhang1990@gmail.com
38059 * @author huangtonger@aliyun.com
38060 */
38061
38062var Util = __webpack_require__(0);
38063var Shape = __webpack_require__(10);
38064var PathUtil = __webpack_require__(14);
38065var Global = __webpack_require__(1);
38066
38067// 获取柱状图的几个点
38068function getRectPoints(cfg, isPyramid) {
38069 var x = cfg.x;
38070 var y = cfg.y;
38071 var y0 = cfg.y0; // 0 点的位置
38072 var width = cfg.size;
38073 // 有3种情况,
38074 // 1. y,x都不是数组
38075 // 2. y是数组,x不是
38076 // 3. x是数组,y不是
38077 var ymin = y0;
38078 var ymax = y;
38079 if (Util.isArray(y)) {
38080 ymax = y[1];
38081 ymin = y[0];
38082 }
38083
38084 var xmin = void 0;
38085 var xmax = void 0;
38086 if (Util.isArray(x)) {
38087 xmin = x[0];
38088 xmax = x[1];
38089 } else {
38090 xmin = x - width / 2;
38091 xmax = x + width / 2;
38092 }
38093
38094 var points = [];
38095 points.push({
38096 x: xmin,
38097 y: ymin
38098 }, {
38099 x: xmin,
38100 y: ymax
38101 });
38102
38103 if (isPyramid) {
38104 points.push({
38105 x: xmax,
38106 y: (ymax + ymin) / 2
38107 });
38108 } else {
38109 points.push({
38110 x: xmax,
38111 y: ymax
38112 }, {
38113 x: xmax,
38114 y: ymin
38115 });
38116 }
38117
38118 return points;
38119}
38120
38121function getRectPath(points) {
38122 var path = [];
38123 for (var i = 0; i < points.length; i++) {
38124 var point = points[i];
38125 if (point) {
38126 var action = i === 0 ? 'M' : 'L';
38127 path.push([action, point.x, point.y]);
38128 }
38129 }
38130 var first = points[0];
38131 path.push(['L', first.x, first.y]);
38132 path.push(['z']);
38133 return path;
38134}
38135
38136function getLinePoints(cfg) {
38137 var x = cfg.x;
38138 var y = cfg.y;
38139 var y0 = cfg.y0; // 0 点的位置
38140 var points = [];
38141
38142 if (Util.isArray(y)) {
38143 Util.each(y, function (yItem, idx) {
38144 points.push({
38145 x: Util.isArray(x) ? x[idx] : x,
38146 y: yItem
38147 });
38148 });
38149 } else {
38150 points.push({
38151 x: x,
38152 y: y
38153 }, {
38154 x: x,
38155 y: y0
38156 });
38157 }
38158
38159 return points;
38160}
38161
38162function getTickPoints(cfg) {
38163 var x = cfg.x;
38164 var y = Util.isArray(cfg.y) ? cfg.y[1] : cfg.y;
38165 var y0 = Util.isArray(cfg.y) ? cfg.y[0] : cfg.y0;
38166
38167 var barWidth = cfg.size;
38168 var points = [];
38169
38170 points.push({
38171 x: x - barWidth / 2,
38172 y: y
38173 }, {
38174 x: x + barWidth / 2,
38175 y: y
38176 }, {
38177 x: x,
38178 y: y
38179 }, {
38180 x: x,
38181 y: y0
38182 }, {
38183 x: x - barWidth / 2,
38184 y: y0
38185 }, {
38186 x: x + barWidth / 2,
38187 y: y0
38188 });
38189
38190 return points;
38191}
38192
38193function getTickPath(points) {
38194 var path = [];
38195 path.push(['M', points[0].x, points[0].y], ['L', points[1].x, points[1].y], ['M', points[2].x, points[2].y], ['L', points[3].x, points[3].y], ['M', points[4].x, points[4].y], ['L', points[5].x, points[5].y]);
38196 return path;
38197}
38198
38199function getFillAttrs(cfg) {
38200 var defaultAttrs = Global.shape.interval;
38201 var attrs = Util.mix({}, defaultAttrs, {
38202 fill: cfg.color,
38203 stroke: cfg.color,
38204 fillOpacity: cfg.opacity
38205 }, cfg.style);
38206 return attrs;
38207}
38208
38209function getLineAttrs(cfg) {
38210 var defaultAttrs = Global.shape.hollowInterval;
38211 var attrs = Util.mix({}, defaultAttrs, {
38212 stroke: cfg.color,
38213 strokeOpacity: cfg.opacity
38214 }, cfg.style);
38215 return attrs;
38216}
38217
38218function getFunnelPath(cfg, isFunnel) {
38219 var path = [];
38220 var points = cfg.points;
38221 var nextPoints = cfg.nextPoints;
38222 if (!Util.isNil(nextPoints)) {
38223 path.push(['M', points[0].x, points[0].y], ['L', points[1].x, points[1].y], ['L', nextPoints[1].x, nextPoints[1].y], ['L', nextPoints[0].x, nextPoints[0].y], ['Z']);
38224 } else if (isFunnel) {
38225 path.push(['M', points[0].x, points[0].y], ['L', points[1].x, points[1].y], ['L', points[2].x, points[2].y], ['L', points[3].x, points[3].y], ['Z']);
38226 } else {
38227 path.push(['M', points[0].x, points[0].y], ['L', points[1].x, points[1].y], ['L', points[2].x, points[2].y], ['Z']);
38228 }
38229
38230 return path;
38231}
38232
38233function getThetaCfg(point, coord) {
38234 var r = coord.getRadius();
38235 var inner = coord.innerRadius;
38236 var startAngle = void 0;
38237 var endAngle = void 0;
38238 var ir = r * inner;
38239 var startPoint = void 0;
38240 var endPoint = void 0;
38241
38242 if (!Util.isArray(point.x) && Util.isArray(point.y)) {
38243 point.x = [point.x, point.x]; // 如果x是一个值,y是数组,将x转成数组
38244 }
38245 if (Util.isArray(point.x)) {
38246 startPoint = {
38247 x: point.x[0],
38248 y: point.y[0]
38249 };
38250 endPoint = {
38251 x: point.x[1],
38252 y: point.y[1]
38253 };
38254 startAngle = PathUtil.getPointAngle(coord, startPoint);
38255 endAngle = PathUtil.getPointAngle(coord, endPoint);
38256 if (endAngle <= startAngle) {
38257 // 考虑占比百分百的情形
38258 endAngle = endAngle + Math.PI * 2;
38259 }
38260 } else {
38261 endPoint = point;
38262 startAngle = coord.startAngle;
38263 endAngle = PathUtil.getPointAngle(coord, endPoint);
38264 }
38265 return {
38266 r: r,
38267 ir: ir,
38268 startAngle: startAngle,
38269 endAngle: endAngle
38270 };
38271}
38272
38273// 获取选中时的样式,当前仅支持饼图
38274function _getSelectedCfg(type, cfg) {
38275 var geom = cfg.geom;
38276 var coord = geom.get('coord');
38277 var point = cfg.point;
38278 var r = 7.5;
38279 var selectedCfg = void 0;
38280 if (coord && coord.type === 'theta') {
38281 var thetaCfg = getThetaCfg(point, coord);
38282 var middleAngle = (thetaCfg.endAngle - thetaCfg.startAngle) / 2 + thetaCfg.startAngle;
38283 var x = r * Math.cos(middleAngle);
38284 var y = r * Math.sin(middleAngle);
38285 selectedCfg = {
38286 transform: [['t', x, y]]
38287 };
38288 }
38289 return Util.mix({}, selectedCfg);
38290}
38291
38292var Interval = Shape.registerFactory('interval', {
38293 defaultShapeType: 'rect',
38294 getActiveCfg: function getActiveCfg(type, cfg) {
38295 if (!type || Util.inArray(['rect', 'funnel', 'pyramid'], type)) {
38296 // 透明度降低 0.15
38297 var fillOpacity = cfg.fillOpacity || cfg.opacity || 1;
38298 return {
38299 fillOpacity: fillOpacity - 0.15
38300 };
38301 }
38302 var lineWidth = cfg.lineWidth || 0;
38303 return {
38304 lineWidth: lineWidth + 1
38305 };
38306 },
38307 getDefaultPoints: function getDefaultPoints(pointInfo) {
38308 return getRectPoints(pointInfo);
38309 },
38310 getSelectedCfg: function getSelectedCfg(type, cfg) {
38311 return _getSelectedCfg(type, cfg);
38312 }
38313});
38314
38315// 默认柱状图
38316Shape.registerShape('interval', 'rect', {
38317 draw: function draw(cfg, container) {
38318 var attrs = getFillAttrs(cfg);
38319 var path = getRectPath(cfg.points);
38320 path = this.parsePath(path);
38321 return container.addShape('path', {
38322 attrs: Util.mix(attrs, {
38323 path: path
38324 })
38325 });
38326 },
38327 getMarkerCfg: function getMarkerCfg(cfg) {
38328 var rectCfg = getFillAttrs(cfg);
38329 var isInCircle = cfg.isInCircle;
38330 return Util.mix({
38331 symbol: isInCircle ? 'circle' : 'square',
38332 radius: isInCircle ? 4.5 : 4
38333 }, rectCfg);
38334 }
38335});
38336
38337// 空心柱状图
38338Shape.registerShape('interval', 'hollowRect', {
38339 draw: function draw(cfg, container) {
38340 var attrs = getLineAttrs(cfg);
38341 var path = getRectPath(cfg.points);
38342 path = this.parsePath(path);
38343 return container.addShape('path', {
38344 attrs: Util.mix(attrs, {
38345 path: path
38346 })
38347 });
38348 },
38349 getMarkerCfg: function getMarkerCfg(cfg) {
38350 var rectCfg = getLineAttrs(cfg);
38351 var isInCircle = cfg.isInCircle;
38352 return Util.mix({
38353 symbol: isInCircle ? 'circle' : 'square',
38354 radius: isInCircle ? 4.5 : 4
38355 }, rectCfg);
38356 }
38357});
38358
38359// 线形柱状图
38360Shape.registerShape('interval', 'line', {
38361 getPoints: function getPoints(pointInfo) {
38362 return getLinePoints(pointInfo);
38363 },
38364 draw: function draw(cfg, container) {
38365 var attrs = getLineAttrs(cfg);
38366 attrs.lineWidth = cfg.size || 1; // size 就是线的宽度
38367 var path = getRectPath(cfg.points);
38368 path = this.parsePath(path);
38369 return container.addShape('path', {
38370 attrs: Util.mix(attrs, {
38371 path: path
38372 })
38373 });
38374 },
38375 getMarkerCfg: function getMarkerCfg(cfg) {
38376 var lineCfg = getLineAttrs(cfg);
38377 return Util.mix({
38378 symbol: 'line',
38379 radius: 5
38380 }, lineCfg);
38381 }
38382});
38383
38384// 钉子形的柱状图
38385Shape.registerShape('interval', 'tick', {
38386 getPoints: function getPoints(pointInfo) {
38387 return getTickPoints(pointInfo);
38388 },
38389 draw: function draw(cfg, container) {
38390 var attrs = getLineAttrs(cfg);
38391 var path = getTickPath(cfg.points);
38392 path = this.parsePath(path);
38393 return container.addShape('path', {
38394 attrs: Util.mix(attrs, {
38395 path: path
38396 })
38397 });
38398 },
38399 getMarkerCfg: function getMarkerCfg(cfg) {
38400 var lineCfg = getLineAttrs(cfg);
38401 return Util.mix({
38402 symbol: 'tick',
38403 radius: 5
38404 }, lineCfg);
38405 }
38406});
38407
38408// 漏斗图
38409Shape.registerShape('interval', 'funnel', {
38410 getPoints: function getPoints(pointInfo) {
38411 pointInfo.size = pointInfo.size * 2; // 漏斗图的 size 是柱状图的两倍
38412 return getRectPoints(pointInfo);
38413 },
38414 draw: function draw(cfg, container) {
38415 var attrs = getFillAttrs(cfg);
38416 var path = getFunnelPath(cfg, true);
38417 path = this.parsePath(path);
38418 return container.addShape('path', {
38419 attrs: Util.mix(attrs, {
38420 path: path
38421 })
38422 });
38423 },
38424 getMarkerCfg: function getMarkerCfg(cfg) {
38425 var funnelCfg = getFillAttrs(cfg);
38426 return Util.mix({
38427 symbol: 'square',
38428 radius: 4
38429 }, funnelCfg);
38430 }
38431});
38432
38433// 金字塔图
38434Shape.registerShape('interval', 'pyramid', {
38435 getPoints: function getPoints(pointInfo) {
38436 pointInfo.size = pointInfo.size * 2; // 漏斗图的 size 是柱状图的两倍
38437 return getRectPoints(pointInfo, true);
38438 },
38439 draw: function draw(cfg, container) {
38440 var attrs = getFillAttrs(cfg);
38441 var path = getFunnelPath(cfg, false);
38442 path = this.parsePath(path);
38443 return container.addShape('path', {
38444 attrs: Util.mix(attrs, {
38445 path: path
38446 })
38447 });
38448 },
38449 getMarkerCfg: function getMarkerCfg(cfg) {
38450 var funnelCfg = getFillAttrs(cfg);
38451 return Util.mix({
38452 symbol: 'square',
38453 radius: 4
38454 }, funnelCfg);
38455 }
38456});
38457module.exports = Interval;
38458
38459/***/ }),
38460/* 306 */
38461/***/ (function(module, exports, __webpack_require__) {
38462
38463/**
38464 * @fileOverview line shapes
38465 * @author dxq613@gmail.com
38466 * @author sima.zhang1990@gmail.com
38467 * @author huangtonger@aliyun.com
38468 */
38469
38470var Util = __webpack_require__(0);
38471var PathUtil = __webpack_require__(14);
38472var ShapeUtil = __webpack_require__(67);
38473var Shape = __webpack_require__(10);
38474var Global = __webpack_require__(1);
38475var DOT_ARR = [1, 1];
38476var DASH_ARR = [5.5, 1];
38477
38478function getAttrs(cfg) {
38479 var defaultCfg = Global.shape.line;
38480 var shapeCfg = Util.mix({}, defaultCfg, {
38481 stroke: cfg.color,
38482 lineWidth: cfg.size,
38483 strokeOpacity: cfg.opacity,
38484 opacity: cfg.opacity
38485 }, cfg.style);
38486 return shapeCfg;
38487}
38488
38489function getMarkerAttrs(cfg) {
38490 var defaultCfg = Global.shape.line;
38491 var shapeCfg = Util.mix({}, defaultCfg, {
38492 stroke: cfg.color,
38493 lineWidth: 2,
38494 strokeOpacity: cfg.opacity,
38495 opacity: cfg.opacity,
38496 radius: 6
38497 }, cfg.style);
38498 return shapeCfg;
38499}
38500
38501// 获取带有上下区间的 path
38502function getRangePath(points, smooth, isInCircle, cfg) {
38503 var topPoints = [];
38504 var isStack = cfg.isStack;
38505 var bottomPoints = [];
38506 for (var i = 0; i < points.length; i++) {
38507 var point = points[i];
38508 var tmp = ShapeUtil.splitPoints(point);
38509 bottomPoints.push(tmp[0]);
38510 topPoints.push(tmp[1]);
38511 }
38512 var topPath = getSinglePath(topPoints, smooth, isInCircle, cfg);
38513 var bottomPath = getSinglePath(bottomPoints, smooth, isInCircle, cfg);
38514 if (isStack) {
38515 return topPath;
38516 }
38517 return topPath.concat(bottomPath);
38518}
38519
38520// 单条 path
38521function getSinglePath(points, smooth, isInCircle, cfg) {
38522 var path = void 0;
38523 if (!smooth) {
38524 path = PathUtil.getLinePath(points, false);
38525 if (isInCircle) {
38526 path.push(['Z']);
38527 }
38528 } else {
38529 // 直角坐标系下绘制曲线时限制最大值、最小值
38530 var constraint = cfg.constraint;
38531 if (isInCircle && points.length) {
38532 points.push({ x: points[0].x, y: points[0].y });
38533 }
38534 path = PathUtil.getSplinePath(points, false, constraint);
38535 }
38536
38537 return path;
38538}
38539// get line path
38540function getPath(cfg, smooth) {
38541 var path = void 0;
38542 var points = cfg.points;
38543 var isInCircle = cfg.isInCircle;
38544 var first = points[0];
38545 if (Util.isArray(first.y)) {
38546 path = getRangePath(points, smooth, isInCircle, cfg);
38547 } else {
38548 path = getSinglePath(points, smooth, isInCircle, cfg);
38549 }
38550 return path;
38551}
38552
38553function _interpPoints(points, fn) {
38554 var tmpPoints = [];
38555 Util.each(points, function (point, index) {
38556 var nextPoint = points[index + 1];
38557 tmpPoints.push(point);
38558 if (nextPoint) {
38559 tmpPoints = tmpPoints.concat(fn(point, nextPoint));
38560 }
38561 });
38562 return tmpPoints;
38563}
38564// 插值的图形path,不考虑null
38565function _getInterPath(points) {
38566 var path = [];
38567 Util.each(points, function (point, index) {
38568 var subPath = index === 0 ? ['M', point.x, point.y] : ['L', point.x, point.y];
38569 path.push(subPath);
38570 });
38571 return path;
38572}
38573// 插值的图形
38574function _getInterPointShapeCfg(cfg, fn) {
38575 var points = _interpPoints(cfg.points, fn);
38576 return _getInterPath(points);
38577}
38578
38579function _markerFn(x, y, r, ctx) {
38580 ctx.moveTo(x - r, y);
38581 ctx.lineTo(x + r, y);
38582}
38583
38584function _smoothMarkerFn(x, y, r, ctx) {
38585 ctx.moveTo(x - r, y);
38586 ctx.arcTo(x - r / 2, y - r / 2, x, y, r / 2);
38587 ctx.lineTo(x, y);
38588 ctx.arcTo(x + r / 2, y + r / 2, x + r, y - r / 2, r / 2);
38589}
38590// get marker cfg
38591function _getMarkerCfg(cfg, smooth) {
38592 return Util.mix({
38593 symbol: smooth ? _smoothMarkerFn : _markerFn
38594 }, getMarkerAttrs(cfg));
38595}
38596
38597function _getInterMarkerCfg(cfg, fn) {
38598 return Util.mix({
38599 symbol: fn
38600 }, getMarkerAttrs(cfg));
38601}
38602
38603// 当只有一个数据时绘制点
38604function drawPointShape(shapeObj, cfg, container) {
38605 var point = cfg.points[0];
38606 return container.addShape('circle', {
38607 attrs: Util.mix({
38608 x: point.x,
38609 y: point.y,
38610 r: 2,
38611 fill: cfg.color
38612 }, cfg.style)
38613 });
38614}
38615
38616// regist line geom
38617var Line = Shape.registerFactory('line', {
38618 // 默认的shape
38619 defaultShapeType: 'line',
38620 getMarkerCfg: function getMarkerCfg(type, cfg) {
38621 var lineObj = Line[type] || Line.line;
38622 return lineObj.getMarkerCfg(cfg);
38623 },
38624 getActiveCfg: function getActiveCfg(type, cfg) {
38625 var lineWidth = cfg.lineWidth || 0;
38626 return {
38627 lineWidth: lineWidth + 1
38628 };
38629 },
38630
38631 // 计算点 如果存在多个点,分割成单个的点, 不考虑多个x对应一个y的情况
38632 getDefaultPoints: function getDefaultPoints(pointInfo) {
38633 return ShapeUtil.splitPoints(pointInfo);
38634 },
38635 drawShape: function drawShape(type, cfg, container) {
38636 var shape = this.getShape(type);
38637 var gShape = void 0;
38638 if (cfg.points.length === 1 && Global.showSinglePoint) {
38639 gShape = drawPointShape(this, cfg, container);
38640 } else {
38641 gShape = shape.draw(cfg, container);
38642 }
38643 if (gShape) {
38644 gShape.set('origin', cfg.origin);
38645 gShape._id = cfg.splitedIndex ? cfg._id + cfg.splitedIndex : cfg._id;
38646 gShape.name = this.name;
38647 }
38648 return gShape;
38649 }
38650});
38651
38652// draw line shape
38653Shape.registerShape('line', 'line', {
38654 draw: function draw(cfg, container) {
38655 var attrs = getAttrs(cfg);
38656 var path = getPath(cfg, false);
38657 return container.addShape('path', {
38658 attrs: Util.mix(attrs, {
38659 path: path
38660 })
38661 });
38662 },
38663 getMarkerCfg: function getMarkerCfg(cfg) {
38664 return _getMarkerCfg(cfg);
38665 }
38666});
38667
38668// 点线 ···
38669Shape.registerShape('line', 'dot', {
38670 draw: function draw(cfg, container) {
38671 var attrs = getAttrs(cfg);
38672 var path = getPath(cfg, false);
38673 return container.addShape('path', {
38674 attrs: Util.mix(attrs, {
38675 path: path,
38676 lineDash: DOT_ARR
38677 })
38678 });
38679 },
38680 getMarkerCfg: function getMarkerCfg(cfg) {
38681 var tmp = _getMarkerCfg(cfg, false);
38682 tmp.lineDash = DOT_ARR;
38683 return tmp;
38684 }
38685});
38686
38687// 断线 - - -
38688Shape.registerShape('line', 'dash', {
38689 draw: function draw(cfg, container) {
38690 var attrs = getAttrs(cfg);
38691 var path = getPath(cfg, false);
38692 return container.addShape('path', {
38693 attrs: Util.mix(attrs, {
38694 path: path,
38695 lineDash: DASH_ARR
38696 })
38697 });
38698 },
38699 getMarkerCfg: function getMarkerCfg(cfg) {
38700 var tmp = _getMarkerCfg(cfg, false);
38701 tmp.lineDash = DASH_ARR;
38702 return tmp;
38703 }
38704});
38705
38706// draw smooth line shape
38707Shape.registerShape('line', 'smooth', {
38708 draw: function draw(cfg, container) {
38709 var attrs = getAttrs(cfg);
38710 var coord = this._coord;
38711 // 曲线的限制
38712 cfg.constraint = [[coord.start.x, coord.end.y], [coord.end.x, coord.start.y]];
38713 var path = getPath(cfg, true);
38714 return container.addShape('path', {
38715 attrs: Util.mix(attrs, {
38716 path: path
38717 })
38718 });
38719 },
38720 getMarkerCfg: function getMarkerCfg(cfg) {
38721 return _getMarkerCfg(cfg, true);
38722 }
38723});
38724
38725Shape.registerShape('line', 'hv', {
38726 draw: function draw(cfg, container) {
38727 var attrs = getAttrs(cfg);
38728 var path = _getInterPointShapeCfg(cfg, function (point, nextPoint) {
38729 var tmp = [];
38730 tmp.push({
38731 x: nextPoint.x,
38732 y: point.y
38733 });
38734 return tmp;
38735 });
38736 return container.addShape('path', {
38737 attrs: Util.mix(attrs, {
38738 path: path
38739 })
38740 });
38741 },
38742 getMarkerCfg: function getMarkerCfg(cfg) {
38743 return _getInterMarkerCfg(cfg, function (x, y, r, ctx) {
38744 ctx.moveTo(x - r - 1, y - 2.5);
38745 ctx.lineTo(x, y - 2.5);
38746 ctx.lineTo(x, y + 2.5);
38747 ctx.lineTo(x + r + 1, y + 2.5);
38748 });
38749 }
38750});
38751
38752Shape.registerShape('line', 'vh', {
38753 draw: function draw(cfg, container) {
38754 var attrs = getAttrs(cfg);
38755 var path = _getInterPointShapeCfg(cfg, function (point, nextPoint) {
38756 var tmp = [];
38757 tmp.push({
38758 x: point.x,
38759 y: nextPoint.y
38760 });
38761 return tmp;
38762 });
38763 return container.addShape('path', {
38764 attrs: Util.mix(attrs, {
38765 path: path
38766 })
38767 });
38768 },
38769 getMarkerCfg: function getMarkerCfg(cfg) {
38770 return _getInterMarkerCfg(cfg, function (x, y, r, ctx) {
38771 ctx.moveTo(x - r - 1, y + 2.5);
38772 ctx.lineTo(x, y + 2.5);
38773 ctx.lineTo(x, y - 2.5);
38774 ctx.lineTo(x + r + 1, y - 2.5);
38775 });
38776 }
38777});
38778
38779Shape.registerShape('line', 'hvh', {
38780 draw: function draw(cfg, container) {
38781 var attrs = getAttrs(cfg);
38782 var path = _getInterPointShapeCfg(cfg, function (point, nextPoint) {
38783 var tmp = [];
38784 var middlex = (nextPoint.x - point.x) / 2 + point.x;
38785 tmp.push({
38786 x: middlex,
38787 y: point.y
38788 });
38789 tmp.push({
38790 x: middlex,
38791 y: nextPoint.y
38792 });
38793 return tmp;
38794 });
38795 return container.addShape('path', {
38796 attrs: Util.mix(attrs, {
38797 path: path
38798 })
38799 });
38800 },
38801 getMarkerCfg: function getMarkerCfg(cfg) {
38802 return _getInterMarkerCfg(cfg, function (x, y, r, ctx) {
38803 ctx.moveTo(x - (r + 1), y + 2.5);
38804 ctx.lineTo(x - r / 2, y + 2.5);
38805 ctx.lineTo(x - r / 2, y - 2.5);
38806 ctx.lineTo(x + r / 2, y - 2.5);
38807 ctx.lineTo(x + r / 2, y + 2.5);
38808 ctx.lineTo(x + r + 1, y + 2.5);
38809 });
38810 }
38811});
38812
38813Shape.registerShape('line', 'vhv', {
38814 draw: function draw(cfg, container) {
38815 var attrs = getAttrs(cfg);
38816 var path = _getInterPointShapeCfg(cfg, function (point, nextPoint) {
38817 var tmp = [];
38818 var middley = (nextPoint.y - point.y) / 2 + point.y;
38819 tmp.push({
38820 x: point.x,
38821 y: middley
38822 });
38823 tmp.push({
38824 x: nextPoint.x,
38825 y: middley
38826 });
38827 return tmp;
38828 });
38829 return container.addShape('path', {
38830 attrs: Util.mix(attrs, {
38831 path: path
38832 })
38833 });
38834 },
38835 getMarkerCfg: function getMarkerCfg(cfg) {
38836 return _getInterMarkerCfg(cfg, function (x, y, r, ctx) {
38837 // 宽 13px,高 8px
38838 ctx.moveTo(x - 5, y + 2.5);
38839 ctx.lineTo(x - 5, y);
38840 ctx.lineTo(x, y);
38841 ctx.lineTo(x, y - 3);
38842 ctx.lineTo(x, y + 3);
38843 ctx.lineTo(x + 6.5, y + 3);
38844 });
38845 }
38846});
38847
38848Line.spline = Line.smooth;
38849
38850module.exports = Line;
38851
38852/***/ }),
38853/* 307 */
38854/***/ (function(module, exports, __webpack_require__) {
38855
38856/**
38857 * @fileOverview point shapes
38858 * @author dxq613@gmail.com
38859 * @author sima.zhang1990@gmail.com
38860 * @author huangtonger@aliyun.com
38861 */
38862
38863var Util = __webpack_require__(0);
38864var ShapeUtil = __webpack_require__(67);
38865var Marker = __webpack_require__(2).Marker;
38866var Global = __webpack_require__(1);
38867var Shape = __webpack_require__(10);
38868var SHAPES = ['circle', 'square', 'bowtie', 'diamond', 'hexagon', 'triangle', 'triangle-down'];
38869var HOLLOW_SHAPES = ['cross', 'tick', 'plus', 'hyphen', 'line', 'pointerLine', 'pointerArrow'];
38870var SQRT_3 = Math.sqrt(3);
38871
38872// 增加marker
38873Util.mix(Marker.Symbols, {
38874 hexagon: function hexagon(x, y, r, ctx) {
38875 var diffX = r / 2 * SQRT_3;
38876 ctx.moveTo(x, y - r);
38877 ctx.lineTo(x + diffX, y - r / 2);
38878 ctx.lineTo(x + diffX, y + r / 2);
38879 ctx.lineTo(x, y + r);
38880 ctx.lineTo(x - diffX, y + r / 2);
38881 ctx.lineTo(x - diffX, y - r / 2);
38882 ctx.closePath();
38883 },
38884 bowtie: function bowtie(x, y, r, ctx) {
38885 var diffY = r - 1.5;
38886 ctx.moveTo(x - r, y - diffY);
38887 ctx.lineTo(x + r, y + diffY);
38888 ctx.lineTo(x + r, y - diffY);
38889 ctx.lineTo(x - r, y + diffY);
38890 ctx.closePath();
38891 },
38892 cross: function cross(x, y, r, ctx) {
38893 ctx.moveTo(x - r, y - r);
38894 ctx.lineTo(x + r, y + r);
38895 ctx.moveTo(x + r, y - r);
38896 ctx.lineTo(x - r, y + r);
38897 },
38898 tick: function tick(x, y, r, ctx) {
38899 ctx.moveTo(x - r / 2, y - r);
38900 ctx.lineTo(x + r / 2, y - r);
38901 ctx.moveTo(x, y - r);
38902 ctx.lineTo(x, y + r);
38903 ctx.moveTo(x - r / 2, y + r);
38904 ctx.lineTo(x + r / 2, y + r);
38905 },
38906 plus: function plus(x, y, r, ctx) {
38907 ctx.moveTo(x - r, y);
38908 ctx.lineTo(x + r, y);
38909 ctx.moveTo(x, y - r);
38910 ctx.lineTo(x, y + r);
38911 },
38912 hyphen: function hyphen(x, y, r, ctx) {
38913 ctx.moveTo(x - r, y);
38914 ctx.lineTo(x + r, y);
38915 },
38916 line: function line(x, y, r, ctx) {
38917 ctx.moveTo(x, y - r);
38918 ctx.lineTo(x, y + r);
38919 }
38920});
38921
38922function getFillAttrs(cfg) {
38923 var defaultAttrs = Global.shape.point;
38924 var pointAttrs = Util.mix({}, defaultAttrs, {
38925 fill: cfg.color,
38926 fillOpacity: cfg.opacity,
38927 radius: cfg.size
38928 }, cfg.style);
38929 return pointAttrs;
38930}
38931
38932function getLineAttrs(cfg) {
38933 var defaultAttrs = Global.shape.hollowPoint;
38934 var pointAttrs = Util.mix({}, defaultAttrs, {
38935 stroke: cfg.color,
38936 strokeOpacity: cfg.opacity,
38937 radius: cfg.size
38938 }, cfg.style);
38939 return pointAttrs;
38940}
38941
38942var Point = Shape.registerFactory('point', {
38943 defaultShapeType: 'hollowCircle',
38944 getActiveCfg: function getActiveCfg(type, cfg) {
38945 // 点放大 + 颜色加亮
38946 var radius = cfg.radius;
38947 var color = void 0;
38948 if (type && (type.indexOf('hollow') === 0 || Util.indexOf(HOLLOW_SHAPES, type) !== -1) || !type) {
38949 color = cfg.stroke || cfg.strokeStyle;
38950 } else {
38951 color = cfg.fill || cfg.fillStyle;
38952 }
38953
38954 return {
38955 radius: radius + 1,
38956 shadowBlur: radius,
38957 shadowColor: color,
38958 stroke: color,
38959 strokeStyle: color,
38960 strokeOpacity: 1,
38961 lineWidth: 1
38962 };
38963 },
38964 getDefaultPoints: function getDefaultPoints(pointInfo) {
38965 return ShapeUtil.splitPoints(pointInfo);
38966 }
38967});
38968
38969function getRectPath(cfg) {
38970 var x = cfg.points[0].x;
38971 var y = cfg.points[0].y;
38972 var w = cfg.size[0];
38973 var h = cfg.size[1];
38974 var path = [['M', x - 0.5 * w, y - 0.5 * h], ['L', x + 0.5 * w, y - 0.5 * h], ['L', x + 0.5 * w, y + 0.5 * h], ['L', x - 0.5 * w, y + 0.5 * h], ['z']];
38975 return path;
38976}
38977
38978// 用于桑基图的节点
38979Shape.registerShape('point', 'rect', {
38980 draw: function draw(cfg, container) {
38981 var rectAttrs = getFillAttrs(cfg);
38982 var path = getRectPath(cfg);
38983 path = this.parsePath(path);
38984 var gShape = container.addShape('path', {
38985 attrs: Util.mix(rectAttrs, {
38986 path: path
38987 })
38988 });
38989 return gShape;
38990 },
38991 getMarkerCfg: function getMarkerCfg(cfg) {
38992 var attrs = getFillAttrs(cfg);
38993 attrs.symbol = 'rect';
38994 attrs.radius = 4.5;
38995 return attrs;
38996 }
38997});
38998
38999// 添加shapes
39000Util.each(SHAPES, function (shape) {
39001 Shape.registerShape('point', shape, {
39002 draw: function draw(cfg, container) {
39003 // cfg.points = this.parsePoints(cfg.points);
39004 var attrs = getFillAttrs(cfg);
39005 return container.addShape('Marker', {
39006 attrs: Util.mix(attrs, {
39007 symbol: shape,
39008 x: cfg.x,
39009 y: cfg.y
39010 })
39011 });
39012 },
39013 getMarkerCfg: function getMarkerCfg(cfg) {
39014 var attrs = getFillAttrs(cfg);
39015 attrs.symbol = shape;
39016 attrs.radius = 4.5;
39017 return attrs;
39018 }
39019 });
39020 // 添加该 shape 对应的 hollowShape
39021 Shape.registerShape('point', 'hollow' + Util.upperFirst(shape), {
39022 draw: function draw(cfg, container) {
39023 // cfg.points = this.parsePoints(cfg.points);
39024 var attrs = getLineAttrs(cfg);
39025 return container.addShape('Marker', {
39026 attrs: Util.mix(attrs, {
39027 symbol: shape,
39028 x: cfg.x,
39029 y: cfg.y
39030 })
39031 });
39032 },
39033 getMarkerCfg: function getMarkerCfg(cfg) {
39034 var attrs = getLineAttrs(cfg);
39035 attrs.symbol = shape;
39036 attrs.radius = 4.5;
39037 return attrs;
39038 }
39039 });
39040});
39041
39042// 添加 hollowShapes
39043Util.each(HOLLOW_SHAPES, function (shape) {
39044 Shape.registerShape('point', shape, {
39045 draw: function draw(cfg, container) {
39046 var attrs = getLineAttrs(cfg);
39047 return container.addShape('Marker', {
39048 attrs: Util.mix(attrs, {
39049 symbol: shape,
39050 x: cfg.x,
39051 y: cfg.y
39052 })
39053 });
39054 },
39055 getMarkerCfg: function getMarkerCfg(cfg) {
39056 var attrs = getLineAttrs(cfg);
39057 attrs.symbol = shape;
39058 attrs.radius = 4.5;
39059 return attrs;
39060 }
39061 });
39062});
39063
39064module.exports = Point;
39065
39066/***/ }),
39067/* 308 */
39068/***/ (function(module, exports, __webpack_require__) {
39069
39070/**
39071 * @fileOverview line shapes
39072 * @author dxq613@gmail.com
39073 * @author sima.zhang1990@gmail.com
39074 * @author huangtonger@aliyun.com
39075 */
39076
39077var Util = __webpack_require__(0);
39078var Shape = __webpack_require__(10);
39079var Global = __webpack_require__(1);
39080
39081function getAttrs(cfg) {
39082 var defaultCfg = Global.shape.polygon;
39083 var shapeCfg = Util.mix({}, defaultCfg, {
39084 stroke: cfg.color,
39085 fill: cfg.color,
39086 fillOpacity: cfg.opacity
39087 }, cfg.style);
39088 return shapeCfg;
39089}
39090
39091function getHollowAttrs(cfg) {
39092 var defaultCfg = Global.shape.hollowPolygon;
39093 var shapeCfg = Util.mix({}, defaultCfg, {
39094 stroke: cfg.color,
39095 strokeOpacity: cfg.opacity
39096 }, cfg.style);
39097 return shapeCfg;
39098}
39099function getPath(points) {
39100 var path = [];
39101 var flag = [points[0].x, points[0].y];
39102 var flagIndex = 0;
39103 var lastStartPoint = points[0];
39104 Util.each(points, function (obj, index) {
39105 var subPath = index === 0 ? ['M', obj.x, obj.y] : ['L', obj.x, obj.y];
39106 path.push(subPath);
39107 if (flagIndex !== index && index < points.length - 1 && Util.isEqualWith(flag, [obj.x, obj.y])) {
39108 var nextPoint = points[index + 1];
39109 path.push(['Z']);
39110 path.push(['M', nextPoint.x, nextPoint.y]);
39111 lastStartPoint = nextPoint;
39112 flagIndex = index + 1;
39113 flag = [nextPoint.x, nextPoint.y];
39114 }
39115 });
39116 path.push(['L', lastStartPoint.x, lastStartPoint.y]);
39117 path.push(['Z']);
39118 // console.log(Util.map(path, points => points.join('')).join(''));
39119 return path;
39120}
39121
39122// regist line geom
39123var Polygon = Shape.registerFactory('polygon', {
39124 defaultShapeType: 'polygon',
39125 getDefaultPoints: function getDefaultPoints(pointInfo) {
39126 var points = [];
39127 Util.each(pointInfo.x, function (subX, index) {
39128 var subY = pointInfo.y[index];
39129 points.push({
39130 x: subX,
39131 y: subY
39132 });
39133 });
39134 return points;
39135 },
39136 getActiveCfg: function getActiveCfg(type, cfg) {
39137 var lineWidth = cfg.lineWidth || 1;
39138 if (type === 'hollow') {
39139 return {
39140 lineWidth: lineWidth + 1
39141 };
39142 }
39143
39144 var opacity = cfg.fillOpacity || cfg.opacity || 1;
39145 return {
39146 // lineWidth,
39147 fillOpacity: opacity - 0.08
39148 };
39149 },
39150 getSelectedCfg: function getSelectedCfg(type, cfg) {
39151 if (cfg && cfg.style) {
39152 return cfg.style;
39153 }
39154 return this.getActiveCfg(type, cfg);
39155 }
39156});
39157
39158Shape.registerShape('polygon', 'polygon', {
39159 draw: function draw(cfg, container) {
39160 if (!Util.isEmpty(cfg.points)) {
39161 var attrs = getAttrs(cfg);
39162 var path = getPath(cfg.points);
39163 path = this.parsePath(path);
39164 return container.addShape('path', {
39165 attrs: Util.mix(attrs, {
39166 path: path
39167 })
39168 });
39169 }
39170 },
39171 getMarkerCfg: function getMarkerCfg(cfg) {
39172 return Util.mix({
39173 symbol: 'square',
39174 radius: 4
39175 }, getAttrs(cfg));
39176 }
39177});
39178
39179Shape.registerShape('polygon', 'hollow', {
39180 draw: function draw(cfg, container) {
39181 if (!Util.isEmpty(cfg.points)) {
39182 var attrs = getHollowAttrs(cfg);
39183 var path = getPath(cfg.points);
39184 path = this.parsePath(path);
39185
39186 return container.addShape('path', {
39187 attrs: Util.mix(attrs, {
39188 path: path
39189 })
39190 });
39191 }
39192 },
39193 getMarkerCfg: function getMarkerCfg(cfg) {
39194 return Util.mix({
39195 symbol: 'square',
39196 radius: 4
39197 }, getAttrs(cfg));
39198 }
39199});
39200
39201module.exports = Polygon;
39202
39203/***/ }),
39204/* 309 */
39205/***/ (function(module, exports, __webpack_require__) {
39206
39207/**
39208 * @fileOverview 自定义的 shape
39209 * @author dxq613@gmail.com
39210 * @author sima.zhang1990@gmail.com
39211 */
39212
39213var Util = __webpack_require__(0);
39214var Shape = __webpack_require__(10);
39215var Global = __webpack_require__(1);
39216
39217function _parseValue(value) {
39218 if (!Util.isArray(value)) {
39219 value = [value];
39220 }
39221 var min = value[0]; // 最小值
39222 var max = value[value.length - 1]; // 最大值
39223 var min1 = value.length > 1 ? value[1] : min;
39224 var max1 = value.length > 3 ? value[3] : max;
39225 var median = value.length > 2 ? value[2] : min1;
39226
39227 return {
39228 min: min, // 最小值
39229 max: max, // 最大值
39230 min1: min1,
39231 max1: max1,
39232 median: median
39233 };
39234}
39235
39236function addPoints(from, to) {
39237 Util.each(from, function (subArr) {
39238 to.push({
39239 x: subArr[0],
39240 y: subArr[1]
39241 });
39242 });
39243}
39244
39245function getAttrs(cfg) {
39246 var defaultAttrs = Global.shape.schema;
39247 var attrs = Util.mix({}, defaultAttrs, {
39248 stroke: cfg.color,
39249 strokeOpacity: cfg.opacity
39250 }, cfg.style);
39251 return attrs;
39252}
39253
39254function getFillAttrs(cfg) {
39255 var defaultAttrs = Global.shape.schema;
39256 var attrs = Util.mix({}, defaultAttrs, {
39257 fill: cfg.color,
39258 stroke: cfg.color,
39259 fillOpacity: cfg.opacity
39260 }, cfg.style);
39261 return attrs;
39262}
39263
39264function getBoxPoints(x, y, width) {
39265 var points = [];
39266 var pointsArray = void 0;
39267 var obj = void 0;
39268 if (Util.isArray(y)) {
39269 // 2维
39270 obj = _parseValue(y);
39271 pointsArray = [[x - width / 2, obj.max], [x + width / 2, obj.max], [x, obj.max], [x, obj.max1], [x - width / 2, obj.min1], [x - width / 2, obj.max1], [x + width / 2, obj.max1], [x + width / 2, obj.min1], [x, obj.min1], [x, obj.min], [x - width / 2, obj.min], [x + width / 2, obj.min], [x - width / 2, obj.median], [x + width / 2, obj.median]];
39272 } else {
39273 // 只有一个维度
39274 y = y || 0.5;
39275 obj = _parseValue(x);
39276 pointsArray = [[obj.min, y - width / 2], [obj.min, y + width / 2], [obj.min, y], [obj.min1, y], [obj.min1, y - width / 2], [obj.min1, y + width / 2], [obj.max1, y + width / 2], [obj.max1, y - width / 2], [obj.max1, y], [obj.max, y], [obj.max, y - width / 2], [obj.max, y + width / 2], [obj.median, y - width / 2], [obj.median, y + width / 2]];
39277 }
39278 addPoints(pointsArray, points);
39279 return points;
39280}
39281
39282function _sortValue(value) {
39283 if (!Util.isArray(value)) {
39284 value = [value];
39285 }
39286 // 从大到小排序
39287 var sorted = value.sort(function (a, b) {
39288 return a < b ? 1 : -1;
39289 });
39290
39291 var length = sorted.length;
39292 if (length < 4) {
39293 var min = sorted[length - 1];
39294 for (var i = 0; i < 4 - length; i++) {
39295 sorted.push(min);
39296 }
39297 }
39298
39299 return sorted;
39300}
39301
39302// 获取K线图的points
39303function getCandlePoints(x, y, width) {
39304 var yValues = _sortValue(y);
39305 var points = [{
39306 x: x,
39307 y: yValues[0]
39308 }, {
39309 x: x,
39310 y: yValues[1]
39311 }, {
39312 x: x - width / 2,
39313 y: yValues[2]
39314 }, {
39315 x: x - width / 2,
39316 y: yValues[1]
39317 }, {
39318 x: x + width / 2,
39319 y: yValues[1]
39320 }, {
39321 x: x + width / 2,
39322 y: yValues[2]
39323 }, {
39324 x: x,
39325 y: yValues[2]
39326 }, {
39327 x: x,
39328 y: yValues[3]
39329 }]; // 按照顺时针连接
39330 return points;
39331}
39332
39333function getBoxPath(points) {
39334 var path = [['M', points[0].x, points[0].y], ['L', points[1].x, points[1].y], ['M', points[2].x, points[2].y], ['L', points[3].x, points[3].y], ['M', points[4].x, points[4].y], ['L', points[5].x, points[5].y], ['L', points[6].x, points[6].y], ['L', points[7].x, points[7].y], ['L', points[4].x, points[4].y], // 封闭 z
39335 ['Z'], ['M', points[8].x, points[8].y], ['L', points[9].x, points[9].y], ['M', points[10].x, points[10].y], ['L', points[11].x, points[11].y], ['M', points[12].x, points[12].y], ['L', points[13].x, points[13].y]];
39336 return path;
39337}
39338
39339function getCandlePath(points) {
39340 var path = [['M', points[0].x, points[0].y], ['L', points[1].x, points[1].y], ['M', points[2].x, points[2].y], ['L', points[3].x, points[3].y], ['L', points[4].x, points[4].y], ['L', points[5].x, points[5].y], ['Z'], ['M', points[6].x, points[6].y], ['L', points[7].x, points[7].y]];
39341 return path;
39342}
39343
39344var Schema = Shape.registerFactory('schema', {
39345 defaultShapeType: '',
39346 getActiveCfg: function getActiveCfg(type, cfg) {
39347 if (type === 'box') {
39348 var lineWidth = cfg.lineWidth || 1;
39349 return {
39350 lineWidth: lineWidth + 1
39351 };
39352 }
39353 var opacity = cfg.fillOpacity || cfg.opacity || 1;
39354 return {
39355 fillOpacity: opacity - 0.15,
39356 strokeOpacity: opacity - 0.15
39357 };
39358 },
39359 getSelectedCfg: function getSelectedCfg(type, cfg) {
39360 if (cfg && cfg.style) {
39361 return cfg.style;
39362 }
39363 return this.getActiveCfg(type, cfg);
39364 }
39365});
39366
39367// 箱线图
39368Shape.registerShape('schema', 'box', {
39369 getPoints: function getPoints(pointInfo) {
39370 return getBoxPoints(pointInfo.x, pointInfo.y, pointInfo.size);
39371 },
39372 draw: function draw(cfg, container) {
39373 var attrs = getAttrs(cfg);
39374 var path = getBoxPath(cfg.points);
39375 path = this.parsePath(path);
39376 return container.addShape('path', {
39377 attrs: Util.mix(attrs, {
39378 path: path
39379 })
39380 });
39381 },
39382 getMarkerCfg: function getMarkerCfg(cfg) {
39383 return {
39384 symbol: function symbol(x, y, r, ctx) {
39385 var yValues = [y - 6, y - 3, y, y + 3, y + 6];
39386 var points = getBoxPoints(x, yValues, r);
39387 ctx.moveTo(points[0].x + 1, points[0].y);
39388 ctx.lineTo(points[1].x - 1, points[1].y);
39389 ctx.moveTo(points[2].x, points[2].y);
39390 ctx.lineTo(points[3].x, points[3].y);
39391 ctx.moveTo(points[4].x, points[4].y);
39392 ctx.lineTo(points[5].x, points[5].y);
39393 ctx.lineTo(points[6].x, points[6].y);
39394 ctx.lineTo(points[7].x, points[7].y);
39395 ctx.lineTo(points[4].x, points[4].y);
39396 ctx.closePath();
39397 ctx.moveTo(points[8].x, points[8].y);
39398 ctx.lineTo(points[9].x, points[9].y);
39399 ctx.moveTo(points[10].x + 1, points[10].y);
39400 ctx.lineTo(points[11].x - 1, points[11].y);
39401 ctx.moveTo(points[12].x, points[12].y);
39402 ctx.lineTo(points[13].x, points[13].y);
39403 },
39404
39405 radius: 6,
39406 lineWidth: 1,
39407 stroke: cfg.color
39408 };
39409 }
39410});
39411
39412// K线
39413Shape.registerShape('schema', 'candle', {
39414 getPoints: function getPoints(pointInfo) {
39415 return getCandlePoints(pointInfo.x, pointInfo.y, pointInfo.size);
39416 },
39417 draw: function draw(cfg, container) {
39418 var attrs = getFillAttrs(cfg);
39419 var path = getCandlePath(cfg.points);
39420 path = this.parsePath(path);
39421 return container.addShape('path', {
39422 attrs: Util.mix(attrs, {
39423 path: path
39424 })
39425 });
39426 },
39427 getMarkerCfg: function getMarkerCfg(cfg) {
39428 return {
39429 symbol: function symbol(x, y, r, ctx) {
39430 y = [y + 7.5, y + 3, y - 3, y - 7.5];
39431 var points = getCandlePoints(x, y, r);
39432 ctx.moveTo(points[0].x, points[0].y);
39433 ctx.lineTo(points[1].x, points[1].y);
39434 ctx.moveTo(points[2].x, points[2].y);
39435 ctx.lineTo(points[3].x, points[3].y);
39436 ctx.lineTo(points[4].x, points[4].y);
39437 ctx.lineTo(points[5].x, points[5].y);
39438 ctx.closePath();
39439 ctx.moveTo(points[6].x, points[6].y);
39440 ctx.lineTo(points[7].x, points[7].y);
39441 },
39442
39443 lineWidth: 1,
39444 stroke: cfg.color,
39445 fill: cfg.color,
39446 radius: 6
39447 };
39448 }
39449});
39450
39451module.exports = Schema;
39452
39453/***/ }),
39454/* 310 */
39455/***/ (function(module, exports, __webpack_require__) {
39456
39457/**
39458 * @fileOverview The tooltip handler
39459 * @author sima.zhang
39460 */
39461var Util = __webpack_require__(0);
39462
39463var _require = __webpack_require__(1),
39464 defaultColor = _require.defaultColor;
39465
39466var FIELD_ORIGIN = '_origin';
39467
39468function getScaleName(scale) {
39469 return scale.alias || scale.field;
39470}
39471
39472var TooltipMixin = {
39473 _snapEqual: function _snapEqual(v1, v2, scale) {
39474 var equals = void 0;
39475 v1 = scale.translate(v1);
39476 v2 = scale.translate(v2);
39477
39478 if (scale.isCategory) {
39479 equals = v1 === v2;
39480 } else {
39481 equals = Util.snapEqual(v1, v2);
39482 }
39483 return equals;
39484 },
39485 _getScaleValueByPoint: function _getScaleValueByPoint(point) {
39486 var result = 0;
39487 var coord = this.get('coord');
39488 var xScale = this.getXScale();
39489 var invertPoint = coord.invert(point);
39490 var xValue = invertPoint.x;
39491
39492 if (this.isInCircle() && xValue > (1 + xScale.rangeMax()) / 2) {
39493 xValue = xScale.rangeMin(); // 极坐标下,scale 的 range 被做过特殊处理 see view.js#L88
39494 }
39495 result = xScale.invert(xValue);
39496
39497 if (xScale.isCategory) {
39498 result = xScale.translate(result); // 防止分类类型
39499 }
39500
39501 return result;
39502 },
39503 _getOriginByPoint: function _getOriginByPoint(point) {
39504 var xScale = this.getXScale();
39505 var yScale = this.getYScale();
39506 var xField = xScale.field;
39507 var yField = yScale.field;
39508 var coord = this.get('coord');
39509 var invertPoint = coord.invert(point);
39510 var xValue = xScale.invert(invertPoint.x);
39511 var yValue = yScale.invert(invertPoint.y);
39512
39513 var result = {};
39514 result[xField] = xValue;
39515 result[yField] = yValue;
39516 return result;
39517 },
39518 _getScale: function _getScale(field) {
39519 var self = this;
39520 var scales = self.get('scales');
39521 var rst = null;
39522
39523 Util.each(scales, function (scale) {
39524 if (scale.field === field) {
39525 rst = scale;
39526 return false;
39527 }
39528 });
39529 return rst;
39530 },
39531
39532
39533 // 获取值对应的度量
39534 _getTipValueScale: function _getTipValueScale() {
39535 var attrs = this.getAttrsForLegend();
39536 var scale = void 0;
39537 Util.each(attrs, function (attr) {
39538 var tmpScale = attr.getScale(attr.type);
39539 if (tmpScale.isLinear) {
39540 // 如果指定字段是非position的,同时是连续的
39541 scale = tmpScale;
39542 return false;
39543 }
39544 });
39545
39546 var xScale = this.getXScale();
39547 var yScale = this.getYScale();
39548
39549 if (!scale && yScale && yScale.field === '..y') {
39550 return xScale;
39551 }
39552
39553 return scale || yScale || xScale;
39554 },
39555 _getTipTitleScale: function _getTipTitleScale(titleField) {
39556 var self = this;
39557 if (titleField) {
39558 return self._getScale(titleField);
39559 }
39560 var position = self.getAttr('position');
39561 var fields = position.getFields();
39562 var tmpField = void 0;
39563 Util.each(fields, function (field) {
39564 if (field.indexOf('..') === -1) {
39565 tmpField = field;
39566 return false;
39567 }
39568 });
39569 return self._getScale(tmpField);
39570 },
39571 _filterValue: function _filterValue(arr, point) {
39572 var coord = this.get('coord');
39573 var yScale = this.getYScale();
39574 var yField = yScale.field;
39575 var invertPoint = coord.invert(point);
39576 var yValue = invertPoint.y;
39577 yValue = yScale.invert(yValue);
39578 var rst = arr[arr.length - 1];
39579
39580 Util.each(arr, function (obj) {
39581 var origin = obj[FIELD_ORIGIN];
39582 if (origin[yField][0] <= yValue && origin[yField][1] >= yValue) {
39583 rst = obj;
39584 return false;
39585 }
39586 });
39587 return rst;
39588 },
39589 getXDistance: function getXDistance() {
39590 var self = this;
39591 var distance = self.get('xDistance');
39592 if (!distance) {
39593 var xScale = self.getXScale();
39594 if (xScale.isCategory) {
39595 distance = 1;
39596 } else {
39597 var values = xScale.values; // values 是无序的
39598 var min = xScale.translate(values[0]);
39599 var max = min;
39600 Util.each(values, function (value) {
39601 // 时间类型需要 translate
39602 value = xScale.translate(value);
39603 if (value < min) {
39604 min = value;
39605 }
39606 if (value > max) {
39607 max = value;
39608 }
39609 });
39610 var length = values.length;
39611 // 应该是除以 length - 1
39612 distance = (max - min) / (length - 1);
39613 }
39614 self.set('xDistance', distance);
39615 }
39616
39617 return distance;
39618 },
39619 findPoint: function findPoint(point, dataArray) {
39620 var self = this;
39621 var type = self.get('type');
39622 var xScale = self.getXScale();
39623 var yScale = self.getYScale();
39624 var xField = xScale.field;
39625 var yField = yScale.field;
39626 var rst = null;
39627
39628 if (Util.indexOf(['heatmap'], type) > -1) {
39629 var coord = self.get('coord');
39630 var invertPoint = coord.invert(point);
39631 var xValue = xScale.invert(invertPoint.x);
39632 var yValue = yScale.invert(invertPoint.y);
39633 var min = Infinity;
39634 Util.each(dataArray, function (obj) {
39635 var distance = Math.pow(obj[FIELD_ORIGIN][xField] - xValue, 2) + Math.pow(obj[FIELD_ORIGIN][yField] - yValue, 2);
39636 if (distance < min) {
39637 min = distance;
39638 rst = obj;
39639 }
39640 });
39641 return rst;
39642 }
39643
39644 var first = dataArray[0];
39645 var last = dataArray[dataArray.length - 1];
39646
39647 if (!first) {
39648 return rst;
39649 }
39650
39651 var value = self._getScaleValueByPoint(point); // 根据该点获得对应度量后数据的值
39652 var firstXValue = first[FIELD_ORIGIN][xField];
39653 var firstYValue = first[FIELD_ORIGIN][yField];
39654 var lastXValue = last[FIELD_ORIGIN][xField];
39655 var isYRange = yScale.isLinear && Util.isArray(firstYValue); // 考虑 x 维度相同,y 是数组区间的情况
39656
39657 // 如果x的值是数组
39658 if (Util.isArray(firstXValue)) {
39659 Util.each(dataArray, function (record) {
39660 var origin = record[FIELD_ORIGIN];
39661 if (xScale.translate(origin[xField][0]) <= value && xScale.translate(origin[xField][1]) >= value) {
39662 if (isYRange) {
39663 if (!Util.isArray(rst)) {
39664 rst = [];
39665 }
39666 rst.push(record);
39667 } else {
39668 rst = record;
39669 return false;
39670 }
39671 }
39672 });
39673 if (Util.isArray(rst)) {
39674 rst = this._filterValue(rst, point);
39675 }
39676 } else {
39677 var next = void 0;
39678 if (!xScale.isLinear && xScale.type !== 'timeCat') {
39679 Util.each(dataArray, function (record, index) {
39680 var origin = record[FIELD_ORIGIN];
39681 if (self._snapEqual(origin[xField], value, xScale)) {
39682 if (isYRange) {
39683 if (!Util.isArray(rst)) {
39684 rst = [];
39685 }
39686 rst.push(record);
39687 } else {
39688 rst = record;
39689 return false;
39690 }
39691 } else if (xScale.translate(origin[xField]) <= value) {
39692 last = record;
39693 next = dataArray[index + 1];
39694 }
39695 });
39696
39697 if (Util.isArray(rst)) {
39698 rst = this._filterValue(rst, point);
39699 }
39700 } else {
39701 if ((value > xScale.translate(lastXValue) || value < xScale.translate(firstXValue)) && (value > xScale.max || value < xScale.min)) {
39702 return null;
39703 }
39704
39705 var firstIdx = 0;
39706 var lastIdx = dataArray.length - 1;
39707 var middleIdx = void 0;
39708 while (firstIdx <= lastIdx) {
39709 middleIdx = Math.floor((firstIdx + lastIdx) / 2);
39710 var item = dataArray[middleIdx][FIELD_ORIGIN][xField];
39711 if (self._snapEqual(item, value, xScale)) {
39712 return dataArray[middleIdx];
39713 }
39714
39715 if (xScale.translate(item) <= xScale.translate(value)) {
39716 firstIdx = middleIdx + 1;
39717 last = dataArray[middleIdx];
39718 next = dataArray[middleIdx + 1];
39719 } else {
39720 if (lastIdx === 0) {
39721 last = dataArray[0];
39722 }
39723 lastIdx = middleIdx - 1;
39724 }
39725 }
39726 }
39727
39728 if (last && next) {
39729 // 计算最逼近的
39730 if (Math.abs(xScale.translate(last[FIELD_ORIGIN][xField]) - value) > Math.abs(xScale.translate(next[FIELD_ORIGIN][xField]) - value)) {
39731 last = next;
39732 }
39733 }
39734 }
39735
39736 var distance = self.getXDistance(); // 每个分类间的平均间距
39737 if (!rst && Math.abs(xScale.translate(last[FIELD_ORIGIN][xField]) - value) <= distance / 2) {
39738 rst = last;
39739 }
39740
39741 return rst;
39742 },
39743
39744 /**
39745 * @protected
39746 * 获取tooltip的标题
39747 * @param {Object} origin 点的原始信息
39748 * @param {String} titleField 标题的字段
39749 * @return {String} 提示信息的标题
39750 */
39751 getTipTitle: function getTipTitle(origin, titleField) {
39752 var tipTitle = '';
39753 var titleScale = this._getTipTitleScale(titleField);
39754
39755 if (titleScale) {
39756 var value = origin[titleScale.field];
39757 tipTitle = titleScale.getText(value);
39758 } else if (this.get('type') === 'heatmap') {
39759 // 热力图在不存在 title 的时候特殊处理
39760 var xScale = this.getXScale();
39761 var yScale = this.getYScale();
39762 var xValue = xScale.getText(origin[xScale.field]);
39763 var yValue = yScale.getText(origin[yScale.field]);
39764
39765 tipTitle = '( ' + xValue + ', ' + yValue + ' )';
39766 }
39767 return tipTitle;
39768 },
39769 getTipValue: function getTipValue(origin, valueScale) {
39770 var value = void 0;
39771 var field = valueScale.field;
39772 value = origin[field];
39773
39774 if (Util.isArray(value)) {
39775 var tmp = [];
39776 Util.each(value, function (sub) {
39777 tmp.push(valueScale.getText(sub));
39778 });
39779 value = tmp.join('-');
39780 } else {
39781 value = valueScale.getText(value);
39782 }
39783 return value;
39784 },
39785
39786 /**
39787 * @protected
39788 * 获取tooltip的名称
39789 * @param {Object} origin 点的原始信息
39790 * @return {String} 提示信息的名称
39791 */
39792 getTipName: function getTipName(origin) {
39793 var name = void 0;
39794 var nameScale = void 0;
39795 var groupScales = this._getGroupScales();
39796 if (groupScales.length) {
39797 // 如果存在分组类型,取第一个分组类型
39798 Util.each(groupScales, function (scale) {
39799 nameScale = scale;
39800 return false;
39801 });
39802 }
39803 if (nameScale) {
39804 var field = nameScale.field;
39805 name = nameScale.getText(origin[field]);
39806 } else {
39807 var valueScale = this._getTipValueScale();
39808 name = getScaleName(valueScale);
39809 }
39810 return name;
39811 },
39812
39813 /**
39814 * 获取点对应tooltip的信息
39815 * @protected
39816 * @param {Object} point 原始的数据记录
39817 * @param {String} titleField tooltipTitle 配置信息
39818 * @return {Array} 一条或者多条记录
39819 */
39820 getTipItems: function getTipItems(point, titleField) {
39821 var self = this;
39822 var origin = point[FIELD_ORIGIN];
39823 var tipTitle = self.getTipTitle(origin, titleField);
39824 var tooltipCfg = self.get('tooltipCfg');
39825 var items = [];
39826 var name = void 0;
39827 var value = void 0;
39828
39829 function addItem(itemName, itemValue, cfg) {
39830 if (!Util.isNil(itemValue) && itemValue !== '') {
39831 // 值为null的时候,忽视
39832 var item = {
39833 title: tipTitle,
39834 point: point,
39835 name: itemName || tipTitle,
39836 value: itemValue,
39837 color: point.color || defaultColor,
39838 marker: true
39839 };
39840 if (self.get('type') === 'interval' || self.get('type') === 'schema') {
39841 item.size = self.getSize();
39842 }
39843
39844 items.push(Util.mix({}, item, cfg));
39845 }
39846 }
39847
39848 if (tooltipCfg) {
39849 var fields = tooltipCfg.fields;
39850 var cfg = tooltipCfg.cfg;
39851 var callbackParams = [];
39852 Util.each(fields, function (field) {
39853 callbackParams.push(origin[field]);
39854 });
39855 if (cfg) {
39856 // 存在回调函数
39857 if (Util.isFunction(cfg)) {
39858 cfg = cfg.apply(null, callbackParams);
39859 }
39860 var itemCfg = Util.mix({}, {
39861 point: point,
39862 title: tipTitle,
39863 color: point.color || defaultColor,
39864 marker: true // 默认展示 marker
39865 }, cfg);
39866 if (self.get('type') === 'interval' || self.get('type') === 'schema') {
39867 itemCfg.size = self.getSize();
39868 }
39869 items.push(itemCfg);
39870 } else {
39871 Util.each(fields, function (field) {
39872 if (!Util.isNil(origin[field])) {
39873 // 字段数据为null ,undefined时不显示
39874 var scale = self._getScale(field);
39875 name = getScaleName(scale);
39876 value = scale.getText(origin[field]);
39877 addItem(name, value);
39878 }
39879 });
39880 }
39881 } else {
39882 var valueScale = self._getTipValueScale();
39883 if (!Util.isNil(origin[valueScale.field])) {
39884 // 字段数据为null ,undefined时不显示
39885 value = self.getTipValue(origin, valueScale);
39886 name = self.getTipName(origin);
39887 addItem(name, value);
39888 }
39889 }
39890 return items;
39891 },
39892 isShareTooltip: function isShareTooltip() {
39893 var shareTooltip = this.get('shareTooltip');
39894 var type = this.get('type');
39895 var view = this.get('view');
39896 var options = void 0;
39897 if (view.get('parent')) {
39898 options = view.get('parent').get('options');
39899 } else {
39900 options = view.get('options');
39901 }
39902
39903 if (type === 'interval') {
39904 var coord = this.get('coord');
39905 var coordType = coord.type;
39906 if (coordType === 'theta' || coordType === 'polar' && coord.isTransposed) {
39907 shareTooltip = false;
39908 }
39909 } else if (!this.getYScale() || Util.inArray(['contour', 'point', 'polygon', 'edge'], type)) {
39910 shareTooltip = false;
39911 }
39912
39913 if (options.tooltip && Util.isBoolean(options.tooltip.shared)) {
39914 // 以用户设置的为准
39915 shareTooltip = options.tooltip.shared;
39916 }
39917 return shareTooltip;
39918 }
39919};
39920
39921module.exports = TooltipMixin;
39922
39923/***/ }),
39924/* 311 */
39925/***/ (function(module, exports, __webpack_require__) {
39926
39927/**
39928 * @fileOverview the interaction when geom was actived
39929 * @author sima.zhang
39930 */
39931var Util = __webpack_require__(0);
39932var FIELD_ORIGIN = '_origin';
39933
39934function isSameShape(shape1, shape2) {
39935 if (Util.isNil(shape1) || Util.isNil(shape2)) {
39936 return false;
39937 }
39938 var shape1Origin = shape1.get('origin');
39939 var shape2Origin = shape2.get('origin');
39940 return Util.isEqual(shape1Origin, shape2Origin);
39941}
39942
39943function isChange(preShapes, shapes) {
39944 if (!preShapes) {
39945 return true;
39946 }
39947
39948 if (preShapes.length !== shapes.length) {
39949 return true;
39950 }
39951
39952 var rst = false;
39953 Util.each(shapes, function (shape, index) {
39954 if (!isSameShape(shape, preShapes[index])) {
39955 rst = true;
39956 return false;
39957 }
39958 });
39959 return rst;
39960}
39961
39962var ActiveMixin = {
39963 _isAllowActive: function _isAllowActive() {
39964 var allowActive = this.get('allowActive');
39965 if (Util.isNil(allowActive)) {
39966 // 用户未设置,使用默认的策略
39967 var view = this.get('view');
39968 var isShareTooltip = this.isShareTooltip();
39969 var options = view.get('options');
39970 // 默认情况下,tooltip 关闭或者 tooltip 模式为 shared === false 的时候允许 active
39971 if (options.tooltip === false || !isShareTooltip) {
39972 return true;
39973 }
39974 } else {
39975 return allowActive;
39976 }
39977
39978 return false;
39979 },
39980 _onMouseenter: function _onMouseenter(ev) {
39981 var self = this;
39982 var shape = ev.shape;
39983 var shapeContainer = self.get('shapeContainer');
39984 if (shape && !shape.get('animating') && shapeContainer.contain(shape) && self._isAllowActive()) {
39985 self.setShapesActived(shape);
39986 }
39987 },
39988 _onMouseleave: function _onMouseleave() {
39989 var self = this;
39990 var view = self.get('view');
39991 var canvas = view.get('canvas');
39992 if (self.get('activeShapes')) {
39993 self.clearActivedShapes();
39994 canvas.draw();
39995 }
39996 },
39997 _bindActiveAction: function _bindActiveAction() {
39998 var self = this;
39999 var view = self.get('view');
40000 var type = self.get('type');
40001 view.on(type + ':mouseenter', Util.wrapBehavior(self, '_onMouseenter'));
40002 view.on(type + ':mouseleave', Util.wrapBehavior(self, '_onMouseleave'));
40003 },
40004 _offActiveAction: function _offActiveAction() {
40005 var self = this;
40006 var view = self.get('view');
40007 var type = self.get('type');
40008 view.off(type + ':mouseenter', Util.getWrapBehavior(self, '_onMouseenter'));
40009 view.off(type + ':mouseleave', Util.getWrapBehavior(self, '_onMouseleave'));
40010 },
40011 _setActiveShape: function _setActiveShape(shape) {
40012 var self = this;
40013 var shapeData = shape.get('origin');
40014 var shapeName = shapeData.shape || self.getDefaultValue('shape');
40015 if (Util.isArray(shapeName)) {
40016 shapeName = shapeName[0];
40017 }
40018 var shapeFactory = self.get('shapeFactory');
40019 var shapeCfg = Util.mix({}, shape.__attrs, {
40020 origin: shapeData
40021 });
40022 var activeCfg = shapeFactory.getActiveCfg(shapeName, shapeCfg);
40023 Util.mix(shape.__attrs, activeCfg);
40024 shape.setZIndex(1); // 提前
40025 },
40026 setShapesActived: function setShapesActived(shapes) {
40027 var self = this;
40028 var isStop = false; // 判断 shape 是否正在动画
40029 if (!Util.isArray(shapes)) {
40030 shapes = [shapes];
40031 }
40032
40033 var preShapes = self.get('preShapes'); // 获取上次被激活的 shapes
40034 if (!isChange(preShapes, shapes)) {
40035 return;
40036 }
40037 if (preShapes) {
40038 self.clearActivedShapes(); // 先清除激活元素
40039 }
40040 var view = self.get('view');
40041 var canvas = view.get('canvas');
40042 var shapeContainer = self.get('shapeContainer');
40043 Util.each(shapes, function (shape) {
40044 if (shape.get('animating')) {
40045 isStop = true;
40046 return false;
40047 }
40048 if (!shape.get('_originAttrs')) {
40049 shape.set('_originAttrs', Util.cloneDeep(shape.__attrs)); // 缓存原来的属性,由于 __attrs.matrix 是数组,所以此处需要深度复制
40050 }
40051 if (shape.get('visible') && !shape.get('selected')) {
40052 self._setActiveShape(shape);
40053 }
40054 });
40055
40056 if (isStop) {
40057 return;
40058 }
40059
40060 self.set('activeShapes', shapes);
40061 self.set('preShapes', shapes);
40062 shapeContainer.sort();
40063 canvas.draw();
40064 },
40065 clearActivedShapes: function clearActivedShapes() {
40066 var self = this;
40067 var shapeContainer = self.get('shapeContainer');
40068 if (shapeContainer && !shapeContainer.get('destroyed')) {
40069 var activeShapes = self.get('activeShapes');
40070 Util.each(activeShapes, function (activeShape) {
40071 if (!activeShape.get('selected')) {
40072 var originAttrs = activeShape.get('_originAttrs');
40073 activeShape.__attrs = Util.cloneDeep(originAttrs);
40074 activeShape.setZIndex(0);
40075 activeShape.set('_originAttrs', null);
40076 }
40077 });
40078 var preHighlightShapes = self.get('preHighlightShapes');
40079 if (preHighlightShapes) {
40080 var shapes = shapeContainer.get('children');
40081 Util.each(shapes, function (shape) {
40082 if (!shape.get('selected')) {
40083 var originAttrs = shape.get('_originAttrs');
40084 if (originAttrs) {
40085 shape.__attrs = Util.cloneDeep(originAttrs);
40086 shape.setZIndex(0);
40087 shape.set('_originAttrs', null);
40088 }
40089 }
40090 });
40091 }
40092 // 恢复原来排序
40093 var children = shapeContainer.get('children');
40094 children.sort(function (obj1, obj2) {
40095 return obj1._INDEX - obj2._INDEX;
40096 });
40097
40098 self.set('activeShapes', null);
40099 self.set('preShapes', null);
40100 self.set('preHighlightShapes', null);
40101 }
40102 },
40103 getGroupShapesByPoint: function getGroupShapesByPoint(point) {
40104 var self = this;
40105 var shapeContainer = self.get('shapeContainer');
40106 var activeShapes = [];
40107 if (shapeContainer) {
40108 var xField = self.getXScale().field;
40109 var shapes = self.getShapes();
40110 var originObj = self._getOriginByPoint(point);
40111 Util.each(shapes, function (shape) {
40112 var origin = shape.get('origin');
40113 if (shape.get('visible') && origin) {
40114 // 有可能不是图形,而是label文本,所以判断一下
40115 var shapeXValue = origin[FIELD_ORIGIN][xField];
40116 if (shapeXValue === originObj[xField]) {
40117 activeShapes.push(shape);
40118 }
40119 }
40120 });
40121 }
40122 return activeShapes;
40123 },
40124 getSingleShapeByPoint: function getSingleShapeByPoint(point) {
40125 var self = this;
40126 var shapeContainer = self.get('shapeContainer');
40127 var canvas = shapeContainer.get('canvas');
40128 var pixelRatio = canvas.get('pixelRatio');
40129 var result = void 0;
40130 if (shapeContainer) {
40131 result = shapeContainer.getShape(point.x * pixelRatio, point.y * pixelRatio);
40132 }
40133
40134 if (result && result.get('origin')) {
40135 return result;
40136 }
40137 },
40138 highlightShapes: function highlightShapes(_highlightShapes, highlightCfg) {
40139 var self = this;
40140 if (!Util.isArray(_highlightShapes)) {
40141 _highlightShapes = [_highlightShapes];
40142 }
40143
40144 var preHighlightShapes = self.get('preHighlightShapes'); // 获取上次被激活的 shapes
40145 if (!isChange(preHighlightShapes, _highlightShapes)) {
40146 return;
40147 }
40148
40149 if (preHighlightShapes) {
40150 self.clearActivedShapes();
40151 }
40152
40153 var shapes = self.getShapes();
40154
40155 Util.each(shapes, function (shape) {
40156 if (!shape.get('_originAttrs')) {
40157 shape.set('_originAttrs', Util.cloneDeep(shape.__attrs)); // 缓存原来的属性
40158 }
40159 if (Util.indexOf(_highlightShapes, shape) !== -1) {
40160 shape.__attrs = Util.mix({}, shape.get('_originAttrs'), highlightCfg);
40161 shape.setZIndex(1); // 提前
40162 } else {
40163 Util.mix(shape.__attrs, {
40164 fill: '#fff',
40165 fillOpacity: 0.3,
40166 strokeOpacity: 0.3,
40167 stroke: '#fff'
40168 });
40169 shape.setZIndex(0);
40170 }
40171 });
40172 self.set('preHighlightShapes', _highlightShapes);
40173 self.set('activeShapes', _highlightShapes);
40174 }
40175};
40176
40177module.exports = ActiveMixin;
40178
40179/***/ }),
40180/* 312 */
40181/***/ (function(module, exports, __webpack_require__) {
40182
40183/**
40184 * @fileOverview the interaction when geom was selected
40185 * @author sima.zhang
40186 */
40187var Util = __webpack_require__(0);
40188
40189function isSameShape(shape1, shape2) {
40190 if (Util.isNil(shape1) || Util.isNil(shape2)) {
40191 return false;
40192 }
40193 var shape1Origin = shape1.get('origin');
40194 var shape2Origin = shape2.get('origin');
40195 return Util.isEqual(shape1Origin, shape2Origin);
40196}
40197
40198var SelectMixin = {
40199 _isAllowSelect: function _isAllowSelect() {
40200 var isAllowSelect = this.get('allowSelect');
40201 if (Util.isNil(isAllowSelect)) {
40202 var type = this.get('type');
40203 var coord = this.get('coord');
40204 var coordType = coord && coord.type;
40205
40206 if (type === 'interval' && coordType === 'theta') {
40207 // 饼图默认可以进行选中
40208 return true;
40209 }
40210 } else {
40211 // 用户设置了 select 配置
40212 return isAllowSelect;
40213 }
40214
40215 return false;
40216 },
40217 _onClick: function _onClick(ev) {
40218 var self = this;
40219 if (self._isAllowSelect()) {
40220 // 允许选中下才执行
40221 self.clearActivedShapes(); // 清除hover效果
40222 var shape = ev.shape;
40223 var shapeContainer = self.get('shapeContainer');
40224 if (shape && !shape.get('animating') && shapeContainer.contain(shape)) {
40225 self.setShapeSelected(shape);
40226 }
40227 }
40228 },
40229 _bindSelectedAction: function _bindSelectedAction() {
40230 var self = this;
40231 var view = self.get('view');
40232 var type = self.get('type');
40233 view.on(type + ':click', Util.wrapBehavior(self, '_onClick'));
40234 },
40235 _offSelectedAction: function _offSelectedAction() {
40236 var self = this;
40237 var view = self.get('view');
40238 var type = self.get('type');
40239 view.off(type + ':click', Util.getWrapBehavior(self, '_onClick'));
40240 },
40241 _setShapeStatus: function _setShapeStatus(shape, status) {
40242 var self = this;
40243 var view = self.get('view');
40244 var selectedOptions = self.get('selectedOptions') || {};
40245 var animate = selectedOptions.animate !== false; // 默认允许动画
40246 var canvas = view.get('canvas');
40247
40248 shape.set('selected', status);
40249 var shapeData = shape.get('origin');
40250
40251 if (status) {
40252 // 选中状态
40253 var shapeName = shapeData.shape || self.getDefaultValue('shape');
40254 if (Util.isArray(shapeName)) {
40255 shapeName = shapeName[0];
40256 }
40257 var shapeFactory = self.get('shapeFactory');
40258 var cfg = Util.mix({
40259 geom: self,
40260 point: shapeData
40261 }, selectedOptions);
40262 var selectedStyle = shapeFactory.getSelectedCfg(shapeName, cfg);
40263 Util.mix(selectedStyle, cfg.style); // 用户设置的优先级更高
40264
40265 if (!shape.get('_originAttrs')) {
40266 // 缓存原有属性
40267 shape.set('_originAttrs', Util.cloneDeep(shape.__attrs));
40268 }
40269
40270 if (animate) {
40271 shape.animate(selectedStyle, 300);
40272 } else {
40273 shape.attr(selectedStyle);
40274 canvas.draw();
40275 }
40276 } else {
40277 var originAttrs = shape.get('_originAttrs');
40278 if (animate) {
40279 shape.animate(originAttrs, 300);
40280 } else {
40281 shape.attr(originAttrs);
40282 canvas.draw();
40283 }
40284 }
40285 },
40286 setShapeSelected: function setShapeSelected(shape) {
40287 var self = this;
40288 var selectedShapes = self._getSelectedShapes();
40289 var selectedOptions = self.get('selectedOptions') || {};
40290 var cancelable = selectedOptions.cancelable !== false; // 选中状态是否允许取消,默认允许
40291 if (selectedOptions.mode === 'multiple') {
40292 // 支持多选
40293 if (Util.indexOf(selectedShapes, shape) === -1) {
40294 selectedShapes.push(shape);
40295 self._setShapeStatus(shape, true);
40296 } else if (cancelable) {
40297 // 图形已经被选中并且选中状态允许取消选中
40298 Util.Array.remove(selectedShapes, shape);
40299 self._setShapeStatus(shape, false);
40300 }
40301 } else {
40302 var selectedShape = selectedShapes[0];
40303 if (cancelable) {
40304 // 如果允许取消,则选中null
40305 shape = isSameShape(selectedShape, shape) ? null : shape;
40306 }
40307 if (!isSameShape(selectedShape, shape)) {
40308 if (selectedShape) {
40309 self._setShapeStatus(selectedShape, false);
40310 }
40311 if (shape) {
40312 self._setShapeStatus(shape, true);
40313 }
40314 }
40315 }
40316 },
40317 clearSelected: function clearSelected() {
40318 var self = this;
40319 var shapeContainer = self.get('shapeContainer');
40320 if (shapeContainer && !shapeContainer.get('destroyed')) {
40321 var selectedShapes = self._getSelectedShapes();
40322 Util.each(selectedShapes, function (shape) {
40323 self._setShapeStatus(shape, false);
40324 shape.set('_originAttrs', null);
40325 });
40326 }
40327 },
40328 _getSelectedShapes: function _getSelectedShapes() {
40329 var self = this;
40330 var shapes = self.getShapes();
40331 var selectedShapes = [];
40332
40333 Util.each(shapes, function (shape) {
40334 if (shape.get('selected')) {
40335 selectedShapes.push(shape);
40336 }
40337 });
40338 self.set('selectedShapes', selectedShapes);
40339 return selectedShapes;
40340 }
40341};
40342
40343module.exports = SelectMixin;
40344
40345/***/ }),
40346/* 313 */
40347/***/ (function(module, exports, __webpack_require__) {
40348
40349function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
40350
40351function _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; }
40352
40353function _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; }
40354
40355/**
40356 * @fileOverview 点图
40357 * @author dxq613@gmail.com
40358 */
40359
40360var GeomBase = __webpack_require__(9);
40361var Util = __webpack_require__(0);
40362
40363var Point = function (_GeomBase) {
40364 _inherits(Point, _GeomBase);
40365
40366 function Point() {
40367 _classCallCheck(this, Point);
40368
40369 return _possibleConstructorReturn(this, _GeomBase.apply(this, arguments));
40370 }
40371
40372 /**
40373 * 获取默认的配置属性
40374 * @protected
40375 * @return {Object} 默认属性
40376 */
40377 Point.prototype.getDefaultCfg = function getDefaultCfg() {
40378 var cfg = _GeomBase.prototype.getDefaultCfg.call(this);
40379 cfg.type = 'point';
40380 cfg.shapeType = 'point';
40381 cfg.generatePoints = true;
40382 return cfg;
40383 };
40384
40385 Point.prototype.drawPoint = function drawPoint(obj, container, shapeFactory, index) {
40386 var self = this;
40387 var shape = obj.shape;
40388 var cfg = self.getDrawCfg(obj);
40389 var geomShape = void 0;
40390 if (Util.isArray(obj.y)) {
40391 var hasAdjust = self.hasStack();
40392 Util.each(obj.y, function (y, idx) {
40393 cfg.y = y;
40394 cfg.yIndex = idx;
40395 if (!hasAdjust || idx !== 0) {
40396 geomShape = shapeFactory.drawShape(shape, cfg, container);
40397 geomShape.setSilent('index', index + idx);
40398 geomShape.setSilent('coord', self.get('coord'));
40399 if (self.get('animate') && self.get('animateCfg')) {
40400 geomShape.setSilent('animateCfg', self.get('animateCfg'));
40401 }
40402 }
40403 });
40404 } else if (!Util.isNil(obj.y)) {
40405 geomShape = shapeFactory.drawShape(shape, cfg, container);
40406 geomShape.setSilent('index', index);
40407 geomShape.setSilent('coord', self.get('coord'));
40408
40409 if (self.get('animate') && self.get('animateCfg')) {
40410 geomShape.setSilent('animateCfg', self.get('animateCfg'));
40411 }
40412 }
40413 };
40414
40415 return Point;
40416}(GeomBase);
40417
40418var PointJitter = function (_Point) {
40419 _inherits(PointJitter, _Point);
40420
40421 function PointJitter() {
40422 _classCallCheck(this, PointJitter);
40423
40424 return _possibleConstructorReturn(this, _Point.apply(this, arguments));
40425 }
40426
40427 PointJitter.prototype.getDefaultCfg = function getDefaultCfg() {
40428 var cfg = _Point.prototype.getDefaultCfg.call(this);
40429 cfg.hasDefaultAdjust = true;
40430 cfg.adjusts = [{ type: 'jitter' }];
40431 return cfg;
40432 };
40433
40434 return PointJitter;
40435}(Point);
40436
40437Point.Jitter = PointJitter;
40438
40439module.exports = Point;
40440
40441/***/ }),
40442/* 314 */
40443/***/ (function(module, exports, __webpack_require__) {
40444
40445function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
40446
40447function _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; }
40448
40449function _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; }
40450
40451/**
40452 * @fileOverview 线图
40453 * @author dxq613@gmail.com
40454 */
40455
40456var Path = __webpack_require__(112);
40457
40458var Line = function (_Path) {
40459 _inherits(Line, _Path);
40460
40461 function Line() {
40462 _classCallCheck(this, Line);
40463
40464 return _possibleConstructorReturn(this, _Path.apply(this, arguments));
40465 }
40466
40467 /**
40468 * 获取默认的配置属性
40469 * @protected
40470 * @return {Object} 默认属性
40471 */
40472 Line.prototype.getDefaultCfg = function getDefaultCfg() {
40473 var cfg = _Path.prototype.getDefaultCfg.call(this);
40474 cfg.type = 'line';
40475 cfg.sortable = true;
40476 return cfg;
40477 };
40478
40479 return Line;
40480}(Path);
40481
40482var LineStack = function (_Line) {
40483 _inherits(LineStack, _Line);
40484
40485 function LineStack() {
40486 _classCallCheck(this, LineStack);
40487
40488 return _possibleConstructorReturn(this, _Line.apply(this, arguments));
40489 }
40490
40491 LineStack.prototype.getDefaultCfg = function getDefaultCfg() {
40492 var cfg = _Line.prototype.getDefaultCfg.call(this);
40493 cfg.hasDefaultAdjust = true;
40494 cfg.adjusts = [{ type: 'stack' }];
40495 return cfg;
40496 };
40497
40498 return LineStack;
40499}(Line);
40500
40501Line.Stack = LineStack;
40502module.exports = Line;
40503
40504/***/ }),
40505/* 315 */
40506/***/ (function(module, exports, __webpack_require__) {
40507
40508function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
40509
40510function _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; }
40511
40512function _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; }
40513
40514/**
40515 * @fileOverview interval geometry
40516 * @author dxq613@gmail.com
40517 */
40518
40519var GeomBase = __webpack_require__(9);
40520var Util = __webpack_require__(0);
40521var SizeMixin = __webpack_require__(114);
40522
40523var Interval = function (_GeomBase) {
40524 _inherits(Interval, _GeomBase);
40525
40526 /**
40527 * 获取默认的配置属性
40528 * @protected
40529 * @return {Object} 默认属性
40530 */
40531 Interval.prototype.getDefaultCfg = function getDefaultCfg() {
40532 var cfg = _GeomBase.prototype.getDefaultCfg.call(this);
40533 cfg.type = 'interval';
40534 cfg.shapeType = 'interval';
40535 cfg.generatePoints = true;
40536 return cfg;
40537 };
40538
40539 function Interval(cfg) {
40540 _classCallCheck(this, Interval);
40541
40542 var _this = _possibleConstructorReturn(this, _GeomBase.call(this, cfg));
40543
40544 Util.assign(_this, SizeMixin);
40545 return _this;
40546 }
40547
40548 Interval.prototype.createShapePointsCfg = function createShapePointsCfg(obj) {
40549 var cfg = _GeomBase.prototype.createShapePointsCfg.call(this, obj);
40550 cfg.size = this.getNormalizedSize(obj);
40551 return cfg;
40552 };
40553
40554 Interval.prototype.clearInner = function clearInner() {
40555 _GeomBase.prototype.clearInner.call(this);
40556 this.set('defaultSize', null);
40557 };
40558
40559 return Interval;
40560}(GeomBase);
40561
40562var IntervalStack = function (_Interval) {
40563 _inherits(IntervalStack, _Interval);
40564
40565 function IntervalStack() {
40566 _classCallCheck(this, IntervalStack);
40567
40568 return _possibleConstructorReturn(this, _Interval.apply(this, arguments));
40569 }
40570
40571 IntervalStack.prototype.getDefaultCfg = function getDefaultCfg() {
40572 var cfg = _Interval.prototype.getDefaultCfg.call(this);
40573 cfg.hasDefaultAdjust = true;
40574 cfg.adjusts = [{ type: 'stack' }];
40575 return cfg;
40576 };
40577
40578 return IntervalStack;
40579}(Interval);
40580
40581var IntervalDodge = function (_Interval2) {
40582 _inherits(IntervalDodge, _Interval2);
40583
40584 function IntervalDodge() {
40585 _classCallCheck(this, IntervalDodge);
40586
40587 return _possibleConstructorReturn(this, _Interval2.apply(this, arguments));
40588 }
40589
40590 IntervalDodge.prototype.getDefaultCfg = function getDefaultCfg() {
40591 var cfg = _Interval2.prototype.getDefaultCfg.call(this);
40592 cfg.hasDefaultAdjust = true;
40593 cfg.adjusts = [{ type: 'dodge' }];
40594 return cfg;
40595 };
40596
40597 return IntervalDodge;
40598}(Interval);
40599
40600var IntervalSymmetric = function (_Interval3) {
40601 _inherits(IntervalSymmetric, _Interval3);
40602
40603 function IntervalSymmetric() {
40604 _classCallCheck(this, IntervalSymmetric);
40605
40606 return _possibleConstructorReturn(this, _Interval3.apply(this, arguments));
40607 }
40608
40609 IntervalSymmetric.prototype.getDefaultCfg = function getDefaultCfg() {
40610 var cfg = _Interval3.prototype.getDefaultCfg.call(this);
40611 cfg.hasDefaultAdjust = true;
40612 cfg.adjusts = [{ type: 'symmetric' }];
40613 return cfg;
40614 };
40615
40616 return IntervalSymmetric;
40617}(Interval);
40618
40619Interval.Stack = IntervalStack;
40620Interval.Dodge = IntervalDodge;
40621Interval.Symmetric = IntervalSymmetric;
40622
40623module.exports = Interval;
40624
40625/***/ }),
40626/* 316 */
40627/***/ (function(module, exports, __webpack_require__) {
40628
40629function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
40630
40631function _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; }
40632
40633function _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; }
40634
40635/**
40636 * @fileOverview 面积图
40637 * @author dxq613@gmail.com
40638 */
40639
40640var GeomBase = __webpack_require__(9);
40641var SplitMixin = __webpack_require__(113);
40642var Util = __webpack_require__(0);
40643
40644var Area = function (_GeomBase) {
40645 _inherits(Area, _GeomBase);
40646
40647 /**
40648 * 获取默认的配置属性
40649 * @protected
40650 * @return {Object} 默认属性
40651 */
40652 Area.prototype.getDefaultCfg = function getDefaultCfg() {
40653 var cfg = _GeomBase.prototype.getDefaultCfg.call(this);
40654 cfg.type = 'area';
40655 cfg.shapeType = 'area';
40656 cfg.generatePoints = true;
40657 cfg.sortable = true;
40658 return cfg;
40659 };
40660
40661 function Area(cfg) {
40662 _classCallCheck(this, Area);
40663
40664 var _this = _possibleConstructorReturn(this, _GeomBase.call(this, cfg));
40665
40666 Util.assign(_this, SplitMixin);
40667 return _this;
40668 }
40669
40670 Area.prototype.draw = function draw(data, container, shapeFactory, index) {
40671 var self = this;
40672 var cfg = this.getDrawCfg(data[0]);
40673 var splitArray = this.splitData(data);
40674
40675 cfg.origin = data; // path,line,area 等图的origin 是整个序列
40676 Util.each(splitArray, function (subData, splitedIndex) {
40677 cfg.splitedIndex = splitedIndex; // 传入分割片段索引 用于生成id
40678 var points = subData.map(function (obj) {
40679 return obj.points;
40680 });
40681 cfg.points = points;
40682 var geomShape = shapeFactory.drawShape(cfg.shape, cfg, container);
40683 geomShape.setSilent('index', index + splitedIndex);
40684 geomShape.setSilent('coord', self.get('coord'));
40685
40686 if (self.get('animate') && self.get('animateCfg')) {
40687 geomShape.setSilent('animateCfg', self.get('animateCfg'));
40688 }
40689 });
40690 };
40691
40692 return Area;
40693}(GeomBase);
40694
40695var AreaStack = function (_Area) {
40696 _inherits(AreaStack, _Area);
40697
40698 function AreaStack() {
40699 _classCallCheck(this, AreaStack);
40700
40701 return _possibleConstructorReturn(this, _Area.apply(this, arguments));
40702 }
40703
40704 AreaStack.prototype.getDefaultCfg = function getDefaultCfg() {
40705 var cfg = _Area.prototype.getDefaultCfg.call(this);
40706 cfg.hasDefaultAdjust = true;
40707 cfg.adjusts = [{ type: 'stack' }];
40708 return cfg;
40709 };
40710
40711 return AreaStack;
40712}(Area);
40713
40714Area.Stack = AreaStack;
40715module.exports = Area;
40716
40717/***/ }),
40718/* 317 */
40719/***/ (function(module, exports, __webpack_require__) {
40720
40721function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
40722
40723function _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; }
40724
40725function _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; }
40726
40727/**
40728 * @fileOverview 多边形
40729 * @author dxq613@gmail.com
40730 */
40731
40732var GeomBase = __webpack_require__(9);
40733var Util = __webpack_require__(0);
40734
40735var Polygon = function (_GeomBase) {
40736 _inherits(Polygon, _GeomBase);
40737
40738 function Polygon() {
40739 _classCallCheck(this, Polygon);
40740
40741 return _possibleConstructorReturn(this, _GeomBase.apply(this, arguments));
40742 }
40743
40744 /**
40745 * 获取默认的配置属性
40746 * @protected
40747 * @return {Object} 默认属性
40748 */
40749 Polygon.prototype.getDefaultCfg = function getDefaultCfg() {
40750 var cfg = _GeomBase.prototype.getDefaultCfg.call(this);
40751 cfg.type = 'polygon';
40752 cfg.shapeType = 'polygon';
40753 cfg.generatePoints = true;
40754 return cfg;
40755 };
40756
40757 Polygon.prototype.createShapePointsCfg = function createShapePointsCfg(obj) {
40758 var cfg = _GeomBase.prototype.createShapePointsCfg.call(this, obj);
40759 var self = this;
40760 var x = cfg.x;
40761 var y = cfg.y;
40762 var temp = void 0;
40763 if (!(Util.isArray(x) && Util.isArray(y))) {
40764 // x y 都是数组时,不做处理
40765 var xScale = self.getXScale();
40766 var yScale = self.getYScale();
40767 var xCount = xScale.values ? xScale.values.length : xScale.ticks.length;
40768 var yCount = yScale.values ? yScale.values.length : yScale.ticks.length;
40769 var xOffset = 0.5 * 1 / xCount;
40770 var yOffset = 0.5 * 1 / yCount;
40771 if (xScale.isCategory && yScale.isCategory) {
40772 // 如果x,y都是分类
40773 x = [x - xOffset, x - xOffset, x + xOffset, x + xOffset];
40774 y = [y - yOffset, y + yOffset, y + yOffset, y - yOffset];
40775 } else if (Util.isArray(x)) {
40776 // x 是数组
40777 temp = x;
40778 x = [temp[0], temp[0], temp[1], temp[1]];
40779 y = [y - yOffset / 2, y + yOffset / 2, y + yOffset / 2, y - yOffset / 2];
40780 } else if (Util.isArray(y)) {
40781 // y 是数组
40782 temp = y;
40783 y = [temp[0], temp[1], temp[1], temp[0]];
40784 x = [x - xOffset / 2, x - xOffset / 2, x + xOffset / 2, x + xOffset / 2];
40785 }
40786 cfg.x = x;
40787 cfg.y = y;
40788 }
40789 return cfg;
40790 };
40791
40792 return Polygon;
40793}(GeomBase);
40794
40795module.exports = Polygon;
40796
40797/***/ }),
40798/* 318 */
40799/***/ (function(module, exports, __webpack_require__) {
40800
40801function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
40802
40803function _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; }
40804
40805function _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; }
40806
40807/**
40808 * @fileOverview 自定义图形
40809 * @author dxq613@gmail.com
40810 */
40811
40812var GeomBase = __webpack_require__(9);
40813var Util = __webpack_require__(0);
40814var SizeMixin = __webpack_require__(114);
40815
40816var Schema = function (_GeomBase) {
40817 _inherits(Schema, _GeomBase);
40818
40819 /**
40820 * 获取默认的配置属性
40821 * @protected
40822 * @return {Object} 默认属性
40823 */
40824 Schema.prototype.getDefaultCfg = function getDefaultCfg() {
40825 var cfg = _GeomBase.prototype.getDefaultCfg.call(this);
40826 cfg.type = 'schema';
40827 cfg.shapeType = 'schema';
40828 cfg.generatePoints = true;
40829 return cfg;
40830 };
40831
40832 function Schema(cfg) {
40833 _classCallCheck(this, Schema);
40834
40835 var _this = _possibleConstructorReturn(this, _GeomBase.call(this, cfg));
40836
40837 Util.assign(_this, SizeMixin);
40838 return _this;
40839 }
40840
40841 Schema.prototype.createShapePointsCfg = function createShapePointsCfg(obj) {
40842 var cfg = _GeomBase.prototype.createShapePointsCfg.call(this, obj);
40843 cfg.size = this.getNormalizedSize(obj);
40844 return cfg;
40845 };
40846
40847 return Schema;
40848}(GeomBase);
40849
40850var SchemaDodge = function (_Schema) {
40851 _inherits(SchemaDodge, _Schema);
40852
40853 function SchemaDodge() {
40854 _classCallCheck(this, SchemaDodge);
40855
40856 return _possibleConstructorReturn(this, _Schema.apply(this, arguments));
40857 }
40858
40859 SchemaDodge.prototype.getDefaultCfg = function getDefaultCfg() {
40860 var cfg = _Schema.prototype.getDefaultCfg.call(this);
40861 cfg.hasDefaultAdjust = true;
40862 cfg.adjusts = [{ type: 'dodge' }];
40863 return cfg;
40864 };
40865
40866 return SchemaDodge;
40867}(Schema);
40868
40869Schema.Dodge = SchemaDodge;
40870module.exports = Schema;
40871
40872/***/ }),
40873/* 319 */
40874/***/ (function(module, exports, __webpack_require__) {
40875
40876function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
40877
40878function _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; }
40879
40880function _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; }
40881
40882/**
40883 * @fileOverview 边,用于关系图的边
40884 * @author dxq613@gmail.com
40885 */
40886
40887var GeomBase = __webpack_require__(9);
40888
40889var Edge = function (_GeomBase) {
40890 _inherits(Edge, _GeomBase);
40891
40892 function Edge() {
40893 _classCallCheck(this, Edge);
40894
40895 return _possibleConstructorReturn(this, _GeomBase.apply(this, arguments));
40896 }
40897
40898 /**
40899 * 获取默认的配置属性
40900 * @protected
40901 * @return {Object} 默认属性
40902 */
40903 Edge.prototype.getDefaultCfg = function getDefaultCfg() {
40904 var cfg = _GeomBase.prototype.getDefaultCfg.call(this);
40905 cfg.type = 'edge';
40906 cfg.shapeType = 'edge';
40907 cfg.generatePoints = true;
40908 return cfg;
40909 };
40910
40911 return Edge;
40912}(GeomBase);
40913
40914module.exports = Edge;
40915
40916/***/ }),
40917/* 320 */
40918/***/ (function(module, exports, __webpack_require__) {
40919
40920function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
40921
40922function _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; }
40923
40924function _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; }
40925
40926/**
40927 * @fileOverview heatmap
40928 * @author leungwensen@gmail.com
40929 */
40930var GeomBase = __webpack_require__(9);
40931var colorUtil = __webpack_require__(64);
40932var Util = __webpack_require__(0);
40933
40934var ORIGIN_FIELD = '_origin';
40935var SHADOW_CANVAS_CTX = 'shadowCanvasCtx';
40936var VALUE_RANGE = 'valueRange';
40937var IMAGE_SHAPE = 'imageShape';
40938var MAPPED_DATA = 'mappedData';
40939var GRAY_SCALE_BLURRED_CANVAS = 'grayScaleBlurredCanvas';
40940var HEATMAP_SIZE = 'heatmapSize';
40941
40942var paletteCache = {};
40943
40944var Heatmap = function (_GeomBase) {
40945 _inherits(Heatmap, _GeomBase);
40946
40947 function Heatmap() {
40948 _classCallCheck(this, Heatmap);
40949
40950 return _possibleConstructorReturn(this, _GeomBase.apply(this, arguments));
40951 }
40952
40953 /**
40954 * get default configuration
40955 * @protected
40956 * @return {Object} configuration
40957 */
40958 Heatmap.prototype.getDefaultCfg = function getDefaultCfg() {
40959 var cfg = _GeomBase.prototype.getDefaultCfg.call(this);
40960 cfg.type = 'heatmap';
40961 // cfg.shapeType = 'heatmap';
40962 return cfg;
40963 };
40964
40965 Heatmap.prototype._prepareRange = function _prepareRange() {
40966 var self = this;
40967
40968 var data = self.get(MAPPED_DATA);
40969 var colorAttr = self.getAttr('color');
40970 var colorField = colorAttr.field;
40971
40972 var min = Infinity;
40973 var max = -Infinity;
40974 data.forEach(function (row) {
40975 var value = row[ORIGIN_FIELD][colorField];
40976 if (value > max) {
40977 max = value;
40978 }
40979 if (value < min) {
40980 min = value;
40981 }
40982 });
40983 if (min === max) {
40984 min = max - 1;
40985 }
40986
40987 var range = [min, max];
40988 self.set(VALUE_RANGE, range);
40989 };
40990
40991 Heatmap.prototype._prepareSize = function _prepareSize() {
40992 var self = this;
40993 var radius = self.getDefaultValue('size');
40994 if (!Util.isNumber(radius)) {
40995 radius = self._getDefaultSize();
40996 }
40997 var styleOptions = self.get('styleOptions');
40998 var blur = styleOptions && Util.isObject(styleOptions.style) ? styleOptions.style.blur : null;
40999 if (!Util.isFinite(blur)) {
41000 blur = radius / 2;
41001 }
41002 self.set(HEATMAP_SIZE, {
41003 blur: blur,
41004 radius: radius
41005 });
41006 };
41007
41008 Heatmap.prototype._getDefaultSize = function _getDefaultSize() {
41009 var self = this;
41010 var position = self.getAttr('position');
41011 var coord = self.get('coord');
41012 var radius = Math.min(coord.width / (position.scales[0].ticks.length * 4), coord.height / (position.scales[1].ticks.length * 4));
41013 return radius;
41014 };
41015
41016 Heatmap.prototype._colorize = function _colorize(img) {
41017 var self = this;
41018 var colorAttr = self.getAttr('color');
41019 var pixels = img.data;
41020 for (var i = 3; i < pixels.length; i += 4) {
41021 var alpha = pixels[i]; // get gradient color from opacity value
41022 if (alpha) {
41023 var palette = void 0;
41024 if (paletteCache[alpha]) {
41025 palette = paletteCache[alpha];
41026 } else {
41027 palette = colorUtil.rgb2arr(colorAttr.gradient(alpha / 256));
41028 paletteCache[alpha] = palette;
41029 }
41030 // const palette = colorUtil.rgb2arr(colorAttr.gradient(alpha / 256));
41031 pixels[i - 3] = palette[0];
41032 pixels[i - 2] = palette[1];
41033 pixels[i - 1] = palette[2];
41034 pixels[i] = alpha;
41035 }
41036 }
41037 };
41038
41039 Heatmap.prototype._prepareGreyScaleBlurredCircle = function _prepareGreyScaleBlurredCircle(r, blur) {
41040 var self = this;
41041 var circleCanvas = self.get(GRAY_SCALE_BLURRED_CANVAS);
41042 if (!circleCanvas) {
41043 circleCanvas = document.createElement('canvas');
41044 self.set(GRAY_SCALE_BLURRED_CANVAS, circleCanvas);
41045 }
41046 var r2 = r + blur;
41047 var ctx = circleCanvas.getContext('2d');
41048 circleCanvas.width = circleCanvas.height = r2 * 2;
41049 ctx.clearRect(0, 0, circleCanvas.width, circleCanvas.height);
41050 ctx.shadowOffsetX = ctx.shadowOffsetY = r2 * 2;
41051 ctx.shadowBlur = blur;
41052 ctx.shadowColor = 'black';
41053
41054 ctx.beginPath();
41055 ctx.arc(-r2, -r2, r, 0, Math.PI * 2, true);
41056 ctx.closePath();
41057 ctx.fill();
41058 };
41059
41060 Heatmap.prototype._drawGrayScaleBlurredCircle = function _drawGrayScaleBlurredCircle(x, y, r, alpha, ctx) {
41061 var circleCanvas = this.get(GRAY_SCALE_BLURRED_CANVAS);
41062 ctx.globalAlpha = alpha;
41063 ctx.drawImage(circleCanvas, x - r, y - r);
41064 };
41065
41066 Heatmap.prototype._getShadowCanvasCtx = function _getShadowCanvasCtx() {
41067 var self = this;
41068 var ctx = self.get(SHADOW_CANVAS_CTX);
41069 if (ctx) {
41070 return ctx;
41071 }
41072 var coord = self.get('coord');
41073 var width = coord.x.end;
41074 var height = coord.y.start;
41075 var heatmapCanvas = document.createElement('canvas');
41076 heatmapCanvas.width = width;
41077 heatmapCanvas.height = height;
41078 ctx = heatmapCanvas.getContext('2d');
41079 self.set(SHADOW_CANVAS_CTX, ctx);
41080 return ctx;
41081 };
41082
41083 Heatmap.prototype._clearShadowCanvasCtx = function _clearShadowCanvasCtx() {
41084 var ctx = this.get(SHADOW_CANVAS_CTX);
41085 if (ctx) {
41086 ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
41087 }
41088 };
41089
41090 Heatmap.prototype._getImageShape = function _getImageShape() {
41091 var self = this;
41092 var imageShape = self.get(IMAGE_SHAPE);
41093 if (imageShape) {
41094 return imageShape;
41095 }
41096 var container = self.get('container');
41097 imageShape = container.addShape('Image', {});
41098 self.set(IMAGE_SHAPE, imageShape);
41099 return imageShape;
41100 };
41101
41102 Heatmap.prototype.drawWithRange = function drawWithRange(range) {
41103 var self = this;
41104
41105 // canvas size
41106 var coord = self.get('coord');
41107 var width = coord.width;
41108 var height = coord.height;
41109
41110 // value, range, etc
41111 var valueField = self.getAttr('color').field;
41112 var size = self.get(HEATMAP_SIZE);
41113
41114 // prepare shadow canvas context
41115 self._clearShadowCanvasCtx();
41116 var ctx = self._getShadowCanvasCtx();
41117
41118 // filter data
41119 var data = self.get(MAPPED_DATA);
41120 if (range) {
41121 data = data.filter(function (row) {
41122 return row[ORIGIN_FIELD][valueField] <= range[1] && row[ORIGIN_FIELD][valueField] >= range[0];
41123 });
41124 }
41125
41126 // step1. draw points with shadow
41127 var scale = self._getScale(valueField);
41128 for (var i = 0; i < data.length; i++) {
41129 var obj = data[i];
41130 var cfg = self.getDrawCfg(obj);
41131 var alpha = scale.scale(obj[ORIGIN_FIELD][valueField]);
41132 self._drawGrayScaleBlurredCircle(cfg.x, cfg.y, size.radius, alpha, ctx);
41133 }
41134
41135 // step2. convert pixels
41136 var colored = ctx.getImageData(coord.start.x, coord.end.y, width + coord.start.x, height + coord.end.y);
41137 self._clearShadowCanvasCtx();
41138 self._colorize(colored);
41139 ctx.putImageData(colored, 0, 0);
41140 var imageShape = self._getImageShape();
41141 imageShape.attr('x', coord.start.x);
41142 imageShape.attr('y', coord.end.y);
41143 imageShape.attr('width', width + coord.start.x);
41144 imageShape.attr('height', height + coord.end.y);
41145 imageShape.attr('img', ctx.canvas);
41146 };
41147
41148 Heatmap.prototype.draw = function draw(data /* , container, shapeFactory, index */) {
41149 var self = this;
41150 self.set(MAPPED_DATA, data);
41151
41152 self._prepareRange();
41153 self._prepareSize();
41154
41155 var size = self.get(HEATMAP_SIZE);
41156 self._prepareGreyScaleBlurredCircle(size.radius, size.blur);
41157
41158 var range = self.get(VALUE_RANGE);
41159 self.drawWithRange(range);
41160 // super.draw(data, container, shapeFactory, index);
41161 };
41162
41163 return Heatmap;
41164}(GeomBase);
41165
41166module.exports = Heatmap;
41167
41168/***/ }),
41169/* 321 */
41170/***/ (function(module, exports, __webpack_require__) {
41171
41172function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
41173
41174/**
41175 * @fileOverview 度量的控制器
41176 * @author dxq613@gmail.com
41177 */
41178
41179var Util = __webpack_require__(0);
41180var Global = __webpack_require__(1);
41181var Scale = __webpack_require__(116);
41182var dateRegex = /^(?:(?!0000)[0-9]{4}([-/.]+)(?:(?:0?[1-9]|1[0-2])\1(?:0?[1-9]|1[0-9]|2[0-8])|(?:0?[13-9]|1[0-2])\1(?:29|30)|(?:0?[13578]|1[02])\1(?:31))|(?:[0-9]{2}(?:0[48]|[2468][048]|[13579][26])|(?:0[48]|[2468][048]|[13579][26])00)([-/.]?)0?2\2(?:29))(\s+([01]|([01][0-9]|2[0-3])):([0-9]|[0-5][0-9]):([0-9]|[0-5][0-9]))?$/;
41183var TYPES = {
41184 LINEAR: 'linear',
41185 CAT: 'cat',
41186 TIME: 'time'
41187};
41188
41189var ScaleController = function () {
41190 function ScaleController(cfg) {
41191 _classCallCheck(this, ScaleController);
41192
41193 // defs 列定义
41194 this.defs = {};
41195 Util.assign(this, cfg);
41196 }
41197
41198 ScaleController.prototype._getDef = function _getDef(field) {
41199 var defs = this.defs;
41200 var def = null;
41201 if (Global.scales[field] || defs[field]) {
41202 def = Util.mix({}, Global.scales[field]);
41203 // 处理覆盖属性的问题
41204 Util.each(defs[field], function (v, k) {
41205 if (Util.isNil(v)) {
41206 delete def[k];
41207 } else {
41208 def[k] = v;
41209 }
41210 });
41211 }
41212 return def;
41213 };
41214
41215 ScaleController.prototype._getDefaultType = function _getDefaultType(field, data) {
41216 var type = TYPES.LINEAR;
41217 var value = Util.Array.firstValue(data, field);
41218 if (Util.isArray(value)) {
41219 value = value[0];
41220 }
41221 if (dateRegex.test(value)) {
41222 type = TYPES.TIME;
41223 } else if (Util.isString(value)) {
41224 type = TYPES.CAT;
41225 }
41226 return type;
41227 };
41228
41229 ScaleController.prototype._getScaleCfg = function _getScaleCfg(type, field, data) {
41230 var cfg = {
41231 field: field
41232 };
41233 var values = Util.Array.values(data, field);
41234 cfg.values = values;
41235 if (!Scale.isCategory(type) && type !== 'time') {
41236 var range = Util.Array.getRange(values);
41237 cfg.min = range.min;
41238 cfg.max = range.max;
41239 cfg.nice = true;
41240 }
41241
41242 if (type === 'time') {
41243 cfg.nice = false;
41244 }
41245 return cfg;
41246 };
41247
41248 ScaleController.prototype.createScale = function createScale(field, data) {
41249 var self = this;
41250 var def = self._getDef(field);
41251 var scale = void 0;
41252 // 如果数据为空直接返回常量度量
41253 if (!data || !data.length) {
41254 if (def && def.type) {
41255 scale = Scale[def.type](def);
41256 } else {
41257 scale = Scale.identity({
41258 value: field,
41259 field: field.toString(),
41260 values: [field]
41261 });
41262 }
41263 return scale;
41264 }
41265 var firstValue = Util.Array.firstValue(data, field);
41266
41267 if (Util.isNumber(field) || Util.isNil(firstValue) && !def) {
41268 scale = Scale.identity({
41269 value: field,
41270 field: field.toString(),
41271 values: [field]
41272 });
41273 } else {
41274 // 如果已经定义过这个度量
41275 var type = void 0;
41276 if (def) {
41277 type = def.type;
41278 }
41279 type = type || self._getDefaultType(field, data);
41280 var cfg = self._getScaleCfg(type, field, data);
41281 if (def) {
41282 Util.mix(cfg, def);
41283 }
41284 scale = Scale[type](cfg);
41285 }
41286 return scale;
41287 };
41288
41289 return ScaleController;
41290}();
41291
41292module.exports = ScaleController;
41293
41294/***/ }),
41295/* 322 */
41296/***/ (function(module, exports, __webpack_require__) {
41297
41298/**
41299 * @fileOverview 自动计算数字坐标轴
41300 * @author dxq613@gmail.com
41301 */
41302
41303var Util = __webpack_require__(0);
41304var AutoUtil = __webpack_require__(117);
41305var MIN_COUNT = 5;
41306var MAX_COUNT = 7;
41307var Global = __webpack_require__(1);
41308
41309module.exports = function (info) {
41310 var min = info.min;
41311 var max = info.max;
41312 var interval = info.interval;
41313 var ticks = [];
41314 var minCount = info.minCount || MIN_COUNT;
41315 var maxCount = info.maxCount || MAX_COUNT;
41316 var isFixedCount = minCount === maxCount; // 是否限定死了个数
41317 var minLimit = Util.isNil(info.minLimit) ? -Infinity : info.minLimit; // 限定的最小值
41318 var maxLimit = Util.isNil(info.maxLimit) ? Infinity : info.maxLimit; // 限定最大值
41319 var avgCount = (minCount + maxCount) / 2;
41320 var count = avgCount;
41321 // 用户传入的逼近数组
41322 var snapArray = info.snapArray ? info.snapArray : isFixedCount ? Global.snapCountArray : Global.snapArray;
41323
41324 // 如果限定大小范围,同时大小范围等于用户传入的范围,同时限定了个数,interval 按照个数均分
41325 if (min === minLimit && max === maxLimit && isFixedCount) {
41326 interval = (max - min) / (count - 1);
41327 }
41328
41329 if (Util.isNil(min)) {
41330 min = 0;
41331 }
41332 if (Util.isNil(max)) {
41333 max = 0;
41334 }
41335 if (max === min) {
41336 if (min === 0) {
41337 max = 1;
41338 } else {
41339 if (min > 0) {
41340 min = 0;
41341 } else {
41342 max = 0;
41343 }
41344 }
41345 if (max - min < 5 && !interval && max - min >= 1) {
41346 interval = 1;
41347 }
41348 }
41349
41350 if (Util.isNil(interval)) {
41351 // 计算间距
41352 var temp = (max - min) / (avgCount - 1);
41353 interval = AutoUtil.snapFactorTo(temp, snapArray, 'ceil');
41354 if (maxCount !== minCount) {
41355 count = parseInt((max - min) / interval, 10);
41356 if (count > maxCount) {
41357 count = maxCount;
41358 }
41359 if (count < minCount) {
41360 count = minCount;
41361 }
41362 // 不确定tick的个数时,使得tick偏小
41363 interval = AutoUtil.snapFactorTo((max - min) / (count - 1), snapArray, 'floor');
41364 }
41365 }
41366 if (info.interval || maxCount !== minCount) {
41367 // 校正 max 和 min
41368 max = Math.min(AutoUtil.snapMultiple(max, interval, 'ceil'), maxLimit); // 向上逼近
41369 min = Math.max(AutoUtil.snapMultiple(min, interval, 'floor'), minLimit); // 向下逼近
41370
41371 count = Math.round((max - min) / interval);
41372 min = Util.fixedBase(min, interval);
41373 max = Util.fixedBase(max, interval);
41374 } else {
41375 avgCount = parseInt(avgCount, 10); // 取整
41376 var avg = (max + min) / 2;
41377 var avgTick = AutoUtil.snapMultiple(avg, interval, 'ceil');
41378 var sideCount = Math.floor((avgCount - 2) / 2);
41379 var maxTick = avgTick + sideCount * interval;
41380 var minTick = void 0;
41381 if (avgCount % 2 === 0) {
41382 minTick = avgTick - sideCount * interval;
41383 } else {
41384 minTick = avgTick - (sideCount + 1) * interval;
41385 }
41386 if (maxTick < max) {
41387 maxTick = maxTick + interval;
41388 }
41389 if (minTick > min) {
41390 minTick = minTick - interval;
41391 }
41392 max = Util.fixedBase(maxTick, interval);
41393 min = Util.fixedBase(minTick, interval);
41394 }
41395
41396 max = Math.min(max, maxLimit);
41397 min = Math.max(min, minLimit);
41398
41399 ticks.push(min);
41400 for (var i = 1; i < count; i++) {
41401 var tickValue = Util.fixedBase(interval * i + min, interval);
41402 if (tickValue < max) {
41403 ticks.push(tickValue);
41404 }
41405 }
41406 if (ticks[ticks.length - 1] < max) {
41407 ticks.push(max);
41408 }
41409 return {
41410 min: min,
41411 max: max,
41412 interval: interval,
41413 count: count,
41414 ticks: ticks
41415 };
41416};
41417
41418/***/ }),
41419/* 323 */
41420/***/ (function(module, exports, __webpack_require__) {
41421
41422function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
41423
41424function _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; }
41425
41426function _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; }
41427
41428/**
41429 * @fileOverview The data is replaced with constant
41430 * @author dxq613@gmail.com
41431 */
41432
41433var Base = __webpack_require__(41);
41434var Util = __webpack_require__(0);
41435
41436var Identity = function (_Base) {
41437 _inherits(Identity, _Base);
41438
41439 function Identity() {
41440 _classCallCheck(this, Identity);
41441
41442 return _possibleConstructorReturn(this, _Base.apply(this, arguments));
41443 }
41444
41445 /**
41446 * @override
41447 */
41448 Identity.prototype.getDefaultCfg = function getDefaultCfg() {
41449 var cfg = _Base.prototype.getDefaultCfg.call(this);
41450 return Util.mix({}, cfg, {
41451 isIdentity: true,
41452 /**
41453 * @override
41454 * @type {String}
41455 */
41456 type: 'identity',
41457
41458 /**
41459 * 常量值
41460 * @type {*}
41461 */
41462 value: null
41463 });
41464 };
41465
41466 /**
41467 * @override
41468 */
41469
41470
41471 Identity.prototype.getText = function getText() {
41472 return this.value.toString();
41473 };
41474
41475 /**
41476 * @override
41477 */
41478
41479
41480 Identity.prototype.scale = function scale(value) {
41481 if (this.value !== value && Util.isNumber(value)) {
41482 return value;
41483 }
41484 return this.range[0];
41485 };
41486
41487 /**
41488 * @override
41489 */
41490
41491
41492 Identity.prototype.invert = function invert() {
41493 return this.value;
41494 };
41495
41496 return Identity;
41497}(Base);
41498
41499module.exports = Identity;
41500
41501/***/ }),
41502/* 324 */
41503/***/ (function(module, exports, __webpack_require__) {
41504
41505function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
41506
41507function _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; }
41508
41509function _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; }
41510
41511/**
41512 * @fileOverview The measurement of linear data scale function
41513 * @author dxq613@gmail.com
41514 */
41515
41516var Linear = __webpack_require__(42);
41517var Util = __webpack_require__(0);
41518var timeAuto = __webpack_require__(325);
41519var fecha = __webpack_require__(120);
41520var TimeUtil = __webpack_require__(121);
41521
41522/**
41523 * 时间度量的构造函数
41524 * @class Scale.Time
41525 */
41526
41527var Time = function (_Linear) {
41528 _inherits(Time, _Linear);
41529
41530 function Time() {
41531 _classCallCheck(this, Time);
41532
41533 return _possibleConstructorReturn(this, _Linear.apply(this, arguments));
41534 }
41535
41536 /**
41537 * @override
41538 */
41539 Time.prototype.getDefaultCfg = function getDefaultCfg() {
41540 var cfg = _Linear.prototype.getDefaultCfg.call(this);
41541 return Util.mix({}, cfg, {
41542 /**
41543 * @override
41544 */
41545 type: 'time',
41546
41547 /**
41548 * 格式化符
41549 * @type {String}
41550 */
41551 mask: 'YYYY-MM-DD'
41552 });
41553 };
41554
41555 /**
41556 * @override
41557 */
41558
41559
41560 Time.prototype.init = function init() {
41561 var self = this;
41562 var values = self.values;
41563 if (values) {
41564 // 重新计算最大最小值
41565 var timeStamps = [];
41566 var min = Infinity; // 最小值
41567 var secondMin = min; // 次小值
41568 var max = 0;
41569 // 使用一个循环,计算min,max,secondMin
41570 Util.each(values, function (v) {
41571 var timeStamp = self._toTimeStamp(v);
41572 if (min > timeStamp) {
41573 secondMin = min;
41574 min = timeStamp;
41575 } else if (secondMin > timeStamp) {
41576 secondMin = timeStamp;
41577 }
41578 if (max < timeStamp) {
41579 max = timeStamp;
41580 }
41581 timeStamps.push(timeStamp);
41582 });
41583 // 存在多个值时,设置最小间距
41584 if (values.length > 1) {
41585 self.minTickInterval = secondMin - min;
41586 }
41587 if (Util.isNil(self.min) || self._toTimeStamp(self.min) > min) {
41588 self.min = min;
41589 }
41590 if (Util.isNil(self.max) || self._toTimeStamp(self.max) < max) {
41591 self.max = max;
41592 }
41593 }
41594 _Linear.prototype.init.call(this);
41595 };
41596
41597 Time.prototype.calculateTicks = function calculateTicks() {
41598 var self = this;
41599 var min = self.min;
41600 var max = self.max;
41601 var count = self.tickCount;
41602 var interval = self.tickInterval;
41603 var tmp = timeAuto({
41604 min: min,
41605 max: max,
41606 minCount: count,
41607 maxCount: count,
41608 interval: interval,
41609 minInterval: self.minTickInterval
41610 });
41611 return tmp.ticks;
41612 };
41613
41614 /**
41615 * @override
41616 */
41617
41618
41619 Time.prototype.getText = function getText(value) {
41620 var formatter = this.formatter;
41621 value = this.translate(value);
41622 value = formatter ? formatter(value) : fecha.format(value, this.mask);
41623 return value;
41624 };
41625
41626 /**
41627 * @override
41628 */
41629
41630
41631 Time.prototype.scale = function scale(value) {
41632 if (Util.isString(value)) {
41633 value = this.translate(value);
41634 }
41635 return _Linear.prototype.scale.call(this, value);
41636 };
41637
41638 /**
41639 * @override
41640 */
41641
41642
41643 Time.prototype.translate = function translate(value) {
41644 return this._toTimeStamp(value);
41645 };
41646
41647 // 将时间转换为时间戳
41648
41649
41650 Time.prototype._toTimeStamp = function _toTimeStamp(value) {
41651 return TimeUtil.toTimeStamp(value);
41652 };
41653
41654 return Time;
41655}(Linear);
41656
41657module.exports = Time;
41658
41659/***/ }),
41660/* 325 */
41661/***/ (function(module, exports, __webpack_require__) {
41662
41663/**
41664 * @fileOverview 计算时间坐标轴
41665 * @author dxq613@gmail.com
41666 */
41667
41668var Util = __webpack_require__(0);
41669var AutoUtil = __webpack_require__(117);
41670
41671var MAX_COUNT = 6;
41672var SNAP_ARRAY = [1, 2, 4, 6, 8, 12];
41673var MINUTE_MS = 60 * 1000;
41674var HOUR_MS = 3600 * 1000;
41675var DAY_MS = 24 * 3600 * 1000;
41676
41677function getYear(date) {
41678 return new Date(date).getFullYear();
41679}
41680
41681function createYear(year) {
41682 return new Date(year, 0, 1).getTime();
41683}
41684
41685function getMonth(date) {
41686 return new Date(date).getMonth();
41687}
41688
41689function diffMonth(min, max) {
41690 var minYear = getYear(min);
41691 var maxYear = getYear(max);
41692 var minMonth = getMonth(min);
41693 var maxMonth = getMonth(max);
41694 return (maxYear - minYear) * 12 + (maxMonth - minMonth) % 12;
41695}
41696
41697function creatMonth(year, month) {
41698 return new Date(year, month, 1).getTime();
41699}
41700
41701function diffDay(min, max) {
41702 return Math.ceil((max - min) / DAY_MS);
41703}
41704
41705function diffHour(min, max) {
41706 return Math.ceil((max - min) / HOUR_MS);
41707}
41708
41709function diffMinus(min, max) {
41710 return Math.ceil((max - min) / (60 * 1000));
41711}
41712
41713module.exports = function (info) {
41714 var minInterval = info.minInterval;
41715 var ticks = [];
41716 var min = info.min;
41717 var max = info.max;
41718 var interval = info.interval;
41719 var count = void 0;
41720
41721 // 如果最大值和最小值相等,则设置最大值大于最小值一天
41722 if (max === min) {
41723 max = min + DAY_MS;
41724 }
41725
41726 // 计算间距
41727 if (Util.isNil(interval)) {
41728 var innerTime = max - min;
41729 var dms = DAY_MS; // 天代表的秒
41730 var yms = 365 * dms; // 年代表的秒
41731 interval = parseInt(innerTime / (info.maxCount || MAX_COUNT), 10);
41732 if (minInterval && minInterval > interval) {
41733 interval = minInterval;
41734 }
41735 var yfactor = interval / yms;
41736 var minYear = getYear(min);
41737 // 大于半年
41738 if (yfactor > 0.51) {
41739 var year = Math.ceil(yfactor);
41740 // interval = year * yms;
41741 var maxYear = getYear(max);
41742
41743 for (var i = minYear; i <= maxYear + year; i = i + year) {
41744 ticks.push(createYear(i));
41745 }
41746 interval = null;
41747 } else if (yfactor > 0.0834) {
41748 // 大于一个月
41749 var month = Math.ceil(yfactor / 0.0834);
41750 var mmMoth = getMonth(min);
41751 var dMonths = diffMonth(min, max);
41752
41753 for (var _i = 0; _i <= dMonths + month; _i = _i + month) {
41754 ticks.push(creatMonth(minYear, _i + mmMoth));
41755 }
41756 interval = null;
41757 } else if (interval > dms * 0.5) {
41758 // 大于一天
41759 var date = new Date(min);
41760 var _year = date.getFullYear();
41761 var _month = date.getMonth(min);
41762 var mday = date.getDate();
41763 var day = Math.ceil(interval / dms);
41764 var ddays = diffDay(min, max);
41765 interval = day * dms;
41766 for (var _i2 = 0; _i2 < ddays + day; _i2 = _i2 + day) {
41767 ticks.push(new Date(_year, _month, mday + _i2).getTime());
41768 }
41769 } else if (interval > HOUR_MS) {
41770 // 大于一个小时
41771 var _date = new Date(min);
41772 var _year2 = _date.getFullYear();
41773 var _month2 = _date.getMonth(min);
41774 var _day = _date.getDate();
41775 var hour = _date.getHours();
41776 var hours = AutoUtil.snapTo(SNAP_ARRAY, Math.ceil(interval / HOUR_MS));
41777 var dHours = diffHour(min, max);
41778 interval = hours * HOUR_MS;
41779
41780 for (var _i3 = 0; _i3 <= dHours + hours; _i3 = _i3 + hours) {
41781 ticks.push(new Date(_year2, _month2, _day, hour + _i3).getTime());
41782 }
41783 } else if (interval > MINUTE_MS) {
41784 // 最小单位是分钟
41785 var dMinus = diffMinus(min, max);
41786 var minutes = Math.ceil(interval / MINUTE_MS);
41787 interval = minutes * MINUTE_MS;
41788
41789 for (var _i4 = 0; _i4 <= dMinus + minutes; _i4 = _i4 + minutes) {
41790 ticks.push(min + _i4 * MINUTE_MS);
41791 }
41792 } else {
41793 if (interval < 1000) {
41794 interval = 1000;
41795 }
41796 min = Math.floor(min / 1000) * 1000;
41797 var dSeconds = Math.ceil((max - min) / 1000);
41798 var seconds = Math.ceil(interval / 1000);
41799 interval = seconds * 1000;
41800
41801 for (var _i5 = 0; _i5 < dSeconds + seconds; _i5 = _i5 + seconds) {
41802 ticks.push(min + _i5 * 1000);
41803 }
41804 }
41805 }
41806
41807 if (!ticks.length) {
41808 min = Math.floor(min / 1000) * 1000;
41809 max = Math.ceil(max / 1000) * 1000;
41810 count = (max - min) / interval;
41811 for (var _i6 = 0; _i6 <= count; _i6++) {
41812 ticks.push(Util.fixedBase(interval * _i6 + min, interval));
41813 }
41814 }
41815
41816 return {
41817 max: max,
41818 min: min,
41819 interval: interval,
41820 ticks: ticks,
41821 count: ticks.length
41822 };
41823};
41824
41825/***/ }),
41826/* 326 */
41827/***/ (function(module, exports, __webpack_require__) {
41828
41829function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
41830
41831function _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; }
41832
41833function _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; }
41834
41835/**
41836 * @fileOverview 时间数据作为分类类型
41837 * @author dxq613@gmail.com
41838 */
41839
41840var Category = __webpack_require__(118);
41841var Util = __webpack_require__(0);
41842var fecha = __webpack_require__(120);
41843var catAuto = __webpack_require__(119);
41844var TimeUtil = __webpack_require__(121);
41845
41846/**
41847 * 度量的构造函数
41848 * @class Scale.TimeCategory
41849 */
41850
41851var TimeCategory = function (_Category) {
41852 _inherits(TimeCategory, _Category);
41853
41854 function TimeCategory() {
41855 _classCallCheck(this, TimeCategory);
41856
41857 return _possibleConstructorReturn(this, _Category.apply(this, arguments));
41858 }
41859
41860 /**
41861 * @override
41862 */
41863 TimeCategory.prototype.getDefaultCfg = function getDefaultCfg() {
41864 var cfg = _Category.prototype.getDefaultCfg.call(this);
41865 return Util.mix({}, cfg, {
41866 /**
41867 * @override
41868 */
41869 type: 'timeCat',
41870
41871 /**
41872 * 格式化符
41873 * @type {String}
41874 */
41875 mask: 'YYYY-MM-DD',
41876
41877 /**
41878 * @override
41879 */
41880 tickCount: 5
41881 });
41882 };
41883
41884 TimeCategory.prototype.init = function init() {
41885 var self = this;
41886 var values = this.values;
41887 // 针对时间分类类型,会将时间统一转换为时间戳
41888 Util.each(values, function (v, i) {
41889 values[i] = self._toTimeStamp(v);
41890 });
41891 values.sort(function (v1, v2) {
41892 return v1 - v2;
41893 });
41894
41895 if (!self.ticks) {
41896 self.ticks = this.calculateTicks(false);
41897 }
41898 };
41899
41900 /**
41901 * 计算 ticks
41902 * @param {boolean} formated 是否将 ticks 按照指定的 mask 格式化
41903 * @return {array} 返回 ticks 数组
41904 */
41905
41906
41907 TimeCategory.prototype.calculateTicks = function calculateTicks(formated) {
41908 var self = this;
41909 var count = self.tickCount;
41910 var temp = catAuto({
41911 maxCount: count,
41912 data: self.values
41913 });
41914
41915 var ticks = temp.ticks;
41916 if (formated) {
41917 Util.each(ticks, function (value, index) {
41918 ticks[index] = fecha.format(value, self.mask);
41919 });
41920 }
41921 return ticks;
41922 };
41923
41924 /**
41925 * @override
41926 */
41927
41928
41929 TimeCategory.prototype.translate = function translate(value) {
41930 value = this._toTimeStamp(value);
41931 var index = this.values.indexOf(value);
41932
41933 if (index === -1) {
41934 if (Util.isNumber(value) && value < this.values.length) {
41935 index = value;
41936 } else {
41937 index = NaN;
41938 }
41939 }
41940 return index;
41941 };
41942
41943 /**
41944 * @override
41945 */
41946
41947
41948 TimeCategory.prototype.scale = function scale(value) {
41949 var rangeMin = this.rangeMin();
41950 var rangeMax = this.rangeMax();
41951 var index = this.translate(value);
41952 var percent = void 0;
41953
41954 if (this.values.length === 1) {
41955 percent = index;
41956 } else if (index > -1) {
41957 percent = index / (this.values.length - 1);
41958 } else {
41959 percent = 0;
41960 }
41961
41962 return rangeMin + percent * (rangeMax - rangeMin);
41963 };
41964
41965 /**
41966 * @override
41967 */
41968
41969
41970 TimeCategory.prototype.getText = function getText(value) {
41971 var result = '';
41972 var index = this.translate(value);
41973 if (index > -1) {
41974 result = this.values[index];
41975 } else {
41976 result = value;
41977 }
41978
41979 var formatter = this.formatter;
41980 result = parseInt(result, 10);
41981 result = formatter ? formatter(result) : fecha.format(result, this.mask);
41982 return result;
41983 };
41984
41985 /**
41986 * @override
41987 */
41988
41989
41990 TimeCategory.prototype.getTicks = function getTicks() {
41991 var self = this;
41992 var ticks = this.ticks;
41993 var rst = [];
41994 Util.each(ticks, function (tick) {
41995 var obj = void 0;
41996 if (Util.isObject(tick)) {
41997 obj = tick;
41998 } else {
41999 obj = {
42000 text: Util.isString(tick) ? tick : self.getText(tick),
42001 value: self.scale(tick)
42002 };
42003 }
42004 rst.push(obj);
42005 });
42006 return rst;
42007 };
42008
42009 // 将时间转换为时间戳
42010
42011
42012 TimeCategory.prototype._toTimeStamp = function _toTimeStamp(value) {
42013 return TimeUtil.toTimeStamp(value);
42014 };
42015
42016 return TimeCategory;
42017}(Category);
42018
42019module.exports = TimeCategory;
42020
42021/***/ }),
42022/* 327 */
42023/***/ (function(module, exports, __webpack_require__) {
42024
42025function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
42026
42027function _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; }
42028
42029function _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; }
42030
42031/**
42032 * @fileOverview 使用度量,进行log转换
42033 * @author dxq613@gmail.com
42034 */
42035
42036var Linear = __webpack_require__(42);
42037var Util = __webpack_require__(0);
42038
42039// 计算log
42040function log(a, b) {
42041 if (a === 1) {
42042 return 1;
42043 }
42044 return Math.log(b) / Math.log(a);
42045}
42046
42047/**
42048 * 度量的log计算
42049 * @class Scale.Log
42050 */
42051
42052var Log = function (_Linear) {
42053 _inherits(Log, _Linear);
42054
42055 function Log() {
42056 _classCallCheck(this, Log);
42057
42058 return _possibleConstructorReturn(this, _Linear.apply(this, arguments));
42059 }
42060
42061 /**
42062 * @override
42063 */
42064 Log.prototype.getDefaultCfg = function getDefaultCfg() {
42065 var cfg = _Linear.prototype.getDefaultCfg.call(this);
42066 return Util.mix({}, cfg, {
42067 /**
42068 * @override
42069 */
42070 type: 'log',
42071
42072 /**
42073 * 进行log计算的基数
42074 * @type {Number}
42075 */
42076 base: 2,
42077
42078 /**
42079 * @override
42080 * log 的坐标点的个数控制在10个以下
42081 * @type {Number}
42082 */
42083 tickCount: 10,
42084
42085 // 最小的tick,仅内部使用
42086 _minTick: null
42087 });
42088 };
42089 /**
42090 * @override
42091 */
42092
42093
42094 Log.prototype.calculateTicks = function calculateTicks() {
42095 var self = this;
42096 var base = self.base;
42097 var minTick = void 0;
42098 if (self.min < 0) {
42099 throw new Error('The minimum value must be greater than zero!');
42100 }
42101 var maxTick = log(base, self.max);
42102
42103 if (self.min > 0) {
42104 minTick = Math.floor(log(base, self.min));
42105 } else {
42106 var values = self.values;
42107 var positiveMin = self.max; // 查找大于0的第一个值, 如果都小于0,默认为1
42108 Util.each(values, function (value) {
42109 if (value > 0 && value < positiveMin) {
42110 positiveMin = value;
42111 }
42112 });
42113 if (positiveMin === self.max) {
42114 positiveMin = self.max / base;
42115 }
42116 if (positiveMin > 1) {
42117 positiveMin = 1;
42118 }
42119 minTick = Math.floor(log(base, positiveMin));
42120 self._minTick = minTick;
42121 self.positiveMin = positiveMin;
42122 }
42123 var count = maxTick - minTick;
42124 var tickCount = self.tickCount;
42125 var avg = Math.ceil(count / tickCount);
42126 var ticks = [];
42127
42128 for (var i = minTick; i < maxTick + avg; i = i + avg) {
42129 ticks.push(Math.pow(base, i));
42130 } /**/
42131 if (self.min === 0) {
42132 ticks.unshift(0);
42133 }
42134 return ticks;
42135 };
42136 // 获取度量计算时,value占的定义域百分比
42137
42138
42139 Log.prototype._getScalePercent = function _getScalePercent(value) {
42140 var max = this.max;
42141 var min = this.min;
42142 if (max === min) {
42143 return 0;
42144 }
42145 // 如果值小于等于0,则按照0处理
42146 if (value <= 0) {
42147 return 0;
42148 }
42149 var base = this.base;
42150 var positiveMin = this.positiveMin;
42151 // 如果min == 0, 则根据比0大的最小值,计算比例关系。这个最小值作为坐标轴上的第二个tick,第一个是0但是不显示
42152 if (positiveMin) {
42153 min = positiveMin * 1 / base;
42154 }
42155 var percent = void 0;
42156 // 如果数值小于次小值,那么就计算 value / 次小值 占整体的比例
42157 if (value < positiveMin) {
42158 percent = value / positiveMin / (log(base, max) - log(base, min));
42159 } else {
42160 percent = (log(base, value) - log(base, min)) / (log(base, max) - log(base, min));
42161 }
42162 return percent;
42163 };
42164
42165 /**
42166 * @override
42167 */
42168
42169
42170 Log.prototype.scale = function scale(value) {
42171 var percent = this._getScalePercent(value);
42172 var rangeMin = this.rangeMin();
42173 var rangeMax = this.rangeMax();
42174 return rangeMin + percent * (rangeMax - rangeMin);
42175 };
42176 /**
42177 * @override
42178 */
42179
42180
42181 Log.prototype.invert = function invert(value) {
42182 var base = this.base;
42183 var max = log(base, this.max);
42184 var rangeMin = this.rangeMin();
42185 var range = this.rangeMax() - rangeMin;
42186 var min = void 0;
42187 var positiveMin = this.positiveMin;
42188 if (positiveMin) {
42189 if (value === 0) {
42190 return 0;
42191 }
42192 min = log(base, positiveMin / base);
42193 var appendPercent = 1 / (max - min) * range; // 0 到 positiveMin的占比
42194 if (value < appendPercent) {
42195 // 落到 0 - positiveMin 之间
42196 return value / appendPercent * positiveMin;
42197 }
42198 } else {
42199 min = log(base, this.min);
42200 }
42201 var percent = (value - rangeMin) / range;
42202 var tmp = percent * (max - min) + min;
42203 return Math.pow(base, tmp);
42204 };
42205
42206 return Log;
42207}(Linear);
42208
42209module.exports = Log;
42210
42211/***/ }),
42212/* 328 */
42213/***/ (function(module, exports, __webpack_require__) {
42214
42215function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
42216
42217function _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; }
42218
42219function _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; }
42220
42221/**
42222 * @fileOverview 使用pow进行度量计算
42223 * @author dxq613@gmail.com
42224 */
42225
42226var Linear = __webpack_require__(42);
42227var Util = __webpack_require__(0);
42228
42229// 求以a为次幂,结果为b的基数,如 x^^a = b;求x
42230function calBase(a, b) {
42231 var e = Math.E;
42232 var value = Math.pow(e, Math.log(b) / a); // 使用换底公式求底
42233 return value;
42234}
42235
42236/**
42237 * 度量的Pow计算
42238 * @class Scale.Log
42239 */
42240
42241var Pow = function (_Linear) {
42242 _inherits(Pow, _Linear);
42243
42244 function Pow() {
42245 _classCallCheck(this, Pow);
42246
42247 return _possibleConstructorReturn(this, _Linear.apply(this, arguments));
42248 }
42249
42250 /**
42251 * @override
42252 */
42253 Pow.prototype.getDefaultCfg = function getDefaultCfg() {
42254 var cfg = _Linear.prototype.getDefaultCfg.call(this);
42255 return Util.mix({}, cfg, {
42256 /**
42257 * @override
42258 */
42259 type: 'pow',
42260
42261 /**
42262 * 进行pow计算的基数
42263 * @type {Number}
42264 */
42265 exponent: 2,
42266
42267 /**
42268 * @override
42269 * pow 的坐标点的个数控制在10个以下
42270 * @type {Number}
42271 */
42272 tickCount: 10
42273 });
42274 };
42275
42276 /**
42277 * @override
42278 */
42279
42280
42281 Pow.prototype.calculateTicks = function calculateTicks() {
42282 var self = this;
42283 var exponent = self.exponent;
42284 var min = void 0;
42285 var max = Math.ceil(calBase(exponent, self.max));
42286
42287 if (self.min >= 0) {
42288 min = Math.floor(calBase(exponent, self.min));
42289 } else {
42290 min = 0;
42291 }
42292 if (min > max) {
42293 var tmp = max;
42294 max = min;
42295 min = tmp;
42296 }
42297 var count = max - min;
42298 var tickCount = self.tickCount;
42299 var avg = Math.ceil(count / tickCount);
42300 var ticks = [];
42301
42302 for (var i = min; i < max + avg; i = i + avg) {
42303 ticks.push(Math.pow(i, exponent));
42304 }
42305 return ticks;
42306 };
42307
42308 // 获取度量计算时,value占的定义域百分比
42309
42310
42311 Pow.prototype._getScalePercent = function _getScalePercent(value) {
42312 var max = this.max;
42313 var min = this.min;
42314 if (max === min) {
42315 return 0;
42316 }
42317 var exponent = this.exponent;
42318 var percent = (calBase(exponent, value) - calBase(exponent, min)) / (calBase(exponent, max) - calBase(exponent, min));
42319 return percent;
42320 };
42321
42322 /**
42323 * @override
42324 */
42325
42326
42327 Pow.prototype.scale = function scale(value) {
42328 var percent = this._getScalePercent(value);
42329 var rangeMin = this.rangeMin();
42330 var rangeMax = this.rangeMax();
42331 return rangeMin + percent * (rangeMax - rangeMin);
42332 };
42333
42334 /**
42335 * @override
42336 */
42337
42338
42339 Pow.prototype.invert = function invert(value) {
42340 var percent = (value - this.rangeMin()) / (this.rangeMax() - this.rangeMin());
42341 var exponent = this.exponent;
42342 var max = calBase(exponent, this.max);
42343 var min = calBase(exponent, this.min);
42344 var tmp = percent * (max - min) + min;
42345 return Math.pow(tmp, exponent);
42346 };
42347
42348 return Pow;
42349}(Linear);
42350
42351module.exports = Pow;
42352
42353/***/ }),
42354/* 329 */
42355/***/ (function(module, exports, __webpack_require__) {
42356
42357function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
42358
42359/**
42360 * @fileOverview The controller of coordinate
42361 * @author sima.zhang
42362 */
42363var Util = __webpack_require__(0);
42364var Coord = __webpack_require__(330);
42365
42366var CoordController = function () {
42367 function CoordController(option) {
42368 _classCallCheck(this, CoordController);
42369
42370 this.type = 'rect';
42371 this.actions = [];
42372 this.cfg = {};
42373 Util.mix(this, option);
42374 this.option = option || {};
42375 }
42376
42377 CoordController.prototype.reset = function reset(coordOption) {
42378 this.actions = coordOption.actions || [];
42379 this.type = coordOption.type;
42380 this.cfg = coordOption.cfg;
42381 this.option.actions = this.actions;
42382 this.option.type = this.type;
42383 this.option.cfg = this.cfg;
42384 return this;
42385 };
42386
42387 CoordController.prototype._execActions = function _execActions(coord) {
42388 var actions = this.actions;
42389 Util.each(actions, function (action) {
42390 var m = action[0];
42391 coord[m](action[1], action[2]);
42392 });
42393 };
42394
42395 CoordController.prototype.hasAction = function hasAction(actionName) {
42396 var actions = this.actions;
42397 var rst = false;
42398 Util.each(actions, function (action) {
42399 if (actionName === action[0]) {
42400 rst = true;
42401 return false;
42402 }
42403 });
42404 return rst;
42405 };
42406 /**
42407 * 创建坐标系对象
42408 * @param {Object} start 坐标系起始点
42409 * @param {Object} end 坐标系结束点
42410 * @return {Function} 坐标系的构造函数
42411 */
42412
42413
42414 CoordController.prototype.createCoord = function createCoord(start, end) {
42415 var self = this;
42416 var type = self.type;
42417 var cfg = self.cfg;
42418 var C = void 0; // 构造函数
42419 var coord = void 0;
42420
42421 var coordCfg = Util.mix({
42422 start: start,
42423 end: end
42424 }, cfg);
42425
42426 if (type === 'theta') {
42427 C = Coord.Polar;
42428
42429 if (!self.hasAction('transpose')) {
42430 self.transpose(); // 极坐标,同时transpose
42431 }
42432 coord = new C(coordCfg);
42433 coord.type = type;
42434 } else {
42435 C = Coord[Util.upperFirst(type)] || Coord.Rect;
42436 coord = new C(coordCfg);
42437 }
42438
42439 self._execActions(coord);
42440 return coord;
42441 };
42442
42443 CoordController.prototype.rotate = function rotate(angle) {
42444 angle = angle * Math.PI / 180;
42445 this.actions.push(['rotate', angle]);
42446 return this;
42447 };
42448
42449 CoordController.prototype.reflect = function reflect(dim) {
42450 this.actions.push(['reflect', dim]);
42451 return this;
42452 };
42453
42454 CoordController.prototype.scale = function scale(sx, sy) {
42455 this.actions.push(['scale', sx, sy]);
42456 return this;
42457 };
42458
42459 CoordController.prototype.transpose = function transpose() {
42460 this.actions.push(['transpose']);
42461 return this;
42462 };
42463
42464 return CoordController;
42465}();
42466
42467module.exports = CoordController;
42468
42469/***/ }),
42470/* 330 */
42471/***/ (function(module, exports, __webpack_require__) {
42472
42473/**
42474 * @fileOverview the entry of coordinate
42475 * @author sima.zhang1990@gmail.com
42476 */
42477var Coord = __webpack_require__(43);
42478Coord.Cartesian = __webpack_require__(331);
42479Coord.Rect = Coord.Cartesian;
42480Coord.Polar = __webpack_require__(332);
42481Coord.Helix = __webpack_require__(333);
42482
42483module.exports = Coord;
42484
42485/***/ }),
42486/* 331 */
42487/***/ (function(module, exports, __webpack_require__) {
42488
42489function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
42490
42491function _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; }
42492
42493function _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; }
42494
42495/**
42496 * @fileOverview the class of Cartesian Coordinate
42497 * @author sima.zhang
42498 */
42499var Util = __webpack_require__(0);
42500var Base = __webpack_require__(43);
42501
42502var Cartesian = function (_Base) {
42503 _inherits(Cartesian, _Base);
42504
42505 /**
42506 * @override
42507 */
42508 Cartesian.prototype.getDefaultCfg = function getDefaultCfg() {
42509 var cfg = _Base.prototype.getDefaultCfg.call(this);
42510 return Util.mix({}, cfg, {
42511 start: {
42512 x: 0,
42513 y: 0
42514 },
42515 end: {
42516 x: 0,
42517 y: 0
42518 },
42519 type: 'cartesian',
42520 isRect: true
42521 });
42522 };
42523
42524 function Cartesian(cfg) {
42525 _classCallCheck(this, Cartesian);
42526
42527 var _this = _possibleConstructorReturn(this, _Base.call(this, cfg));
42528
42529 _this._init();
42530 return _this;
42531 }
42532
42533 Cartesian.prototype._init = function _init() {
42534 var start = this.start,
42535 end = this.end;
42536
42537 var x = {
42538 start: start.x,
42539 end: end.x
42540 };
42541 var y = {
42542 start: start.y,
42543 end: end.y
42544 };
42545 this.x = x;
42546 this.y = y;
42547 };
42548
42549 Cartesian.prototype.convertPoint = function convertPoint(point) {
42550 var x = void 0;
42551 var y = void 0;
42552 if (this.isTransposed) {
42553 x = point.y;
42554 y = point.x;
42555 } else {
42556 x = point.x;
42557 y = point.y;
42558 }
42559
42560 return {
42561 x: this.convertDim(x, 'x'),
42562 y: this.convertDim(y, 'y')
42563 };
42564 };
42565
42566 Cartesian.prototype.invertPoint = function invertPoint(point) {
42567 var x = this.invertDim(point.x, 'x');
42568 var y = this.invertDim(point.y, 'y');
42569
42570 if (this.isTransposed) {
42571 return {
42572 x: y,
42573 y: x
42574 };
42575 }
42576
42577 return {
42578 x: x,
42579 y: y
42580 };
42581 };
42582
42583 return Cartesian;
42584}(Base);
42585
42586module.exports = Cartesian;
42587
42588/***/ }),
42589/* 332 */
42590/***/ (function(module, exports, __webpack_require__) {
42591
42592function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
42593
42594function _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; }
42595
42596function _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; }
42597
42598/**
42599 * @fileOverview the class of Polar Coordinate
42600 * @author sima.zhang
42601 */
42602var Util = __webpack_require__(0);
42603var Base = __webpack_require__(43);
42604var MatrixUtil = __webpack_require__(2).MatrixUtil;
42605var mat3 = MatrixUtil.mat3;
42606var vec2 = MatrixUtil.vec2;
42607var vec3 = MatrixUtil.vec3;
42608
42609var Polar = function (_Base) {
42610 _inherits(Polar, _Base);
42611
42612 Polar.prototype.getDefaultCfg = function getDefaultCfg() {
42613 var cfg = _Base.prototype.getDefaultCfg.call(this);
42614 return Util.mix({}, cfg, {
42615 startAngle: -Math.PI / 2,
42616 endAngle: Math.PI * 3 / 2,
42617 innerRadius: 0,
42618 type: 'polar',
42619 isPolar: true
42620 });
42621 };
42622
42623 function Polar(cfg) {
42624 _classCallCheck(this, Polar);
42625
42626 var _this = _possibleConstructorReturn(this, _Base.call(this, cfg));
42627
42628 _this._init();
42629 return _this;
42630 }
42631
42632 Polar.prototype._init = function _init() {
42633 var radius = this.radius;
42634 var innerRadius = this.innerRadius;
42635 var startAngle = this.startAngle;
42636 var endAngle = this.endAngle;
42637 var center = this.center;
42638 var oneBox = this.getOneBox();
42639
42640 var oneWidth = oneBox.maxX - oneBox.minX;
42641 var oneHeight = oneBox.maxY - oneBox.minY;
42642 var left = Math.abs(oneBox.minX) / oneWidth;
42643 var top = Math.abs(oneBox.minY) / oneHeight;
42644 var width = this.width;
42645 var height = this.height;
42646 var maxRadius = void 0;
42647 var circleCentre = void 0;
42648 if (height / oneHeight > width / oneWidth) {
42649 // width为主
42650 maxRadius = width / oneWidth;
42651 circleCentre = {
42652 x: center.x - (0.5 - left) * width,
42653 y: center.y - (0.5 - top) * maxRadius * oneHeight
42654 };
42655 } else {
42656 // height为主
42657 maxRadius = height / oneHeight;
42658 circleCentre = {
42659 x: center.x - (0.5 - left) * maxRadius * oneWidth,
42660 y: center.y - (0.5 - top) * height
42661 };
42662 }
42663
42664 if (!radius) {
42665 radius = maxRadius;
42666 } else if (radius > 0 && radius <= 1) {
42667 radius = maxRadius * radius;
42668 } else if (radius <= 0 || radius > maxRadius) {
42669 radius = maxRadius;
42670 }
42671
42672 var x = {
42673 start: startAngle,
42674 end: endAngle
42675 };
42676
42677 var y = {
42678 start: innerRadius * radius,
42679 end: radius
42680 };
42681
42682 this.x = x;
42683 this.y = y;
42684 this.radius = radius;
42685 this.circleCentre = circleCentre;
42686 this.center = circleCentre;
42687 };
42688
42689 Polar.prototype.getCenter = function getCenter() {
42690 return this.circleCentre;
42691 };
42692
42693 Polar.prototype.getOneBox = function getOneBox() {
42694 var startAngle = this.startAngle;
42695 var endAngle = this.endAngle;
42696 if (endAngle - startAngle >= Math.PI * 2) {
42697 return {
42698 minX: -1,
42699 maxX: 1,
42700 minY: -1,
42701 maxY: 1
42702 };
42703 }
42704 var xs = [0, Math.cos(startAngle), Math.cos(endAngle)];
42705 var ys = [0, Math.sin(startAngle), Math.sin(endAngle)];
42706
42707 for (var i = -Math.PI * 5 / 2; i < Math.PI * 3 / 2; i += Math.PI / 2) {
42708 if (startAngle <= i && i <= endAngle) {
42709 xs.push(Math.cos(i));
42710 ys.push(Math.sin(i));
42711 }
42712 }
42713
42714 return {
42715 minX: Math.min.apply(Math, xs),
42716 maxX: Math.max.apply(Math, xs),
42717 minY: Math.min.apply(Math, ys),
42718 maxY: Math.max.apply(Math, ys)
42719 };
42720 };
42721
42722 Polar.prototype.getRadius = function getRadius() {
42723 return this.radius;
42724 };
42725
42726 Polar.prototype.convertPoint = function convertPoint(point) {
42727 var center = this.getCenter();
42728 var x = this.isTransposed ? point.y : point.x;
42729 var y = this.isTransposed ? point.x : point.y;
42730
42731 x = this.convertDim(x, 'x');
42732 y = this.convertDim(y, 'y');
42733
42734 return {
42735 x: center.x + Math.cos(x) * y,
42736 y: center.y + Math.sin(x) * y
42737 };
42738 };
42739
42740 Polar.prototype.invertPoint = function invertPoint(point) {
42741 var center = this.getCenter();
42742 var vPoint = [point.x - center.x, point.y - center.y];
42743 var x = this.x;
42744 var m = [1, 0, 0, 0, 1, 0, 0, 0, 1];
42745 mat3.rotate(m, m, x.start);
42746
42747 var vStart = [1, 0, 0];
42748 vec3.transformMat3(vStart, vStart, m);
42749 vStart = [vStart[0], vStart[1]];
42750 var angle = vec2.angleTo(vStart, vPoint, x.end < x.start);
42751 if (Util.snapEqual(angle, Math.PI * 2)) {
42752 angle = 0;
42753 }
42754 var radius = vec2.length(vPoint);
42755
42756 var xPercent = angle / (x.end - x.start);
42757 xPercent = x.end - x.start > 0 ? xPercent : -xPercent;
42758
42759 var yPercent = this.invertDim(radius, 'y');
42760 var rst = {};
42761 rst.x = this.isTransposed ? yPercent : xPercent;
42762 rst.y = this.isTransposed ? xPercent : yPercent;
42763 return rst;
42764 };
42765
42766 return Polar;
42767}(Base);
42768
42769module.exports = Polar;
42770
42771/***/ }),
42772/* 333 */
42773/***/ (function(module, exports, __webpack_require__) {
42774
42775function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
42776
42777function _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; }
42778
42779function _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; }
42780
42781/**
42782 * @fileOverview the class of Helix Coordinate
42783 * @author sima.zhang
42784 */
42785var Util = __webpack_require__(0);
42786var Base = __webpack_require__(43);
42787var MatrixUtil = __webpack_require__(2).MatrixUtil;
42788var vec2 = MatrixUtil.vec2;
42789
42790var Helix = function (_Base) {
42791 _inherits(Helix, _Base);
42792
42793 Helix.prototype.getDefaultCfg = function getDefaultCfg() {
42794 var cfg = _Base.prototype.getDefaultCfg.call(this);
42795 return Util.mix({}, cfg, {
42796 startAngle: 1.25 * Math.PI,
42797 endAngle: 7.25 * Math.PI,
42798 innerRadius: 0,
42799 type: 'helix',
42800 isHelix: true
42801 });
42802 };
42803
42804 function Helix(cfg) {
42805 _classCallCheck(this, Helix);
42806
42807 var _this = _possibleConstructorReturn(this, _Base.call(this, cfg));
42808
42809 _this._init();
42810 return _this;
42811 }
42812
42813 Helix.prototype._init = function _init() {
42814 var width = this.width;
42815 var height = this.height;
42816 var radius = this.radius;
42817 var innerRadius = this.innerRadius;
42818 var startAngle = this.startAngle;
42819 var endAngle = this.endAngle;
42820
42821 var index = (endAngle - startAngle) / (2 * Math.PI) + 1; // 螺线圈数
42822 var maxRadius = Math.min(width, height) / 2;
42823 if (radius && radius >= 0 && radius <= 1) {
42824 maxRadius = maxRadius * radius;
42825 }
42826
42827 var d = Math.floor(maxRadius * (1 - innerRadius) / index);
42828 var a = d / (Math.PI * 2); // 螺线系数
42829
42830 var x = {
42831 start: startAngle,
42832 end: endAngle
42833 };
42834 var y = {
42835 start: innerRadius * maxRadius,
42836 end: innerRadius * maxRadius + d * 0.99
42837 };
42838
42839 this.a = a;
42840 this.d = d;
42841 this.x = x;
42842 this.y = y;
42843 };
42844
42845 Helix.prototype.getCenter = function getCenter() {
42846 return this.center;
42847 };
42848
42849 /**
42850 * 将百分比数据变成屏幕坐标
42851 * @param {Object} point 归一化的点坐标
42852 * @return {Object} 返回对应的屏幕坐标
42853 */
42854
42855
42856 Helix.prototype.convertPoint = function convertPoint(point) {
42857 var a = this.a;
42858 var center = this.center;
42859 var x = void 0;
42860 var y = void 0;
42861
42862 if (this.isTransposed) {
42863 x = point.y;
42864 y = point.x;
42865 } else {
42866 x = point.x;
42867 y = point.y;
42868 }
42869
42870 var thi = this.convertDim(x, 'x');
42871 var r = a * thi;
42872 var newY = this.convertDim(y, 'y');
42873
42874 return {
42875 x: center.x + Math.cos(thi) * (r + newY),
42876 y: center.y + Math.sin(thi) * (r + newY)
42877 };
42878 };
42879
42880 /**
42881 * 将屏幕坐标点还原成百分比数据
42882 * @param {Object} point 屏幕坐标
42883 * @return {Object} 返回对应的归一化后的数据
42884 */
42885
42886
42887 Helix.prototype.invertPoint = function invertPoint(point) {
42888 var center = this.center;
42889 var a = this.a;
42890 var d = this.d + this.y.start;
42891 var v = vec2.subtract([], [point.x, point.y], [center.x, center.y]);
42892 var thi = vec2.angleTo(v, [1, 0], true);
42893 var rMin = thi * a; // 坐标与原点的连线在第一圈上的交点,最小r值
42894
42895 if (vec2.length(v) < rMin) {
42896 // 坐标与原点的连线不可能小于最小r值,但不排除因小数计算产生的略小于rMin的情况
42897 rMin = vec2.length(v);
42898 }
42899
42900 var index = Math.floor((vec2.length(v) - rMin) / d); // 当前点位于第index圈
42901 thi = 2 * index * Math.PI + thi;
42902 var r = a * thi;
42903 var newY = vec2.length(v) - r;
42904 newY = Util.snapEqual(newY, 0) ? 0 : newY;
42905
42906 var x = this.invertDim(thi, 'x');
42907 var y = this.invertDim(newY, 'y');
42908 x = Util.snapEqual(x, 0) ? 0 : x;
42909 y = Util.snapEqual(y, 0) ? 0 : y;
42910
42911 var rst = {};
42912 rst.x = this.isTransposed ? y : x;
42913 rst.y = this.isTransposed ? x : y;
42914 return rst;
42915 };
42916
42917 return Helix;
42918}(Base);
42919
42920module.exports = Helix;
42921
42922/***/ }),
42923/* 334 */
42924/***/ (function(module, exports, __webpack_require__) {
42925
42926function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
42927
42928/**
42929 * @fileOverview The controller of axis
42930 * @author sima.zhang
42931 */
42932var Util = __webpack_require__(0);
42933
42934var _require = __webpack_require__(25),
42935 Axis = _require.Axis;
42936
42937var vec2 = __webpack_require__(2).MatrixUtil.vec2;
42938
42939var Global = __webpack_require__(1);
42940
42941function formatTicks(ticks) {
42942 var tmp = [];
42943 if (ticks.length > 0) {
42944 tmp = ticks.slice(0);
42945 var first = tmp[0];
42946 var last = tmp[tmp.length - 1];
42947 if (first.value !== 0) {
42948 tmp.unshift({
42949 value: 0
42950 });
42951 }
42952 if (last.value !== 1) {
42953 tmp.push({
42954 value: 1
42955 });
42956 }
42957 }
42958 return tmp;
42959}
42960
42961var AxisController = function () {
42962 function AxisController(cfg) {
42963 _classCallCheck(this, AxisController);
42964
42965 this.visible = true;
42966 this.container = null;
42967 this.coord = null;
42968 this.options = null;
42969 this.axes = [];
42970 Util.mix(this, cfg);
42971 }
42972
42973 AxisController.prototype._isHide = function _isHide(field) {
42974 // 对应的坐标轴是否隐藏
42975 var options = this.options;
42976
42977 if (options && options[field] === false) {
42978 return true;
42979 }
42980 return false;
42981 };
42982
42983 AxisController.prototype._getMiddleValue = function _getMiddleValue(curValue, ticks, index) {
42984 var tickCount = ticks.length;
42985 if (index === tickCount - 1) {
42986 return null;
42987 }
42988 var nextValue = ticks[index + 1].value;
42989 return (curValue + nextValue) / 2;
42990 };
42991
42992 AxisController.prototype._getLineRange = function _getLineRange(coord, scale, dimType, index) {
42993 var start = void 0;
42994 var end = void 0;
42995 var isVertical = void 0;
42996 var field = scale.field;
42997 var options = this.options;
42998 var position = '';
42999 if (options[field] && options[field].position) {
43000 position = options[field].position;
43001 }
43002
43003 if (dimType === 'x') {
43004 // x轴的坐标轴,底部的横坐标
43005 start = {
43006 x: 0,
43007 y: position === 'top' ? 1 : 0
43008 };
43009 end = {
43010 x: 1,
43011 y: position === 'top' ? 1 : 0
43012 };
43013 isVertical = false;
43014 } else {
43015 // y轴坐标轴
43016 if (index) {
43017 // 多轴的情况
43018 start = {
43019 x: position === 'left' ? 0 : 1,
43020 y: 0
43021 };
43022 end = {
43023 x: position === 'left' ? 0 : 1,
43024 y: 1
43025 };
43026 } else {
43027 // 单个y轴,或者第一个y轴
43028 start = {
43029 x: position === 'right' ? 1 : 0,
43030 y: 0
43031 };
43032 end = {
43033 x: position === 'right' ? 1 : 0,
43034 y: 1
43035 };
43036 }
43037 isVertical = true;
43038 }
43039
43040 start = coord.convert(start);
43041 end = coord.convert(end);
43042
43043 return {
43044 start: start,
43045 end: end,
43046 isVertical: isVertical
43047 };
43048 };
43049
43050 AxisController.prototype._getLineCfg = function _getLineCfg(coord, scale, dimType, index) {
43051 var factor = void 0;
43052 var range = this._getLineRange(coord, scale, dimType, index);
43053 var isVertical = range.isVertical; // 标识该坐标轴是否是纵坐标
43054 var start = range.start;
43055 var end = range.end;
43056 var center = coord.center;
43057
43058 if (coord.isTransposed) {
43059 isVertical = !isVertical;
43060 }
43061
43062 if (isVertical && start.x > center.x || !isVertical && start.y > center.y) {
43063 factor = 1;
43064 } else {
43065 factor = -1;
43066 }
43067
43068 return {
43069 isVertical: isVertical,
43070 factor: factor,
43071 start: start,
43072 end: end
43073 };
43074 };
43075
43076 // 获取圆弧坐标轴配置项信息
43077
43078
43079 AxisController.prototype._getCircleCfg = function _getCircleCfg(coord) {
43080 var circleCfg = {};
43081 var rangeX = coord.x;
43082 var rangeY = coord.y;
43083 var isReflectY = rangeY.start > rangeY.end;
43084 var start = void 0;
43085 if (coord.isTransposed) {
43086 start = {
43087 x: isReflectY ? 0 : 1,
43088 y: 0
43089 };
43090 } else {
43091 start = {
43092 x: 0,
43093 y: isReflectY ? 0 : 1
43094 };
43095 }
43096
43097 start = coord.convert(start);
43098 var center = coord.circleCentre;
43099 var startVector = [start.x - center.x, start.y - center.y];
43100 var normalVector = [1, 0];
43101 var startAngle = void 0;
43102 if (start.y > center.y) {
43103 startAngle = vec2.angle(startVector, normalVector);
43104 } else {
43105 startAngle = vec2.angle(startVector, normalVector) * -1;
43106 }
43107 var endAngle = startAngle + (rangeX.end - rangeX.start);
43108
43109 circleCfg.startAngle = startAngle;
43110 circleCfg.endAngle = endAngle;
43111 circleCfg.center = center;
43112 circleCfg.radius = Math.sqrt(Math.pow(start.x - center.x, 2) + Math.pow(start.y - center.y, 2));
43113 circleCfg.inner = coord.innerRadius || 0;
43114 return circleCfg;
43115 };
43116
43117 AxisController.prototype._getRadiusCfg = function _getRadiusCfg(coord) {
43118 var startAngle = coord.x.start;
43119 var factor = startAngle < 0 ? -1 : 1;
43120 var start = void 0;
43121 var end = void 0;
43122 if (coord.isTransposed) {
43123 start = {
43124 x: 0,
43125 y: 0
43126 };
43127 end = {
43128 x: 1,
43129 y: 0
43130 };
43131 } else {
43132 start = {
43133 x: 0,
43134 y: 0
43135 };
43136 end = {
43137 x: 0,
43138 y: 1
43139 };
43140 }
43141 return {
43142 factor: factor,
43143 start: coord.convert(start),
43144 end: coord.convert(end)
43145 };
43146 };
43147
43148 // 确定坐标轴的位置
43149
43150
43151 AxisController.prototype._getAxisPosition = function _getAxisPosition(coord, dimType, index, field) {
43152 var position = '';
43153 // 用户自己定义了 position
43154 var options = this.options;
43155 if (options[field] && options[field].position) {
43156 position = options[field].position;
43157 } else {
43158 var coordType = coord.type;
43159 if (coord.isRect) {
43160 if (dimType === 'x') {
43161 position = 'bottom';
43162 } else if (dimType === 'y') {
43163 if (index) {
43164 position = 'right';
43165 } else {
43166 position = 'left';
43167 }
43168 }
43169 } else if (coordType === 'helix') {
43170 position = 'helix';
43171 } else if (dimType === 'x') {
43172 position = coord.isTransposed ? 'radius' : 'circle';
43173 } else {
43174 position = coord.isTransposed ? 'circle' : 'radius';
43175 }
43176 }
43177
43178 return position;
43179 };
43180
43181 // 获取坐标轴构成的配置信息
43182
43183
43184 AxisController.prototype._getAxisDefaultCfg = function _getAxisDefaultCfg(coord, scale, type, position) {
43185 var self = this;
43186 var cfg = {};
43187 var options = self.options;
43188 var field = scale.field;
43189 var isShowTitle = !!(Global.axis[position] && Global.axis[position].title); // 用户全局禁用 title
43190 var titleCfg = void 0;
43191
43192 // bugfix: title was set by chart.axis('field', { title: {} })
43193 if (isShowTitle || options[field] && options[field].title) {
43194 titleCfg = {
43195 title: {
43196 text: scale.alias || field
43197 }
43198 };
43199 }
43200 cfg = Util.deepMix({}, Global.axis[position], cfg, options[field]);
43201 Util.mix(cfg, titleCfg);
43202 cfg.ticks = scale.getTicks();
43203
43204 if (coord.isPolar && !scale.isCategory) {
43205 if (type === 'x' && Math.abs(coord.endAngle - coord.startAngle) === Math.PI * 2) {
43206 cfg.ticks.pop();
43207 }
43208 }
43209
43210 cfg.coord = coord;
43211 if (cfg.label && Util.isNil(cfg.label.autoRotate)) {
43212 cfg.label.autoRotate = true; // 允许自动旋转,避免重叠
43213 }
43214 return cfg;
43215 };
43216
43217 // 确定坐标轴的配置信息
43218
43219
43220 AxisController.prototype._getAxisCfg = function _getAxisCfg(coord, scale, verticalScale, dimType) {
43221 var index = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : '';
43222 var viewId = arguments[5];
43223
43224 var self = this;
43225 var position = self._getAxisPosition(coord, dimType, index, scale.field);
43226 var cfg = self._getAxisDefaultCfg(coord, scale, dimType, position);
43227 if (!Util.isEmpty(cfg.grid) && verticalScale) {
43228 // 生成 gridPoints
43229 var gridPoints = [];
43230 var verticalTicks = formatTicks(verticalScale.getTicks());
43231 // 没有垂直的坐标点时不会只栅格
43232 if (verticalTicks.length) {
43233 var ticks = cfg.ticks;
43234 Util.each(ticks, function (tick, idx) {
43235 var subPoints = [];
43236 var value = tick.value;
43237 if (cfg.grid.align === 'center') {
43238 value = self._getMiddleValue(value, ticks, idx);
43239 }
43240 if (!Util.isNil(value)) {
43241 var rangeX = coord.x;
43242 var rangeY = coord.y;
43243 Util.each(verticalTicks, function (verticalTick) {
43244 var x = dimType === 'x' ? value : verticalTick.value;
43245 var y = dimType === 'x' ? verticalTick.value : value;
43246 var point = coord.convert({
43247 x: x,
43248 y: y
43249 });
43250 if (coord.isPolar) {
43251 var center = coord.circleCentre;
43252 if (rangeY.start > rangeY.end) {
43253 y = 1 - y;
43254 }
43255 point.flag = rangeX.start > rangeX.end ? 0 : 1;
43256 point.radius = Math.sqrt(Math.pow(point.x - center.x, 2) + Math.pow(point.y - center.y, 2));
43257 }
43258 subPoints.push(point);
43259 });
43260 gridPoints.push({
43261 _id: viewId + '-' + dimType + index + '-grid-' + tick.tickValue,
43262 points: subPoints
43263 });
43264 }
43265 });
43266
43267 // TODO: 临时解决,需要添加一条以满足最后一格能颜色交替
43268 if (ticks.length % 2 === 0 && cfg.grid.align === 'center' && cfg.grid.alternateColor) {
43269 gridPoints.push({
43270 points: [{ x: coord.end.x, y: coord.start.y }, { x: coord.end.x, y: coord.end.y }]
43271 });
43272 }
43273 }
43274 cfg.grid.items = gridPoints;
43275 }
43276 return cfg;
43277 };
43278
43279 AxisController.prototype._getHelixCfg = function _getHelixCfg(coord) {
43280 var helixCfg = {};
43281 var a = coord.a;
43282 var startAngle = coord.startAngle;
43283 var endAngle = coord.endAngle;
43284 var index = 100;
43285 var crp = [];
43286 for (var i = 0; i <= index; i++) {
43287 var point = coord.convert({
43288 x: i / 100,
43289 y: 0
43290 });
43291 crp.push(point.x);
43292 crp.push(point.y);
43293 }
43294 var axisStart = coord.convert({
43295 x: 0,
43296 y: 0
43297 });
43298 helixCfg.a = a;
43299 helixCfg.startAngle = startAngle;
43300 helixCfg.endAngle = endAngle;
43301 helixCfg.crp = crp;
43302 helixCfg.axisStart = axisStart;
43303 helixCfg.center = coord.center;
43304 helixCfg.inner = coord.y.start; // 内半径
43305 return helixCfg;
43306 };
43307
43308 AxisController.prototype._drawAxis = function _drawAxis(coord, scale, verticalScale, dimType, viewId, xAxis, index) {
43309 var container = this.container;
43310 var C = void 0; // 坐标轴类
43311 var appendCfg = void 0; // 每个坐标轴 start end 等绘制边界的信息
43312
43313 if (coord.type === 'cartesian') {
43314 C = Axis.Line;
43315 appendCfg = this._getLineCfg(coord, scale, dimType, index);
43316 } else if (coord.type === 'helix' && dimType === 'x') {
43317 C = Axis.Helix;
43318 appendCfg = this._getHelixCfg(coord);
43319 } else if (dimType === 'x') {
43320 C = Axis.Circle;
43321 appendCfg = this._getCircleCfg(coord);
43322 } else {
43323 C = Axis.Line;
43324 appendCfg = this._getRadiusCfg(coord);
43325 }
43326 var cfg = this._getAxisCfg(coord, scale, verticalScale, dimType, index, viewId);
43327 cfg = Util.mix({}, cfg, appendCfg);
43328
43329 if (dimType === 'y' && xAxis && xAxis.get('type') === 'circle') {
43330 cfg.circle = xAxis;
43331 }
43332 cfg._id = viewId + '-' + dimType;
43333 if (!Util.isNil(index)) {
43334 cfg._id = viewId + '-' + dimType + index;
43335 }
43336
43337 var axis = container.addGroup(C, cfg);
43338 this.axes.push(axis);
43339 return axis;
43340 };
43341
43342 AxisController.prototype.createAxis = function createAxis(xScale, yScales, viewId) {
43343 var self = this;
43344 var coord = this.coord;
43345 var coordType = coord.type;
43346
43347 // theta坐标系默认不绘制坐标轴
43348 if (coordType !== 'theta' && !(coordType === 'polar' && coord.isTransposed)) {
43349 var xAxis = void 0;
43350 if (xScale && !self._isHide(xScale.field)) {
43351 xAxis = self._drawAxis(coord, xScale, yScales[0], 'x', viewId); // 绘制 x 轴
43352 }
43353 if (!Util.isEmpty(yScales) && coordType !== 'helix') {
43354 Util.each(yScales, function (yScale, index) {
43355 if (!self._isHide(yScale.field)) {
43356 self._drawAxis(coord, yScale, xScale, 'y', viewId, xAxis, index);
43357 }
43358 });
43359 }
43360 }
43361 };
43362
43363 AxisController.prototype.changeVisible = function changeVisible(visible) {
43364 var axes = this.axes;
43365 Util.each(axes, function (axis) {
43366 axis.set('visible', visible);
43367 });
43368 };
43369
43370 AxisController.prototype.clear = function clear() {
43371 var axes = this.axes;
43372 Util.each(axes, function (axis) {
43373 axis.remove();
43374 });
43375 this.axes = [];
43376 };
43377
43378 return AxisController;
43379}();
43380
43381module.exports = AxisController;
43382
43383/***/ }),
43384/* 335 */
43385/***/ (function(module, exports, __webpack_require__) {
43386
43387/**
43388 * @fileOverview the entry of axis
43389 * @author sima.zhang
43390 */
43391module.exports = {
43392 Line: __webpack_require__(336), // 基础的直线坐标轴
43393 Circle: __webpack_require__(338), // 极坐标下
43394 Helix: __webpack_require__(339), // 螺旋坐标轴
43395 PolyLine: __webpack_require__(340) // 多线段组成的坐标轴
43396};
43397
43398/***/ }),
43399/* 336 */
43400/***/ (function(module, exports, __webpack_require__) {
43401
43402function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
43403
43404function _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; }
43405
43406function _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; }
43407
43408/**
43409 * @fileOverview the radius axis of polar coordinate and axis of cartesian coordinate
43410 * @author sima.zhang
43411 */
43412var Base = __webpack_require__(44);
43413var Util = __webpack_require__(0);
43414
43415var _require = __webpack_require__(2),
43416 MatrixUtil = _require.MatrixUtil;
43417
43418var vec2 = MatrixUtil.vec2;
43419
43420var Line = function (_Base) {
43421 _inherits(Line, _Base);
43422
43423 function Line() {
43424 _classCallCheck(this, Line);
43425
43426 return _possibleConstructorReturn(this, _Base.apply(this, arguments));
43427 }
43428
43429 Line.prototype.getDefaultCfg = function getDefaultCfg() {
43430 var cfg = _Base.prototype.getDefaultCfg.call(this);
43431 return Util.mix({}, cfg, {
43432 x: null, // @type {Number} 距离初始位置的x轴偏移量,仅对于左侧、右侧的纵向坐标有效
43433 y: null, // @type {Number} 距离初始位置的y轴偏移量,仅对顶部、底部的横向坐标轴有效
43434 line: { // @type {Attrs} 坐标轴线的图形属性,如果设置成null,则不显示轴线
43435 lineWidth: 1,
43436 stroke: '#C0D0E0'
43437 },
43438 tickLine: { // @type {Attrs} 标注坐标线的图形属性
43439 lineWidth: 1,
43440 stroke: '#C0D0E0',
43441 length: 5
43442 },
43443 isVertical: false,
43444 start: null, // @type {Object} 起点
43445 end: null // @type {Object} 终点
43446 });
43447 };
43448
43449 Line.prototype._getAvgLabelLength = function _getAvgLabelLength(labelsGroup) {
43450 var labels = labelsGroup.get('children');
43451 return labels[1].attr('x') - labels[0].attr('x');
43452 };
43453
43454 /**
43455 * 获取距离坐标轴的向量
43456 * @override
43457 * @param {Number} offset 偏移值
43458 * @return {Array} 返回二维向量
43459 */
43460
43461
43462 Line.prototype.getSideVector = function getSideVector(offset) {
43463 var self = this;
43464 var factor = self.get('factor');
43465 var isVertical = self.get('isVertical');
43466 var start = self.get('start');
43467 var end = self.get('end');
43468 var axisVector = self.getAxisVector();
43469 var normal = vec2.normalize([], axisVector);
43470 var direction = false;
43471 if (isVertical && start.y < end.y || !isVertical && start.x > end.x) {
43472 direction = true;
43473 }
43474 var verticalVector = vec2.vertical([], normal, direction);
43475 return vec2.scale([], verticalVector, offset * factor);
43476 };
43477
43478 Line.prototype.getAxisVector = function getAxisVector() {
43479 var start = this.get('start');
43480 var end = this.get('end');
43481 return [end.x - start.x, end.y - start.y];
43482 };
43483
43484 Line.prototype.getLinePath = function getLinePath() {
43485 var self = this;
43486 var start = self.get('start');
43487 var end = self.get('end');
43488 var path = [];
43489 path.push(['M', start.x, start.y]);
43490 path.push(['L', end.x, end.y]);
43491 return path;
43492 };
43493
43494 Line.prototype.getTickEnd = function getTickEnd(start, value) {
43495 var self = this;
43496 var offsetVector = self.getSideVector(value);
43497 return {
43498 x: start.x + offsetVector[0],
43499 y: start.y + offsetVector[1]
43500 };
43501 };
43502
43503 Line.prototype.getTickPoint = function getTickPoint(tickValue) {
43504 var self = this;
43505 var start = self.get('start');
43506 var end = self.get('end');
43507 var rangeX = end.x - start.x;
43508 var rangeY = end.y - start.y;
43509 return {
43510 x: start.x + rangeX * tickValue,
43511 y: start.y + rangeY * tickValue
43512 };
43513 };
43514
43515 Line.prototype.renderTitle = function renderTitle() {
43516 var self = this;
43517 var title = self.get('title');
43518 var offsetPoint = self.getTickPoint(0.5);
43519 var titleOffset = title.offset;
43520 if (!titleOffset) {
43521 // 没有指定 offset 则自动计算
43522 titleOffset = 20;
43523 var labelsGroup = self.get('labelsGroup');
43524 if (labelsGroup) {
43525 var labelLength = self.getMaxLabelWidth(labelsGroup);
43526 var labelOffset = self.get('label').offset || self.get('_labelOffset');
43527 titleOffset += labelLength + labelOffset;
43528 }
43529 }
43530
43531 var textStyle = title.textStyle;
43532 var cfg = Util.mix({}, textStyle);
43533 if (title.text) {
43534 var vector = self.getAxisVector(); // 坐标轴方向的向量
43535
43536 if (title.autoRotate && !textStyle.rotate) {
43537 // 自动旋转并且用户没有指定标题的旋转角度
43538 var angle = 0;
43539 if (!Util.snapEqual(vector[1], 0)) {
43540 // 所有水平坐标轴,文本不转置
43541 var v1 = [1, 0];
43542 var v2 = [vector[0], vector[1]];
43543 angle = vec2.angleTo(v2, v1, true);
43544 }
43545
43546 cfg.rotate = angle * (180 / Math.PI);
43547 } else if (textStyle.rotate) {
43548 // 用户设置了旋转角度就以用户设置的为准
43549 cfg.rotate = textStyle.rotate / 180 * Math.PI; // 将角度转换为弧度
43550 }
43551
43552 var sideVector = self.getSideVector(titleOffset);
43553 var point = void 0;
43554 var position = title.position;
43555 if (position === 'start') {
43556 point = {
43557 x: this.get('start').x + sideVector[0],
43558 y: this.get('start').y + sideVector[1]
43559 };
43560 } else if (position === 'end') {
43561 point = {
43562 x: this.get('end').x + sideVector[0],
43563 y: this.get('end').y + sideVector[1]
43564 };
43565 } else {
43566 point = {
43567 x: offsetPoint.x + sideVector[0],
43568 y: offsetPoint.y + sideVector[1]
43569 };
43570 }
43571
43572 cfg.x = point.x;
43573 cfg.y = point.y;
43574 cfg.text = title.text;
43575
43576 var titleShape = self.addShape('Text', {
43577 zIndex: 2,
43578 attrs: cfg
43579 });
43580 titleShape.name = 'axis-title';
43581 self.get('appendInfo') && titleShape.setSilent('appendInfo', self.get('appendInfo'));
43582 }
43583 };
43584
43585 Line.prototype.autoRotateLabels = function autoRotateLabels() {
43586 var self = this;
43587 var labelsGroup = self.get('labelsGroup');
43588 var title = self.get('title');
43589 if (labelsGroup) {
43590 var offset = self.get('label').offset;
43591 var append = 12;
43592 var titleOffset = title ? title.offset : 48;
43593 if (titleOffset < 0) {
43594 // 如果是负的的话就不旋转
43595 return;
43596 }
43597 var vector = self.getAxisVector(); // 坐标轴的向量,仅处理水平或者垂直的场景
43598 var angle = void 0;
43599 var maxWidth = void 0;
43600 if (Util.snapEqual(vector[0], 0) && title && title.text) {
43601 // 坐标轴垂直,由于不知道边距,只能防止跟title重合,如果title不存在,则不自动旋转
43602 maxWidth = self.getMaxLabelWidth(labelsGroup);
43603 if (maxWidth > titleOffset - offset - append) {
43604 angle = Math.acos((titleOffset - offset - append) / maxWidth) * -1;
43605 }
43606 } else if (Util.snapEqual(vector[1], 0) && labelsGroup.getCount() > 1) {
43607 // 坐标轴水平,不考虑边距,根据最长的和平均值进行翻转
43608 var avgWidth = Math.abs(self._getAvgLabelLength(labelsGroup));
43609 maxWidth = self.getMaxLabelWidth(labelsGroup);
43610 if (maxWidth > avgWidth) {
43611 angle = Math.asin((titleOffset - offset - append) * 1.25 / maxWidth);
43612 }
43613 }
43614
43615 if (angle) {
43616 var factor = self.get('factor');
43617 Util.each(labelsGroup.get('children'), function (label) {
43618 label.rotateAtStart(angle);
43619 if (Util.snapEqual(vector[1], 0)) {
43620 if (factor > 0) {
43621 label.attr('textAlign', 'left');
43622 } else {
43623 label.attr('textAlign', 'right');
43624 }
43625 }
43626 });
43627 }
43628 }
43629 };
43630
43631 return Line;
43632}(Base);
43633
43634module.exports = Line;
43635
43636/***/ }),
43637/* 337 */
43638/***/ (function(module, exports, __webpack_require__) {
43639
43640function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
43641
43642function _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; }
43643
43644function _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; }
43645
43646/**
43647 * @fileOverview the grid of axis
43648 * @author sima.zhang
43649 */
43650var _require = __webpack_require__(2),
43651 Group = _require.Group;
43652
43653var Util = __webpack_require__(0);
43654
43655var Grid = function (_Group) {
43656 _inherits(Grid, _Group);
43657
43658 function Grid() {
43659 _classCallCheck(this, Grid);
43660
43661 return _possibleConstructorReturn(this, _Group.apply(this, arguments));
43662 }
43663
43664 Grid.prototype.getDefaultCfg = function getDefaultCfg() {
43665 return {
43666 zIndex: 1,
43667 /**
43668 * 栅格线的类型
43669 * - line 不封闭的线
43670 * - polygon 封闭的多边形
43671 * @type {String}
43672 */
43673 type: 'line',
43674 /**
43675 * 线的样式配置
43676 * @type {Object}
43677 */
43678 lineStyle: null,
43679 /**
43680 * 线集合的配置
43681 * @type {Array}
43682 */
43683 items: null,
43684 /**
43685 * 为网格设置交替的背景色,指定一个值则先渲染奇数层,两个值则交替渲染
43686 * @type {String | Array}
43687 */
43688 alternateColor: null,
43689 matrix: null,
43690 /**
43691 * 是否隐藏第一条网格线,默认为 false
43692 * @type {Boolean}
43693 */
43694 hideFirstLine: false,
43695 /**
43696 * 是否隐藏最后一条网格线,默认为 false
43697 * @type {Boolean}
43698 */
43699 hideLastLine: false
43700 };
43701 };
43702
43703 Grid.prototype._renderUI = function _renderUI() {
43704 _Group.prototype._renderUI.call(this);
43705 this._drawLines();
43706 };
43707
43708 Grid.prototype._drawLines = function _drawLines() {
43709 var self = this;
43710 var lineStyle = self.get('lineStyle');
43711 var items = self.get('items');
43712 if (items && items.length) {
43713 self._precessItems(items);
43714 self._drawGridLines(items, lineStyle);
43715 }
43716 };
43717
43718 Grid.prototype._precessItems = function _precessItems(items) {
43719 var self = this;
43720 var preItem = void 0;
43721 Util.each(items, function (item, index) {
43722 if (preItem && self.get('alternateColor')) {
43723 self._drawAlternativeBg(item, preItem, index);
43724 }
43725
43726 preItem = item;
43727 });
43728 };
43729
43730 Grid.prototype._drawGridLines = function _drawGridLines(items, lineStyle) {
43731 var self = this;
43732 var type = this.get('type');
43733 var gridLine = void 0;
43734 var path = void 0;
43735 var cfg = void 0;
43736 var points = void 0;
43737 var itemsLength = items.length;
43738
43739 if (type === 'line' || type === 'polygon') {
43740 Util.each(items, function (item, idx) {
43741 if (self.get('hideFirstLine') && idx === 0) {
43742 // 不展示第一条网格线
43743 return;
43744 }
43745 if (self.get('hideLastLine') && idx === itemsLength - 1) {
43746 // 不展示最后一条网格线
43747 return;
43748 }
43749
43750 points = item.points;
43751 path = [];
43752 if (type === 'line') {
43753 path.push(['M', points[0].x, points[0].y]);
43754 path.push(['L', points[points.length - 1].x, points[points.length - 1].y]);
43755 } else {
43756 Util.each(points, function (point, index) {
43757 if (index === 0) {
43758 path.push(['M', point.x, point.y]);
43759 } else {
43760 path.push(['L', point.x, point.y]);
43761 }
43762 });
43763 }
43764
43765 cfg = Util.mix({}, lineStyle, {
43766 path: path
43767 });
43768 gridLine = self.addShape('path', {
43769 attrs: cfg
43770 });
43771 gridLine.name = 'axis-grid';
43772 gridLine._id = item._id;
43773 gridLine.set('coord', self.get('coord'));
43774 self.get('appendInfo') && gridLine.setSilent('appendInfo', self.get('appendInfo'));
43775 });
43776 } else {
43777 Util.each(items, function (item, idx) {
43778 if (self.get('hideFirstLine') && idx === 0) {
43779 // 不展示第一条网格线
43780 return;
43781 }
43782 if (self.get('hideLastLine') && idx === itemsLength - 1) {
43783 // 不展示最后一条网格线
43784 return;
43785 }
43786
43787 points = item.points;
43788 path = [];
43789 Util.each(points, function (point, index) {
43790 var radius = point.radius;
43791 if (index === 0) {
43792 path.push(['M', point.x, point.y]);
43793 } else {
43794 path.push(['A', radius, radius, 0, 0, point.flag, point.x, point.y]);
43795 }
43796 });
43797 cfg = Util.mix({}, lineStyle, {
43798 path: path
43799 });
43800 gridLine = self.addShape('path', {
43801 attrs: cfg
43802 });
43803 gridLine.name = 'axis-grid';
43804 gridLine._id = item._id;
43805 gridLine.set('coord', self.get('coord'));
43806 self.get('appendInfo') && gridLine.setSilent('appendInfo', self.get('appendInfo'));
43807 });
43808 }
43809 };
43810
43811 Grid.prototype._drawAlternativeBg = function _drawAlternativeBg(item, preItem, index) {
43812 var self = this;
43813 var alternateColor = self.get('alternateColor');
43814 var attrs = void 0;
43815 var oddColor = void 0;
43816 var evenColor = void 0;
43817
43818 if (Util.isString(alternateColor)) {
43819 oddColor = alternateColor;
43820 } else if (Util.isArray(alternateColor)) {
43821 oddColor = alternateColor[0];
43822 evenColor = alternateColor[1];
43823 }
43824
43825 if (index % 2 === 0) {
43826 if (evenColor) {
43827 attrs = self._getBackItem(preItem.points, item.points, evenColor);
43828 }
43829 } else if (oddColor) {
43830 attrs = self._getBackItem(preItem.points, item.points, oddColor);
43831 }
43832
43833 var shape = self.addShape('Path', {
43834 attrs: attrs
43835 });
43836 shape.name = 'axis-grid-rect';
43837 shape._id = item._id && item._id.replace('grid', 'grid-rect');
43838 shape.set('coord', self.get('coord'));
43839 self.get('appendInfo') && shape.setSilent('appendInfo', self.get('appendInfo'));
43840 };
43841
43842 Grid.prototype._getBackItem = function _getBackItem(start, end, bgColor) {
43843 var path = [];
43844 var type = this.get('type');
43845
43846 if (type === 'line') {
43847 path.push(['M', start[0].x, start[0].y]);
43848 path.push(['L', start[start.length - 1].x, start[start.length - 1].y]);
43849 path.push(['L', end[end.length - 1].x, end[end.length - 1].y]);
43850 path.push(['L', end[0].x, end[0].y]);
43851 path.push(['Z']);
43852 } else if (type === 'polygon') {
43853 Util.each(start, function (subItem, index) {
43854 if (index === 0) {
43855 path.push(['M', subItem.x, subItem.y]);
43856 } else {
43857 path.push(['L', subItem.x, subItem.y]);
43858 }
43859 });
43860 for (var i = end.length - 1; i >= 0; i--) {
43861 path.push(['L', end[i].x, end[i].y]);
43862 }
43863 path.push(['Z']);
43864 } else {
43865 var flag = start[0].flag;
43866 Util.each(start, function (subItem, index) {
43867 var radius = subItem.radius;
43868 if (index === 0) {
43869 path.push(['M', subItem.x, subItem.y]);
43870 } else {
43871 path.push(['A', radius, radius, 0, 0, subItem.flag, subItem.x, subItem.y]);
43872 }
43873 });
43874 for (var j = end.length - 1; j >= 0; j--) {
43875 var endSubItem = end[j];
43876 var endRadius = endSubItem.radius;
43877 if (j === end.length - 1) {
43878 path.push(['M', endSubItem.x, endSubItem.y]);
43879 } else {
43880 path.push(['A', endRadius, endRadius, 0, 0, flag === 1 ? 0 : 1, endSubItem.x, endSubItem.y]);
43881 }
43882 }
43883 }
43884
43885 return {
43886 fill: bgColor,
43887 path: path
43888 };
43889 };
43890
43891 return Grid;
43892}(Group);
43893
43894module.exports = Grid;
43895
43896/***/ }),
43897/* 338 */
43898/***/ (function(module, exports, __webpack_require__) {
43899
43900function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
43901
43902function _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; }
43903
43904function _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; }
43905
43906/**
43907 * @fileOverview the circle axis of polar coordinate
43908 * @author sima.zhang
43909 */
43910var Util = __webpack_require__(0);
43911var Base = __webpack_require__(44);
43912
43913var vec2 = __webpack_require__(2).MatrixUtil.vec2;
43914
43915var Circle = function (_Base) {
43916 _inherits(Circle, _Base);
43917
43918 function Circle() {
43919 _classCallCheck(this, Circle);
43920
43921 return _possibleConstructorReturn(this, _Base.apply(this, arguments));
43922 }
43923
43924 Circle.prototype.getDefaultCfg = function getDefaultCfg() {
43925 var cfg = _Base.prototype.getDefaultCfg.call(this);
43926
43927 return Util.mix({}, cfg, {
43928 /**
43929 * 坐标轴的类型
43930 * @type {String}
43931 */
43932 type: 'circle',
43933 /**
43934 * 指定刻度之间的间距
43935 * @type {Number}
43936 */
43937 tickInterval: null,
43938 /**
43939 * 开始弧度
43940 * @type {Number}
43941 */
43942 startAngle: -Math.PI / 2,
43943 /**
43944 * 结束弧度
43945 * @type {Number}
43946 */
43947 endAngle: Math.PI * 3 / 2,
43948 line: { // @type {Attrs} 坐标轴线的图形属性,如果设置成null,则不显示轴线
43949 lineWidth: 1,
43950 stroke: '#C0D0E0'
43951 },
43952 tickLine: { // @type {Attrs} 标注坐标线的图形属性
43953 lineWidth: 1,
43954 stroke: '#C0D0E0',
43955 length: 5
43956 },
43957 /**
43958 * 默认文本距离轴线的距离
43959 * @type {Number}
43960 */
43961 _labelOffset: 5
43962 });
43963 };
43964
43965 Circle.prototype.parseTick = function parseTick(tick, index, length) {
43966 return {
43967 text: tick,
43968 value: index / length
43969 };
43970 };
43971
43972 Circle.prototype._getCirclePoint = function _getCirclePoint(angle, radius) {
43973 var self = this;
43974 var center = self.get('center');
43975 radius = radius || self.get('radius');
43976 return {
43977 x: center.x + Math.cos(angle) * radius,
43978 y: center.y + Math.sin(angle) * radius
43979 };
43980 };
43981
43982 Circle.prototype.getTickPoint = function getTickPoint(value) {
43983 var self = this;
43984 var startAngle = self.get('startAngle');
43985 var endAngle = self.get('endAngle');
43986 var angle = startAngle + (endAngle - startAngle) * value;
43987 return self._getCirclePoint(angle);
43988 };
43989
43990 Circle.prototype.getSideVector = function getSideVector(offset, point) {
43991 var self = this;
43992 var center = self.get('center');
43993 var vector = [point.x - center.x, point.y - center.y];
43994 if (!Util.isNil(offset)) {
43995 var vecLen = vec2.length(vector);
43996 vec2.scale(vector, vector, offset / vecLen);
43997 }
43998 return vector;
43999 };
44000
44001 Circle.prototype.getSidePoint = function getSidePoint(point, offset) {
44002 var self = this;
44003 var vector = self.getSideVector(offset, point);
44004
44005 return {
44006 x: point.x + vector[0],
44007 y: point.y + vector[1]
44008 };
44009 };
44010
44011 Circle.prototype.getTickEnd = function getTickEnd(start, length) {
44012 var self = this;
44013 var tickLine = self.get('tickLine');
44014 length = length ? length : tickLine.length;
44015 return self.getSidePoint(start, length);
44016 };
44017
44018 Circle.prototype.getTextAnchor = function getTextAnchor(vector) {
44019 var align = void 0;
44020 if (Util.snapEqual(vector[0], 0)) {
44021 align = 'center';
44022 } else if (vector[0] > 0) {
44023 align = 'left';
44024 } else if (vector[0] < 0) {
44025 align = 'right';
44026 }
44027 return align;
44028 };
44029
44030 Circle.prototype.getLinePath = function getLinePath() {
44031 var self = this;
44032 var center = self.get('center');
44033 var x = center.x;
44034 var y = center.y;
44035 var rx = self.get('radius');
44036 var ry = rx;
44037 var startAngle = self.get('startAngle');
44038 var endAngle = self.get('endAngle');
44039 var inner = self.get('inner');
44040
44041 var path = [];
44042 if (Math.abs(endAngle - startAngle) === Math.PI * 2) {
44043 path = [['M', x, y], ['m', 0, -ry], ['a', rx, ry, 0, 1, 1, 0, 2 * ry], ['a', rx, ry, 0, 1, 1, 0, -2 * ry], ['z']];
44044 } else {
44045 var startPoint = self._getCirclePoint(startAngle);
44046 var endPoint = self._getCirclePoint(endAngle);
44047 var large = Math.abs(endAngle - startAngle) > Math.PI ? 1 : 0;
44048 var sweep = startAngle > endAngle ? 0 : 1;
44049 if (!inner) {
44050 path = [['M', x, y], ['L', startPoint.x, startPoint.y], ['A', rx, ry, 0, large, sweep, endPoint.x, endPoint.y], ['L', x, y]];
44051 } else {
44052 var innerStartVector = self.getSideVector(inner * rx, startPoint);
44053 var innerEndVector = self.getSideVector(inner * rx, endPoint);
44054 var innerStartPoint = {
44055 x: innerStartVector[0] + x,
44056 y: innerStartVector[1] + y
44057 };
44058 var innerEndPoint = {
44059 x: innerEndVector[0] + x,
44060 y: innerEndVector[1] + y
44061 };
44062
44063 path = [['M', innerStartPoint.x, innerStartPoint.y], ['L', startPoint.x, startPoint.y], ['A', rx, ry, 0, large, sweep, endPoint.x, endPoint.y], ['L', innerEndPoint.x, innerEndPoint.y], ['A', rx * inner, ry * inner, 0, large, Math.abs(sweep - 1), innerStartPoint.x, innerStartPoint.y]];
44064 }
44065 }
44066 return path;
44067 };
44068
44069 Circle.prototype.addLabel = function addLabel(tick, point, index) {
44070 var self = this;
44071 var offset = self.get('label').offset || self.get('_labelOffset') || 0.001;
44072 point = self.getSidePoint(point, offset);
44073 _Base.prototype.addLabel.call(this, tick, point, index);
44074 };
44075
44076 Circle.prototype.autoRotateLabels = function autoRotateLabels() {
44077 var self = this;
44078 var ticks = self.get('ticks');
44079 var labelsGroup = self.get('labelsGroup');
44080 if (labelsGroup && ticks.length > 12) {
44081 // 小于12个文本时文本不旋转
44082 var radius = self.get('radius');
44083 var startAngle = self.get('startAngle');
44084 var endAngle = self.get('endAngle');
44085 var totalAngle = endAngle - startAngle;
44086 var avgAngle = totalAngle / (ticks.length - 1);
44087 var avgWidth = Math.sin(avgAngle / 2) * radius * 2;
44088 var maxLength = self.getMaxLabelWidth(labelsGroup);
44089 Util.each(labelsGroup.get('children'), function (label, index) {
44090 var tick = ticks[index];
44091 var angle = tick.value * totalAngle + startAngle;
44092 var mode = angle % (Math.PI * 2);
44093 if (maxLength < avgWidth) {
44094 // 文本的最大宽度大于
44095 if (mode <= 0) {
44096 angle = angle + Math.PI;
44097 }
44098 if (mode > Math.PI) {
44099 angle = angle - Math.PI;
44100 }
44101 angle = angle - Math.PI / 2;
44102 label.attr('textAlign', 'center');
44103 } else {
44104 if (mode > Math.PI / 2) {
44105 angle = angle - Math.PI;
44106 } else if (mode < Math.PI / 2 * -1) {
44107 angle = angle + Math.PI;
44108 }
44109 }
44110 label.rotateAtStart(angle);
44111 });
44112 }
44113 };
44114
44115 return Circle;
44116}(Base);
44117
44118module.exports = Circle;
44119
44120/***/ }),
44121/* 339 */
44122/***/ (function(module, exports, __webpack_require__) {
44123
44124function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
44125
44126function _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; }
44127
44128function _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; }
44129
44130/**
44131 * @fileOverview the helix axis of helix coordinate
44132 * @author sima.zhang
44133 */
44134var Util = __webpack_require__(0);
44135var Base = __webpack_require__(44);
44136
44137var _require = __webpack_require__(2),
44138 MatrixUtil = _require.MatrixUtil,
44139 PathUtil = _require.PathUtil;
44140
44141var vec2 = MatrixUtil.vec2;
44142
44143var Helix = function (_Base) {
44144 _inherits(Helix, _Base);
44145
44146 function Helix() {
44147 _classCallCheck(this, Helix);
44148
44149 return _possibleConstructorReturn(this, _Base.apply(this, arguments));
44150 }
44151
44152 Helix.prototype.getDefaultCfg = function getDefaultCfg() {
44153 var cfg = _Base.prototype.getDefaultCfg.call(this);
44154
44155 return Util.mix({}, cfg, {
44156 type: 'helix',
44157 line: { // @type {Attrs} 坐标轴线的图形属性,如果设置成null,则不显示轴线
44158 lineWidth: 1,
44159 stroke: '#C0D0E0'
44160 },
44161 tickLine: { // @type {Attrs} 标注坐标线的图形属性
44162 lineWidth: 1,
44163 stroke: '#C0D0E0',
44164 length: 5
44165 },
44166 startAngle: 1.25 * Math.PI,
44167 endAngle: 7.25 * Math.PI,
44168 // 螺旋系数
44169 a: 0,
44170 // 画布中心坐标
44171 center: null,
44172 // 坐标轴绘制起点
44173 axisStart: null,
44174 // 坐标轴的n个坐标点
44175 crp: []
44176 });
44177 };
44178
44179 Helix.prototype.getLinePath = function getLinePath() {
44180 var self = this;
44181 var crp = self.get('crp');
44182 var axisStart = self.get('axisStart');
44183 var path = PathUtil.catmullRomToBezier(crp);
44184 path.unshift(['M', axisStart.x, axisStart.y]);
44185 return path;
44186 };
44187
44188 Helix.prototype.getTickPoint = function getTickPoint(value) {
44189 var self = this;
44190 var startAngle = self.get('startAngle');
44191 var endAngle = self.get('endAngle');
44192 var angle = startAngle + (endAngle - startAngle) * value;
44193 return self._getHelixPoint(angle);
44194 };
44195
44196 Helix.prototype._getHelixPoint = function _getHelixPoint(angle) {
44197 var self = this;
44198 var center = self.get('center');
44199 var a = self.get('a'); // 螺线系数
44200 var radius = a * angle + self.get('inner'); // 螺线方程
44201 return {
44202 x: center.x + Math.cos(angle) * radius,
44203 y: center.y + Math.sin(angle) * radius
44204 };
44205 };
44206
44207 Helix.prototype.getSideVector = function getSideVector(offset, point) {
44208 var self = this;
44209 var center = self.get('center');
44210 var vector = [point.x - center.x, point.y - center.y];
44211 if (offset) {
44212 var vecLen = vec2.length(vector);
44213 vec2.scale(vector, vector, offset / vecLen);
44214 }
44215 return vector;
44216 };
44217
44218 Helix.prototype.getSidePoint = function getSidePoint(point, offset) {
44219 var self = this;
44220 var vector = self.getSideVector(offset, point);
44221
44222 return {
44223 x: point.x + vector[0],
44224 y: point.y + vector[1]
44225 };
44226 };
44227
44228 Helix.prototype.getTickEnd = function getTickEnd(start, length) {
44229 var self = this;
44230 var tickLine = self.get('tickLine');
44231 length = length ? length : tickLine.length;
44232 return self.getSidePoint(start, length);
44233 };
44234
44235 return Helix;
44236}(Base);
44237
44238module.exports = Helix;
44239
44240/***/ }),
44241/* 340 */
44242/***/ (function(module, exports, __webpack_require__) {
44243
44244function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
44245
44246function _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; }
44247
44248function _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; }
44249
44250/**
44251 * @fileOverview the axis of map coodinate
44252 * @author sima.zhang
44253 */
44254var Util = __webpack_require__(0);
44255var Base = __webpack_require__(44);
44256
44257var _require = __webpack_require__(2),
44258 MatrixUtil = _require.MatrixUtil,
44259 PathUtil = _require.PathUtil;
44260
44261var vec2 = MatrixUtil.vec2;
44262
44263var Polyline = function (_Base) {
44264 _inherits(Polyline, _Base);
44265
44266 function Polyline() {
44267 _classCallCheck(this, Polyline);
44268
44269 return _possibleConstructorReturn(this, _Base.apply(this, arguments));
44270 }
44271
44272 Polyline.prototype.getDefaultCfg = function getDefaultCfg() {
44273 var cfg = _Base.prototype.getDefaultCfg.call(this);
44274
44275 return Util.mix({}, cfg, {
44276 type: 'polyline'
44277 });
44278 };
44279
44280 Polyline.prototype.getLinePath = function getLinePath() {
44281 var self = this;
44282 var tickPoints = self.get('tickPoints');
44283 var start = self.get('start');
44284 var end = self.get('end');
44285 var points = [];
44286 points.push(start.x);
44287 points.push(start.y);
44288 Util.each(tickPoints, function (tick) {
44289 points.push(tick.x);
44290 points.push(tick.y);
44291 });
44292 points.push(end.x);
44293 points.push(end.y);
44294
44295 var path = PathUtil.catmullRomToBezier(points);
44296 path.unshift(['M', start.x, start.y]);
44297 return path;
44298 };
44299
44300 Polyline.prototype.getTickPoint = function getTickPoint(value, index) {
44301 var tickPoints = this.get('tickPoints');
44302 return tickPoints[index];
44303 };
44304
44305 Polyline.prototype.getTickEnd = function getTickEnd(start, value, index) {
44306 var self = this;
44307 var lineAttrs = self.get('tickLine');
44308 var tickLength = value ? value : lineAttrs.length;
44309 var offsetVector = self.getSideVector(tickLength, start, index);
44310 return {
44311 x: start.x + offsetVector[0],
44312 y: start.y + offsetVector[1]
44313 };
44314 };
44315
44316 Polyline.prototype.getSideVector = function getSideVector(offset, point, index) {
44317 var self = this;
44318 var preTickPoint = void 0;
44319 if (index === 0) {
44320 preTickPoint = self.get('start');
44321 } else {
44322 var tickPoints = self.get('tickPoints');
44323 preTickPoint = tickPoints[index - 1];
44324 }
44325
44326 var vector = [point.x - preTickPoint.x, point.y - preTickPoint.y];
44327 var normal = vec2.normalize([], vector);
44328 var verticalVector = vec2.vertical([], normal, false);
44329 return vec2.scale([], verticalVector, offset);
44330 };
44331
44332 return Polyline;
44333}(Base);
44334
44335module.exports = Polyline;
44336
44337/***/ }),
44338/* 341 */
44339/***/ (function(module, exports, __webpack_require__) {
44340
44341/**
44342 * @fileOverview the entry of guide
44343 * @author sima.zhang
44344 */
44345module.exports = {
44346 Line: __webpack_require__(342),
44347 Text: __webpack_require__(343),
44348 Image: __webpack_require__(344),
44349 Region: __webpack_require__(345),
44350 Html: __webpack_require__(346),
44351 Arc: __webpack_require__(347)
44352};
44353
44354/***/ }),
44355/* 342 */
44356/***/ (function(module, exports, __webpack_require__) {
44357
44358function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
44359
44360function _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; }
44361
44362function _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; }
44363
44364/**
44365 * @fileOverview the line guide
44366 * @author sima.zhang
44367 */
44368var Util = __webpack_require__(0);
44369var Base = __webpack_require__(17);
44370
44371var vec2 = __webpack_require__(2).MatrixUtil.vec2;
44372
44373var Line = function (_Base) {
44374 _inherits(Line, _Base);
44375
44376 function Line() {
44377 _classCallCheck(this, Line);
44378
44379 return _possibleConstructorReturn(this, _Base.apply(this, arguments));
44380 }
44381
44382 Line.prototype.getDefaultCfg = function getDefaultCfg() {
44383 var cfg = _Base.prototype.getDefaultCfg.call(this);
44384 return Util.mix({}, cfg, {
44385 /**
44386 * 辅助元素类型
44387 * @type {String}
44388 */
44389 type: 'line',
44390 zIndex: 15,
44391 /**
44392 * 辅助线的起点位置
44393 * @type {Object | Function | Array}
44394 */
44395 start: null,
44396 /**
44397 * 辅助线的终点位置
44398 * @type {Object | Function | Array}
44399 */
44400 end: null,
44401 /**
44402 * 辅助线的图形样式
44403 * @type {Object}
44404 */
44405 lineStyle: {
44406 stroke: '#000',
44407 lineWidth: 1
44408 },
44409 /**
44410 * 辅助文本配置
44411 * @type {Object}
44412 */
44413 text: {
44414 position: 'end', // 文本的显示位置: start / center / end / 百分比
44415 autoRotate: true, // 文本是否沿着辅助线的方向自动旋转
44416 style: {
44417 fill: '#999',
44418 fontSize: 12,
44419 fontWeight: 500,
44420 fontFamily: 'sans-serif'
44421 }, // 辅助文本的样式
44422 content: null // 辅助文本的文字
44423 }
44424 });
44425 };
44426
44427 Line.prototype.render = function render(coord, group) {
44428 var self = this;
44429 var start = self.parsePoint(coord, self.start);
44430 var end = self.parsePoint(coord, self.end);
44431 var guideLineGroup = group.addGroup();
44432
44433 self._drawLines(start, end, guideLineGroup);
44434 if (this.text && this.text.content) {
44435 self._drawText(start, end, guideLineGroup);
44436 }
44437 self.el = guideLineGroup;
44438 };
44439
44440 Line.prototype._drawLines = function _drawLines(start, end, group) {
44441 var path = [['M', start.x, start.y], ['L', end.x, end.y]];
44442 var guideLine = group.addShape('Path', {
44443 attrs: Util.mix({
44444 path: path
44445 }, this.lineStyle)
44446 });
44447 guideLine.name = 'guide-line';
44448 this.appendInfo && guideLine.setSilent('appendInfo', this.appendInfo);
44449 };
44450
44451 Line.prototype._drawText = function _drawText(start, end, group) {
44452 var textCfg = this.text;
44453 var position = textCfg.position;
44454 var textStyle = textCfg.style;
44455
44456 var percent = void 0;
44457 if (position === 'start') {
44458 percent = 0;
44459 } else if (position === 'center') {
44460 percent = 0.5;
44461 } else if (Util.isString(position) && position.indexOf('%') !== -1) {
44462 percent = parseInt(position, 10) / 100;
44463 } else if (Util.isNumber(position)) {
44464 percent = position;
44465 } else {
44466 percent = 1;
44467 }
44468
44469 if (percent > 1 || percent < 0) {
44470 percent = 1;
44471 }
44472
44473 var cfg = {
44474 x: start.x + (end.x - start.x) * percent,
44475 y: start.y + (end.y - start.y) * percent
44476 };
44477
44478 if (textCfg.offsetX) {
44479 // 设置了偏移量
44480 cfg.x += textCfg.offsetX;
44481 }
44482
44483 if (textCfg.offsetY) {
44484 // 设置了偏移量
44485 cfg.y += textCfg.offsetY;
44486 }
44487
44488 cfg.text = textCfg.content;
44489 cfg = Util.mix({}, cfg, textStyle);
44490 if (textCfg.autoRotate && !textStyle.rotate) {
44491 var angle = vec2.angleTo([end.x - start.x, end.y - start.y], [1, 0], 1);
44492 cfg.rotate = angle;
44493 } else if (textStyle.rotate) {
44494 cfg.rotate = textStyle.rotate * Math.PI / 180;
44495 }
44496
44497 var shape = group.addShape('Text', {
44498 attrs: cfg
44499 });
44500 shape.name = 'guide-line-text';
44501 this.appendInfo && shape.setSilent('appendInfo', this.appendInfo);
44502 };
44503
44504 return Line;
44505}(Base);
44506
44507module.exports = Line;
44508
44509/***/ }),
44510/* 343 */
44511/***/ (function(module, exports, __webpack_require__) {
44512
44513function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
44514
44515function _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; }
44516
44517function _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; }
44518
44519/**
44520 * @fileOverview the text guide
44521 * @author sima.zhang
44522 */
44523var Util = __webpack_require__(0);
44524var Base = __webpack_require__(17);
44525
44526var Text = function (_Base) {
44527 _inherits(Text, _Base);
44528
44529 function Text() {
44530 _classCallCheck(this, Text);
44531
44532 return _possibleConstructorReturn(this, _Base.apply(this, arguments));
44533 }
44534
44535 Text.prototype.getDefaultCfg = function getDefaultCfg() {
44536 var cfg = _Base.prototype.getDefaultCfg.call(this);
44537 return Util.mix({}, cfg, {
44538 /**
44539 * 辅助元素类型
44540 * @type {String}
44541 */
44542 type: 'text',
44543 // TODO 需要调整
44544 zIndex: 15,
44545 /**
44546 * 辅助文本的位置
44547 * @type {Object | Function | Array}
44548 */
44549 position: null,
44550 /**
44551 * 辅助文本的显示文字
44552 * @type {String}
44553 */
44554 content: null,
44555 /**
44556 * 辅助文本的样式配置
44557 * @type {Object}
44558 */
44559 style: {
44560 fill: '#999',
44561 fontSize: 12,
44562 fontWeight: 500,
44563 textAlign: 'center'
44564 },
44565 /**
44566 * x 方向的偏移量
44567 * @type {Number}
44568 */
44569 offsetX: null,
44570 /**
44571 * y 方向的偏移量
44572 * @type {Number}
44573 */
44574 offsetY: null
44575 });
44576 };
44577
44578 Text.prototype.render = function render(coord, group) {
44579 var self = this;
44580 var position = self.position;
44581 var point = self.parsePoint(coord, position);
44582 var textStyle = Util.mix({}, this.style);
44583
44584 if (self.offsetX) {
44585 point.x += self.offsetX;
44586 }
44587
44588 if (self.offsetY) {
44589 point.y += self.offsetY;
44590 }
44591
44592 if (textStyle.rotate) {
44593 textStyle.rotate = textStyle.rotate * Math.PI / 180; // 将角度转换为弧度
44594 }
44595
44596 var guideText = group.addShape('Text', {
44597 zIndex: self.zIndex,
44598 attrs: Util.mix({
44599 text: self.content
44600 }, textStyle, point)
44601 });
44602 guideText.name = 'guide-text';
44603 self.appendInfo && guideText.setSilent('appendInfo', self.appendInfo);
44604 self.el = guideText;
44605 };
44606
44607 return Text;
44608}(Base);
44609
44610module.exports = Text;
44611
44612/***/ }),
44613/* 344 */
44614/***/ (function(module, exports, __webpack_require__) {
44615
44616function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
44617
44618function _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; }
44619
44620function _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; }
44621
44622/**
44623 * @fileOverview the image guide
44624 * @author sima.zhang
44625 */
44626var Util = __webpack_require__(0);
44627var Base = __webpack_require__(17);
44628
44629var Image = function (_Base) {
44630 _inherits(Image, _Base);
44631
44632 function Image() {
44633 _classCallCheck(this, Image);
44634
44635 return _possibleConstructorReturn(this, _Base.apply(this, arguments));
44636 }
44637
44638 Image.prototype.getDefaultCfg = function getDefaultCfg() {
44639 var cfg = _Base.prototype.getDefaultCfg.call(this);
44640 return Util.mix({}, cfg, {
44641 /**
44642 * 辅助元素类型
44643 * @type {String}
44644 */
44645 type: 'image',
44646 zIndex: 1,
44647 /**
44648 * 辅助图片的起点位置
44649 * @type {Object | Function | Array}
44650 */
44651 start: null,
44652 /**
44653 * 辅助图片的终点位置
44654 * @type {Object | Function | Array}
44655 */
44656 end: null,
44657 /**
44658 * 辅助图片的地址
44659 * @type {Strinf}
44660 */
44661 src: null,
44662 /**
44663 * x 方向的偏移量
44664 * @type {Number}
44665 */
44666 offsetX: null,
44667 /**
44668 * y 方向的偏移量
44669 * @type {Number}
44670 */
44671 offsetY: null
44672 });
44673 };
44674
44675 Image.prototype.render = function render(coord, group) {
44676 var self = this;
44677 var start = self.parsePoint(coord, self.start);
44678
44679 var cfg = {
44680 x: start.x,
44681 y: start.y
44682 };
44683 cfg.img = self.src;
44684
44685 if (!self.end) {
44686 // 如果咩有指定结束点,则 start 为图片的左上角坐标
44687 if (self.width) {
44688 cfg.width = self.width;
44689 }
44690
44691 if (self.height) {
44692 cfg.height = self.height;
44693 }
44694 } else {
44695 var end = self.parsePoint(coord, self.end);
44696 cfg.width = Math.abs(end.x - start.x);
44697 cfg.height = Math.abs(start.y - end.y);
44698 }
44699
44700 if (self.offsetX) {
44701 cfg.x += self.offsetX;
44702 }
44703
44704 if (self.offsetY) {
44705 cfg.y += self.offsetY;
44706 }
44707
44708 var imgGuide = group.addShape('Image', {
44709 zIndex: 1,
44710 attrs: cfg
44711 });
44712 imgGuide.name = 'guide-image';
44713 self.appendInfo && imgGuide.setSilent('appendInfo', self.appendInfo);
44714 self.el = imgGuide;
44715 };
44716
44717 return Image;
44718}(Base);
44719
44720module.exports = Image;
44721
44722/***/ }),
44723/* 345 */
44724/***/ (function(module, exports, __webpack_require__) {
44725
44726function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
44727
44728function _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; }
44729
44730function _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; }
44731
44732/**
44733 * @fileOverview the region guide
44734 * @author sima.zhang
44735 */
44736var Util = __webpack_require__(0);
44737var Base = __webpack_require__(17);
44738
44739var Region = function (_Base) {
44740 _inherits(Region, _Base);
44741
44742 function Region() {
44743 _classCallCheck(this, Region);
44744
44745 return _possibleConstructorReturn(this, _Base.apply(this, arguments));
44746 }
44747
44748 Region.prototype.getDefaultCfg = function getDefaultCfg() {
44749 var cfg = _Base.prototype.getDefaultCfg.call(this);
44750
44751 return Util.mix({}, cfg, {
44752 type: 'region',
44753 zIndex: 1,
44754 start: null,
44755 end: null,
44756 style: {
44757 lineWidth: 0,
44758 fill: '#CCD7EB',
44759 opacity: 0.4
44760 }
44761 });
44762 };
44763
44764 Region.prototype.render = function render(coord, group) {
44765 var self = this;
44766 var rectStyle = self.style;
44767 var path = self._getPath(coord);
44768
44769 var regionGroup = group.addShape('path', {
44770 zIndex: self.zIndex,
44771 attrs: Util.mix({
44772 path: path
44773 }, rectStyle)
44774 });
44775 regionGroup.name = 'guide-region';
44776 self.appendInfo && regionGroup.setSilent('appendInfo', self.appendInfo);
44777 self.el = regionGroup;
44778 };
44779
44780 Region.prototype._getPath = function _getPath(coord) {
44781 var self = this;
44782 var start = self.parsePoint(coord, self.start);
44783 var end = self.parsePoint(coord, self.end);
44784 var path = [];
44785 path.push(['M', start.x, start.y]);
44786 path.push(['L', end.x, start.y]);
44787 path.push(['L', end.x, end.y]);
44788 path.push(['L', start.x, end.y]);
44789 path.push(['z']);
44790 return path;
44791 };
44792
44793 return Region;
44794}(Base);
44795
44796module.exports = Region;
44797
44798/***/ }),
44799/* 346 */
44800/***/ (function(module, exports, __webpack_require__) {
44801
44802function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
44803
44804function _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; }
44805
44806function _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; }
44807
44808/**
44809 * @fileOverview the html guide
44810 * @author sima.zhang
44811 */
44812var Util = __webpack_require__(0);
44813
44814var _require = __webpack_require__(2),
44815 DomUtil = _require.DomUtil;
44816
44817var Base = __webpack_require__(17);
44818
44819var Html = function (_Base) {
44820 _inherits(Html, _Base);
44821
44822 function Html() {
44823 _classCallCheck(this, Html);
44824
44825 return _possibleConstructorReturn(this, _Base.apply(this, arguments));
44826 }
44827
44828 Html.prototype.getDefaultCfg = function getDefaultCfg() {
44829 var cfg = _Base.prototype.getDefaultCfg.call(this);
44830 return Util.mix({}, cfg, {
44831 /**
44832 * 辅助元素类型
44833 * @type {String}
44834 */
44835 type: 'html',
44836 zIndex: 15,
44837 /**
44838 * dom 显示位置点
44839 * @type {Object | Array}
44840 */
44841 position: null,
44842 /**
44843 * 水平方向对齐方式,可取值 'left'、'middle'、'right'
44844 * @type {String}
44845 */
44846 alignX: 'middle',
44847 /**
44848 * 垂直方向对齐方式,可取值 'top'、'middle'、'bottom'
44849 * @type {String}
44850 */
44851 alignY: 'middle',
44852 /**
44853 * x 方向的偏移量
44854 * @type {Number}
44855 */
44856 offsetX: null,
44857 /**
44858 * y 方向的偏移量
44859 * @type {Number}
44860 */
44861 offsetY: null,
44862 /**
44863 * html内容
44864 *@type {String | Function}
44865 */
44866 html: null
44867 });
44868 };
44869
44870 Html.prototype.render = function render(coord, group) {
44871 var self = this;
44872 var position = self.parsePoint(coord, self.position);
44873
44874 var parentNode = group.get('canvas').get('el').parentNode;
44875 var wrapperNode = DomUtil.createDom('<div class="g-guide"></div>');
44876 parentNode.appendChild(wrapperNode);
44877
44878 var html = self.html;
44879 if (Util.isFunction(html)) {
44880 html = html(self.xScales, self.yScales);
44881 }
44882 var htmlNode = DomUtil.createDom(html);
44883 wrapperNode.appendChild(htmlNode);
44884 self._setDomPosition(wrapperNode, htmlNode, position);
44885 self.el = wrapperNode;
44886 };
44887
44888 Html.prototype._setDomPosition = function _setDomPosition(parentDom, childDom, point) {
44889 var self = this;
44890 var alignX = self.alignX;
44891 var alignY = self.alignY;
44892 var domWidth = DomUtil.getOuterWidth(childDom);
44893 var domHeight = DomUtil.getOuterHeight(childDom);
44894
44895 var position = {
44896 x: point.x,
44897 y: point.y
44898 };
44899
44900 if (alignX === 'middle' && alignY === 'top') {
44901 position.x -= Util.round(domWidth / 2);
44902 } else if (alignX === 'middle' && alignY === 'bottom') {
44903 position.x -= Util.round(domWidth / 2);
44904 position.y -= Util.round(domHeight);
44905 } else if (alignX === 'left' && alignY === 'bottom') {
44906 position.y -= Util.round(domHeight);
44907 } else if (alignX === 'left' && alignY === 'middle') {
44908 position.y -= Util.round(domHeight / 2);
44909 } else if (alignX === 'left' && alignY === 'top') {
44910 position.x = point.x;
44911 position.y = point.y;
44912 } else if (alignX === 'right' && alignY === 'bottom') {
44913 position.x -= Util.round(domWidth);
44914 position.y -= Util.round(domHeight);
44915 } else if (alignX === 'right' && alignY === 'middle') {
44916 position.x -= Util.round(domWidth);
44917 position.y -= Util.round(domHeight / 2);
44918 } else if (alignX === 'right' && alignY === 'top') {
44919 position.x -= Util.round(domWidth);
44920 } else {
44921 // 默认位于中心点
44922 position.x -= Util.round(domWidth / 2);
44923 position.y -= Util.round(domHeight / 2);
44924 }
44925
44926 if (self.offsetX) {
44927 position.x += self.offsetX;
44928 }
44929
44930 if (self.offsetY) {
44931 position.y += self.offsetY;
44932 }
44933
44934 DomUtil.modifyCSS(parentDom, {
44935 position: 'absolute',
44936 top: Math.round(position.y) + 'px',
44937 left: Math.round(position.x) + 'px',
44938 visibility: 'visible',
44939 zIndex: self.zIndex
44940 });
44941 };
44942
44943 Html.prototype.remove = function remove() {
44944 var self = this;
44945 var el = self.el;
44946 if (el) {
44947 el.parentNode.removeChild(el);
44948 }
44949 };
44950
44951 return Html;
44952}(Base);
44953
44954module.exports = Html;
44955
44956/***/ }),
44957/* 347 */
44958/***/ (function(module, exports, __webpack_require__) {
44959
44960function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
44961
44962function _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; }
44963
44964function _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; }
44965
44966/**
44967 * @fileOverview the arc guide
44968 * @author sima.zhang
44969 */
44970var Util = __webpack_require__(0);
44971var Base = __webpack_require__(17);
44972
44973var Arc = function (_Base) {
44974 _inherits(Arc, _Base);
44975
44976 function Arc() {
44977 _classCallCheck(this, Arc);
44978
44979 return _possibleConstructorReturn(this, _Base.apply(this, arguments));
44980 }
44981
44982 Arc.prototype.getDefaultCfg = function getDefaultCfg() {
44983 var cfg = _Base.prototype.getDefaultCfg.call(this);
44984 return Util.mix({}, cfg, {
44985 /**
44986 * 辅助元素类型
44987 * @type {String}
44988 */
44989 type: 'arc',
44990 zIndex: 15,
44991 /**
44992 * 辅助弧线的起始点
44993 * @type {Object | Function | Array}
44994 */
44995 start: null,
44996 /**
44997 * 辅助弧线的终止点
44998 * @type {Object | Function | Array}
44999 */
45000 end: null,
45001 /**
45002 * 辅助文本的样式配置
45003 * @type {Object}
45004 */
45005 style: {
45006 stroke: '#999',
45007 lineWidth: 1
45008 }
45009 });
45010 };
45011
45012 Arc.prototype.render = function render(coord, group) {
45013 var self = this;
45014 var start = self.parsePoint(coord, self.start);
45015 var end = self.parsePoint(coord, self.end);
45016 var coordCenter = coord.getCenter();
45017 var radius = Math.sqrt((start.x - coordCenter.x) * (start.x - coordCenter.x) + (start.y - coordCenter.y) * (start.y - coordCenter.y));
45018 var startAngle = Math.atan2(start.y - coordCenter.y, start.x - coordCenter.x);
45019 var endAngle = Math.atan2(end.y - coordCenter.y, end.x - coordCenter.x);
45020
45021 var arcShape = group.addShape('arc', {
45022 zIndex: self.zIndex,
45023 attrs: Util.mix({
45024 x: coordCenter.x,
45025 y: coordCenter.y,
45026 r: radius,
45027 startAngle: startAngle,
45028 endAngle: endAngle
45029 }, self.style)
45030 });
45031 arcShape.name = 'guide-arc';
45032 self.appendInfo && arcShape.setSilent('appendInfo', self.appendInfo);
45033 self.el = arcShape;
45034 };
45035
45036 return Arc;
45037}(Base);
45038
45039module.exports = Arc;
45040
45041/***/ }),
45042/* 348 */
45043/***/ (function(module, exports, __webpack_require__) {
45044
45045/**
45046 * @fileOverview The entry of legend
45047 * @author sima.zhang
45048 */
45049module.exports = {
45050 Category: __webpack_require__(349), // 分类图例
45051 Color: __webpack_require__(350), // 颜色图例
45052 Size: __webpack_require__(352) // 大小图例
45053};
45054
45055/***/ }),
45056/* 349 */
45057/***/ (function(module, exports, __webpack_require__) {
45058
45059function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
45060
45061function _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; }
45062
45063function _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; }
45064
45065/**
45066 * @fileOverview The class of category legend
45067 * @author sima.zhang
45068 */
45069var Util = __webpack_require__(0);
45070var Base = __webpack_require__(122);
45071
45072var _require = __webpack_require__(2),
45073 DomUtil = _require.DomUtil,
45074 Event = _require.Event,
45075 Group = _require.Group;
45076
45077var Global = __webpack_require__(1);
45078var LEGEND_STYLE = Global.legend.html;
45079
45080var CONTAINER_CLASS = 'g2-legend';
45081var TITLE_CLASS = 'g2-legend-title';
45082var LIST_CLASS = 'g2-legend-list';
45083var ITEM_CLASS = 'g2-legend-list-item';
45084var TEXT_CLASS = 'g2-legend-text';
45085var MARKER_CLASS = 'g2-legend-marker';
45086
45087function findNodeByClass(node, className) {
45088 return node.getElementsByClassName(className)[0];
45089}
45090
45091function getParentNode(node, className) {
45092 var nodeClass = node.className;
45093 nodeClass = nodeClass.split(' ');
45094 if (nodeClass.indexOf(className) > -1) {
45095 return node;
45096 }
45097
45098 if (node.parentNode) {
45099 if (node.parentNode.className === CONTAINER_CLASS) {
45100 return node.parentNode;
45101 }
45102 return getParentNode(node.parentNode, className);
45103 }
45104
45105 return null;
45106}
45107
45108function findItem(items, refer) {
45109 var rst = null;
45110 var value = refer instanceof Group ? refer.get('value') : refer;
45111 Util.each(items, function (item) {
45112 if (item.value === value) {
45113 rst = item;
45114 return false;
45115 }
45116 });
45117
45118 return rst;
45119}
45120
45121function findShapeByName(group, name) {
45122 return group.findBy(function (node) {
45123 return node.name === name;
45124 });
45125}
45126
45127var Category = function (_Base) {
45128 _inherits(Category, _Base);
45129
45130 function Category() {
45131 _classCallCheck(this, Category);
45132
45133 return _possibleConstructorReturn(this, _Base.apply(this, arguments));
45134 }
45135
45136 Category.prototype.getDefaultCfg = function getDefaultCfg() {
45137 var cfg = _Base.prototype.getDefaultCfg.call(this);
45138 return Util.mix({}, cfg, {
45139 /**
45140 * type标识
45141 * @type {String}
45142 */
45143 type: 'category-legend',
45144 /**
45145 * 子项集合
45146 * @type {Array}
45147 */
45148 items: null,
45149 /**
45150 * TODO:rename
45151 * 图例项水平方向的间距
45152 * @type {Number}
45153 */
45154 itemGap: 5,
45155 /**
45156 * TODO:rename
45157 * 图例标题距离图例项的距离
45158 * @type {Number}
45159 */
45160 titleGap: 15,
45161 /**
45162 * TODO:rename
45163 * 图例项垂直方向的间距
45164 * @type {Number}
45165 */
45166 itemMarginBottom: 8,
45167 /**
45168 * 图例项图组
45169 * @type {Group}
45170 */
45171 itemsGroup: null,
45172 /**
45173 * 布局方式: horizontal,vertical
45174 * @type {String}
45175 */
45176 layout: 'horizontal',
45177 /**
45178 * 是否允许全部取消,默认 false,即必须保留一个被选中
45179 * @type {Boolean}
45180 */
45181 allowAllCanceled: false,
45182 /**
45183 * 边框内边距
45184 * @type {Array}
45185 */
45186 backPadding: [0, 0, 0, 0],
45187 /**
45188 * 是否能被点击
45189 * @type {Boolean}
45190 */
45191 checkable: true,
45192 /**
45193 * 图例项取消选中的颜色
45194 * @type {String}
45195 */
45196 unCheckColor: '#ccc',
45197 /**
45198 * 图例背景层属性设置
45199 * @type {Obejct}
45200 */
45201 background: {
45202 fill: '#fff',
45203 fillOpacity: 0
45204 },
45205 /**
45206 * 图例项的宽度,当图例有很多图例项,并且用户想要这些图例项在同一平面内垂直对齐,此时这个属性可帮用户实现此效果
45207 * @type {Number}
45208 */
45209 itemWidth: null,
45210 textStyle: {
45211 fill: '#333',
45212 fontSize: 12,
45213 textAlign: 'start',
45214 textBaseline: 'middle',
45215 fontFamily: Global.fontFamily
45216 },
45217 /**
45218 * marker 和文字的距离
45219 * @type {Number}
45220 */
45221 _wordSpaceing: 8,
45222 /**
45223 * 是否使用 html 进行渲染,默认为 false
45224 * @type {Boolean}
45225 */
45226 useHtml: false,
45227 /**
45228 * useHtml 为 true 时生效,用于自动定位
45229 * @type {[type]}
45230 */
45231 autoPosition: true,
45232 container: null,
45233 /**
45234 * 使用html时的外层模板
45235 * @type {String}
45236 */
45237 containerTpl: '<div class="' + CONTAINER_CLASS + '">' + '<h4 class="' + TITLE_CLASS + '"></h4>' + '<ul class="' + LIST_CLASS + '"></ul>' + '</div>',
45238 /**
45239 * 默认的图例项 html 模板
45240 * @type {String}
45241 */
45242 _defaultItemTpl: '<li class="' + ITEM_CLASS + ' item-{index} {checked}" data-color="{originColor}" data-value="{originValue}">' + '<i class="' + MARKER_CLASS + '" style="background-color:{color};"></i>' + '<span class="' + TEXT_CLASS + '">{value}</span></li>',
45243 /**
45244 * 用户设置的图例项 html 模板
45245 * @type {String|Function}
45246 */
45247 itemTpl: null,
45248 /**
45249 * 图例项是否可点击,默认为 true
45250 * @type {Boolean}
45251 */
45252 clickable: true,
45253 /**
45254 * TODO: rename
45255 * 图例项的选择模式,多选和单选 multiple、single
45256 * @type {String}
45257 */
45258 selectedMode: 'multiple',
45259 /**
45260 * 图例项的顺序是否要逆序,默认为 false
45261 * @type {Boolean}
45262 */
45263 reversed: false,
45264 /**
45265 * 是否自动换行
45266 * @type {Boolean}
45267 */
45268 autoWrap: true
45269 });
45270 };
45271
45272 Category.prototype._beforeRenderUI = function _beforeRenderUI() {
45273 _Base.prototype._beforeRenderUI.call(this);
45274 };
45275
45276 Category.prototype._renderUI = function _renderUI() {
45277 if (!this.get('useHtml')) {
45278 _Base.prototype._renderUI.call(this);
45279 this._renderItems();
45280 this.get('autoWrap') && this._adjustItems(); // 默认自动换行
45281 this._renderBack();
45282 } else {
45283 // 使用 html 渲染图例
45284 this._renderHTML();
45285 }
45286 };
45287
45288 Category.prototype._bindUI = function _bindUI() {
45289 if (this.get('hoverable')) {
45290 this.on('mousemove', Util.wrapBehavior(this, '_onMousemove'));
45291 this.on('mouseleave', Util.wrapBehavior(this, '_onMouseleave'));
45292 }
45293
45294 if (this.get('clickable')) {
45295 this.on('click', Util.wrapBehavior(this, '_onClick'));
45296 }
45297 };
45298
45299 Category.prototype._getLegendItem = function _getLegendItem(target) {
45300 var item = target.get('parent');
45301 if (item && item.name === 'legendGroup') {
45302 return item;
45303 }
45304 return null;
45305 };
45306
45307 Category.prototype._onMousemove = function _onMousemove(ev) {
45308 var item = this._getLegendItem(ev.currentTarget);
45309 if (item && item.get('checked')) {
45310 var items = this.get('items');
45311 var itemhover = new Event('itemhover', ev, true, true);
45312 itemhover.item = findItem(items, item);
45313 itemhover.checked = item.get('checked');
45314 this.emit('itemhover', itemhover);
45315 } else if (!item) {
45316 this.emit('itemunhover', ev);
45317 }
45318
45319 return;
45320 };
45321
45322 Category.prototype._onMouseleave = function _onMouseleave(ev) {
45323 this.emit('itemunhover', ev);
45324 return;
45325 };
45326
45327 Category.prototype._onClick = function _onClick(ev) {
45328 var clickedItem = this._getLegendItem(ev.currentTarget);
45329 var items = this.get('items');
45330 if (clickedItem && !clickedItem.get('destroyed')) {
45331 var checked = clickedItem.get('checked');
45332 if (!this.get('allowAllCanceled') && checked && this.getCheckedCount() === 1) {
45333 return;
45334 }
45335 var mode = this.get('selectedMode');
45336 var item = findItem(items, clickedItem);
45337 var itemclick = new Event('itemclick', ev, true, true);
45338 itemclick.item = item;
45339 itemclick.currentTarget = clickedItem;
45340 itemclick.checked = mode === 'single' ? true : !checked;
45341
45342 var unCheckColor = this.get('unCheckColor');
45343 var checkColor = this.get('textStyle').fill;
45344 var markerItem = void 0;
45345 var textItem = void 0;
45346 var legendItem = void 0;
45347 if (mode === 'single') {
45348 var itemsGroup = this.get('itemsGroup');
45349 var children = itemsGroup.get('children');
45350 Util.each(children, function (child) {
45351 markerItem = findShapeByName(child, 'legend-marker');
45352 textItem = findShapeByName(child, 'legend-text');
45353 legendItem = findShapeByName(child, 'legend-item');
45354 if (child !== clickedItem) {
45355 if (markerItem.attr('fill')) {
45356 markerItem.attr('fill', unCheckColor);
45357 }
45358 if (markerItem.attr('stroke')) {
45359 markerItem.attr('stroke', unCheckColor);
45360 }
45361 textItem.attr('fill', unCheckColor);
45362 markerItem.setSilent('checked', false);
45363 textItem.setSilent('checked', false);
45364 legendItem.setSilent('checked', false);
45365 child.setSilent('checked', false);
45366 } else {
45367 if (markerItem.attr('fill')) {
45368 markerItem.attr('fill', item.marker.fill);
45369 }
45370 if (markerItem.attr('stroke')) {
45371 markerItem.attr('stroke', item.marker.stroke);
45372 }
45373 textItem.attr('fill', checkColor);
45374 markerItem.setSilent('checked', true);
45375 textItem.setSilent('checked', true);
45376 legendItem.setSilent('checked', true);
45377 child.setSilent('checked', true);
45378 }
45379 });
45380 } else {
45381 markerItem = findShapeByName(clickedItem, 'legend-marker');
45382 textItem = findShapeByName(clickedItem, 'legend-text');
45383 legendItem = findShapeByName(clickedItem, 'legend-item');
45384
45385 if (markerItem.attr('fill')) {
45386 markerItem.attr('fill', checked ? unCheckColor : item.marker.fill);
45387 }
45388 if (markerItem.attr('stroke')) {
45389 markerItem.attr('stroke', checked ? unCheckColor : item.marker.stroke);
45390 }
45391 textItem.attr('fill', checked ? unCheckColor : checkColor);
45392 clickedItem.setSilent('checked', !checked);
45393 markerItem.setSilent('checked', !checked);
45394 textItem.setSilent('checked', !checked);
45395 legendItem.setSilent('checked', !checked);
45396 }
45397 this.emit('itemclick', itemclick);
45398 }
45399 return;
45400 };
45401
45402 Category.prototype._renderHTML = function _renderHTML() {
45403 var _this2 = this;
45404
45405 var self = this;
45406 var canvas = self.get('canvas');
45407 var outterNode = canvas.get('el').parentNode;
45408 var title = this.get('title');
45409 var containerTpl = self.get('containerTpl');
45410 var legendWrapper = DomUtil.createDom(containerTpl);
45411 var titleDom = findNodeByClass(legendWrapper, TITLE_CLASS);
45412 var itemListDom = findNodeByClass(legendWrapper, LIST_CLASS);
45413 var unCheckedColor = self.get('unCheckColor');
45414 var mode = self.get('selectedMode');
45415
45416 DomUtil.modifyCSS(itemListDom, Util.mix({}, LEGEND_STYLE[LIST_CLASS], self.get(LIST_CLASS)));
45417
45418 if (titleDom) {
45419 if (title && title.text) {
45420 titleDom.innerHTML = title.text;
45421 DomUtil.modifyCSS(titleDom, Util.mix({}, LEGEND_STYLE[TITLE_CLASS], self.get(TITLE_CLASS)));
45422 } else {
45423 legendWrapper.removeChild(titleDom);
45424 }
45425 }
45426
45427 // 开始渲染图例项
45428 var items = self.get('items');
45429 var itemTpl = self.get('_defaultItemTpl');
45430 var userItemTpl = self.get('itemTpl');
45431 if (userItemTpl && userItemTpl !== itemTpl) {
45432 itemTpl = userItemTpl;
45433 }
45434
45435 if (self.get('reversed')) {
45436 items.reverse();
45437 }
45438
45439 var position = self.get('position');
45440 var itemStyle = Util.mix({}, LEGEND_STYLE[ITEM_CLASS], {
45441 display: position === 'right' || position === 'left' ? 'block' : 'inline-block'
45442 }, self.get(ITEM_CLASS));
45443 var markerStyle = Util.mix({}, LEGEND_STYLE[MARKER_CLASS], self.get(MARKER_CLASS));
45444 Util.each(items, function (item, index) {
45445 var checked = item.checked;
45446 var value = self._formatItemValue(item.value);
45447 var markerColor = item.marker.fill || item.marker.stroke;
45448 var color = checked ? markerColor : unCheckedColor;
45449 var domStr = void 0;
45450 if (Util.isFunction(itemTpl)) {
45451 domStr = itemTpl(value, color, checked, index);
45452 } else {
45453 domStr = itemTpl;
45454 }
45455 var itemDiv = Util.substitute(domStr, {
45456 index: index,
45457 checked: checked ? 'checked' : 'unChecked',
45458 value: value,
45459 color: color,
45460 originColor: markerColor,
45461 originValue: item.value
45462 });
45463 var itemDom = DomUtil.createDom(itemDiv);
45464 var markerDom = findNodeByClass(itemDom, MARKER_CLASS);
45465 DomUtil.modifyCSS(itemDom, itemStyle);
45466 markerDom && DomUtil.modifyCSS(markerDom, markerStyle);
45467
45468 if (!checked) {
45469 itemDom.style.color = unCheckedColor;
45470 if (markerDom) {
45471 markerDom.style.backgroundColor = unCheckedColor;
45472 }
45473 }
45474 itemListDom.appendChild(itemDom);
45475 });
45476
45477 if (self.get('clickable')) {
45478 var childNodes = itemListDom.childNodes;
45479 // 注册事件
45480 legendWrapper.onclick = function (ev) {
45481 var target = ev.target;
45482 var targetClass = target.className;
45483 targetClass = targetClass.split(' ');
45484 if (targetClass.indexOf(CONTAINER_CLASS) > -1 || targetClass.indexOf(LIST_CLASS) > -1) {
45485 return;
45486 }
45487 var parentDom = getParentNode(target, ITEM_CLASS);
45488 var textDom = findNodeByClass(parentDom, TEXT_CLASS);
45489 var markerDom = findNodeByClass(parentDom, MARKER_CLASS);
45490 var clickedItem = findItem(items, parentDom.getAttribute('data-value'));
45491
45492 if (!clickedItem) {
45493 return;
45494 }
45495 // update checked status
45496 clickedItem.checked = mode === 'single' ? true : !clickedItem.checked;
45497 var domClass = parentDom.className;
45498 var originColor = parentDom.getAttribute('data-color');
45499 if (mode === 'single') {
45500 // 单选模式
45501 // 其他图例项全部置灰
45502 Util.each(childNodes, function (child) {
45503 if (child !== parentDom) {
45504 var childMarkerDom = findNodeByClass(child, MARKER_CLASS);
45505 childMarkerDom.style.backgroundColor = unCheckedColor;
45506 child.className = Util.replace(child.className, 'checked', 'unChecked');
45507 child.style.color = unCheckedColor;
45508
45509 var childItem = findItem(items, child.getAttribute('data-value'));
45510 childItem.checked = false;
45511 } else {
45512 if (textDom) {
45513 textDom.style.color = self.get('textStyle').fill;
45514 }
45515 if (markerDom) {
45516 markerDom.style.backgroundColor = originColor;
45517 }
45518 parentDom.className = Util.replace(domClass, 'unChecked', 'checked');
45519 }
45520 });
45521 } else {
45522 // 混合模式
45523 var clickedItemChecked = domClass.includes('checked');
45524 var count = 0;
45525 Util.each(childNodes, function (child) {
45526 if (child.className.includes('checked')) {
45527 count++;
45528 }
45529 });
45530 if (!_this2.get('allowAllCanceled') && clickedItemChecked && count === 1) {
45531 return;
45532 }
45533 if (clickedItemChecked) {
45534 if (markerDom) {
45535 markerDom.style.backgroundColor = unCheckedColor;
45536 }
45537 parentDom.className = Util.replace(domClass, 'checked', 'unChecked');
45538 parentDom.style.color = unCheckedColor;
45539 } else {
45540 if (markerDom) {
45541 markerDom.style.backgroundColor = originColor;
45542 }
45543 parentDom.className = Util.replace(domClass, 'unChecked', 'checked');
45544 parentDom.style.color = self.get('textStyle').fill;
45545 }
45546 }
45547
45548 self.emit('itemclick', {
45549 item: clickedItem,
45550 currentTarget: parentDom,
45551 checked: mode === 'single' ? true : clickedItem.checked
45552 });
45553 };
45554 }
45555 if (self.get('hoverable')) {
45556 legendWrapper.onmousemove = function (ev) {
45557 var target = ev.target;
45558 var targetClass = target.className;
45559 targetClass = targetClass.split(' ');
45560 if (targetClass.indexOf(CONTAINER_CLASS) > -1 || targetClass.indexOf(LIST_CLASS) > -1) {
45561 return;
45562 }
45563 var parentDom = getParentNode(target, ITEM_CLASS);
45564 var domClass = parentDom.className;
45565 var hoveredItem = findItem(items, parentDom.getAttribute('data-value'));
45566 if (hoveredItem && domClass.includes('checked')) {
45567 self.emit('itemhover', {
45568 item: hoveredItem,
45569 currentTarget: parentDom,
45570 checked: hoveredItem.checked
45571 });
45572 } else if (!hoveredItem) {
45573 self.emit('itemunhover', ev);
45574 }
45575 };
45576
45577 legendWrapper.onmouseout = function (ev) {
45578 self.emit('itemunhover', ev);
45579 };
45580 }
45581
45582 var container = self.get('container');
45583 if (/^\#/.test(container)) {
45584 // 如果传入 dom 节点的 id
45585 var id = container.replace('#', '');
45586 container = document.getElementById(id);
45587 // container.style.position = 'relative';
45588 container.appendChild(legendWrapper);
45589 } else {
45590 var _position = self.get('position');
45591 var _canvas = self.get('canvas');
45592 var rangeStyle = {};
45593 if (_position === 'left' || _position === 'right') {
45594 rangeStyle = {
45595 maxHeight: (self.get('maxLength') || _canvas.get('height')) + 'px'
45596 };
45597 } else {
45598 rangeStyle = {
45599 maxWidth: (self.get('maxLength') || _canvas.get('width')) + 'px'
45600 };
45601 }
45602
45603 DomUtil.modifyCSS(legendWrapper, Util.mix({}, LEGEND_STYLE[CONTAINER_CLASS], rangeStyle, self.get(CONTAINER_CLASS)));
45604 outterNode.appendChild(legendWrapper);
45605 }
45606 self.set('legendWrapper', legendWrapper);
45607 };
45608
45609 Category.prototype._renderItems = function _renderItems() {
45610 var self = this;
45611 var items = self.get('items');
45612 if (self.get('reversed')) {
45613 items.reverse();
45614 }
45615 Util.each(items, function (item, index) {
45616 self._addItem(item, index);
45617 });
45618 };
45619
45620 Category.prototype._renderBack = function _renderBack() {
45621 var padding = this.get('backPadding');
45622 var backAttrs = this.get('background');
45623 this.renderBack(padding, backAttrs);
45624 };
45625
45626 Category.prototype._formatItemValue = function _formatItemValue(value) {
45627 var formatter = this.get('itemFormatter');
45628 if (formatter) {
45629 value = formatter.call(this, value);
45630 }
45631 return value;
45632 };
45633
45634 Category.prototype._getNextX = function _getNextX() {
45635 var layout = this.get('layout');
45636 var itemGap = this.get('itemGap');
45637 var itemsGroup = this.get('itemsGroup');
45638 var itemWidth = this.get('itemWidth');
45639 var children = itemsGroup.get('children');
45640 var nextX = 0;
45641
45642 if (layout === 'horizontal') {
45643 // 水平布局
45644 Util.each(children, function (v) {
45645 nextX += (itemWidth ? itemWidth : v.getBBox().width) + itemGap;
45646 });
45647 }
45648 return nextX;
45649 };
45650
45651 Category.prototype._getNextY = function _getNextY() {
45652 var itemMarginBottom = this.get('itemMarginBottom');
45653 var titleGap = this.get('titleShape') ? this.get('titleGap') : 0;
45654 var layout = this.get('layout');
45655 var itemsGroup = this.get('itemsGroup');
45656 var titleShape = this.get('titleShape');
45657 var children = itemsGroup.get('children');
45658 var nextY = titleGap;
45659 if (titleShape) {
45660 nextY += titleShape.getBBox().height;
45661 }
45662
45663 if (layout === 'vertical') {
45664 // 竖直布局
45665 Util.each(children, function (v) {
45666 nextY += v.getBBox().height + itemMarginBottom;
45667 });
45668 }
45669 return nextY;
45670 };
45671
45672 Category.prototype._addItem = function _addItem(item) {
45673 var itemsGroup = this.get('itemsGroup');
45674 var x = this._getNextX();
45675 var y = this._getNextY();
45676 var unCheckColor = this.get('unCheckColor');
45677 var itemGroup = itemsGroup.addGroup({
45678 x: x,
45679 y: y,
45680 value: item.value,
45681 checked: item.checked
45682 });
45683
45684 var textStyle = this.get('textStyle');
45685 var wordSpace = this.get('_wordSpaceing');
45686 var startX = 0;
45687
45688 if (item.marker) {
45689 // 如果有marker添加marker
45690 var markerAttrs = Util.mix({}, item.marker, {
45691 x: item.marker.radius + x,
45692 y: y
45693 });
45694
45695 if (!item.checked) {
45696 if (markerAttrs.fill) {
45697 markerAttrs.fill = unCheckColor;
45698 }
45699 if (markerAttrs.stroke) {
45700 markerAttrs.stroke = unCheckColor;
45701 }
45702 }
45703
45704 var markerShape = itemGroup.addShape('marker', {
45705 type: 'marker',
45706 attrs: markerAttrs
45707 });
45708 markerShape.attr('cursor', 'pointer');
45709 markerShape.name = 'legend-marker';
45710 startX += markerShape.getBBox().width + wordSpace;
45711 }
45712
45713 var textAttrs = Util.mix({}, textStyle, {
45714 x: startX + x,
45715 y: y,
45716 text: this._formatItemValue(item.value)
45717 });
45718 if (!item.checked) {
45719 Util.mix(textAttrs, {
45720 fill: unCheckColor
45721 });
45722 }
45723
45724 var textShape = itemGroup.addShape('text', {
45725 attrs: textAttrs
45726 });
45727 textShape.attr('cursor', 'pointer');
45728 textShape.name = 'legend-text';
45729 this.get('appendInfo') && textShape.setSilent('appendInfo', this.get('appendInfo'));
45730
45731 // 添加一个包围矩形,用于事件支持
45732 var bbox = itemGroup.getBBox();
45733 var itemWidth = this.get('itemWidth');
45734 var wrapperShape = itemGroup.addShape('rect', {
45735 attrs: {
45736 x: x,
45737 y: y - bbox.height / 2,
45738 fill: '#fff',
45739 fillOpacity: 0,
45740 width: itemWidth || bbox.width,
45741 height: bbox.height
45742 }
45743 });
45744 wrapperShape.attr('cursor', 'pointer');
45745 wrapperShape.setSilent('origin', item); // 保存图例项相关的数据,便于事件操作
45746 wrapperShape.name = 'legend-item';
45747 this.get('appendInfo') && wrapperShape.setSilent('appendInfo', this.get('appendInfo'));
45748 itemGroup.name = 'legendGroup';
45749 return itemGroup;
45750 };
45751
45752 Category.prototype._adjustHorizontal = function _adjustHorizontal() {
45753 var itemsGroup = this.get('itemsGroup');
45754 var children = itemsGroup.get('children');
45755 var maxLength = this.get('maxLength');
45756 var itemGap = this.get('itemGap');
45757 var itemMarginBottom = this.get('itemMarginBottom');
45758 var titleGap = this.get('titleShape') ? this.get('titleGap') : 0;
45759 var row = 0;
45760 var rowLength = 0;
45761 var width = void 0;
45762 var height = void 0;
45763 var box = void 0;
45764 var itemWidth = this.get('itemWidth');
45765 if (itemsGroup.getBBox().width > maxLength) {
45766 Util.each(children, function (child) {
45767 box = child.getBBox();
45768 width = itemWidth || box.width;
45769 height = box.height + itemMarginBottom;
45770
45771 if (maxLength - rowLength < width) {
45772 row++;
45773 rowLength = 0;
45774 }
45775 child.move(rowLength, row * height + titleGap);
45776 rowLength += width + itemGap;
45777 });
45778 }
45779 return;
45780 };
45781
45782 Category.prototype._adjustVertical = function _adjustVertical() {
45783 var itemsGroup = this.get('itemsGroup');
45784 var titleShape = this.get('titleShape');
45785 var children = itemsGroup.get('children');
45786 var maxLength = this.get('maxLength'); // 垂直布局,则 maxLength 代表容器的高度
45787 var itemGap = this.get('itemGap');
45788 var itemMarginBottom = this.get('itemMarginBottom');
45789 var titleGap = this.get('titleGap');
45790 var titleHeight = titleShape ? titleShape.getBBox().height + titleGap : 0;
45791 var itemWidth = this.get('itemWidth');
45792 var colLength = titleHeight;
45793 var width = void 0;
45794 var height = void 0;
45795 var box = void 0;
45796 var maxItemWidth = 0;
45797 var totalLength = 0;
45798
45799 if (itemsGroup.getBBox().height > maxLength) {
45800 Util.each(children, function (v) {
45801 box = v.getBBox();
45802 width = box.width;
45803 height = box.height;
45804
45805 if (itemWidth) {
45806 maxItemWidth = itemWidth + itemGap;
45807 } else if (width > maxItemWidth) {
45808 maxItemWidth = width + itemGap;
45809 }
45810
45811 if (maxLength - colLength < height) {
45812 colLength = titleHeight;
45813 totalLength += maxItemWidth;
45814 v.move(totalLength, titleHeight);
45815 } else {
45816 v.move(totalLength, colLength);
45817 }
45818
45819 colLength += height + itemMarginBottom;
45820 });
45821 }
45822 return;
45823 };
45824
45825 Category.prototype._adjustItems = function _adjustItems() {
45826 var layout = this.get('layout');
45827 if (layout === 'horizontal') {
45828 this._adjustHorizontal();
45829 } else {
45830 this._adjustVertical();
45831 }
45832 };
45833
45834 Category.prototype.getWidth = function getWidth() {
45835 if (this.get('useHtml')) {
45836 return DomUtil.getOuterWidth(this.get('legendWrapper'));
45837 }
45838 return _Base.prototype.getWidth.call(this);
45839 };
45840
45841 Category.prototype.getHeight = function getHeight() {
45842 if (this.get('useHtml')) {
45843 return DomUtil.getOuterHeight(this.get('legendWrapper'));
45844 }
45845
45846 return _Base.prototype.getHeight.call(this);
45847 };
45848
45849 Category.prototype.move = function move(x, y) {
45850 if (this.get('useHtml') && !/^\#/.test(this.get('container'))) {
45851 DomUtil.modifyCSS(this.get('legendWrapper'), {
45852 left: x + 'px',
45853 top: y + 'px'
45854 });
45855 } else {
45856 _Base.prototype.move.call(this, x, y);
45857 }
45858 };
45859
45860 Category.prototype.remove = function remove() {
45861 if (this.get('useHtml')) {
45862 // 移除元素
45863 var legendWrapper = this.get('legendWrapper');
45864 if (legendWrapper && legendWrapper.parentNode) {
45865 legendWrapper.parentNode.removeChild(legendWrapper);
45866 }
45867 }
45868 _Base.prototype.remove.call(this); // must be called
45869 };
45870
45871 return Category;
45872}(Base);
45873
45874module.exports = Category;
45875
45876/***/ }),
45877/* 350 */
45878/***/ (function(module, exports, __webpack_require__) {
45879
45880function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
45881
45882function _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; }
45883
45884function _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; }
45885
45886/**
45887 * @fileOverview The class of the gradient color legend
45888 * @author sima.zhang
45889 */
45890var Util = __webpack_require__(0);
45891var Continuous = __webpack_require__(123);
45892var ColorUtil = __webpack_require__(64); // TODO: 这个 Util 是否可换个位置
45893
45894var Color = function (_Continuous) {
45895 _inherits(Color, _Continuous);
45896
45897 function Color() {
45898 _classCallCheck(this, Color);
45899
45900 return _possibleConstructorReturn(this, _Continuous.apply(this, arguments));
45901 }
45902
45903 Color.prototype.getDefaultCfg = function getDefaultCfg() {
45904 var cfg = _Continuous.prototype.getDefaultCfg.call(this);
45905 return Util.mix({}, cfg, {
45906 /**
45907 * 类型
45908 * @type {String}
45909 */
45910 type: 'color-legend',
45911 /**
45912 * 布局方式
45913 * horizontal 水平
45914 * vertical 垂直
45915 * @type {String}
45916 */
45917 layout: 'vertical',
45918 labelOffset: 15,
45919 lineStyle: {
45920 lineWidth: 1,
45921 stroke: '#fff'
45922 }
45923 });
45924 };
45925
45926 Color.prototype._renderSliderShape = function _renderSliderShape() {
45927 var slider = this.get('slider');
45928 var backgroundElement = slider.get('backgroundElement');
45929 var width = this.get('width');
45930 var height = this.get('height');
45931 var layout = this.get('layout');
45932 var items = this.get('items');
45933 var fill = '';
45934 var rgbColor = void 0;
45935
45936 if (layout === 'vertical') {
45937 fill += 'l (90) ';
45938 Util.each(items, function (v) {
45939 rgbColor = ColorUtil.toRGB(v.attrValue);
45940 fill += 1 - v.scaleValue + ':' + rgbColor + ' ';
45941 });
45942 } else {
45943 fill += 'l (0) ';
45944 Util.each(items, function (v) {
45945 rgbColor = ColorUtil.toRGB(v.attrValue);
45946 fill += v.scaleValue + ':' + rgbColor + ' ';
45947 });
45948 }
45949 return this._addBackground(backgroundElement, 'Rect', {
45950 x: 0,
45951 y: 0,
45952 width: width,
45953 height: height,
45954 fill: fill,
45955 strokeOpacity: 0
45956 });
45957 };
45958
45959 Color.prototype._renderBackground = function _renderBackground() {
45960 var self = this;
45961 var titleShape = this.get('titleShape');
45962 var titleGap = this.get('titleGap');
45963 titleGap = titleShape ? titleShape.getBBox().height + titleGap : titleGap;
45964 var width = this.get('width');
45965 var height = this.get('height');
45966 var layout = this.get('layout');
45967 var items = this.get('items');
45968 var fill = '';
45969 var rgbColor = void 0;
45970
45971 var path = [];
45972 var bgGroup = this.addGroup();
45973
45974 if (layout === 'vertical') {
45975 fill += 'l (90) ';
45976 Util.each(items, function (v, index) {
45977 if (index !== 0 && index !== items.length - 1) {
45978 path.push(['M', 0, height - v.scaleValue * height]);
45979 path.push(['L', width, height - v.scaleValue * height]);
45980 }
45981
45982 rgbColor = ColorUtil.toRGB(v.attrValue);
45983 fill += 1 - v.scaleValue + ':' + rgbColor + ' ';
45984 bgGroup.addShape('text', {
45985 attrs: Util.mix({}, {
45986 x: width + self.get('labelOffset') / 2,
45987 y: height - v.scaleValue * height,
45988 text: self._formatItemValue(v.value) + '' // 以字符串格式展示
45989 }, self.get('textStyle'), {
45990 textAlign: 'start'
45991 })
45992 });
45993 });
45994 } else {
45995 fill += 'l (0) ';
45996 Util.each(items, function (v, index) {
45997 if (index !== 0 && index !== items.length - 1) {
45998 path.push(['M', v.scaleValue * width, 0]);
45999 path.push(['L', v.scaleValue * width, height]);
46000 }
46001 rgbColor = ColorUtil.toRGB(v.attrValue);
46002 fill += v.scaleValue + ':' + rgbColor + ' ';
46003 bgGroup.addShape('text', {
46004 attrs: Util.mix({}, {
46005 x: v.scaleValue * width,
46006 y: height + self.get('labelOffset'),
46007 text: self._formatItemValue(v.value) + '' // 以字符串格式展示
46008 }, self.get('textStyle'))
46009 });
46010 });
46011 }
46012 bgGroup.addShape('rect', {
46013 attrs: {
46014 x: 0,
46015 y: 0,
46016 width: width,
46017 height: height,
46018 fill: fill,
46019 strokeOpacity: 0
46020 }
46021 });
46022
46023 bgGroup.addShape('path', {
46024 attrs: Util.mix({
46025 path: path
46026 }, this.get('lineStyle'))
46027 });
46028
46029 bgGroup.move(0, titleGap);
46030 };
46031
46032 return Color;
46033}(Continuous);
46034
46035module.exports = Color;
46036
46037/***/ }),
46038/* 351 */
46039/***/ (function(module, exports, __webpack_require__) {
46040
46041function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
46042
46043function _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; }
46044
46045function _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; }
46046
46047/**
46048 * @fileOverview The class of slider
46049 * @author sima.zhang
46050 */
46051var Util = __webpack_require__(0);
46052
46053var _require = __webpack_require__(2),
46054 Group = _require.Group,
46055 DomUtil = _require.DomUtil;
46056
46057var Slider = function (_Group) {
46058 _inherits(Slider, _Group);
46059
46060 function Slider() {
46061 _classCallCheck(this, Slider);
46062
46063 return _possibleConstructorReturn(this, _Group.apply(this, arguments));
46064 }
46065
46066 Slider.prototype.getDefaultCfg = function getDefaultCfg() {
46067 return {
46068 /**
46069 * 范围
46070 * @type {Array}
46071 */
46072 range: null,
46073 /**
46074 * 中滑块属性
46075 * @type {ATTRS}
46076 */
46077 middleAttr: null,
46078 /**
46079 * 背景
46080 * @type {G-Element}
46081 */
46082 backgroundElement: null,
46083 /**
46084 * 下滑块
46085 * @type {G-Element}
46086 */
46087 minHandleElement: null,
46088 /**
46089 * 上滑块
46090 * @type {G-Element}
46091 */
46092 maxHandleElement: null,
46093 /**
46094 * 中块
46095 * @type {G-Element}
46096 */
46097 middleHandleElement: null,
46098 /**
46099 * 当前的激活的元素
46100 * @type {G-Element}
46101 */
46102 currentTarget: null,
46103 /**
46104 * 布局方式: horizontal,vertical
46105 * @type {String}
46106 */
46107 layout: 'vertical',
46108 /**
46109 * 宽
46110 * @type {Number}
46111 */
46112 width: null,
46113 /**
46114 * 高
46115 * @type {Number}
46116 */
46117 height: null,
46118 /**
46119 * 当前的PageX
46120 * @type {Number}
46121 */
46122 pageX: null,
46123 /**
46124 * 当前的PageY
46125 * @type {Number}
46126 */
46127 pageY: null
46128 };
46129 };
46130
46131 Slider.prototype._beforeRenderUI = function _beforeRenderUI() {
46132 var layout = this.get('layout');
46133 var backgroundElement = this.get('backgroundElement');
46134 var minHandleElement = this.get('minHandleElement');
46135 var maxHandleElement = this.get('maxHandleElement');
46136 var middleHandleElement = this.addShape('rect', {
46137 attrs: this.get('middleAttr')
46138 });
46139 var trigerCursor = layout === 'vertical' ? 'ns-resize' : 'ew-resize';
46140
46141 this.add([backgroundElement, minHandleElement, maxHandleElement]);
46142 this.set('middleHandleElement', middleHandleElement);
46143 backgroundElement.set('zIndex', 0);
46144 middleHandleElement.set('zIndex', 1);
46145 minHandleElement.set('zIndex', 2);
46146 maxHandleElement.set('zIndex', 2);
46147 middleHandleElement.attr('cursor', 'move');
46148 minHandleElement.attr('cursor', trigerCursor);
46149 maxHandleElement.attr('cursor', trigerCursor);
46150 this.sort();
46151 };
46152
46153 Slider.prototype._renderUI = function _renderUI() {
46154 if (this.get('layout') === 'horizontal') {
46155 this._renderHorizontal();
46156 } else {
46157 this._renderVertical();
46158 }
46159 };
46160
46161 Slider.prototype._transform = function _transform(layout) {
46162 var range = this.get('range');
46163 var minRatio = range[0] / 100;
46164 var maxRatio = range[1] / 100;
46165 var width = this.get('width');
46166 var height = this.get('height');
46167 var minHandleElement = this.get('minHandleElement');
46168 var maxHandleElement = this.get('maxHandleElement');
46169 var middleHandleElement = this.get('middleHandleElement');
46170
46171 minHandleElement.initTransform();
46172 maxHandleElement.initTransform();
46173
46174 if (layout === 'horizontal') {
46175 middleHandleElement.attr({
46176 x: width * minRatio,
46177 y: 0,
46178 width: (maxRatio - minRatio) * width,
46179 height: height
46180 });
46181 minHandleElement.translate(minRatio * width, height);
46182 maxHandleElement.translate(maxRatio * width, height);
46183 } else {
46184 middleHandleElement.attr({
46185 x: 0,
46186 y: height * (1 - maxRatio),
46187 width: width,
46188 height: (maxRatio - minRatio) * height
46189 });
46190 minHandleElement.translate(width / 2, (1 - minRatio) * height);
46191 maxHandleElement.translate(width / 2, (1 - maxRatio) * height);
46192 }
46193 };
46194
46195 Slider.prototype._renderHorizontal = function _renderHorizontal() {
46196 this._transform('horizontal');
46197 };
46198
46199 Slider.prototype._renderVertical = function _renderVertical() {
46200 this._transform('vertical');
46201 };
46202
46203 Slider.prototype._bindUI = function _bindUI() {
46204 this.on('mousedown', Util.wrapBehavior(this, '_onMouseDown'));
46205 };
46206
46207 Slider.prototype._isElement = function _isElement(target, name) {
46208 // 判断是否是该元素
46209 var element = this.get(name);
46210 if (target === element) {
46211 return true;
46212 }
46213 if (element.isGroup) {
46214 var elementChildren = element.get('children');
46215 return elementChildren.indexOf(target) > -1;
46216 }
46217 return false;
46218 };
46219
46220 Slider.prototype._getRange = function _getRange(diff, range) {
46221 var rst = diff + range;
46222 rst = rst > 100 ? 100 : rst;
46223 rst = rst < 0 ? 0 : rst;
46224 return rst;
46225 };
46226
46227 Slider.prototype._updateStatus = function _updateStatus(dim, ev) {
46228 var totalLength = dim === 'x' ? this.get('width') : this.get('height');
46229 dim = Util.upperFirst(dim);
46230 var range = this.get('range');
46231 var page = this.get('page' + dim);
46232 var currentTarget = this.get('currentTarget');
46233 var rangeStash = this.get('rangeStash');
46234 var layout = this.get('layout');
46235 var sign = layout === 'vertical' ? -1 : 1;
46236 var currentPage = ev['page' + dim];
46237 var diffPage = currentPage - page;
46238 var diffRange = diffPage / totalLength * 100 * sign;
46239 var diffStashRange = void 0;
46240
46241 if (range[1] <= range[0]) {
46242 if (this._isElement(currentTarget, 'minHandleElement') || this._isElement(currentTarget, 'maxHandleElement')) {
46243 range[0] = this._getRange(diffRange, range[0]);
46244 range[1] = this._getRange(diffRange, range[0]);
46245 }
46246 } else {
46247 if (this._isElement(currentTarget, 'minHandleElement')) {
46248 range[0] = this._getRange(diffRange, range[0]);
46249 }
46250 if (this._isElement(currentTarget, 'maxHandleElement')) {
46251 range[1] = this._getRange(diffRange, range[1]);
46252 }
46253 }
46254
46255 if (this._isElement(currentTarget, 'middleHandleElement')) {
46256 diffStashRange = rangeStash[1] - rangeStash[0];
46257 range[0] = this._getRange(diffRange, range[0]);
46258 range[1] = range[0] + diffStashRange;
46259 if (range[1] > 100) {
46260 range[1] = 100;
46261 range[0] = range[1] - diffStashRange;
46262 }
46263 }
46264
46265 this.emit('sliderchange', {
46266 range: range
46267 });
46268
46269 this.set('page' + dim, currentPage);
46270 this._renderUI();
46271 this.get('canvas').draw(); // need delete
46272 return;
46273 };
46274
46275 Slider.prototype._onMouseDown = function _onMouseDown(ev) {
46276 var currentTarget = ev.currentTarget;
46277 var originEvent = ev.event;
46278 var range = this.get('range');
46279 originEvent.stopPropagation();
46280 originEvent.preventDefault();
46281 this.set('pageX', originEvent.pageX);
46282 this.set('pageY', originEvent.pageY);
46283 this.set('currentTarget', currentTarget);
46284 this.set('rangeStash', [range[0], range[1]]);
46285 this._bindCanvasEvents();
46286 };
46287
46288 Slider.prototype._bindCanvasEvents = function _bindCanvasEvents() {
46289 var containerDOM = this.get('canvas').get('containerDOM');
46290 this.onMouseMoveListener = DomUtil.addEventListener(containerDOM, 'mousemove', Util.wrapBehavior(this, '_onCanvasMouseMove'));
46291 this.onMouseUpListener = DomUtil.addEventListener(containerDOM, 'mouseup', Util.wrapBehavior(this, '_onCanvasMouseUp'));
46292 };
46293
46294 Slider.prototype._onCanvasMouseMove = function _onCanvasMouseMove(ev) {
46295 var layout = this.get('layout');
46296 if (layout === 'horizontal') {
46297 this._updateStatus('x', ev);
46298 } else {
46299 this._updateStatus('y', ev);
46300 }
46301 };
46302
46303 Slider.prototype._onCanvasMouseUp = function _onCanvasMouseUp() {
46304 this._removeDocumentEvents();
46305 };
46306
46307 Slider.prototype._removeDocumentEvents = function _removeDocumentEvents() {
46308 this.onMouseMoveListener.remove();
46309 this.onMouseUpListener.remove();
46310 };
46311
46312 return Slider;
46313}(Group);
46314
46315module.exports = Slider;
46316
46317/***/ }),
46318/* 352 */
46319/***/ (function(module, exports, __webpack_require__) {
46320
46321function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
46322
46323function _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; }
46324
46325function _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; }
46326
46327/**
46328 * @fileOverview The class of the size legend
46329 * @author sima.zhang
46330 */
46331var Util = __webpack_require__(0);
46332var Global = __webpack_require__(1);
46333var Continuous = __webpack_require__(123);
46334var CIRCLE_GAP = 8;
46335
46336var Size = function (_Continuous) {
46337 _inherits(Size, _Continuous);
46338
46339 function Size() {
46340 _classCallCheck(this, Size);
46341
46342 return _possibleConstructorReturn(this, _Continuous.apply(this, arguments));
46343 }
46344
46345 Size.prototype.getDefaultCfg = function getDefaultCfg() {
46346 var cfg = _Continuous.prototype.getDefaultCfg.call(this);
46347 return Util.mix({}, cfg, {
46348 /**
46349 * 类型
46350 * @type {String}
46351 */
46352 type: 'size-legend',
46353 width: 100,
46354 height: 200,
46355 _circleStyle: {
46356 stroke: '#4E7CCC',
46357 fill: '#fff',
46358 fillOpacity: 0
46359 },
46360 textStyle: {
46361 fill: '#333',
46362 textAlign: 'start',
46363 textBaseline: 'middle',
46364 fontFamily: Global.fontFamily
46365 }
46366 });
46367 };
46368
46369 Size.prototype._renderSliderShape = function _renderSliderShape() {
46370 var slider = this.get('slider');
46371 var backgroundElement = slider.get('backgroundElement');
46372 var width = this.get('width');
46373 var height = this.get('height');
46374 var inRange = this.get('inRange');
46375 var layout = this.get('layout');
46376 var points = layout === 'vertical' ? [[0, 0], [width, 0], [width, height]] : [[0, height], [width, 0], [width, height]];
46377
46378 return this._addBackground(backgroundElement, 'Polygon', Util.mix({
46379 points: points
46380 }, inRange));
46381 };
46382
46383 Size.prototype._addCircle = function _addCircle(x, y, r, text, maxWidth) {
46384 var group = this.addGroup();
46385 var circleStyle = this.get('_circleStyle');
46386 var textStyle = this.get('textStyle');
46387 var titleShape = this.get('titleShape');
46388 var titleGap = this.get('titleGap');
46389 if (titleShape) {
46390 titleGap += titleShape.getBBox().height;
46391 }
46392
46393 group.addShape('circle', {
46394 attrs: Util.mix({
46395 x: x,
46396 y: y + titleGap,
46397 r: r === 0 ? 1 : r
46398 }, circleStyle)
46399 });
46400 group.addShape('text', {
46401 attrs: Util.mix({
46402 x: maxWidth + 5,
46403 y: y + titleGap,
46404 text: text === 0 ? '0' : text
46405 }, textStyle)
46406 });
46407 };
46408
46409 Size.prototype._renderBackground = function _renderBackground() {
46410 var self = this;
46411 var minRadius = this.get('firstItem').attrValue * 1;
46412 var maxRadius = this.get('lastItem').attrValue * 1;
46413 var medianRadius = (minRadius + maxRadius) / 2;
46414 self._addCircle(maxRadius, maxRadius, maxRadius, medianRadius, 2 * maxRadius);
46415 self._addCircle(maxRadius, maxRadius * 2 + CIRCLE_GAP + medianRadius, medianRadius, (minRadius + medianRadius) / 2, 2 * maxRadius);
46416 self._addCircle(maxRadius, (maxRadius + CIRCLE_GAP + medianRadius) * 2 + minRadius, minRadius, minRadius, 2 * maxRadius);
46417 };
46418
46419 return Size;
46420}(Continuous);
46421
46422module.exports = Size;
46423
46424/***/ }),
46425/* 353 */
46426/***/ (function(module, exports, __webpack_require__) {
46427
46428function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
46429
46430function _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; }
46431
46432function _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; }
46433
46434/**
46435 * @fileOverview The class of canvas plot
46436 * @author sima.zhang
46437 */
46438var Util = __webpack_require__(0);
46439
46440var _require = __webpack_require__(2),
46441 Group = _require.Group;
46442
46443var PlotBack = function (_Group) {
46444 _inherits(PlotBack, _Group);
46445
46446 function PlotBack() {
46447 _classCallCheck(this, PlotBack);
46448
46449 return _possibleConstructorReturn(this, _Group.apply(this, arguments));
46450 }
46451
46452 PlotBack.prototype.getDefaultCfg = function getDefaultCfg() {
46453 return {
46454 /**
46455 * 类型
46456 * @type {String}
46457 */
46458 type: 'plotBack',
46459 /**
46460 * 画布边距
46461 * @type {Number | Array | Object | "auto"}
46462 */
46463 padding: null,
46464 /**
46465 * 大背景
46466 * @type {Object}
46467 */
46468 background: null,
46469 /**
46470 * 绘图区域范围
46471 * @type {Object}
46472 */
46473 plotRange: null,
46474 /**
46475 * 绘图区域背景
46476 * @type {Object}
46477 */
46478 plotBackground: null
46479 };
46480 };
46481
46482 PlotBack.prototype._beforeRenderUI = function _beforeRenderUI() {
46483 this._calculateRange();
46484 };
46485
46486 PlotBack.prototype._renderUI = function _renderUI() {
46487 this._renderBackground();
46488 this._renderPlotBackground();
46489 };
46490
46491 PlotBack.prototype._renderBackground = function _renderBackground() {
46492 var self = this;
46493 var background = self.get('background');
46494 if (background) {
46495 var canvas = this.get('canvas');
46496 var width = self.get('width') || canvas.get('width');
46497 var height = self.get('height') || canvas.get('height');
46498 var cfg = {
46499 x: 0,
46500 y: 0,
46501 width: width,
46502 height: height
46503 };
46504
46505 var rect = self.get('backgroundShape');
46506 if (!rect) {
46507 rect = this.addShape('rect', {
46508 attrs: Util.mix(cfg, background)
46509 });
46510 this.set('backgroundShape', rect);
46511 } else {
46512 rect.attr(cfg);
46513 }
46514 } else {
46515 return;
46516 }
46517 };
46518
46519 PlotBack.prototype._renderPlotBackground = function _renderPlotBackground() {
46520 var self = this;
46521 var plotBackground = self.get('plotBackground');
46522 if (plotBackground) {
46523 var plotRange = self.get('plotRange');
46524 var width = plotRange.br.x - plotRange.bl.x;
46525 var height = plotRange.br.y - plotRange.tr.y;
46526 var tl = plotRange.tl;
46527 var cfg = {
46528 x: tl.x,
46529 y: tl.y,
46530 width: width,
46531 height: height
46532 };
46533 var plotBackShape = self.get('plotBackShape');
46534 if (!plotBackShape) {
46535 if (plotBackground.image) {
46536 cfg.img = plotBackground.image;
46537 plotBackShape = self.addShape('image', {
46538 attrs: cfg
46539 });
46540 } else {
46541 // 矩形
46542 Util.mix(cfg, plotBackground);
46543 plotBackShape = self.addShape('rect', {
46544 attrs: cfg
46545 });
46546 }
46547 self.set('plotBackShape', plotBackShape);
46548 } else {
46549 plotBackShape.attr(cfg);
46550 }
46551 } else {
46552 return;
46553 }
46554 };
46555
46556 PlotBack.prototype._convert = function _convert(val, isHorizontal) {
46557 if (Util.isString(val) && val.indexOf('%') !== -1) {
46558 var canvas = this.get('canvas');
46559 var width = this.get('width') || canvas.get('width');
46560 var height = this.get('height') || canvas.get('height');
46561 val = parseInt(val, 10) / 100;
46562 val = isHorizontal ? val * width : val * height;
46563 }
46564
46565 return val;
46566 };
46567
46568 PlotBack.prototype._calculateRange = function _calculateRange() {
46569 var self = this;
46570 var plotRange = self.get('plotRange');
46571 if (Util.isNil(plotRange)) {
46572 plotRange = {};
46573 }
46574
46575 var padding = self.get('padding');
46576 var canvas = this.get('canvas');
46577 var width = self.get('width') || canvas.get('width');
46578 var height = self.get('height') || canvas.get('height');
46579
46580 var allPadding = Util.toAllPadding(padding);
46581
46582 var top = self._convert(allPadding[0], false);
46583 var right = self._convert(allPadding[1], true);
46584 var bottom = self._convert(allPadding[2], false);
46585 var left = self._convert(allPadding[3], true);
46586
46587 var minX = Math.min(left, width - right);
46588 var maxX = Math.max(left, width - right);
46589 var minY = Math.min(height - bottom, top);
46590 var maxY = Math.max(height - bottom, top);
46591
46592 plotRange.tl = {
46593 x: minX,
46594 y: minY
46595 }; // top-left
46596
46597 plotRange.tr = {
46598 x: maxX,
46599 y: minY
46600 }; // top-right
46601
46602 plotRange.bl = {
46603 x: minX,
46604 y: maxY
46605 }; // bottom-left
46606
46607 plotRange.br = {
46608 x: maxX,
46609 y: maxY
46610 }; // bottom-right
46611
46612 plotRange.cc = {
46613 x: (maxX + minX) / 2,
46614 y: (maxY + minY) / 2
46615 };
46616
46617 this.set('plotRange', plotRange);
46618 };
46619
46620 PlotBack.prototype.repaint = function repaint() {
46621 this._calculateRange();
46622 this._renderBackground();
46623 this._renderPlotBackground();
46624 return this;
46625 };
46626
46627 return PlotBack;
46628}(Group);
46629
46630module.exports = PlotBack;
46631
46632/***/ }),
46633/* 354 */
46634/***/ (function(module, exports, __webpack_require__) {
46635
46636function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
46637
46638function _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; }
46639
46640function _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; }
46641
46642/**
46643 * @fileOverview The class of tooltip
46644 * @author sima.zhang
46645 */
46646var Util = __webpack_require__(0);
46647var Base = __webpack_require__(63);
46648var Global = __webpack_require__(1);
46649
46650var _require = __webpack_require__(2),
46651 DomUtil = _require.DomUtil;
46652
46653var CONTAINER_CLASS = 'g2-tooltip';
46654var TITLE_CLASS = 'g2-tooltip-title';
46655var LIST_CLASS = 'g2-tooltip-list';
46656var MARKER_CLASS = 'g2-tooltip-marker';
46657var LIST_ITEM_CLASS = 'g2-tooltip-list-item';
46658
46659function find(dom, cls) {
46660 return dom.getElementsByClassName(cls)[0];
46661}
46662
46663function refixTooltipPosition(x, y, el, viewWidth, viewHeight) {
46664 var width = el.clientWidth;
46665 var height = el.clientHeight;
46666 var gap = 20;
46667
46668 if (x + width + gap > viewWidth) {
46669 x -= width + gap;
46670 x = x < 0 ? 0 : x;
46671 } else {
46672 x += gap;
46673 }
46674 if (y + height + gap > viewHeight) {
46675 y -= height + gap;
46676 y = x < 0 ? 0 : y;
46677 } else {
46678 y += gap;
46679 }
46680 return [x, y];
46681}
46682
46683function calcTooltipPosition(x, y, position, dom, target) {
46684 var domWidth = dom.clientWidth;
46685 var domHeight = dom.clientHeight;
46686 var rectWidth = 0;
46687 var rectHeight = 0;
46688 var gap = 20;
46689
46690 if (target) {
46691 var rect = target.getBBox();
46692 rectWidth = rect.width;
46693 rectHeight = rect.height;
46694 x = rect.x;
46695 y = rect.y;
46696 gap = 5;
46697 }
46698 switch (position) {
46699 case 'inside':
46700 x = x + rectWidth / 2 - domWidth / 2;
46701 y = y + rectHeight / 2 - domHeight / 2;
46702 break;
46703 case 'top':
46704 x = x + rectWidth / 2 - domWidth / 2;
46705 y = y - domHeight - gap;
46706 break;
46707 case 'left':
46708 x = x - domWidth - gap;
46709 y = y + rectHeight / 2 - domHeight / 2;
46710 break;
46711 case 'right':
46712 x = x + rectWidth + gap;
46713 y = y + rectHeight / 2 - domHeight / 2;
46714 break;
46715 case 'bottom':
46716 default:
46717 x = x + rectWidth / 2 - domWidth / 2;
46718 y = y + rectHeight + gap;
46719 break;
46720 }
46721 return [x, y];
46722}
46723
46724function confineTooltipPosition(x, y, el, plotRange) {
46725 var gap = 20;
46726 var width = el.clientWidth;
46727 var height = el.clientHeight;
46728 if (x + width > plotRange.tr.x) {
46729 x -= width + 2 * gap;
46730 }
46731
46732 if (x < plotRange.tl.x) {
46733 x = plotRange.tl.x;
46734 }
46735
46736 if (y + height > plotRange.bl.y) {
46737 y -= height + 2 * gap;
46738 }
46739
46740 if (y < plotRange.tl.y) {
46741 y = plotRange.tl.y;
46742 }
46743
46744 return [x, y];
46745}
46746
46747var Tooltip = function (_Base) {
46748 _inherits(Tooltip, _Base);
46749
46750 Tooltip.prototype.getDefaultCfg = function getDefaultCfg() {
46751 return {
46752 /**
46753 * 右下角坐标
46754 * @type {Number}
46755 */
46756 x: 0,
46757 /**
46758 * y 右下角坐标
46759 * @type {Number}
46760 */
46761 y: 0,
46762 /**
46763 * tooltip 记录项
46764 * @type {Array}
46765 */
46766 items: null,
46767 /**
46768 * 是否展示 title
46769 * @type {Boolean}
46770 */
46771 showTitle: true,
46772 /**
46773 * tooltip 辅助线配置
46774 * @type {Object}
46775 */
46776 crosshairs: null,
46777 /**
46778 * 视图范围
46779 * @type {Object}
46780 */
46781 plotRange: null,
46782 /**
46783 * x轴上,移动到位置的偏移量
46784 * @type {Number}
46785 */
46786 offset: 10,
46787 /**
46788 * 时间戳
46789 * @type {Number}
46790 */
46791 timeStamp: 0,
46792 /**
46793 * tooltip 容器模板
46794 * @type {String}
46795 */
46796 containerTpl: '<div class="' + CONTAINER_CLASS + '">' + '<div class="' + TITLE_CLASS + '"></div>' + '<ul class="' + LIST_CLASS + '"></ul>' + '</div>',
46797 /**
46798 * tooltip 列表项模板
46799 * @type {String}
46800 */
46801 itemTpl: '<li data-index={index}>' + '<span style="background-color:{color};" class=' + MARKER_CLASS + '></span>' + '{name}: {value}</li>',
46802 /**
46803 * 将 tooltip 展示在指定区域内
46804 * @type {Boolean}
46805 */
46806 inPlot: true,
46807 /**
46808 * tooltip 内容跟随鼠标移动
46809 * @type {Boolean}
46810 */
46811 follow: true,
46812 /**
46813 * 是否允许鼠标停留在 tooltip 上,默认不允许
46814 * @type {Boolean}
46815 */
46816 enterable: false
46817 };
46818 };
46819
46820 Tooltip.prototype._initTooltipWrapper = function _initTooltipWrapper() {
46821 var self = this;
46822 var containerTpl = self.get('containerTpl');
46823 var outterNode = self.get('canvas').get('el').parentNode;
46824 var container = void 0;
46825 if (/^\#/.test(containerTpl)) {
46826 // 如果传入 dom 节点的 id
46827 var id = containerTpl.replace('#', '');
46828 container = document.getElementById(id);
46829 } else {
46830 container = DomUtil.createDom(containerTpl);
46831 DomUtil.modifyCSS(container, self.get(CONTAINER_CLASS));
46832 outterNode.appendChild(container);
46833 outterNode.style.position = 'relative';
46834 }
46835 self.set('container', container);
46836 };
46837
46838 Tooltip.prototype._init = function _init() {
46839 var crosshairs = this.get('crosshairs');
46840 var frontPlot = this.get('frontPlot');
46841 var backPlot = this.get('backPlot');
46842 var crosshairsGroup = void 0;
46843
46844 if (crosshairs) {
46845 if (crosshairs.type === 'rect') {
46846 this.set('crosshairs', Util.deepMix({}, Global.tooltipCrosshairsRect, crosshairs));
46847 crosshairsGroup = backPlot.addGroup({
46848 zIndex: 0
46849 });
46850 } else {
46851 this.set('crosshairs', Util.deepMix({}, Global.tooltipCrosshairsLine, crosshairs));
46852 crosshairsGroup = frontPlot.addGroup();
46853 }
46854 }
46855
46856 this.set('crosshairsGroup', crosshairsGroup);
46857 this._initTooltipWrapper();
46858 };
46859
46860 function Tooltip(cfg) {
46861 _classCallCheck(this, Tooltip);
46862
46863 var _this = _possibleConstructorReturn(this, _Base.call(this, cfg));
46864
46865 _this._init(); // 初始化属性
46866
46867 if (_this.get('items')) {
46868 _this._renderTooltip();
46869 }
46870 _this._renderCrosshairs();
46871 return _this;
46872 }
46873
46874 Tooltip.prototype._clearDom = function _clearDom() {
46875 var container = this.get('container');
46876 var titleDom = find(container, TITLE_CLASS);
46877 var listDom = find(container, LIST_CLASS);
46878 if (titleDom) {
46879 titleDom.innerHTML = '';
46880 }
46881 if (listDom) {
46882 listDom.innerHTML = '';
46883 }
46884 };
46885
46886 Tooltip.prototype._addItem = function _addItem(item, index) {
46887 var itemTpl = this.get('itemTpl'); // TODO: 有可能是个回调函数
46888
46889 var itemDiv = Util.substitute(itemTpl, Util.mix({
46890 index: index
46891 }, item));
46892
46893 var itemDOM = DomUtil.createDom(itemDiv);
46894 DomUtil.modifyCSS(itemDOM, this.get(LIST_ITEM_CLASS));
46895 var markerDom = find(itemDOM, MARKER_CLASS);
46896 if (markerDom) {
46897 DomUtil.modifyCSS(markerDom, this.get(MARKER_CLASS));
46898 }
46899
46900 return itemDOM;
46901 };
46902
46903 Tooltip.prototype._renderTooltip = function _renderTooltip() {
46904 var self = this;
46905 var showTitle = self.get('showTitle');
46906 var titleContent = self.get('titleContent');
46907 var container = self.get('container');
46908 var titleDom = find(container, TITLE_CLASS);
46909 var listDom = find(container, LIST_CLASS);
46910 var items = self.get('items');
46911 self._clearDom();
46912
46913 if (titleDom && showTitle) {
46914 DomUtil.modifyCSS(titleDom, self.get(TITLE_CLASS));
46915 titleDom.innerHTML = titleContent;
46916 }
46917
46918 if (listDom) {
46919 DomUtil.modifyCSS(listDom, self.get(LIST_CLASS));
46920 Util.each(items, function (item, index) {
46921 listDom.appendChild(self._addItem(item, index));
46922 });
46923 }
46924 };
46925
46926 Tooltip.prototype._clearCrosshairsGroup = function _clearCrosshairsGroup() {
46927 var crosshairsGroup = this.get('crosshairsGroup');
46928 this.set('crossLineShapeX', null);
46929 this.set('crossLineShapeY', null);
46930 this.set('crosshairsRectShape', null);
46931 crosshairsGroup.clear();
46932 };
46933
46934 Tooltip.prototype._renderCrosshairs = function _renderCrosshairs() {
46935 var crosshairs = this.get('crosshairs');
46936 var canvas = this.get('canvas');
46937 var plotRange = this.get('plotRange');
46938 var isTransposed = this.get('isTransposed');
46939 if (crosshairs) {
46940 this._clearCrosshairsGroup();
46941 switch (crosshairs.type) {
46942 case 'x':
46943 this._renderHorizontalLine(canvas, plotRange);
46944 break;
46945 case 'y':
46946 this._renderVerticalLine(canvas, plotRange);
46947 break;
46948 case 'cross':
46949 this._renderHorizontalLine(canvas, plotRange);
46950 this._renderVerticalLine(canvas, plotRange);
46951 break;
46952 case 'rect':
46953 this._renderBackground(canvas, plotRange);
46954 break;
46955 default:
46956 isTransposed ? this._renderHorizontalLine(canvas, plotRange) : this._renderVerticalLine(canvas, plotRange);
46957 }
46958 }
46959 };
46960
46961 Tooltip.prototype._addCrossLineShape = function _addCrossLineShape(attrs, type) {
46962 var crosshairsGroup = this.get('crosshairsGroup');
46963 var shape = crosshairsGroup.addShape('line', {
46964 attrs: attrs
46965 });
46966 shape.hide();
46967 this.set('crossLineShape' + type, shape);
46968 return shape;
46969 };
46970
46971 Tooltip.prototype._renderVerticalLine = function _renderVerticalLine(canvas, plotRange) {
46972 var _get = this.get('crosshairs'),
46973 style = _get.style;
46974
46975 var attrs = Util.mix({
46976 x1: 0,
46977 y1: plotRange ? plotRange.bl.y : canvas.get('height'),
46978 x2: 0,
46979 y2: plotRange ? plotRange.tl.y : 0
46980 }, style);
46981
46982 this._addCrossLineShape(attrs, 'Y');
46983 };
46984
46985 Tooltip.prototype._renderHorizontalLine = function _renderHorizontalLine(canvas, plotRange) {
46986 var _get2 = this.get('crosshairs'),
46987 style = _get2.style;
46988
46989 var attrs = Util.mix({
46990 x1: plotRange ? plotRange.bl.x : canvas.get('width'),
46991 y1: 0,
46992 x2: plotRange ? plotRange.br.x : 0,
46993 y2: 0
46994 }, style);
46995
46996 this._addCrossLineShape(attrs, 'X');
46997 };
46998
46999 Tooltip.prototype._renderBackground = function _renderBackground(canvas, plotRange) {
47000 var _get3 = this.get('crosshairs'),
47001 style = _get3.style;
47002
47003 var crosshairsGroup = this.get('crosshairsGroup');
47004 var attrs = Util.mix({
47005 x: plotRange ? plotRange.tl.x : 0,
47006 y: plotRange ? plotRange.tl.y : canvas.get('height'),
47007 width: plotRange ? plotRange.br.x - plotRange.bl.x : canvas.get('width'),
47008 height: plotRange ? Math.abs(plotRange.tl.y - plotRange.bl.y) : canvas.get('height')
47009 }, style);
47010
47011 var shape = crosshairsGroup.addShape('rect', {
47012 attrs: attrs
47013 });
47014 shape.hide();
47015 this.set('crosshairsRectShape', shape);
47016 return shape;
47017 };
47018
47019 Tooltip.prototype._isContentChange = function _isContentChange(title, items) {
47020 var titleContent = this.get('titleContent');
47021 var lastItems = this.get('items');
47022 var isChanged = !(title === titleContent && lastItems.length === items.length);
47023 if (!isChanged) {
47024 Util.each(items, function (item, index) {
47025 var preItem = lastItems[index];
47026 isChanged = item.value !== preItem.value || item.color !== preItem.color || item.name !== preItem.name || item.title !== preItem.title;
47027 if (isChanged) {
47028 return false;
47029 }
47030 });
47031 }
47032
47033 return isChanged;
47034 };
47035
47036 Tooltip.prototype.setContent = function setContent(title, items) {
47037 var isChange = this._isContentChange(title, items);
47038 if (isChange) {
47039 var timeStamp = +new Date();
47040 this.set('items', items);
47041 this.set('titleContent', title);
47042 this.set('timeStamp', timeStamp);
47043 this._renderTooltip();
47044 }
47045 return this;
47046 };
47047
47048 Tooltip.prototype.setMarkers = function setMarkers(markerItems, markerCfg) {
47049 var self = this;
47050 var markerGroup = self.get('markerGroup');
47051 var frontPlot = self.get('frontPlot');
47052 if (!markerGroup) {
47053 markerGroup = frontPlot.addGroup({
47054 zIndex: 1
47055 });
47056 self.set('markerGroup', markerGroup);
47057 } else {
47058 markerGroup.clear();
47059 }
47060 Util.each(markerItems, function (item) {
47061 markerGroup.addShape('marker', {
47062 color: item.color,
47063 attrs: Util.mix({}, markerCfg, {
47064 x: item.x,
47065 y: item.y
47066 })
47067 });
47068 });
47069 this.set('markerItems', markerItems);
47070 };
47071
47072 Tooltip.prototype.clearMarkers = function clearMarkers() {
47073 var markerGroup = this.get('markerGroup');
47074 markerGroup && markerGroup.clear();
47075 };
47076
47077 Tooltip.prototype.setPosition = function setPosition(x, y, target) {
47078 var container = this.get('container');
47079 var crossLineShapeX = this.get('crossLineShapeX');
47080 var crossLineShapeY = this.get('crossLineShapeY');
47081 var crosshairsRectShape = this.get('crosshairsRectShape');
47082 var endx = x;
47083 var endy = y;
47084 // const outterNode = this.get('canvas').get('el').parentNode;
47085 var outterNode = this.get('canvas').get('el');
47086 var viewWidth = DomUtil.getWidth(outterNode);
47087 var viewHeight = DomUtil.getHeight(outterNode);
47088 var offset = this.get('offset');
47089
47090 var position = void 0;
47091 if (this.get('position')) {
47092 position = calcTooltipPosition(x, y, this.get('position'), container, target);
47093 x = position[0];
47094 y = position[1];
47095 } else if (!this.get('position')) {
47096 position = refixTooltipPosition(x, y, container, viewWidth, viewHeight);
47097 x = position[0];
47098 y = position[1];
47099 }
47100
47101 if (this.get('inPlot')) {
47102 // tooltip 必须限制在绘图区域内
47103 var plotRange = this.get('plotRange');
47104 position = confineTooltipPosition(x, y, container, plotRange);
47105 x = position[0];
47106 y = position[1];
47107 }
47108
47109 if (this.get('x') !== x || this.get('y') !== y) {
47110 var markerItems = this.get('markerItems');
47111 if (!Util.isEmpty(markerItems)) {
47112 endx = markerItems[0].x;
47113 endy = markerItems[0].y;
47114 }
47115 if (crossLineShapeY) {
47116 // 第一次进入时,画布需要单独绘制,所以需要先设定corss的位置
47117 crossLineShapeY.move(endx, 0);
47118 }
47119 if (crossLineShapeX) {
47120 crossLineShapeX.move(0, endy);
47121 }
47122
47123 if (crosshairsRectShape) {
47124 var isTransposed = this.get('isTransposed');
47125 var items = this.get('items');
47126 var firstItem = items[0];
47127 var lastItem = items[items.length - 1];
47128 var dim = isTransposed ? 'y' : 'x';
47129 var attr = isTransposed ? 'height' : 'width';
47130 var startDim = firstItem[dim];
47131 if (items.length > 1 && firstItem[dim] > lastItem[dim]) {
47132 startDim = lastItem[dim];
47133 }
47134
47135 if (this.get('crosshairs').width) {
47136 // 用户定义了 width
47137 crosshairsRectShape.attr(dim, startDim - this.get('crosshairs').width / 2);
47138 crosshairsRectShape.attr(attr, this.get('crosshairs').width);
47139 } else {
47140 offset = firstItem.size / 2 + firstItem.size / 4 || 10;
47141 crosshairsRectShape.attr(dim, startDim - offset);
47142
47143 if (items.length === 1) {
47144 crosshairsRectShape.attr(attr, firstItem.size + firstItem.size / 2);
47145 } else {
47146 var _lastItem = items[items.length - 1];
47147 crosshairsRectShape.attr(attr, Math.abs(_lastItem[dim] - firstItem[dim]) + 2 * offset);
47148 }
47149 }
47150 }
47151
47152 var follow = this.get('follow');
47153 container.style.left = follow ? x + 'px' : 0;
47154 container.style.top = follow ? y + 'px' : 0;
47155 }
47156 };
47157
47158 Tooltip.prototype.show = function show() {
47159 var crossLineShapeX = this.get('crossLineShapeX');
47160 var crossLineShapeY = this.get('crossLineShapeY');
47161 var crosshairsRectShape = this.get('crosshairsRectShape');
47162 var markerGroup = this.get('markerGroup');
47163 var container = this.get('container');
47164 var canvas = this.get('canvas');
47165 crossLineShapeX && crossLineShapeX.show();
47166 crossLineShapeY && crossLineShapeY.show();
47167 crosshairsRectShape && crosshairsRectShape.show();
47168 markerGroup && markerGroup.show();
47169 _Base.prototype.show.call(this);
47170 container.style.visibility = 'visible';
47171 // canvas.sort();
47172 canvas.draw();
47173 };
47174
47175 Tooltip.prototype.hide = function hide() {
47176 var self = this;
47177 var container = self.get('container');
47178 var crossLineShapeX = self.get('crossLineShapeX');
47179 var crossLineShapeY = self.get('crossLineShapeY');
47180 var crosshairsRectShape = this.get('crosshairsRectShape');
47181 var markerGroup = self.get('markerGroup');
47182 var canvas = self.get('canvas');
47183 container.style.visibility = 'hidden';
47184 crossLineShapeX && crossLineShapeX.hide();
47185 crossLineShapeY && crossLineShapeY.hide();
47186 crosshairsRectShape && crosshairsRectShape.hide();
47187 markerGroup && markerGroup.hide();
47188 _Base.prototype.hide.call(this);
47189 canvas.draw();
47190 };
47191
47192 Tooltip.prototype.destroy = function destroy() {
47193 var self = this;
47194 var crossLineShapeX = self.get('crossLineShapeX');
47195 var crossLineShapeY = self.get('crossLineShapeY');
47196 var markerGroup = self.get('markerGroup');
47197 var crosshairsRectShape = self.get('crosshairsRectShape');
47198 var container = self.get('container');
47199 var containerTpl = self.get('containerTpl');
47200
47201 if (container && !/^\#/.test(containerTpl)) {
47202 container.parentNode.removeChild(container);
47203 }
47204
47205 crossLineShapeX && crossLineShapeX.remove();
47206 crossLineShapeY && crossLineShapeY.remove();
47207 markerGroup && markerGroup.remove();
47208 crosshairsRectShape && crosshairsRectShape.remove();
47209 // super.remove();
47210 _Base.prototype.destroy.call(this);
47211 };
47212
47213 return Tooltip;
47214}(Base);
47215
47216module.exports = Tooltip;
47217
47218/***/ }),
47219/* 355 */
47220/***/ (function(module, exports, __webpack_require__) {
47221
47222function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
47223
47224/**
47225 * @fileOverview The controller of guide
47226 * @author sima.zhang
47227 */
47228var Util = __webpack_require__(0);
47229
47230var _require = __webpack_require__(25),
47231 Guide = _require.Guide;
47232
47233var Global = __webpack_require__(1);
47234
47235var GuideController = function () {
47236 function GuideController(cfg) {
47237 _classCallCheck(this, GuideController);
47238
47239 this.guides = [];
47240 this.options = [];
47241 this.xScales = null;
47242 this.yScales = null;
47243 this.container = null;
47244 Util.mix(this, cfg);
47245 }
47246
47247 GuideController.prototype._creatGuides = function _creatGuides() {
47248 var self = this;
47249 var options = this.options;
47250 var xScales = this.xScales;
47251 var yScales = this.yScales;
47252 options.forEach(function (option) {
47253 var type = option.type;
47254 var config = Util.deepMix({
47255 xScales: xScales,
47256 yScales: yScales
47257 }, Global.guide[type], option);
47258 type = Util.upperFirst(type);
47259 var guide = new Guide[type](config);
47260 self.guides.push(guide);
47261 });
47262
47263 return self.guides;
47264 };
47265
47266 GuideController.prototype.line = function line() {
47267 var cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
47268
47269 this.options.push(Util.mix({
47270 type: 'line'
47271 }, cfg));
47272 return this;
47273 };
47274
47275 GuideController.prototype.arc = function arc() {
47276 var cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
47277
47278 this.options.push(Util.mix({
47279 type: 'arc'
47280 }, cfg));
47281 return this;
47282 };
47283
47284 GuideController.prototype.text = function text() {
47285 var cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
47286
47287 this.options.push(Util.mix({
47288 type: 'text'
47289 }, cfg));
47290 return this;
47291 };
47292
47293 GuideController.prototype.image = function image() {
47294 var cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
47295
47296 this.options.push(Util.mix({
47297 type: 'image'
47298 }, cfg));
47299 return this;
47300 };
47301
47302 GuideController.prototype.region = function region() {
47303 var cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
47304
47305 this.options.push(Util.mix({
47306 type: 'region'
47307 }, cfg));
47308 return this;
47309 };
47310
47311 GuideController.prototype.html = function html() {
47312 var cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
47313
47314 this.options.push(Util.mix({
47315 type: 'html'
47316 }, cfg));
47317 return this;
47318 };
47319
47320 GuideController.prototype.render = function render(coord) {
47321 var self = this;
47322 var guides = self._creatGuides();
47323 var container = self.backContainer;
47324
47325 Util.each(guides, function (guide) {
47326 if (guide.top) {
47327 // 默认 guide 绘制到 backPlot,用户也可以声明 top: true,显示在最上层
47328 container = self.frontContainer;
47329 }
47330 guide.render(coord, container);
47331 });
47332 };
47333
47334 GuideController.prototype.clear = function clear() {
47335 this.options = [];
47336 this.reset();
47337 };
47338
47339 GuideController.prototype.changeVisible = function changeVisible(visible) {
47340 var guides = this.guides;
47341 Util.each(guides, function (guide) {
47342 guide.setVisible(visible);
47343 });
47344 };
47345
47346 GuideController.prototype.reset = function reset() {
47347 var guides = this.guides;
47348 Util.each(guides, function (guide) {
47349 guide.remove();
47350 });
47351 this.guides = [];
47352 };
47353
47354 return GuideController;
47355}();
47356
47357module.exports = GuideController;
47358
47359/***/ }),
47360/* 356 */
47361/***/ (function(module, exports, __webpack_require__) {
47362
47363function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
47364
47365var Util = __webpack_require__(0);
47366var Global = __webpack_require__(1);
47367
47368var _require = __webpack_require__(25),
47369 Legend = _require.Legend;
47370
47371var Shape = __webpack_require__(66);
47372
47373var FIELD_ORIGIN = '_origin';
47374var MARGIN = 24;
47375var MARGIN_LEGEND = 24;
47376var requireAnimationFrameFn = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame;
47377
47378function _snapEqual(v1, v2, scale) {
47379 var isEqual = void 0;
47380 if (Util.isNil(scale)) {
47381 return false;
47382 }
47383 v1 = scale.translate(v1);
47384 v2 = scale.translate(v2);
47385 if (scale.isCategory) {
47386 isEqual = v1 === v2;
47387 } else {
47388 isEqual = Math.abs(v1 - v2) <= 1;
47389 }
47390 return isEqual;
47391}
47392
47393function findGeom(geoms, value) {
47394 var rst = void 0;
47395 Util.each(geoms, function (geom) {
47396 if (geom.get('visible')) {
47397 var yScale = geom.getYScale();
47398 if (yScale.field === value) {
47399 rst = geom;
47400 return;
47401 }
47402 }
47403 });
47404
47405 return rst;
47406}
47407
47408var LegendController = function () {
47409 function LegendController(cfg) {
47410 _classCallCheck(this, LegendController);
47411
47412 this.options = {};
47413 Util.mix(this, cfg);
47414 this.clear();
47415 var chart = this.chart;
47416 this.container = chart.get('frontPlot');
47417 this.plotRange = chart.get('plotRange');
47418 }
47419
47420 LegendController.prototype.clear = function clear() {
47421 var legends = this.legends;
47422 Util.each(legends, function (legendItems) {
47423 Util.each(legendItems, function (legend) {
47424 legend.remove();
47425 });
47426 });
47427 this.legends = {};
47428 };
47429
47430 LegendController.prototype._isFieldInView = function _isFieldInView(field, value, view) {
47431 var flag = false;
47432 var scales = view.get('scales');
47433 var fieldScale = scales[field];
47434 if (fieldScale && fieldScale.values) {
47435 flag = Util.inArray(fieldScale.values, value);
47436 }
47437
47438 return flag;
47439 };
47440
47441 LegendController.prototype._bindClickEvent = function _bindClickEvent(legend, scale, filterVals) {
47442 var self = this;
47443 var chart = self.chart;
47444 var views = chart.get('views');
47445 var field = scale.field;
47446 var options = self.options;
47447
47448 legend.on('itemclick', function (ev) {
47449 if (options.onClick) {
47450 // 用户自定义了图例点击事件
47451 options.onClick(ev);
47452 } else {
47453 var item = ev.item;
47454 var checked = ev.checked;
47455 var isSingeSelected = legend.get('selectedMode') === 'single'; // 图例的选中模式
47456 var clickedValue = item.dataValue; // import: 需要取该图例项原始的数值
47457
47458 if (checked) {
47459 filterVals.push(clickedValue);
47460 if (self._isFieldInView(field, clickedValue, chart)) {
47461 chart.filter(field, function (field) {
47462 return isSingeSelected ? field === clickedValue : Util.inArray(filterVals, field);
47463 });
47464 }
47465 Util.each(views, function (view) {
47466 if (self._isFieldInView(field, clickedValue, view)) {
47467 view.filter(field, function (field) {
47468 return isSingeSelected ? field === clickedValue : Util.inArray(filterVals, field);
47469 });
47470 }
47471 });
47472 } else if (!isSingeSelected) {
47473 Util.Array.remove(filterVals, clickedValue);
47474
47475 if (self._isFieldInView(field, clickedValue, chart)) {
47476 chart.filter(field, function (field) {
47477 return Util.inArray(filterVals, field);
47478 });
47479 }
47480 Util.each(views, function (view) {
47481 if (self._isFieldInView(field, clickedValue, view)) {
47482 view.filter(field, function (field) {
47483 return Util.inArray(filterVals, field);
47484 });
47485 }
47486 });
47487 }
47488 chart.set('keepLegend', true); // 图例不重新渲染
47489 chart.repaint();
47490 }
47491 });
47492 };
47493
47494 LegendController.prototype._filterLabels = function _filterLabels(shape, geom, visible) {
47495 if (shape.get('gLabel')) {
47496 shape.get('gLabel').set('visible', visible);
47497 } else {
47498 var labelCfg = geom.get('labelCfg');
47499 if (labelCfg && labelCfg.fields && labelCfg.fields.length > 0) {
47500 var xScale = geom.getXScale();
47501 var yScale = geom.getYScale();
47502 var xField = xScale.field;
47503 var yField = yScale.field;
47504 var shapeData = shape.get('origin')._origin;
47505 var labelContainer = geom.get('labelContainer');
47506 var labels = labelContainer.get('labelsGroup').get('children');
47507 Util.each(labels, function (label) {
47508 var labelData = label.get('origin') || [];
47509 if (labelData[xField] === shapeData[xField] && labelData[yField] === shapeData[yField]) {
47510 label.set('visible', visible);
47511 shape.set('gLabel', label);
47512 }
47513 });
47514 }
47515 }
47516 };
47517
47518 LegendController.prototype._bindFilterEvent = function _bindFilterEvent(legend, scale) {
47519 var self = this;
47520 var chart = this.chart;
47521 var field = scale.field;
47522 legend.on('itemfilter', function (ev) {
47523 var range = ev.range;
47524 chart.filterShape(function (obj, shape, geom) {
47525 if (obj[field]) {
47526 var filtered = obj[field] >= range[0] && obj[field] <= range[1];
47527 // shape 带 label,则还需要隐藏 label
47528 self._filterLabels(shape, geom, filtered);
47529 return filtered;
47530 }
47531 return true;
47532 });
47533 var geoms = chart.getAllGeoms() || [];
47534
47535 var _loop = function _loop(i) {
47536 var geom = geoms[i];
47537 if (geom.get('type') === 'heatmap') {
47538 requireAnimationFrameFn(function () {
47539 geom.drawWithRange(range);
47540 });
47541 }
47542 };
47543
47544 for (var i = 0; i < geoms.length; i++) {
47545 _loop(i);
47546 }
47547 });
47548 };
47549
47550 LegendController.prototype._getShapeData = function _getShapeData(shape) {
47551 var originData = shape.get('origin');
47552
47553 if (Util.isArray(originData)) {
47554 originData = originData[0];
47555 }
47556 return originData[FIELD_ORIGIN];
47557 };
47558
47559 LegendController.prototype._bindHoverEvent = function _bindHoverEvent(legend, field) {
47560 var self = this;
47561 var chart = self.chart;
47562 var geoms = chart.getAllGeoms();
47563 var options = self.options;
47564 var canvas = chart.get('canvas');
47565 legend.on('itemhover', function (ev) {
47566 var value = ev.item.value;
47567 var pre = self.pre;
47568 if (!pre) {
47569 Util.each(geoms, function (geom) {
47570 var shapeContainer = geom.get('shapeContainer');
47571 var shapes = geom.getShapes();
47572 var activeShapes = [];
47573 if (field) {
47574 var scale = geom.get('scales')[field];
47575 Util.each(shapes, function (shape) {
47576 var origin = self._getShapeData(shape);
47577 if (origin && _snapEqual(origin[field], value, scale)) {
47578 activeShapes.push(shape);
47579 }
47580 });
47581 } else if (geom.getYScale().field === value) {
47582 activeShapes = shapes;
47583 }
47584
47585 if (!Util.isEmpty(activeShapes)) {
47586 ev.shapes = activeShapes;
47587 ev.geom = geom;
47588 if (options.onHover) {
47589 options.onHover(ev);
47590 shapeContainer.sort();
47591 canvas.draw();
47592 } else {
47593 geom.setShapesActived(activeShapes);
47594 }
47595 }
47596 });
47597 self.pre = value;
47598 } else if (pre === value) {
47599 return;
47600 }
47601 });
47602
47603 legend.on('itemunhover', function () {
47604 self.pre = null;
47605 Util.each(geoms, function (geom) {
47606 if (geom.get('activeShapes')) {
47607 geom.clearActivedShapes();
47608 canvas.draw();
47609 }
47610 });
47611 });
47612 };
47613
47614 LegendController.prototype._isFiltered = function _isFiltered(scale, values, value) {
47615 if (!scale.isCategory) {
47616 return true;
47617 }
47618 var rst = false;
47619 value = scale.invert(value);
47620 Util.each(values, function (val) {
47621 rst = rst || scale.getText(val) === scale.getText(value);
47622 if (rst) {
47623 return false;
47624 }
47625 });
47626 return rst;
47627 };
47628
47629 LegendController.prototype._alignLegend = function _alignLegend(legend, pre, region, position) {
47630 var self = this;
47631 var container = self.container;
47632 var canvas = container.get('canvas');
47633 var width = canvas.get('width');
47634 var height = canvas.get('height');
47635 var plotRange = self.plotRange;
47636 var offsetX = legend.get('offsetX') || 0;
47637 var offsetY = legend.get('offsetY') || 0;
47638 var offset = Util.isNil(legend.get('offset')) ? MARGIN : legend.get('offset');
47639 var legendHeight = legend.getHeight();
47640
47641 var x = 0;
47642 var y = 0;
47643
47644 if (position === 'left' || position === 'right') {
47645 // 垂直
47646 height = plotRange.br.y;
47647 x = position === 'left' ? offset : plotRange.br.x + offset;
47648 y = height - legendHeight;
47649
47650 if (pre) {
47651 y = pre.get('y') - legendHeight - MARGIN_LEGEND;
47652 }
47653 } else {
47654 x = (width - region.totalWidth) / 2;
47655 y = position === 'top' ? offset : plotRange.bl.y + offset;
47656
47657 if (pre) {
47658 var preWidth = pre.getWidth();
47659 x = pre.get('x') + preWidth + MARGIN_LEGEND;
47660 }
47661 }
47662
47663 legend.move(x + offsetX, y + offsetY);
47664 };
47665
47666 LegendController.prototype._getRegion = function _getRegion(legends) {
47667 var maxWidth = 0;
47668 var totalWidth = 0;
47669 Util.each(legends, function (legend) {
47670 var width = legend.getWidth();
47671 if (maxWidth < width) {
47672 maxWidth = width;
47673 }
47674 totalWidth += width;
47675 });
47676 return {
47677 maxWidth: maxWidth,
47678 totalWidth: totalWidth
47679 };
47680 };
47681
47682 LegendController.prototype._addCategroyLegend = function _addCategroyLegend(scale, attr, geom, filterVals, position) {
47683 var self = this;
47684 var field = scale.field;
47685 var legendOptions = self.options;
47686 var legends = self.legends;
47687 legends[position] = legends[position] || [];
47688 var container = self.container;
47689 var items = [];
47690 var ticks = scale.getTicks();
47691
47692 var isByAttr = true;
47693 var shapeType = geom.get('shapeType') || 'point';
47694 var shape = geom.getDefaultValue('shape') || 'circle';
47695 if (legendOptions[field] && legendOptions[field].marker) {
47696 // 用户为 field 对应的图例定义了 marker
47697 shape = legendOptions[field].marker;
47698 shapeType = 'point';
47699 isByAttr = false;
47700 } else if (legendOptions.marker) {
47701 shape = legendOptions.marker;
47702 shapeType = 'point';
47703 isByAttr = false;
47704 }
47705
47706 var chart = self.chart;
47707 var canvas = chart.get('canvas');
47708 var plotRange = self.plotRange;
47709 var maxLength = position === 'right' || position === 'left' ? plotRange.bl.y - plotRange.tr.y : canvas.get('width');
47710
47711 Util.each(ticks, function (tick) {
47712 var text = tick.text;
47713 var name = text;
47714 var scaleValue = tick.value;
47715 var value = scale.invert(scaleValue);
47716 var cfg = {
47717 isInCircle: geom.isInCircle()
47718 };
47719 var checked = filterVals ? self._isFiltered(scale, filterVals, scaleValue) : true;
47720
47721 var colorAttr = geom.getAttr('color');
47722 var shapeAttr = geom.getAttr('shape');
47723 if (colorAttr) {
47724 // 存在颜色映射
47725 if (colorAttr.callback && colorAttr.callback.length > 1) {
47726 // 多参数映射,阻止程序报错
47727 var restArgs = Array(colorAttr.callback.length - 1).fill('');
47728 cfg.color = colorAttr.mapping.apply(colorAttr, [value].concat(restArgs)).join('') || Global.defaultColor;
47729 } else {
47730 cfg.color = colorAttr.mapping(value).join('') || Global.defaultColor;
47731 }
47732 }
47733 if (isByAttr && shapeAttr) {
47734 // 存在形状映射
47735 if (shapeAttr.callback && shapeAttr.callback.length > 1) {
47736 // 多参数映射,阻止程序报错
47737 var _restArgs = Array(shapeAttr.callback.length - 1).fill('');
47738 shape = shapeAttr.mapping.apply(shapeAttr, [value].concat(_restArgs)).join('');
47739 } else {
47740 shape = shapeAttr.mapping(value).join('');
47741 }
47742 }
47743
47744 var shapeObject = Shape.getShapeFactory(shapeType);
47745 var marker = shapeObject.getMarkerCfg(shape, cfg);
47746
47747 if (Util.isFunction(shape)) {
47748 marker.symbol = shape;
47749 }
47750
47751 items.push({
47752 value: name, // 图例项显示文本的内容
47753 dataValue: value, // 图例项对应原始数据中的数值
47754 checked: checked,
47755 marker: marker
47756 });
47757 });
47758
47759 var legendCfg = Util.deepMix({
47760 title: {
47761 text: scale.alias || scale.field
47762 }
47763 }, Global.legend[position], legendOptions[field] || legendOptions, {
47764 maxLength: maxLength,
47765 items: items
47766 });
47767
47768 var legend = container.addGroup(Legend.Category, legendCfg);
47769 self._bindClickEvent(legend, scale, filterVals);
47770 legends[position].push(legend);
47771 return legend;
47772 };
47773
47774 LegendController.prototype._addContinuousLegend = function _addContinuousLegend(scale, attr, position) {
47775 var self = this;
47776 var legends = self.legends;
47777 legends[position] = legends[position] || [];
47778 var container = self.container;
47779 var field = scale.field;
47780 var ticks = scale.getTicks();
47781 var items = [];
47782 var legend = void 0;
47783 var minValue = void 0;
47784 var maxValue = void 0;
47785
47786 Util.each(ticks, function (tick) {
47787 var scaleValue = tick.value;
47788 var invertValue = scale.invert(scaleValue);
47789 var attrValue = attr.mapping(invertValue).join('');
47790
47791 items.push({
47792 value: tick.text,
47793 attrValue: attrValue,
47794 scaleValue: scaleValue
47795 });
47796 if (scaleValue === 0) {
47797 minValue = true;
47798 }
47799 if (scaleValue === 1) {
47800 maxValue = true;
47801 }
47802 });
47803
47804 if (!minValue) {
47805 items.push({
47806 value: scale.getText(scale.invert(0)),
47807 attrValue: attr.mapping(0).join(''),
47808 scaleValue: 0
47809 });
47810 }
47811 if (!maxValue) {
47812 items.push({
47813 value: scale.getText(scale.invert(1)),
47814 attrValue: attr.mapping(1).join(''),
47815 scaleValue: 1
47816 });
47817 }
47818
47819 var options = self.options;
47820
47821 var defaultCfg = Global.legend[position];
47822 if (options && options.slidable === false || options[field] && options[field].slidable === false) {
47823 defaultCfg = Util.mix({}, defaultCfg, Global.legend.gradient);
47824 }
47825
47826 var legendCfg = Util.deepMix({
47827 title: {
47828 text: scale.alias || scale.field
47829 }
47830 }, defaultCfg, options[field] || options, {
47831 items: items,
47832 attr: attr
47833 });
47834
47835 if (attr.type === 'color') {
47836 legend = container.addGroup(Legend.Color, legendCfg);
47837 } else if (attr.type === 'size') {
47838 legend = container.addGroup(Legend.Size, legendCfg);
47839 }
47840 self._bindFilterEvent(legend, scale);
47841 legends[position].push(legend);
47842 return legend;
47843 };
47844
47845 LegendController.prototype.addLegend = function addLegend(scale, attr, geom, filterVals) {
47846 var self = this;
47847 var legendOptions = self.options;
47848 var field = scale.field;
47849 var fieldOption = legendOptions[field];
47850
47851 if (fieldOption === false) {
47852 // 如果不显示此图例
47853 return null;
47854 }
47855
47856 if (fieldOption && fieldOption.custom) {
47857 self.addCustomLegend(field);
47858 } else {
47859 var position = legendOptions.position || Global.defaultLegendPosition;
47860 if (fieldOption && fieldOption.position) {
47861 // 如果对某个图例单独设置 position,则对 position 重新赋值
47862 position = fieldOption.position;
47863 }
47864
47865 var legend = void 0;
47866 if (scale.isLinear) {
47867 legend = self._addContinuousLegend(scale, attr, position);
47868 } else {
47869 legend = self._addCategroyLegend(scale, attr, geom, filterVals, position);
47870 }
47871 self._bindHoverEvent(legend, field);
47872 }
47873 };
47874
47875 /**
47876 * 自定义图例
47877 * @param {string} field 自定义图例的数据字段名,可以为空
47878 */
47879
47880
47881 LegendController.prototype.addCustomLegend = function addCustomLegend(field) {
47882 var self = this;
47883 var chart = self.chart;
47884 var container = self.container;
47885 var legendOptions = self.options;
47886
47887 if (field) {
47888 legendOptions = legendOptions[field];
47889 }
47890
47891 var position = legendOptions.position || Global.defaultLegendPosition;
47892 var legends = self.legends;
47893 legends[position] = legends[position] || [];
47894 var items = legendOptions.items;
47895 if (!items) {
47896 return;
47897 }
47898
47899 var geoms = chart.getAllGeoms();
47900 Util.each(items, function (item) {
47901 var geom = findGeom(geoms, item.value);
47902 if (!Util.isObject(item.marker)) {
47903 item.marker = {
47904 symbol: item.marker ? item.marker : 'circle',
47905 fill: item.fill,
47906 radius: 4.5
47907 };
47908 }
47909 item.checked = Util.isNil(item.checked) ? true : item.checked;
47910 item.geom = geom;
47911 });
47912
47913 var canvas = chart.get('canvas');
47914 var plotRange = self.plotRange;
47915 var maxLength = position === 'right' || position === 'left' ? plotRange.bl.y - plotRange.tr.y : canvas.get('width');
47916
47917 var legendCfg = Util.deepMix({}, Global.legend[position], legendOptions, {
47918 maxLength: maxLength,
47919 items: items
47920 });
47921
47922 var legend = container.addGroup(Legend.Category, legendCfg);
47923 legends[position].push(legend);
47924
47925 legend.on('itemclick', function (ev) {
47926 if (legendOptions.onClick) {
47927 // 用户自定义了图例点击事件
47928 legendOptions.onClick(ev);
47929 }
47930 });
47931
47932 self._bindHoverEvent(legend);
47933 };
47934
47935 LegendController.prototype.alignLegends = function alignLegends() {
47936 var self = this;
47937 var legends = self.legends;
47938 Util.each(legends, function (legendItems, position) {
47939 var region = self._getRegion(legendItems);
47940 Util.each(legendItems, function (legend, index) {
47941 var pre = legendItems[index - 1];
47942 if (!(legend.get('useHtml') && !legend.get('autoPosition'))) {
47943 self._alignLegend(legend, pre, region, position);
47944 }
47945 });
47946 });
47947
47948 return this;
47949 };
47950
47951 return LegendController;
47952}();
47953
47954module.exports = LegendController;
47955
47956/***/ }),
47957/* 357 */
47958/***/ (function(module, exports, __webpack_require__) {
47959
47960function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
47961
47962/**
47963 * @fileOverview The controller of tooltip
47964 * @author sima.zhang
47965 */
47966var Util = __webpack_require__(0);
47967var Global = __webpack_require__(1);
47968
47969var _require = __webpack_require__(25),
47970 Tooltip = _require.Tooltip;
47971
47972var MatrixUtil = __webpack_require__(2).MatrixUtil;
47973var Vector2 = MatrixUtil.vec2;
47974
47975var TYPE_SHOW_MARKERS = ['line', 'area', 'path', 'areaStack']; // 默认展示 tooltip marker 的几何图形
47976var TYPE_SHOW_CROSSHAIRS = ['line', 'area']; // 默认展示十字瞄准线的几何图形
47977
47978function _indexOfArray(items, item) {
47979 var rst = -1;
47980 Util.each(items, function (sub, index) {
47981 if (sub.title === item.title && sub.name === item.name && sub.value === item.value && sub.color === item.color) {
47982 rst = index;
47983 return false;
47984 }
47985 });
47986 return rst;
47987}
47988
47989// 判断是否有样式
47990function _hasClass(dom, className) {
47991 if (!dom) {
47992 return false;
47993 }
47994 var cls = '';
47995 if (!dom.className) return false;
47996 if (!Util.isNil(dom.className.baseVal)) {
47997 cls = dom.className.baseVal;
47998 } else {
47999 cls = dom.className;
48000 }
48001 return cls.indexOf(className) !== -1;
48002}
48003
48004function _isParent(dom, cls) {
48005 var parent = dom.parentNode;
48006 var rst = false;
48007 while (parent && parent !== document.body) {
48008 if (_hasClass(parent, cls)) {
48009 rst = true;
48010 break;
48011 }
48012 parent = parent.parentNode;
48013 }
48014 return rst;
48015}
48016
48017// 去除重复的值, 去除不同图形相同数据,只展示一份即可
48018function _uniqItems(items) {
48019 var tmp = [];
48020 Util.each(items, function (item) {
48021 var index = _indexOfArray(tmp, item);
48022 if (index === -1) {
48023 tmp.push(item);
48024 } else {
48025 tmp[index] = item;
48026 }
48027 });
48028 return tmp;
48029}
48030
48031var TooltipController = function () {
48032 function TooltipController(cfg) {
48033 _classCallCheck(this, TooltipController);
48034
48035 Util.assign(this, cfg);
48036 this.timeStamp = 0;
48037 }
48038
48039 TooltipController.prototype._normalizeEvent = function _normalizeEvent(event) {
48040 var chart = this.chart;
48041 var canvas = this._getCanvas();
48042 var point = canvas.getPointByClient(event.clientX, event.clientY);
48043 var pixelRatio = canvas.get('pixelRatio');
48044 point.x = point.x / pixelRatio;
48045 point.y = point.y / pixelRatio;
48046 var views = chart.getViewsByPoint(point);
48047 point.views = views;
48048 return point;
48049 };
48050
48051 TooltipController.prototype._getCanvas = function _getCanvas() {
48052 return this.chart.get('canvas');
48053 };
48054
48055 TooltipController.prototype._getTriggerEvent = function _getTriggerEvent() {
48056 var options = this.options;
48057 var triggerOn = options.triggerOn;
48058 var eventName = void 0;
48059
48060 if (!triggerOn || triggerOn === 'mousemove') {
48061 eventName = 'plotmove';
48062 } else if (triggerOn === 'click') {
48063 eventName = 'plotclick';
48064 } else if (triggerOn === 'none') {
48065 eventName = null;
48066 }
48067
48068 return eventName;
48069 };
48070
48071 TooltipController.prototype._getDefaultTooltipCfg = function _getDefaultTooltipCfg() {
48072 var self = this;
48073 var options = self.options;
48074 var defaultCfg = Util.mix({}, Global.tooltip);
48075 var chart = self.chart;
48076 var geoms = chart.getAllGeoms().filter(function (geom) {
48077 return geom.get('visible');
48078 });
48079 var shapes = [];
48080 Util.each(geoms, function (geom) {
48081 var type = geom.get('type');
48082 var adjusts = geom.get('adjusts');
48083 var isSymmetric = false;
48084 if (adjusts) {
48085 Util.each(adjusts, function (adjust) {
48086 if (adjust.type === 'symmetric' || adjust.type === 'Symmetric') {
48087 isSymmetric = true;
48088 return false;
48089 }
48090 });
48091 }
48092 if (Util.indexOf(shapes, type) === -1 && !isSymmetric) {
48093 shapes.push(type);
48094 }
48095 });
48096
48097 var crosshairsCfg = void 0;
48098 if (geoms.length && geoms[0].get('coord') && geoms[0].get('coord').type === 'cartesian' && shapes.length === 1) {
48099 if (shapes[0] === 'interval' && options.shared !== false) {
48100 // 直角坐标系下 interval 的 crosshair 为矩形背景框
48101 crosshairsCfg = {
48102 zIndex: 0, // 矩形背景框不可覆盖 geom
48103 crosshairs: Global.tooltipCrosshairsRect
48104 };
48105 } else if (Util.indexOf(TYPE_SHOW_CROSSHAIRS, shapes[0]) > -1) {
48106 crosshairsCfg = {
48107 crosshairs: Global.tooltipCrosshairsLine
48108 };
48109 }
48110 }
48111
48112 return Util.mix(defaultCfg, crosshairsCfg, {
48113 isTransposed: geoms[0].get('coord').isTransposed
48114 });
48115 };
48116
48117 TooltipController.prototype._bindEvent = function _bindEvent() {
48118 var chart = this.chart;
48119 var triggerEvent = this._getTriggerEvent();
48120 if (triggerEvent) {
48121 chart.on(triggerEvent, Util.wrapBehavior(this, 'onMouseMove'));
48122 chart.on('plotleave', Util.wrapBehavior(this, 'onMouseOut'));
48123 }
48124 };
48125
48126 TooltipController.prototype._offEvent = function _offEvent() {
48127 var chart = this.chart;
48128 var triggerEvent = this._getTriggerEvent();
48129 if (triggerEvent) {
48130 chart.off(triggerEvent, Util.getWrapBehavior(this, 'onMouseMove'));
48131 chart.off('plotleave', Util.getWrapBehavior(this, 'onMouseOut'));
48132 }
48133 };
48134
48135 TooltipController.prototype._setTooltip = function _setTooltip(title, point, items, markersItems, target) {
48136 var self = this;
48137 var tooltip = self.tooltip;
48138 var prePoint = self.prePoint;
48139 if (!prePoint || prePoint.x !== point.x || prePoint.y !== point.y) {
48140 items = _uniqItems(items);
48141 self.prePoint = point;
48142
48143 var chart = self.chart;
48144 var x = Util.isArray(point.x) ? point.x[point.x.length - 1] : point.x;
48145 var y = Util.isArray(point.y) ? point.y[point.y.length - 1] : point.y;
48146 if (!tooltip.get('visible')) {
48147 chart.emit('tooltip:show', {
48148 x: x,
48149 y: y,
48150 tooltip: tooltip
48151 });
48152 }
48153 chart.emit('tooltip:change', {
48154 tooltip: tooltip,
48155 x: x,
48156 y: y,
48157 items: items
48158 });
48159 tooltip.setContent(title, items);
48160 if (!Util.isEmpty(markersItems)) {
48161 if (self.options.hideMarkers === true) {
48162 // 不展示 tooltip marker
48163 tooltip.set('markerItems', markersItems); // 用于 tooltip 辅助线的定位
48164 } else {
48165 tooltip.setMarkers(markersItems, Global.tooltipMarker);
48166 }
48167 } else {
48168 tooltip.clearMarkers();
48169 }
48170
48171 tooltip.setPosition(x, y, target);
48172 tooltip.show();
48173 }
48174 };
48175
48176 TooltipController.prototype.hideTooltip = function hideTooltip() {
48177 var tooltip = this.tooltip;
48178 var chart = this.chart;
48179 var canvas = this._getCanvas();
48180 this.prePoint = null;
48181 tooltip.hide();
48182 chart.emit('tooltip:hide', {
48183 tooltip: tooltip
48184 });
48185 canvas.draw();
48186 };
48187
48188 TooltipController.prototype.onMouseMove = function onMouseMove(ev) {
48189 if (Util.isEmpty(ev.views)) {
48190 return;
48191 }
48192
48193 var lastTimeStamp = this.timeStamp;
48194 var timeStamp = +new Date();
48195 var point = {
48196 x: ev.x,
48197 y: ev.y
48198 };
48199 if (timeStamp - lastTimeStamp > 16) {
48200 var target = void 0;
48201 if (ev.shape && Util.inArray(['point', 'interval', 'polygon', 'schema'], ev.shape.name)) {
48202 target = ev.shape;
48203 }
48204 this.showTooltip(point, ev.views, target);
48205 this.timeStamp = timeStamp;
48206 }
48207 };
48208
48209 TooltipController.prototype.onMouseOut = function onMouseOut(ev) {
48210 var tooltip = this.tooltip;
48211 var canvas = this._getCanvas();
48212 if (!tooltip.get('visible')) {
48213 return;
48214 }
48215 if (ev && ev.target !== canvas) {
48216 return;
48217 }
48218 if (ev && ev.toElement && (_hasClass(ev.toElement, 'g2-tooltip') || _isParent(ev.toElement, 'g2-tooltip'))) {
48219 return;
48220 }
48221 this.hideTooltip();
48222 };
48223
48224 TooltipController.prototype.renderTooltip = function renderTooltip() {
48225 var self = this;
48226 if (self.tooltip) {
48227 // tooltip 对象已经创建
48228 return;
48229 }
48230 var chart = self.chart;
48231 var canvas = self._getCanvas();
48232 var defaultCfg = self._getDefaultTooltipCfg();
48233 var options = self.options;
48234 options = Util.deepMix({
48235 plotRange: chart.get('plotRange'),
48236 capture: false,
48237 canvas: canvas,
48238 frontPlot: chart.get('frontPlot'),
48239 backPlot: chart.get('backPlot')
48240 }, defaultCfg, options);
48241 if (options.crosshairs && options.crosshairs.type === 'rect') {
48242 options.zIndex = 0; // toolip 背景框不可遮盖住 geom,防止用户配置了 crosshairs
48243 }
48244
48245 options.visible = false;
48246 if (options.shared === false && Util.isNil(options.position)) {
48247 options.position = 'top';
48248 }
48249
48250 var tooltip = new Tooltip(options);
48251 self.tooltip = tooltip;
48252
48253 var triggerEvent = self._getTriggerEvent();
48254 if (!tooltip.get('enterable') && triggerEvent === 'plotmove') {
48255 // 鼠标不允许进入 tooltip 容器
48256 var tooltipContainer = tooltip.get('container');
48257 if (tooltipContainer) {
48258 tooltipContainer.onmousemove = function (e) {
48259 // 避免 tooltip 频繁闪烁
48260 var eventObj = self._normalizeEvent(e);
48261 chart.emit(triggerEvent, eventObj);
48262 };
48263 }
48264 }
48265 self._bindEvent();
48266 };
48267
48268 TooltipController.prototype.showTooltip = function showTooltip(point, views, target) {
48269 var self = this;
48270 if (Util.isEmpty(views) || !point) {
48271 return;
48272 }
48273 if (!this.tooltip) {
48274 this.renderTooltip(); // 如果一开始 tooltip 关闭,用户重新调用的时候需要先生成 tooltip
48275 }
48276 var options = self.options;
48277 var markersItems = [];
48278 var items = [];
48279
48280 Util.each(views, function (view) {
48281 if (!view.get('tooltipEnable')) {
48282 // 如果不显示tooltip,则跳过
48283 return true;
48284 }
48285 var geoms = view.get('geoms');
48286 var coord = view.get('coord');
48287 Util.each(geoms, function (geom) {
48288 var type = geom.get('type');
48289 if (geom.get('visible') && geom.get('tooltipCfg') !== false) {
48290 var dataArray = geom.get('dataArray');
48291 if (geom.isShareTooltip() || options.shared === false && Util.inArray(['area', 'line', 'path'], type)) {
48292 Util.each(dataArray, function (obj) {
48293 var tmpPoint = geom.findPoint(point, obj);
48294 if (tmpPoint) {
48295 var subItems = geom.getTipItems(tmpPoint, options.title);
48296 if (Util.indexOf(TYPE_SHOW_MARKERS, type) !== -1) {
48297 Util.each(subItems, function (v) {
48298 var point = v.point;
48299 if (point && point.x && point.y) {
48300 // hotfix: make sure there is no null value
48301 var x = Util.isArray(point.x) ? point.x[point.x.length - 1] : point.x;
48302 var y = Util.isArray(point.y) ? point.y[point.y.length - 1] : point.y;
48303 point = coord.applyMatrix(x, y, 1);
48304 v.x = point[0];
48305 v.y = point[1];
48306 v.showMarker = true;
48307 markersItems.push(v);
48308 }
48309 });
48310 }
48311 items = items.concat(subItems);
48312 }
48313 });
48314 } else {
48315 var geomContainer = geom.get('shapeContainer');
48316 var canvas = geomContainer.get('canvas');
48317 var pixelRatio = canvas.get('pixelRatio');
48318 var shape = geomContainer.getShape(point.x * pixelRatio, point.y * pixelRatio);
48319 if (shape && shape.get('visible') && shape.get('origin')) {
48320 items = geom.getTipItems(shape.get('origin'), options.title);
48321 }
48322 }
48323 }
48324 });
48325
48326 Util.each(items, function (item) {
48327 var point = item.point;
48328 var x = Util.isArray(point.x) ? point.x[point.x.length - 1] : point.x;
48329 var y = Util.isArray(point.y) ? point.y[point.y.length - 1] : point.y;
48330 point = coord.applyMatrix(x, y, 1);
48331 item.x = point[0];
48332 item.y = point[1];
48333 });
48334 });
48335
48336 if (items.length) {
48337 var first = items[0];
48338
48339 // bugfix: multiple tooltip items with different titles
48340 if (!items.every(function (item) {
48341 return item.title === first.title;
48342 })) {
48343 var nearestItem = first;
48344 var nearestDistance = Infinity;
48345 items.forEach(function (item) {
48346 var distance = Vector2.distance([point.x, point.y], [item.x, item.y]);
48347 if (distance < nearestDistance) {
48348 nearestDistance = distance;
48349 nearestItem = item;
48350 }
48351 });
48352 items = items.filter(function (item) {
48353 return item.title === nearestItem.title;
48354 });
48355 markersItems = markersItems.filter(function (item) {
48356 return item.title === nearestItem.title;
48357 });
48358 }
48359
48360 if (options.shared === false && items.length > 1) {
48361 var snapItem = items[0];
48362 var min = Math.abs(point.y - snapItem.y);
48363 Util.each(items, function (aItem) {
48364 if (Math.abs(point.y - aItem.y) <= min) {
48365 snapItem = aItem;
48366 min = Math.abs(point.y - aItem.y);
48367 }
48368 });
48369 if (snapItem && snapItem.x && snapItem.y) {
48370 markersItems = [snapItem];
48371 }
48372 items = [snapItem];
48373 }
48374 // 3.0 采用当前鼠标位置作为 tooltip 的参考点
48375 // if (!Util.isEmpty(markersItems)) {
48376 // point = markersItems[0];
48377 // }
48378 var title = first.title || first.name;
48379
48380 self._setTooltip(title, point, items, markersItems, target);
48381 } else {
48382 self.hideTooltip();
48383 }
48384 };
48385
48386 TooltipController.prototype.clear = function clear() {
48387 var tooltip = this.tooltip;
48388 tooltip && tooltip.destroy();
48389 this.tooltip = null;
48390 this.prePoint = null;
48391 this._offEvent();
48392 };
48393
48394 return TooltipController;
48395}();
48396
48397module.exports = TooltipController;
48398
48399/***/ }),
48400/* 358 */
48401/***/ (function(module, exports, __webpack_require__) {
48402
48403function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
48404
48405/**
48406 * @fileOverview The controller of chart's events
48407 * @author sima.zhang
48408 */
48409var Util = __webpack_require__(0);
48410
48411function isSameShape(shape1, shape2) {
48412 if (Util.isNil(shape1) || Util.isNil(shape2)) {
48413 return false;
48414 }
48415 var shape1Origin = shape1.get('origin');
48416 var shape2Origin = shape2.get('origin');
48417
48418 // hotfix: if both shapes have no data,just compare shapes.
48419 if (Util.isNil(shape1Origin) && Util.isNil(shape2Origin)) {
48420 return Util.isEqual(shape1, shape2);
48421 }
48422
48423 return Util.isEqual(shape1Origin, shape2Origin);
48424}
48425
48426function registerData(eventObj) {
48427 if (eventObj.shape && eventObj.shape.get('origin')) {
48428 eventObj.data = eventObj.shape.get('origin');
48429 }
48430}
48431
48432var EventController = function () {
48433 function EventController(cfg) {
48434 _classCallCheck(this, EventController);
48435
48436 this.view = null;
48437 this.canvas = null;
48438 Util.assign(this, cfg);
48439
48440 this._init();
48441 }
48442
48443 EventController.prototype._init = function _init() {
48444 this.pixelRatio = this.canvas.get('pixelRatio');
48445 };
48446
48447 EventController.prototype._getShapeEventObj = function _getShapeEventObj(ev) {
48448 return {
48449 x: ev.x / this.pixelRatio,
48450 y: ev.y / this.pixelRatio,
48451 target: ev.target, // canvas 元素
48452 toElement: ev.event.toElement || ev.event.relatedTarget
48453 };
48454 };
48455
48456 EventController.prototype._getShape = function _getShape(x, y) {
48457 var view = this.view;
48458 var container = view.get('canvas');
48459 return container.getShape(x, y);
48460 };
48461
48462 EventController.prototype._getPointInfo = function _getPointInfo(ev) {
48463 var view = this.view;
48464 var point = {
48465 x: ev.x / this.pixelRatio,
48466 y: ev.y / this.pixelRatio
48467 };
48468 var views = view.getViewsByPoint(point);
48469 point.views = views;
48470 return point;
48471 };
48472
48473 EventController.prototype._getEventObj = function _getEventObj(ev, point, views) {
48474 return {
48475 x: point.x,
48476 y: point.y,
48477 target: ev.target, // canvas 元素
48478 toElement: ev.event.toElement || ev.event.relatedTarget, // 目标元素
48479 views: views
48480 };
48481 };
48482
48483 EventController.prototype.bindEvents = function bindEvents() {
48484 var canvas = this.canvas;
48485 canvas.on('mousedown', Util.wrapBehavior(this, 'onDown'));
48486 canvas.on('mousemove', Util.wrapBehavior(this, 'onMove'));
48487 canvas.on('mouseleave', Util.wrapBehavior(this, 'onOut'));
48488 canvas.on('mouseup', Util.wrapBehavior(this, 'onUp'));
48489 canvas.on('click', Util.wrapBehavior(this, 'onClick'));
48490 canvas.on('dblclick', Util.wrapBehavior(this, 'onClick'));
48491 canvas.on('touchstart', Util.wrapBehavior(this, 'onTouchstart'));
48492 canvas.on('touchmove', Util.wrapBehavior(this, 'onTouchmove'));
48493 canvas.on('touchend', Util.wrapBehavior(this, 'onTouchend'));
48494 };
48495
48496 EventController.prototype._triggerShapeEvent = function _triggerShapeEvent(shape, eventName, eventObj) {
48497 if (shape && shape.name) {
48498 var view = this.view;
48499 if (view.isShapeInView(shape)) {
48500 var name = shape.name + ':' + eventName;
48501 eventObj.view = view;
48502 eventObj.appendInfo = shape.get('appendInfo'); // appendInfo is defined by user
48503 view.emit(name, eventObj);
48504 }
48505 // const parent = view.get('parent');
48506 // if (parent) { // chart 上也需要抛出该事件,本期先不抛出
48507 // parent.emit(name, eventObj);
48508 // }
48509 }
48510 };
48511
48512 EventController.prototype.onDown = function onDown(ev) {
48513 var view = this.view;
48514 var eventObj = this._getShapeEventObj(ev);
48515 eventObj.shape = this.currentShape;
48516 registerData(eventObj);
48517 view.emit('mousedown', eventObj);
48518 this._triggerShapeEvent(this.currentShape, 'mousedown', eventObj);
48519 };
48520
48521 EventController.prototype.onMove = function onMove(ev) {
48522 var self = this;
48523 var view = self.view;
48524 var currentShape = self.currentShape;
48525 var shape = self._getShape(ev.x, ev.y);
48526 var eventObj = self._getShapeEventObj(ev);
48527 eventObj.shape = shape;
48528 registerData(eventObj);
48529 view.emit('mousemove', eventObj);
48530 self._triggerShapeEvent(shape, 'mousemove', eventObj);
48531
48532 if (currentShape && !isSameShape(currentShape, shape)) {
48533 var leaveObj = self._getShapeEventObj(ev);
48534 leaveObj.shape = currentShape;
48535 leaveObj.toShape = shape;
48536 registerData(leaveObj);
48537 self._triggerShapeEvent(currentShape, 'mouseleave', leaveObj);
48538 }
48539
48540 if (shape && !isSameShape(currentShape, shape)) {
48541 var enterObj = self._getShapeEventObj(ev);
48542 enterObj.shape = shape;
48543 enterObj.fromShape = currentShape;
48544 registerData(enterObj);
48545 self._triggerShapeEvent(shape, 'mouseenter', enterObj);
48546 }
48547 self.currentShape = shape;
48548
48549 var point = self._getPointInfo(ev);
48550 var preViews = self.curViews || [];
48551
48552 if (preViews.length === 0 && point.views.length) {
48553 view.emit('plotenter', self._getEventObj(ev, point, point.views));
48554 }
48555 if (preViews.length && point.views.length === 0) {
48556 view.emit('plotleave', self._getEventObj(ev, point, preViews));
48557 }
48558
48559 if (point.views.length) {
48560 eventObj = self._getEventObj(ev, point, point.views);
48561 eventObj.shape = shape;
48562 registerData(eventObj);
48563 view.emit('plotmove', eventObj);
48564 }
48565
48566 self.curViews = point.views;
48567 };
48568
48569 EventController.prototype.onOut = function onOut(ev) {
48570 var self = this;
48571 var view = self.view;
48572 var point = self._getPointInfo(ev);
48573 view.emit('plotleave', self._getEventObj(ev, point, self.curViews));
48574 };
48575
48576 EventController.prototype.onUp = function onUp(ev) {
48577 var view = this.view;
48578 var eventObj = this._getShapeEventObj(ev);
48579 eventObj.shape = this.currentShape;
48580 view.emit('mouseup', eventObj);
48581 this._triggerShapeEvent(this.currentShape, 'mouseup', eventObj);
48582 };
48583
48584 EventController.prototype.onClick = function onClick(ev) {
48585 var self = this;
48586 var view = self.view;
48587 var shape = self._getShape(ev.x, ev.y);
48588 var shapeEventObj = self._getShapeEventObj(ev);
48589 shapeEventObj.shape = shape;
48590 registerData(shapeEventObj);
48591 view.emit('click', shapeEventObj);
48592 self._triggerShapeEvent(shape, ev.type, shapeEventObj);
48593 self.currentShape = shape;
48594
48595 var point = self._getPointInfo(ev);
48596 var views = point.views;
48597 if (!Util.isEmpty(views)) {
48598 var eventObj = self._getEventObj(ev, point, views);
48599 if (self.currentShape) {
48600 var _shape = self.currentShape;
48601 eventObj.shape = _shape;
48602 registerData(eventObj);
48603 // eventObj.data = shape.get('origin');
48604 }
48605 view.emit('plotclick', eventObj);
48606 if (ev.type === 'dblclick') {
48607 view.emit('plotdblclick', eventObj);
48608 view.emit('dblclick', shapeEventObj);
48609 }
48610 }
48611 };
48612
48613 EventController.prototype.onTouchstart = function onTouchstart(ev) {
48614 var view = this.view;
48615 var shape = this._getShape(ev.x, ev.y);
48616 var eventObj = this._getShapeEventObj(ev);
48617 eventObj.shape = shape;
48618 registerData(eventObj);
48619 view.emit('touchstart', eventObj);
48620 this._triggerShapeEvent(shape, 'touchstart', eventObj);
48621 this.currentShape = shape;
48622 };
48623
48624 EventController.prototype.onTouchmove = function onTouchmove(ev) {
48625 var view = this.view;
48626 var shape = this._getShape(ev.x, ev.y);
48627 var eventObj = this._getShapeEventObj(ev);
48628 eventObj.shape = shape;
48629 registerData(eventObj);
48630 view.emit('touchmove', eventObj);
48631 this._triggerShapeEvent(shape, 'touchmove', eventObj);
48632 this.currentShape = shape;
48633 };
48634
48635 EventController.prototype.onTouchend = function onTouchend(ev) {
48636 var view = this.view;
48637 var eventObj = this._getShapeEventObj(ev);
48638 eventObj.shape = this.currentShape;
48639 registerData(eventObj);
48640 view.emit('touchend', eventObj);
48641 this._triggerShapeEvent(this.currentShape, 'touchend', eventObj);
48642 };
48643
48644 EventController.prototype.clearEvents = function clearEvents() {
48645 var canvas = this.canvas;
48646 canvas.off('mousemove', Util.getWrapBehavior(this, 'onMove'));
48647 canvas.off('mouseleave', Util.getWrapBehavior(this, 'onOut'));
48648 canvas.off('mousedown', Util.getWrapBehavior(this, 'onDown'));
48649 canvas.off('mouseup', Util.getWrapBehavior(this, 'onUp'));
48650 canvas.off('click', Util.getWrapBehavior(this, 'onClick'));
48651 canvas.off('dblclick', Util.getWrapBehavior(this, 'onClick'));
48652 canvas.off('touchstart', Util.getWrapBehavior(this, 'onTouchstart'));
48653 canvas.off('touchmove', Util.getWrapBehavior(this, 'onTouchmove'));
48654 canvas.off('touchend', Util.getWrapBehavior(this, 'onTouchend'));
48655 };
48656
48657 return EventController;
48658}();
48659
48660module.exports = EventController;
48661
48662/***/ }),
48663/* 359 */
48664/***/ (function(module, exports, __webpack_require__) {
48665
48666/**
48667 * @fileOverview The entry of chart's animation
48668 * @author sima.zhang
48669 */
48670var Util = __webpack_require__(0);
48671var Animate = __webpack_require__(68);
48672
48673var _require = __webpack_require__(2),
48674 MatrixUtil = _require.MatrixUtil;
48675
48676var mat3 = MatrixUtil.mat3;
48677
48678// 获取图组内所有的shapes
48679
48680function getShapes(container, viewId) {
48681 var shapes = [];
48682 if (container.get('animate') === false) {
48683 return [];
48684 }
48685 var children = container.get('children');
48686 Util.each(children, function (child) {
48687 if (child.isGroup) {
48688 shapes = shapes.concat(getShapes(child, viewId));
48689 } else if (child.isShape && child._id) {
48690 var id = child._id;
48691 id = id.split('-')[0];
48692 if (id === viewId) {
48693 shapes.push(child);
48694 }
48695 }
48696 });
48697
48698 return shapes;
48699}
48700
48701function cache(shapes) {
48702 var rst = {};
48703 Util.each(shapes, function (shape) {
48704 if (!shape._id || shape.isClip) return;
48705 var id = shape._id;
48706 rst[id] = {
48707 _id: id,
48708 type: shape.get('type'),
48709 attrs: Util.cloneDeep(shape.__attrs), // 原始属性
48710 name: shape.name,
48711 index: shape.get('index'),
48712 animateCfg: shape.get('animateCfg'),
48713 coord: shape.get('coord')
48714 };
48715 });
48716 return rst;
48717}
48718
48719function getAnimate(geomType, coord, animationType, animationName) {
48720 var result = void 0;
48721 if (animationName) {
48722 result = Animate.Action[animationType][animationName];
48723 } else {
48724 result = Animate.getAnimation(geomType, coord, animationType);
48725 }
48726 return result;
48727}
48728
48729function getAnimateCfg(geomType, animationType, animateCfg) {
48730 var defaultCfg = Animate.getAnimateCfg(geomType, animationType);
48731 if (animateCfg && animateCfg[animationType]) {
48732 return Util.deepMix({}, defaultCfg, animateCfg[animationType]);
48733 }
48734 return defaultCfg;
48735}
48736
48737function addAnimate(cache, shapes, canvas, isUpdate) {
48738 var animate = void 0;
48739 var animateCfg = void 0;
48740 var canvasDrawn = false;
48741
48742 if (isUpdate) {
48743 // Step: leave -> update -> enter
48744 var updateShapes = []; // 存储的是 shapes
48745 var newShapes = []; // 存储的是 shapes
48746 Util.each(shapes, function (shape) {
48747 var result = cache[shape._id];
48748 if (!result) {
48749 newShapes.push(shape);
48750 } else {
48751 shape.setSilent('cacheShape', result);
48752 updateShapes.push(shape);
48753 delete cache[shape._id];
48754 }
48755 });
48756
48757 Util.each(cache, function (deletedShape) {
48758 var name = deletedShape.name,
48759 coord = deletedShape.coord,
48760 _id = deletedShape._id,
48761 attrs = deletedShape.attrs,
48762 index = deletedShape.index,
48763 type = deletedShape.type;
48764
48765 animateCfg = getAnimateCfg(name, 'leave', deletedShape.animateCfg);
48766 animate = getAnimate(name, coord, 'leave', animateCfg.animation);
48767 if (Util.isFunction(animate)) {
48768 var tempShape = canvas.addShape(type, {
48769 attrs: attrs,
48770 index: index
48771 });
48772 tempShape._id = _id;
48773 tempShape.name = name;
48774 if (coord) {
48775 var tempShapeMatrix = tempShape.getMatrix();
48776 var finalMatrix = mat3.multiply([], tempShapeMatrix, coord.matrix);
48777 tempShape.setMatrix(finalMatrix);
48778 }
48779 canvasDrawn = true;
48780 animate(tempShape, animateCfg, coord);
48781 }
48782 });
48783
48784 Util.each(updateShapes, function (updateShape) {
48785 var name = updateShape.name;
48786 var coord = updateShape.get('coord');
48787 var cacheAttrs = updateShape.get('cacheShape').attrs;
48788 // 判断如果属性相同的话就不进行变换
48789 if (!Util.isEqual(cacheAttrs, updateShape.__attrs)) {
48790 animateCfg = getAnimateCfg(name, 'update', updateShape.get('animateCfg'));
48791 animate = getAnimate(name, coord, 'update', animateCfg.animation);
48792 if (Util.isFunction(animate)) {
48793 animate(updateShape, animateCfg, coord);
48794 } else {
48795 var endState = Util.cloneDeep(updateShape.__attrs);
48796 // updateShape.__attrs = cacheAttrs;
48797 updateShape.attr(cacheAttrs);
48798 updateShape.animate(endState, animateCfg.duration, animateCfg.easing, function () {
48799 updateShape.setSilent('cacheShape', null);
48800 });
48801 }
48802 canvasDrawn = true;
48803 }
48804 });
48805
48806 Util.each(newShapes, function (newShape) {
48807 var name = newShape.name;
48808 var coord = newShape.get('coord');
48809
48810 animateCfg = getAnimateCfg(name, 'enter', newShape.get('animateCfg'));
48811 animate = getAnimate(name, coord, 'enter', animateCfg.animation);
48812 if (Util.isFunction(animate)) {
48813 animate(newShape, animateCfg, coord);
48814 canvasDrawn = true;
48815 }
48816 });
48817 } else {
48818 Util.each(shapes, function (shape) {
48819 var name = shape.name;
48820 var coord = shape.get('coord');
48821 animateCfg = getAnimateCfg(name, 'appear', shape.get('animateCfg'));
48822 animate = getAnimate(name, coord, 'appear', animateCfg.animation);
48823 if (Util.isFunction(animate)) {
48824 animate(shape, animateCfg, coord);
48825 canvasDrawn = true;
48826 }
48827 });
48828 }
48829 return canvasDrawn;
48830}
48831
48832module.exports = {
48833 execAnimation: function execAnimation(view, isUpdate) {
48834 var viewContainer = view.get('middlePlot');
48835 var axisContainer = view.get('backPlot');
48836 var viewId = view.get('_id');
48837 var canvas = view.get('canvas');
48838 var caches = canvas.get(viewId + 'caches') || [];
48839 var shapes = getShapes(viewContainer, viewId);
48840 var axisShapes = getShapes(axisContainer, viewId);
48841 var cacheShapes = shapes.concat(axisShapes);
48842 canvas.setSilent(viewId + 'caches', cache(cacheShapes));
48843 var drawn = void 0;
48844 if (isUpdate) {
48845 drawn = addAnimate(caches, cacheShapes, canvas, isUpdate);
48846 } else {
48847 drawn = addAnimate(caches, shapes, canvas, isUpdate);
48848 }
48849 if (!drawn) {
48850 canvas.draw();
48851 }
48852 }
48853};
48854
48855/***/ }),
48856/* 360 */
48857/***/ (function(module, exports, __webpack_require__) {
48858
48859/**
48860 * @fileOverview Facet 的入口
48861 * @author dxq613@gmail.com
48862 */
48863
48864var Facets = {};
48865
48866Facets.Rect = __webpack_require__(124);
48867Facets.List = __webpack_require__(125);
48868Facets.Circle = __webpack_require__(361);
48869Facets.Tree = __webpack_require__(362);
48870Facets.Mirror = __webpack_require__(363);
48871Facets.Matrix = __webpack_require__(364);
48872
48873module.exports = Facets;
48874
48875/***/ }),
48876/* 361 */
48877/***/ (function(module, exports, __webpack_require__) {
48878
48879function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
48880
48881function _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; }
48882
48883function _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; }
48884
48885/**
48886 * @fileOverview circle facets
48887 * @author dxq613@gmail.com
48888 */
48889
48890var Base = __webpack_require__(45);
48891
48892function getPoint(center, r, angle) {
48893 return {
48894 x: center.x + r * Math.cos(angle),
48895 y: center.y + r * Math.sin(angle)
48896 };
48897}
48898
48899var Circle = function (_Base) {
48900 _inherits(Circle, _Base);
48901
48902 function Circle() {
48903 _classCallCheck(this, Circle);
48904
48905 return _possibleConstructorReturn(this, _Base.apply(this, arguments));
48906 }
48907
48908 Circle.prototype.getDefaultCfg = function getDefaultCfg() {
48909 var cfg = _Base.prototype.getDefaultCfg.call(this);
48910 cfg.type = 'circle';
48911 return cfg;
48912 };
48913
48914 Circle.prototype.getRegion = function getRegion(count, index) {
48915 var r = 1 / 2; // 画布半径
48916 var avgAngle = Math.PI * 2 / count;
48917 var angle = -1 * Math.PI / 2 + avgAngle * index; // 当前分面所在的弧度
48918 var facetR = r / (1 + 1 / Math.sin(avgAngle / 2));
48919 var center = { x: 0.5, y: 0.5 }; // 画布圆心
48920 var middle = getPoint(center, r - facetR, angle); // 分面的中心点
48921 var startAngle = Math.PI * 5 / 4; // 右上角
48922 var endAngle = Math.PI * 1 / 4; // 左下角
48923
48924 return {
48925 start: getPoint(middle, facetR, startAngle),
48926 end: getPoint(middle, facetR, endAngle)
48927 };
48928 };
48929
48930 Circle.prototype.generateFacets = function generateFacets(data) {
48931 var self = this;
48932 var fields = self.fields;
48933 var field = fields[0];
48934 if (!field) {
48935 throw 'Please specify for the field for facet!';
48936 }
48937 var values = self.getFieldValues(field, data);
48938 var count = values.length;
48939 var rst = [];
48940 values.forEach(function (value, index) {
48941 var conditions = [{ field: field, value: value, values: values }];
48942 var filter = self.getFilter(conditions);
48943 var subData = data.filter(filter);
48944 var facet = {
48945 type: self.type,
48946 colValue: value,
48947 colField: field,
48948 colIndex: index,
48949 cols: count,
48950 rows: 1,
48951 rowIndex: 0,
48952 data: subData,
48953 region: self.getRegion(count, index)
48954 };
48955 rst.push(facet);
48956 });
48957 return rst;
48958 };
48959
48960 return Circle;
48961}(Base);
48962
48963module.exports = Circle;
48964
48965/***/ }),
48966/* 362 */
48967/***/ (function(module, exports, __webpack_require__) {
48968
48969function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
48970
48971function _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; }
48972
48973function _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; }
48974
48975/**
48976 * @fileOverview tree facets
48977 * @author dxq613@gmail.com
48978 */
48979
48980var assign = __webpack_require__(60);
48981var Base = __webpack_require__(45);
48982
48983var Tree = function (_Base) {
48984 _inherits(Tree, _Base);
48985
48986 function Tree() {
48987 _classCallCheck(this, Tree);
48988
48989 return _possibleConstructorReturn(this, _Base.apply(this, arguments));
48990 }
48991
48992 Tree.prototype.getDefaultCfg = function getDefaultCfg() {
48993 var cfg = _Base.prototype.getDefaultCfg.call(this);
48994 cfg.type = 'tree';
48995 cfg.line = {
48996 lineWidth: 1,
48997 stroke: '#ddd'
48998 };
48999 cfg.lineSmooth = false;
49000 return cfg;
49001 };
49002
49003 Tree.prototype.generateFacets = function generateFacets(data) {
49004 var self = this;
49005 var fields = self.fields;
49006 if (!fields.length) {
49007 throw 'Please specify for the fields for facet!';
49008 }
49009 var rst = [];
49010 var root = self.getRootFacet(data);
49011 // if (self.showRoot) {
49012 rst.push(root);
49013 // }
49014 root.children = self.getChildFacets(data, 1, rst);
49015 self.setRegion(rst);
49016 return rst;
49017 };
49018
49019 Tree.prototype.getRootFacet = function getRootFacet(data) {
49020 var self = this;
49021 var facet = {
49022 type: self.type,
49023 rows: self.getRows(),
49024 rowIndex: 0,
49025 colIndex: 0,
49026 colValue: self.rootTitle,
49027 data: data
49028 };
49029 return facet;
49030 };
49031
49032 Tree.prototype.getRows = function getRows() {
49033 return this.fields.length + 1;
49034 };
49035
49036 // get child
49037
49038
49039 Tree.prototype.getChildFacets = function getChildFacets(data, level, arr) {
49040 var self = this;
49041 var fields = self.fields;
49042 var length = fields.length;
49043 if (length < level) {
49044 return;
49045 }
49046 var rst = [];
49047 var field = fields[level - 1];
49048 var values = self.getFieldValues(field, data);
49049 values.forEach(function (value, index) {
49050 var conditions = [{ field: field, value: value, values: values }];
49051 var filter = self.getFilter(conditions);
49052 var subData = data.filter(filter);
49053 if (subData.length) {
49054 var facet = {
49055 type: self.type,
49056 colValue: value,
49057 colField: field,
49058 colIndex: index,
49059 rows: self.getRows(),
49060 rowIndex: level,
49061 data: subData,
49062 children: self.getChildFacets(subData, level + 1, arr)
49063 };
49064 rst.push(facet);
49065 arr.push(facet);
49066 }
49067 });
49068 return rst;
49069 };
49070
49071 // 设置 region
49072
49073
49074 Tree.prototype.setRegion = function setRegion(facets) {
49075 var self = this;
49076 self.forceColIndex(facets);
49077 facets.forEach(function (facet) {
49078 facet.region = self.getRegion(facet.rows, facet.cols, facet.colIndex, facet.rowIndex);
49079 });
49080 };
49081
49082 // set column index of facets
49083
49084
49085 Tree.prototype.forceColIndex = function forceColIndex(facets) {
49086 var self = this;
49087 var leafs = [];
49088 var index = 0;
49089 facets.forEach(function (facet) {
49090 if (self.isLeaf(facet)) {
49091 leafs.push(facet);
49092 facet.colIndex = index;
49093 index++;
49094 }
49095 });
49096
49097 leafs.forEach(function (facet) {
49098 facet.cols = leafs.length;
49099 });
49100 var maxLevel = self.fields.length;
49101 for (var i = maxLevel - 1; i >= 0; i--) {
49102 var levelFacets = self.getFacetsByLevel(facets, i);
49103 // var yIndex = maxLevel - i;
49104 for (var j = 0; j < levelFacets.length; j++) {
49105 var facet = levelFacets[j];
49106 if (!self.isLeaf(facet)) {
49107 facet.originColIndex = facet.colIndex;
49108 facet.colIndex = self.getRegionIndex(facet.children);
49109 facet.cols = leafs.length;
49110 }
49111 }
49112 }
49113 };
49114
49115 // get facet use level
49116
49117
49118 Tree.prototype.getFacetsByLevel = function getFacetsByLevel(facets, level) {
49119 var rst = [];
49120 facets.forEach(function (facet) {
49121 if (facet.rowIndex === level) {
49122 rst.push(facet);
49123 }
49124 });
49125 return rst;
49126 };
49127
49128 // set facets region
49129
49130
49131 Tree.prototype.getRegion = function getRegion(rows, cols, xIndex, yIndex) {
49132 var xWidth = 1 / cols; // x轴方向的每个分面的偏移
49133 var yWidth = 1 / rows; // y轴方向的每个分面的偏移
49134
49135 var start = {
49136 x: xWidth * xIndex,
49137 y: yWidth * yIndex
49138 };
49139
49140 var end = {
49141 x: start.x + xWidth,
49142 y: start.y + yWidth * 2 / 3 // 预留1/3的空隙,方便添加连接线
49143 };
49144 return {
49145 start: start,
49146 end: end
49147 };
49148 };
49149
49150 // if the facet has children , make it's column index in the middle of it's children
49151
49152
49153 Tree.prototype.getRegionIndex = function getRegionIndex(children) {
49154 var first = children[0];
49155 var last = children[children.length - 1];
49156 return (last.colIndex - first.colIndex) / 2 + first.colIndex;
49157 };
49158
49159 // is a leaf without children
49160
49161
49162 Tree.prototype.isLeaf = function isLeaf(facet) {
49163 return !facet.children || !facet.children.length;
49164 };
49165
49166 Tree.prototype.setXAxis = function setXAxis(xField, axes, facet) {
49167 // 当是最后一行或者下面没有 view 时文本不显示
49168 if (facet.rowIndex !== facet.rows - 1) {
49169 axes[xField].label = null;
49170 axes[xField].title = null;
49171 }
49172 };
49173
49174 // 设置 y 坐标轴的文本、title 是否显示
49175
49176
49177 Tree.prototype.setYAxis = function setYAxis(yField, axes, facet) {
49178 if (facet.originColIndex !== 0 && facet.colIndex !== 0) {
49179 axes[yField].title = null;
49180 axes[yField].label = null;
49181 }
49182 };
49183
49184 // 绘制完成后
49185
49186
49187 Tree.prototype.onPaint = function onPaint() {
49188 _Base.prototype.onPaint.call(this);
49189 this.group.clear();
49190 if (this.facets && this.line) {
49191 this.drawLines(this.facets, this.group);
49192 }
49193 };
49194
49195 Tree.prototype.drawLines = function drawLines(facets, group) {
49196 var self = this;
49197 var lineGroup = group.addGroup();
49198 facets.forEach(function (facet) {
49199 if (!self.isLeaf(facet)) {
49200 var children = facet.children;
49201 self._addFacetLines(facet, children, lineGroup);
49202 }
49203 });
49204 };
49205
49206 // add lines with it's children
49207
49208
49209 Tree.prototype._addFacetLines = function _addFacetLines(facet, children, group) {
49210 var self = this;
49211 var view = facet.view;
49212 var region = view.getViewRegion();
49213 var start = {
49214 x: region.start.x + (region.end.x - region.start.x) / 2,
49215 y: region.start.y
49216 };
49217
49218 children.forEach(function (subFacet) {
49219 var subRegion = subFacet.view.getViewRegion();
49220 var end = {
49221 x: subRegion.start.x + (subRegion.end.x - subRegion.start.x) / 2,
49222 y: subRegion.end.y
49223 };
49224 var middle1 = {
49225 x: start.x,
49226 y: start.y + (end.y - start.y) / 2
49227 };
49228 var middle2 = {
49229 x: end.x,
49230 y: middle1.y
49231 };
49232 self._drawLine([start, middle1, middle2, end], group);
49233 });
49234 };
49235
49236 Tree.prototype._getPath = function _getPath(points) {
49237 var self = this;
49238 var path = [];
49239 var smooth = self.lineSmooth;
49240 if (smooth) {
49241 path.push(['M', points[0].x, points[0].y]);
49242 path.push(['C', points[1].x, points[1].y, points[2].x, points[2].y, points[3].x, points[3].y]);
49243 } else {
49244 points.forEach(function (point, index) {
49245 if (index === 0) {
49246 path.push(['M', point.x, point.y]);
49247 } else {
49248 path.push(['L', point.x, point.y]);
49249 }
49250 });
49251 }
49252
49253 return path;
49254 };
49255
49256 // draw line width points
49257
49258
49259 Tree.prototype._drawLine = function _drawLine(points, group) {
49260 var self = this;
49261 var path = self._getPath(points);
49262 var line = self.line;
49263 group.addShape('path', {
49264 attrs: assign({
49265 path: path
49266 }, line)
49267 });
49268 };
49269
49270 return Tree;
49271}(Base);
49272
49273module.exports = Tree;
49274
49275/***/ }),
49276/* 363 */
49277/***/ (function(module, exports, __webpack_require__) {
49278
49279function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
49280
49281function _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; }
49282
49283function _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; }
49284
49285/**
49286 * @fileOverview mirror facets
49287 * @author dxq613@gmail.com
49288 */
49289
49290var List = __webpack_require__(125);
49291
49292var Mirror = function (_List) {
49293 _inherits(Mirror, _List);
49294
49295 function Mirror() {
49296 _classCallCheck(this, Mirror);
49297
49298 return _possibleConstructorReturn(this, _List.apply(this, arguments));
49299 }
49300
49301 Mirror.prototype.getDefaultCfg = function getDefaultCfg() {
49302 var cfg = _List.prototype.getDefaultCfg.call(this);
49303 cfg.type = 'mirror';
49304 this.transpose = false;
49305 return cfg;
49306 };
49307
49308 Mirror.prototype.init = function init() {
49309 var self = this;
49310 if (self.transpose) {
49311 self.cols = 2;
49312 self.rows = 1;
49313 } else {
49314 self.cols = 1;
49315 self.rows = 2;
49316 }
49317 _List.prototype.init.call(this);
49318 };
49319
49320 Mirror.prototype.beforeProcessView = function beforeProcessView(view, facet) {
49321 if (this.transpose) {
49322 if (facet.colIndex % 2 === 0) {
49323 view.coord().transpose().scale(-1, 1);
49324 } else {
49325 view.coord().transpose();
49326 }
49327 } else {
49328 if (facet.rowIndex % 2 !== 0) {
49329 view.coord().scale(1, -1);
49330 }
49331 }
49332 };
49333
49334 Mirror.prototype.renderTitle = function renderTitle(view, facet) {
49335 if (this.transpose) {
49336 this.drawColTitle(view, facet);
49337 } else {
49338 this.drawRowTitle(view, facet);
49339 }
49340 };
49341
49342 Mirror.prototype.setXAxis = function setXAxis(xField, axes, facet) {
49343 // 当是最后一行或者下面没有 view 时文本不显示
49344 if (facet.colIndex === 1 || facet.rowIndex === 1) {
49345 axes[xField].label = null;
49346 axes[xField].title = null;
49347 }
49348 };
49349
49350 Mirror.prototype.setYAxis = function setYAxis() /* yField, axes, facet */{};
49351
49352 return Mirror;
49353}(List);
49354
49355module.exports = Mirror;
49356
49357/***/ }),
49358/* 364 */
49359/***/ (function(module, exports, __webpack_require__) {
49360
49361function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
49362
49363function _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; }
49364
49365function _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; }
49366
49367/**
49368 * @fileOverview Use matrices to compare different fields
49369 * @author dxq613@gmail.com
49370 */
49371
49372var Rect = __webpack_require__(124);
49373
49374var Matrix = function (_Rect) {
49375 _inherits(Matrix, _Rect);
49376
49377 function Matrix() {
49378 _classCallCheck(this, Matrix);
49379
49380 return _possibleConstructorReturn(this, _Rect.apply(this, arguments));
49381 }
49382
49383 Matrix.prototype.getDefaultCfg = function getDefaultCfg() {
49384 var cfg = _Rect.prototype.getDefaultCfg.call(this);
49385 cfg.type = 'matrix';
49386 cfg.showTitle = false;
49387 return cfg;
49388 };
49389
49390 Matrix.prototype.generateFacets = function generateFacets(data) {
49391 var self = this;
49392 var fields = self.fields;
49393 var rows = fields.length;
49394 var cols = rows; // 矩阵中行列相等,等于指定的字段个数
49395 var rst = [];
49396 for (var i = 0; i < cols; i++) {
49397 var colField = fields[i];
49398 for (var j = 0; j < rows; j++) {
49399 var rowField = fields[j];
49400 var facet = {
49401 type: self.type,
49402 colValue: colField,
49403 rowValue: rowField,
49404 colField: colField,
49405 rowField: rowField,
49406 colIndex: i,
49407 rowIndex: j,
49408 cols: cols,
49409 rows: rows,
49410 data: data,
49411 region: self.getRegion(rows, cols, i, j)
49412 };
49413 rst.push(facet);
49414 }
49415 }
49416 return rst;
49417 };
49418
49419 // 设置 x 坐标轴的文本、title 是否显示
49420
49421
49422 Matrix.prototype.setXAxis = function setXAxis(xField, axes, facet) {
49423 if (facet.rowIndex !== facet.rows - 1) {
49424 axes[xField].title = null;
49425 axes[xField].label = null;
49426 }
49427 };
49428
49429 // 设置 y 坐标轴的文本、title 是否显示
49430
49431
49432 Matrix.prototype.setYAxis = function setYAxis(yField, axes, facet) {
49433 if (facet.colIndex !== 0) {
49434 axes[yField].title = null;
49435 axes[yField].label = null;
49436 }
49437 };
49438
49439 return Matrix;
49440}(Rect);
49441
49442module.exports = Matrix;
49443
49444/***/ }),
49445/* 365 */
49446/***/ (function(module, exports, __webpack_require__) {
49447
49448function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
49449
49450/**
49451 * @fileOverview track g2
49452 * @author dxq613@gmail.com
49453 */
49454var Global = __webpack_require__(1);
49455var SERVER_URL = 'https://kcart.alipay.com/web/bi.do';
49456var Util = __webpack_require__(0);
49457
49458var Monitor = function () {
49459 function Monitor(opt) {
49460 _classCallCheck(this, Monitor);
49461
49462 var _self = this;
49463 var config = opt || {};
49464 var image = new Image();
49465 Util.mix(_self, {
49466 image: image,
49467 server: SERVER_URL
49468 }, config);
49469 }
49470 /**
49471 * 发送请求
49472 * @param {object} opt 埋点记录参数
49473 * opt.pg:访问的页面url
49474 */
49475
49476
49477 Monitor.prototype.log = function log(opt) {
49478 var _self = this;
49479 var config = opt || {};
49480 var newObj = Util.mix({
49481 pg: document.URL,
49482 r: new Date().getTime()
49483 }, config);
49484 var d = encodeURIComponent(JSON.stringify([newObj]));
49485 _self.image.src = _self.server + '?BIProfile=merge&d=' + d;
49486 };
49487
49488 return Monitor;
49489}();
49490
49491// 延迟发送请求
49492
49493
49494setTimeout(function () {
49495 if (Global.trackable) {
49496 var m = new Monitor();
49497 m.log({
49498 g2: true,
49499 version: Global.version,
49500 page_type: 'syslog'
49501 });
49502 }
49503}, 3000);
49504
49505/***/ })
49506/******/ ]);
49507});
49508//# sourceMappingURL=g2.js.map
\No newline at end of file