1 | import React, { Component, Fragment, createRef, PureComponent, useState, useEffect, useRef } from 'react';
|
2 | import PropTypes from 'prop-types';
|
3 | import styled, { css, createGlobalStyle } from 'styled-components';
|
4 | import { Icon, Button, Menu, Tab, Modal, Header, Grid, Divider, Pagination, Input, Label, TextArea, Checkbox, Table, Dropdown } from 'semantic-ui-react';
|
5 | import reactDom, { createPortal, findDOMNode } from 'react-dom';
|
6 | import { Spring } from 'react-spring';
|
7 | import { DateRangePicker } from 'react-dates';
|
8 | import 'react-dates/initialize';
|
9 | import 'react-dates/lib/css/_datepicker.css';
|
10 | import { CustomPicker } from 'react-color';
|
11 | import { EditableInput, Hue, Saturation } from 'react-color/lib/components/common';
|
12 | import domain from 'domain';
|
13 |
|
14 | function _taggedTemplateLiteralLoose(strings, raw) {
|
15 | if (!raw) {
|
16 | raw = strings.slice(0);
|
17 | }
|
18 |
|
19 | strings.raw = raw;
|
20 | return strings;
|
21 | }
|
22 |
|
23 | var taggedTemplateLiteralLoose = _taggedTemplateLiteralLoose;
|
24 |
|
25 | var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
26 |
|
27 | function commonjsRequire () {
|
28 | throw new Error('Dynamic requires are not currently supported by rollup-plugin-commonjs');
|
29 | }
|
30 |
|
31 | function unwrapExports (x) {
|
32 | return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
33 | }
|
34 |
|
35 | function createCommonjsModule(fn, module) {
|
36 | return module = { exports: {} }, fn(module, module.exports), module.exports;
|
37 | }
|
38 |
|
39 | var _extends_1 = createCommonjsModule(function (module) {
|
40 | function _extends() {
|
41 | module.exports = _extends = Object.assign || function (target) {
|
42 | for (var i = 1; i < arguments.length; i++) {
|
43 | var source = arguments[i];
|
44 |
|
45 | for (var key in source) {
|
46 | if (Object.prototype.hasOwnProperty.call(source, key)) {
|
47 | target[key] = source[key];
|
48 | }
|
49 | }
|
50 | }
|
51 |
|
52 | return target;
|
53 | };
|
54 |
|
55 | return _extends.apply(this, arguments);
|
56 | }
|
57 |
|
58 | module.exports = _extends;
|
59 | });
|
60 |
|
61 | function _objectWithoutPropertiesLoose(source, excluded) {
|
62 | if (source == null) return {};
|
63 | var target = {};
|
64 | var sourceKeys = Object.keys(source);
|
65 | var key, i;
|
66 |
|
67 | for (i = 0; i < sourceKeys.length; i++) {
|
68 | key = sourceKeys[i];
|
69 | if (excluded.indexOf(key) >= 0) continue;
|
70 | target[key] = source[key];
|
71 | }
|
72 |
|
73 | return target;
|
74 | }
|
75 |
|
76 | var objectWithoutPropertiesLoose = _objectWithoutPropertiesLoose;
|
77 |
|
78 | var IconName = ['assets', 'dash', 'date-time', 'expand', 'help', 'image-big', 'image', 'left-navigation', 'logout', 'multimedia1', 'playlist', 'right-navigation', 'weather', 'video-big .path1', 'video-big .path2', 'virtual-ticket', 'tv', 'timer', 'ticket-bold', 'priority', 'more-options', 'move', 'list', 'grid', 'settings-qmpad', 'eye-closed', 'refresh', 'info', 'duplicate', 'checkbox-off', 'checkbox-on', 'radio-button-off', 'radio-button-on', 'management', 'login', 'data', 'dashboard', 'add', 'arrow-down', 'arrow-left', 'arrow-right', 'arrow-up', 'calendar', 'clock', 'color', 'download', 'edit', 'email', 'error', 'gear', 'key', 'language', 'left-to-right', 'link', 'lock', 'multimedia', 'no-notications', 'notifications', 'on-off', 'preview', 'priority-ticket', 'restore', 'right-to-left', 'rss', 'save', 'search', 'select-down', 'select-left', 'select-right', 'select-up', 'sms', 'stopwatch', 'success', 'text', 'ticket', 'transfer', 'unlock', 'update', 'upload', 'user', 'warning', 'zoom-in', 'zoom-out', 'cancel', 'pause', 'transfer-bold', 'call', 'end'];
|
79 |
|
80 | function _templateObject() {
|
81 | var data = taggedTemplateLiteralLoose(["\n\tmargin: 0 !important;\n\tcolor: ", " !important;\n\n\t&&&& {\n\t\theight: 1em;\n\t}\n\n\t&&&.disabled {\n\t\tcursor: not-allowed !important;\n\t\tpointer-events: none !important;\n\t}\n\n\t&&&.clickable {\n\t\tcursor: pointer;\n\t}\n"]);
|
82 |
|
83 | _templateObject = function _templateObject() {
|
84 | return data;
|
85 | };
|
86 |
|
87 | return data;
|
88 | }
|
89 |
|
90 |
|
91 |
|
92 |
|
93 |
|
94 |
|
95 | var IconStyled = styled(function (_ref) {
|
96 | var color = _ref.color,
|
97 | props = objectWithoutPropertiesLoose(_ref, ["color"]);
|
98 |
|
99 | return React.createElement(Icon, props);
|
100 | })(_templateObject(), function (_ref2) {
|
101 | var color = _ref2.color;
|
102 | return color;
|
103 | });
|
104 | IconStyled.propTypes = _extends_1({}, Icon.propTypes, {
|
105 |
|
106 | color: PropTypes.string
|
107 | });
|
108 | IconStyled.displayName = 'IconStyled';
|
109 |
|
110 | var Icon$1 = function Icon$$1(_ref3) {
|
111 | var icon = _ref3.icon,
|
112 | className = _ref3.className,
|
113 | onClick = _ref3.onClick,
|
114 | props = objectWithoutPropertiesLoose(_ref3, ["icon", "className", "onClick"]);
|
115 |
|
116 | var combinedClassName = "icoqube" + icon + (className ? ' '.concat(className) : '') + (onClick ? ' clickable' : '');
|
117 | return React.createElement(IconStyled, _extends_1({}, props, {
|
118 | onClick: onClick,
|
119 | className: combinedClassName
|
120 | }));
|
121 | };
|
122 |
|
123 | Icon$1.defaultProps = {
|
124 | className: '',
|
125 | color: 'black',
|
126 | onClick: undefined
|
127 | };
|
128 | Icon$1.propTypes = {
|
129 |
|
130 | icon: PropTypes.oneOf(IconName).isRequired,
|
131 |
|
132 |
|
133 | className: PropTypes.string,
|
134 |
|
135 |
|
136 | color: PropTypes.string,
|
137 |
|
138 |
|
139 | onClick: PropTypes.func
|
140 | };
|
141 | Icon$1.displayName = 'Icon';
|
142 |
|
143 | function _templateObject2() {
|
144 | var data = taggedTemplateLiteralLoose(["\n\t", "\n"]);
|
145 |
|
146 | _templateObject2 = function _templateObject2() {
|
147 | return data;
|
148 | };
|
149 |
|
150 | return data;
|
151 | }
|
152 |
|
153 | function _templateObject$1() {
|
154 | var data = taggedTemplateLiteralLoose(["\n\tfont-size: ", "px!important;\n\tfont-style: ", "!important;\n\tfont-weight: ", "!important;\n\tline-height: ", "px!important;\n\tcolor: ", "!important;\n\ttext-transform: ", "!important;\n\tborder-bottom: ", "!important;\n"]);
|
155 |
|
156 | _templateObject$1 = function _templateObject() {
|
157 | return data;
|
158 | };
|
159 |
|
160 | return data;
|
161 | }
|
162 | var typographyStyles = css(_templateObject$1(), function (_ref) {
|
163 | var size = _ref.size,
|
164 | theme = _ref.theme;
|
165 | return theme.text[size].font;
|
166 | }, function (_ref2) {
|
167 | var italic = _ref2.italic;
|
168 | return italic ? 'italic' : 'normal';
|
169 | }, function (_ref3) {
|
170 | var bold = _ref3.bold;
|
171 | return bold ? 'bold' : 'normal';
|
172 | }, function (_ref4) {
|
173 | var size = _ref4.size,
|
174 | theme = _ref4.theme;
|
175 | return theme.text[size].line;
|
176 | }, function (_ref5) {
|
177 | var color = _ref5.color,
|
178 | theme = _ref5.theme;
|
179 | return theme.colors[color];
|
180 | }, function (_ref6) {
|
181 | var uppercase = _ref6.uppercase;
|
182 | return uppercase ? 'uppercase' : 'none';
|
183 | }, function (_ref7) {
|
184 | var color = _ref7.color,
|
185 | underlined = _ref7.underlined,
|
186 | theme = _ref7.theme;
|
187 | return underlined ? "1px solid " + theme.colors[color] : '0';
|
188 | });
|
189 | var Text = styled.div(_templateObject2(), typographyStyles);
|
190 | Text.displayName = 'Text';
|
191 | Text.defaultProps = {
|
192 | color: 'darkGray',
|
193 | italic: false,
|
194 | uppercase: false,
|
195 | size: 'md',
|
196 | bold: false,
|
197 | underlined: false
|
198 | };
|
199 | Text.propTypes = {
|
200 | color: PropTypes.string,
|
201 | italic: PropTypes.bool,
|
202 | uppercase: PropTypes.bool,
|
203 | size: PropTypes.oneOf(['sm', 'md', 'lg', 'xl', 'xxl']),
|
204 | bold: PropTypes.bool,
|
205 | underlined: PropTypes.bool
|
206 | };
|
207 |
|
208 | var ButtonText = function ButtonText(props) {
|
209 | return React.createElement(Text, _extends_1({
|
210 | uppercase: true
|
211 | }, props));
|
212 | };
|
213 |
|
214 | ButtonText.displayName = 'ButtonText';
|
215 |
|
216 | function _templateObject$2() {
|
217 | var data = taggedTemplateLiteralLoose(["\n\tpadding-right: 16px !important;\n\tpadding-left: 16px !important;\n\n\tbackground-color: ", " !important;\n\tborder-radius: ", " !important;\n\tpointer-events: ", " !important;\n\tcursor: ", ";\n\n\t&:active {\n\t\tbackground-color: ", " !important;\n\t}\n\n\ti.icon {\n\t\tmargin-right: 0 !important;\n\t\tmargin-left: 6px !important;\n\t}\n"]);
|
218 |
|
219 | _templateObject$2 = function _templateObject() {
|
220 | return data;
|
221 | };
|
222 |
|
223 | return data;
|
224 | }
|
225 |
|
226 | var Button$1 = function Button$$1(_ref) {
|
227 | var icon = _ref.icon,
|
228 | content = _ref.content,
|
229 | labelPosition = _ref.labelPosition,
|
230 | iconColor = _ref.iconColor,
|
231 | loading = _ref.loading,
|
232 | children = _ref.children,
|
233 | size = _ref.size,
|
234 | props = objectWithoutPropertiesLoose(_ref, ["icon", "content", "labelPosition", "iconColor", "loading", "children", "size"]);
|
235 |
|
236 | return React.createElement(ButtonStyled, _extends_1({
|
237 | loading: loading
|
238 | }, props), React.createElement(ButtonText, {
|
239 | size: size,
|
240 | color: loading ? 'transparent' : 'white'
|
241 | }, children || content, icon && React.createElement(Icon$1, {
|
242 | color: iconColor,
|
243 | icon: icon
|
244 | })));
|
245 | };
|
246 |
|
247 |
|
248 |
|
249 |
|
250 |
|
251 |
|
252 |
|
253 | var ButtonStyled = styled(Button)(_templateObject$2(), function (_ref2) {
|
254 | var theme = _ref2.theme;
|
255 | return theme.buttons.bg;
|
256 | }, function (_ref3) {
|
257 | var theme = _ref3.theme;
|
258 | return theme.buttons.borderRadius;
|
259 | }, function (_ref4) {
|
260 | var loading = _ref4.loading;
|
261 | return loading ? 'none' : 'auto';
|
262 | }, function (_ref5) {
|
263 | var disabled = _ref5.disabled;
|
264 | return disabled ? 'not-allowed' : 'pointer';
|
265 | }, function (_ref6) {
|
266 | var theme = _ref6.theme;
|
267 | return theme.buttons.activeBg;
|
268 | });
|
269 | ButtonStyled.displayName = 'ButtonStyled';
|
270 | Button$1.defaultProps = {
|
271 | size: 'lg',
|
272 | iconColor: 'white',
|
273 | icon: null,
|
274 | labelPosition: 'left',
|
275 | content: null,
|
276 | loading: false,
|
277 | children: null
|
278 | };
|
279 | Button$1.propTypes = {
|
280 |
|
281 | children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),
|
282 |
|
283 |
|
284 | size: PropTypes.string,
|
285 |
|
286 |
|
287 | icon: PropTypes.oneOf(IconName),
|
288 |
|
289 |
|
290 | labelPosition: PropTypes.oneOf(['left', 'right']),
|
291 |
|
292 |
|
293 | content: PropTypes.string,
|
294 |
|
295 |
|
296 | iconColor: PropTypes.string,
|
297 |
|
298 |
|
299 | loading: PropTypes.bool
|
300 | };
|
301 | Button$1.displayName = 'Button';
|
302 |
|
303 | function _templateObject$3() {
|
304 | var data = taggedTemplateLiteralLoose(["\n\twidth: ", " !important;\n\theight: ", " !important;\n\tpadding: 0 !important;\n\tbackground-color: ", " !important;\n\tborder-radius: 50% !important;\n\tcursor: ", ";\n\ttext-transform: uppercase !important;\n\n\t&:active,\n\t&:focus {\n\t\tbackground-color: ", " !important;\n\t}\n"]);
|
305 |
|
306 | _templateObject$3 = function _templateObject() {
|
307 | return data;
|
308 | };
|
309 |
|
310 | return data;
|
311 | }
|
312 |
|
313 | var IconButton = function IconButton(_ref) {
|
314 | var icon = _ref.icon,
|
315 | btnSize = _ref.btnSize,
|
316 | iconSize = _ref.iconSize,
|
317 | iconColor = _ref.iconColor,
|
318 | props = objectWithoutPropertiesLoose(_ref, ["icon", "btnSize", "iconSize", "iconColor"]);
|
319 |
|
320 | return React.createElement(IconButtonStyled, _extends_1({}, props, {
|
321 | btnSize: btnSize
|
322 | }), React.createElement(Icon$1, {
|
323 | color: iconColor,
|
324 | size: iconSize,
|
325 | icon: icon
|
326 | }));
|
327 | };
|
328 |
|
329 |
|
330 |
|
331 |
|
332 |
|
333 |
|
334 |
|
335 | var IconButtonStyled = styled(function (_ref2) {
|
336 | var btnSize = _ref2.btnSize,
|
337 | props = objectWithoutPropertiesLoose(_ref2, ["btnSize"]);
|
338 |
|
339 | return React.createElement(Button, props);
|
340 | })(_templateObject$3(), function (_ref3) {
|
341 | var btnSize = _ref3.btnSize;
|
342 | return btnSize;
|
343 | }, function (_ref4) {
|
344 | var btnSize = _ref4.btnSize;
|
345 | return btnSize;
|
346 | }, function (_ref5) {
|
347 | var theme = _ref5.theme;
|
348 | return theme.buttons.bg;
|
349 | }, function (_ref6) {
|
350 | var disabled = _ref6.disabled;
|
351 | return disabled ? 'not-allowed' : 'pointer';
|
352 | }, function (_ref7) {
|
353 | var theme = _ref7.theme;
|
354 | return theme.buttons.activeBg;
|
355 | });
|
356 | IconButtonStyled.displayName = 'IconButtonStyled';
|
357 | IconButton.defaultProps = {
|
358 | iconSize: 'small',
|
359 | btnSize: '24px',
|
360 | iconColor: 'white'
|
361 | };
|
362 | IconButton.propTypes = {
|
363 |
|
364 | icon: PropTypes.oneOf(IconName).isRequired,
|
365 |
|
366 |
|
367 | iconColor: PropTypes.string,
|
368 |
|
369 |
|
370 | iconSize: PropTypes.string,
|
371 |
|
372 |
|
373 | btnSize: PropTypes.string
|
374 | };
|
375 | IconButton.displayName = 'IconButton';
|
376 |
|
377 | function _templateObject$4() {
|
378 | var data = taggedTemplateLiteralLoose(["\n\tpadding: 0 !important;\n\tborder-radius: 0 !important;\n\tborder-bottom: 1px solid ", " !important;\n\tappearance: none !important;\n\tbackground: transparent !important;\n\t&:hover,\n\t&:focus {\n\t\tcolor: ", " !important;\n\t\toutline: 0 !important;\n\t}\n"]);
|
379 |
|
380 | _templateObject$4 = function _templateObject() {
|
381 | return data;
|
382 | };
|
383 |
|
384 | return data;
|
385 | }
|
386 | var Link = styled(function (_ref) {
|
387 | var disabled = _ref.disabled,
|
388 | props = objectWithoutPropertiesLoose(_ref, ["disabled"]);
|
389 |
|
390 | return React.createElement(ButtonText, _extends_1({
|
391 | color: disabled ? 'strokeGray' : 'activeBlue'
|
392 | }, props));
|
393 | })(_templateObject$4(), function (_ref2) {
|
394 | var theme = _ref2.theme,
|
395 | disabled = _ref2.disabled;
|
396 | return disabled ? theme.colors.strokeGray : theme.colors.deepBlue;
|
397 | }, function (_ref3) {
|
398 | var theme = _ref3.theme,
|
399 | disabled = _ref3.disabled;
|
400 | return disabled ? theme.colors.strokeGray : theme.colors.deepBlue;
|
401 | });
|
402 | Link.defaultProps = {
|
403 | disabled: false
|
404 | };
|
405 | Link.propTypes = {
|
406 |
|
407 | disabled: PropTypes.bool
|
408 | };
|
409 | Link.displayName = 'Link';
|
410 |
|
411 | var ButtonLink = function ButtonLink(_ref) {
|
412 | var size = _ref.size,
|
413 | props = objectWithoutPropertiesLoose(_ref, ["size"]);
|
414 |
|
415 | return React.createElement(Button, _extends_1({
|
416 | as: function as(linkProps) {
|
417 | return React.createElement(Link, _extends_1({
|
418 | size: size
|
419 | }, linkProps));
|
420 | }
|
421 | }, props));
|
422 | };
|
423 |
|
424 | ButtonLink.defaultProps = {
|
425 | size: 'lg'
|
426 | };
|
427 | ButtonLink.propTypes = {
|
428 |
|
429 | size: PropTypes.string
|
430 | };
|
431 | ButtonLink.displayName = 'ButtonLink';
|
432 |
|
433 | function _templateObject$5() {
|
434 | var data = taggedTemplateLiteralLoose(["\n\tpadding: 8px 16px;\n\tbackground: ", ";\n\tborder-width: 0;\n\tborder-bottom-left-radius: 16px;\n\tborder-bottom-right-radius: 16px;\n\tbox-shadow: ", ";\n\tcolor: ", ";\n\tcursor: ", ";\n\tfont-size: 14px;\n\ttext-transform: uppercase;\n\tuser-select: none;\n\n\t:active {\n\t\tbox-shadow: ", ";\n\t\toutline: none;\n\t}\n"]);
|
435 |
|
436 | _templateObject$5 = function _templateObject() {
|
437 | return data;
|
438 | };
|
439 |
|
440 | return data;
|
441 | }
|
442 | var TopButtonStyled = styled.button(_templateObject$5(), function (_ref) {
|
443 | var theme = _ref.theme,
|
444 | disabled = _ref.disabled;
|
445 | return disabled ? theme.colors.strokeGray : theme.colors.jellyfish;
|
446 | }, function (_ref2) {
|
447 | var disabled = _ref2.disabled;
|
448 | return disabled ? 'none' : '0px 2px 6px rgba(0, 0, 0, 0.25)';
|
449 | }, function (_ref3) {
|
450 | var disabled = _ref3.disabled,
|
451 | theme = _ref3.theme;
|
452 | return disabled ? theme.colors.gray : 'white';
|
453 | }, function (_ref4) {
|
454 | var disabled = _ref4.disabled;
|
455 | return disabled ? 'not-allowed' : 'pointer';
|
456 | }, function (_ref5) {
|
457 | var disabled = _ref5.disabled;
|
458 | return disabled ? 'none' : '0px 2px 4px rgba(0, 0, 0, 0.25)';
|
459 | });
|
460 |
|
461 | var TopButton = function TopButton(props) {
|
462 | return React.createElement(TopButtonStyled, props);
|
463 | };
|
464 |
|
465 | TopButton.defaultProps = {
|
466 | children: 'Apply'
|
467 | };
|
468 | TopButton.propTypes = {
|
469 |
|
470 | children: PropTypes.string
|
471 | };
|
472 | TopButton.displayName = 'TopButton';
|
473 |
|
474 | function _templateObject$6() {
|
475 | var data = taggedTemplateLiteralLoose(["\n\tpadding: 8px;\n\tfont-size: 16px;\n\tline-height: 19px;\n\tborder: ", ";\n\tborder-radius: 4px;\n\tbackground-color: ", ";\n\tcolor: ", ";\n\tcursor: pointer;\n\toutline: none;\n"]);
|
476 |
|
477 | _templateObject$6 = function _templateObject() {
|
478 | return data;
|
479 | };
|
480 |
|
481 | return data;
|
482 | }
|
483 |
|
484 | var SelectButton = function SelectButton(props) {
|
485 | return React.createElement(SelectButtonStyled, _extends_1({
|
486 | type: "button"
|
487 | }, props));
|
488 | };
|
489 |
|
490 | var SelectButtonStyled = styled.button(_templateObject$6(), function (_ref) {
|
491 | var theme = _ref.theme,
|
492 | selected = _ref.selected,
|
493 | backgroundColor = _ref.backgroundColor;
|
494 | return "1px solid " + (selected ? backgroundColor || theme.colors.deepBlue : theme.colors.strokeGray);
|
495 | }, function (_ref2) {
|
496 | var theme = _ref2.theme,
|
497 | selected = _ref2.selected,
|
498 | backgroundColor = _ref2.backgroundColor;
|
499 | return selected ? backgroundColor || theme.colors.deepBlue : theme.colors.white;
|
500 | }, function (_ref3) {
|
501 | var theme = _ref3.theme,
|
502 | selected = _ref3.selected,
|
503 | colorText = _ref3.colorText;
|
504 | return selected ? theme.colors.white : colorText || theme.colors.gray;
|
505 | });
|
506 | SelectButton.defaultProps = {
|
507 | selected: false
|
508 | };
|
509 | SelectButton.displayName = 'SelectButton';
|
510 | SelectButton.propTypes = {
|
511 | selected: PropTypes.bool
|
512 | };
|
513 |
|
514 | function _templateObject$7() {
|
515 | var data = taggedTemplateLiteralLoose(["\n\twidth: 100%;\n\n\tbutton {\n\t\tborder-radius: 0;\n\t\twidth: ", ";\n\t}\n\n\tbutton:first-child {\n\t\tborder-radius: 4px 0px 0px 4px;\n\t}\n\n\tbutton:last-child {\n\t\tborder-radius: 0px 4px 4px 0px;\n\t}\n"]);
|
516 |
|
517 | _templateObject$7 = function _templateObject() {
|
518 | return data;
|
519 | };
|
520 |
|
521 | return data;
|
522 | }
|
523 |
|
524 | var SelectGroupButton = function SelectGroupButton(_ref) {
|
525 | var children = _ref.children,
|
526 | childWidth = _ref.childWidth,
|
527 | props = objectWithoutPropertiesLoose(_ref, ["children", "childWidth"]);
|
528 |
|
529 | return React.createElement(SelectGroupButtonWrapper, _extends_1({
|
530 | childWidth: childWidth
|
531 | }, props), children);
|
532 | };
|
533 |
|
534 | var SelectGroupButtonWrapper = styled.div(_templateObject$7(), function (_ref2) {
|
535 | var childWidth = _ref2.childWidth;
|
536 | return childWidth;
|
537 | });
|
538 | SelectGroupButton.defaultProps = {
|
539 | childWidth: '178px'
|
540 | };
|
541 | SelectGroupButton.propTypes = {
|
542 |
|
543 | children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
|
544 |
|
545 |
|
546 | childWidth: PropTypes.string
|
547 | };
|
548 | SelectGroupButton.displayName = 'SelectGroupButton';
|
549 | SelectGroupButtonWrapper.displayName = 'SelectGroupButtonWrapper';
|
550 |
|
551 | var colors = {
|
552 | white: '#FFFFFF',
|
553 | black: '#424242',
|
554 |
|
555 | deepBlue: '#0D0CB5',
|
556 | activeBlue: '#005BEA',
|
557 | purple: '#4E2F60',
|
558 |
|
559 | yellow: '#FBB03B',
|
560 | orange: '#EC8222',
|
561 | red: '#CF0A2C',
|
562 | darkRed: '#A21D21',
|
563 | lightBlue: '#DAEDFF',
|
564 | malibu: '#63BDE9',
|
565 | pacificBlue: '#1692CE',
|
566 | green: '#3EC28F',
|
567 | lightGreen: '#95C623',
|
568 | purpleHeart: '#6A11CB',
|
569 | ultraMarine: '#0D0CB5',
|
570 | oliveDrab: '#679009',
|
571 | mariner: '#4265AA',
|
572 | summerSky: '#36A8DF',
|
573 | whisper: '#ECECEC',
|
574 |
|
575 | darkGray: '#424242',
|
576 | mediumGray: '#6A6A6A',
|
577 | gray: '#B8B8B8',
|
578 | strokeGray: '#DDDDDD',
|
579 | lightGray: '#F3F3F3',
|
580 |
|
581 | blueOcean: 'linear-gradient(90deg,#0D0CB5 0%,rgba(255, 255, 255, 0) 100%),#2681E0',
|
582 | wine: 'linear-gradient(90deg,#4E2F60 0%,rgba(255, 255, 255, 0) 100%),#852D91',
|
583 | jellyfish: 'linear-gradient(90deg,#6A11CB 0%,rgba(255,255,255,0) 100%),#2575FC'
|
584 | };
|
585 |
|
586 | var SPACE_UNIT = 1;
|
587 | var theme = {
|
588 | name: 'DEFAULT',
|
589 | colors: colors,
|
590 | borderRadius: '0',
|
591 | navbar: {
|
592 | backgroundColor: colors.darkRed
|
593 | },
|
594 | buttons: {
|
595 | borderRadius: '16px',
|
596 | bg: colors.activeBlue,
|
597 | activeBg: colors.deepBlue,
|
598 | text: colors.white,
|
599 | dropdown: {
|
600 | separatorColor: colors.gray,
|
601 | activeBackgroundColor: colors.gray
|
602 | }
|
603 | },
|
604 | list: {
|
605 | pairCell: colors.lightGray,
|
606 | unPairCell: colors.white,
|
607 | title: colors.black,
|
608 | additionalInfo: colors.gray,
|
609 | activeCell: colors.lightBlue,
|
610 | boxShadow: '0 3px 3px rgba(0, 0, 0, 0.25)'
|
611 | },
|
612 | span: {
|
613 | defaultColor: colors.activeBlue,
|
614 | negative: colors.red,
|
615 | positive: colors.green,
|
616 | primary: colors.activeBlue
|
617 | },
|
618 | block: {
|
619 | borderRadius: '0',
|
620 | backgroundColor: colors.darkRed,
|
621 | labelColor: colors.darkGray,
|
622 | color: colors.darkGray
|
623 | },
|
624 | input: {
|
625 | borderRadius: '0'
|
626 | },
|
627 | select: {
|
628 | borderRadius: '4px',
|
629 | placeholderColor: colors.darkGray,
|
630 | focusedBackgroundColor: colors.whisper,
|
631 | selectedBackgroundColor: colors.activeBlue,
|
632 | menuPadding: '5px 10px 5px 10px'
|
633 | },
|
634 | toggle: {
|
635 | color: colors.green
|
636 | },
|
637 | timePicker: {
|
638 | errorColor: colors.red,
|
639 | disabledColor: colors.lightGray,
|
640 | primaryColor: colors.activeBlue,
|
641 | activeColor: colors.deepBlue,
|
642 | hoverColor: colors.lightGray,
|
643 | textColor: colors.darkGray
|
644 | },
|
645 | numberSpinner: {
|
646 | errorColor: colors.red,
|
647 | disabledColor: colors.lightGray,
|
648 | disabledColorText: colors.gray,
|
649 | primaryColor: colors.activeBlue,
|
650 | activeColor: colors.deepBlue,
|
651 | hoverColor: colors.lightGray,
|
652 | textColor: colors.darkGray,
|
653 | borderColor: colors.white
|
654 | },
|
655 | toast: {
|
656 | titleColor: colors.darkGray,
|
657 | messageColor: colors.mediumGray,
|
658 | errorColor: colors.red,
|
659 | successColor: colors.green,
|
660 | warningColor: colors.yellow
|
661 | },
|
662 | passwordStrengthMeter: {
|
663 | none: colors.strokeGray,
|
664 | bad: colors.red,
|
665 | medium: colors.yellow,
|
666 | good: colors.lightGreen,
|
667 | excellent: colors.green
|
668 | },
|
669 | status: {
|
670 | bg: {
|
671 | success: colors.green,
|
672 | error: colors.red,
|
673 | info: colors.lightBlue,
|
674 | blocked: colors.jellyfish
|
675 | },
|
676 | color: {
|
677 | success: colors.white,
|
678 | error: colors.white,
|
679 | info: colors.darkGray,
|
680 | blocked: colors.white
|
681 | }
|
682 | },
|
683 | bulletState: {
|
684 | colors: {
|
685 | on: colors.green,
|
686 | away: colors.yellow,
|
687 | off: colors.red
|
688 | }
|
689 | },
|
690 | inputRange: {
|
691 | borderColor: colors.strokeGray,
|
692 | backgroundThumbColor: colors.white,
|
693 | gradient: function gradient(value) {
|
694 | return "linear-gradient(90deg, " + colors.purpleHeart + " 0%, " + colors.ultraMarine + " " + value + "%, " + colors.strokeGray + " " + value + "%, " + colors.strokeGray + " 100%)";
|
695 | }
|
696 | },
|
697 | gradeDropdown: {
|
698 | veryHigh: colors.darkRed,
|
699 | high: colors.orange,
|
700 | normal: colors.yellow,
|
701 | low: colors.green,
|
702 | veryLow: colors.activeBlue
|
703 | },
|
704 | label: {
|
705 | defaultColor: colors.activeBlue
|
706 | },
|
707 | listCard: {
|
708 | defaultBorder: colors.strokeGray,
|
709 | errorBorder: colors.red
|
710 | },
|
711 | dndList: {
|
712 | active: colors.activeBlue,
|
713 | dragOver: colors.lightBlue
|
714 | },
|
715 | space: {
|
716 | xxs: SPACE_UNIT * 0.25 + "em",
|
717 | xs: SPACE_UNIT * 0.5 + "em",
|
718 | sm: SPACE_UNIT * 0.75 + "em",
|
719 | md: SPACE_UNIT * 1.25 + "em",
|
720 | lg: SPACE_UNIT * 2 + "em",
|
721 | xl: SPACE_UNIT * 3.25 + "em",
|
722 | xxl: SPACE_UNIT * 5.25 + "em"
|
723 | },
|
724 | text: {
|
725 | sm: {
|
726 | font: 12,
|
727 | line: 14
|
728 | },
|
729 | md: {
|
730 | font: 13,
|
731 | line: 15
|
732 | },
|
733 | lg: {
|
734 | font: 15,
|
735 | line: 18
|
736 | },
|
737 | xl: {
|
738 | font: 18,
|
739 | line: 21
|
740 | },
|
741 | xxl: {
|
742 | font: 22,
|
743 | line: 26
|
744 | }
|
745 | }
|
746 | };
|
747 |
|
748 | var colorLuminance = (function (hex, lum) {
|
749 | if (lum === void 0) {
|
750 | lum = 0;
|
751 | }
|
752 |
|
753 | var rgb = '#';
|
754 | var c;
|
755 | hex.slice(1).match(/.{1,2}/g).forEach(function (element) {
|
756 | c = parseInt(element, 16);
|
757 | c = Math.round(Math.min(Math.max(0, c + c * lum), 255)).toString(16);
|
758 | rgb += ("00" + c).substr(c.length);
|
759 | });
|
760 | return rgb;
|
761 | });
|
762 |
|
763 | function _templateObject$8() {
|
764 | var data = taggedTemplateLiteralLoose(["\n\tbackground-position: center;\n\ttransition: background 0.8s;\n\tuser-select: none;\n\tcursor: pointer;\n\n\t:hover {\n\t\tbackground: ", "\n\t\t\tradial-gradient(circle, transparent 1%, ", " 1%) center/15000%;\n\t}\n\n\t:active {\n\t\tbackground-color: ", ";\n\t\tbackground-size: 100%;\n\t\ttransition: background 0s;\n\t}\n"]);
|
765 |
|
766 | _templateObject$8 = function _templateObject() {
|
767 | return data;
|
768 | };
|
769 |
|
770 | return data;
|
771 | }
|
772 | var Ripple = styled.div(_templateObject$8(), function (_ref) {
|
773 | var color = _ref.color;
|
774 | return colorLuminance(color, 0.1);
|
775 | }, function (_ref2) {
|
776 | var color = _ref2.color;
|
777 | return colorLuminance(color, 0.1);
|
778 | }, function (_ref3) {
|
779 | var color = _ref3.color;
|
780 | return colorLuminance(color, 0.3);
|
781 | });
|
782 | Ripple.propTypes = {
|
783 |
|
784 | color: PropTypes.string.isRequired
|
785 | };
|
786 | Ripple.displayName = 'Ripple';
|
787 |
|
788 | function _templateObject3() {
|
789 | var data = taggedTemplateLiteralLoose(["\n\tpadding-left: 18px;\n"]);
|
790 |
|
791 | _templateObject3 = function _templateObject3() {
|
792 | return data;
|
793 | };
|
794 |
|
795 | return data;
|
796 | }
|
797 |
|
798 | function _templateObject2$1() {
|
799 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\twidth: 68px;\n\theight: 100%;\n\talign-items: center;\n\tjustify-content: center;\n\n\tbackground: ", ";\n\tborder-radius: 3px 0 0 3px;\n\tcolor: ", ";\n"]);
|
800 |
|
801 | _templateObject2$1 = function _templateObject2() {
|
802 | return data;
|
803 | };
|
804 |
|
805 | return data;
|
806 | }
|
807 |
|
808 | function _templateObject$9() {
|
809 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tmin-width: 200px;\n\tmax-width: ", ";\n\theight: 68px;\n\n\talign-items: center;\n\n\tbackground-color: ", ";\n\tborder-radius: 3px;\n\tbox-shadow: 0 0 8px rgba(0, 0, 0, 0.15);\n\n\tcolor: ", ";\n\tfont-size: 35px;\n\toutline: none;\n"]);
|
810 |
|
811 | _templateObject$9 = function _templateObject() {
|
812 | return data;
|
813 | };
|
814 |
|
815 | return data;
|
816 | }
|
817 |
|
818 | var GenerateButton = function GenerateButton(_ref) {
|
819 | var children = _ref.children,
|
820 | onClick = _ref.onClick,
|
821 | boldContent = _ref.boldContent,
|
822 | bgColor = _ref.bgColor,
|
823 | fullWidth = _ref.fullWidth,
|
824 | props = objectWithoutPropertiesLoose(_ref, ["children", "onClick", "boldContent", "bgColor", "fullWidth"]);
|
825 |
|
826 | return React.createElement(GenerateButtonStyled, _extends_1({
|
827 | fullWidth: fullWidth,
|
828 | color: theme.colors.strokeGray,
|
829 | onClick: onClick
|
830 | }, props), boldContent && React.createElement(BoldContentWrapper, {
|
831 | bgColor: bgColor
|
832 | }, boldContent), React.createElement(Content, null, children));
|
833 | };
|
834 |
|
835 | var GenerateButtonStyled = styled(Ripple)(_templateObject$9(), function (_ref2) {
|
836 | var fullWidth = _ref2.fullWidth;
|
837 | return fullWidth ? '100%' : '340px';
|
838 | }, function (_ref3) {
|
839 | var theme$$1 = _ref3.theme;
|
840 | return theme$$1.colors.white;
|
841 | }, function (_ref4) {
|
842 | var theme$$1 = _ref4.theme;
|
843 | return theme$$1.colors.darkGray;
|
844 | });
|
845 | var BoldContentWrapper = styled.div(_templateObject2$1(), function (_ref5) {
|
846 | var bgColor = _ref5.bgColor;
|
847 | return bgColor;
|
848 | }, function (_ref6) {
|
849 | var theme$$1 = _ref6.theme;
|
850 | return theme$$1.colors.white;
|
851 | });
|
852 | var Content = styled.div(_templateObject3());
|
853 | GenerateButton.defaultProps = {
|
854 | boldContent: '',
|
855 | bgColor: theme.colors.red,
|
856 | fullWidth: false
|
857 | };
|
858 | GenerateButton.propTypes = {
|
859 |
|
860 | onClick: PropTypes.func.isRequired,
|
861 |
|
862 |
|
863 | boldContent: PropTypes.string,
|
864 |
|
865 |
|
866 | bgColor: PropTypes.string,
|
867 |
|
868 |
|
869 | fullWidth: PropTypes.bool,
|
870 |
|
871 |
|
872 | children: PropTypes.string.isRequired
|
873 | };
|
874 | GenerateButton.displayName = 'GenerateButton';
|
875 |
|
876 | function _templateObject2$2() {
|
877 | var data = taggedTemplateLiteralLoose(["\n\tcolor: ", ";\n"]);
|
878 |
|
879 | _templateObject2$2 = function _templateObject2() {
|
880 | return data;
|
881 | };
|
882 |
|
883 | return data;
|
884 | }
|
885 |
|
886 | function _templateObject$a() {
|
887 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tmin-width: 200px;\n\twidth: ", ";\n\theight: ", ";\n\n\talign-items: center;\n\tjustify-content: center;\n\n\tbackground-color: ", ";\n\n\tfont-size: 28px;\n\tbox-shadow: 0px 0px 8px rgba(0, 0, 0, 0.15);\n\tborder-radius: 4px;\n"]);
|
888 |
|
889 | _templateObject$a = function _templateObject() {
|
890 | return data;
|
891 | };
|
892 |
|
893 | return data;
|
894 | }
|
895 |
|
896 | var SquareButton = function SquareButton(_ref) {
|
897 | var children = _ref.children,
|
898 | onClick = _ref.onClick,
|
899 | width = _ref.width,
|
900 | height = _ref.height,
|
901 | bgColor = _ref.bgColor,
|
902 | textColor = _ref.textColor,
|
903 | props = objectWithoutPropertiesLoose(_ref, ["children", "onClick", "width", "height", "bgColor", "textColor"]);
|
904 |
|
905 | return React.createElement(SquareButtonStyled, _extends_1({
|
906 | onClick: onClick,
|
907 | width: width,
|
908 | height: height,
|
909 | bgColor: bgColor,
|
910 | color: bgColor || theme.colors.strokeGray
|
911 | }, props), React.createElement(Content$1, {
|
912 | textColor: textColor
|
913 | }, children));
|
914 | };
|
915 |
|
916 | var SquareButtonStyled = styled(Ripple)(_templateObject$a(), function (_ref2) {
|
917 | var width = _ref2.width;
|
918 | return width;
|
919 | }, function (_ref3) {
|
920 | var height = _ref3.height;
|
921 | return height;
|
922 | }, function (_ref4) {
|
923 | var bgColor = _ref4.bgColor,
|
924 | theme$$1 = _ref4.theme;
|
925 | return bgColor || theme$$1.colors.white;
|
926 | });
|
927 | var Content$1 = styled.div(_templateObject2$2(), function (_ref5) {
|
928 | var textColor = _ref5.textColor;
|
929 | return textColor;
|
930 | });
|
931 | SquareButton.defaultProps = {
|
932 | width: '427px',
|
933 | height: '68px',
|
934 | bgColor: undefined,
|
935 | textColor: theme.colors.darkGray
|
936 | };
|
937 | SquareButton.propTypes = {
|
938 |
|
939 | onClick: PropTypes.func.isRequired,
|
940 |
|
941 |
|
942 | width: PropTypes.string,
|
943 |
|
944 |
|
945 | height: PropTypes.string,
|
946 |
|
947 |
|
948 | bgColor: PropTypes.string,
|
949 |
|
950 |
|
951 | textColor: PropTypes.string,
|
952 |
|
953 |
|
954 | children: PropTypes.string.isRequired
|
955 | };
|
956 | SquareButton.displayName = 'SquareButton';
|
957 |
|
958 | function _inheritsLoose(subClass, superClass) {
|
959 | subClass.prototype = Object.create(superClass.prototype);
|
960 | subClass.prototype.constructor = subClass;
|
961 | subClass.__proto__ = superClass;
|
962 | }
|
963 |
|
964 | var inheritsLoose = _inheritsLoose;
|
965 |
|
966 | function _templateObject$b() {
|
967 | var data = taggedTemplateLiteralLoose(["\n\tbackground-color: ", " !important;\n\tbox-shadow: 0 2px 3px rgba(0, 0, 0, 0.4) !important;\n\n\t& .item {\n\t\tcolor: #fff !important;\n\t}\n\n\t&&& a.active.item {\n\t\tborder-color: #fff !important;\n\t\tfont-weight: 700;\n\t}\n\n\t&&& a.item:hover {\n\t\tborder-color: #fff !important;\n\t\tfont-weight: 700;\n\t}\n"]);
|
968 |
|
969 | _templateObject$b = function _templateObject() {
|
970 | return data;
|
971 | };
|
972 |
|
973 | return data;
|
974 | }
|
975 |
|
976 | var MenuExtended =
|
977 |
|
978 | function (_SemanticUIMenu) {
|
979 | inheritsLoose(MenuExtended, _SemanticUIMenu);
|
980 |
|
981 | function MenuExtended() {
|
982 | return _SemanticUIMenu.apply(this, arguments) || this;
|
983 | }
|
984 |
|
985 | return MenuExtended;
|
986 | }(Menu);
|
987 |
|
988 | MenuExtended.propTypes = _extends_1({}, Menu.propTypes, {
|
989 | color: PropTypes.string.isRequired
|
990 | |
991 |
|
992 |
|
993 |
|
994 |
|
995 | });
|
996 | var Navbar = styled(MenuExtended)(_templateObject$b(), function (_ref) {
|
997 | var color = _ref.color;
|
998 | return color;
|
999 | });
|
1000 | Navbar.propTypes = {
|
1001 |
|
1002 | color: PropTypes.string.isRequired
|
1003 | };
|
1004 | Navbar.displayName = 'Navbar';
|
1005 |
|
1006 | function _templateObject$c() {
|
1007 | var data = taggedTemplateLiteralLoose(["\n\tborder-color: #cccccc !important;\n\n\t.active.item {\n\t\tborder-color: ", " !important;\n\t\tcolor: ", " !important;\n\t}\n\n\t.item {\n\t\tpadding: 8px 12px !important;\n\t\tcolor: #cccccc !important;\n\t\tfont-size: 15px !important;\n\t}\n"]);
|
1008 |
|
1009 | _templateObject$c = function _templateObject() {
|
1010 | return data;
|
1011 | };
|
1012 |
|
1013 | return data;
|
1014 | }
|
1015 |
|
1016 | var Tabs = function Tabs(_ref) {
|
1017 | var panes = _ref.panes,
|
1018 | props = objectWithoutPropertiesLoose(_ref, ["panes"]);
|
1019 |
|
1020 | return React.createElement(TabStyled, _extends_1({
|
1021 | menu: {
|
1022 | secondary: true,
|
1023 | pointing: true
|
1024 | },
|
1025 | panes: panes
|
1026 | }, props));
|
1027 | };
|
1028 |
|
1029 | var TabStyled = styled(Tab)(_templateObject$c(), function (_ref2) {
|
1030 | var theme = _ref2.theme;
|
1031 | return theme.colors.activeBlue;
|
1032 | }, function (_ref3) {
|
1033 | var theme = _ref3.theme;
|
1034 | return theme.colors.activeBlue;
|
1035 | });
|
1036 |
|
1037 | function _assertThisInitialized(self) {
|
1038 | if (self === void 0) {
|
1039 | throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
1040 | }
|
1041 |
|
1042 | return self;
|
1043 | }
|
1044 |
|
1045 | var assertThisInitialized = _assertThisInitialized;
|
1046 |
|
1047 | function _defineProperty(obj, key, value) {
|
1048 | if (key in obj) {
|
1049 | Object.defineProperty(obj, key, {
|
1050 | value: value,
|
1051 | enumerable: true,
|
1052 | configurable: true,
|
1053 | writable: true
|
1054 | });
|
1055 | } else {
|
1056 | obj[key] = value;
|
1057 | }
|
1058 |
|
1059 | return obj;
|
1060 | }
|
1061 |
|
1062 | var defineProperty = _defineProperty;
|
1063 |
|
1064 | var _ref =
|
1065 |
|
1066 | React.createElement("path", {
|
1067 | d: "M93.262 36.578c-.14.14-.376.235-.663.235-.308 0-.56-.067-.802-.381v.347h-.286v-3.99h.286v1.637c.241-.314.494-.381.802-.381.287 0 .522.095.663.235.275.274.347.723.347 1.149 0 .425-.072.874-.347 1.149zm-.702-2.281c-.662 0-.763.571-.763 1.132 0 .56.101 1.132.763 1.132s.763-.572.763-1.132c0-.56-.1-1.132-.763-1.132zM94.888 37.826c-.135.129-.331.174-.51.174h-.135v-.252h.106c.309 0 .399-.101.494-.37l.219-.6-.988-2.701h.315l.813 2.365.814-2.365h.314l-1.257 3.435a.713.713 0 0 1-.185.314zM100.886 36.958l-.399-.398c-.23.162-.522.252-.836.252a1.43 1.43 0 0 1-1.049-.426c-.393-.392-.387-.835-.387-1.603 0-.767-.006-1.21.387-1.602a1.43 1.43 0 0 1 1.05-.426c.426 0 .779.151 1.054.426.393.392.382.835.382 1.602 0 .679.005 1.093-.258 1.452l.392.386-.336.337zm-.64-3.413a.815.815 0 0 0-.595-.247.815.815 0 0 0-.594.247c-.197.213-.236.437-.236 1.238 0 .802.039 1.026.236 1.239.14.151.359.247.594.247a.699.699 0 0 0 .41-.13l-.42-.42.336-.336.387.387c.101-.202.118-.47.118-.986 0-.802-.04-1.026-.236-1.239zM101.839 35.49v-.533h1.638v.533h-1.638zM105.99 36.779h-1.616v-3.99h1.555c.74 0 1.206.42 1.206 1.092 0 .432-.269.74-.539.847.309.123.601.42.601.924 0 .734-.5 1.127-1.207 1.127zm-.112-3.447h-.898v1.143h.898c.387 0 .651-.202.651-.571 0-.37-.264-.572-.651-.572zm.056 1.687h-.954v1.216h.954c.421 0 .657-.258.657-.61 0-.354-.236-.606-.657-.606zM108.448 35.523c0 .488.258.796.724.796.319 0 .488-.09.69-.292l.364.342c-.291.292-.566.443-1.066.443-.712 0-1.279-.375-1.279-1.457 0-.92.477-1.451 1.206-1.451.764 0 1.207.56 1.207 1.367v.252h-1.846zm1.2-.785a.585.585 0 0 0-.561-.358.593.593 0 0 0-.566.358.89.89 0 0 0-.073.387h1.279a.888.888 0 0 0-.079-.386zM111.898 36.778c-.533 0-.78-.38-.78-.79v-1.563h-.325v-.438h.325v-.863h.572v.863h.55v.438h-.55v1.535c0 .207.101.33.315.33h.235v.488h-.342zM113.817 36.778c-.533 0-.78-.38-.78-.79v-1.563h-.326v-.438h.326v-.863h.572v.863h.55v.438h-.55v1.535c0 .207.101.33.314.33h.236v.488h-.342zM115.292 35.523c0 .488.258.796.724.796.319 0 .488-.09.69-.292l.365.342c-.292.292-.567.443-1.066.443-.713 0-1.28-.375-1.28-1.457 0-.92.477-1.451 1.207-1.451.763 0 1.206.56 1.206 1.367v.252h-1.846zm1.201-.785a.587.587 0 0 0-.562-.358.594.594 0 0 0-.566.358.89.89 0 0 0-.073.387h1.279a.888.888 0 0 0-.078-.386zM119.46 34.604c-.129-.129-.23-.19-.427-.19-.308 0-.566.246-.566.638v1.726h-.572v-2.84h.561v.307c.145-.201.437-.341.757-.341.275 0 .483.072.679.268l-.432.432z",
|
1068 | fill: "#fff"
|
1069 | });
|
1070 |
|
1071 | var _ref2 =
|
1072 |
|
1073 | React.createElement("path", {
|
1074 | d: "M.986 22.506l12.426 7.018v-3.13l-9.288-5.31v-9.265l-3.138-1.77v12.457z",
|
1075 | fill: "url(#paint0_linear)"
|
1076 | });
|
1077 |
|
1078 | var _ref3 =
|
1079 |
|
1080 | React.createElement("path", {
|
1081 | d: "M22.823 11.793l3.134-1.769L13.5 2.964 1.076 10.047 4.21 11.82l9.291-5.294 9.322 5.268z",
|
1082 | fill: "url(#paint1_linear)"
|
1083 | });
|
1084 |
|
1085 | var _ref4 =
|
1086 |
|
1087 | React.createElement("path", {
|
1088 | d: "M16.487 24.653l-3.075 1.742v3.125l3.075-1.764 3.076-1.767v-3.102l-3.076 1.766z",
|
1089 | fill: "url(#paint2_linear)"
|
1090 | });
|
1091 |
|
1092 | var _ref5 =
|
1093 |
|
1094 | React.createElement("path", {
|
1095 | d: "M25.838 26.015v3.07l3.013-1.794v-3.078l-3.013-1.802V10.024l-3.138 1.77v12.42l3.138 1.801z",
|
1096 | fill: "url(#paint3_linear)"
|
1097 | });
|
1098 |
|
1099 | var _ref6 =
|
1100 |
|
1101 | React.createElement("path", {
|
1102 | d: "M88.524 8.693c-.101 0-.2.005-.301.009v-.009c-2.732 0-5.063.993-6.719 2.67V1.332a1.333 1.333 0 0 0-2.667 0v17.002l.002.003c.035 5.465 3.915 9.46 9.404 9.46v-.008c.094.002.186.008.281.008 5.265 0 9.126-4.03 9.126-9.534 0-5.539-3.826-9.57-9.126-9.57zm-.316 16.51a7.042 7.042 0 0 1-2.837-.579c-2.302-1.049-3.867-3.439-3.867-6.361 0-1.704.467-3.214 1.329-4.39.012-.015.021-.031.032-.046.066-.087.139-.169.21-.252.084-.1.167-.201.257-.295l.061-.06c.136-.137.276-.271.425-.395.003-.004.008-.007.012-.01.155-.13.317-.252.485-.367l.116-.073c.127-.084.258-.165.393-.24.126-.068.256-.131.39-.193.047-.022.092-.046.14-.068.765-.329 1.632-.525 2.589-.575.088-.003.175-.012.265-.012 3.93 0 6.775 2.944 6.775 6.976 0 4.065-2.879 6.94-6.775 6.94zM44.603 27.172c.102 0 .201-.005.302-.009v.009c2.732 0 5.062-.993 6.718-2.67v10.032a1.333 1.333 0 0 0 2.668 0V17.532l-.003-.004c-.034-5.465-3.914-9.46-9.404-9.46v.008c-.093-.002-.185-.008-.28-.008-5.266 0-9.127 4.031-9.127 9.535 0 5.538 3.827 9.57 9.126 9.57zm.316-16.51a7.04 7.04 0 0 1 2.837.58c2.302 1.048 3.867 3.438 3.867 6.36 0 1.704-.467 3.214-1.328 4.39-.012.015-.022.031-.033.046-.066.087-.139.17-.209.253-.085.1-.167.2-.258.295l-.06.06a6.088 6.088 0 0 1-.425.395l-.012.009c-.156.13-.317.252-.485.367-.038.026-.078.049-.116.074a6.08 6.08 0 0 1-.394.239 6.842 6.842 0 0 1-.389.193c-.047.023-.093.046-.141.068-.764.329-1.632.526-2.588.575-.089.003-.176.012-.266.012-3.93 0-6.774-2.944-6.774-6.975 0-4.066 2.878-6.94 6.774-6.94zM72.728 8.062c-.736 0-1.334.597-1.334 1.332V19.98c0 3.12-1.79 5.398-4.949 5.398s-4.948-2.278-4.948-5.398V9.394a1.334 1.334 0 0 0-2.668 0V19.98c0 4.522 3.088 7.817 7.616 7.817s7.617-3.295 7.617-7.817V9.394c0-.735-.598-1.332-1.334-1.332zM120 18.024c0-5.46-3.916-9.442-9.348-9.442-5.503 0-9.454 3.981-9.454 9.407 0 5.672 4.021 9.794 9.595 9.794 3.628 0 7.081-2.064 8.282-4.928a1.51 1.51 0 0 0 .065-.15l.014-.03-.004-.002c.043-.128.071-.263.071-.406 0-.717-.582-1.298-1.299-1.298-.528 0-.969.354-1.165.826l-.002-.001c-.882 2.008-3.458 3.558-6.139 3.558-3.527 0-6.243-2.572-6.667-6.306l16.016.035c.035-.387.035-.74.035-1.057zm-15.98-1.303c.494-3.347 3.069-5.673 6.526-5.673 3.527 0 6.138 2.326 6.632 5.708l-13.158-.035z",
|
1103 | fill: "#fff"
|
1104 | });
|
1105 |
|
1106 | var _ref7 =
|
1107 |
|
1108 | React.createElement("defs", null, React.createElement("linearGradient", {
|
1109 | id: "paint0_linear",
|
1110 | x1: 1.258,
|
1111 | y1: 16.424,
|
1112 | x2: 13.449,
|
1113 | y2: 23.384,
|
1114 | gradientUnits: "userSpaceOnUse"
|
1115 | }, React.createElement("stop", {
|
1116 | stopColor: "#BCBEC0"
|
1117 | }), React.createElement("stop", {
|
1118 | offset: 1,
|
1119 | stopColor: "#fff"
|
1120 | })), React.createElement("linearGradient", {
|
1121 | id: "paint1_linear",
|
1122 | x1: 1.076,
|
1123 | y1: 7.391,
|
1124 | x2: 22.256,
|
1125 | y2: 7.391,
|
1126 | gradientUnits: "userSpaceOnUse"
|
1127 | }, React.createElement("stop", {
|
1128 | stopColor: "#BCBEC0"
|
1129 | }), React.createElement("stop", {
|
1130 | offset: 1,
|
1131 | stopColor: "#fff"
|
1132 | })), React.createElement("linearGradient", {
|
1133 | id: "paint2_linear",
|
1134 | x1: 18.858,
|
1135 | y1: 24.874,
|
1136 | x2: 14.624,
|
1137 | y2: 27.254,
|
1138 | gradientUnits: "userSpaceOnUse"
|
1139 | }, React.createElement("stop", {
|
1140 | stopColor: "#BCBEC0"
|
1141 | }), React.createElement("stop", {
|
1142 | offset: 1,
|
1143 | stopColor: "#fff"
|
1144 | })), React.createElement("linearGradient", {
|
1145 | id: "paint3_linear",
|
1146 | x1: 25.776,
|
1147 | y1: 10.998,
|
1148 | x2: 25.776,
|
1149 | y2: 27.864,
|
1150 | gradientUnits: "userSpaceOnUse"
|
1151 | }, React.createElement("stop", {
|
1152 | stopColor: "#BCBEC0"
|
1153 | }), React.createElement("stop", {
|
1154 | offset: 1,
|
1155 | stopColor: "#fff"
|
1156 | })));
|
1157 |
|
1158 | var QubeLogo = 'data:image/svg+xml,%3Csvg%20width%3D%22120%22%20height%3D%2238%22%20viewBox%3D%220%200%20120%2038%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M93.2616%2036.5776C93.1213%2036.7178%2092.8857%2036.8129%2092.5994%2036.8129C92.2909%2036.8129%2092.0382%2036.7456%2091.7971%2036.4319V36.7792H91.511V32.7894H91.7971V34.4256C92.0382%2034.1117%2092.2909%2034.0446%2092.5994%2034.0446C92.8857%2034.0446%2093.1213%2034.1399%2093.2616%2034.2799C93.5365%2034.5544%2093.6094%2035.0027%2093.6094%2035.4287C93.6094%2035.8545%2093.5365%2036.3028%2093.2616%2036.5776ZM92.5604%2034.2968C91.8982%2034.2968%2091.7972%2034.8682%2091.7972%2035.4287C91.7972%2035.9891%2091.8983%2036.5607%2092.5604%2036.5607C93.2224%2036.5607%2093.3233%2035.9891%2093.3233%2035.4287C93.3233%2034.8682%2093.2222%2034.2968%2092.5604%2034.2968Z%22%20fill%3D%22white%22%2F%3E%3Cpath%20d%3D%22M94.8881%2037.8259C94.7533%2037.9549%2094.5569%2037.9997%2094.3774%2037.9997H94.2427V37.7475H94.3494C94.6579%2037.7475%2094.7478%2037.6466%2094.843%2037.3776L95.062%2036.778L94.0743%2034.0769H94.3886L95.2022%2036.4418L96.0158%2034.0769H96.3301L95.0733%2037.5121C95.0228%2037.6578%2094.9611%2037.7643%2094.8881%2037.8259Z%22%20fill%3D%22white%22%2F%3E%3Cpath%20d%3D%22M100.886%2036.9578L100.487%2036.5599C100.257%2036.7223%2099.9654%2036.8121%2099.6512%2036.8121C99.2248%2036.8121%2098.877%2036.6607%2098.602%2036.3862C98.2092%2035.994%2098.2148%2035.5513%2098.2148%2034.7835C98.2148%2034.0156%2098.2092%2033.573%2098.602%2033.1806C98.877%2032.9061%2099.2248%2032.7549%2099.6512%2032.7549C100.078%2032.7549%20100.431%2032.9061%20100.706%2033.1806C101.099%2033.5728%20101.088%2034.0156%20101.088%2034.7835C101.088%2035.4616%20101.093%2035.8762%20100.83%2036.235L101.222%2036.6215L100.886%2036.9578ZM100.246%2033.545C100.106%2033.3936%2099.8869%2033.2983%2099.6512%2033.2983C99.4157%2033.2983%2099.1967%2033.3936%2099.0566%2033.545C98.86%2033.758%2098.8208%2033.9821%2098.8208%2034.7835C98.8208%2035.5847%2098.86%2035.8089%2099.0566%2036.0219C99.1967%2036.1732%2099.4157%2036.2686%2099.6512%2036.2686C99.8028%2036.2686%2099.943%2036.2237%20100.061%2036.1397L99.6401%2035.7195L99.9767%2035.3832L100.364%2035.7699C100.465%2035.5681%20100.482%2035.2991%20100.482%2034.7836C100.482%2033.9821%20100.442%2033.758%20100.246%2033.545Z%22%20fill%3D%22white%22%2F%3E%3Cpath%20d%3D%22M101.839%2035.4897V34.9573H103.477V35.4897H101.839Z%22%20fill%3D%22white%22%2F%3E%3Cpath%20d%3D%22M105.99%2036.7786H104.374V32.7887H105.929C106.669%2032.7887%20107.135%2033.2089%20107.135%2033.8813C107.135%2034.3127%20106.866%2034.6212%20106.596%2034.7276C106.905%2034.8507%20107.197%2035.1478%20107.197%2035.6522C107.197%2036.3864%20106.697%2036.7786%20105.99%2036.7786ZM105.878%2033.3322H104.98V34.4754H105.878C106.265%2034.4754%20106.529%2034.2735%20106.529%2033.9038C106.529%2033.534%20106.265%2033.3322%20105.878%2033.3322ZM105.934%2035.019H104.98V36.235H105.934C106.355%2036.235%20106.591%2035.9771%20106.591%2035.6242C106.591%2035.2712%20106.355%2035.019%20105.934%2035.019Z%22%20fill%3D%22white%22%2F%3E%3Cpath%20d%3D%22M108.448%2035.5231C108.448%2036.0106%20108.706%2036.3188%20109.172%2036.3188C109.491%2036.3188%20109.66%2036.2292%20109.862%2036.0274L110.226%2036.3692C109.935%2036.6606%20109.66%2036.812%20109.16%2036.812C108.448%2036.812%20107.881%2036.4365%20107.881%2035.355C107.881%2034.4359%20108.358%2033.9035%20109.087%2033.9035C109.851%2033.9035%20110.294%2034.4638%20110.294%2035.2707V35.5229H108.448V35.5231ZM109.648%2034.7385C109.559%2034.5255%20109.357%2034.3798%20109.087%2034.3798C108.818%2034.3798%20108.61%2034.5255%20108.521%2034.7385C108.465%2034.8673%20108.453%2034.9515%20108.448%2035.1252H109.727C109.721%2034.9514%20109.705%2034.8673%20109.648%2034.7385Z%22%20fill%3D%22white%22%2F%3E%3Cpath%20d%3D%22M111.898%2036.7781C111.365%2036.7781%20111.118%2036.3971%20111.118%2035.988V34.4245H110.793V33.9872H111.118V33.1242H111.69V33.9872H112.24V34.4245H111.69V35.9599C111.69%2036.1672%20111.791%2036.2906%20112.005%2036.2906H112.24V36.7781H111.898Z%22%20fill%3D%22white%22%2F%3E%3Cpath%20d%3D%22M113.817%2036.7781C113.284%2036.7781%20113.037%2036.3971%20113.037%2035.988V34.4245H112.711V33.9872H113.037V33.1242H113.609V33.9872H114.159V34.4245H113.609V35.9599C113.609%2036.1672%20113.71%2036.2906%20113.923%2036.2906H114.159V36.7781H113.817Z%22%20fill%3D%22white%22%2F%3E%3Cpath%20d%3D%22M115.292%2035.5231C115.292%2036.0106%20115.55%2036.3188%20116.016%2036.3188C116.335%2036.3188%20116.504%2036.2292%20116.706%2036.0274L117.071%2036.3692C116.779%2036.6606%20116.504%2036.812%20116.005%2036.812C115.292%2036.812%20114.725%2036.4365%20114.725%2035.355C114.725%2034.4359%20115.202%2033.9035%20115.932%2033.9035C116.695%2033.9035%20117.138%2034.4638%20117.138%2035.2707V35.5229H115.292V35.5231ZM116.493%2034.7385C116.403%2034.5255%20116.201%2034.3798%20115.931%2034.3798C115.662%2034.3798%20115.455%2034.5255%20115.365%2034.7385C115.309%2034.8673%20115.297%2034.9515%20115.292%2035.1252H116.571C116.566%2034.9514%20116.549%2034.8673%20116.493%2034.7385Z%22%20fill%3D%22white%22%2F%3E%3Cpath%20d%3D%22M119.46%2034.604C119.331%2034.4752%20119.23%2034.4134%20119.033%2034.4134C118.725%2034.4134%20118.467%2034.6601%20118.467%2035.0523V36.7783H117.895V33.9371H118.456V34.2453C118.601%2034.0436%20118.893%2033.9035%20119.213%2033.9035C119.488%2033.9035%20119.696%2033.9763%20119.892%2034.1724L119.46%2034.604Z%22%20fill%3D%22white%22%2F%3E%3Cpath%20d%3D%22M0.98584%2022.506L13.4121%2029.5243V26.3946L4.12378%2021.0833V11.819L0.98584%2010.0499V22.506Z%22%20fill%3D%22url%28%23paint0_linear%29%22%2F%3E%3Cpath%20d%3D%22M22.8229%2011.7933L25.9567%2010.0241L13.5008%202.96313L1.07617%2010.0483L4.21022%2011.8191L13.501%206.52529L22.8229%2011.7933Z%22%20fill%3D%22url%28%23paint1_linear%29%22%2F%3E%3Cpath%20d%3D%22M16.4874%2024.6532L13.4122%2026.3947V29.5201L16.4874%2027.7556L19.5625%2025.9892V22.8869L16.4874%2024.6532Z%22%20fill%3D%22url%28%23paint2_linear%29%22%2F%3E%3Cpath%20d%3D%22M25.8382%2026.0152V29.0841L28.8506%2027.2913V24.2132L25.8382%2022.4112V10.0241L22.7003%2011.7933V24.2132L25.8382%2026.0152Z%22%20fill%3D%22url%28%23paint3_linear%29%22%2F%3E%3Cpath%20d%3D%22M88.5242%208.69291C88.4226%208.69291%2088.3233%208.69843%2088.223%208.70194L88.2236%208.69341C85.4909%208.69341%2083.1604%209.68624%2081.5045%2011.3625V1.33155C81.5045%200.5962%2080.907%200%2080.1709%200C79.4339%200%2078.837%200.5962%2078.837%201.33155V18.3337L78.8392%2018.3372C78.8738%2023.8025%2082.7537%2027.797%2088.243%2027.797L88.2425%2027.7892C88.3366%2027.7915%2088.429%2027.797%2088.5244%2027.797C93.7892%2027.797%2097.6502%2023.7663%2097.6502%2018.2626C97.6499%2012.7245%2093.8238%208.69291%2088.5242%208.69291ZM88.2081%2025.2029C87.1759%2025.2029%2086.2219%2024.9959%2085.3715%2024.624C83.0691%2023.5751%2081.5041%2021.1854%2081.5041%2018.2627C81.5041%2016.559%2081.9709%2015.0494%2082.8328%2013.8731C82.8446%2013.8581%2082.8542%2013.8418%2082.8655%2013.8272C82.9314%2013.7399%2083.0039%2013.6582%2083.0743%2013.5747C83.159%2013.4753%2083.2418%2013.3736%2083.3321%2013.2795C83.3521%2013.2591%2083.3729%2013.2406%2083.393%2013.2202C83.5288%2013.0826%2083.669%2012.9489%2083.8178%2012.8246C83.8213%2012.8214%2083.8259%2012.8184%2083.8296%2012.8153C83.9848%2012.6848%2084.1466%2012.5634%2084.3147%2012.4481C84.3525%2012.4227%2084.3923%2012.3996%2084.4307%2012.3748C84.5584%2012.2907%2084.6895%2012.2104%2084.8244%2012.1356C84.9504%2012.0673%2085.0801%2012.0035%2085.2135%2011.9418C85.2606%2011.9199%2085.3064%2011.8964%2085.3545%2011.8745C86.1189%2011.5455%2086.986%2011.3487%2087.9428%2011.2992C88.0315%2011.2962%2088.1182%2011.2869%2088.2082%2011.2869C92.1389%2011.2869%2094.9825%2014.2315%2094.9825%2018.2626C94.9824%2022.3285%2092.1041%2025.2029%2088.2081%2025.2029Z%22%20fill%3D%22white%22%2F%3E%3Cpath%20d%3D%22M44.6034%2027.1723C44.705%2027.1723%2044.804%2027.1668%2044.9047%2027.1634L44.9042%2027.1718C47.6368%2027.1718%2049.9673%2026.179%2051.6232%2024.5027V34.5338C51.6232%2035.269%2052.2207%2035.8652%2052.9569%2035.8652C53.6937%2035.8652%2054.2905%2035.269%2054.2905%2034.5338V17.5316L54.2884%2017.5281C54.2537%2012.0628%2050.374%208.06824%2044.8843%208.06824L44.8848%208.07601C44.7909%208.07388%2044.6986%208.06824%2044.6032%208.06824C39.3383%208.06824%2035.4774%2012.099%2035.4774%2017.6027C35.4777%2023.1407%2039.3037%2027.1723%2044.6034%2027.1723ZM44.9194%2010.6624C45.9515%2010.6624%2046.9055%2010.8693%2047.7558%2011.2413C50.0583%2012.2902%2051.6232%2014.6798%2051.6232%2017.6025C51.6232%2019.3063%2051.1563%2020.8158%2050.2945%2021.9922C50.2827%2022.0071%2050.2732%2022.0235%2050.2619%2022.0381C50.196%2022.1253%2050.1233%2022.2072%2050.053%2022.2907C49.9682%2022.3901%2049.8856%2022.4917%2049.7951%2022.5858C49.7753%2022.6062%2049.7544%2022.6246%2049.7343%2022.6452C49.5985%2022.7828%2049.4581%2022.9164%2049.3095%2023.0407C49.3061%2023.0438%2049.3014%2023.0469%2049.2979%2023.05C49.1425%2023.1805%2048.9807%2023.3018%2048.8128%2023.4171C48.775%2023.4426%2048.7351%2023.4656%2048.6968%2023.4906C48.569%2023.5746%2048.438%2023.6549%2048.3031%2023.7296C48.177%2023.798%2048.0471%2023.8618%2047.914%2023.9234C47.8669%2023.9455%2047.8211%2023.9688%2047.773%2023.9908C47.0086%2024.3197%2046.1415%2024.5165%2045.1847%2024.566C45.096%2024.569%2045.0092%2024.5784%2044.9192%2024.5784C40.9885%2024.5784%2038.1449%2021.6339%2038.1449%2017.6028C38.1452%2013.5366%2041.0234%2010.6624%2044.9194%2010.6624Z%22%20fill%3D%22white%22%2F%3E%3Cpath%20d%3D%22M72.7282%208.06204C71.9915%208.06204%2071.3941%208.65874%2071.3941%209.39409V19.9804C71.3941%2023.0997%2069.6037%2025.3784%2066.4452%2025.3784C63.2864%2025.3784%2061.4966%2023.0997%2061.4966%2019.9804V9.39409C61.4966%208.65874%2060.8987%208.06204%2060.1622%208.06204C59.4256%208.06204%2058.8286%208.65874%2058.8286%209.39409V19.9804C58.8286%2024.5022%2061.9172%2027.7971%2066.4452%2027.7971C70.9731%2027.7971%2074.0616%2024.5022%2074.0616%2019.9804V9.39409C74.0616%208.65862%2073.4639%208.06204%2072.7282%208.06204Z%22%20fill%3D%22white%22%2F%3E%3Cpath%20d%3D%22M120%2018.024C120%2012.5631%20116.084%208.58167%20110.652%208.58167C105.149%208.58167%20101.198%2012.5633%20101.198%2017.9892C101.198%2023.661%20105.219%2027.7832%20110.793%2027.7832C114.421%2027.7832%20117.874%2025.7195%20119.075%2022.8545C119.099%2022.8061%20119.121%2022.7572%20119.14%2022.7057C119.144%2022.6954%20119.149%2022.6853%20119.154%2022.675L119.15%2022.6733C119.193%2022.5447%20119.221%2022.41%20119.221%2022.2674C119.221%2021.5504%20118.639%2020.9692%20117.922%2020.9692C117.394%2020.9692%20116.953%2021.323%20116.757%2021.7952L116.755%2021.7936C115.873%2023.8019%20113.297%2025.3522%20110.616%2025.3522C107.089%2025.3522%20104.373%2022.7805%20103.949%2019.0463L119.965%2019.081C120%2018.6935%20120%2018.3412%20120%2018.024ZM104.02%2016.7206C104.514%2013.3737%20107.089%2011.0482%20110.546%2011.0482C114.073%2011.0482%20116.684%2013.3737%20117.178%2016.756L104.02%2016.7206Z%22%20fill%3D%22white%22%2F%3E%3Cdefs%3E%3ClinearGradient%20id%3D%22paint0_linear%22%20x1%3D%221.2581%22%20y1%3D%2216.424%22%20x2%3D%2213.4488%22%20y2%3D%2223.3842%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%23BCBEC0%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22white%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22paint1_linear%22%20x1%3D%221.07617%22%20y1%3D%227.39112%22%20x2%3D%2222.2555%22%20y2%3D%227.39112%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%23BCBEC0%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22white%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22paint2_linear%22%20x1%3D%2218.8581%22%20y1%3D%2224.8741%22%20x2%3D%2214.6244%22%20y2%3D%2227.2544%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%23BCBEC0%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22white%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22paint3_linear%22%20x1%3D%2225.7755%22%20y1%3D%2210.9983%22%20x2%3D%2225.7755%22%20y2%3D%2227.8636%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%23BCBEC0%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22white%22%2F%3E%3C%2FlinearGradient%3E%3C%2Fdefs%3E%3C%2Fsvg%3E';
|
1159 |
|
1160 | var _ref$1 =
|
1161 |
|
1162 | React.createElement("path", {
|
1163 | d: "M.986 19.543l12.426 7.018v-3.13l-9.288-5.31V8.855L.986 7.086v12.457z",
|
1164 | fill: "url(#paint0_linear)"
|
1165 | });
|
1166 |
|
1167 | var _ref2$1 =
|
1168 |
|
1169 | React.createElement("path", {
|
1170 | d: "M22.823 8.83l3.134-1.769L13.5 0 1.076 7.085 4.21 8.856l9.291-5.294 9.322 5.268z",
|
1171 | fill: "url(#paint1_linear)"
|
1172 | });
|
1173 |
|
1174 | var _ref3$1 =
|
1175 |
|
1176 | React.createElement("path", {
|
1177 | d: "M16.487 21.69l-3.075 1.741v3.126l3.075-1.765 3.076-1.766v-3.102l-3.076 1.766z",
|
1178 | fill: "url(#paint2_linear)"
|
1179 | });
|
1180 |
|
1181 | var _ref4$1 =
|
1182 |
|
1183 | React.createElement("path", {
|
1184 | d: "M25.838 23.052v3.069l3.013-1.793V21.25l-3.013-1.802V7.061L22.7 8.831v12.42l3.138 1.801z",
|
1185 | fill: "url(#paint3_linear)"
|
1186 | });
|
1187 |
|
1188 | var _ref5$1 =
|
1189 |
|
1190 | React.createElement("defs", null, React.createElement("linearGradient", {
|
1191 | id: "paint0_linear",
|
1192 | x1: 1.258,
|
1193 | y1: 13.461,
|
1194 | x2: 13.449,
|
1195 | y2: 20.421,
|
1196 | gradientUnits: "userSpaceOnUse"
|
1197 | }, React.createElement("stop", {
|
1198 | stopColor: "#BCBEC0"
|
1199 | }), React.createElement("stop", {
|
1200 | offset: 1,
|
1201 | stopColor: "#fff"
|
1202 | })), React.createElement("linearGradient", {
|
1203 | id: "paint1_linear",
|
1204 | x1: 1.076,
|
1205 | y1: 4.428,
|
1206 | x2: 22.256,
|
1207 | y2: 4.428,
|
1208 | gradientUnits: "userSpaceOnUse"
|
1209 | }, React.createElement("stop", {
|
1210 | stopColor: "#BCBEC0"
|
1211 | }), React.createElement("stop", {
|
1212 | offset: 1,
|
1213 | stopColor: "#fff"
|
1214 | })), React.createElement("linearGradient", {
|
1215 | id: "paint2_linear",
|
1216 | x1: 18.858,
|
1217 | y1: 21.911,
|
1218 | x2: 14.624,
|
1219 | y2: 24.291,
|
1220 | gradientUnits: "userSpaceOnUse"
|
1221 | }, React.createElement("stop", {
|
1222 | stopColor: "#BCBEC0"
|
1223 | }), React.createElement("stop", {
|
1224 | offset: 1,
|
1225 | stopColor: "#fff"
|
1226 | })), React.createElement("linearGradient", {
|
1227 | id: "paint3_linear",
|
1228 | x1: 25.775,
|
1229 | y1: 8.035,
|
1230 | x2: 25.775,
|
1231 | y2: 24.901,
|
1232 | gradientUnits: "userSpaceOnUse"
|
1233 | }, React.createElement("stop", {
|
1234 | stopColor: "#BCBEC0"
|
1235 | }), React.createElement("stop", {
|
1236 | offset: 1,
|
1237 | stopColor: "#fff"
|
1238 | })));
|
1239 |
|
1240 | var QubeSymbol = 'data:image/svg+xml,%3Csvg%20width%3D%2229%22%20height%3D%2227%22%20viewBox%3D%220%200%2029%2027%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M0.98584%2019.5429L13.4121%2026.5611V23.4315L4.12378%2018.1202V8.8559L0.98584%207.08673V19.5429Z%22%20fill%3D%22url%28%23paint0_linear%29%22%2F%3E%3Cpath%20d%3D%22M22.8229%208.83018L25.9567%207.06101L13.5008%200L1.07617%207.0852L4.21022%208.856L13.501%203.56216L22.8229%208.83018Z%22%20fill%3D%22url%28%23paint1_linear%29%22%2F%3E%3Cpath%20d%3D%22M16.4873%2021.6901L13.4121%2023.4315V26.557L16.4873%2024.7924L19.5625%2023.026V19.9238L16.4873%2021.6901Z%22%20fill%3D%22url%28%23paint2_linear%29%22%2F%3E%3Cpath%20d%3D%22M25.8381%2023.0521V26.1209L28.8506%2024.3282V21.2501L25.8381%2019.448V7.06097L22.7002%208.83014V21.2501L25.8381%2023.0521Z%22%20fill%3D%22url%28%23paint3_linear%29%22%2F%3E%3Cdefs%3E%3ClinearGradient%20id%3D%22paint0_linear%22%20x1%3D%221.2581%22%20y1%3D%2213.4608%22%20x2%3D%2213.4488%22%20y2%3D%2220.421%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%23BCBEC0%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22white%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22paint1_linear%22%20x1%3D%221.07617%22%20y1%3D%224.42799%22%20x2%3D%2222.2555%22%20y2%3D%224.42799%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%23BCBEC0%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22white%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22paint2_linear%22%20x1%3D%2218.858%22%20y1%3D%2221.9109%22%20x2%3D%2214.6244%22%20y2%3D%2224.2912%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%23BCBEC0%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22white%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22paint3_linear%22%20x1%3D%2225.7754%22%20y1%3D%228.03516%22%20x2%3D%2225.7754%22%20y2%3D%2224.9005%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20stop-color%3D%22%23BCBEC0%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22white%22%2F%3E%3C%2FlinearGradient%3E%3C%2Fdefs%3E%3C%2Fsvg%3E';
|
1241 |
|
1242 | function _templateObject7() {
|
1243 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\n\theight: 40px;\n\talign-items: center;\n\tpadding-left: 16px;\n\n\tbackground: ", ";\n\tborder-radius: 4px;\n\tcolor: ", ";\n\tcursor: pointer;\n\ttext-decoration: none;\n\n\t&:hover {\n\t\tbackground: ", ";\n\t\tcolor: ", ";\n\t}\n\n\t&:active,\n\t&:focus {\n\t\tcolor: ", ";\n\t}\n"]);
|
1244 |
|
1245 | _templateObject7 = function _templateObject7() {
|
1246 | return data;
|
1247 | };
|
1248 |
|
1249 | return data;
|
1250 | }
|
1251 |
|
1252 | function _templateObject6() {
|
1253 | var data = taggedTemplateLiteralLoose(["\n\tz-index: 2;\n\n\tmargin-top: 32px;\n"]);
|
1254 |
|
1255 | _templateObject6 = function _templateObject6() {
|
1256 | return data;
|
1257 | };
|
1258 |
|
1259 | return data;
|
1260 | }
|
1261 |
|
1262 | function _templateObject5() {
|
1263 | var data = taggedTemplateLiteralLoose(["\n\tz-index: 2;\n\tmargin-top: 6px;\n\tcolor: ", ";\n\tfont-size: 16px;\n"]);
|
1264 |
|
1265 | _templateObject5 = function _templateObject5() {
|
1266 | return data;
|
1267 | };
|
1268 |
|
1269 | return data;
|
1270 | }
|
1271 |
|
1272 | function _templateObject4() {
|
1273 | var data = taggedTemplateLiteralLoose(["\n\t&&&.small.icon {\n\t\tcolor: ", " !important;\n\t\tfont-size: 18px !important;\n\t}\n"]);
|
1274 |
|
1275 | _templateObject4 = function _templateObject4() {
|
1276 | return data;
|
1277 | };
|
1278 |
|
1279 | return data;
|
1280 | }
|
1281 |
|
1282 | function _templateObject3$1() {
|
1283 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tflex-direction: column;\n\n\tpadding-top: 28px;\n\tpadding-left: 16px;\n"]);
|
1284 |
|
1285 | _templateObject3$1 = function _templateObject3() {
|
1286 | return data;
|
1287 | };
|
1288 |
|
1289 | return data;
|
1290 | }
|
1291 |
|
1292 | function _templateObject2$3() {
|
1293 | var data = taggedTemplateLiteralLoose(["\n\twidth: 100%;\n"]);
|
1294 |
|
1295 | _templateObject2$3 = function _templateObject2() {
|
1296 | return data;
|
1297 | };
|
1298 |
|
1299 | return data;
|
1300 | }
|
1301 |
|
1302 | function _templateObject$d() {
|
1303 | var data = taggedTemplateLiteralLoose(["\n\tz-index: 2;\n\tdisplay: ", ";\n\n\twidth: 100%;\n\theight: 100%;\n\tmin-height: 664px;\n\tpadding: 12px;\n\n\tbackground: ", ";\n\tbox-shadow: 2px 0px 2px rgba(0, 0, 0, 0.08);\n\tuser-select: none;\n"]);
|
1304 |
|
1305 | _templateObject$d = function _templateObject() {
|
1306 | return data;
|
1307 | };
|
1308 |
|
1309 | return data;
|
1310 | }
|
1311 |
|
1312 | var SubNav = function SubNav(_ref) {
|
1313 | var collapse = _ref.collapse,
|
1314 | _ref$activeItem = _ref.activeItem,
|
1315 | items = _ref$activeItem.items,
|
1316 | icon = _ref$activeItem.icon,
|
1317 | title = _ref$activeItem.title,
|
1318 | isActive = _ref.isActive,
|
1319 | setRoute = _ref.setRoute,
|
1320 | subNavBgColor = _ref.subNavBgColor,
|
1321 | subNavColor = _ref.subNavColor,
|
1322 | subNavColorTitle = _ref.subNavColorTitle,
|
1323 | subNavHoverBgColor = _ref.subNavHoverBgColor,
|
1324 | subNavHoverColor = _ref.subNavHoverColor,
|
1325 | subNavHighlightBgColor = _ref.subNavHighlightBgColor,
|
1326 | subNavHighlightColor = _ref.subNavHighlightColor;
|
1327 |
|
1328 | var _onClick = function onClick(_ref2) {
|
1329 | var onClickItem = _ref2.onClickItem,
|
1330 | path = _ref2.path;
|
1331 | return onClickItem ? onClickItem(path) : setRoute(path);
|
1332 | };
|
1333 |
|
1334 | return React.createElement(SubNavStyled, {
|
1335 | collapse: collapse,
|
1336 | bgColor: subNavBgColor,
|
1337 | "data-test-id": "submenu"
|
1338 | }, React.createElement(Header$1, null, React.createElement(FullWidth, null, icon && React.createElement(HeaderIcon, {
|
1339 | icon: icon,
|
1340 | size: "small",
|
1341 | collapse: collapse,
|
1342 | color: subNavColorTitle,
|
1343 | "data-test-id": "submenu-icon"
|
1344 | })), React.createElement(Title, {
|
1345 | color: subNavColorTitle,
|
1346 | "data-test-id": "submenu-title"
|
1347 | }, title)), React.createElement(SubNavList, null, items.map(function (item) {
|
1348 | return React.createElement(SubNavLink, {
|
1349 | key: item.id,
|
1350 | active: isActive(item),
|
1351 | onClick: function onClick() {
|
1352 | return _onClick(item);
|
1353 | },
|
1354 | bgColor: subNavBgColor,
|
1355 | color: subNavColor,
|
1356 | hoverBgColor: subNavHoverBgColor,
|
1357 | hoverColor: subNavHoverColor,
|
1358 | subNavHighlightBgColor: subNavHighlightBgColor,
|
1359 | highlightColor: subNavHighlightColor
|
1360 | }, item.title);
|
1361 | })));
|
1362 | };
|
1363 |
|
1364 | var SubNavStyled = styled.div(_templateObject$d(), function (_ref3) {
|
1365 | var collapse = _ref3.collapse;
|
1366 | return collapse ? 'block' : 'none';
|
1367 | }, function (_ref4) {
|
1368 | var bgColor = _ref4.bgColor;
|
1369 | return bgColor;
|
1370 | });
|
1371 | var FullWidth = styled.div(_templateObject2$3());
|
1372 | var Header$1 = styled.div(_templateObject3$1());
|
1373 | var HeaderIcon = styled(function (_ref5) {
|
1374 | var collapse = _ref5.collapse,
|
1375 | props = objectWithoutPropertiesLoose(_ref5, ["collapse"]);
|
1376 |
|
1377 | return React.createElement(Icon$1, props);
|
1378 | })(_templateObject4(), function (_ref6) {
|
1379 | var color = _ref6.color;
|
1380 | return color;
|
1381 | });
|
1382 | HeaderIcon.displayName = 'HeaderIcon';
|
1383 | var Title = styled.div(_templateObject5(), function (_ref7) {
|
1384 | var color = _ref7.color;
|
1385 | return color;
|
1386 | });
|
1387 | var SubNavList = styled.div(_templateObject6());
|
1388 | var SubNavLink = styled.a(_templateObject7(), function (_ref8) {
|
1389 | var active = _ref8.active,
|
1390 | hoverBgColor = _ref8.hoverBgColor,
|
1391 | bgColor = _ref8.bgColor;
|
1392 | return active ? hoverBgColor : bgColor;
|
1393 | }, function (_ref9) {
|
1394 | var active = _ref9.active,
|
1395 | highlightColor = _ref9.highlightColor,
|
1396 | color = _ref9.color;
|
1397 | return active ? highlightColor : color;
|
1398 | }, function (_ref10) {
|
1399 | var hoverBgColor = _ref10.hoverBgColor;
|
1400 | return hoverBgColor;
|
1401 | }, function (_ref11) {
|
1402 | var hoverColor = _ref11.hoverColor;
|
1403 | return hoverColor;
|
1404 | }, function (_ref12) {
|
1405 | var highlightColor = _ref12.highlightColor;
|
1406 | return highlightColor;
|
1407 | });
|
1408 | SubNavLink.displayName = 'SubNavLink';
|
1409 | SubNav.propTypes = {
|
1410 | setRoute: PropTypes.func.isRequired,
|
1411 | collapse: PropTypes.bool.isRequired,
|
1412 | isActive: PropTypes.func.isRequired,
|
1413 | activeItem: PropTypes.shape({
|
1414 | title: PropTypes.string,
|
1415 | items: PropTypes.arrayOf(PropTypes.shape({
|
1416 | icon: PropTypes.string,
|
1417 | title: PropTypes.string,
|
1418 | path: PropTypes.string,
|
1419 | items: PropTypes.arrayOf(PropTypes.shape({
|
1420 | title: PropTypes.string,
|
1421 | path: PropTypes.string
|
1422 | }))
|
1423 | }))
|
1424 | }).isRequired,
|
1425 | subNavBgColor: PropTypes.string.isRequired,
|
1426 | subNavColor: PropTypes.string.isRequired,
|
1427 | subNavColorTitle: PropTypes.string.isRequired,
|
1428 | subNavHoverBgColor: PropTypes.string.isRequired,
|
1429 | subNavHoverColor: PropTypes.string.isRequired,
|
1430 | subNavHighlightBgColor: PropTypes.string.isRequired,
|
1431 | subNavHighlightColor: PropTypes.string.isRequired
|
1432 | };
|
1433 | SubNav.displayName = 'SubNav';
|
1434 |
|
1435 | function _templateObject6$1() {
|
1436 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: none !important;\n\tmargin-left: 8px !important;\n\n\t&&&.icon.arrow {\n\t\tcolor: ", " !important;\n\t}\n"]);
|
1437 |
|
1438 | _templateObject6$1 = function _templateObject6() {
|
1439 | return data;
|
1440 | };
|
1441 |
|
1442 | return data;
|
1443 | }
|
1444 |
|
1445 | function _templateObject5$1() {
|
1446 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: ", ";\n"]);
|
1447 |
|
1448 | _templateObject5$1 = function _templateObject5() {
|
1449 | return data;
|
1450 | };
|
1451 |
|
1452 | return data;
|
1453 | }
|
1454 |
|
1455 | function _templateObject4$1() {
|
1456 | var data = taggedTemplateLiteralLoose(["\n\tmargin: ", " !important;\n\n\t&&&.small.icon {\n\t\twidth: ", " !important;\n\t\tfont-size: 15px;\n\t}\n"]);
|
1457 |
|
1458 | _templateObject4$1 = function _templateObject4() {
|
1459 | return data;
|
1460 | };
|
1461 |
|
1462 | return data;
|
1463 | }
|
1464 |
|
1465 | function _templateObject3$2() {
|
1466 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\twidth: 100%;\n\talign-items: center;\n\tjustify-content: ", ";\n\n\tcolor: white;\n\tfont-size: 15px;\n"]);
|
1467 |
|
1468 | _templateObject3$2 = function _templateObject3() {
|
1469 | return data;
|
1470 | };
|
1471 |
|
1472 | return data;
|
1473 | }
|
1474 |
|
1475 | function _templateObject2$4() {
|
1476 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\talign-items: baseline;\n\tjustify-content: center;\n"]);
|
1477 |
|
1478 | _templateObject2$4 = function _templateObject2() {
|
1479 | return data;
|
1480 | };
|
1481 |
|
1482 | return data;
|
1483 | }
|
1484 |
|
1485 | function _templateObject$e() {
|
1486 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\twidth: 100%;\n\theight: 46px;\n\tjustify-content: ", ";\n\tpadding: ", ";\n\n\tbackground: ", ";\n\tcursor: pointer;\n\ttext-decoration: none;\n\tuser-select: none;\n\n\tp {\n\t\tcolor: ", " !important;\n\t}\n\n\t.small.icon {\n\t\tcolor: ", " !important;\n\t}\n\n\t:hover {\n\t\tbackground: ", ";\n\n\t\tp {\n\t\t\tcolor: ", " !important;\n\t\t}\n\n\t\t.small.icon {\n\t\t\tcolor: ", " !important;\n\t\t}\n\n\t\t.arrow {\n\t\t\tdisplay: ", " !important;\n\t\t}\n\t}\n"]);
|
1487 |
|
1488 | _templateObject$e = function _templateObject() {
|
1489 | return data;
|
1490 | };
|
1491 |
|
1492 | return data;
|
1493 | }
|
1494 |
|
1495 | var SideNavLink = function SideNavLink(_ref) {
|
1496 | var collapse = _ref.collapse,
|
1497 | item = _ref.item,
|
1498 | isActive = _ref.isActive,
|
1499 | _onClick = _ref.onClick,
|
1500 | color = _ref.color,
|
1501 | highlightColor = _ref.highlightColor,
|
1502 | highlightBgColor = _ref.highlightBgColor,
|
1503 | hoverBgColor = _ref.hoverBgColor,
|
1504 | hoverColor = _ref.hoverColor;
|
1505 | return React.createElement(SideNavLinkStyled, {
|
1506 | collapse: collapse,
|
1507 | active: isActive(item),
|
1508 | onClick: function onClick() {
|
1509 | return _onClick(item);
|
1510 | },
|
1511 | color: color,
|
1512 | highlightBgColor: highlightBgColor,
|
1513 | highlightColor: highlightColor,
|
1514 | hoverBgColor: hoverBgColor,
|
1515 | hoverColor: hoverColor
|
1516 | }, React.createElement(SideNavLinkWrapper, {
|
1517 | collapse: collapse
|
1518 | }, React.createElement(Flex, null, item.icon && React.createElement(SideNavLinkIcon, {
|
1519 | icon: item.icon,
|
1520 | color: color,
|
1521 | size: "small",
|
1522 | collapse: collapse
|
1523 | }), item.title && React.createElement(SideNavLinkText, {
|
1524 | collapse: collapse
|
1525 | }, item.title)), React.createElement(SideNavLinkArrow, {
|
1526 | className: "arrow",
|
1527 | icon: "arrow-right",
|
1528 | color: hoverColor
|
1529 | })));
|
1530 | };
|
1531 |
|
1532 | var SideNavLinkStyled = styled.div(_templateObject$e(), function (_ref2) {
|
1533 | var collapse = _ref2.collapse;
|
1534 | return collapse ? 'center' : 'start';
|
1535 | }, function (_ref3) {
|
1536 | var collapse = _ref3.collapse;
|
1537 | return collapse ? '0 4px' : '0 32px';
|
1538 | }, function (_ref4) {
|
1539 | var active = _ref4.active,
|
1540 | highlightBgColor = _ref4.highlightBgColor;
|
1541 | return active ? highlightBgColor : undefined;
|
1542 | }, function (_ref5) {
|
1543 | var active = _ref5.active,
|
1544 | highlightColor = _ref5.highlightColor,
|
1545 | color = _ref5.color;
|
1546 | return active ? highlightColor : color;
|
1547 | }, function (_ref6) {
|
1548 | var highlightColor = _ref6.highlightColor,
|
1549 | active = _ref6.active;
|
1550 | return active ? highlightColor : undefined;
|
1551 | }, function (_ref7) {
|
1552 | var hoverBgColor = _ref7.hoverBgColor,
|
1553 | highlightBgColor = _ref7.highlightBgColor,
|
1554 | collapse = _ref7.collapse;
|
1555 | return collapse ? highlightBgColor : hoverBgColor;
|
1556 | }, function (_ref8) {
|
1557 | var hoverColor = _ref8.hoverColor;
|
1558 | return hoverColor;
|
1559 | }, function (_ref9) {
|
1560 | var highlightColor = _ref9.highlightColor,
|
1561 | hoverColor = _ref9.hoverColor,
|
1562 | collapse = _ref9.collapse;
|
1563 | return collapse ? highlightColor : hoverColor;
|
1564 | }, function (_ref10) {
|
1565 | var collapse = _ref10.collapse;
|
1566 | return collapse ? 'none' : 'block';
|
1567 | });
|
1568 | SideNavLinkStyled.displayName = 'SideNavLinkStyled';
|
1569 | var Flex = styled.div(_templateObject2$4());
|
1570 | var SideNavLinkWrapper = styled.div(_templateObject3$2(), function (_ref11) {
|
1571 | var collapse = _ref11.collapse;
|
1572 | return collapse ? 'center' : 'space-between';
|
1573 | });
|
1574 | var SideNavLinkIcon = styled(function (_ref12) {
|
1575 | var collapse = _ref12.collapse,
|
1576 | props = objectWithoutPropertiesLoose(_ref12, ["collapse"]);
|
1577 |
|
1578 | return React.createElement(Icon$1, props);
|
1579 | })(_templateObject4$1(), function (_ref13) {
|
1580 | var collapse = _ref13.collapse;
|
1581 | return collapse ? ' auto' : '0 20px 0 0';
|
1582 | }, function (_ref14) {
|
1583 | var collapse = _ref14.collapse;
|
1584 | return collapse ? ' 100%' : null;
|
1585 | });
|
1586 | var SideNavLinkText = styled.p(_templateObject5$1(), function (_ref15) {
|
1587 | var collapse = _ref15.collapse;
|
1588 | return collapse ? 'none' : 'inline-block';
|
1589 | });
|
1590 | var SideNavLinkArrow = styled(Icon$1)(_templateObject6$1(), function (_ref16) {
|
1591 | var color = _ref16.color;
|
1592 | return color;
|
1593 | });
|
1594 | SideNavLink.propTypes = {
|
1595 | item: PropTypes.shape({
|
1596 | id: PropTypes.string,
|
1597 | icon: PropTypes.string,
|
1598 | title: PropTypes.string,
|
1599 | path: PropTypes.string,
|
1600 | items: PropTypes.arrayOf(PropTypes.shape({
|
1601 | title: PropTypes.string,
|
1602 | path: PropTypes.string
|
1603 | }))
|
1604 | }).isRequired,
|
1605 | isActive: PropTypes.func.isRequired,
|
1606 | onClick: PropTypes.func.isRequired,
|
1607 | collapse: PropTypes.bool.isRequired,
|
1608 | color: PropTypes.string.isRequired,
|
1609 | hoverBgColor: PropTypes.string.isRequired,
|
1610 | hoverColor: PropTypes.string.isRequired,
|
1611 | highlightBgColor: PropTypes.string.isRequired,
|
1612 | highlightColor: PropTypes.string.isRequired
|
1613 | };
|
1614 | SideNavLink.displayName = 'SideNavLink';
|
1615 |
|
1616 | function _templateObject2$5() {
|
1617 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: ", ";\n\theight: 36px;\n\tpadding: ", ";\n\n\tcolor: ", ";\n\tfont-size: ", ";\n\ttext-align: ", ";\n\ttext-transform: uppercase;\n\n\ttransition: ", ";\n"]);
|
1618 |
|
1619 | _templateObject2$5 = function _templateObject2() {
|
1620 | return data;
|
1621 | };
|
1622 |
|
1623 | return data;
|
1624 | }
|
1625 |
|
1626 | function _templateObject$f() {
|
1627 | var data = taggedTemplateLiteralLoose(["\n\tpadding-left: 0px;\n"]);
|
1628 |
|
1629 | _templateObject$f = function _templateObject() {
|
1630 | return data;
|
1631 | };
|
1632 |
|
1633 | return data;
|
1634 | }
|
1635 |
|
1636 | var SideNavSection = function SideNavSection(_ref) {
|
1637 | var collapse = _ref.collapse,
|
1638 | _ref$section = _ref.section,
|
1639 | items = _ref$section.items,
|
1640 | title = _ref$section.title,
|
1641 | isActive = _ref.isActive,
|
1642 | setRoute = _ref.setRoute,
|
1643 | colorTitle = _ref.colorTitle,
|
1644 | color = _ref.color,
|
1645 | hoverBgColor = _ref.hoverBgColor,
|
1646 | hoverColor = _ref.hoverColor,
|
1647 | highlightBgColor = _ref.highlightBgColor,
|
1648 | highlightColor = _ref.highlightColor;
|
1649 |
|
1650 | var _onClick = function onClick(_ref2) {
|
1651 | var onClickItem = _ref2.onClickItem,
|
1652 | path = _ref2.path;
|
1653 | return onClickItem ? onClickItem(path) : setRoute(path);
|
1654 | };
|
1655 |
|
1656 | return React.createElement("section", null, React.createElement(SideNavSectionStyled, null, React.createElement(SideNavSectionTitle, {
|
1657 | show: !!title,
|
1658 | collapse: collapse,
|
1659 | color: colorTitle
|
1660 | }, title), items.map(function (item) {
|
1661 | return item.render ? collapse ? item.render.collapsed : item.render.expanded : React.createElement(SideNavLink, {
|
1662 | key: item.id,
|
1663 | item: item,
|
1664 | collapse: collapse,
|
1665 | onClick: function onClick() {
|
1666 | return _onClick(item);
|
1667 | },
|
1668 | isActive: isActive,
|
1669 | color: color,
|
1670 | highlightColor: highlightColor,
|
1671 | highlightBgColor: highlightBgColor,
|
1672 | hoverBgColor: hoverBgColor,
|
1673 | hoverColor: hoverColor
|
1674 | });
|
1675 | })));
|
1676 | };
|
1677 |
|
1678 | var SideNavSectionStyled = styled.div(_templateObject$f());
|
1679 | var SideNavSectionTitle = styled.div(_templateObject2$5(), function (_ref3) {
|
1680 | var show = _ref3.show;
|
1681 | return show ? 'block' : 'none';
|
1682 | }, function (_ref4) {
|
1683 | var collapse = _ref4.collapse;
|
1684 | return collapse ? '0' : '0 32px;';
|
1685 | }, function (_ref5) {
|
1686 | var color = _ref5.color;
|
1687 | return color;
|
1688 | }, function (_ref6) {
|
1689 | var collapse = _ref6.collapse;
|
1690 | return collapse ? '11px' : '15px';
|
1691 | }, function (_ref7) {
|
1692 | var collapse = _ref7.collapse;
|
1693 | return collapse ? 'center' : 'left';
|
1694 | }, function (_ref8) {
|
1695 | var collapse = _ref8.collapse;
|
1696 | return collapse ? '0' : '0.3s';
|
1697 | });
|
1698 | SideNavSection.propTypes = {
|
1699 | setRoute: PropTypes.func.isRequired,
|
1700 | isActive: PropTypes.func.isRequired,
|
1701 | collapse: PropTypes.bool.isRequired,
|
1702 | section: PropTypes.shape({
|
1703 | title: PropTypes.string,
|
1704 | items: PropTypes.arrayOf(PropTypes.shape({
|
1705 | render: PropTypes.shape({
|
1706 | collapsed: PropTypes.element.isRequired,
|
1707 | expanded: PropTypes.element.isRequired
|
1708 | }),
|
1709 | icon: PropTypes.string,
|
1710 | title: PropTypes.string,
|
1711 | path: PropTypes.string,
|
1712 | items: PropTypes.arrayOf(PropTypes.shape({
|
1713 | title: PropTypes.string,
|
1714 | path: PropTypes.string
|
1715 | }))
|
1716 | }))
|
1717 | }).isRequired,
|
1718 | color: PropTypes.string.isRequired,
|
1719 | colorTitle: PropTypes.string.isRequired,
|
1720 | hoverBgColor: PropTypes.string.isRequired,
|
1721 | hoverColor: PropTypes.string.isRequired,
|
1722 | highlightBgColor: PropTypes.string.isRequired,
|
1723 | highlightColor: PropTypes.string.isRequired
|
1724 | };
|
1725 | SideNavSection.displayName = 'SideNavSection';
|
1726 |
|
1727 | function _templateObject12() {
|
1728 | var data = taggedTemplateLiteralLoose(["\n\tcursor: pointer;\n\tfont-size: 17px !important;\n"]);
|
1729 |
|
1730 | _templateObject12 = function _templateObject12() {
|
1731 | return data;
|
1732 | };
|
1733 |
|
1734 | return data;
|
1735 | }
|
1736 |
|
1737 | function _templateObject11() {
|
1738 | var data = taggedTemplateLiteralLoose(["\n\tpadding: 10px 0;\n"]);
|
1739 |
|
1740 | _templateObject11 = function _templateObject11() {
|
1741 | return data;
|
1742 | };
|
1743 |
|
1744 | return data;
|
1745 | }
|
1746 |
|
1747 | function _templateObject10() {
|
1748 | var data = taggedTemplateLiteralLoose(["\n\tposition: absolute;\n\tbottom: 10px;\n\tleft: ", " !important;\n"]);
|
1749 |
|
1750 | _templateObject10 = function _templateObject10() {
|
1751 | return data;
|
1752 | };
|
1753 |
|
1754 | return data;
|
1755 | }
|
1756 |
|
1757 | function _templateObject9() {
|
1758 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: ", ";\n\twidth: 100%;\n\tjustify-content: center;\n\tmargin: auto;\n\tcursor: pointer;\n\n\timg {\n\t\tmax-width: 154px;\n\t}\n"]);
|
1759 |
|
1760 | _templateObject9 = function _templateObject9() {
|
1761 | return data;
|
1762 | };
|
1763 |
|
1764 | return data;
|
1765 | }
|
1766 |
|
1767 | function _templateObject8() {
|
1768 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: ", ";\n\tmargin: auto;\n\tcursor: pointer;\n\n\timg {\n\t\tmin-width: 24px;\n\t\tmax-width: 32px;\n\t}\n"]);
|
1769 |
|
1770 | _templateObject8 = function _templateObject8() {
|
1771 | return data;
|
1772 | };
|
1773 |
|
1774 | return data;
|
1775 | }
|
1776 |
|
1777 | function _templateObject7$1() {
|
1778 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\twidth: 100%;\n\theight: 38px;\n\n\tjustify-content: center;\n\n\tmargin-top: 12px;\n\tmargin-bottom: 32px;\n"]);
|
1779 |
|
1780 | _templateObject7$1 = function _templateObject7() {
|
1781 | return data;
|
1782 | };
|
1783 |
|
1784 | return data;
|
1785 | }
|
1786 |
|
1787 | function _templateObject6$2() {
|
1788 | var data = taggedTemplateLiteralLoose(["\n\tposition: relative;\n\tz-index: 3;\n\n\twidth: ", ";\n\theight: 100%;\n\tmin-height: 664px;\n\tflex-direction: column;\n\talign-items: center;\n\tjustify-content: center;\n\tpadding: 32px 0;\n\n\tbackground: ", ";\n\tbox-shadow: ", ";\n\ttransition: width 260ms cubic-bezier(0.2, 0, 0, 1) 0s;\n"]);
|
1789 |
|
1790 | _templateObject6$2 = function _templateObject6() {
|
1791 | return data;
|
1792 | };
|
1793 |
|
1794 | return data;
|
1795 | }
|
1796 |
|
1797 | function _templateObject5$2() {
|
1798 | var data = taggedTemplateLiteralLoose(["\n\tz-index: 2;\n\tdisplay: flex;\n\theight: 100%;\n"]);
|
1799 |
|
1800 | _templateObject5$2 = function _templateObject5() {
|
1801 | return data;
|
1802 | };
|
1803 |
|
1804 | return data;
|
1805 | }
|
1806 |
|
1807 | function _templateObject4$2() {
|
1808 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: ", ";\n\n\twidth: ", ";\n\tmargin: auto;\n\tborder: 1px solid ", ";\n"]);
|
1809 |
|
1810 | _templateObject4$2 = function _templateObject4() {
|
1811 | return data;
|
1812 | };
|
1813 |
|
1814 | return data;
|
1815 | }
|
1816 |
|
1817 | function _templateObject3$3() {
|
1818 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\theight: 60px;\n\tflex-direction: column;\n"]);
|
1819 |
|
1820 | _templateObject3$3 = function _templateObject3() {
|
1821 | return data;
|
1822 | };
|
1823 |
|
1824 | return data;
|
1825 | }
|
1826 |
|
1827 | function _templateObject2$6() {
|
1828 | var data = taggedTemplateLiteralLoose(["\n\tcolor: black;\n"]);
|
1829 |
|
1830 | _templateObject2$6 = function _templateObject2() {
|
1831 | return data;
|
1832 | };
|
1833 |
|
1834 | return data;
|
1835 | }
|
1836 |
|
1837 | function _templateObject$g() {
|
1838 | var data = taggedTemplateLiteralLoose(["\n\tposition: absolute;\n\tright: -12px;\n\tdisplay: flex;\n\twidth: 30px;\n\theight: 30px;\n\n\talign-items: center;\n\tjustify-content: center;\n\tborder: 1px solid #dddddd;\n\n\tbackground: #ffffff;\n\tborder-radius: 50%;\n\tbox-shadow: 0px 1px 4px rgba(0, 0, 0, 0.25);\n\n\tcursor: pointer;\n"]);
|
1839 |
|
1840 | _templateObject$g = function _templateObject() {
|
1841 | return data;
|
1842 | };
|
1843 |
|
1844 | return data;
|
1845 | }
|
1846 |
|
1847 | var SideNav =
|
1848 |
|
1849 | function (_Component) {
|
1850 | inheritsLoose(SideNav, _Component);
|
1851 |
|
1852 | function SideNav(props) {
|
1853 | var _this;
|
1854 |
|
1855 | _this = _Component.call(this, props) || this;
|
1856 |
|
1857 | defineProperty(assertThisInitialized(_this), "onMouseEnter", function () {
|
1858 | _this.timeout = setTimeout(function () {
|
1859 | return _this.setState({
|
1860 | onHover: true
|
1861 | });
|
1862 | }, 350);
|
1863 | });
|
1864 |
|
1865 | defineProperty(assertThisInitialized(_this), "onMouseLeave", function () {
|
1866 | clearTimeout(_this.timeout);
|
1867 |
|
1868 | _this.setState({
|
1869 | onHover: false
|
1870 | });
|
1871 | });
|
1872 |
|
1873 | defineProperty(assertThisInitialized(_this), "getActiveItem", function (_ref) {
|
1874 | var items = _ref.items;
|
1875 | return items.find(function (item) {
|
1876 | return _this.isActive(item) || item.items && _this.getActiveItem(item);
|
1877 | });
|
1878 | });
|
1879 |
|
1880 | defineProperty(assertThisInitialized(_this), "isActive", function (item) {
|
1881 | var _this$props = _this.props,
|
1882 | matchPath = _this$props.matchPath,
|
1883 | location = _this$props.location;
|
1884 | var params = item.matchPath ? {
|
1885 | path: item.matchPath,
|
1886 | exact: false
|
1887 | } : item.path;
|
1888 | var match = matchPath(location, params);
|
1889 | return match && (match.isExact || item.matchPath);
|
1890 | });
|
1891 |
|
1892 | defineProperty(assertThisInitialized(_this), "activeSection", function () {
|
1893 | var nav = _this.props.nav;
|
1894 | return nav.find(function (section) {
|
1895 | return _this.getActiveItem(section);
|
1896 | });
|
1897 | });
|
1898 |
|
1899 | defineProperty(assertThisInitialized(_this), "activeItem", function () {
|
1900 | var activeSection = _this.activeSection();
|
1901 |
|
1902 | return activeSection && _this.getActiveItem(activeSection);
|
1903 | });
|
1904 |
|
1905 | defineProperty(assertThisInitialized(_this), "activeItemHasSubNav", function () {
|
1906 | return _this.activeItem() && _this.activeItem().items;
|
1907 | });
|
1908 |
|
1909 | defineProperty(assertThisInitialized(_this), "isCollapsed", function () {
|
1910 | var onHover = _this.state.onHover;
|
1911 | return _this.activeSection() !== undefined && _this.activeItemHasSubNav() !== undefined && !onHover;
|
1912 | });
|
1913 |
|
1914 | defineProperty(assertThisInitialized(_this), "notLastElement", function (index) {
|
1915 | var nav = _this.props.nav;
|
1916 | return index !== nav.length - 1;
|
1917 | });
|
1918 |
|
1919 | defineProperty(assertThisInitialized(_this), "renderCollapseToggle", function (isToggleCollapsed, setToggleCollapsed) {
|
1920 | return React.createElement(CollapseToggle, {
|
1921 | onClick: function onClick() {
|
1922 | return setToggleCollapsed(!isToggleCollapsed);
|
1923 | }
|
1924 | }, React.createElement(ToggleIcon, {
|
1925 | icon: !isToggleCollapsed ? 'select-left' : 'select-right',
|
1926 | color: theme.colors.darkGray
|
1927 | }));
|
1928 | });
|
1929 |
|
1930 | _this.state = {
|
1931 | onHover: false
|
1932 | };
|
1933 | return _this;
|
1934 | }
|
1935 |
|
1936 | var _proto = SideNav.prototype;
|
1937 |
|
1938 | _proto.render = function render() {
|
1939 | var _this2 = this;
|
1940 |
|
1941 | var _this$props2 = this.props,
|
1942 | nav = _this$props2.nav,
|
1943 | _setRoute = _this$props2.setRoute,
|
1944 | customActions = _this$props2.customActions,
|
1945 | logo = _this$props2.logo,
|
1946 | symbol = _this$props2.symbol,
|
1947 | bgColor = _this$props2.bgColor,
|
1948 | dividerColor = _this$props2.dividerColor,
|
1949 | color = _this$props2.color,
|
1950 | hoverBgColor = _this$props2.hoverBgColor,
|
1951 | hoverColor = _this$props2.hoverColor,
|
1952 | highlightColor = _this$props2.highlightColor,
|
1953 | highlightBgColor = _this$props2.highlightBgColor,
|
1954 | colorTitle = _this$props2.colorTitle,
|
1955 | subNavBgColor = _this$props2.subNavBgColor,
|
1956 | subNavColor = _this$props2.subNavColor,
|
1957 | subNavColorTitle = _this$props2.subNavColorTitle,
|
1958 | subNavHoverBgColor = _this$props2.subNavHoverBgColor,
|
1959 | subNavHoverColor = _this$props2.subNavHoverColor,
|
1960 | subNavHighlightBgColor = _this$props2.subNavHighlightBgColor,
|
1961 | subNavHighlightColor = _this$props2.subNavHighlightColor,
|
1962 | customIconColor = _this$props2.customIconColor,
|
1963 | setToggleCollapsed = _this$props2.setToggleCollapsed,
|
1964 | isToggleCollapsed = _this$props2.isToggleCollapsed;
|
1965 | var collapse = this.isCollapsed();
|
1966 | return React.createElement(SideNavStyled, {
|
1967 | id: "menu"
|
1968 | }, React.createElement(Nav, {
|
1969 | isToggleCollapsed: isToggleCollapsed,
|
1970 | collapse: collapse,
|
1971 | onMouseEnter: this.onMouseEnter,
|
1972 | onMouseLeave: this.onMouseLeave,
|
1973 | bgColor: bgColor
|
1974 | }, setToggleCollapsed && this.renderCollapseToggle(isToggleCollapsed, setToggleCollapsed), !isToggleCollapsed && React.createElement("div", null, React.createElement(LogoContainer, null, React.createElement(Logo, {
|
1975 | collapse: collapse,
|
1976 | onClick: function onClick() {
|
1977 | return _setRoute('/');
|
1978 | }
|
1979 | }, React.createElement("img", {
|
1980 | src: logo,
|
1981 | "data-test-id": "menu-logo",
|
1982 | draggable: "false",
|
1983 | alt: "logo"
|
1984 | })), React.createElement(LogoIcon, {
|
1985 | collapse: collapse,
|
1986 | onClick: function onClick() {
|
1987 | return _setRoute('/');
|
1988 | }
|
1989 | }, React.createElement("img", {
|
1990 | src: symbol,
|
1991 | "data-test-id": "menu-small-logo",
|
1992 | draggable: "false",
|
1993 | alt: "small logo"
|
1994 | }))), nav.map(function (section, index) {
|
1995 | return React.createElement("div", {
|
1996 | key: section.id
|
1997 | }, React.createElement(SideNavSection, {
|
1998 | section: section,
|
1999 | collapse: collapse,
|
2000 | isActive: _this2.isActive,
|
2001 | setRoute: function setRoute(route) {
|
2002 | _this2.onMouseLeave();
|
2003 |
|
2004 | _setRoute(route);
|
2005 | },
|
2006 | hoverBgColor: hoverBgColor,
|
2007 | hoverColor: hoverColor,
|
2008 | color: color,
|
2009 | colorTitle: colorTitle,
|
2010 | highlightBgColor: highlightBgColor,
|
2011 | highlightColor: highlightColor
|
2012 | }), React.createElement(DividerContainer, null, React.createElement(Divider$1, {
|
2013 | color: dividerColor,
|
2014 | collapse: collapse,
|
2015 | show: _this2.notLastElement(index)
|
2016 | })));
|
2017 | }), React.createElement(CustomIconList, {
|
2018 | collapse: collapse
|
2019 | }, customActions.map(function (_ref2) {
|
2020 | var icon = _ref2.icon,
|
2021 | onClick = _ref2.onClick;
|
2022 | return React.createElement(CustomIconRow, {
|
2023 | key: icon
|
2024 | }, React.createElement(CustomIcon, {
|
2025 | icon: icon,
|
2026 | color: customIconColor,
|
2027 | size: "small",
|
2028 | onClick: onClick
|
2029 | }));
|
2030 | })))), this.activeItem() && this.activeItem().items && React.createElement(SubNav, {
|
2031 | collapse: collapse,
|
2032 | activeItem: this.activeItem(),
|
2033 | isActive: function isActive(item) {
|
2034 | return _this2.isActive(item);
|
2035 | },
|
2036 | setRoute: _setRoute,
|
2037 | subNavBgColor: subNavBgColor,
|
2038 | subNavColor: subNavColor,
|
2039 | subNavColorTitle: subNavColorTitle,
|
2040 | subNavHoverBgColor: subNavHoverBgColor,
|
2041 | subNavHoverColor: subNavHoverColor,
|
2042 | subNavHighlightBgColor: subNavHighlightBgColor,
|
2043 | subNavHighlightColor: subNavHighlightColor
|
2044 | }));
|
2045 | };
|
2046 |
|
2047 | return SideNav;
|
2048 | }(Component);
|
2049 |
|
2050 | var CollapseToggle = styled.div(_templateObject$g());
|
2051 | CollapseToggle.displayName = 'CollapseToggle';
|
2052 | var ToggleIcon = styled(Icon$1)(_templateObject2$6());
|
2053 | var DividerContainer = styled.div(_templateObject3$3());
|
2054 | var Divider$1 = styled.div(_templateObject4$2(), function (_ref3) {
|
2055 | var show = _ref3.show;
|
2056 | return show ? 'block' : 'none';
|
2057 | }, function (_ref4) {
|
2058 | var collapse = _ref4.collapse;
|
2059 | return collapse ? '56px' : '75%';
|
2060 | }, function (_ref5) {
|
2061 | var color = _ref5.color;
|
2062 | return color;
|
2063 | });
|
2064 | var SideNavStyled = styled.div(_templateObject5$2());
|
2065 | var Nav = styled.div(_templateObject6$2(), function (_ref6) {
|
2066 | var collapse = _ref6.collapse,
|
2067 | isToggleCollapsed = _ref6.isToggleCollapsed;
|
2068 | return collapse ? '56px' : isToggleCollapsed ? '20px' : '100%';
|
2069 | }, function (_ref7) {
|
2070 | var bgColor = _ref7.bgColor;
|
2071 | return bgColor;
|
2072 | }, function (_ref8) {
|
2073 | var collapse = _ref8.collapse;
|
2074 | return collapse ? 'none' : ' 2px 0px 2px rgba(0, 0, 0, 0.08)';
|
2075 | });
|
2076 | Nav.displayName = 'Nav';
|
2077 | var LogoContainer = styled.div(_templateObject7$1());
|
2078 | var LogoIcon = styled.div(_templateObject8(), function (_ref9) {
|
2079 | var collapse = _ref9.collapse;
|
2080 | return collapse ? 'block' : 'none';
|
2081 | });
|
2082 | LogoIcon.displayName = 'LogoIcon';
|
2083 | var Logo = styled.div(_templateObject9(), function (_ref10) {
|
2084 | var collapse = _ref10.collapse;
|
2085 | return collapse ? 'none' : 'flex';
|
2086 | });
|
2087 | Logo.displayName = 'Logo';
|
2088 | var CustomIconList = styled.div(_templateObject10(), function (_ref11) {
|
2089 | var collapse = _ref11.collapse;
|
2090 | return collapse ? '18px' : '32px';
|
2091 | });
|
2092 | var CustomIconRow = styled.div(_templateObject11());
|
2093 | var CustomIcon = styled(function (_ref12) {
|
2094 | var collapse = _ref12.collapse,
|
2095 | props = objectWithoutPropertiesLoose(_ref12, ["collapse"]);
|
2096 |
|
2097 | return React.createElement(Icon$1, props);
|
2098 | })(_templateObject12());
|
2099 | CustomIcon.displayName = 'CustomIcon';
|
2100 | SideNav.defaultProps = {
|
2101 | logo: QubeLogo,
|
2102 | symbol: QubeSymbol,
|
2103 | bgColor: theme.colors.deepBlue,
|
2104 | colorTitle: theme.colors.white,
|
2105 | color: theme.colors.white,
|
2106 | hoverBgColor: theme.colors.activeBlue,
|
2107 | hoverColor: theme.colors.white,
|
2108 | highlightBgColor: theme.colors.white,
|
2109 | highlightColor: theme.colors.deepBlue,
|
2110 | dividerColor: theme.colors.white,
|
2111 | subNavBgColor: theme.colors.white,
|
2112 | subNavColor: theme.colors.black,
|
2113 | subNavColorTitle: theme.colors.deepBlue,
|
2114 | subNavHoverBgColor: theme.colors.lightGray,
|
2115 | subNavHoverColor: theme.colors.activeBlue,
|
2116 | subNavHighlightBgColor: theme.colors.lightGray,
|
2117 | subNavHighlightColor: theme.colors.deepBlue,
|
2118 | customIconColor: theme.colors.white,
|
2119 | customActions: [],
|
2120 | isToggleCollapsed: false,
|
2121 | setToggleCollapsed: undefined
|
2122 | };
|
2123 | SideNav.propTypes = {
|
2124 | setRoute: PropTypes.func.isRequired,
|
2125 | location: PropTypes.string.isRequired,
|
2126 | matchPath: PropTypes.func.isRequired,
|
2127 | customActions: PropTypes.arrayOf(PropTypes.shape({
|
2128 | icon: PropTypes.string.isRequired,
|
2129 | onClick: PropTypes.func.isRequired
|
2130 | })),
|
2131 | nav: PropTypes.arrayOf(PropTypes.shape({
|
2132 | title: PropTypes.string,
|
2133 | items: PropTypes.arrayOf(PropTypes.shape({
|
2134 | icon: PropTypes.string,
|
2135 | title: PropTypes.string,
|
2136 | path: PropTypes.string,
|
2137 | items: PropTypes.arrayOf(PropTypes.shape({
|
2138 | title: PropTypes.string,
|
2139 | path: PropTypes.string
|
2140 | }))
|
2141 | }))
|
2142 | })).isRequired,
|
2143 |
|
2144 |
|
2145 | logo: PropTypes.string,
|
2146 |
|
2147 |
|
2148 | symbol: PropTypes.string,
|
2149 |
|
2150 |
|
2151 | bgColor: PropTypes.string,
|
2152 |
|
2153 |
|
2154 | color: PropTypes.string,
|
2155 |
|
2156 |
|
2157 | colorTitle: PropTypes.string,
|
2158 |
|
2159 |
|
2160 | hoverBgColor: PropTypes.string,
|
2161 |
|
2162 |
|
2163 | hoverColor: PropTypes.string,
|
2164 |
|
2165 |
|
2166 | highlightBgColor: PropTypes.string,
|
2167 |
|
2168 |
|
2169 | highlightColor: PropTypes.string,
|
2170 |
|
2171 |
|
2172 | dividerColor: PropTypes.string,
|
2173 |
|
2174 |
|
2175 | subNavBgColor: PropTypes.string,
|
2176 |
|
2177 |
|
2178 | subNavColor: PropTypes.string,
|
2179 |
|
2180 |
|
2181 | subNavColorTitle: PropTypes.string,
|
2182 |
|
2183 |
|
2184 | subNavHoverBgColor: PropTypes.string,
|
2185 |
|
2186 |
|
2187 | subNavHoverColor: PropTypes.string,
|
2188 |
|
2189 |
|
2190 | subNavHighlightBgColor: PropTypes.string,
|
2191 |
|
2192 |
|
2193 | subNavHighlightColor: PropTypes.string,
|
2194 |
|
2195 |
|
2196 | customIconColor: PropTypes.string,
|
2197 |
|
2198 |
|
2199 | isToggleCollapsed: PropTypes.bool,
|
2200 |
|
2201 |
|
2202 | setToggleCollapsed: PropTypes.func
|
2203 | };
|
2204 | SideNav.displayName = 'SideNav';
|
2205 |
|
2206 | function _templateObject3$4() {
|
2207 | var data = taggedTemplateLiteralLoose(["\n\tcolor: ", ";\n\tfont-weight: ", ";\n"]);
|
2208 |
|
2209 | _templateObject3$4 = function _templateObject3() {
|
2210 | return data;
|
2211 | };
|
2212 |
|
2213 | return data;
|
2214 | }
|
2215 |
|
2216 | function _templateObject2$7() {
|
2217 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\theight: 34px;\n\tflex-direction: column;\n\tjustify-content: center;\n\tpadding-left: 12px;\n\n\tborder: 0.5px solid ", ";\n\tcursor: pointer;\n\n\t&:focus span,\n\t&:hover span {\n\t\tcolor: ", ";\n\t}\n"]);
|
2218 |
|
2219 | _templateObject2$7 = function _templateObject2() {
|
2220 | return data;
|
2221 | };
|
2222 |
|
2223 | return data;
|
2224 | }
|
2225 |
|
2226 | function _templateObject$h() {
|
2227 | var data = taggedTemplateLiteralLoose(["\n\tposition: absolute;\n\tleft: 6px;\n\twidth: 2px;\n\theight: 20px;\n\tbackground-color: ", ";\n"]);
|
2228 |
|
2229 | _templateObject$h = function _templateObject() {
|
2230 | return data;
|
2231 | };
|
2232 |
|
2233 | return data;
|
2234 | }
|
2235 |
|
2236 | var AnchorMenuItem = function AnchorMenuItem(_ref) {
|
2237 | var title = _ref.title,
|
2238 | active = _ref.active,
|
2239 | props = objectWithoutPropertiesLoose(_ref, ["title", "active"]);
|
2240 |
|
2241 | return React.createElement(MenuItemStyled, props, active && React.createElement(Marker, null), React.createElement(NormalTextStyled, {
|
2242 | active: active
|
2243 | }, title));
|
2244 | };
|
2245 |
|
2246 | AnchorMenuItem.defaultProps = {
|
2247 | active: false
|
2248 | };
|
2249 | AnchorMenuItem.displayName = 'AnchorMenuItem';
|
2250 | AnchorMenuItem.propTypes = {
|
2251 | title: PropTypes.string.isRequired,
|
2252 | active: PropTypes.bool,
|
2253 | onClick: PropTypes.func.isRequired
|
2254 | };
|
2255 | var Marker = styled.div(_templateObject$h(), function (_ref2) {
|
2256 | var theme = _ref2.theme;
|
2257 | return theme.colors.deepBlue;
|
2258 | });
|
2259 | Marker.displayName = 'Marker';
|
2260 | var MenuItemStyled = styled.div(_templateObject2$7(), function (_ref3) {
|
2261 | var theme = _ref3.theme;
|
2262 | return theme.colors.lightGray;
|
2263 | }, function (_ref4) {
|
2264 | var theme = _ref4.theme;
|
2265 | return theme.colors.activeBlue;
|
2266 | });
|
2267 | MenuItemStyled.displayName = 'MenuItemStyled';
|
2268 | var NormalTextStyled = styled.span(_templateObject3$4(), function (_ref5) {
|
2269 | var theme = _ref5.theme,
|
2270 | active = _ref5.active;
|
2271 | return active ? theme.colors.deepBlue + " !important" : theme.colors.black;
|
2272 | }, function (_ref6) {
|
2273 | var active = _ref6.active;
|
2274 | return active ? 'bold' : 'normal';
|
2275 | });
|
2276 | NormalTextStyled.displayName = 'NormalTextStyled';
|
2277 |
|
2278 | function _templateObject$i() {
|
2279 | var data = taggedTemplateLiteralLoose(["\n\tposition: relative;\n\tborder: 0.5px solid ", ";\n\tborder-radius: 4px;\n"]);
|
2280 |
|
2281 | _templateObject$i = function _templateObject() {
|
2282 | return data;
|
2283 | };
|
2284 |
|
2285 | return data;
|
2286 | }
|
2287 |
|
2288 | var AnchorMenuMapper = function AnchorMenuMapper(_ref) {
|
2289 | var items = _ref.items,
|
2290 | props = objectWithoutPropertiesLoose(_ref, ["items"]);
|
2291 |
|
2292 | return React.createElement(AnchorMenuStyled, props, items.map(function (_ref2) {
|
2293 | var title = _ref2.title,
|
2294 | rest = objectWithoutPropertiesLoose(_ref2, ["title"]);
|
2295 |
|
2296 | return React.createElement(AnchorMenuItem, _extends_1({
|
2297 | key: title,
|
2298 | title: title
|
2299 | }, rest));
|
2300 | }));
|
2301 | };
|
2302 |
|
2303 | var AnchorMenuStyled = styled.div(_templateObject$i(), function (_ref3) {
|
2304 | var theme = _ref3.theme;
|
2305 | return theme.colors.lightGray;
|
2306 | });
|
2307 | AnchorMenuMapper.propTypes = {
|
2308 | items: PropTypes.arrayOf(PropTypes.shape({
|
2309 | title: PropTypes.string.isRequired,
|
2310 | anchor: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
2311 | current: PropTypes.instanceOf(Element)
|
2312 | })]),
|
2313 | path: PropTypes.string,
|
2314 | active: PropTypes.bool
|
2315 | })).isRequired
|
2316 | };
|
2317 |
|
2318 | var ScrollableAnchorMenu =
|
2319 |
|
2320 | function (_Component) {
|
2321 | inheritsLoose(ScrollableAnchorMenu, _Component);
|
2322 |
|
2323 | function ScrollableAnchorMenu(props) {
|
2324 | var _this;
|
2325 |
|
2326 | _this = _Component.call(this, props) || this;
|
2327 |
|
2328 | defineProperty(assertThisInitialized(_this), "setSelectedItem", function (selectedItem, lockSelectedItem, scrollingTo) {
|
2329 | _this.setState({
|
2330 | selectedItem: selectedItem,
|
2331 | lockSelectedItem: lockSelectedItem,
|
2332 | scrollingTo: scrollingTo
|
2333 | });
|
2334 | });
|
2335 |
|
2336 | defineProperty(assertThisInitialized(_this), "limitValue", function (val, min, max) {
|
2337 | return val < min ? min : val > max ? max : val;
|
2338 | });
|
2339 |
|
2340 | defineProperty(assertThisInitialized(_this), "getCoords", function (elem) {
|
2341 | var _elem$getBoundingClie = elem.getBoundingClientRect(),
|
2342 | top = _elem$getBoundingClie.top;
|
2343 |
|
2344 | var _document = document,
|
2345 | body = _document.body;
|
2346 | var docEl = document.documentElement;
|
2347 | var scrollTop = window.scrollY || docEl.scrollTop || body.scrollTop;
|
2348 | var clientTop = docEl.clientTop || body.clientTop || 0;
|
2349 | return top + scrollTop - clientTop;
|
2350 | });
|
2351 |
|
2352 | defineProperty(assertThisInitialized(_this), "findCurrentSection", function (items) {
|
2353 | var sectionIndex = items.findIndex(function (_ref) {
|
2354 | var anchor = _ref.anchor;
|
2355 | return _this.getCoords(anchor.current) - document.documentElement.scrollTop > 0;
|
2356 | });
|
2357 | return sectionIndex >= 0 ? sectionIndex - 1 : items.length - 1;
|
2358 | });
|
2359 |
|
2360 | defineProperty(assertThisInitialized(_this), "searchItemsForCurrentSection", function () {
|
2361 | var items = _this.props.items;
|
2362 |
|
2363 | var currentSection = _this.limitValue(_this.findCurrentSection(items), 0, items.length - 1);
|
2364 |
|
2365 | return currentSection >= 0 ? currentSection : items.length - 1;
|
2366 | });
|
2367 |
|
2368 | defineProperty(assertThisInitialized(_this), "clearLockTimeOut", function () {
|
2369 | clearTimeout(_this.lockClear);
|
2370 | _this.lockClear = setTimeout(function () {
|
2371 | _this.setSelectedItem(_this.searchItemsForCurrentSection(), false, -1);
|
2372 | }, 200);
|
2373 | });
|
2374 |
|
2375 | defineProperty(assertThisInitialized(_this), "handleScroll", function () {
|
2376 | var _this$state = _this.state,
|
2377 | selectedItem = _this$state.selectedItem,
|
2378 | lockSelectedItem = _this$state.lockSelectedItem,
|
2379 | scrollingTo = _this$state.scrollingTo;
|
2380 |
|
2381 | if (!lockSelectedItem) {
|
2382 | _this.setSelectedItem(_this.searchItemsForCurrentSection(), false, -1);
|
2383 | } else if (scrollingTo === document.documentElement.scrollTop) {
|
2384 | clearTimeout(_this.lockClear);
|
2385 |
|
2386 | _this.setSelectedItem(selectedItem, false, scrollingTo);
|
2387 | } else {
|
2388 | _this.clearLockTimeOut();
|
2389 | }
|
2390 | });
|
2391 |
|
2392 | defineProperty(assertThisInitialized(_this), "onItemClick", function (anchor, index) {
|
2393 | var y = _this.getCoords(anchor.current);
|
2394 |
|
2395 | _this.setSelectedItem(index, true, y);
|
2396 |
|
2397 | window.scrollTo({
|
2398 | top: y,
|
2399 | behavior: 'smooth'
|
2400 | });
|
2401 | });
|
2402 |
|
2403 | _this.lockClear = '';
|
2404 | _this.state = {
|
2405 | selectedItem: 0,
|
2406 | lockSelectedItem: false,
|
2407 | scrollingTo: -1
|
2408 | };
|
2409 | return _this;
|
2410 | }
|
2411 |
|
2412 | var _proto = ScrollableAnchorMenu.prototype;
|
2413 |
|
2414 | _proto.componentDidMount = function componentDidMount() {
|
2415 | window.addEventListener('scroll', this.handleScroll);
|
2416 | };
|
2417 |
|
2418 | _proto.UNSAFE_componentWillUnmount = function UNSAFE_componentWillUnmount() {
|
2419 | window.removeEventListener('scroll', this.handleScroll);
|
2420 | };
|
2421 |
|
2422 | _proto.render = function render() {
|
2423 | var _this2 = this;
|
2424 |
|
2425 | var selectedItem = this.state.selectedItem;
|
2426 |
|
2427 | var _this$props = this.props,
|
2428 | items = _this$props.items,
|
2429 | props = objectWithoutPropertiesLoose(_this$props, ["items"]);
|
2430 |
|
2431 | var computedItems = items.map(function (item, index) {
|
2432 | return _extends_1({
|
2433 | onClick: function onClick() {
|
2434 | return _this2.onItemClick(item.anchor, index);
|
2435 | },
|
2436 | active: selectedItem === index
|
2437 | }, item);
|
2438 | });
|
2439 | return React.createElement(AnchorMenuMapper, _extends_1({
|
2440 | items: computedItems
|
2441 | }, props));
|
2442 | };
|
2443 |
|
2444 | return ScrollableAnchorMenu;
|
2445 | }(Component);
|
2446 |
|
2447 | ScrollableAnchorMenu.displayName = 'ScrollableAnchorMenu';
|
2448 | ScrollableAnchorMenu.propTypes = {
|
2449 | items: PropTypes.arrayOf(PropTypes.shape({
|
2450 | anchor: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
2451 | current: PropTypes.instanceOf(Element)
|
2452 | })]),
|
2453 | title: PropTypes.string.isRequired
|
2454 | })).isRequired
|
2455 | };
|
2456 |
|
2457 | var NavigationAnchorMenu = function NavigationAnchorMenu(_ref) {
|
2458 | var items = _ref.items,
|
2459 | onItemClick = _ref.onItemClick;
|
2460 | var newItems = items.map(function (item) {
|
2461 | return _extends_1({
|
2462 | onClick: function onClick() {
|
2463 | return onItemClick(item.path);
|
2464 | }
|
2465 | }, item);
|
2466 | });
|
2467 | return React.createElement(AnchorMenuMapper, {
|
2468 | items: newItems
|
2469 | });
|
2470 | };
|
2471 |
|
2472 | NavigationAnchorMenu.displayName = 'NavigationAnchorMenu';
|
2473 | NavigationAnchorMenu.propTypes = {
|
2474 | onItemClick: PropTypes.func.isRequired,
|
2475 | items: PropTypes.arrayOf(PropTypes.shape({
|
2476 | path: PropTypes.string.isRequired,
|
2477 | title: PropTypes.string.isRequired,
|
2478 | active: PropTypes.bool
|
2479 | })).isRequired
|
2480 | };
|
2481 |
|
2482 | var AnchorMenu = function AnchorMenu(_ref) {
|
2483 | var type = _ref.type,
|
2484 | items = _ref.items,
|
2485 | onItemClick = _ref.onItemClick,
|
2486 | props = objectWithoutPropertiesLoose(_ref, ["type", "items", "onItemClick"]);
|
2487 |
|
2488 | return type === 'scrollable' ? React.createElement(ScrollableAnchorMenu, _extends_1({
|
2489 | items: items
|
2490 | }, props)) : React.createElement(NavigationAnchorMenu, _extends_1({
|
2491 | items: items,
|
2492 | onItemClick: onItemClick
|
2493 | }, props));
|
2494 | };
|
2495 |
|
2496 | AnchorMenu.defaultProps = {
|
2497 | onItemClick: undefined
|
2498 | };
|
2499 | AnchorMenu.propTypes = {
|
2500 | type: PropTypes.oneOf(['scrollable', 'navigation']).isRequired,
|
2501 | items: PropTypes.arrayOf(PropTypes.shape({
|
2502 | title: PropTypes.string.isRequired,
|
2503 | anchor: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
2504 | current: PropTypes.instanceOf(Element)
|
2505 | })]),
|
2506 | path: PropTypes.string,
|
2507 | active: PropTypes.bool
|
2508 | })).isRequired,
|
2509 | onItemClick: PropTypes.func
|
2510 | };
|
2511 |
|
2512 | function _templateObject$j() {
|
2513 | var data = taggedTemplateLiteralLoose(["\n\tpadding: 24px 15px;\n\n\tbackground-color: ", " !important;\n\tborder-radius: ", " !important;\n\tcolor: ", " !important;\n\tvertical-align: middle;\n\n\tp {\n\t\tpadding: 0 !important;\n\t\tmargin: 0 !important;\n\t\ttext-align: center;\n\t}\n"]);
|
2514 |
|
2515 | _templateObject$j = function _templateObject() {
|
2516 | return data;
|
2517 | };
|
2518 |
|
2519 | return data;
|
2520 | }
|
2521 | var BlockWrapper = styled.div(_templateObject$j(), function (_ref) {
|
2522 | var theme = _ref.theme,
|
2523 | background = _ref.background;
|
2524 | return background || theme.block.backgroundColor;
|
2525 | }, function (_ref2) {
|
2526 | var theme = _ref2.theme;
|
2527 | return theme.block.borderRadius;
|
2528 | }, function (_ref3) {
|
2529 | var theme = _ref3.theme,
|
2530 | color = _ref3.color;
|
2531 | return color || theme.block.color;
|
2532 | });
|
2533 | BlockWrapper.displayName = 'BlockWrapper';
|
2534 | BlockWrapper.propTypes = {
|
2535 | color: PropTypes.string,
|
2536 | background: PropTypes.string
|
2537 | };
|
2538 |
|
2539 |
|
2540 |
|
2541 |
|
2542 |
|
2543 | var Block = function Block(_ref) {
|
2544 | var value = _ref.value,
|
2545 | label = _ref.label,
|
2546 | props = objectWithoutPropertiesLoose(_ref, ["value", "label"]);
|
2547 |
|
2548 | return React.createElement(BlockWrapper, props, React.createElement("div", null, React.createElement("p", {
|
2549 | style: {
|
2550 | fontSize: 40
|
2551 | }
|
2552 | }, " " + value), React.createElement("p", {
|
2553 | style: {
|
2554 | fontSize: 14,
|
2555 | textTransform: 'uppercase'
|
2556 | }
|
2557 | }, label)));
|
2558 | };
|
2559 |
|
2560 | Block.defaultProps = {
|
2561 | color: '#fff',
|
2562 | background: '#a21d21'
|
2563 | };
|
2564 | Block.propTypes = {
|
2565 |
|
2566 | value: PropTypes.number.isRequired,
|
2567 |
|
2568 |
|
2569 | label: PropTypes.string.isRequired,
|
2570 |
|
2571 |
|
2572 | color: PropTypes.string,
|
2573 |
|
2574 |
|
2575 | background: PropTypes.string
|
2576 | };
|
2577 | Block.displayName = 'Block';
|
2578 |
|
2579 | function _templateObject$k() {
|
2580 | var data = taggedTemplateLiteralLoose(["\n\tvertical-align: middle;\n\n\t&&& p {\n\t\tpadding: 0 !important;\n\t\tmargin: 0 !important;\n\t\ttext-align: left;\n\t}\n\n\t&&& div {\n\t\tpadding-left: 8px !important;\n\n\t\tborder-color: ", ";\n\t\tborder-left-width: 5px;\n\t\tborder-left-style: solid;\n\t}\n"]);
|
2581 |
|
2582 | _templateObject$k = function _templateObject() {
|
2583 | return data;
|
2584 | };
|
2585 |
|
2586 | return data;
|
2587 | }
|
2588 | var BlockBarWrapper = styled(BlockWrapper)(_templateObject$k(), function (_ref) {
|
2589 | var theme = _ref.theme,
|
2590 | labelColor = _ref.labelColor;
|
2591 | return labelColor || theme.block.labelColor;
|
2592 | });
|
2593 | BlockBarWrapper.propTypes = {
|
2594 | labelColor: PropTypes.string
|
2595 | };
|
2596 | BlockBarWrapper.displayName = 'BlockBarWrapper';
|
2597 |
|
2598 |
|
2599 |
|
2600 |
|
2601 |
|
2602 | var BlockBar = function BlockBar(_ref) {
|
2603 | var value = _ref.value,
|
2604 | label = _ref.label,
|
2605 | labelColor = _ref.labelColor,
|
2606 | props = objectWithoutPropertiesLoose(_ref, ["value", "label", "labelColor"]);
|
2607 |
|
2608 | return React.createElement(BlockBarWrapper, _extends_1({
|
2609 | labelColor: labelColor
|
2610 | }, props), React.createElement("div", null, React.createElement("p", {
|
2611 | style: {
|
2612 | fontSize: 40
|
2613 | }
|
2614 | }, " " + value), React.createElement("p", {
|
2615 | style: {
|
2616 | fontSize: 14,
|
2617 | textTransform: 'uppercase'
|
2618 | }
|
2619 | }, label)));
|
2620 | };
|
2621 |
|
2622 | BlockBar.defaultProps = {
|
2623 | labelColor: '#ffffff'
|
2624 | };
|
2625 | BlockBar.propTypes = {
|
2626 | value: PropTypes.number.isRequired,
|
2627 | label: PropTypes.string.isRequired,
|
2628 | labelColor: PropTypes.string
|
2629 | };
|
2630 | BlockBar.displayName = 'BlockBar';
|
2631 |
|
2632 | function _templateObject$l() {
|
2633 | var data = taggedTemplateLiteralLoose(["\n\tcolor: ", " !important;\n\tfont-weight: ", " !important;\n"]);
|
2634 |
|
2635 | _templateObject$l = function _templateObject() {
|
2636 | return data;
|
2637 | };
|
2638 |
|
2639 | return data;
|
2640 | }
|
2641 | var Span = styled.span(_templateObject$l(), function (_ref) {
|
2642 | var theme = _ref.theme,
|
2643 | type = _ref.type,
|
2644 | color = _ref.color;
|
2645 | return type ? theme.span[type] : color || theme.span.defaultColor;
|
2646 | }, function (_ref2) {
|
2647 | var bold = _ref2.bold;
|
2648 | return bold ? 700 : undefined;
|
2649 | });
|
2650 | Span.propTypes = {
|
2651 | bold: PropTypes.bool,
|
2652 | color: PropTypes.string,
|
2653 | type: PropTypes.oneOf(['positive', 'negative', 'primary'])
|
2654 | };
|
2655 | Span.displayName = 'Span';
|
2656 |
|
2657 | function _templateObject$m() {
|
2658 | var data = taggedTemplateLiteralLoose(["\n\tbox-shadow: 0 0 3px rgba(0, 0, 0, 0.25);\n\n\t&&.ui.modal > .close {\n\t\ttop: 8px;\n\t\tright: 8px;\n\t\tcolor: ", ";\n\t\tpadding: 0;\n\t\twidth: 10px;\n\t\tfont-size: 18px;\n\n\t\t:hover {\n\t\t\tcolor: ", ";\n\t\t}\n\t}\n"]);
|
2659 |
|
2660 | _templateObject$m = function _templateObject() {
|
2661 | return data;
|
2662 | };
|
2663 |
|
2664 | return data;
|
2665 | }
|
2666 |
|
2667 | var ModalStyled = function ModalStyled(_ref) {
|
2668 | var children = _ref.children,
|
2669 | props = objectWithoutPropertiesLoose(_ref, ["children"]);
|
2670 |
|
2671 | return React.createElement(ModalStyledWrapper, props, children);
|
2672 | };
|
2673 |
|
2674 | var ModalStyledWrapper = styled(Modal)(_templateObject$m(), function (_ref2) {
|
2675 | var theme = _ref2.theme;
|
2676 | return theme.colors.gray;
|
2677 | }, function (_ref3) {
|
2678 | var theme = _ref3.theme;
|
2679 | return theme.colors.mediumGray;
|
2680 | });
|
2681 | ModalStyled.displayName = 'ModalStyled';
|
2682 | ModalStyled.propTypes = {
|
2683 | children: PropTypes.node
|
2684 | };
|
2685 | ModalStyled.defaultProps = {
|
2686 | children: null
|
2687 | };
|
2688 |
|
2689 | var secondary = {
|
2690 | name: 'SECONDARY',
|
2691 | colors: colors,
|
2692 | borderRadius: '0',
|
2693 | navbar: {
|
2694 | backgroundColor: colors.darkRed
|
2695 | },
|
2696 | buttons: {
|
2697 | borderRadius: '0',
|
2698 | primary: colors.activeBlue,
|
2699 | danger: colors.red,
|
2700 | success: colors.green,
|
2701 | white: colors.white,
|
2702 | activeBg: {
|
2703 | primary: colors.darkBlue,
|
2704 | danger: colors.darkRed,
|
2705 | success: colors.green,
|
2706 | white: colors.white
|
2707 | },
|
2708 | dropdown: {
|
2709 | separatorColor: colors.gray,
|
2710 | activeBackgroundColor: colors.gray
|
2711 | }
|
2712 | },
|
2713 | list: {
|
2714 | pairCell: colors.lightGray,
|
2715 | unPairCell: colors.white,
|
2716 | title: colors.black,
|
2717 | additionalInfo: colors.gray,
|
2718 | activeCell: colors.lightBlue
|
2719 | },
|
2720 | span: {
|
2721 | defaultColor: colors.activeBlue,
|
2722 | negative: colors.red,
|
2723 | positive: colors.green,
|
2724 | primary: colors.activeBlue
|
2725 | },
|
2726 | block: {
|
2727 | borderRadius: '0',
|
2728 | backgroundColor: colors.darkRed,
|
2729 | labelColor: colors.darkGray,
|
2730 | color: colors.darkGray
|
2731 | },
|
2732 | input: {
|
2733 | borderRadius: '0'
|
2734 | },
|
2735 | select: {
|
2736 | borderRadius: '4px',
|
2737 | placeholderColor: '#424242',
|
2738 | focusedBackgroundColor: '#ECECEC',
|
2739 | selectedBackgroundColor: '#005BEA',
|
2740 | menuPadding: '5px 10px 5px 10px'
|
2741 | },
|
2742 | toggle: {
|
2743 | color: colors.green
|
2744 | },
|
2745 | timePicker: {
|
2746 | errorColor: colors.red,
|
2747 | disabledColor: colors.lightGray,
|
2748 | primaryColor: colors.activeBlue,
|
2749 | activeColor: colors.deepBlue,
|
2750 | hoverColor: colors.lightGray,
|
2751 | textColor: colors.darkGray
|
2752 | },
|
2753 | toast: {
|
2754 | titleColor: colors.darkGray,
|
2755 | messageColor: colors.mediumGray,
|
2756 | errorColor: colors.red,
|
2757 | successColor: colors.green,
|
2758 | warningColor: colors.yellow
|
2759 | },
|
2760 | status: {
|
2761 | bg: {
|
2762 | success: colors.green,
|
2763 | error: colors.red,
|
2764 | info: colors.lightBlue
|
2765 | },
|
2766 | color: {
|
2767 | success: colors.white,
|
2768 | error: colors.white,
|
2769 | info: colors.darkGray
|
2770 | }
|
2771 | }
|
2772 | };
|
2773 |
|
2774 | function _templateObject$n() {
|
2775 | var data = taggedTemplateLiteralLoose(["\n\t&&.header {\n\t\tborder-bottom: none;\n\t}\n"]);
|
2776 |
|
2777 | _templateObject$n = function _templateObject() {
|
2778 | return data;
|
2779 | };
|
2780 |
|
2781 | return data;
|
2782 | }
|
2783 | var NoBorderModalHeader = styled(Header)(_templateObject$n());
|
2784 |
|
2785 | var ModalHeader = function ModalHeader(_ref) {
|
2786 | var children = _ref.children;
|
2787 | return React.createElement(NoBorderModalHeader, null, children);
|
2788 | };
|
2789 |
|
2790 | var ModalTitleHeader = function ModalTitleHeader(_ref2) {
|
2791 | var title = _ref2.title;
|
2792 | return React.createElement(NoBorderModalHeader, {
|
2793 | content: title
|
2794 | });
|
2795 | };
|
2796 | var ModalIconTitleHeader = function ModalIconTitleHeader(_ref3) {
|
2797 | var title = _ref3.title,
|
2798 | icon = _ref3.icon,
|
2799 | iconColor = _ref3.iconColor;
|
2800 | return React.createElement(NoBorderModalHeader, {
|
2801 | icon: React.createElement(Icon$1, {
|
2802 | color: iconColor,
|
2803 | size: "big",
|
2804 | icon: icon
|
2805 | }),
|
2806 | content: title
|
2807 | });
|
2808 | };
|
2809 | ModalHeader.defaultProps = {
|
2810 | children: ''
|
2811 | };
|
2812 | ModalHeader.propTypes = {
|
2813 | children: PropTypes.node
|
2814 | };
|
2815 | ModalHeader.displayName = 'ModalHeader';
|
2816 | ModalTitleHeader.propTypes = {
|
2817 | title: PropTypes.string.isRequired
|
2818 | };
|
2819 | ModalTitleHeader.displayName = 'ModalTitleHeader';
|
2820 | ModalIconTitleHeader.defaultProps = {
|
2821 | title: '',
|
2822 | iconColor: theme.colors.red
|
2823 | };
|
2824 | ModalIconTitleHeader.propTypes = {
|
2825 | title: PropTypes.string,
|
2826 | icon: PropTypes.string.isRequired,
|
2827 | iconColor: PropTypes.string
|
2828 | };
|
2829 | ModalIconTitleHeader.displayName = 'ModalIconTitleHeader';
|
2830 |
|
2831 | var ModalContent = function ModalContent(_ref) {
|
2832 | var children = _ref.children;
|
2833 | return React.createElement(Modal.Content, null, children);
|
2834 | };
|
2835 |
|
2836 | ModalContent.defaultProps = {
|
2837 | children: null
|
2838 | };
|
2839 | ModalContent.propTypes = {
|
2840 | children: PropTypes.node
|
2841 | };
|
2842 | ModalContent.displayName = 'ModalContent';
|
2843 |
|
2844 | function _templateObject$o() {
|
2845 | var data = taggedTemplateLiteralLoose(["\n\tpadding: 1.25rem 1.5rem;\n"]);
|
2846 |
|
2847 | _templateObject$o = function _templateObject() {
|
2848 | return data;
|
2849 | };
|
2850 |
|
2851 | return data;
|
2852 | }
|
2853 | var SemanticModalFooter = styled.div(_templateObject$o());
|
2854 |
|
2855 | var ModalFooter = function ModalFooter(_ref) {
|
2856 | var children = _ref.children;
|
2857 | return React.createElement(SemanticModalFooter, null, children);
|
2858 | };
|
2859 |
|
2860 | var ModalSingleButtonFooter = function ModalSingleButtonFooter(_ref2) {
|
2861 | var buttonText = _ref2.buttonText,
|
2862 | buttonOnClickHandler = _ref2.buttonOnClickHandler,
|
2863 | buttonId = _ref2.buttonId,
|
2864 | loading = _ref2.loading,
|
2865 | props = objectWithoutPropertiesLoose(_ref2, ["buttonText", "buttonOnClickHandler", "buttonId", "loading"]);
|
2866 |
|
2867 | return React.createElement(SemanticModalFooter, null, React.createElement(Grid, null, React.createElement(Grid.Column, {
|
2868 | align: "right"
|
2869 | }, React.createElement(Button$1, _extends_1({
|
2870 | id: buttonId,
|
2871 | onClick: buttonOnClickHandler,
|
2872 | content: buttonText,
|
2873 | loading: loading
|
2874 | }, props)))));
|
2875 | };
|
2876 | var ModalDoubleButtonFooter = function ModalDoubleButtonFooter(_ref3) {
|
2877 | var leftButtonText = _ref3.leftButtonText,
|
2878 | leftButtonOnClickHandler = _ref3.leftButtonOnClickHandler,
|
2879 | leftButtonId = _ref3.leftButtonId,
|
2880 | rightButtonText = _ref3.rightButtonText,
|
2881 | rightButtonOnClickHandler = _ref3.rightButtonOnClickHandler,
|
2882 | rightButtonId = _ref3.rightButtonId,
|
2883 | loading = _ref3.loading,
|
2884 | disabled = _ref3.disabled,
|
2885 | props = objectWithoutPropertiesLoose(_ref3, ["leftButtonText", "leftButtonOnClickHandler", "leftButtonId", "rightButtonText", "rightButtonOnClickHandler", "rightButtonId", "loading", "disabled"]);
|
2886 |
|
2887 | return React.createElement(SemanticModalFooter, null, React.createElement(Grid, null, React.createElement(Grid.Column, {
|
2888 | verticalAlign: "middle",
|
2889 | width: 8,
|
2890 | align: "left"
|
2891 | }, React.createElement(ButtonLink, {
|
2892 | id: leftButtonId,
|
2893 | onClick: leftButtonOnClickHandler
|
2894 | }, leftButtonText)), React.createElement(Grid.Column, {
|
2895 | width: 8,
|
2896 | align: "right"
|
2897 | }, React.createElement(Button$1, _extends_1({
|
2898 | id: rightButtonId,
|
2899 | onClick: rightButtonOnClickHandler,
|
2900 | content: rightButtonText,
|
2901 | loading: loading,
|
2902 | disabled: disabled
|
2903 | }, props)))));
|
2904 | };
|
2905 | var ModalDoubleButtonContentFooter = function ModalDoubleButtonContentFooter(_ref4) {
|
2906 | var leftButtonText = _ref4.leftButtonText,
|
2907 | leftButtonOnClickHandler = _ref4.leftButtonOnClickHandler,
|
2908 | leftButtonId = _ref4.leftButtonId,
|
2909 | rightButtonText = _ref4.rightButtonText,
|
2910 | rightButtonOnClickHandler = _ref4.rightButtonOnClickHandler,
|
2911 | rightButtonId = _ref4.rightButtonId,
|
2912 | loading = _ref4.loading,
|
2913 | disabled = _ref4.disabled,
|
2914 | props = objectWithoutPropertiesLoose(_ref4, ["leftButtonText", "leftButtonOnClickHandler", "leftButtonId", "rightButtonText", "rightButtonOnClickHandler", "rightButtonId", "loading", "disabled"]);
|
2915 |
|
2916 | return React.createElement(Grid, null, React.createElement(Grid.Column, {
|
2917 | verticalAlign: "middle",
|
2918 | width: 8,
|
2919 | align: "left"
|
2920 | }, React.createElement(ButtonLink, {
|
2921 | id: leftButtonId,
|
2922 | onClick: leftButtonOnClickHandler
|
2923 | }, leftButtonText)), React.createElement(Grid.Column, {
|
2924 | width: 8,
|
2925 | align: "right"
|
2926 | }, React.createElement(Button$1, _extends_1({
|
2927 | id: rightButtonId,
|
2928 | onClick: rightButtonOnClickHandler,
|
2929 | content: rightButtonText,
|
2930 | loading: loading,
|
2931 | disabled: disabled
|
2932 | }, props))));
|
2933 | };
|
2934 | ModalFooter.defaultProps = {
|
2935 | children: null
|
2936 | };
|
2937 | ModalFooter.propTypes = {
|
2938 | children: PropTypes.node
|
2939 | };
|
2940 | ModalFooter.displayName = 'ModalFooter';
|
2941 | ModalSingleButtonFooter.defaultProps = {
|
2942 | buttonId: '',
|
2943 | loading: false
|
2944 | };
|
2945 | ModalSingleButtonFooter.propTypes = {
|
2946 | buttonId: PropTypes.string,
|
2947 | buttonText: PropTypes.string.isRequired,
|
2948 | buttonOnClickHandler: PropTypes.func.isRequired,
|
2949 | loading: PropTypes.bool
|
2950 | };
|
2951 | ModalSingleButtonFooter.displayName = 'ModalSingleButtonFooter';
|
2952 | ModalDoubleButtonFooter.defaultProps = {
|
2953 | leftButtonId: '',
|
2954 | rightButtonId: '',
|
2955 | loading: false,
|
2956 | disabled: false
|
2957 | };
|
2958 | ModalDoubleButtonFooter.propTypes = {
|
2959 | leftButtonId: PropTypes.string,
|
2960 | leftButtonText: PropTypes.string.isRequired,
|
2961 | leftButtonOnClickHandler: PropTypes.func.isRequired,
|
2962 | rightButtonId: PropTypes.string,
|
2963 | rightButtonText: PropTypes.string.isRequired,
|
2964 | rightButtonOnClickHandler: PropTypes.func.isRequired,
|
2965 | loading: PropTypes.bool,
|
2966 | disabled: PropTypes.bool
|
2967 | };
|
2968 | ModalDoubleButtonFooter.displayName = 'ModalDoubleButtonFooter';
|
2969 | ModalDoubleButtonContentFooter.defaultProps = {
|
2970 | leftButtonId: '',
|
2971 | rightButtonId: '',
|
2972 | loading: false,
|
2973 | disabled: false
|
2974 | };
|
2975 | ModalDoubleButtonContentFooter.propTypes = {
|
2976 | leftButtonId: PropTypes.string,
|
2977 | leftButtonText: PropTypes.string.isRequired,
|
2978 | leftButtonOnClickHandler: PropTypes.func.isRequired,
|
2979 | rightButtonId: PropTypes.string,
|
2980 | rightButtonText: PropTypes.string.isRequired,
|
2981 | rightButtonOnClickHandler: PropTypes.func.isRequired,
|
2982 | loading: PropTypes.bool,
|
2983 | disabled: PropTypes.bool
|
2984 | };
|
2985 | ModalDoubleButtonContentFooter.displayName = 'ModalDoubleButtonContentFooter';
|
2986 |
|
2987 | var Modal$1 = function Modal$$1(_ref) {
|
2988 | var children = _ref.children,
|
2989 | dimmer = _ref.dimmer,
|
2990 | size = _ref.size,
|
2991 | closeOnDimmerClick = _ref.closeOnDimmerClick,
|
2992 | props = objectWithoutPropertiesLoose(_ref, ["children", "dimmer", "size", "closeOnDimmerClick"]);
|
2993 |
|
2994 | return React.createElement(ModalStyled, _extends_1({
|
2995 | dimmer: dimmer,
|
2996 | size: size,
|
2997 | closeOnDimmerClick: closeOnDimmerClick,
|
2998 | closeIcon: true
|
2999 | }, props), children);
|
3000 | };
|
3001 |
|
3002 | Modal$1.Header = function (_ref2) {
|
3003 | var props = _extends_1({}, _ref2);
|
3004 |
|
3005 | return React.createElement(ModalHeader, props);
|
3006 | };
|
3007 |
|
3008 | Modal$1.Header.displayName = 'Modal.Header';
|
3009 |
|
3010 | Modal$1.TitleHeader = function (_ref3) {
|
3011 | var props = _extends_1({}, _ref3);
|
3012 |
|
3013 | return React.createElement(ModalTitleHeader, props);
|
3014 | };
|
3015 |
|
3016 | Modal$1.TitleHeader.displayName = 'Modal.ModalTitleHeader';
|
3017 |
|
3018 | Modal$1.IconTitleHeader = function (_ref4) {
|
3019 | var props = _extends_1({}, _ref4);
|
3020 |
|
3021 | return React.createElement(ModalIconTitleHeader, props);
|
3022 | };
|
3023 |
|
3024 | Modal$1.IconTitleHeader.displayName = 'Modal.ModalIconTitleHeader';
|
3025 |
|
3026 | Modal$1.Content = function (_ref5) {
|
3027 | var props = _extends_1({}, _ref5);
|
3028 |
|
3029 | return React.createElement(ModalContent, props);
|
3030 | };
|
3031 |
|
3032 | Modal$1.Content.displayName = 'Modal.Content';
|
3033 |
|
3034 | Modal$1.Footer = function (_ref6) {
|
3035 | var props = _extends_1({}, _ref6);
|
3036 |
|
3037 | return React.createElement(ModalFooter, props);
|
3038 | };
|
3039 |
|
3040 | Modal$1.Footer.displayName = 'Modal.Footer';
|
3041 |
|
3042 | Modal$1.SingleButtonFooter = function (_ref7) {
|
3043 | var props = _extends_1({}, _ref7);
|
3044 |
|
3045 | return React.createElement(ModalSingleButtonFooter, props);
|
3046 | };
|
3047 |
|
3048 | Modal$1.SingleButtonFooter.displayName = 'Modal.SingleButtonFooter';
|
3049 |
|
3050 | Modal$1.DoubleButtonFooter = function (_ref8) {
|
3051 | var props = _extends_1({}, _ref8);
|
3052 |
|
3053 | return React.createElement(ModalDoubleButtonFooter, props);
|
3054 | };
|
3055 |
|
3056 | Modal$1.DoubleButtonFooter.displayName = 'Modal.DoubleButtonFooter';
|
3057 |
|
3058 | Modal$1.ModalDoubleButtonContentFooter = function (_ref9) {
|
3059 | var props = _extends_1({}, _ref9);
|
3060 |
|
3061 | return React.createElement(ModalDoubleButtonContentFooter, props);
|
3062 | };
|
3063 |
|
3064 | Modal$1.ModalDoubleButtonContentFooter.displayName = 'Modal.ModalDoubleButtonContentFooter';
|
3065 | Modal$1.defaultProps = {
|
3066 | dimmer: 'inverted',
|
3067 | size: 'tiny',
|
3068 | children: null,
|
3069 | closeOnDimmerClick: false,
|
3070 | closeIcon: true
|
3071 | };
|
3072 | Modal$1.propTypes = {
|
3073 |
|
3074 | children: PropTypes.node,
|
3075 |
|
3076 |
|
3077 | dimmer: PropTypes.string,
|
3078 |
|
3079 |
|
3080 | size: PropTypes.string,
|
3081 |
|
3082 |
|
3083 | closeOnDimmerClick: PropTypes.bool,
|
3084 |
|
3085 |
|
3086 | closeIcon: PropTypes.bool
|
3087 | };
|
3088 | Modal$1.displayName = 'Modal';
|
3089 |
|
3090 | function _templateObject5$3() {
|
3091 | var data = taggedTemplateLiteralLoose(["\n\t&&&& {\n\t\tright: 0;\n\t\tbottom: 0;\n\t\ttop: 0;\n\t\twidth: 100% !important;\n\t\theight: 100%;\n\t\tmargin: 0 !important;\n\t\tposition: relative;\n\t}\n"]);
|
3092 |
|
3093 | _templateObject5$3 = function _templateObject5() {
|
3094 | return data;
|
3095 | };
|
3096 |
|
3097 | return data;
|
3098 | }
|
3099 |
|
3100 | function _templateObject4$3() {
|
3101 | var data = taggedTemplateLiteralLoose(["\n\t.ui.dimmer {\n\t\tpadding: 0;\n\t}\n"]);
|
3102 |
|
3103 | _templateObject4$3 = function _templateObject4() {
|
3104 | return data;
|
3105 | };
|
3106 |
|
3107 | return data;
|
3108 | }
|
3109 |
|
3110 | function _templateObject3$5() {
|
3111 | var data = taggedTemplateLiteralLoose(["\n\tposition: absolute;\n\ttop: 24px;\n\tleft: 24px;\n"]);
|
3112 |
|
3113 | _templateObject3$5 = function _templateObject3() {
|
3114 | return data;
|
3115 | };
|
3116 |
|
3117 | return data;
|
3118 | }
|
3119 |
|
3120 | function _templateObject2$8() {
|
3121 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tmargin-top: 136px;\n"]);
|
3122 |
|
3123 | _templateObject2$8 = function _templateObject2() {
|
3124 | return data;
|
3125 | };
|
3126 |
|
3127 | return data;
|
3128 | }
|
3129 |
|
3130 | function _templateObject$p() {
|
3131 | var data = taggedTemplateLiteralLoose(["\n\tmargin-right: 4px !important;\n"]);
|
3132 |
|
3133 | _templateObject$p = function _templateObject() {
|
3134 | return data;
|
3135 | };
|
3136 |
|
3137 | return data;
|
3138 | }
|
3139 |
|
3140 | var FullScreenModal = function FullScreenModal(_ref) {
|
3141 | var negativeLabel = _ref.negativeLabel,
|
3142 | negativeActionHandler = _ref.negativeActionHandler,
|
3143 | children = _ref.children,
|
3144 | props = objectWithoutPropertiesLoose(_ref, ["negativeLabel", "negativeActionHandler", "children"]);
|
3145 |
|
3146 | return React.createElement(React.Fragment, null, React.createElement(ModalGlobalStyle, null), React.createElement(FullModalStyled, _extends_1({
|
3147 | size: "fullscreen",
|
3148 | dimmer: "inverted",
|
3149 | closeIcon: true
|
3150 | }, props), React.createElement(Modal$1.Content, null, React.createElement(Top, null, React.createElement(ButtonLink, {
|
3151 | onClick: negativeActionHandler
|
3152 | }, React.createElement(IconSpaced, {
|
3153 | icon: "arrow-left",
|
3154 | color: theme.colors.activeBlue
|
3155 | }), negativeLabel)), children && React.createElement(CenteredContent, null, children))));
|
3156 | };
|
3157 |
|
3158 | var IconSpaced = styled(Icon$1)(_templateObject$p());
|
3159 | var CenteredContent = styled.div(_templateObject2$8());
|
3160 | CenteredContent.displayName = 'CenteredContent';
|
3161 | var Top = styled.div(_templateObject3$5());
|
3162 |
|
3163 | var ModalGlobalStyle = createGlobalStyle(_templateObject4$3());
|
3164 | var FullModalStyled = styled(ModalStyled)(_templateObject5$3());
|
3165 | FullScreenModal.defaultProps = {
|
3166 | children: null,
|
3167 | negativeLabel: '',
|
3168 | negativeActionHandler: null
|
3169 | };
|
3170 | FullScreenModal.propTypes = {
|
3171 |
|
3172 | children: PropTypes.node,
|
3173 |
|
3174 |
|
3175 | negativeLabel: PropTypes.string,
|
3176 |
|
3177 |
|
3178 | negativeActionHandler: PropTypes.func
|
3179 | };
|
3180 |
|
3181 | var ErrorModal = function ErrorModal(_ref) {
|
3182 | var title = _ref.title,
|
3183 | errors = _ref.errors,
|
3184 | buttonText = _ref.buttonText,
|
3185 | buttonOnClickHandler = _ref.buttonOnClickHandler,
|
3186 | buttonId = _ref.buttonId,
|
3187 | props = objectWithoutPropertiesLoose(_ref, ["title", "errors", "buttonText", "buttonOnClickHandler", "buttonId"]);
|
3188 |
|
3189 | return React.createElement(Modal$1, _extends_1({
|
3190 | closeIcon: false
|
3191 | }, props), React.createElement(Modal$1.IconTitleHeader, {
|
3192 | title: title,
|
3193 | icon: "warning"
|
3194 | }), React.createElement(Modal$1.Content, null, React.createElement("ul", null, errors.map(function (error, index) {
|
3195 | return React.createElement("li", {
|
3196 | key: error + "-" + index
|
3197 | }, error);
|
3198 | }))), React.createElement(Modal$1.SingleButtonFooter, {
|
3199 | buttonText: buttonText,
|
3200 | buttonOnClickHandler: buttonOnClickHandler,
|
3201 | buttonId: buttonId
|
3202 | }));
|
3203 | };
|
3204 |
|
3205 | ErrorModal.defaultProps = {
|
3206 | buttonId: ''
|
3207 | };
|
3208 | ErrorModal.propTypes = {
|
3209 |
|
3210 | title: PropTypes.string.isRequired,
|
3211 |
|
3212 |
|
3213 | errors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
3214 |
|
3215 |
|
3216 | buttonText: PropTypes.string.isRequired,
|
3217 |
|
3218 |
|
3219 | buttonOnClickHandler: PropTypes.func.isRequired,
|
3220 |
|
3221 |
|
3222 | buttonId: PropTypes.string
|
3223 | };
|
3224 | ErrorModal.displayName = 'ErrorModal';
|
3225 |
|
3226 | var ConfirmationModal = function ConfirmationModal(_ref) {
|
3227 | var title = _ref.title,
|
3228 | contentText = _ref.contentText,
|
3229 | leftButtonText = _ref.leftButtonText,
|
3230 | leftButtonOnClickHandler = _ref.leftButtonOnClickHandler,
|
3231 | leftButtonId = _ref.leftButtonId,
|
3232 | rightButtonText = _ref.rightButtonText,
|
3233 | rightButtonOnClickHandler = _ref.rightButtonOnClickHandler,
|
3234 | rightButtonId = _ref.rightButtonId,
|
3235 | loading = _ref.loading,
|
3236 | props = objectWithoutPropertiesLoose(_ref, ["title", "contentText", "leftButtonText", "leftButtonOnClickHandler", "leftButtonId", "rightButtonText", "rightButtonOnClickHandler", "rightButtonId", "loading"]);
|
3237 |
|
3238 | return React.createElement(Modal$1, props, React.createElement(Modal$1.IconTitleHeader, {
|
3239 | title: title,
|
3240 | icon: "warning"
|
3241 | }), React.createElement(Modal$1.Content, null, contentText), React.createElement(Modal$1.DoubleButtonFooter, {
|
3242 | leftButtonText: leftButtonText,
|
3243 | leftButtonOnClickHandler: leftButtonOnClickHandler,
|
3244 | leftButtonId: leftButtonId,
|
3245 | rightButtonText: rightButtonText,
|
3246 | rightButtonOnClickHandler: rightButtonOnClickHandler,
|
3247 | rightButtonId: rightButtonId,
|
3248 | loading: loading
|
3249 | }));
|
3250 | };
|
3251 |
|
3252 | ConfirmationModal.defaultProps = {
|
3253 | leftButtonId: '',
|
3254 | rightButtonId: '',
|
3255 | loading: false
|
3256 | };
|
3257 | ConfirmationModal.propTypes = {
|
3258 |
|
3259 | title: PropTypes.string.isRequired,
|
3260 |
|
3261 |
|
3262 | contentText: PropTypes.string.isRequired,
|
3263 |
|
3264 |
|
3265 | leftButtonText: PropTypes.string.isRequired,
|
3266 |
|
3267 |
|
3268 | leftButtonOnClickHandler: PropTypes.func.isRequired,
|
3269 |
|
3270 |
|
3271 | leftButtonId: PropTypes.string,
|
3272 |
|
3273 |
|
3274 | rightButtonText: PropTypes.string.isRequired,
|
3275 |
|
3276 |
|
3277 | rightButtonOnClickHandler: PropTypes.func.isRequired,
|
3278 |
|
3279 |
|
3280 | rightButtonId: PropTypes.string,
|
3281 |
|
3282 |
|
3283 | loading: PropTypes.bool
|
3284 | };
|
3285 | ConfirmationModal.displayName = 'ConfirmationModal';
|
3286 |
|
3287 | var classnames = createCommonjsModule(function (module) {
|
3288 |
|
3289 |
|
3290 |
|
3291 |
|
3292 |
|
3293 |
|
3294 |
|
3295 | (function () {
|
3296 |
|
3297 | var hasOwn = {}.hasOwnProperty;
|
3298 |
|
3299 | function classNames () {
|
3300 | var classes = [];
|
3301 |
|
3302 | for (var i = 0; i < arguments.length; i++) {
|
3303 | var arg = arguments[i];
|
3304 | if (!arg) continue;
|
3305 |
|
3306 | var argType = typeof arg;
|
3307 |
|
3308 | if (argType === 'string' || argType === 'number') {
|
3309 | classes.push(arg);
|
3310 | } else if (Array.isArray(arg) && arg.length) {
|
3311 | var inner = classNames.apply(null, arg);
|
3312 | if (inner) {
|
3313 | classes.push(inner);
|
3314 | }
|
3315 | } else if (argType === 'object') {
|
3316 | for (var key in arg) {
|
3317 | if (hasOwn.call(arg, key) && arg[key]) {
|
3318 | classes.push(key);
|
3319 | }
|
3320 | }
|
3321 | }
|
3322 | }
|
3323 |
|
3324 | return classes.join(' ');
|
3325 | }
|
3326 |
|
3327 | if (module.exports) {
|
3328 | classNames.default = classNames;
|
3329 | module.exports = classNames;
|
3330 | } else {
|
3331 | window.classNames = classNames;
|
3332 | }
|
3333 | }());
|
3334 | });
|
3335 |
|
3336 | var constant = createCommonjsModule(function (module, exports) {
|
3337 |
|
3338 | Object.defineProperty(exports, "__esModule", {
|
3339 | value: true
|
3340 | });
|
3341 | exports.default = {
|
3342 |
|
3343 | GLOBAL: {
|
3344 | HIDE: '__react_tooltip_hide_event',
|
3345 | REBUILD: '__react_tooltip_rebuild_event',
|
3346 | SHOW: '__react_tooltip_show_event'
|
3347 | }
|
3348 | };
|
3349 | });
|
3350 |
|
3351 | unwrapExports(constant);
|
3352 |
|
3353 | var staticMethods = createCommonjsModule(function (module, exports) {
|
3354 |
|
3355 | Object.defineProperty(exports, "__esModule", {
|
3356 | value: true
|
3357 | });
|
3358 |
|
3359 | exports.default = function (target) {
|
3360 | |
3361 |
|
3362 |
|
3363 |
|
3364 | target.hide = function (target) {
|
3365 | dispatchGlobalEvent(_constant2.default.GLOBAL.HIDE, { target: target });
|
3366 | };
|
3367 |
|
3368 | |
3369 |
|
3370 |
|
3371 |
|
3372 | target.rebuild = function () {
|
3373 | dispatchGlobalEvent(_constant2.default.GLOBAL.REBUILD);
|
3374 | };
|
3375 |
|
3376 | |
3377 |
|
3378 |
|
3379 |
|
3380 | target.show = function (target) {
|
3381 | dispatchGlobalEvent(_constant2.default.GLOBAL.SHOW, { target: target });
|
3382 | };
|
3383 |
|
3384 | target.prototype.globalRebuild = function () {
|
3385 | if (this.mount) {
|
3386 | this.unbindListener();
|
3387 | this.bindListener();
|
3388 | }
|
3389 | };
|
3390 |
|
3391 | target.prototype.globalShow = function (event) {
|
3392 | if (this.mount) {
|
3393 |
|
3394 |
|
3395 | var e = { currentTarget: event.detail.target };
|
3396 | this.showTooltip(e, true);
|
3397 | }
|
3398 | };
|
3399 |
|
3400 | target.prototype.globalHide = function (event) {
|
3401 | if (this.mount) {
|
3402 | var hasTarget = event && event.detail && event.detail.target && true || false;
|
3403 | this.hideTooltip({ currentTarget: hasTarget && event.detail.target }, hasTarget);
|
3404 | }
|
3405 | };
|
3406 | };
|
3407 |
|
3408 |
|
3409 |
|
3410 | var _constant2 = _interopRequireDefault(constant);
|
3411 |
|
3412 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
3413 |
|
3414 | var dispatchGlobalEvent = function dispatchGlobalEvent(eventName, opts) {
|
3415 |
|
3416 |
|
3417 | var event = void 0;
|
3418 |
|
3419 | if (typeof window.CustomEvent === 'function') {
|
3420 | event = new window.CustomEvent(eventName, { detail: opts });
|
3421 | } else {
|
3422 | event = document.createEvent('Event');
|
3423 | event.initEvent(eventName, false, true);
|
3424 | event.detail = opts;
|
3425 | }
|
3426 |
|
3427 | window.dispatchEvent(event);
|
3428 | }; |
3429 |
|
3430 |
|
3431 | });
|
3432 |
|
3433 | unwrapExports(staticMethods);
|
3434 |
|
3435 | var windowListener = createCommonjsModule(function (module, exports) {
|
3436 |
|
3437 | Object.defineProperty(exports, "__esModule", {
|
3438 | value: true
|
3439 | });
|
3440 |
|
3441 | exports.default = function (target) {
|
3442 | target.prototype.bindWindowEvents = function (resizeHide) {
|
3443 |
|
3444 | window.removeEventListener(_constant2.default.GLOBAL.HIDE, this.globalHide);
|
3445 | window.addEventListener(_constant2.default.GLOBAL.HIDE, this.globalHide, false);
|
3446 |
|
3447 |
|
3448 | window.removeEventListener(_constant2.default.GLOBAL.REBUILD, this.globalRebuild);
|
3449 | window.addEventListener(_constant2.default.GLOBAL.REBUILD, this.globalRebuild, false);
|
3450 |
|
3451 |
|
3452 | window.removeEventListener(_constant2.default.GLOBAL.SHOW, this.globalShow);
|
3453 | window.addEventListener(_constant2.default.GLOBAL.SHOW, this.globalShow, false);
|
3454 |
|
3455 |
|
3456 | if (resizeHide) {
|
3457 | window.removeEventListener('resize', this.onWindowResize);
|
3458 | window.addEventListener('resize', this.onWindowResize, false);
|
3459 | }
|
3460 | };
|
3461 |
|
3462 | target.prototype.unbindWindowEvents = function () {
|
3463 | window.removeEventListener(_constant2.default.GLOBAL.HIDE, this.globalHide);
|
3464 | window.removeEventListener(_constant2.default.GLOBAL.REBUILD, this.globalRebuild);
|
3465 | window.removeEventListener(_constant2.default.GLOBAL.SHOW, this.globalShow);
|
3466 | window.removeEventListener('resize', this.onWindowResize);
|
3467 | };
|
3468 |
|
3469 | |
3470 |
|
3471 |
|
3472 | target.prototype.onWindowResize = function () {
|
3473 | if (!this.mount) return;
|
3474 | this.hideTooltip();
|
3475 | };
|
3476 | };
|
3477 |
|
3478 |
|
3479 |
|
3480 | var _constant2 = _interopRequireDefault(constant);
|
3481 |
|
3482 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
3483 | });
|
3484 |
|
3485 | unwrapExports(windowListener);
|
3486 |
|
3487 | var customEvent = createCommonjsModule(function (module, exports) {
|
3488 |
|
3489 | Object.defineProperty(exports, "__esModule", {
|
3490 | value: true
|
3491 | });
|
3492 |
|
3493 | exports.default = function (target) {
|
3494 | target.prototype.isCustomEvent = function (ele) {
|
3495 | var event = this.state.event;
|
3496 |
|
3497 | return event || !!ele.getAttribute('data-event');
|
3498 | };
|
3499 |
|
3500 |
|
3501 | target.prototype.customBindListener = function (ele) {
|
3502 | var _this = this;
|
3503 |
|
3504 | var _state = this.state,
|
3505 | event = _state.event,
|
3506 | eventOff = _state.eventOff;
|
3507 |
|
3508 | var dataEvent = ele.getAttribute('data-event') || event;
|
3509 | var dataEventOff = ele.getAttribute('data-event-off') || eventOff;
|
3510 |
|
3511 | dataEvent.split(' ').forEach(function (event) {
|
3512 | ele.removeEventListener(event, customListeners.get(ele, event));
|
3513 | var customListener = checkStatus.bind(_this, dataEventOff);
|
3514 | customListeners.set(ele, event, customListener);
|
3515 | ele.addEventListener(event, customListener, false);
|
3516 | });
|
3517 | if (dataEventOff) {
|
3518 | dataEventOff.split(' ').forEach(function (event) {
|
3519 | ele.removeEventListener(event, _this.hideTooltip);
|
3520 | ele.addEventListener(event, _this.hideTooltip, false);
|
3521 | });
|
3522 | }
|
3523 | };
|
3524 |
|
3525 |
|
3526 | target.prototype.customUnbindListener = function (ele) {
|
3527 | var _state2 = this.state,
|
3528 | event = _state2.event,
|
3529 | eventOff = _state2.eventOff;
|
3530 |
|
3531 | var dataEvent = event || ele.getAttribute('data-event');
|
3532 | var dataEventOff = eventOff || ele.getAttribute('data-event-off');
|
3533 |
|
3534 | ele.removeEventListener(dataEvent, customListeners.get(ele, event));
|
3535 | if (dataEventOff) ele.removeEventListener(dataEventOff, this.hideTooltip);
|
3536 | };
|
3537 | };
|
3538 |
|
3539 | function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
3540 |
|
3541 |
|
3542 |
|
3543 |
|
3544 |
|
3545 |
|
3546 |
|
3547 |
|
3548 |
|
3549 | var checkStatus = function checkStatus(dataEventOff, e) {
|
3550 | var show = this.state.show;
|
3551 | var id = this.props.id;
|
3552 |
|
3553 | var dataIsCapture = e.currentTarget.getAttribute('data-iscapture');
|
3554 | var isCapture = dataIsCapture && dataIsCapture === 'true' || this.props.isCapture;
|
3555 | var currentItem = e.currentTarget.getAttribute('currentItem');
|
3556 |
|
3557 | if (!isCapture) e.stopPropagation();
|
3558 | if (show && currentItem === 'true') {
|
3559 | if (!dataEventOff) this.hideTooltip(e);
|
3560 | } else {
|
3561 | e.currentTarget.setAttribute('currentItem', 'true');
|
3562 | setUntargetItems(e.currentTarget, this.getTargetArray(id));
|
3563 | this.showTooltip(e);
|
3564 | }
|
3565 | };
|
3566 |
|
3567 | var setUntargetItems = function setUntargetItems(currentTarget, targetArray) {
|
3568 | for (var i = 0; i < targetArray.length; i++) {
|
3569 | if (currentTarget !== targetArray[i]) {
|
3570 | targetArray[i].setAttribute('currentItem', 'false');
|
3571 | } else {
|
3572 | targetArray[i].setAttribute('currentItem', 'true');
|
3573 | }
|
3574 | }
|
3575 | };
|
3576 |
|
3577 | var customListeners = {
|
3578 | id: '9b69f92e-d3fe-498b-b1b4-c5e63a51b0cf',
|
3579 | set: function set(target, event, listener) {
|
3580 | if (this.id in target) {
|
3581 | var map = target[this.id];
|
3582 | map[event] = listener;
|
3583 | } else {
|
3584 |
|
3585 | Object.defineProperty(target, this.id, {
|
3586 | configurable: true,
|
3587 | value: _defineProperty({}, event, listener)
|
3588 | });
|
3589 | }
|
3590 | },
|
3591 | get: function get(target, event) {
|
3592 | var map = target[this.id];
|
3593 | if (map !== undefined) {
|
3594 | return map[event];
|
3595 | }
|
3596 | }
|
3597 | };
|
3598 | });
|
3599 |
|
3600 | unwrapExports(customEvent);
|
3601 |
|
3602 | var isCapture = createCommonjsModule(function (module, exports) {
|
3603 |
|
3604 | Object.defineProperty(exports, "__esModule", {
|
3605 | value: true
|
3606 | });
|
3607 |
|
3608 | exports.default = function (target) {
|
3609 | target.prototype.isCapture = function (currentTarget) {
|
3610 | return currentTarget && currentTarget.getAttribute('data-iscapture') === 'true' || this.props.isCapture || false;
|
3611 | };
|
3612 | };
|
3613 | });
|
3614 |
|
3615 | unwrapExports(isCapture);
|
3616 |
|
3617 | var getEffect = createCommonjsModule(function (module, exports) {
|
3618 |
|
3619 | Object.defineProperty(exports, "__esModule", {
|
3620 | value: true
|
3621 | });
|
3622 |
|
3623 | exports.default = function (target) {
|
3624 | target.prototype.getEffect = function (currentTarget) {
|
3625 | var dataEffect = currentTarget.getAttribute('data-effect');
|
3626 | return dataEffect || this.props.effect || 'float';
|
3627 | };
|
3628 | };
|
3629 | });
|
3630 |
|
3631 | unwrapExports(getEffect);
|
3632 |
|
3633 | var trackRemoval = createCommonjsModule(function (module, exports) {
|
3634 |
|
3635 | Object.defineProperty(exports, "__esModule", {
|
3636 | value: true
|
3637 | });
|
3638 |
|
3639 | exports.default = function (target) {
|
3640 | target.prototype.bindRemovalTracker = function () {
|
3641 | var _this = this;
|
3642 |
|
3643 | var MutationObserver = getMutationObserverClass();
|
3644 | if (MutationObserver == null) return;
|
3645 |
|
3646 | var observer = new MutationObserver(function (mutations) {
|
3647 | for (var m1 = 0; m1 < mutations.length; m1++) {
|
3648 | var mutation = mutations[m1];
|
3649 | for (var m2 = 0; m2 < mutation.removedNodes.length; m2++) {
|
3650 | var element = mutation.removedNodes[m2];
|
3651 | if (element === _this.state.currentTarget) {
|
3652 | _this.hideTooltip();
|
3653 | return;
|
3654 | }
|
3655 | }
|
3656 | }
|
3657 | });
|
3658 |
|
3659 | observer.observe(window.document, { childList: true, subtree: true });
|
3660 |
|
3661 | this.removalTracker = observer;
|
3662 | };
|
3663 |
|
3664 | target.prototype.unbindRemovalTracker = function () {
|
3665 | if (this.removalTracker) {
|
3666 | this.removalTracker.disconnect();
|
3667 | this.removalTracker = null;
|
3668 | }
|
3669 | };
|
3670 | };
|
3671 |
|
3672 |
|
3673 |
|
3674 |
|
3675 |
|
3676 |
|
3677 |
|
3678 |
|
3679 |
|
3680 |
|
3681 |
|
3682 | var getMutationObserverClass = function getMutationObserverClass() {
|
3683 | return window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
|
3684 | };
|
3685 | });
|
3686 |
|
3687 | unwrapExports(trackRemoval);
|
3688 |
|
3689 | var getPosition = createCommonjsModule(function (module, exports) {
|
3690 |
|
3691 | Object.defineProperty(exports, "__esModule", {
|
3692 | value: true
|
3693 | });
|
3694 |
|
3695 | exports.default = function (e, target, node, place, desiredPlace, effect, offset) {
|
3696 | var _getDimensions = getDimensions(node),
|
3697 | tipWidth = _getDimensions.width,
|
3698 | tipHeight = _getDimensions.height;
|
3699 |
|
3700 | var _getDimensions2 = getDimensions(target),
|
3701 | targetWidth = _getDimensions2.width,
|
3702 | targetHeight = _getDimensions2.height;
|
3703 |
|
3704 | var _getCurrentOffset = getCurrentOffset(e, target, effect),
|
3705 | mouseX = _getCurrentOffset.mouseX,
|
3706 | mouseY = _getCurrentOffset.mouseY;
|
3707 |
|
3708 | var defaultOffset = getDefaultPosition(effect, targetWidth, targetHeight, tipWidth, tipHeight);
|
3709 |
|
3710 | var _calculateOffset = calculateOffset(offset),
|
3711 | extraOffset_X = _calculateOffset.extraOffset_X,
|
3712 | extraOffset_Y = _calculateOffset.extraOffset_Y;
|
3713 |
|
3714 | var windowWidth = window.innerWidth;
|
3715 | var windowHeight = window.innerHeight;
|
3716 |
|
3717 | var _getParent = getParent(node),
|
3718 | parentTop = _getParent.parentTop,
|
3719 | parentLeft = _getParent.parentLeft;
|
3720 |
|
3721 |
|
3722 |
|
3723 |
|
3724 | var getTipOffsetLeft = function getTipOffsetLeft(place) {
|
3725 | var offset_X = defaultOffset[place].l;
|
3726 | return mouseX + offset_X + extraOffset_X;
|
3727 | };
|
3728 | var getTipOffsetRight = function getTipOffsetRight(place) {
|
3729 | var offset_X = defaultOffset[place].r;
|
3730 | return mouseX + offset_X + extraOffset_X;
|
3731 | };
|
3732 | var getTipOffsetTop = function getTipOffsetTop(place) {
|
3733 | var offset_Y = defaultOffset[place].t;
|
3734 | return mouseY + offset_Y + extraOffset_Y;
|
3735 | };
|
3736 | var getTipOffsetBottom = function getTipOffsetBottom(place) {
|
3737 | var offset_Y = defaultOffset[place].b;
|
3738 | return mouseY + offset_Y + extraOffset_Y;
|
3739 | };
|
3740 |
|
3741 |
|
3742 |
|
3743 |
|
3744 |
|
3745 |
|
3746 |
|
3747 |
|
3748 |
|
3749 |
|
3750 |
|
3751 |
|
3752 |
|
3753 |
|
3754 |
|
3755 | var outsideLeft = function outsideLeft(p) {
|
3756 | return getTipOffsetLeft(p) < 0;
|
3757 | };
|
3758 | var outsideRight = function outsideRight(p) {
|
3759 | return getTipOffsetRight(p) > windowWidth;
|
3760 | };
|
3761 | var outsideTop = function outsideTop(p) {
|
3762 | return getTipOffsetTop(p) < 0;
|
3763 | };
|
3764 | var outsideBottom = function outsideBottom(p) {
|
3765 | return getTipOffsetBottom(p) > windowHeight;
|
3766 | };
|
3767 |
|
3768 |
|
3769 | var outside = function outside(p) {
|
3770 | return outsideLeft(p) || outsideRight(p) || outsideTop(p) || outsideBottom(p);
|
3771 | };
|
3772 | var inside = function inside(p) {
|
3773 | return !outside(p);
|
3774 | };
|
3775 |
|
3776 | var placesList = ['top', 'bottom', 'left', 'right'];
|
3777 | var insideList = [];
|
3778 | for (var i = 0; i < 4; i++) {
|
3779 | var p = placesList[i];
|
3780 | if (inside(p)) {
|
3781 | insideList.push(p);
|
3782 | }
|
3783 | }
|
3784 |
|
3785 | var isNewState = false;
|
3786 | var newPlace = void 0;
|
3787 | if (inside(desiredPlace) && desiredPlace !== place) {
|
3788 | isNewState = true;
|
3789 | newPlace = desiredPlace;
|
3790 | } else if (insideList.length > 0 && outside(desiredPlace) && outside(place)) {
|
3791 | isNewState = true;
|
3792 | newPlace = insideList[0];
|
3793 | }
|
3794 |
|
3795 | if (isNewState) {
|
3796 | return {
|
3797 | isNewState: true,
|
3798 | newState: { place: newPlace }
|
3799 | };
|
3800 | }
|
3801 |
|
3802 | return {
|
3803 | isNewState: false,
|
3804 | position: {
|
3805 | left: parseInt(getTipOffsetLeft(place) - parentLeft, 10),
|
3806 | top: parseInt(getTipOffsetTop(place) - parentTop, 10)
|
3807 | }
|
3808 | };
|
3809 | };
|
3810 |
|
3811 | var getDimensions = function getDimensions(node) {
|
3812 | var _node$getBoundingClie = node.getBoundingClientRect(),
|
3813 | height = _node$getBoundingClie.height,
|
3814 | width = _node$getBoundingClie.width;
|
3815 |
|
3816 | return {
|
3817 | height: parseInt(height, 10),
|
3818 | width: parseInt(width, 10)
|
3819 | };
|
3820 | };
|
3821 |
|
3822 |
|
3823 |
|
3824 |
|
3825 |
|
3826 |
|
3827 |
|
3828 |
|
3829 |
|
3830 |
|
3831 |
|
3832 |
|
3833 |
|
3834 |
|
3835 |
|
3836 |
|
3837 |
|
3838 |
|
3839 | var getCurrentOffset = function getCurrentOffset(e, currentTarget, effect) {
|
3840 | var boundingClientRect = currentTarget.getBoundingClientRect();
|
3841 | var targetTop = boundingClientRect.top;
|
3842 | var targetLeft = boundingClientRect.left;
|
3843 |
|
3844 | var _getDimensions3 = getDimensions(currentTarget),
|
3845 | targetWidth = _getDimensions3.width,
|
3846 | targetHeight = _getDimensions3.height;
|
3847 |
|
3848 | if (effect === 'float') {
|
3849 | return {
|
3850 | mouseX: e.clientX,
|
3851 | mouseY: e.clientY
|
3852 | };
|
3853 | }
|
3854 | return {
|
3855 | mouseX: targetLeft + targetWidth / 2,
|
3856 | mouseY: targetTop + targetHeight / 2
|
3857 | };
|
3858 | };
|
3859 |
|
3860 |
|
3861 |
|
3862 | var getDefaultPosition = function getDefaultPosition(effect, targetWidth, targetHeight, tipWidth, tipHeight) {
|
3863 | var top = void 0;
|
3864 | var right = void 0;
|
3865 | var bottom = void 0;
|
3866 | var left = void 0;
|
3867 | var disToMouse = 3;
|
3868 | var triangleHeight = 2;
|
3869 | var cursorHeight = 12;
|
3870 |
|
3871 | if (effect === 'float') {
|
3872 | top = {
|
3873 | l: -(tipWidth / 2),
|
3874 | r: tipWidth / 2,
|
3875 | t: -(tipHeight + disToMouse + triangleHeight),
|
3876 | b: -disToMouse
|
3877 | };
|
3878 | bottom = {
|
3879 | l: -(tipWidth / 2),
|
3880 | r: tipWidth / 2,
|
3881 | t: disToMouse + cursorHeight,
|
3882 | b: tipHeight + disToMouse + triangleHeight + cursorHeight
|
3883 | };
|
3884 | left = {
|
3885 | l: -(tipWidth + disToMouse + triangleHeight),
|
3886 | r: -disToMouse,
|
3887 | t: -(tipHeight / 2),
|
3888 | b: tipHeight / 2
|
3889 | };
|
3890 | right = {
|
3891 | l: disToMouse,
|
3892 | r: tipWidth + disToMouse + triangleHeight,
|
3893 | t: -(tipHeight / 2),
|
3894 | b: tipHeight / 2
|
3895 | };
|
3896 | } else if (effect === 'solid') {
|
3897 | top = {
|
3898 | l: -(tipWidth / 2),
|
3899 | r: tipWidth / 2,
|
3900 | t: -(targetHeight / 2 + tipHeight + triangleHeight),
|
3901 | b: -(targetHeight / 2)
|
3902 | };
|
3903 | bottom = {
|
3904 | l: -(tipWidth / 2),
|
3905 | r: tipWidth / 2,
|
3906 | t: targetHeight / 2,
|
3907 | b: targetHeight / 2 + tipHeight + triangleHeight
|
3908 | };
|
3909 | left = {
|
3910 | l: -(tipWidth + targetWidth / 2 + triangleHeight),
|
3911 | r: -(targetWidth / 2),
|
3912 | t: -(tipHeight / 2),
|
3913 | b: tipHeight / 2
|
3914 | };
|
3915 | right = {
|
3916 | l: targetWidth / 2,
|
3917 | r: tipWidth + targetWidth / 2 + triangleHeight,
|
3918 | t: -(tipHeight / 2),
|
3919 | b: tipHeight / 2
|
3920 | };
|
3921 | }
|
3922 |
|
3923 | return { top: top, bottom: bottom, left: left, right: right };
|
3924 | };
|
3925 |
|
3926 |
|
3927 | var calculateOffset = function calculateOffset(offset) {
|
3928 | var extraOffset_X = 0;
|
3929 | var extraOffset_Y = 0;
|
3930 |
|
3931 | if (Object.prototype.toString.apply(offset) === '[object String]') {
|
3932 | offset = JSON.parse(offset.toString().replace(/\'/g, '\"'));
|
3933 | }
|
3934 | for (var key in offset) {
|
3935 | if (key === 'top') {
|
3936 | extraOffset_Y -= parseInt(offset[key], 10);
|
3937 | } else if (key === 'bottom') {
|
3938 | extraOffset_Y += parseInt(offset[key], 10);
|
3939 | } else if (key === 'left') {
|
3940 | extraOffset_X -= parseInt(offset[key], 10);
|
3941 | } else if (key === 'right') {
|
3942 | extraOffset_X += parseInt(offset[key], 10);
|
3943 | }
|
3944 | }
|
3945 |
|
3946 | return { extraOffset_X: extraOffset_X, extraOffset_Y: extraOffset_Y };
|
3947 | };
|
3948 |
|
3949 |
|
3950 | var getParent = function getParent(currentTarget) {
|
3951 | var currentParent = currentTarget;
|
3952 | while (currentParent) {
|
3953 | if (window.getComputedStyle(currentParent).getPropertyValue('transform') !== 'none') break;
|
3954 | currentParent = currentParent.parentElement;
|
3955 | }
|
3956 |
|
3957 | var parentTop = currentParent && currentParent.getBoundingClientRect().top || 0;
|
3958 | var parentLeft = currentParent && currentParent.getBoundingClientRect().left || 0;
|
3959 |
|
3960 | return { parentTop: parentTop, parentLeft: parentLeft };
|
3961 | };
|
3962 | });
|
3963 |
|
3964 | unwrapExports(getPosition);
|
3965 |
|
3966 | var getTipContent = createCommonjsModule(function (module, exports) {
|
3967 |
|
3968 | Object.defineProperty(exports, "__esModule", {
|
3969 | value: true
|
3970 | });
|
3971 |
|
3972 | exports.default = function (tip, children, getContent, multiline) {
|
3973 | if (children) return children;
|
3974 | if (getContent !== undefined && getContent !== null) return getContent;
|
3975 | if (getContent === null) return null;
|
3976 |
|
3977 | var regexp = /<br\s*\/?>/;
|
3978 | if (!multiline || multiline === 'false' || !regexp.test(tip)) {
|
3979 |
|
3980 | return tip;
|
3981 | }
|
3982 |
|
3983 |
|
3984 | return tip.split(regexp).map(function (d, i) {
|
3985 | return _react2.default.createElement(
|
3986 | 'span',
|
3987 | { key: i, className: 'multi-line' },
|
3988 | d
|
3989 | );
|
3990 | });
|
3991 | };
|
3992 |
|
3993 |
|
3994 |
|
3995 | var _react2 = _interopRequireDefault(React);
|
3996 |
|
3997 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
3998 | });
|
3999 |
|
4000 | unwrapExports(getTipContent);
|
4001 |
|
4002 | var aria = createCommonjsModule(function (module, exports) {
|
4003 |
|
4004 | Object.defineProperty(exports, "__esModule", {
|
4005 | value: true
|
4006 | });
|
4007 | exports.parseAria = parseAria;
|
4008 |
|
4009 |
|
4010 |
|
4011 |
|
4012 |
|
4013 |
|
4014 | function parseAria(props) {
|
4015 | var ariaObj = {};
|
4016 | Object.keys(props).filter(function (prop) {
|
4017 |
|
4018 | return (/(^aria-\w+$|^role$)/.test(prop)
|
4019 | );
|
4020 | }).forEach(function (prop) {
|
4021 | ariaObj[prop] = props[prop];
|
4022 | });
|
4023 |
|
4024 | return ariaObj;
|
4025 | }
|
4026 | });
|
4027 |
|
4028 | unwrapExports(aria);
|
4029 | var aria_1 = aria.parseAria;
|
4030 |
|
4031 | var nodeListToArray = createCommonjsModule(function (module, exports) {
|
4032 |
|
4033 | Object.defineProperty(exports, "__esModule", {
|
4034 | value: true
|
4035 | });
|
4036 |
|
4037 | exports.default = function (nodeList) {
|
4038 | var length = nodeList.length;
|
4039 | if (nodeList.hasOwnProperty) {
|
4040 | return Array.prototype.slice.call(nodeList);
|
4041 | }
|
4042 | return new Array(length).fill().map(function (index) {
|
4043 | return nodeList[index];
|
4044 | });
|
4045 | };
|
4046 | });
|
4047 |
|
4048 | unwrapExports(nodeListToArray);
|
4049 |
|
4050 | var style = createCommonjsModule(function (module, exports) {
|
4051 |
|
4052 | Object.defineProperty(exports, "__esModule", {
|
4053 | value: true
|
4054 | });
|
4055 | exports.default = '.__react_component_tooltip{border-radius:3px;display:inline-block;font-size:13px;left:-999em;opacity:0;padding:8px 21px;position:fixed;pointer-events:none;transition:opacity 0.3s ease-out;top:-999em;visibility:hidden;z-index:999}.__react_component_tooltip.allow_hover,.__react_component_tooltip.allow_click{pointer-events:auto}.__react_component_tooltip:before,.__react_component_tooltip:after{content:"";width:0;height:0;position:absolute}.__react_component_tooltip.show{opacity:0.9;margin-top:0px;margin-left:0px;visibility:visible}.__react_component_tooltip.type-dark{color:#fff;background-color:#222}.__react_component_tooltip.type-dark.place-top:after{border-top-color:#222;border-top-style:solid;border-top-width:6px}.__react_component_tooltip.type-dark.place-bottom:after{border-bottom-color:#222;border-bottom-style:solid;border-bottom-width:6px}.__react_component_tooltip.type-dark.place-left:after{border-left-color:#222;border-left-style:solid;border-left-width:6px}.__react_component_tooltip.type-dark.place-right:after{border-right-color:#222;border-right-style:solid;border-right-width:6px}.__react_component_tooltip.type-dark.border{border:1px solid #fff}.__react_component_tooltip.type-dark.border.place-top:before{border-top:8px solid #fff}.__react_component_tooltip.type-dark.border.place-bottom:before{border-bottom:8px solid #fff}.__react_component_tooltip.type-dark.border.place-left:before{border-left:8px solid #fff}.__react_component_tooltip.type-dark.border.place-right:before{border-right:8px solid #fff}.__react_component_tooltip.type-success{color:#fff;background-color:#8DC572}.__react_component_tooltip.type-success.place-top:after{border-top-color:#8DC572;border-top-style:solid;border-top-width:6px}.__react_component_tooltip.type-success.place-bottom:after{border-bottom-color:#8DC572;border-bottom-style:solid;border-bottom-width:6px}.__react_component_tooltip.type-success.place-left:after{border-left-color:#8DC572;border-left-style:solid;border-left-width:6px}.__react_component_tooltip.type-success.place-right:after{border-right-color:#8DC572;border-right-style:solid;border-right-width:6px}.__react_component_tooltip.type-success.border{border:1px solid #fff}.__react_component_tooltip.type-success.border.place-top:before{border-top:8px solid #fff}.__react_component_tooltip.type-success.border.place-bottom:before{border-bottom:8px solid #fff}.__react_component_tooltip.type-success.border.place-left:before{border-left:8px solid #fff}.__react_component_tooltip.type-success.border.place-right:before{border-right:8px solid #fff}.__react_component_tooltip.type-warning{color:#fff;background-color:#F0AD4E}.__react_component_tooltip.type-warning.place-top:after{border-top-color:#F0AD4E;border-top-style:solid;border-top-width:6px}.__react_component_tooltip.type-warning.place-bottom:after{border-bottom-color:#F0AD4E;border-bottom-style:solid;border-bottom-width:6px}.__react_component_tooltip.type-warning.place-left:after{border-left-color:#F0AD4E;border-left-style:solid;border-left-width:6px}.__react_component_tooltip.type-warning.place-right:after{border-right-color:#F0AD4E;border-right-style:solid;border-right-width:6px}.__react_component_tooltip.type-warning.border{border:1px solid #fff}.__react_component_tooltip.type-warning.border.place-top:before{border-top:8px solid #fff}.__react_component_tooltip.type-warning.border.place-bottom:before{border-bottom:8px solid #fff}.__react_component_tooltip.type-warning.border.place-left:before{border-left:8px solid #fff}.__react_component_tooltip.type-warning.border.place-right:before{border-right:8px solid #fff}.__react_component_tooltip.type-error{color:#fff;background-color:#BE6464}.__react_component_tooltip.type-error.place-top:after{border-top-color:#BE6464;border-top-style:solid;border-top-width:6px}.__react_component_tooltip.type-error.place-bottom:after{border-bottom-color:#BE6464;border-bottom-style:solid;border-bottom-width:6px}.__react_component_tooltip.type-error.place-left:after{border-left-color:#BE6464;border-left-style:solid;border-left-width:6px}.__react_component_tooltip.type-error.place-right:after{border-right-color:#BE6464;border-right-style:solid;border-right-width:6px}.__react_component_tooltip.type-error.border{border:1px solid #fff}.__react_component_tooltip.type-error.border.place-top:before{border-top:8px solid #fff}.__react_component_tooltip.type-error.border.place-bottom:before{border-bottom:8px solid #fff}.__react_component_tooltip.type-error.border.place-left:before{border-left:8px solid #fff}.__react_component_tooltip.type-error.border.place-right:before{border-right:8px solid #fff}.__react_component_tooltip.type-info{color:#fff;background-color:#337AB7}.__react_component_tooltip.type-info.place-top:after{border-top-color:#337AB7;border-top-style:solid;border-top-width:6px}.__react_component_tooltip.type-info.place-bottom:after{border-bottom-color:#337AB7;border-bottom-style:solid;border-bottom-width:6px}.__react_component_tooltip.type-info.place-left:after{border-left-color:#337AB7;border-left-style:solid;border-left-width:6px}.__react_component_tooltip.type-info.place-right:after{border-right-color:#337AB7;border-right-style:solid;border-right-width:6px}.__react_component_tooltip.type-info.border{border:1px solid #fff}.__react_component_tooltip.type-info.border.place-top:before{border-top:8px solid #fff}.__react_component_tooltip.type-info.border.place-bottom:before{border-bottom:8px solid #fff}.__react_component_tooltip.type-info.border.place-left:before{border-left:8px solid #fff}.__react_component_tooltip.type-info.border.place-right:before{border-right:8px solid #fff}.__react_component_tooltip.type-light{color:#222;background-color:#fff}.__react_component_tooltip.type-light.place-top:after{border-top-color:#fff;border-top-style:solid;border-top-width:6px}.__react_component_tooltip.type-light.place-bottom:after{border-bottom-color:#fff;border-bottom-style:solid;border-bottom-width:6px}.__react_component_tooltip.type-light.place-left:after{border-left-color:#fff;border-left-style:solid;border-left-width:6px}.__react_component_tooltip.type-light.place-right:after{border-right-color:#fff;border-right-style:solid;border-right-width:6px}.__react_component_tooltip.type-light.border{border:1px solid #222}.__react_component_tooltip.type-light.border.place-top:before{border-top:8px solid #222}.__react_component_tooltip.type-light.border.place-bottom:before{border-bottom:8px solid #222}.__react_component_tooltip.type-light.border.place-left:before{border-left:8px solid #222}.__react_component_tooltip.type-light.border.place-right:before{border-right:8px solid #222}.__react_component_tooltip.place-top{margin-top:-10px}.__react_component_tooltip.place-top:before{border-left:10px solid transparent;border-right:10px solid transparent;bottom:-8px;left:50%;margin-left:-10px}.__react_component_tooltip.place-top:after{border-left:8px solid transparent;border-right:8px solid transparent;bottom:-6px;left:50%;margin-left:-8px}.__react_component_tooltip.place-bottom{margin-top:10px}.__react_component_tooltip.place-bottom:before{border-left:10px solid transparent;border-right:10px solid transparent;top:-8px;left:50%;margin-left:-10px}.__react_component_tooltip.place-bottom:after{border-left:8px solid transparent;border-right:8px solid transparent;top:-6px;left:50%;margin-left:-8px}.__react_component_tooltip.place-left{margin-left:-10px}.__react_component_tooltip.place-left:before{border-top:6px solid transparent;border-bottom:6px solid transparent;right:-8px;top:50%;margin-top:-5px}.__react_component_tooltip.place-left:after{border-top:5px solid transparent;border-bottom:5px solid transparent;right:-6px;top:50%;margin-top:-4px}.__react_component_tooltip.place-right{margin-left:10px}.__react_component_tooltip.place-right:before{border-top:6px solid transparent;border-bottom:6px solid transparent;left:-8px;top:50%;margin-top:-5px}.__react_component_tooltip.place-right:after{border-top:5px solid transparent;border-bottom:5px solid transparent;left:-6px;top:50%;margin-top:-4px}.__react_component_tooltip .multi-line{display:block;padding:2px 0px;text-align:center}';
|
4056 | });
|
4057 |
|
4058 | unwrapExports(style);
|
4059 |
|
4060 | var dist = createCommonjsModule(function (module) {
|
4061 |
|
4062 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
4063 |
|
4064 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
4065 |
|
4066 | var _class, _class2, _temp;
|
4067 |
|
4068 |
|
4069 |
|
4070 |
|
4071 |
|
4072 |
|
4073 |
|
4074 |
|
4075 |
|
4076 |
|
4077 |
|
4078 |
|
4079 | var _react2 = _interopRequireDefault(React);
|
4080 |
|
4081 |
|
4082 |
|
4083 | var _propTypes2 = _interopRequireDefault(PropTypes);
|
4084 |
|
4085 |
|
4086 |
|
4087 | var _classnames2 = _interopRequireDefault(classnames);
|
4088 |
|
4089 |
|
4090 |
|
4091 | var _staticMethods2 = _interopRequireDefault(staticMethods);
|
4092 |
|
4093 |
|
4094 |
|
4095 | var _windowListener2 = _interopRequireDefault(windowListener);
|
4096 |
|
4097 |
|
4098 |
|
4099 | var _customEvent2 = _interopRequireDefault(customEvent);
|
4100 |
|
4101 |
|
4102 |
|
4103 | var _isCapture2 = _interopRequireDefault(isCapture);
|
4104 |
|
4105 |
|
4106 |
|
4107 | var _getEffect2 = _interopRequireDefault(getEffect);
|
4108 |
|
4109 |
|
4110 |
|
4111 | var _trackRemoval2 = _interopRequireDefault(trackRemoval);
|
4112 |
|
4113 |
|
4114 |
|
4115 | var _getPosition2 = _interopRequireDefault(getPosition);
|
4116 |
|
4117 |
|
4118 |
|
4119 | var _getTipContent2 = _interopRequireDefault(getTipContent);
|
4120 |
|
4121 |
|
4122 |
|
4123 |
|
4124 |
|
4125 | var _nodeListToArray2 = _interopRequireDefault(nodeListToArray);
|
4126 |
|
4127 |
|
4128 |
|
4129 | var _style2 = _interopRequireDefault(style);
|
4130 |
|
4131 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
4132 |
|
4133 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
4134 |
|
4135 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
4136 |
|
4137 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
4138 |
|
4139 | var ReactTooltip = (0, _staticMethods2.default)(_class = (0, _windowListener2.default)(_class = (0, _customEvent2.default)(_class = (0, _isCapture2.default)(_class = (0, _getEffect2.default)(_class = (0, _trackRemoval2.default)(_class = (_temp = _class2 = function (_React$Component) {
|
4140 | _inherits(ReactTooltip, _React$Component);
|
4141 |
|
4142 | function ReactTooltip(props) {
|
4143 | _classCallCheck(this, ReactTooltip);
|
4144 |
|
4145 | var _this = _possibleConstructorReturn(this, (ReactTooltip.__proto__ || Object.getPrototypeOf(ReactTooltip)).call(this, props));
|
4146 |
|
4147 | _this.state = {
|
4148 | place: props.place || 'top',
|
4149 | desiredPlace: props.place || 'top',
|
4150 | type: 'dark',
|
4151 | effect: 'float',
|
4152 | show: false,
|
4153 | border: false,
|
4154 | offset: {},
|
4155 | extraClass: '',
|
4156 | html: false,
|
4157 | delayHide: 0,
|
4158 | delayShow: 0,
|
4159 | event: props.event || null,
|
4160 | eventOff: props.eventOff || null,
|
4161 | currentEvent: null,
|
4162 | currentTarget: null,
|
4163 | ariaProps: (0, aria.parseAria)(props),
|
4164 | isEmptyTip: false,
|
4165 | disable: false,
|
4166 | originTooltip: null,
|
4167 | isMultiline: false
|
4168 | };
|
4169 |
|
4170 | _this.bind(['showTooltip', 'updateTooltip', 'hideTooltip', 'hideTooltipOnScroll', 'getTooltipContent', 'globalRebuild', 'globalShow', 'globalHide', 'onWindowResize', 'mouseOnToolTip']);
|
4171 |
|
4172 | _this.mount = true;
|
4173 | _this.delayShowLoop = null;
|
4174 | _this.delayHideLoop = null;
|
4175 | _this.delayReshow = null;
|
4176 | _this.intervalUpdateContent = null;
|
4177 | return _this;
|
4178 | }
|
4179 |
|
4180 | |
4181 |
|
4182 |
|
4183 |
|
4184 |
|
4185 | _createClass(ReactTooltip, [{
|
4186 | key: 'bind',
|
4187 | value: function bind(methodArray) {
|
4188 | var _this2 = this;
|
4189 |
|
4190 | methodArray.forEach(function (method) {
|
4191 | _this2[method] = _this2[method].bind(_this2);
|
4192 | });
|
4193 | }
|
4194 | }, {
|
4195 | key: 'componentDidMount',
|
4196 | value: function componentDidMount() {
|
4197 | var _props = this.props,
|
4198 | insecure = _props.insecure,
|
4199 | resizeHide = _props.resizeHide;
|
4200 |
|
4201 | if (insecure) {
|
4202 | this.setStyleHeader();
|
4203 | }
|
4204 | this.bindListener();
|
4205 | this.bindWindowEvents(resizeHide);
|
4206 | }
|
4207 | }, {
|
4208 | key: 'componentWillUnmount',
|
4209 | value: function componentWillUnmount() {
|
4210 | this.mount = false;
|
4211 |
|
4212 | this.clearTimer();
|
4213 |
|
4214 | this.unbindListener();
|
4215 | this.removeScrollListener();
|
4216 | this.unbindWindowEvents();
|
4217 | }
|
4218 |
|
4219 | |
4220 |
|
4221 |
|
4222 |
|
4223 |
|
4224 | }, {
|
4225 | key: 'mouseOnToolTip',
|
4226 | value: function mouseOnToolTip() {
|
4227 | var show = this.state.show;
|
4228 |
|
4229 |
|
4230 | if (show && this.tooltipRef) {
|
4231 |
|
4232 | if (!this.tooltipRef.matches) {
|
4233 |
|
4234 | if (this.tooltipRef.msMatchesSelector) {
|
4235 | this.tooltipRef.matches = this.tooltipRef.msMatchesSelector;
|
4236 | } else {
|
4237 |
|
4238 | this.tooltipRef.matches = this.tooltipRef.mozMatchesSelector;
|
4239 | }
|
4240 | }
|
4241 | return this.tooltipRef.matches(':hover');
|
4242 | }
|
4243 | return false;
|
4244 | }
|
4245 | |
4246 |
|
4247 |
|
4248 |
|
4249 | }, {
|
4250 | key: 'getTargetArray',
|
4251 | value: function getTargetArray(id) {
|
4252 | var targetArray = void 0;
|
4253 | if (!id) {
|
4254 | targetArray = document.querySelectorAll('[data-tip]:not([data-for])');
|
4255 | } else {
|
4256 | var escaped = id.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
|
4257 | targetArray = document.querySelectorAll('[data-tip][data-for="' + escaped + '"]');
|
4258 | }
|
4259 |
|
4260 | return (0, _nodeListToArray2.default)(targetArray);
|
4261 | }
|
4262 |
|
4263 | |
4264 |
|
4265 |
|
4266 |
|
4267 |
|
4268 | }, {
|
4269 | key: 'bindListener',
|
4270 | value: function bindListener() {
|
4271 | var _this3 = this;
|
4272 |
|
4273 | var _props2 = this.props,
|
4274 | id = _props2.id,
|
4275 | globalEventOff = _props2.globalEventOff,
|
4276 | isCapture$$1 = _props2.isCapture;
|
4277 |
|
4278 | var targetArray = this.getTargetArray(id);
|
4279 |
|
4280 | targetArray.forEach(function (target) {
|
4281 | var isCaptureMode = _this3.isCapture(target);
|
4282 | var effect = _this3.getEffect(target);
|
4283 | if (target.getAttribute('currentItem') === null) {
|
4284 | target.setAttribute('currentItem', 'false');
|
4285 | }
|
4286 | _this3.unbindBasicListener(target);
|
4287 |
|
4288 | if (_this3.isCustomEvent(target)) {
|
4289 | _this3.customBindListener(target);
|
4290 | return;
|
4291 | }
|
4292 |
|
4293 | target.addEventListener('mouseenter', _this3.showTooltip, isCaptureMode);
|
4294 | if (effect === 'float') {
|
4295 | target.addEventListener('mousemove', _this3.updateTooltip, isCaptureMode);
|
4296 | }
|
4297 | target.addEventListener('mouseleave', _this3.hideTooltip, isCaptureMode);
|
4298 | });
|
4299 |
|
4300 |
|
4301 | if (globalEventOff) {
|
4302 | window.removeEventListener(globalEventOff, this.hideTooltip);
|
4303 | window.addEventListener(globalEventOff, this.hideTooltip, isCapture$$1);
|
4304 | }
|
4305 |
|
4306 |
|
4307 | this.bindRemovalTracker();
|
4308 | }
|
4309 |
|
4310 | |
4311 |
|
4312 |
|
4313 |
|
4314 | }, {
|
4315 | key: 'unbindListener',
|
4316 | value: function unbindListener() {
|
4317 | var _this4 = this;
|
4318 |
|
4319 | var _props3 = this.props,
|
4320 | id = _props3.id,
|
4321 | globalEventOff = _props3.globalEventOff;
|
4322 |
|
4323 | var targetArray = this.getTargetArray(id);
|
4324 | targetArray.forEach(function (target) {
|
4325 | _this4.unbindBasicListener(target);
|
4326 | if (_this4.isCustomEvent(target)) _this4.customUnbindListener(target);
|
4327 | });
|
4328 |
|
4329 | if (globalEventOff) window.removeEventListener(globalEventOff, this.hideTooltip);
|
4330 | this.unbindRemovalTracker();
|
4331 | }
|
4332 |
|
4333 | |
4334 |
|
4335 |
|
4336 |
|
4337 |
|
4338 |
|
4339 | }, {
|
4340 | key: 'unbindBasicListener',
|
4341 | value: function unbindBasicListener(target) {
|
4342 | var isCaptureMode = this.isCapture(target);
|
4343 | target.removeEventListener('mouseenter', this.showTooltip, isCaptureMode);
|
4344 | target.removeEventListener('mousemove', this.updateTooltip, isCaptureMode);
|
4345 | target.removeEventListener('mouseleave', this.hideTooltip, isCaptureMode);
|
4346 | }
|
4347 | }, {
|
4348 | key: 'getTooltipContent',
|
4349 | value: function getTooltipContent() {
|
4350 | var _props4 = this.props,
|
4351 | getContent = _props4.getContent,
|
4352 | children = _props4.children;
|
4353 |
|
4354 |
|
4355 |
|
4356 | var content = void 0;
|
4357 | if (getContent) {
|
4358 | if (Array.isArray(getContent)) {
|
4359 | content = getContent[0] && getContent[0](this.state.originTooltip);
|
4360 | } else {
|
4361 | content = getContent(this.state.originTooltip);
|
4362 | }
|
4363 | }
|
4364 |
|
4365 | return (0, _getTipContent2.default)(this.state.originTooltip, children, content, this.state.isMultiline);
|
4366 | }
|
4367 | }, {
|
4368 | key: 'isEmptyTip',
|
4369 | value: function isEmptyTip(placeholder) {
|
4370 | return typeof placeholder === 'string' && placeholder === '' || placeholder === null;
|
4371 | }
|
4372 |
|
4373 | |
4374 |
|
4375 |
|
4376 |
|
4377 | }, {
|
4378 | key: 'showTooltip',
|
4379 | value: function showTooltip(e, isGlobalCall) {
|
4380 | if (isGlobalCall) {
|
4381 |
|
4382 | var targetArray = this.getTargetArray(this.props.id);
|
4383 | var isMyElement = targetArray.some(function (ele) {
|
4384 | return ele === e.currentTarget;
|
4385 | });
|
4386 | if (!isMyElement) return;
|
4387 | }
|
4388 |
|
4389 |
|
4390 | var _props5 = this.props,
|
4391 | multiline = _props5.multiline,
|
4392 | getContent = _props5.getContent;
|
4393 |
|
4394 | var originTooltip = e.currentTarget.getAttribute('data-tip');
|
4395 | var isMultiline = e.currentTarget.getAttribute('data-multiline') || multiline || false;
|
4396 |
|
4397 |
|
4398 | var switchToSolid = e instanceof window.FocusEvent || isGlobalCall;
|
4399 |
|
4400 |
|
4401 | var scrollHide = true;
|
4402 | if (e.currentTarget.getAttribute('data-scroll-hide')) {
|
4403 | scrollHide = e.currentTarget.getAttribute('data-scroll-hide') === 'true';
|
4404 | } else if (this.props.scrollHide != null) {
|
4405 | scrollHide = this.props.scrollHide;
|
4406 | }
|
4407 |
|
4408 |
|
4409 | var desiredPlace = e.currentTarget.getAttribute('data-place') || this.props.place || 'top';
|
4410 | var effect = switchToSolid && 'solid' || this.getEffect(e.currentTarget);
|
4411 | var offset = e.currentTarget.getAttribute('data-offset') || this.props.offset || {};
|
4412 | var result = (0, _getPosition2.default)(e, e.currentTarget, this.tooltipRef, desiredPlace, desiredPlace, effect, offset);
|
4413 | if (result.position && this.props.overridePosition) {
|
4414 | result.position = this.props.overridePosition(result.position, e.currentTarget, this.tooltipRef, desiredPlace, desiredPlace, effect, offset);
|
4415 | }
|
4416 |
|
4417 | var place = result.isNewState ? result.newState.place : desiredPlace;
|
4418 |
|
4419 |
|
4420 | this.clearTimer();
|
4421 |
|
4422 | var target = e.currentTarget;
|
4423 |
|
4424 | var reshowDelay = this.state.show ? target.getAttribute('data-delay-update') || this.props.delayUpdate : 0;
|
4425 |
|
4426 | var self = this;
|
4427 |
|
4428 | var updateState = function updateState() {
|
4429 | self.setState({
|
4430 | originTooltip: originTooltip,
|
4431 | isMultiline: isMultiline,
|
4432 | desiredPlace: desiredPlace,
|
4433 | place: place,
|
4434 | type: target.getAttribute('data-type') || self.props.type || 'dark',
|
4435 | effect: effect,
|
4436 | offset: offset,
|
4437 | html: target.getAttribute('data-html') ? target.getAttribute('data-html') === 'true' : self.props.html || false,
|
4438 | delayShow: target.getAttribute('data-delay-show') || self.props.delayShow || 0,
|
4439 | delayHide: target.getAttribute('data-delay-hide') || self.props.delayHide || 0,
|
4440 | delayUpdate: target.getAttribute('data-delay-update') || self.props.delayUpdate || 0,
|
4441 | border: target.getAttribute('data-border') ? target.getAttribute('data-border') === 'true' : self.props.border || false,
|
4442 | extraClass: target.getAttribute('data-class') || self.props.class || self.props.className || '',
|
4443 | disable: target.getAttribute('data-tip-disable') ? target.getAttribute('data-tip-disable') === 'true' : self.props.disable || false,
|
4444 | currentTarget: target
|
4445 | }, function () {
|
4446 | if (scrollHide) self.addScrollListener(self.state.currentTarget);
|
4447 | self.updateTooltip(e);
|
4448 |
|
4449 | if (getContent && Array.isArray(getContent)) {
|
4450 | self.intervalUpdateContent = setInterval(function () {
|
4451 | if (self.mount) {
|
4452 | var _getContent = self.props.getContent;
|
4453 |
|
4454 | var placeholder = (0, _getTipContent2.default)(originTooltip, '', _getContent[0](), isMultiline);
|
4455 | var isEmptyTip = self.isEmptyTip(placeholder);
|
4456 | self.setState({
|
4457 | isEmptyTip: isEmptyTip
|
4458 | });
|
4459 | self.updatePosition();
|
4460 | }
|
4461 | }, getContent[1]);
|
4462 | }
|
4463 | });
|
4464 | };
|
4465 |
|
4466 |
|
4467 | if (reshowDelay) {
|
4468 | this.delayReshow = setTimeout(updateState, reshowDelay);
|
4469 | } else {
|
4470 | updateState();
|
4471 | }
|
4472 | }
|
4473 |
|
4474 | |
4475 |
|
4476 |
|
4477 |
|
4478 | }, {
|
4479 | key: 'updateTooltip',
|
4480 | value: function updateTooltip(e) {
|
4481 | var _this5 = this;
|
4482 |
|
4483 | var _state = this.state,
|
4484 | delayShow = _state.delayShow,
|
4485 | disable = _state.disable;
|
4486 | var afterShow = this.props.afterShow;
|
4487 |
|
4488 | var placeholder = this.getTooltipContent();
|
4489 | var delayTime = parseInt(delayShow, 10);
|
4490 | var eventTarget = e.currentTarget || e.target;
|
4491 |
|
4492 |
|
4493 | if (this.mouseOnToolTip()) {
|
4494 | return;
|
4495 | }
|
4496 |
|
4497 | if (this.isEmptyTip(placeholder) || disable) return;
|
4498 | var updateState = function updateState() {
|
4499 | if (Array.isArray(placeholder) && placeholder.length > 0 || placeholder) {
|
4500 | var isInvisible = !_this5.state.show;
|
4501 | _this5.setState({
|
4502 | currentEvent: e,
|
4503 | currentTarget: eventTarget,
|
4504 | show: true
|
4505 | }, function () {
|
4506 | _this5.updatePosition();
|
4507 | if (isInvisible && afterShow) afterShow(e);
|
4508 | });
|
4509 | }
|
4510 | };
|
4511 |
|
4512 | clearTimeout(this.delayShowLoop);
|
4513 | if (delayShow) {
|
4514 | this.delayShowLoop = setTimeout(updateState, delayTime);
|
4515 | } else {
|
4516 | updateState();
|
4517 | }
|
4518 | }
|
4519 |
|
4520 | |
4521 |
|
4522 |
|
4523 |
|
4524 | }, {
|
4525 | key: 'listenForTooltipExit',
|
4526 | value: function listenForTooltipExit() {
|
4527 | var show = this.state.show;
|
4528 |
|
4529 |
|
4530 | if (show && this.tooltipRef) {
|
4531 | this.tooltipRef.addEventListener('mouseleave', this.hideTooltip);
|
4532 | }
|
4533 | }
|
4534 | }, {
|
4535 | key: 'removeListenerForTooltipExit',
|
4536 | value: function removeListenerForTooltipExit() {
|
4537 | var show = this.state.show;
|
4538 |
|
4539 |
|
4540 | if (show && this.tooltipRef) {
|
4541 | this.tooltipRef.removeEventListener('mouseleave', this.hideTooltip);
|
4542 | }
|
4543 | }
|
4544 |
|
4545 | |
4546 |
|
4547 |
|
4548 |
|
4549 | }, {
|
4550 | key: 'hideTooltip',
|
4551 | value: function hideTooltip(e, hasTarget) {
|
4552 | var _this6 = this;
|
4553 |
|
4554 | var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : { isScroll: false };
|
4555 | var disable = this.state.disable;
|
4556 | var isScroll = options.isScroll;
|
4557 |
|
4558 | var delayHide = isScroll ? 0 : this.state.delayHide;
|
4559 | var afterHide = this.props.afterHide;
|
4560 |
|
4561 | var placeholder = this.getTooltipContent();
|
4562 | if (!this.mount) return;
|
4563 | if (this.isEmptyTip(placeholder) || disable) return;
|
4564 | if (hasTarget) {
|
4565 |
|
4566 | var targetArray = this.getTargetArray(this.props.id);
|
4567 | var isMyElement = targetArray.some(function (ele) {
|
4568 | return ele === e.currentTarget;
|
4569 | });
|
4570 | if (!isMyElement || !this.state.show) return;
|
4571 | }
|
4572 |
|
4573 | var resetState = function resetState() {
|
4574 | var isVisible = _this6.state.show;
|
4575 |
|
4576 | if (_this6.mouseOnToolTip()) {
|
4577 | _this6.listenForTooltipExit();
|
4578 | return;
|
4579 | }
|
4580 | _this6.removeListenerForTooltipExit();
|
4581 |
|
4582 | _this6.setState({
|
4583 | show: false
|
4584 | }, function () {
|
4585 | _this6.removeScrollListener();
|
4586 | if (isVisible && afterHide) afterHide(e);
|
4587 | });
|
4588 | };
|
4589 |
|
4590 | this.clearTimer();
|
4591 | if (delayHide) {
|
4592 | this.delayHideLoop = setTimeout(resetState, parseInt(delayHide, 10));
|
4593 | } else {
|
4594 | resetState();
|
4595 | }
|
4596 | }
|
4597 |
|
4598 | |
4599 |
|
4600 |
|
4601 |
|
4602 | }, {
|
4603 | key: 'hideTooltipOnScroll',
|
4604 | value: function hideTooltipOnScroll(event, hasTarget) {
|
4605 | this.hideTooltip(event, hasTarget, { isScroll: true });
|
4606 | }
|
4607 |
|
4608 | |
4609 |
|
4610 |
|
4611 |
|
4612 |
|
4613 | }, {
|
4614 | key: 'addScrollListener',
|
4615 | value: function addScrollListener(currentTarget) {
|
4616 | var isCaptureMode = this.isCapture(currentTarget);
|
4617 | window.addEventListener('scroll', this.hideTooltipOnScroll, isCaptureMode);
|
4618 | }
|
4619 | }, {
|
4620 | key: 'removeScrollListener',
|
4621 | value: function removeScrollListener() {
|
4622 | window.removeEventListener('scroll', this.hideTooltipOnScroll);
|
4623 | }
|
4624 |
|
4625 |
|
4626 |
|
4627 | }, {
|
4628 | key: 'updatePosition',
|
4629 | value: function updatePosition() {
|
4630 | var _this7 = this;
|
4631 |
|
4632 | var _state2 = this.state,
|
4633 | currentEvent = _state2.currentEvent,
|
4634 | currentTarget = _state2.currentTarget,
|
4635 | place = _state2.place,
|
4636 | desiredPlace = _state2.desiredPlace,
|
4637 | effect = _state2.effect,
|
4638 | offset = _state2.offset;
|
4639 |
|
4640 | var node = this.tooltipRef;
|
4641 | var result = (0, _getPosition2.default)(currentEvent, currentTarget, node, place, desiredPlace, effect, offset);
|
4642 | if (result.position && this.props.overridePosition) {
|
4643 | result.position = this.props.overridePosition(result.position, currentEvent, currentTarget, node, place, desiredPlace, effect, offset);
|
4644 | }
|
4645 |
|
4646 | if (result.isNewState) {
|
4647 |
|
4648 | return this.setState(result.newState, function () {
|
4649 | _this7.updatePosition();
|
4650 | });
|
4651 | }
|
4652 |
|
4653 | node.style.left = result.position.left + 'px';
|
4654 | node.style.top = result.position.top + 'px';
|
4655 | }
|
4656 |
|
4657 | |
4658 |
|
4659 |
|
4660 |
|
4661 |
|
4662 | }, {
|
4663 | key: 'setStyleHeader',
|
4664 | value: function setStyleHeader() {
|
4665 | var head = document.getElementsByTagName('head')[0];
|
4666 | if (!head.querySelector('style[id="react-tooltip"]')) {
|
4667 | var tag = document.createElement('style');
|
4668 | tag.id = 'react-tooltip';
|
4669 | tag.innerHTML = _style2.default;
|
4670 |
|
4671 | if (typeof __webpack_nonce__ !== 'undefined' && __webpack_nonce__) {
|
4672 | tag.setAttribute('nonce', __webpack_nonce__);
|
4673 | }
|
4674 |
|
4675 | head.insertBefore(tag, head.firstChild);
|
4676 | }
|
4677 | }
|
4678 |
|
4679 | |
4680 |
|
4681 |
|
4682 |
|
4683 | }, {
|
4684 | key: 'clearTimer',
|
4685 | value: function clearTimer() {
|
4686 | clearTimeout(this.delayShowLoop);
|
4687 | clearTimeout(this.delayHideLoop);
|
4688 | clearTimeout(this.delayReshow);
|
4689 | clearInterval(this.intervalUpdateContent);
|
4690 | }
|
4691 | }, {
|
4692 | key: 'render',
|
4693 | value: function render() {
|
4694 | var _this8 = this;
|
4695 |
|
4696 | var _state3 = this.state,
|
4697 | extraClass = _state3.extraClass,
|
4698 | html = _state3.html,
|
4699 | ariaProps = _state3.ariaProps,
|
4700 | disable = _state3.disable;
|
4701 |
|
4702 | var placeholder = this.getTooltipContent();
|
4703 | var isEmptyTip = this.isEmptyTip(placeholder);
|
4704 | var tooltipClass = (0, _classnames2.default)('__react_component_tooltip', { 'show': this.state.show && !disable && !isEmptyTip }, { 'border': this.state.border }, { 'place-top': this.state.place === 'top' }, { 'place-bottom': this.state.place === 'bottom' }, { 'place-left': this.state.place === 'left' }, { 'place-right': this.state.place === 'right' }, { 'type-dark': this.state.type === 'dark' }, { 'type-success': this.state.type === 'success' }, { 'type-warning': this.state.type === 'warning' }, { 'type-error': this.state.type === 'error' }, { 'type-info': this.state.type === 'info' }, { 'type-light': this.state.type === 'light' }, { 'allow_hover': this.props.delayUpdate }, { 'allow_click': this.props.clickable });
|
4705 |
|
4706 | var Wrapper = this.props.wrapper;
|
4707 | if (ReactTooltip.supportedWrappers.indexOf(Wrapper) < 0) {
|
4708 | Wrapper = ReactTooltip.defaultProps.wrapper;
|
4709 | }
|
4710 |
|
4711 | if (html) {
|
4712 | return _react2.default.createElement(Wrapper, _extends({ className: tooltipClass + ' ' + extraClass,
|
4713 | id: this.props.id,
|
4714 | ref: function ref(_ref) {
|
4715 | return _this8.tooltipRef = _ref;
|
4716 | }
|
4717 | }, ariaProps, {
|
4718 | 'data-id': 'tooltip',
|
4719 | dangerouslySetInnerHTML: { __html: placeholder } }));
|
4720 | } else {
|
4721 | return _react2.default.createElement(
|
4722 | Wrapper,
|
4723 | _extends({ className: tooltipClass + ' ' + extraClass,
|
4724 | id: this.props.id
|
4725 | }, ariaProps, {
|
4726 | ref: function ref(_ref2) {
|
4727 | return _this8.tooltipRef = _ref2;
|
4728 | },
|
4729 | 'data-id': 'tooltip' }),
|
4730 | placeholder
|
4731 | );
|
4732 | }
|
4733 | }
|
4734 | }], [{
|
4735 | key: 'getDerivedStateFromProps',
|
4736 | value: function getDerivedStateFromProps(nextProps, prevState) {
|
4737 | var ariaProps = prevState.ariaProps;
|
4738 |
|
4739 | var newAriaProps = (0, aria.parseAria)(nextProps);
|
4740 | var isChanged = Object.keys(newAriaProps).some(function (props) {
|
4741 | return newAriaProps[props] !== ariaProps[props];
|
4742 | });
|
4743 | if (!isChanged) {
|
4744 | return null;
|
4745 | }
|
4746 | return _extends({}, prevState, {
|
4747 | ariaProps: newAriaProps
|
4748 | });
|
4749 | }
|
4750 | }]);
|
4751 |
|
4752 | return ReactTooltip;
|
4753 | }(_react2.default.Component), _class2.propTypes = {
|
4754 | children: _propTypes2.default.any,
|
4755 | place: _propTypes2.default.string,
|
4756 | type: _propTypes2.default.string,
|
4757 | effect: _propTypes2.default.string,
|
4758 | offset: _propTypes2.default.object,
|
4759 | multiline: _propTypes2.default.bool,
|
4760 | border: _propTypes2.default.bool,
|
4761 | insecure: _propTypes2.default.bool,
|
4762 | class: _propTypes2.default.string,
|
4763 | className: _propTypes2.default.string,
|
4764 | id: _propTypes2.default.string,
|
4765 | html: _propTypes2.default.bool,
|
4766 | delayHide: _propTypes2.default.number,
|
4767 | delayUpdate: _propTypes2.default.number,
|
4768 | delayShow: _propTypes2.default.number,
|
4769 | event: _propTypes2.default.string,
|
4770 | eventOff: _propTypes2.default.string,
|
4771 | watchWindow: _propTypes2.default.bool,
|
4772 | isCapture: _propTypes2.default.bool,
|
4773 | globalEventOff: _propTypes2.default.string,
|
4774 | getContent: _propTypes2.default.any,
|
4775 | afterShow: _propTypes2.default.func,
|
4776 | afterHide: _propTypes2.default.func,
|
4777 | overridePosition: _propTypes2.default.func,
|
4778 | disable: _propTypes2.default.bool,
|
4779 | scrollHide: _propTypes2.default.bool,
|
4780 | resizeHide: _propTypes2.default.bool,
|
4781 | wrapper: _propTypes2.default.string,
|
4782 | clickable: _propTypes2.default.bool
|
4783 | }, _class2.defaultProps = {
|
4784 | insecure: true,
|
4785 | resizeHide: true,
|
4786 | wrapper: 'div',
|
4787 | clickable: false
|
4788 | }, _class2.supportedWrappers = ['div', 'span'], _class2.displayName = 'ReactTooltip', _temp)) || _class) || _class) || _class) || _class) || _class) || _class;
|
4789 |
|
4790 |
|
4791 |
|
4792 |
|
4793 | module.exports = ReactTooltip;
|
4794 | });
|
4795 |
|
4796 | var ReactTooltip = unwrapExports(dist);
|
4797 |
|
4798 | function _templateObject$q() {
|
4799 | var data = taggedTemplateLiteralLoose(["\n\tbackground-color: ", ";\n\n\t&&&&.qube-tooltip:after {\n\t\tborder-top-color: ", ";\n\t\tborder-right-color: ", ";\n\t\tborder-bottom-color: ", ";\n\t\tborder-left-color: ", ";\n\t}\n\n\t&&&&.qube-tooltip {\n\t\tpadding: 12px;\n\n\t\tanimation: fadein 0.5s;\n\t\tbackground-color: ", ";\n\t\tborder-radius: none;\n\t\tbox-shadow: 1px 1px 4px rgba(0, 0, 0, 0.25);\n\t\tcolor: #fff;\n\t\tline-height: 18px;\n\t\topacity: 1;\n\t}\n"]);
|
4800 |
|
4801 | _templateObject$q = function _templateObject() {
|
4802 | return data;
|
4803 | };
|
4804 |
|
4805 | return data;
|
4806 | }
|
4807 | var StyledTooltip = styled(ReactTooltip)(_templateObject$q(), function (_ref) {
|
4808 | var theme = _ref.theme;
|
4809 | return theme.colors.darkGray;
|
4810 | }, function (_ref2) {
|
4811 | var theme = _ref2.theme,
|
4812 | place = _ref2.place;
|
4813 | return place === 'top' ? theme.colors.darkGray : '';
|
4814 | }, function (_ref3) {
|
4815 | var theme = _ref3.theme,
|
4816 | place = _ref3.place;
|
4817 | return place === 'right' ? theme.colors.darkGray : '';
|
4818 | }, function (_ref4) {
|
4819 | var theme = _ref4.theme,
|
4820 | place = _ref4.place;
|
4821 | return place === 'bottom' ? theme.colors.darkGray : '';
|
4822 | }, function (_ref5) {
|
4823 | var theme = _ref5.theme,
|
4824 | place = _ref5.place;
|
4825 | return place === 'left' ? theme.colors.darkGray : '';
|
4826 | }, function (_ref6) {
|
4827 | var theme = _ref6.theme;
|
4828 | return theme.colors.darkGray;
|
4829 | });
|
4830 | StyledTooltip.defaultProps = {
|
4831 | effect: 'solid',
|
4832 | className: 'qube-tooltip',
|
4833 | suppressClassNameWarning: true
|
4834 | };
|
4835 | StyledTooltip.propTypes = {
|
4836 | id: PropTypes.string.isRequired,
|
4837 | text: PropTypes.string,
|
4838 | place: PropTypes.oneOf(['top', 'bottom', 'left', 'right']),
|
4839 | multiline: PropTypes.bool,
|
4840 |
|
4841 |
|
4842 | suppressClassNameWarning: PropTypes.bool
|
4843 | };
|
4844 | StyledTooltip.displayName = 'StyledTooltip';
|
4845 |
|
4846 | function _templateObject$r() {
|
4847 | var data = taggedTemplateLiteralLoose(["\n\tcursor: help;\n"]);
|
4848 |
|
4849 | _templateObject$r = function _templateObject() {
|
4850 | return data;
|
4851 | };
|
4852 |
|
4853 | return data;
|
4854 | }
|
4855 |
|
4856 | var HelpTooltip = function HelpTooltip(_ref) {
|
4857 | var id = _ref.id,
|
4858 | text = _ref.text,
|
4859 | place = _ref.place,
|
4860 | multiline = _ref.multiline,
|
4861 | icon = _ref.icon,
|
4862 | color = _ref.color,
|
4863 | disabled = _ref.disabled;
|
4864 | return React.createElement(Fragment, null, React.createElement(IconStyled$1, {
|
4865 | icon: icon,
|
4866 | color: color,
|
4867 | "data-tip": text,
|
4868 | "data-for": id,
|
4869 | disabled: disabled
|
4870 | }), React.createElement(StyledTooltip, {
|
4871 | id: id,
|
4872 | place: place,
|
4873 | multiline: multiline
|
4874 | }));
|
4875 | };
|
4876 |
|
4877 | var IconStyled$1 = styled(Icon$1)(_templateObject$r());
|
4878 | IconStyled$1.displayName = 'IconStyled';
|
4879 | HelpTooltip.defaultProps = {
|
4880 | icon: 'management',
|
4881 | color: '#EC8222',
|
4882 | place: 'top',
|
4883 | multiline: false,
|
4884 | disabled: false
|
4885 | };
|
4886 | HelpTooltip.propTypes = {
|
4887 | id: PropTypes.string.isRequired,
|
4888 | text: PropTypes.string.isRequired,
|
4889 | place: PropTypes.oneOf(['top', 'bottom', 'left', 'right']),
|
4890 | icon: PropTypes.oneOf(IconName),
|
4891 | color: PropTypes.string,
|
4892 | multiline: PropTypes.bool,
|
4893 | disabled: PropTypes.bool
|
4894 | };
|
4895 | HelpTooltip.displayName = 'HelpTooltip';
|
4896 |
|
4897 | var Tooltip = function Tooltip(_ref) {
|
4898 | var id = _ref.id,
|
4899 | place = _ref.place,
|
4900 | trigger = _ref.trigger,
|
4901 | multiline = _ref.multiline,
|
4902 | props = objectWithoutPropertiesLoose(_ref, ["id", "place", "trigger", "multiline"]);
|
4903 |
|
4904 | return React.createElement(Fragment, null, trigger, React.createElement(StyledTooltip, _extends_1({}, props, {
|
4905 | id: id,
|
4906 | place: place,
|
4907 | multiline: multiline,
|
4908 | effect: "solid"
|
4909 | })));
|
4910 | };
|
4911 |
|
4912 | Tooltip.defaultProps = {
|
4913 | multiline: false,
|
4914 | place: 'bottom'
|
4915 | };
|
4916 | Tooltip.propTypes = {
|
4917 | id: PropTypes.string.isRequired,
|
4918 | trigger: PropTypes.object.isRequired,
|
4919 | place: PropTypes.oneOf(['top', 'bottom', 'left', 'right']),
|
4920 | multiline: PropTypes.bool
|
4921 | };
|
4922 | Tooltip.displayName = 'Tooltip';
|
4923 |
|
4924 | var spanTrigger = React.createElement("span", {
|
4925 | "data-tip": "Tooltip Example",
|
4926 | "data-for": "spanTrigger"
|
4927 | }, "Default tooltip");
|
4928 | var iconTrigger = React.createElement(Icon$1, {
|
4929 | icon: "management",
|
4930 | "data-tip": "Tooltip <br/> Example",
|
4931 | "data-for": "iconTrigger"
|
4932 | });
|
4933 | var buttonTrigger = React.createElement(Button$1, {
|
4934 | icon: "add",
|
4935 | content: "Example on a button",
|
4936 | "data-tip": "Tooltip place top",
|
4937 | "data-for": "buttonTrigger"
|
4938 | });
|
4939 |
|
4940 | var TooltipExample = function TooltipExample() {
|
4941 | return React.createElement("div", null, React.createElement(Header, {
|
4942 | as: "h1"
|
4943 | }, "Tooltip"), React.createElement(Divider, null), React.createElement(Grid, {
|
4944 | columns: 4,
|
4945 | padded: true
|
4946 | }, React.createElement(Grid.Row, null), React.createElement(Grid.Row, null, React.createElement(Grid.Column, null, React.createElement(Tooltip, {
|
4947 | trigger: spanTrigger,
|
4948 | id: "spanTrigger"
|
4949 | })), React.createElement(Grid.Column, null, "Multiline text", React.createElement(Tooltip, {
|
4950 | trigger: iconTrigger,
|
4951 | id: "iconTrigger",
|
4952 | multiline: true
|
4953 | })), React.createElement(Grid.Column, null, React.createElement(Tooltip, {
|
4954 | trigger: buttonTrigger,
|
4955 | id: "buttonTrigger",
|
4956 | place: "top"
|
4957 | }))), React.createElement(Grid.Row, null), React.createElement(Grid.Row, null)));
|
4958 | };
|
4959 |
|
4960 | function _templateObject$s() {
|
4961 | var data = taggedTemplateLiteralLoose(["\n\t&&&& > .active.item,\n\t&&&& > .active.item:hover {\n\t\tborder-color: ", " !important;\n\t\tcolor: ", " !important;\n\t}\n\n\t&&&& > .item:focus {\n\t\toutline: none !important;\n\t}\n\n\t&&&& > .item:hover {\n\t\tcolor: ", " !important;\n\t}\n\n\t&&&& > a[type='ellipsisItem'] {\n\t\tpointer-events: none;\n\t}\n"]);
|
4962 |
|
4963 | _templateObject$s = function _templateObject() {
|
4964 | return data;
|
4965 | };
|
4966 |
|
4967 | return data;
|
4968 | }
|
4969 | var PaginationStyled = styled(function (_ref) {
|
4970 | var activeColor = _ref.activeColor,
|
4971 | props = objectWithoutPropertiesLoose(_ref, ["activeColor"]);
|
4972 |
|
4973 | return React.createElement(Pagination, props);
|
4974 | })(_templateObject$s(), function (_ref2) {
|
4975 | var activeColor = _ref2.activeColor;
|
4976 | return activeColor;
|
4977 | }, function (_ref3) {
|
4978 | var activeColor = _ref3.activeColor;
|
4979 | return activeColor;
|
4980 | }, function (_ref4) {
|
4981 | var activeColor = _ref4.activeColor;
|
4982 | return activeColor;
|
4983 | });
|
4984 |
|
4985 | var Pagination$1 = function Pagination$$1(_ref5) {
|
4986 | var activePage = _ref5.activePage,
|
4987 | totalPages = _ref5.totalPages,
|
4988 | onPageChange = _ref5.onPageChange,
|
4989 | activeColor = _ref5.activeColor,
|
4990 | props = objectWithoutPropertiesLoose(_ref5, ["activePage", "totalPages", "onPageChange", "activeColor"]);
|
4991 |
|
4992 | return React.createElement(PaginationStyled, _extends_1({
|
4993 | activePage: activePage,
|
4994 | firstItem: null,
|
4995 | onPageChange: onPageChange,
|
4996 | lastItem: null,
|
4997 | pointing: true,
|
4998 | secondary: true,
|
4999 | activeColor: activeColor,
|
5000 | nextItem: {
|
5001 | content: React.createElement(Icon$1, {
|
5002 | icon: "select-right",
|
5003 | color: theme.colors.activeBlue
|
5004 | }),
|
5005 | icon: true
|
5006 | },
|
5007 | prevItem: {
|
5008 | content: React.createElement(Icon$1, {
|
5009 | icon: "select-left",
|
5010 | color: theme.colors.activeBlue
|
5011 | }),
|
5012 | icon: true
|
5013 | },
|
5014 | ellipsisItem: {
|
5015 | content: React.createElement(Icon, {
|
5016 | name: "ellipsis horizontal"
|
5017 | }),
|
5018 | icon: true
|
5019 | },
|
5020 | totalPages: totalPages
|
5021 | }, props));
|
5022 | };
|
5023 |
|
5024 | Pagination$1.defaultProps = {
|
5025 | activeColor: theme.colors.activeBlue
|
5026 | };
|
5027 | Pagination$1.displayName = 'Pagination';
|
5028 | Pagination$1.propTypes = {
|
5029 |
|
5030 | activePage: PropTypes.number.isRequired,
|
5031 |
|
5032 |
|
5033 | totalPages: PropTypes.number.isRequired,
|
5034 |
|
5035 |
|
5036 | onPageChange: PropTypes.func.isRequired,
|
5037 |
|
5038 |
|
5039 | activeColor: PropTypes.string
|
5040 | };
|
5041 |
|
5042 |
|
5043 |
|
5044 | function _templateObject$t() {
|
5045 | var data = taggedTemplateLiteralLoose(["\n\twidth: 100%;\n\tcursor: ", " !important;\n\topacity: 1 !important;\n\n\ti.icon {\n\t\tcolor: ", " !important;\n\t\topacity: 1 !important;\n\t\ttransition: none !important;\n\t}\n\n\t&&& input {\n\t\tpadding: 8px;\n\t\tborder-color: ", ";\n\t\tborder-radius: 4px;\n\t\tcolor: ", ";\n\n\t\t:focus {\n\t\t\tborder-color: ", ";\n\t\t}\n\n\t\t::placeholder {\n\t\t\tcolor: ", ";\n\t\t\tuser-select: none;\n\t\t}\n\t}\n\n\t.label {\n\t\tborder-radius: 0 ", " ", " 0 !important;\n\t}\n\n\t:focus-within ::placeholder {\n\t\tcolor: ", " !important;\n\t}\n\n\t:focus-within i {\n\t\tcolor: ", " !important;\n\t}\n"]);
|
5046 |
|
5047 | _templateObject$t = function _templateObject() {
|
5048 | return data;
|
5049 | };
|
5050 |
|
5051 | return data;
|
5052 | }
|
5053 | var Input$1 = styled(Input)(_templateObject$t(), function (_ref) {
|
5054 | var disabled = _ref.disabled;
|
5055 | return disabled ? 'not-allowed' : 'pointer';
|
5056 | }, function (_ref2) {
|
5057 | var theme = _ref2.theme,
|
5058 | disabled = _ref2.disabled;
|
5059 | return disabled ? theme.colors.strokeGray : theme.colors.mediumGray;
|
5060 | }, function (_ref3) {
|
5061 | var theme = _ref3.theme,
|
5062 | error = _ref3.error;
|
5063 | return error ? theme.colors.red : theme.colors.strokeGray;
|
5064 | }, function (_ref4) {
|
5065 | var theme = _ref4.theme,
|
5066 | disabled = _ref4.disabled;
|
5067 | return disabled ? theme.colors.strokeGray : theme.colors.darkGray;
|
5068 | }, function (_ref5) {
|
5069 | var theme = _ref5.theme;
|
5070 | return theme.colors.activeBlue;
|
5071 | }, function (_ref6) {
|
5072 | var theme = _ref6.theme,
|
5073 | disabled = _ref6.disabled;
|
5074 | return disabled ? theme.colors.strokeGray : theme.colors.gray;
|
5075 | }, function (_ref7) {
|
5076 | var theme = _ref7.theme;
|
5077 | return theme.input.borderRadius;
|
5078 | }, function (_ref8) {
|
5079 | var theme = _ref8.theme;
|
5080 | return theme.input.borderRadius;
|
5081 | }, function (_ref9) {
|
5082 | var theme = _ref9.theme;
|
5083 | return theme.colors.mediumGray;
|
5084 | }, function (_ref10) {
|
5085 | var theme = _ref10.theme;
|
5086 | return theme.colors.activeBlue;
|
5087 | });
|
5088 | Input$1.displayName = 'Input';
|
5089 |
|
5090 | function _templateObject$u() {
|
5091 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: inline-block !important;\n\tcolor: ", ";\n\tcursor: pointer;\n\tfloat: right !important;\n\tfont-size: 11px !important;\n\tfont-style: normal !important;\n\tfont-weight: normal !important;\n\tline-height: normal !important;\n\ttext-align: right !important;\n"]);
|
5092 |
|
5093 | _templateObject$u = function _templateObject() {
|
5094 | return data;
|
5095 | };
|
5096 |
|
5097 | return data;
|
5098 | }
|
5099 | var LabelLink = styled.div(_templateObject$u(), function (_ref) {
|
5100 | var theme = _ref.theme,
|
5101 | disabled = _ref.disabled;
|
5102 | return disabled ? theme.colors.strokeGray : theme.colors.activeBlue;
|
5103 | });
|
5104 | LabelLink.defaultProps = {
|
5105 | disabled: false
|
5106 | };
|
5107 | LabelLink.propTypes = {
|
5108 |
|
5109 | disabled: PropTypes.bool
|
5110 | };
|
5111 | LabelLink.displayName = 'LabelLink';
|
5112 |
|
5113 | function _templateObject$v() {
|
5114 | var data = taggedTemplateLiteralLoose(["\n\tposition: relative;\n\ttop: -2px;\n\n\tmargin-right: 9px !important;\n\tmargin-bottom: 3px !important;\n\n\tcolor: ", ";\n\tfloat: left !important;\n\tfont-size: 16px !important;\n"]);
|
5115 |
|
5116 | _templateObject$v = function _templateObject() {
|
5117 | return data;
|
5118 | };
|
5119 |
|
5120 | return data;
|
5121 | }
|
5122 | var InputIcon = styled(Icon$1)(_templateObject$v(), function (_ref) {
|
5123 | var theme = _ref.theme,
|
5124 | disabled = _ref.disabled;
|
5125 | return disabled ? theme.colors.strokeGray : theme.colors.mediumGray;
|
5126 | });
|
5127 | InputIcon.defaultProps = {
|
5128 | disabled: false
|
5129 | };
|
5130 | InputIcon.propTypes = {
|
5131 |
|
5132 | disabled: PropTypes.bool
|
5133 | };
|
5134 | InputIcon.displayName = 'IconInput';
|
5135 |
|
5136 | var ErrorText = function ErrorText(props) {
|
5137 | return React.createElement(Text, _extends_1({
|
5138 | size: "sm",
|
5139 | italic: true,
|
5140 | color: "red"
|
5141 | }, props));
|
5142 | };
|
5143 |
|
5144 | ErrorText.displayName = 'ErrorText';
|
5145 |
|
5146 | var Error$1 = function Error(_ref) {
|
5147 | var children = _ref.children,
|
5148 | props = objectWithoutPropertiesLoose(_ref, ["children"]);
|
5149 |
|
5150 | return React.createElement(ErrorText, props, React.createElement("error-label", null, children));
|
5151 | };
|
5152 |
|
5153 | Error$1.displayName = 'Error';
|
5154 | Error$1.propTypes = {
|
5155 |
|
5156 | children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired
|
5157 | };
|
5158 |
|
5159 | function _templateObject$w() {
|
5160 | var data = taggedTemplateLiteralLoose(["\n\t&& {\n\t\tfont-size: 12px;\n\t}\n\n\t&&& {\n\t\twidth: 100%;\n\t\theight: 100%;\n\t\tbackground-color: ", " !important;\n\t\tcolor: ", ";\n\t\tfont-style: normal;\n\t\tfont-weight: normal;\n\t\tline-height: 14px;\n\t\ttext-align: ", ";\n\t}\n"]);
|
5161 |
|
5162 | _templateObject$w = function _templateObject() {
|
5163 | return data;
|
5164 | };
|
5165 |
|
5166 | return data;
|
5167 | }
|
5168 | var ColorLabel = styled(function (_ref) {
|
5169 | var color = _ref.color,
|
5170 | props = objectWithoutPropertiesLoose(_ref, ["color"]);
|
5171 |
|
5172 | return React.createElement(Label, props);
|
5173 | })(_templateObject$w(), function (_ref2) {
|
5174 | var color = _ref2.color,
|
5175 | theme = _ref2.theme;
|
5176 | return theme.colors[color] || theme.label.defaultColor;
|
5177 | }, function (_ref3) {
|
5178 | var theme = _ref3.theme;
|
5179 | return theme.colors.white;
|
5180 | }, function (_ref4) {
|
5181 | var align = _ref4.align;
|
5182 | return align || 'center';
|
5183 | });
|
5184 | ColorLabel.displayName = 'Label';
|
5185 | ColorLabel.defaultProps = {
|
5186 | color: undefined,
|
5187 | align: undefined
|
5188 | };
|
5189 | ColorLabel.propTypes = {
|
5190 | color: PropTypes.string,
|
5191 | align: PropTypes.oneOf(['left', 'right'])
|
5192 | };
|
5193 |
|
5194 | var LabelText = function LabelText(_ref) {
|
5195 | var disabled = _ref.disabled,
|
5196 | props = objectWithoutPropertiesLoose(_ref, ["disabled"]);
|
5197 |
|
5198 | return React.createElement(Text, _extends_1({
|
5199 | color: disabled ? 'strokeGray' : 'mediumGray',
|
5200 | bold: true,
|
5201 | size: "sm"
|
5202 | }, props));
|
5203 | };
|
5204 |
|
5205 | LabelText.defaultProps = {
|
5206 | disabled: false
|
5207 | };
|
5208 | LabelText.propTypes = {
|
5209 | disabled: PropTypes.bool
|
5210 | };
|
5211 | LabelText.displayName = 'LabelText';
|
5212 |
|
5213 | var Label$1 = function Label$$1(_ref) {
|
5214 | var children = _ref.children,
|
5215 | props = objectWithoutPropertiesLoose(_ref, ["children"]);
|
5216 |
|
5217 | return React.createElement(LabelText, props, React.createElement("label", null, children));
|
5218 | };
|
5219 |
|
5220 | Label$1.defaultProps = {
|
5221 | children: ''
|
5222 | };
|
5223 | Label$1.propTypes = {
|
5224 |
|
5225 | children: PropTypes.string
|
5226 | };
|
5227 | Label$1.displayName = 'Label';
|
5228 |
|
5229 | function _templateObject$x() {
|
5230 | var data = taggedTemplateLiteralLoose(["\n\theight: 12px;\n\tmargin: 5px 0 11px 0;\n\tcolor: ", ";\n\tfont-size: 12px;\n\tfont-style: italic;\n\tfont-weight: 400;\n"]);
|
5231 |
|
5232 | _templateObject$x = function _templateObject() {
|
5233 | return data;
|
5234 | };
|
5235 |
|
5236 | return data;
|
5237 | }
|
5238 | var BottomLabel = styled.div(_templateObject$x(), function (_ref) {
|
5239 | var theme = _ref.theme,
|
5240 | disabled = _ref.disabled;
|
5241 | return disabled ? theme.colors.strokeGray : theme.colors.mediumGray;
|
5242 | });
|
5243 | BottomLabel.defaultProps = {
|
5244 | disabled: false
|
5245 | };
|
5246 | BottomLabel.propTypes = {
|
5247 |
|
5248 | disabled: PropTypes.bool
|
5249 | };
|
5250 | BottomLabel.displayName = 'BottomLabel';
|
5251 |
|
5252 | function _templateObject3$6() {
|
5253 | var data = taggedTemplateLiteralLoose(["\n\tcolor: ", ";\n"]);
|
5254 |
|
5255 | _templateObject3$6 = function _templateObject3() {
|
5256 | return data;
|
5257 | };
|
5258 |
|
5259 | return data;
|
5260 | }
|
5261 |
|
5262 | function _templateObject2$9() {
|
5263 | var data = taggedTemplateLiteralLoose(["\n\tcolor: ", ";\n\tfont-weight: bold;\n"]);
|
5264 |
|
5265 | _templateObject2$9 = function _templateObject2() {
|
5266 | return data;
|
5267 | };
|
5268 |
|
5269 | return data;
|
5270 | }
|
5271 |
|
5272 | function _templateObject$y() {
|
5273 | var data = taggedTemplateLiteralLoose(["\n\tfont-size: 35px;\n\twhite-space: nowrap;\n"]);
|
5274 |
|
5275 | _templateObject$y = function _templateObject() {
|
5276 | return data;
|
5277 | };
|
5278 |
|
5279 | return data;
|
5280 | }
|
5281 |
|
5282 | var TicketLabel = function TicketLabel(_ref) {
|
5283 | var typeTicketLabel = _ref.typeTicketLabel,
|
5284 | color = _ref.color,
|
5285 | queueTag = _ref.queueTag,
|
5286 | ticketNumber = _ref.ticketNumber,
|
5287 | props = objectWithoutPropertiesLoose(_ref, ["typeTicketLabel", "color", "queueTag", "ticketNumber"]);
|
5288 |
|
5289 | var getQueueTagColor = function getQueueTagColor(type, customColor) {
|
5290 | if (type === 'normal') return theme.colors.red;
|
5291 | if (type === 'prioritary') return theme.colors.activeBlue;
|
5292 | if (!type && customColor) return customColor;
|
5293 | return theme.colors.black;
|
5294 | };
|
5295 |
|
5296 | return React.createElement(TicketLabelWrapper, props, React.createElement(TicketQueueTag, {
|
5297 | queueTagColor: getQueueTagColor(typeTicketLabel, color)
|
5298 | }, queueTag + " "), React.createElement(TicketNumber, {
|
5299 | typeTicketLabel: typeTicketLabel,
|
5300 | color: color
|
5301 | }, ticketNumber));
|
5302 | };
|
5303 |
|
5304 | var TicketLabelWrapper = styled.div(_templateObject$y());
|
5305 | TicketLabelWrapper.displayName = 'TicketLabelWrapper';
|
5306 | var TicketQueueTag = styled.span(_templateObject2$9(), function (_ref2) {
|
5307 | var queueTagColor = _ref2.queueTagColor;
|
5308 | return queueTagColor;
|
5309 | });
|
5310 | TicketQueueTag.displayName = 'TicketQueueTag';
|
5311 | var TicketNumber = styled.span(_templateObject3$6(), function (_ref3) {
|
5312 | var typeTicketLabel = _ref3.typeTicketLabel,
|
5313 | color = _ref3.color;
|
5314 | return !typeTicketLabel && color ? color : theme.colors.darkGray;
|
5315 | });
|
5316 | TicketNumber.displayName = 'TicketNumber';
|
5317 | TicketLabel.defaultProps = {
|
5318 | typeTicketLabel: undefined,
|
5319 | color: undefined
|
5320 | };
|
5321 | TicketLabel.propTypes = {
|
5322 |
|
5323 | typeTicketLabel: PropTypes.oneOf(['normal', 'prioritary']),
|
5324 |
|
5325 |
|
5326 | color: PropTypes.string,
|
5327 |
|
5328 |
|
5329 | queueTag: PropTypes.string.isRequired,
|
5330 |
|
5331 |
|
5332 | ticketNumber: PropTypes.string.isRequired
|
5333 | };
|
5334 |
|
5335 | function _templateObject2$a() {
|
5336 | var data = taggedTemplateLiteralLoose(["\n\tdiv:last-child {\n\t\tmargin-bottom: 0;\n\t}\n"]);
|
5337 |
|
5338 | _templateObject2$a = function _templateObject2() {
|
5339 | return data;
|
5340 | };
|
5341 |
|
5342 | return data;
|
5343 | }
|
5344 |
|
5345 | function _templateObject$z() {
|
5346 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tflex-direction: column;\n\tmargin-bottom: 12px;\n"]);
|
5347 |
|
5348 | _templateObject$z = function _templateObject() {
|
5349 | return data;
|
5350 | };
|
5351 |
|
5352 | return data;
|
5353 | }
|
5354 |
|
5355 | var InputField = function InputField(_ref) {
|
5356 | var label = _ref.label,
|
5357 | id = _ref.id,
|
5358 | hint = _ref.hint,
|
5359 | error = _ref.error,
|
5360 | disabled = _ref.disabled,
|
5361 | labelIcon = _ref.labelIcon,
|
5362 | rightLabel = _ref.rightLabel,
|
5363 | rightLabelOnClick = _ref.rightLabelOnClick,
|
5364 | element = _ref.element,
|
5365 | props = objectWithoutPropertiesLoose(_ref, ["label", "id", "hint", "error", "disabled", "labelIcon", "rightLabel", "rightLabelOnClick", "element"]);
|
5366 |
|
5367 | var Element = element;
|
5368 | return React.createElement(InputFieldContainer, null, React.createElement("div", null, labelIcon && React.createElement(InputIcon, {
|
5369 | disabled: disabled,
|
5370 | icon: labelIcon
|
5371 | }), label && React.createElement(Label$1, {
|
5372 | htmlFor: id,
|
5373 | disabled: disabled
|
5374 | }, label), rightLabel && React.createElement(LabelLink, {
|
5375 | id: id,
|
5376 | disabled: disabled,
|
5377 | onClick: !disabled ? rightLabelOnClick : undefined
|
5378 | }, rightLabel)), React.createElement(Element, _extends_1({
|
5379 | id: id,
|
5380 | error: !!error,
|
5381 | disabled: disabled
|
5382 | }, props)), hint && React.createElement(BottomLabel, {
|
5383 | "data-test-id": "hint",
|
5384 | disabled: disabled
|
5385 | }, hint), error && React.createElement(ListErrorWrapper, null, [].concat(error).map(function (child, i) {
|
5386 | return React.createElement(Error$1, {
|
5387 | key: i
|
5388 | }, child);
|
5389 | })));
|
5390 | };
|
5391 |
|
5392 | var InputFieldContainer = styled.div(_templateObject$z());
|
5393 | var ListErrorWrapper = styled.div(_templateObject2$a());
|
5394 | InputField.defaultProps = {
|
5395 | hint: '',
|
5396 | error: '',
|
5397 | label: '',
|
5398 | id: '',
|
5399 | disabled: false,
|
5400 | labelIcon: undefined,
|
5401 | rightLabelOnClick: undefined,
|
5402 | rightLabel: undefined,
|
5403 | element: Input$1
|
5404 | };
|
5405 | InputField.propTypes = {
|
5406 |
|
5407 | hint: PropTypes.string,
|
5408 |
|
5409 |
|
5410 | error: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
|
5411 |
|
5412 |
|
5413 | label: PropTypes.string,
|
5414 |
|
5415 |
|
5416 | id: PropTypes.string,
|
5417 |
|
5418 |
|
5419 | disabled: PropTypes.bool,
|
5420 |
|
5421 |
|
5422 | labelIcon: PropTypes.oneOf(IconName),
|
5423 |
|
5424 |
|
5425 | rightLabelOnClick: PropTypes.func,
|
5426 |
|
5427 |
|
5428 | rightLabel: PropTypes.string,
|
5429 |
|
5430 |
|
5431 | element: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
|
5432 | };
|
5433 | InputField.displayName = 'InputField';
|
5434 |
|
5435 | function _templateObject4$4() {
|
5436 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\theight: 34px;\n\tbox-sizing: border-box;\n\tborder: 1px solid #dddddd;\n\tborder-radius: 4px;\n\tcursor: pointer !important;\n\tuser-select: none;\n"]);
|
5437 |
|
5438 | _templateObject4$4 = function _templateObject4() {
|
5439 | return data;
|
5440 | };
|
5441 |
|
5442 | return data;
|
5443 | }
|
5444 |
|
5445 | function _templateObject3$7() {
|
5446 | var data = taggedTemplateLiteralLoose(["\n\tmargin-right: 9px !important;\n\tmargin-left: 9px !important;\n\tcolor: ", ";\n\tfloat: left;\n\tfont-size: 16px !important;\n\tline-height: 34px !important;\n\tuser-select: none;\n"]);
|
5447 |
|
5448 | _templateObject3$7 = function _templateObject3() {
|
5449 | return data;
|
5450 | };
|
5451 |
|
5452 | return data;
|
5453 | }
|
5454 |
|
5455 | function _templateObject2$b() {
|
5456 | var data = taggedTemplateLiteralLoose(["\n\toverflow: hidden;\n\twidth: calc(100% - 40px);\n\tcolor: ", ";\n\tfloat: left;\n\tfont-size: 14px;\n\tline-height: 34px;\n\ttext-overflow: ellipsis;\n\tuser-select: none;\n\twhite-space: nowrap;\n"]);
|
5457 |
|
5458 | _templateObject2$b = function _templateObject2() {
|
5459 | return data;
|
5460 | };
|
5461 |
|
5462 | return data;
|
5463 | }
|
5464 |
|
5465 | function _templateObject$A() {
|
5466 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: none;\n"]);
|
5467 |
|
5468 | _templateObject$A = function _templateObject() {
|
5469 | return data;
|
5470 | };
|
5471 |
|
5472 | return data;
|
5473 | }
|
5474 |
|
5475 | var InputFile =
|
5476 |
|
5477 | function (_Component) {
|
5478 | inheritsLoose(InputFile, _Component);
|
5479 |
|
5480 | function InputFile(props) {
|
5481 | var _this;
|
5482 |
|
5483 | _this = _Component.call(this, props) || this;
|
5484 |
|
5485 | defineProperty(assertThisInitialized(_this), "handleClick", function () {
|
5486 | _this.fieldField.current.click();
|
5487 | });
|
5488 |
|
5489 | _this.fieldField = React.createRef();
|
5490 | _this.handleClick = _this.handleClick.bind(assertThisInitialized(_this));
|
5491 | return _this;
|
5492 | }
|
5493 |
|
5494 | var _proto = InputFile.prototype;
|
5495 |
|
5496 | _proto.render = function render() {
|
5497 | var _this$props = this.props,
|
5498 | inputFileLabel = _this$props.inputFileLabel,
|
5499 | disabled = _this$props.disabled,
|
5500 | color = _this$props.color,
|
5501 | props = objectWithoutPropertiesLoose(_this$props, ["inputFileLabel", "disabled", "color"]);
|
5502 |
|
5503 | return React.createElement(InputFileContainer, {
|
5504 | onClick: !disabled ? this.handleClick : undefined
|
5505 | }, React.createElement(InputFileHidden, _extends_1({
|
5506 | ref: this.fieldField,
|
5507 | type: "file"
|
5508 | }, props)), React.createElement(AddIcon, {
|
5509 | color: color,
|
5510 | disabled: disabled,
|
5511 | icon: "add"
|
5512 | }), React.createElement(Label$2, {
|
5513 | disabled: disabled
|
5514 | }, inputFileLabel));
|
5515 | };
|
5516 |
|
5517 | return InputFile;
|
5518 | }(Component);
|
5519 |
|
5520 | var InputFileHidden = styled.input(_templateObject$A());
|
5521 | var Label$2 = styled.span(_templateObject2$b(), function (_ref) {
|
5522 | var disabled = _ref.disabled;
|
5523 | return disabled ? theme.colors.strokeGray : theme.colors.black;
|
5524 | });
|
5525 | var AddIcon = styled(Icon$1)(_templateObject3$7(), function (_ref2) {
|
5526 | var disabled = _ref2.disabled,
|
5527 | color = _ref2.color;
|
5528 | return disabled ? theme.colors.strokeGray : color;
|
5529 | });
|
5530 | var InputFileContainer = styled.div(_templateObject4$4());
|
5531 | InputFile.defaultProps = {
|
5532 | disabled: false,
|
5533 | color: theme.colors.activeBlue
|
5534 | };
|
5535 | InputFile.propTypes = {
|
5536 |
|
5537 | inputFileLabel: PropTypes.string.isRequired,
|
5538 |
|
5539 |
|
5540 | color: PropTypes.string,
|
5541 |
|
5542 |
|
5543 | disabled: PropTypes.bool
|
5544 | };
|
5545 | InputFile.displayName = 'InputFile';
|
5546 | InputFileHidden.displayName = 'InputFileHidden';
|
5547 | InputFileContainer.displayName = 'InputFileContainer';
|
5548 | AddIcon.displayName = 'AddIcon';
|
5549 | Label$2.displayName = 'Label';
|
5550 |
|
5551 | function _templateObject$B() {
|
5552 | var data = taggedTemplateLiteralLoose(["\n\twidth: 100%;\n\n\tpadding: 8px !important;\n\tborder-color: ", " !important;\n\tborder-radius: 4px !important;\n\tcolor: ", ";\n\n\tcursor: ", " !important;\n\n\t&:focus {\n\t\tborder-color: ", " !important;\n\t}\n"]);
|
5553 |
|
5554 | _templateObject$B = function _templateObject() {
|
5555 | return data;
|
5556 | };
|
5557 |
|
5558 | return data;
|
5559 | }
|
5560 | var TextArea$1 = styled(function (_ref) {
|
5561 | var error = _ref.error,
|
5562 | disabled = _ref.disabled,
|
5563 | props = objectWithoutPropertiesLoose(_ref, ["error", "disabled"]);
|
5564 |
|
5565 | return React.createElement(TextArea, _extends_1({
|
5566 | disabled: disabled
|
5567 | }, props));
|
5568 | })(_templateObject$B(), function (_ref2) {
|
5569 | var theme = _ref2.theme,
|
5570 | error = _ref2.error;
|
5571 | return error ? theme.colors.red : theme.colors.strokeGray;
|
5572 | }, function (_ref3) {
|
5573 | var theme = _ref3.theme;
|
5574 | return theme.colors.darkGray;
|
5575 | }, function (_ref4) {
|
5576 | var disabled = _ref4.disabled;
|
5577 | return disabled && 'not-allowed';
|
5578 | }, function (_ref5) {
|
5579 | var theme = _ref5.theme;
|
5580 | return theme.colors.activeBlue;
|
5581 | });
|
5582 | TextArea$1.defaultProps = {
|
5583 | disabled: false,
|
5584 | error: false
|
5585 | };
|
5586 | TextArea$1.propTypes = {
|
5587 |
|
5588 | disabled: PropTypes.bool,
|
5589 |
|
5590 |
|
5591 | error: PropTypes.bool
|
5592 | };
|
5593 | TextArea$1.displayName = 'TextArea';
|
5594 |
|
5595 | function _templateObject$C() {
|
5596 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: block !important;\n\twidth: 36px !important;\n\theight: 22px !important;\n\n\t&&&& input ~ label {\n\t\twidth: 36px !important;\n\t\theight: 22px !important;\n\t}\n\n\t&&&& input ~ .box:before {\n\t\twidth: 100% !important;\n\t\theight: 100% !important;\n\t}\n\n\t&&&& input ~ label:before {\n\t\twidth: 100% !important;\n\t\theight: 100% !important;\n\t}\n\n\t&&&& input ~ .box:after {\n\t\ttop: 2px !important;\n\t\tleft: 0.05rem !important;\n\t\twidth: 18px !important;\n\t\theight: 18px !important;\n\t}\n\n\t&&&& input ~ label:after {\n\t\ttop: 2px !important;\n\t\tleft: 0.05rem !important;\n\t\twidth: 18px !important;\n\t\theight: 18px !important;\n\t}\n\n\t&&&& input:checked ~ label:before {\n\t\twidth: 100% !important;\n\t\theight: 100% !important;\n\t\tbackground-color: ", " !important;\n\t}\n\n\t&&&& input:checked ~ .box:before {\n\t\twidth: 100% !important;\n\t\theight: 100% !important;\n\t\tbackground-color: ", " !important;\n\t}\n\n\t&&&& input:focus:checked ~ label:before {\n\t\twidth: 100% !important;\n\t\theight: 100% !important;\n\t\tbackground-color: ", " !important;\n\t}\n\n\t&&&& input:focus:checked ~ .box:before {\n\t\twidth: 100% !important;\n\t\theight: 100% !important;\n\t\tbackground-color: ", " !important;\n\t}\n\n\t&&&& input:checked ~ .box:after {\n\t\ttop: 2px !important;\n\t\tleft: 1.15rem !important;\n\t\twidth: 18px !important;\n\t\theight: 18px !important;\n\t}\n\n\t&&&& input:checked ~ label:after {\n\t\ttop: 2px !important;\n\t\tleft: 1.15rem !important;\n\t\twidth: 18px !important;\n\t\theight: 18px !important;\n\t}\n"]);
|
5597 |
|
5598 | _templateObject$C = function _templateObject() {
|
5599 | return data;
|
5600 | };
|
5601 |
|
5602 | return data;
|
5603 | }
|
5604 | var Toggle = styled(function (props) {
|
5605 | return React.createElement(Checkbox, _extends_1({
|
5606 | toggle: true
|
5607 | }, props));
|
5608 | })(_templateObject$C(), function (_ref) {
|
5609 | var theme = _ref.theme;
|
5610 | return theme.toggle.color;
|
5611 | }, function (_ref2) {
|
5612 | var theme = _ref2.theme;
|
5613 | return theme.toggle.color;
|
5614 | }, function (_ref3) {
|
5615 | var theme = _ref3.theme;
|
5616 | return theme.toggle.color;
|
5617 | }, function (_ref4) {
|
5618 | var theme = _ref4.theme;
|
5619 | return theme.toggle.color;
|
5620 | });
|
5621 | Toggle.displayName = 'Toggle';
|
5622 |
|
5623 | function _templateObject4$5() {
|
5624 | var data = taggedTemplateLiteralLoose(["\n\theight: ", ";\n\tline-height: ", ";\n\tmargin-left: ", ";\n\tmargin-right: ", ";\n\topacity: ", ";\n\tcursor: default;\n"]);
|
5625 |
|
5626 | _templateObject4$5 = function _templateObject4() {
|
5627 | return data;
|
5628 | };
|
5629 |
|
5630 | return data;
|
5631 | }
|
5632 |
|
5633 | function _templateObject3$8() {
|
5634 | var data = taggedTemplateLiteralLoose(["\n\tposition: absolute !important;\n\theight: 0;\n\twidth: 0;\n\tvisibility: hidden;\n"]);
|
5635 |
|
5636 | _templateObject3$8 = function _templateObject3() {
|
5637 | return data;
|
5638 | };
|
5639 |
|
5640 | return data;
|
5641 | }
|
5642 |
|
5643 | function _templateObject2$c() {
|
5644 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: block;\n\tcursor: ", ";\n\twidth: ", "px;\n\theight: ", "px;\n\tline-height: ", "px;\n\tbackground: ", ";\n\tborder-radius: 3px;\n"]);
|
5645 |
|
5646 | _templateObject2$c = function _templateObject2() {
|
5647 | return data;
|
5648 | };
|
5649 |
|
5650 | return data;
|
5651 | }
|
5652 |
|
5653 | function _templateObject$D() {
|
5654 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: inline-flex;\n\tflex-direction: ", ";\n\talign-items: center;\n\tuser-select: none;\n"]);
|
5655 |
|
5656 | _templateObject$D = function _templateObject() {
|
5657 | return data;
|
5658 | };
|
5659 |
|
5660 | return data;
|
5661 | }
|
5662 |
|
5663 | var Checkbox$1 =
|
5664 |
|
5665 | function (_Component) {
|
5666 | inheritsLoose(Checkbox$$1, _Component);
|
5667 |
|
5668 | function Checkbox$$1(props) {
|
5669 | var _this;
|
5670 |
|
5671 | _this = _Component.call(this, props) || this;
|
5672 |
|
5673 | defineProperty(assertThisInitialized(_this), "handleClick", function () {
|
5674 | _this.hiddenCheckbox.click();
|
5675 | });
|
5676 |
|
5677 | _this.hiddenCheckbox = createRef();
|
5678 | return _this;
|
5679 | }
|
5680 |
|
5681 | var _proto = Checkbox$$1.prototype;
|
5682 |
|
5683 | _proto.render = function render() {
|
5684 | var _this2 = this;
|
5685 |
|
5686 | var _this$props = this.props,
|
5687 | id = _this$props.id,
|
5688 | checked = _this$props.checked,
|
5689 | color = _this$props.color,
|
5690 | background = _this$props.background,
|
5691 | label = _this$props.label,
|
5692 | labelPosition = _this$props.labelPosition,
|
5693 | height = _this$props.height,
|
5694 | width = _this$props.width,
|
5695 | disabled = _this$props.disabled,
|
5696 | props = objectWithoutPropertiesLoose(_this$props, ["id", "checked", "color", "background", "label", "labelPosition", "height", "width", "disabled"]);
|
5697 |
|
5698 | return React.createElement(CheckboxWrapper, {
|
5699 | labelPosition: labelPosition,
|
5700 | onClick: function onClick(e) {
|
5701 | return e.stopPropagation();
|
5702 | }
|
5703 | }, React.createElement(CheckboxContainer, {
|
5704 | width: width,
|
5705 | height: height,
|
5706 | disabled: disabled,
|
5707 | background: background
|
5708 | }, React.createElement(HiddenCheckbox, _extends_1({
|
5709 | defaultChecked: checked,
|
5710 | disabled: disabled,
|
5711 | ref: function ref(checkbox) {
|
5712 | _this2.hiddenCheckbox = checkbox;
|
5713 | }
|
5714 | }, props)), checked ? React.createElement("svg", {
|
5715 | fillOpacity: disabled ? 0.5 : 1,
|
5716 | xmlns: "http://www.w3.org/2000/svg",
|
5717 | width: "100%",
|
5718 | height: "100%",
|
5719 | viewBox: "0 0 14 14"
|
5720 | }, React.createElement("path", {
|
5721 | d: "M12.4444 0H1.55556C0.7 0 0 0.7 0 1.55556V12.4444C0 13.3 0.7 14 1.55556 14H12.4444C13.3 14 14 13.3 14 12.4444V1.55556C14 0.7 13.3 0 12.4444 0ZM5.44444 10.8889L1.55556 7L2.64444 5.91111L5.44444 8.71111L11.3556 2.8L12.4444 3.88889L5.44444 10.8889Z",
|
5722 | fill: color ? "" + color : theme.colors.activeBlue
|
5723 | })) : React.createElement("svg", {
|
5724 | fillOpacity: disabled ? 0.5 : 1,
|
5725 | xmlns: "http://www.w3.org/2000/svg",
|
5726 | width: "100%",
|
5727 | height: "100%",
|
5728 | viewBox: "0 0 14 14"
|
5729 | }, React.createElement("path", {
|
5730 | d: "M12.4444 0.915033C12.6138 0.915033 12.7742 0.982135 12.896 1.10396C13.0179 1.22581 13.085 1.38618 13.085 1.55556V12.4444C13.085 12.6138 13.0179 12.7742 12.896 12.896C12.7742 13.0179 12.6138 13.085 12.4444 13.085H1.55556C1.38618 13.085 1.22581 13.0179 1.10396 12.896C0.982134 12.7742 0.915033 12.6138 0.915033 12.4444V1.55556C0.915033 1.38618 0.982134 1.22581 1.10396 1.10396C1.22581 0.982135 1.38618 0.915033 1.55556 0.915033H12.4444ZM12.4444 0H1.55556C0.7 0 0 0.7 0 1.55556V12.4444C0 13.3 0.7 14 1.55556 14H12.4444C13.3 14 14 13.3 14 12.4444V1.55556C14 0.7 13.3 0 12.4444 0Z",
|
5731 | fill: color ? "" + color : theme.colors.darkGray
|
5732 | }))), label && React.createElement(LabelWrapper, {
|
5733 | height: height,
|
5734 | labelPosition: labelPosition,
|
5735 | disabled: disabled,
|
5736 | onClick: this.handleClick
|
5737 | }, React.createElement(Label$1, {
|
5738 | htmlFor: id
|
5739 | }, label)));
|
5740 | };
|
5741 |
|
5742 | return Checkbox$$1;
|
5743 | }(Component);
|
5744 |
|
5745 | var CheckboxWrapper = styled.div(_templateObject$D(), function (_ref) {
|
5746 | var labelPosition = _ref.labelPosition;
|
5747 | return labelPosition === 'right' ? 'row' : 'row-reverse';
|
5748 | });
|
5749 | var CheckboxContainer = styled.label(_templateObject2$c(), function (_ref2) {
|
5750 | var disabled = _ref2.disabled;
|
5751 | return disabled ? 'default' : 'pointer';
|
5752 | }, function (_ref3) {
|
5753 | var width = _ref3.width;
|
5754 | return width;
|
5755 | }, function (_ref4) {
|
5756 | var height = _ref4.height;
|
5757 | return height;
|
5758 | }, function (_ref5) {
|
5759 | var height = _ref5.height;
|
5760 | return height;
|
5761 | }, function (_ref6) {
|
5762 | var background = _ref6.background;
|
5763 | return background ? "" + background : 'white';
|
5764 | });
|
5765 | var HiddenCheckbox = styled.input.attrs({
|
5766 | type: 'checkbox'
|
5767 | })(_templateObject3$8());
|
5768 | var LabelWrapper = styled.div(_templateObject4$5(), function (_ref7) {
|
5769 | var height = _ref7.height;
|
5770 | return height + "px";
|
5771 | }, function (_ref8) {
|
5772 | var height = _ref8.height;
|
5773 | return height + "px";
|
5774 | }, function (_ref9) {
|
5775 | var labelPosition = _ref9.labelPosition;
|
5776 | return labelPosition === 'right' ? '8px' : '0';
|
5777 | }, function (_ref10) {
|
5778 | var labelPosition = _ref10.labelPosition;
|
5779 | return labelPosition === 'left' ? '8px' : '0';
|
5780 | }, function (_ref11) {
|
5781 | var disabled = _ref11.disabled;
|
5782 | return disabled ? '0.5' : '1';
|
5783 | });
|
5784 | CheckboxWrapper.displayName = 'CheckboxWrapper';
|
5785 | CheckboxContainer.displayName = 'CheckboxContainer';
|
5786 | HiddenCheckbox.displayName = 'HiddenCheckbox';
|
5787 | LabelWrapper.displayName = 'LabelWrapper';
|
5788 | Checkbox$1.displayName = 'Checkbox';
|
5789 | Checkbox$1.defaultProps = {
|
5790 | height: 14,
|
5791 | width: 14,
|
5792 | label: null,
|
5793 | labelPosition: 'right',
|
5794 | id: '',
|
5795 | disabled: false,
|
5796 | color: undefined,
|
5797 | background: undefined
|
5798 | };
|
5799 | Checkbox$1.propTypes = {
|
5800 |
|
5801 | height: PropTypes.number,
|
5802 |
|
5803 |
|
5804 | width: PropTypes.number,
|
5805 |
|
5806 |
|
5807 | checked: PropTypes.bool.isRequired,
|
5808 |
|
5809 |
|
5810 | color: PropTypes.string,
|
5811 |
|
5812 |
|
5813 | background: PropTypes.string,
|
5814 |
|
5815 |
|
5816 | label: PropTypes.string,
|
5817 |
|
5818 |
|
5819 | labelPosition: PropTypes.oneOf(['left', 'right']),
|
5820 |
|
5821 |
|
5822 | id: PropTypes.string,
|
5823 |
|
5824 |
|
5825 | disabled: PropTypes.bool
|
5826 | };
|
5827 |
|
5828 | function _templateObject4$6() {
|
5829 | var data = taggedTemplateLiteralLoose(["\n\theight: ", ";\n\tline-height: ", ";\n\tmargin-left: ", ";\n\tmargin-right: ", ";\n\topacity: ", ";\n\tcursor: default;\n"]);
|
5830 |
|
5831 | _templateObject4$6 = function _templateObject4() {
|
5832 | return data;
|
5833 | };
|
5834 |
|
5835 | return data;
|
5836 | }
|
5837 |
|
5838 | function _templateObject3$9() {
|
5839 | var data = taggedTemplateLiteralLoose(["\n\theight: 0;\n\twidth: 0;\n\tvisibility: hidden;\n"]);
|
5840 |
|
5841 | _templateObject3$9 = function _templateObject3() {
|
5842 | return data;
|
5843 | };
|
5844 |
|
5845 | return data;
|
5846 | }
|
5847 |
|
5848 | function _templateObject2$d() {
|
5849 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: block;\n\tcursor: ", ";\n\twidth: ", "px;\n\theight: ", "px;\n\tline-height: ", "px;\n\tbackground: ", ";\n\tborder-radius: 3px;\n"]);
|
5850 |
|
5851 | _templateObject2$d = function _templateObject2() {
|
5852 | return data;
|
5853 | };
|
5854 |
|
5855 | return data;
|
5856 | }
|
5857 |
|
5858 | function _templateObject$E() {
|
5859 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: inline-flex;\n\tflex-direction: ", ";\n\talign-items: center;\n\tuser-select: none;\n"]);
|
5860 |
|
5861 | _templateObject$E = function _templateObject() {
|
5862 | return data;
|
5863 | };
|
5864 |
|
5865 | return data;
|
5866 | }
|
5867 |
|
5868 | var Radio =
|
5869 |
|
5870 | function (_Component) {
|
5871 | inheritsLoose(Radio, _Component);
|
5872 |
|
5873 | function Radio(props) {
|
5874 | var _this;
|
5875 |
|
5876 | _this = _Component.call(this, props) || this;
|
5877 |
|
5878 | defineProperty(assertThisInitialized(_this), "handleClick", function () {
|
5879 | _this.hiddenRadio.click();
|
5880 | });
|
5881 |
|
5882 | _this.hiddenRadio = createRef();
|
5883 | return _this;
|
5884 | }
|
5885 |
|
5886 | var _proto = Radio.prototype;
|
5887 |
|
5888 | _proto.render = function render() {
|
5889 | var _this2 = this;
|
5890 |
|
5891 | var _this$props = this.props,
|
5892 | id = _this$props.id,
|
5893 | checked = _this$props.checked,
|
5894 | color = _this$props.color,
|
5895 | background = _this$props.background,
|
5896 | label = _this$props.label,
|
5897 | labelPosition = _this$props.labelPosition,
|
5898 | height = _this$props.height,
|
5899 | width = _this$props.width,
|
5900 | disabled = _this$props.disabled,
|
5901 | props = objectWithoutPropertiesLoose(_this$props, ["id", "checked", "color", "background", "label", "labelPosition", "height", "width", "disabled"]);
|
5902 |
|
5903 | return React.createElement(RadioWrapper, _extends_1({
|
5904 | labelPosition: labelPosition
|
5905 | }, props), React.createElement(RadioContainer, {
|
5906 | width: width,
|
5907 | height: height,
|
5908 | disabled: disabled,
|
5909 | background: background
|
5910 | }, React.createElement(HiddenRadio, _extends_1({
|
5911 | checked: checked,
|
5912 | disabled: disabled,
|
5913 | ref: function ref(radio) {
|
5914 | _this2.hiddenRadio = radio;
|
5915 | }
|
5916 | }, props)), checked ? React.createElement("svg", {
|
5917 | fillOpacity: disabled ? 0.5 : 1,
|
5918 | width: "100%",
|
5919 | height: "100%",
|
5920 | viewBox: "0 0 14 14",
|
5921 | fill: "none",
|
5922 | xmlns: "http://www.w3.org/2000/svg"
|
5923 | }, React.createElement("path", {
|
5924 | fillRule: "evenodd",
|
5925 | clipRule: "evenodd",
|
5926 | d: "M7 3.5C5.04 3.5 3.5 5.04 3.5 7C3.5 8.96 5.04 10.5 7 10.5C8.96 10.5 10.5 8.96 10.5 7C10.5 5.04 8.96 3.5 7 3.5ZM7 0C3.15 0 0 3.15 0 7C0 10.85 3.15 14 7 14C10.85 14 14 10.85 14 7C14 3.15 10.85 0 7 0ZM7 12.6C3.92 12.6 1.4 10.08 1.4 7C1.4 3.92 3.92 1.4 7 1.4C10.08 1.4 12.6 3.92 12.6 7C12.6 10.08 10.08 12.6 7 12.6Z",
|
5927 | fill: color ? "" + color : theme.colors.activeBlue
|
5928 | })) : React.createElement("svg", {
|
5929 | fillOpacity: disabled ? 0.5 : 1,
|
5930 | xmlns: "http://www.w3.org/2000/svg",
|
5931 | width: "100%",
|
5932 | height: "100%",
|
5933 | viewBox: "0 0 14 14",
|
5934 | fill: "none"
|
5935 | }, React.createElement("path", {
|
5936 | fillRule: "evenodd",
|
5937 | clipRule: "evenodd",
|
5938 | d: "M7 0C3.15 0 0 3.15 0 7C0 10.85 3.15 14 7 14C10.85 14 14 10.85 14 7C14 3.15 10.85 0 7 0ZM7 12.6C3.92 12.6 1.4 10.08 1.4 7C1.4 3.92 3.92 1.4 7 1.4C10.08 1.4 12.6 3.92 12.6 7C12.6 10.08 10.08 12.6 7 12.6Z",
|
5939 | fill: color ? "" + color : theme.colors.darkGray
|
5940 | }))), label && React.createElement(LabelWrapper$1, {
|
5941 | height: height,
|
5942 | labelPosition: labelPosition,
|
5943 | disabled: disabled,
|
5944 | onClick: this.handleClick
|
5945 | }, React.createElement(Label$1, {
|
5946 | htmlFor: id
|
5947 | }, label)));
|
5948 | };
|
5949 |
|
5950 | return Radio;
|
5951 | }(Component);
|
5952 |
|
5953 | var RadioWrapper = styled.div(_templateObject$E(), function (_ref) {
|
5954 | var labelPosition = _ref.labelPosition;
|
5955 | return labelPosition === 'right' ? 'row' : 'row-reverse';
|
5956 | });
|
5957 | var RadioContainer = styled.label(_templateObject2$d(), function (_ref2) {
|
5958 | var disabled = _ref2.disabled;
|
5959 | return disabled ? 'default' : 'pointer';
|
5960 | }, function (_ref3) {
|
5961 | var width = _ref3.width;
|
5962 | return width;
|
5963 | }, function (_ref4) {
|
5964 | var height = _ref4.height;
|
5965 | return height;
|
5966 | }, function (_ref5) {
|
5967 | var height = _ref5.height;
|
5968 | return height;
|
5969 | }, function (_ref6) {
|
5970 | var background = _ref6.background;
|
5971 | return background ? "" + background : 'white';
|
5972 | });
|
5973 | var HiddenRadio = styled.input.attrs({
|
5974 | type: 'checkbox'
|
5975 | })(_templateObject3$9());
|
5976 | var LabelWrapper$1 = styled.div(_templateObject4$6(), function (_ref7) {
|
5977 | var height = _ref7.height;
|
5978 | return height + "px";
|
5979 | }, function (_ref8) {
|
5980 | var height = _ref8.height;
|
5981 | return height + "px";
|
5982 | }, function (_ref9) {
|
5983 | var labelPosition = _ref9.labelPosition;
|
5984 | return labelPosition === 'right' ? '8px' : '0';
|
5985 | }, function (_ref10) {
|
5986 | var labelPosition = _ref10.labelPosition;
|
5987 | return labelPosition === 'left' ? '8px' : '0';
|
5988 | }, function (_ref11) {
|
5989 | var disabled = _ref11.disabled;
|
5990 | return disabled ? '0.5' : '1';
|
5991 | });
|
5992 | RadioWrapper.displayName = 'RadioWrapper';
|
5993 | RadioContainer.displayName = 'RadioContainer';
|
5994 | HiddenRadio.displayName = 'HiddenRadio';
|
5995 | LabelWrapper$1.displayName = 'LabelWrapper';
|
5996 | Radio.defaultProps = {
|
5997 | id: '',
|
5998 | height: 14,
|
5999 | width: 14,
|
6000 | label: null,
|
6001 | labelPosition: 'left',
|
6002 | disabled: false,
|
6003 | color: undefined,
|
6004 | background: undefined
|
6005 | };
|
6006 | Radio.propTypes = {
|
6007 |
|
6008 | id: PropTypes.string,
|
6009 |
|
6010 |
|
6011 | height: PropTypes.number,
|
6012 |
|
6013 |
|
6014 | width: PropTypes.number,
|
6015 |
|
6016 |
|
6017 | checked: PropTypes.bool.isRequired,
|
6018 |
|
6019 |
|
6020 | color: PropTypes.string,
|
6021 |
|
6022 |
|
6023 | background: PropTypes.string,
|
6024 |
|
6025 |
|
6026 | label: PropTypes.string,
|
6027 |
|
6028 |
|
6029 | labelPosition: PropTypes.oneOf(['left', 'right']),
|
6030 |
|
6031 |
|
6032 | onChange: PropTypes.func.isRequired,
|
6033 |
|
6034 |
|
6035 | disabled: PropTypes.bool
|
6036 | };
|
6037 |
|
6038 | function _templateObject$F() {
|
6039 | var data = taggedTemplateLiteralLoose(["\n\topacity: 1 !important;\n\n\t& input {\n\t\twidth: 40px !important;\n\t\tpadding: 1px 0 !important;\n\t\tborder: ", " !important;\n\t\tborder-color: ", " !important;\n\t\tbackground: transparent !important;\n\t\tcolor: ", " !important;\n\n\t\tfont-size: 18px;\n\t\ttext-align: center !important;\n\t\ttext-transform: uppercase;\n\n\t\t&:hover {\n\t\t\tborder-color: ", " !important;\n\t\t\tbackground: white !important;\n\t\t}\n\t\t&:focus {\n\t\t\tborder-color: ", " !important;\n\t\t\tbackground: white !important;\n\t\t}\n\t}\n"]);
|
6040 |
|
6041 | _templateObject$F = function _templateObject() {
|
6042 | return data;
|
6043 | };
|
6044 |
|
6045 | return data;
|
6046 | }
|
6047 | var TagContainer = styled(function (_ref) {
|
6048 | var noBorder = _ref.noBorder,
|
6049 | props = objectWithoutPropertiesLoose(_ref, ["noBorder"]);
|
6050 |
|
6051 | return React.createElement(Input, props);
|
6052 | })(_templateObject$F(), function (_ref2) {
|
6053 | var noBorder = _ref2.noBorder;
|
6054 | return noBorder ? 0 : 'auto';
|
6055 | }, function (_ref3) {
|
6056 | var theme = _ref3.theme,
|
6057 | error = _ref3.error;
|
6058 | return error ? theme.colors.red : 'transparent';
|
6059 | }, function (_ref4) {
|
6060 | var color = _ref4.color;
|
6061 | return color;
|
6062 | }, function (_ref5) {
|
6063 | var theme = _ref5.theme,
|
6064 | error = _ref5.error;
|
6065 | return error ? theme.colors.red : theme.colors.activeBlue;
|
6066 | }, function (_ref6) {
|
6067 | var theme = _ref6.theme;
|
6068 | return theme.colors.activeBlue;
|
6069 | });
|
6070 |
|
6071 | var Tag = function Tag(_ref7) {
|
6072 | var _onChange = _ref7.onChange,
|
6073 | props = objectWithoutPropertiesLoose(_ref7, ["onChange"]);
|
6074 |
|
6075 | return React.createElement(TagContainer, _extends_1({
|
6076 | onChange: function onChange(event) {
|
6077 | var regex = /[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,\-.\/:;<=>?@\[\]^_`´{|}~]/;
|
6078 | event.target.value = event.target.value.replace(regex, '').toUpperCase();
|
6079 |
|
6080 | if (_onChange !== undefined) {
|
6081 | _onChange(event);
|
6082 | }
|
6083 | }
|
6084 | }, props));
|
6085 | };
|
6086 |
|
6087 | Tag.defaultProps = {
|
6088 | noBorder: false,
|
6089 | maxLength: 2,
|
6090 | onChange: undefined
|
6091 | };
|
6092 | Tag.propTypes = {
|
6093 |
|
6094 | color: PropTypes.string.isRequired,
|
6095 |
|
6096 |
|
6097 | maxLength: PropTypes.number,
|
6098 |
|
6099 |
|
6100 | onChange: PropTypes.func,
|
6101 |
|
6102 |
|
6103 | noBorder: PropTypes.bool
|
6104 | };
|
6105 | Tag.displayName = 'Tag';
|
6106 | TagContainer.displayName = 'TagContainer';
|
6107 |
|
6108 | function _templateObject2$e() {
|
6109 | var data = taggedTemplateLiteralLoose(["\n\twidth: 100% !important;\n\tborder-spacing: 0;\n\ttable-layout: fixed;\n\tmargin: 0;\n\tpadding: 0;\n\n\t.first-column {\n\t\twidth: 40px;\n\t\theight: 34px;\n\t\tmargin: 0;\n\t\tpadding: 0;\n\t\tvertical-align: middle;\n\t\tborder: ", ";\n\t\tborder-top-left-radius: 4px !important;\n\t\tborder-bottom-left-radius: 4px !important;\n\t\tborder-right: 0;\n\t\tbox-sizing: border-box;\n\t}\n\n\t.first-column:focus-within {\n\t\tborder-width: 1px 0 1px 1px;\n\t\tborder-style: solid;\n\t\tborder-color: ", ";\n\t}\n\n\t.first-column:focus-within + .second-column {\n\t\tborder-left: ", ";\n\t}\n\n\t.first-column:focus-within + .second-column.errorBlock {\n\t\tborder-left: ", ";\n\t}\n\n\t.first-column.errorBlock:focus-within + .second-column.errorBlock {\n\t\tborder-left: 0 !important;\n\t}\n\n\t.second-column {\n\t\twidth: 40px;\n\t\tmax-width: 34px;\n\t\tmax-height: 34px;\n\t\tvertical-align: middle;\n\t\tborder: ", ";\n\t\tborder-right: 0;\n\t\tbox-sizing: border-box;\n\t}\n\n\t.second-column:focus-within {\n\t\tborder-top: ", ";\n\t\tborder-bottom: ", ";\n\t\tborder-left: ", ";\n\t}\n\n\t.second-column:focus-within + .third-column {\n\t\tborder-left: ", ";\n\t}\n\n\t.second-column:focus-within + .third-column.errorBlock {\n\t\tborder-left: ", ";\n\t}\n\n\t.second-column.errorBlock:focus-within + .third-column.errorBlock {\n\t\tborder-left: 0 !important;\n\t}\n\n\t.third-column {\n\t\tmax-height: 34px;\n\t\tvertical-align: middle;\n\t\tborder: ", ";\n\t\tbox-sizing: border-box;\n\t\tborder-top-right-radius: 4px !important;\n\t\tborder-bottom-right-radius: 4px !important;\n\t}\n\n\t.third-column:focus-within {\n\t\tborder: ", ";\n\t}\n\n\t.first-column.errorBlock {\n\t\tborder: ", ";\n\t}\n\n\t.first-column.errorBlock + .second-column {\n\t\tborder-left: 0;\n\t}\n\n\t.second-column.errorBlock {\n\t\tborder: ", ";\n\t}\n\n\t.second-column.errorBlock + .first-column {\n\t\tborder-right: 0;\n\t}\n\n\t.second-column.errorBlock + .third-column {\n\t\tborder-left: 0;\n\t}\n\n\t.third-column.errorBlock {\n\t\tborder: ", ";\n\t}\n"]);
|
6110 |
|
6111 | _templateObject2$e = function _templateObject2() {
|
6112 | return data;
|
6113 | };
|
6114 |
|
6115 | return data;
|
6116 | }
|
6117 |
|
6118 | function _templateObject$G() {
|
6119 | var data = taggedTemplateLiteralLoose(["\n\tmargin-top: 11px;\n\tmargin-bottom: 28px;\n"]);
|
6120 |
|
6121 | _templateObject$G = function _templateObject() {
|
6122 | return data;
|
6123 | };
|
6124 |
|
6125 | return data;
|
6126 | }
|
6127 |
|
6128 | var InputGroup = function InputGroup(_ref) {
|
6129 | var id = _ref.id,
|
6130 | children = _ref.children,
|
6131 | disabled = _ref.disabled,
|
6132 | label = _ref.label,
|
6133 | hint = _ref.hint,
|
6134 | errors = _ref.errors,
|
6135 | props = objectWithoutPropertiesLoose(_ref, ["id", "children", "disabled", "label", "hint", "errors"]);
|
6136 |
|
6137 | var getClassName = function getClassName(currentIndex) {
|
6138 | return ['first-column', 'second-column', 'third-column'][currentIndex];
|
6139 | };
|
6140 |
|
6141 | var getInputName = function getInputName(currentIndex) {
|
6142 | return ['colour', 'tag', 'name'][currentIndex];
|
6143 | };
|
6144 |
|
6145 | var errorsToArray = errors ? Object.keys(errors).reduce(function (acc, element) {
|
6146 | if (element && Array.isArray(errors[element])) {
|
6147 | errors[element].map(function (errorItem) {
|
6148 | return acc.indexOf(errorItem) === -1 && acc.push(errorItem);
|
6149 | });
|
6150 | } else if (element && errors[element] && acc.indexOf(errors[element]) === -1) {
|
6151 | acc.push(errors[element]);
|
6152 | }
|
6153 |
|
6154 | return acc;
|
6155 | }, []) : undefined;
|
6156 | return React.createElement(React.Fragment, null, label && React.createElement(Label$1, {
|
6157 | htmlFor: id,
|
6158 | disabled: disabled
|
6159 | }, label), React.createElement(InputGroupContainer, null, React.createElement(InputGroupTable, props, React.createElement("tbody", null, React.createElement("tr", null, children.map(function (element, index) {
|
6160 | return React.createElement("td", {
|
6161 | key: element.props.id,
|
6162 | className: getClassName(index) + " " + (errors && (Array.isArray(errors[getInputName(index)]) && errors[getInputName(index)].length > 0 || errors[getInputName(index)]) && 'errorBlock')
|
6163 | }, element);
|
6164 | })))), !errorsToArray && hint && React.createElement(BottomLabel, {
|
6165 | "data-test-id": "hint",
|
6166 | disabled: disabled
|
6167 | }, hint), errorsToArray && errorsToArray.map(function (element) {
|
6168 | return React.createElement(Error$1, {
|
6169 | key: element
|
6170 | }, element);
|
6171 | })));
|
6172 | };
|
6173 |
|
6174 | var InputGroupContainer = styled.div(_templateObject$G());
|
6175 | var InputGroupTable = styled.table(_templateObject2$e(), function (_ref2) {
|
6176 | var theme = _ref2.theme;
|
6177 | return "1px solid " + theme.colors.strokeGray;
|
6178 | }, function (_ref3) {
|
6179 | var theme = _ref3.theme;
|
6180 | return theme.colors.activeBlue;
|
6181 | }, function (_ref4) {
|
6182 | var theme = _ref4.theme;
|
6183 | return "1px solid " + theme.colors.activeBlue;
|
6184 | }, function (_ref5) {
|
6185 | var theme = _ref5.theme;
|
6186 | return "1px solid " + theme.colors.red + " !important";
|
6187 | }, function (_ref6) {
|
6188 | var theme = _ref6.theme;
|
6189 | return "1px solid " + theme.colors.strokeGray;
|
6190 | }, function (_ref7) {
|
6191 | var theme = _ref7.theme;
|
6192 | return "1px solid " + theme.colors.activeBlue;
|
6193 | }, function (_ref8) {
|
6194 | var theme = _ref8.theme;
|
6195 | return "1px solid " + theme.colors.activeBlue;
|
6196 | }, function (_ref9) {
|
6197 | var theme = _ref9.theme;
|
6198 | return "1px solid " + theme.colors.activeBlue;
|
6199 | }, function (_ref10) {
|
6200 | var theme = _ref10.theme;
|
6201 | return "1px solid " + theme.colors.activeBlue;
|
6202 | }, function (_ref11) {
|
6203 | var theme = _ref11.theme;
|
6204 | return "1px solid " + theme.colors.red;
|
6205 | }, function (_ref12) {
|
6206 | var theme = _ref12.theme;
|
6207 | return "1px solid " + theme.colors.strokeGray;
|
6208 | }, function (_ref13) {
|
6209 | var theme = _ref13.theme;
|
6210 | return "1px solid " + theme.colors.activeBlue;
|
6211 | }, function (_ref14) {
|
6212 | var theme = _ref14.theme;
|
6213 | return "1px solid " + theme.colors.red;
|
6214 | }, function (_ref15) {
|
6215 | var theme = _ref15.theme;
|
6216 | return "1px solid " + theme.colors.red;
|
6217 | }, function (_ref16) {
|
6218 | var theme = _ref16.theme;
|
6219 | return "1px solid " + theme.colors.red;
|
6220 | });
|
6221 | InputGroup.defaultProps = {
|
6222 | id: '',
|
6223 | disabled: false,
|
6224 | hint: '',
|
6225 | label: undefined,
|
6226 | errors: undefined
|
6227 | };
|
6228 | InputGroup.displayName = 'InputGroup';
|
6229 | InputGroup.propTypes = {
|
6230 |
|
6231 | id: PropTypes.string,
|
6232 |
|
6233 |
|
6234 | children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
|
6235 |
|
6236 |
|
6237 | disabled: PropTypes.bool,
|
6238 |
|
6239 |
|
6240 | hint: PropTypes.string,
|
6241 |
|
6242 |
|
6243 | label: PropTypes.string,
|
6244 |
|
6245 |
|
6246 | errors: PropTypes.shape({
|
6247 | tag: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
|
6248 | name: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
|
6249 | colour: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)])
|
6250 | })
|
6251 | };
|
6252 |
|
6253 | function _templateObject4$7() {
|
6254 | var data = taggedTemplateLiteralLoose(["\n\tposition: relative;\n\twidth: 100%;\n\tmargin-top: 8px;\n\tbackground-color: ", ";\n"]);
|
6255 |
|
6256 | _templateObject4$7 = function _templateObject4() {
|
6257 | return data;
|
6258 | };
|
6259 |
|
6260 | return data;
|
6261 | }
|
6262 |
|
6263 | function _templateObject3$a() {
|
6264 | var data = taggedTemplateLiteralLoose(["\n\tposition: absolute;\n\ttop: 0;\n\tleft: 0;\n\twidth: ", ";\n\tmax-width: 100%;\n\theight: 3px;\n\tbackground-color: ", ";\n\ttransition: 0.75s;\n"]);
|
6265 |
|
6266 | _templateObject3$a = function _templateObject3() {
|
6267 | return data;
|
6268 | };
|
6269 |
|
6270 | return data;
|
6271 | }
|
6272 |
|
6273 | function _templateObject2$f() {
|
6274 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tflex-direction: row;\n\talign-items: start;\n\tjustify-content: space-between;\n\tbackground-color: white;\n\tmix-blend-mode: hard-light;\n"]);
|
6275 |
|
6276 | _templateObject2$f = function _templateObject2() {
|
6277 | return data;
|
6278 | };
|
6279 |
|
6280 | return data;
|
6281 | }
|
6282 |
|
6283 | function _templateObject$H() {
|
6284 | var data = taggedTemplateLiteralLoose(["\n\twidth: 23.7%;\n\theight: 3px;\n\tbackground-color: gray;\n"]);
|
6285 |
|
6286 | _templateObject$H = function _templateObject() {
|
6287 | return data;
|
6288 | };
|
6289 |
|
6290 | return data;
|
6291 | }
|
6292 |
|
6293 | var PasswordStrengthMeter =
|
6294 |
|
6295 | function (_Component) {
|
6296 | inheritsLoose(PasswordStrengthMeter, _Component);
|
6297 |
|
6298 | function PasswordStrengthMeter() {
|
6299 | var _this;
|
6300 |
|
6301 | for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
6302 | args[_key] = arguments[_key];
|
6303 | }
|
6304 |
|
6305 | _this = _Component.call.apply(_Component, [this].concat(args)) || this;
|
6306 |
|
6307 | defineProperty(assertThisInitialized(_this), "getColor", function () {
|
6308 | var passwordStrengthMeter = theme.passwordStrengthMeter;
|
6309 | var score = _this.props.score;
|
6310 | var colorArray = [passwordStrengthMeter.none, passwordStrengthMeter.bad, passwordStrengthMeter.medium, passwordStrengthMeter.good, passwordStrengthMeter.excellent];
|
6311 | return colorArray[score];
|
6312 | });
|
6313 |
|
6314 | return _this;
|
6315 | }
|
6316 |
|
6317 | var _proto = PasswordStrengthMeter.prototype;
|
6318 |
|
6319 | _proto.render = function render() {
|
6320 | var _this$props = this.props,
|
6321 | score = _this$props.score,
|
6322 | props = objectWithoutPropertiesLoose(_this$props, ["score"]);
|
6323 |
|
6324 | return React.createElement(PasswordStrengthStyled, props, React.createElement(ProgressBar, {
|
6325 | backgroundColor: this.getColor,
|
6326 | score: score
|
6327 | }), React.createElement(BoxContainer, null, React.createElement(Box, null), React.createElement(Box, null), React.createElement(Box, null), React.createElement(Box, null)));
|
6328 | };
|
6329 |
|
6330 | return PasswordStrengthMeter;
|
6331 | }(Component);
|
6332 |
|
6333 | var Box = styled.div(_templateObject$H());
|
6334 | var BoxContainer = styled.div(_templateObject2$f());
|
6335 | var ProgressBar = styled.div(_templateObject3$a(), function (_ref) {
|
6336 | var score = _ref.score;
|
6337 | return score * 25 + "%";
|
6338 | }, function (_ref2) {
|
6339 | var backgroundColor = _ref2.backgroundColor;
|
6340 | return backgroundColor;
|
6341 | });
|
6342 | var PasswordStrengthStyled = styled.div(_templateObject4$7(), function (_ref3) {
|
6343 | var theme$$1 = _ref3.theme;
|
6344 | return theme$$1.passwordStrengthMeter.none;
|
6345 | });
|
6346 | PasswordStrengthMeter.propTypes = {
|
6347 |
|
6348 | score: PropTypes.number.isRequired
|
6349 | };
|
6350 | PasswordStrengthMeter.displayName = 'PasswordStrength';
|
6351 | Box.displayName = 'Box';
|
6352 | BoxContainer.displayName = 'BoxContainer';
|
6353 | ProgressBar.displayName = 'ProgressBar';
|
6354 | PasswordStrengthStyled.displayName = 'PasswordStrengthStyled';
|
6355 |
|
6356 | function _templateObject$I() {
|
6357 | var data = taggedTemplateLiteralLoose(["\n\tcursor: pointer !important;\n\tpointer-events: all !important;\n\t&&& {\n\t\tcolor: ", " !important;\n\t}\n"]);
|
6358 |
|
6359 | _templateObject$I = function _templateObject() {
|
6360 | return data;
|
6361 | };
|
6362 |
|
6363 | return data;
|
6364 | }
|
6365 |
|
6366 | var InputPassword =
|
6367 |
|
6368 | function (_Component) {
|
6369 | inheritsLoose(InputPassword, _Component);
|
6370 |
|
6371 | function InputPassword(props) {
|
6372 | var _this;
|
6373 |
|
6374 | _this = _Component.call(this, props) || this;
|
6375 |
|
6376 | defineProperty(assertThisInitialized(_this), "setType", function (type) {
|
6377 | _this.setState({
|
6378 | type: type
|
6379 | });
|
6380 | });
|
6381 |
|
6382 | defineProperty(assertThisInitialized(_this), "iconInputElement", function () {
|
6383 | var type = _this.state.type;
|
6384 | return React.createElement(IconInput, {
|
6385 | icon: type === 'password' ? 'preview' : 'eye-closed',
|
6386 | onClick: function onClick() {
|
6387 | return _this.setType(type === 'password' ? 'text' : 'password');
|
6388 | }
|
6389 | });
|
6390 | });
|
6391 |
|
6392 | _this.state = {
|
6393 | type: 'password'
|
6394 | };
|
6395 | return _this;
|
6396 | }
|
6397 |
|
6398 | var _proto = InputPassword.prototype;
|
6399 |
|
6400 | _proto.render = function render() {
|
6401 | var type = this.state.type;
|
6402 |
|
6403 | var _this$props = this.props,
|
6404 | score = _this$props.score,
|
6405 | meter = _this$props.meter,
|
6406 | props = objectWithoutPropertiesLoose(_this$props, ["score", "meter"]);
|
6407 |
|
6408 | return React.createElement(React.Fragment, null, React.createElement(Input$1, _extends_1({
|
6409 | type: type,
|
6410 | icon: this.iconInputElement
|
6411 | }, props)), meter && React.createElement(PasswordStrengthMeter, {
|
6412 | score: score
|
6413 | }));
|
6414 | };
|
6415 |
|
6416 | return InputPassword;
|
6417 | }(Component);
|
6418 |
|
6419 | var IconInput = styled(Icon$1)(_templateObject$I(), function (_ref) {
|
6420 | var theme = _ref.theme;
|
6421 | return theme.colors.activeBlue;
|
6422 | });
|
6423 |
|
6424 | var scoreValidation = function scoreValidation(props, propName, componentName) {
|
6425 | if (props.meter && (props[propName] === null || props[propName] === undefined)) {
|
6426 | return new Error("Failed prop type: '" + propName + "' is set to required when 'meter' is true, in " + componentName + ".");
|
6427 | }
|
6428 | };
|
6429 |
|
6430 | InputPassword.propTypes = {
|
6431 |
|
6432 | meter: PropTypes.bool,
|
6433 |
|
6434 |
|
6435 | score: scoreValidation
|
6436 | };
|
6437 | InputPassword.defaultProps = {
|
6438 | meter: false
|
6439 | };
|
6440 | IconInput.displayName = 'IconInput';
|
6441 | InputPassword.displayName = 'InputPassword';
|
6442 |
|
6443 | function _templateObject$J() {
|
6444 | var data = taggedTemplateLiteralLoose(["\n\twidth: 100%;\n\theight: 8px;\n\tpadding: 0;\n\tmargin: 14px 0;\n\tappearance: none;\n\tbackground: ", ";\n\tborder-radius: 8px;\n\tcursor: pointer;\n\toutline: none;\n\tbox-shadow: none;\n\ttransition: background 450ms ease-in;\n\t::-webkit-slider-thumb {\n\t\twidth: 30px;\n\t\theight: 30px;\n\t\tborder: 1px solid ", ";\n\t\tappearance: none;\n\t\tbackground: ", ";\n\t\tborder-radius: 50%;\n\t}\n\t::-moz-range-thumb {\n\t\twidth: 30px;\n\t\theight: 30px;\n\t\tborder: 1px solid ", ";\n\t\tappearance: none;\n\t\tbackground: ", ";\n\t\tborder-radius: 50%;\n\t\toutline: 0;\n\t}\n\t::-moz-focus-outer {\n\t\tborder: 0;\n\t}\n"]);
|
6445 |
|
6446 | _templateObject$J = function _templateObject() {
|
6447 | return data;
|
6448 | };
|
6449 |
|
6450 | return data;
|
6451 | }
|
6452 |
|
6453 | var InputRange = function InputRange(_ref) {
|
6454 | var min = _ref.min,
|
6455 | step = _ref.step,
|
6456 | max = _ref.max,
|
6457 | value = _ref.value,
|
6458 | _onChange = _ref.onChange,
|
6459 | onUpdate = _ref.onUpdate,
|
6460 | props = objectWithoutPropertiesLoose(_ref, ["min", "step", "max", "value", "onChange", "onUpdate"]);
|
6461 |
|
6462 | return React.createElement(InputRangeStyled, _extends_1({
|
6463 | type: "range",
|
6464 | min: 0,
|
6465 | step: step / (max - min) * 100,
|
6466 | max: 100,
|
6467 | value: (value - min) * 100 / (max - min),
|
6468 | onChange: function onChange(e) {
|
6469 | return _onChange(e.target.value / 100 * (max - min) + min);
|
6470 | },
|
6471 | onMouseUp: function onMouseUp(e) {
|
6472 | return onUpdate(e.target.value / 100 * (max - min) + min);
|
6473 | }
|
6474 | }, props));
|
6475 | };
|
6476 |
|
6477 | var InputRangeStyled = styled.input(_templateObject$J(), function (_ref2) {
|
6478 | var value = _ref2.value,
|
6479 | theme = _ref2.theme;
|
6480 | return theme.inputRange.gradient(value);
|
6481 | }, function (_ref3) {
|
6482 | var theme = _ref3.theme;
|
6483 | return theme.inputRange.borderColor;
|
6484 | }, function (_ref4) {
|
6485 | var theme = _ref4.theme;
|
6486 | return theme.inputRange.backgroundThumbColor;
|
6487 | }, function (_ref5) {
|
6488 | var theme = _ref5.theme;
|
6489 | return theme.inputRange.borderColor;
|
6490 | }, function (_ref6) {
|
6491 | var theme = _ref6.theme;
|
6492 | return theme.inputRange.backgroundThumbColor;
|
6493 | });
|
6494 | InputRange.defaultProps = {
|
6495 | min: 0,
|
6496 | step: 1,
|
6497 | max: 100
|
6498 | };
|
6499 | InputRange.propTypes = {
|
6500 |
|
6501 |
|
6502 | min: function min(props, propName, componentName) {
|
6503 | var min = props.min,
|
6504 | max = props.max;
|
6505 |
|
6506 | if (typeof min === 'number' && min > max) {
|
6507 | return new Error("Invalid prop " + propName + " supplied to " + componentName + ". Validation failed. Please provide a minimum number lower than " + max + ".");
|
6508 | }
|
6509 |
|
6510 | if (typeof min !== 'number' && typeof min !== 'undefined') {
|
6511 | return new Error("Invalid prop " + propName + " supplied to " + componentName + ". Validation failed. Please provide a number.");
|
6512 | }
|
6513 | },
|
6514 |
|
6515 |
|
6516 |
|
6517 | step: function step(props, propName, componentName) {
|
6518 | var step = props.step,
|
6519 | min = props.min,
|
6520 | max = props.max;
|
6521 |
|
6522 | if (typeof step === 'number' && (step > max || step < min)) {
|
6523 | return new Error("Invalid prop " + propName + " supplied to " + componentName + ". Validation failed. Please provide a step number between " + min + " and " + max);
|
6524 | }
|
6525 |
|
6526 | if (typeof step !== 'number' && typeof step !== 'undefined') {
|
6527 | return new Error("Invalid prop " + propName + " supplied to " + componentName + ". Validation failed. Please provide a number.");
|
6528 | }
|
6529 | },
|
6530 |
|
6531 |
|
6532 | max: PropTypes.number,
|
6533 |
|
6534 |
|
6535 |
|
6536 | value: function value(props, propName, componentName) {
|
6537 | var min = props.min,
|
6538 | max = props.max,
|
6539 | value = props.value;
|
6540 |
|
6541 | if (typeof value === 'number' && (value < min || value > max)) {
|
6542 | return new Error("Invalid prop " + propName + " supplied to " + componentName + ". Validation failed. Please provide a value number between " + min + " and " + max + ".");
|
6543 | }
|
6544 |
|
6545 | if (typeof value !== 'number') {
|
6546 | return new Error("Invalid prop " + propName + " supplied to " + componentName + ". Validation failed. Please provide a number.");
|
6547 | }
|
6548 | },
|
6549 |
|
6550 |
|
6551 | onChange: PropTypes.func.isRequired,
|
6552 |
|
6553 |
|
6554 | onUpdate: PropTypes.func.isRequired
|
6555 | };
|
6556 | InputRange.displayName = 'InputRange';
|
6557 |
|
6558 | function _templateObject4$8() {
|
6559 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: inline-flex;\n\talign-items: center;\n"]);
|
6560 |
|
6561 | _templateObject4$8 = function _templateObject4() {
|
6562 | return data;
|
6563 | };
|
6564 |
|
6565 | return data;
|
6566 | }
|
6567 |
|
6568 | function _templateObject3$b() {
|
6569 | var data = taggedTemplateLiteralLoose(["\n\tmargin-top: 4px !important;\n\tmargin-bottom: 0px !important;\n\ttransform: rotate(180deg);\n"]);
|
6570 |
|
6571 | _templateObject3$b = function _templateObject3() {
|
6572 | return data;
|
6573 | };
|
6574 |
|
6575 | return data;
|
6576 | }
|
6577 |
|
6578 | function _templateObject2$g() {
|
6579 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: block !important;\n\tmargin: 0 auto !important;\n\tmargin-bottom: 4px !important;\n\topacity: 1;\n\tcolor: ", " !important;\n\tpointer-events: ", ";\n\t:active {\n\t\tcolor: ", " !important;\n\t}\n"]);
|
6580 |
|
6581 | _templateObject2$g = function _templateObject2() {
|
6582 | return data;
|
6583 | };
|
6584 |
|
6585 | return data;
|
6586 | }
|
6587 |
|
6588 | function _templateObject$K() {
|
6589 | var data = taggedTemplateLiteralLoose(["\n\tinput {\n\t\tdisplay: block;\n\t\theight: 20px;\n\t\ttext-align: center !important;\n\t\tpadding: 0 !important;\n\t\tborder: 1px solid\n\t\t\t", " !important;\n\t\tbackground-color: transparent !important;\n\t\tbox-shadow: none !important;\n\t\tcolor: ", " !important;\n\t\tpointer-events: ", ";\n\t\ttransition: none !important;\n\t}\n\n\tinput:hover {\n\t\tbox-sizing: border-box !important;\n\t\tpadding: 0 !important;\n\t\tborder: ", " !important;\n\t\tborder-color: ", " !important;\n\t\tborder-radius: 4px !important;\n\t}\n\n\tinput:focus {\n\t\tbox-sizing: border-box !important;\n\t\tpadding: 0 !important;\n\t\tborder: ", " !important;\n\t\tborder-color: ", " !important;\n\t\tborder-radius: 4px !important;\n\t}\n"]);
|
6590 |
|
6591 | _templateObject$K = function _templateObject() {
|
6592 | return data;
|
6593 | };
|
6594 |
|
6595 | return data;
|
6596 | }
|
6597 |
|
6598 | var NumberSpinner =
|
6599 |
|
6600 | function (_Component) {
|
6601 | inheritsLoose(NumberSpinner, _Component);
|
6602 |
|
6603 | function NumberSpinner() {
|
6604 | var _this;
|
6605 |
|
6606 | for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
6607 | args[_key] = arguments[_key];
|
6608 | }
|
6609 |
|
6610 | _this = _Component.call.apply(_Component, [this].concat(args)) || this;
|
6611 |
|
6612 | defineProperty(assertThisInitialized(_this), "getValue", function (event) {
|
6613 | var _this$props = _this.props,
|
6614 | max = _this$props.max,
|
6615 | min = _this$props.min;
|
6616 | var numValue = Number(event.target.value.replace(/\D/, ''));
|
6617 | return numValue > max ? max : numValue < min ? min : numValue;
|
6618 | });
|
6619 |
|
6620 | defineProperty(assertThisInitialized(_this), "stepLimiter", function (newValue) {
|
6621 | var _this$props2 = _this.props,
|
6622 | max = _this$props2.max,
|
6623 | min = _this$props2.min;
|
6624 | var numValue = Number(newValue);
|
6625 | return numValue > max ? min : numValue < min ? max : numValue;
|
6626 | });
|
6627 |
|
6628 | defineProperty(assertThisInitialized(_this), "setValueByStep", function (event, newValue) {
|
6629 | var _this$props3 = _this.props,
|
6630 | disabled = _this$props3.disabled,
|
6631 | onChange = _this$props3.onChange;
|
6632 | !disabled && onChange(event, _this.stepLimiter(newValue));
|
6633 | });
|
6634 |
|
6635 | defineProperty(assertThisInitialized(_this), "setValueWheel", function (e) {
|
6636 | var _this$props4 = _this.props,
|
6637 | scrollInput = _this$props4.scrollInput,
|
6638 | value = _this$props4.value;
|
6639 |
|
6640 | if (scrollInput) {
|
6641 | e.stopPropagation();
|
6642 |
|
6643 | _this.setValueByStep(e, Number(value) + (e.deltaY > 0 ? -1 : 1));
|
6644 | }
|
6645 | });
|
6646 |
|
6647 | return _this;
|
6648 | }
|
6649 |
|
6650 | var _proto = NumberSpinner.prototype;
|
6651 |
|
6652 | _proto.render = function render() {
|
6653 | var _this2 = this;
|
6654 |
|
6655 | var _this$props5 = this.props,
|
6656 | _onChange = _this$props5.onChange,
|
6657 | name = _this$props5.name,
|
6658 | min = _this$props5.min,
|
6659 | max = _this$props5.max,
|
6660 | value = _this$props5.value,
|
6661 | disabled = _this$props5.disabled,
|
6662 | readOnly = _this$props5.readOnly,
|
6663 | error = _this$props5.error,
|
6664 | scrollInput = _this$props5.scrollInput,
|
6665 | props = objectWithoutPropertiesLoose(_this$props5, ["onChange", "name", "min", "max", "value", "disabled", "readOnly", "error", "scrollInput"]);
|
6666 |
|
6667 | var size = String(max).length;
|
6668 | return React.createElement(Container, null, React.createElement("div", null, React.createElement(IconUp, {
|
6669 | disabled: disabled,
|
6670 | icon: "select-up",
|
6671 | onClick: function onClick(e) {
|
6672 | return _this2.setValueByStep(e, Number(value) + 1);
|
6673 | }
|
6674 | }), React.createElement(Input$2, _extends_1({
|
6675 | readOnly: readOnly,
|
6676 | name: name,
|
6677 | error: error,
|
6678 | disabled: disabled,
|
6679 | min: min,
|
6680 | value: value,
|
6681 | max: max,
|
6682 | input: React.createElement("input", {
|
6683 | size: size,
|
6684 | maxLength: size + 1
|
6685 | }),
|
6686 | onWheel: this.setValueWheel,
|
6687 | onChange: function onChange(e) {
|
6688 | return _onChange(e, _this2.getValue(e));
|
6689 | }
|
6690 | }, props)), React.createElement(IconDown, {
|
6691 | disabled: disabled,
|
6692 | icon: "select-up",
|
6693 | onClick: function onClick(e) {
|
6694 | return _this2.setValueByStep(e, Number(value) - 1);
|
6695 | }
|
6696 | })));
|
6697 | };
|
6698 |
|
6699 | return NumberSpinner;
|
6700 | }(Component);
|
6701 |
|
6702 | NumberSpinner.defaultProps = {
|
6703 | min: 0,
|
6704 | max: 10,
|
6705 | value: 0,
|
6706 | disabled: false,
|
6707 | readOnly: false,
|
6708 | error: false,
|
6709 | scrollInput: false
|
6710 | };
|
6711 |
|
6712 | var minPropValidation = function minPropValidation(props, propName, componentName) {
|
6713 | var min = props.min,
|
6714 | max = props.max;
|
6715 |
|
6716 | if (typeof min === 'number' && min > max) {
|
6717 | return new Error("Invalid prop " + propName + " supplied to " + componentName + ". Validation failed. Please provide a minimum number lower than " + max + ".");
|
6718 | }
|
6719 |
|
6720 | if (typeof min !== 'number' && typeof min !== 'undefined') {
|
6721 | return new Error("Invalid prop " + propName + " supplied to " + componentName + ". Validation failed. Please provide a number.");
|
6722 | }
|
6723 | };
|
6724 |
|
6725 | var valuePropValidation = function valuePropValidation(props, propName, componentName) {
|
6726 | var min = props.min,
|
6727 | max = props.max,
|
6728 | value = props.value;
|
6729 |
|
6730 | if (typeof value === 'number' && (value < min || value > max)) {
|
6731 | return new Error("Invalid prop " + propName + " supplied to " + componentName + ". Validation failed. Please provide a value number between " + min + " and " + max + ".");
|
6732 | }
|
6733 |
|
6734 | if (typeof value === 'string' && (Number(value) < min || Number(value) > max)) {
|
6735 | return new Error("Invalid prop " + propName + " supplied to " + componentName + ". Validation failed. Please provide a value number inside the string between " + min + " and " + max + ".");
|
6736 | }
|
6737 |
|
6738 | if (typeof value !== 'number' && typeof value !== 'string') {
|
6739 | return new Error("Invalid prop " + propName + " supplied to " + componentName + ". Validation failed. Please provide a number.");
|
6740 | }
|
6741 | };
|
6742 |
|
6743 | NumberSpinner.propTypes = {
|
6744 |
|
6745 | onChange: PropTypes.func.isRequired,
|
6746 |
|
6747 |
|
6748 | name: PropTypes.string.isRequired,
|
6749 |
|
6750 |
|
6751 | scrollInput: PropTypes.bool,
|
6752 |
|
6753 |
|
6754 | min: minPropValidation,
|
6755 |
|
6756 |
|
6757 | max: PropTypes.number,
|
6758 |
|
6759 |
|
6760 | value: valuePropValidation,
|
6761 |
|
6762 |
|
6763 | disabled: PropTypes.bool,
|
6764 |
|
6765 |
|
6766 | readOnly: PropTypes.bool,
|
6767 |
|
6768 |
|
6769 | error: PropTypes.bool
|
6770 | };
|
6771 | var Input$2 = styled(function (_ref) {
|
6772 | var size = _ref.size,
|
6773 | maxLength = _ref.maxLength,
|
6774 | props = objectWithoutPropertiesLoose(_ref, ["size", "maxLength"]);
|
6775 |
|
6776 | return React.createElement(Input, props);
|
6777 | })(_templateObject$K(), function (_ref2) {
|
6778 | var error = _ref2.error,
|
6779 | disabled = _ref2.disabled,
|
6780 | theme = _ref2.theme;
|
6781 | return error && !disabled ? theme.numberSpinner.errorColor : theme.numberSpinner.borderColor;
|
6782 | }, function (_ref3) {
|
6783 | var disabled = _ref3.disabled,
|
6784 | theme = _ref3.theme;
|
6785 | return disabled ? theme.numberSpinner.disabledColorText : theme.numberSpinner.textColor;
|
6786 | }, function (_ref4) {
|
6787 | var disabled = _ref4.disabled,
|
6788 | readOnly = _ref4.readOnly;
|
6789 | return disabled || readOnly ? 'none' : 'initial';
|
6790 | }, function (_ref5) {
|
6791 | var disabled = _ref5.disabled,
|
6792 | readOnly = _ref5.readOnly;
|
6793 | return disabled || readOnly ? 'none' : '1px solid';
|
6794 | }, function (_ref6) {
|
6795 | var disabled = _ref6.disabled,
|
6796 | error = _ref6.error,
|
6797 | theme = _ref6.theme;
|
6798 | return disabled && 'none' || error && theme.numberSpinner.errorColor || theme.numberSpinner.hoverColor;
|
6799 | }, function (_ref7) {
|
6800 | var disabled = _ref7.disabled,
|
6801 | readOnly = _ref7.readOnly;
|
6802 | return disabled || readOnly ? 'none' : '1px solid';
|
6803 | }, function (_ref8) {
|
6804 | var disabled = _ref8.disabled,
|
6805 | error = _ref8.error,
|
6806 | theme = _ref8.theme;
|
6807 | return disabled && 'none' || error && theme.numberSpinner.errorColor || theme.numberSpinner.primaryColor;
|
6808 | });
|
6809 | Input$2.displayName = 'Input';
|
6810 | var IconUp = styled(Icon$1)(_templateObject2$g(), function (_ref9) {
|
6811 | var disabled = _ref9.disabled,
|
6812 | theme = _ref9.theme;
|
6813 | return disabled ? theme.numberSpinner.disabledColor : theme.numberSpinner.primaryColor;
|
6814 | }, function (_ref10) {
|
6815 | var disabled = _ref10.disabled;
|
6816 | return disabled ? 'none' : 'initial';
|
6817 | }, function (_ref11) {
|
6818 | var disabled = _ref11.disabled,
|
6819 | theme = _ref11.theme;
|
6820 | return disabled ? theme.numberSpinner.disabledColor : theme.numberSpinner.activeColor;
|
6821 | });
|
6822 | IconUp.displayName = 'IconUp';
|
6823 | var IconDown = styled(IconUp)(_templateObject3$b());
|
6824 | IconDown.displayName = 'IconDown';
|
6825 | var Container = styled.div(_templateObject4$8());
|
6826 | Container.displayName = 'Container';
|
6827 |
|
6828 | function areInputsEqual(newInputs, lastInputs) {
|
6829 | if (newInputs.length !== lastInputs.length) {
|
6830 | return false;
|
6831 | }
|
6832 |
|
6833 | for (var i = 0; i < newInputs.length; i++) {
|
6834 | if (newInputs[i] !== lastInputs[i]) {
|
6835 | return false;
|
6836 | }
|
6837 | }
|
6838 |
|
6839 | return true;
|
6840 | }
|
6841 |
|
6842 | function index$2 (resultFn, isEqual) {
|
6843 | if (isEqual === void 0) {
|
6844 | isEqual = areInputsEqual;
|
6845 | }
|
6846 |
|
6847 | var lastThis;
|
6848 | var lastArgs = [];
|
6849 | var lastResult;
|
6850 | var calledOnce = false;
|
6851 |
|
6852 | var result = function result() {
|
6853 | for (var _len = arguments.length, newArgs = new Array(_len), _key = 0; _key < _len; _key++) {
|
6854 | newArgs[_key] = arguments[_key];
|
6855 | }
|
6856 |
|
6857 | if (calledOnce && lastThis === this && isEqual(newArgs, lastArgs)) {
|
6858 | return lastResult;
|
6859 | }
|
6860 |
|
6861 | lastResult = resultFn.apply(this, newArgs);
|
6862 | calledOnce = true;
|
6863 | lastThis = this;
|
6864 | lastArgs = newArgs;
|
6865 | return lastResult;
|
6866 | };
|
6867 |
|
6868 | return result;
|
6869 | }
|
6870 |
|
6871 | function memoize(fn) {
|
6872 | var cache = {};
|
6873 | return function (arg) {
|
6874 | if (cache[arg] === undefined) cache[arg] = fn(arg);
|
6875 | return cache[arg];
|
6876 | };
|
6877 | }
|
6878 |
|
6879 | var unitlessKeys = {
|
6880 | animationIterationCount: 1,
|
6881 | borderImageOutset: 1,
|
6882 | borderImageSlice: 1,
|
6883 | borderImageWidth: 1,
|
6884 | boxFlex: 1,
|
6885 | boxFlexGroup: 1,
|
6886 | boxOrdinalGroup: 1,
|
6887 | columnCount: 1,
|
6888 | columns: 1,
|
6889 | flex: 1,
|
6890 | flexGrow: 1,
|
6891 | flexPositive: 1,
|
6892 | flexShrink: 1,
|
6893 | flexNegative: 1,
|
6894 | flexOrder: 1,
|
6895 | gridRow: 1,
|
6896 | gridRowEnd: 1,
|
6897 | gridRowSpan: 1,
|
6898 | gridRowStart: 1,
|
6899 | gridColumn: 1,
|
6900 | gridColumnEnd: 1,
|
6901 | gridColumnSpan: 1,
|
6902 | gridColumnStart: 1,
|
6903 | fontWeight: 1,
|
6904 | lineHeight: 1,
|
6905 | opacity: 1,
|
6906 | order: 1,
|
6907 | orphans: 1,
|
6908 | tabSize: 1,
|
6909 | widows: 1,
|
6910 | zIndex: 1,
|
6911 | zoom: 1,
|
6912 | WebkitLineClamp: 1,
|
6913 |
|
6914 | fillOpacity: 1,
|
6915 | floodOpacity: 1,
|
6916 | stopOpacity: 1,
|
6917 | strokeDasharray: 1,
|
6918 | strokeDashoffset: 1,
|
6919 | strokeMiterlimit: 1,
|
6920 | strokeOpacity: 1,
|
6921 | strokeWidth: 1
|
6922 | };
|
6923 |
|
6924 |
|
6925 |
|
6926 | function murmurhash2_32_gc(str) {
|
6927 | var l = str.length,
|
6928 | h = l ^ l,
|
6929 | i = 0,
|
6930 | k;
|
6931 |
|
6932 | while (l >= 4) {
|
6933 | k = str.charCodeAt(i) & 0xff | (str.charCodeAt(++i) & 0xff) << 8 | (str.charCodeAt(++i) & 0xff) << 16 | (str.charCodeAt(++i) & 0xff) << 24;
|
6934 | k = (k & 0xffff) * 0x5bd1e995 + (((k >>> 16) * 0x5bd1e995 & 0xffff) << 16);
|
6935 | k ^= k >>> 24;
|
6936 | k = (k & 0xffff) * 0x5bd1e995 + (((k >>> 16) * 0x5bd1e995 & 0xffff) << 16);
|
6937 | h = (h & 0xffff) * 0x5bd1e995 + (((h >>> 16) * 0x5bd1e995 & 0xffff) << 16) ^ k;
|
6938 | l -= 4;
|
6939 | ++i;
|
6940 | }
|
6941 |
|
6942 | switch (l) {
|
6943 | case 3:
|
6944 | h ^= (str.charCodeAt(i + 2) & 0xff) << 16;
|
6945 |
|
6946 | case 2:
|
6947 | h ^= (str.charCodeAt(i + 1) & 0xff) << 8;
|
6948 |
|
6949 | case 1:
|
6950 | h ^= str.charCodeAt(i) & 0xff;
|
6951 | h = (h & 0xffff) * 0x5bd1e995 + (((h >>> 16) * 0x5bd1e995 & 0xffff) << 16);
|
6952 | }
|
6953 |
|
6954 | h ^= h >>> 13;
|
6955 | h = (h & 0xffff) * 0x5bd1e995 + (((h >>> 16) * 0x5bd1e995 & 0xffff) << 16);
|
6956 | h ^= h >>> 15;
|
6957 | return (h >>> 0).toString(36);
|
6958 | }
|
6959 |
|
6960 | function stylis_min (W) {
|
6961 | function M(d, c, e, h, a) {
|
6962 | for (var m = 0, b = 0, v = 0, n = 0, q, g, x = 0, K = 0, k, u = k = q = 0, l = 0, r = 0, I = 0, t = 0, B = e.length, J = B - 1, y, f = '', p = '', F = '', G = '', C; l < B;) {
|
6963 | g = e.charCodeAt(l);
|
6964 | l === J && 0 !== b + n + v + m && (0 !== b && (g = 47 === b ? 10 : 47), n = v = m = 0, B++, J++);
|
6965 |
|
6966 | if (0 === b + n + v + m) {
|
6967 | if (l === J && (0 < r && (f = f.replace(N, '')), 0 < f.trim().length)) {
|
6968 | switch (g) {
|
6969 | case 32:
|
6970 | case 9:
|
6971 | case 59:
|
6972 | case 13:
|
6973 | case 10:
|
6974 | break;
|
6975 |
|
6976 | default:
|
6977 | f += e.charAt(l);
|
6978 | }
|
6979 |
|
6980 | g = 59;
|
6981 | }
|
6982 |
|
6983 | switch (g) {
|
6984 | case 123:
|
6985 | f = f.trim();
|
6986 | q = f.charCodeAt(0);
|
6987 | k = 1;
|
6988 |
|
6989 | for (t = ++l; l < B;) {
|
6990 | switch (g = e.charCodeAt(l)) {
|
6991 | case 123:
|
6992 | k++;
|
6993 | break;
|
6994 |
|
6995 | case 125:
|
6996 | k--;
|
6997 | break;
|
6998 |
|
6999 | case 47:
|
7000 | switch (g = e.charCodeAt(l + 1)) {
|
7001 | case 42:
|
7002 | case 47:
|
7003 | a: {
|
7004 | for (u = l + 1; u < J; ++u) {
|
7005 | switch (e.charCodeAt(u)) {
|
7006 | case 47:
|
7007 | if (42 === g && 42 === e.charCodeAt(u - 1) && l + 2 !== u) {
|
7008 | l = u + 1;
|
7009 | break a;
|
7010 | }
|
7011 |
|
7012 | break;
|
7013 |
|
7014 | case 10:
|
7015 | if (47 === g) {
|
7016 | l = u + 1;
|
7017 | break a;
|
7018 | }
|
7019 |
|
7020 | }
|
7021 | }
|
7022 |
|
7023 | l = u;
|
7024 | }
|
7025 |
|
7026 | }
|
7027 |
|
7028 | break;
|
7029 |
|
7030 | case 91:
|
7031 | g++;
|
7032 |
|
7033 | case 40:
|
7034 | g++;
|
7035 |
|
7036 | case 34:
|
7037 | case 39:
|
7038 | for (; l++ < J && e.charCodeAt(l) !== g;) {
|
7039 | }
|
7040 |
|
7041 | }
|
7042 |
|
7043 | if (0 === k) break;
|
7044 | l++;
|
7045 | }
|
7046 |
|
7047 | k = e.substring(t, l);
|
7048 | 0 === q && (q = (f = f.replace(ca, '').trim()).charCodeAt(0));
|
7049 |
|
7050 | switch (q) {
|
7051 | case 64:
|
7052 | 0 < r && (f = f.replace(N, ''));
|
7053 | g = f.charCodeAt(1);
|
7054 |
|
7055 | switch (g) {
|
7056 | case 100:
|
7057 | case 109:
|
7058 | case 115:
|
7059 | case 45:
|
7060 | r = c;
|
7061 | break;
|
7062 |
|
7063 | default:
|
7064 | r = O;
|
7065 | }
|
7066 |
|
7067 | k = M(c, r, k, g, a + 1);
|
7068 | t = k.length;
|
7069 | 0 < A && (r = X(O, f, I), C = H(3, k, r, c, D, z, t, g, a, h), f = r.join(''), void 0 !== C && 0 === (t = (k = C.trim()).length) && (g = 0, k = ''));
|
7070 | if (0 < t) switch (g) {
|
7071 | case 115:
|
7072 | f = f.replace(da, ea);
|
7073 |
|
7074 | case 100:
|
7075 | case 109:
|
7076 | case 45:
|
7077 | k = f + '{' + k + '}';
|
7078 | break;
|
7079 |
|
7080 | case 107:
|
7081 | f = f.replace(fa, '$1 $2');
|
7082 | k = f + '{' + k + '}';
|
7083 | k = 1 === w || 2 === w && L('@' + k, 3) ? '@-webkit-' + k + '@' + k : '@' + k;
|
7084 | break;
|
7085 |
|
7086 | default:
|
7087 | k = f + k, 112 === h && (k = (p += k, ''));
|
7088 | } else k = '';
|
7089 | break;
|
7090 |
|
7091 | default:
|
7092 | k = M(c, X(c, f, I), k, h, a + 1);
|
7093 | }
|
7094 |
|
7095 | F += k;
|
7096 | k = I = r = u = q = 0;
|
7097 | f = '';
|
7098 | g = e.charCodeAt(++l);
|
7099 | break;
|
7100 |
|
7101 | case 125:
|
7102 | case 59:
|
7103 | f = (0 < r ? f.replace(N, '') : f).trim();
|
7104 | if (1 < (t = f.length)) switch (0 === u && (q = f.charCodeAt(0), 45 === q || 96 < q && 123 > q) && (t = (f = f.replace(' ', ':')).length), 0 < A && void 0 !== (C = H(1, f, c, d, D, z, p.length, h, a, h)) && 0 === (t = (f = C.trim()).length) && (f = '\x00\x00'), q = f.charCodeAt(0), g = f.charCodeAt(1), q) {
|
7105 | case 0:
|
7106 | break;
|
7107 |
|
7108 | case 64:
|
7109 | if (105 === g || 99 === g) {
|
7110 | G += f + e.charAt(l);
|
7111 | break;
|
7112 | }
|
7113 |
|
7114 | default:
|
7115 | 58 !== f.charCodeAt(t - 1) && (p += P(f, q, g, f.charCodeAt(2)));
|
7116 | }
|
7117 | I = r = u = q = 0;
|
7118 | f = '';
|
7119 | g = e.charCodeAt(++l);
|
7120 | }
|
7121 | }
|
7122 |
|
7123 | switch (g) {
|
7124 | case 13:
|
7125 | case 10:
|
7126 | 47 === b ? b = 0 : 0 === 1 + q && 107 !== h && 0 < f.length && (r = 1, f += '\x00');
|
7127 | 0 < A * Y && H(0, f, c, d, D, z, p.length, h, a, h);
|
7128 | z = 1;
|
7129 | D++;
|
7130 | break;
|
7131 |
|
7132 | case 59:
|
7133 | case 125:
|
7134 | if (0 === b + n + v + m) {
|
7135 | z++;
|
7136 | break;
|
7137 | }
|
7138 |
|
7139 | default:
|
7140 | z++;
|
7141 | y = e.charAt(l);
|
7142 |
|
7143 | switch (g) {
|
7144 | case 9:
|
7145 | case 32:
|
7146 | if (0 === n + m + b) switch (x) {
|
7147 | case 44:
|
7148 | case 58:
|
7149 | case 9:
|
7150 | case 32:
|
7151 | y = '';
|
7152 | break;
|
7153 |
|
7154 | default:
|
7155 | 32 !== g && (y = ' ');
|
7156 | }
|
7157 | break;
|
7158 |
|
7159 | case 0:
|
7160 | y = '\\0';
|
7161 | break;
|
7162 |
|
7163 | case 12:
|
7164 | y = '\\f';
|
7165 | break;
|
7166 |
|
7167 | case 11:
|
7168 | y = '\\v';
|
7169 | break;
|
7170 |
|
7171 | case 38:
|
7172 | 0 === n + b + m && (r = I = 1, y = '\f' + y);
|
7173 | break;
|
7174 |
|
7175 | case 108:
|
7176 | if (0 === n + b + m + E && 0 < u) switch (l - u) {
|
7177 | case 2:
|
7178 | 112 === x && 58 === e.charCodeAt(l - 3) && (E = x);
|
7179 |
|
7180 | case 8:
|
7181 | 111 === K && (E = K);
|
7182 | }
|
7183 | break;
|
7184 |
|
7185 | case 58:
|
7186 | 0 === n + b + m && (u = l);
|
7187 | break;
|
7188 |
|
7189 | case 44:
|
7190 | 0 === b + v + n + m && (r = 1, y += '\r');
|
7191 | break;
|
7192 |
|
7193 | case 34:
|
7194 | case 39:
|
7195 | 0 === b && (n = n === g ? 0 : 0 === n ? g : n);
|
7196 | break;
|
7197 |
|
7198 | case 91:
|
7199 | 0 === n + b + v && m++;
|
7200 | break;
|
7201 |
|
7202 | case 93:
|
7203 | 0 === n + b + v && m--;
|
7204 | break;
|
7205 |
|
7206 | case 41:
|
7207 | 0 === n + b + m && v--;
|
7208 | break;
|
7209 |
|
7210 | case 40:
|
7211 | if (0 === n + b + m) {
|
7212 | if (0 === q) switch (2 * x + 3 * K) {
|
7213 | case 533:
|
7214 | break;
|
7215 |
|
7216 | default:
|
7217 | q = 1;
|
7218 | }
|
7219 | v++;
|
7220 | }
|
7221 |
|
7222 | break;
|
7223 |
|
7224 | case 64:
|
7225 | 0 === b + v + n + m + u + k && (k = 1);
|
7226 | break;
|
7227 |
|
7228 | case 42:
|
7229 | case 47:
|
7230 | if (!(0 < n + m + v)) switch (b) {
|
7231 | case 0:
|
7232 | switch (2 * g + 3 * e.charCodeAt(l + 1)) {
|
7233 | case 235:
|
7234 | b = 47;
|
7235 | break;
|
7236 |
|
7237 | case 220:
|
7238 | t = l, b = 42;
|
7239 | }
|
7240 |
|
7241 | break;
|
7242 |
|
7243 | case 42:
|
7244 | 47 === g && 42 === x && t + 2 !== l && (33 === e.charCodeAt(t + 2) && (p += e.substring(t, l + 1)), y = '', b = 0);
|
7245 | }
|
7246 | }
|
7247 |
|
7248 | 0 === b && (f += y);
|
7249 | }
|
7250 |
|
7251 | K = x;
|
7252 | x = g;
|
7253 | l++;
|
7254 | }
|
7255 |
|
7256 | t = p.length;
|
7257 |
|
7258 | if (0 < t) {
|
7259 | r = c;
|
7260 | if (0 < A && (C = H(2, p, r, d, D, z, t, h, a, h), void 0 !== C && 0 === (p = C).length)) return G + p + F;
|
7261 | p = r.join(',') + '{' + p + '}';
|
7262 |
|
7263 | if (0 !== w * E) {
|
7264 | 2 !== w || L(p, 2) || (E = 0);
|
7265 |
|
7266 | switch (E) {
|
7267 | case 111:
|
7268 | p = p.replace(ha, ':-moz-$1') + p;
|
7269 | break;
|
7270 |
|
7271 | case 112:
|
7272 | p = p.replace(Q, '::-webkit-input-$1') + p.replace(Q, '::-moz-$1') + p.replace(Q, ':-ms-input-$1') + p;
|
7273 | }
|
7274 |
|
7275 | E = 0;
|
7276 | }
|
7277 | }
|
7278 |
|
7279 | return G + p + F;
|
7280 | }
|
7281 |
|
7282 | function X(d, c, e) {
|
7283 | var h = c.trim().split(ia);
|
7284 | c = h;
|
7285 | var a = h.length,
|
7286 | m = d.length;
|
7287 |
|
7288 | switch (m) {
|
7289 | case 0:
|
7290 | case 1:
|
7291 | var b = 0;
|
7292 |
|
7293 | for (d = 0 === m ? '' : d[0] + ' '; b < a; ++b) {
|
7294 | c[b] = Z(d, c[b], e, m).trim();
|
7295 | }
|
7296 |
|
7297 | break;
|
7298 |
|
7299 | default:
|
7300 | var v = b = 0;
|
7301 |
|
7302 | for (c = []; b < a; ++b) {
|
7303 | for (var n = 0; n < m; ++n) {
|
7304 | c[v++] = Z(d[n] + ' ', h[b], e, m).trim();
|
7305 | }
|
7306 | }
|
7307 |
|
7308 | }
|
7309 |
|
7310 | return c;
|
7311 | }
|
7312 |
|
7313 | function Z(d, c, e) {
|
7314 | var h = c.charCodeAt(0);
|
7315 | 33 > h && (h = (c = c.trim()).charCodeAt(0));
|
7316 |
|
7317 | switch (h) {
|
7318 | case 38:
|
7319 | return c.replace(F, '$1' + d.trim());
|
7320 |
|
7321 | case 58:
|
7322 | return d.trim() + c.replace(F, '$1' + d.trim());
|
7323 |
|
7324 | default:
|
7325 | if (0 < 1 * e && 0 < c.indexOf('\f')) return c.replace(F, (58 === d.charCodeAt(0) ? '' : '$1') + d.trim());
|
7326 | }
|
7327 |
|
7328 | return d + c;
|
7329 | }
|
7330 |
|
7331 | function P(d, c, e, h) {
|
7332 | var a = d + ';',
|
7333 | m = 2 * c + 3 * e + 4 * h;
|
7334 |
|
7335 | if (944 === m) {
|
7336 | d = a.indexOf(':', 9) + 1;
|
7337 | var b = a.substring(d, a.length - 1).trim();
|
7338 | b = a.substring(0, d).trim() + b + ';';
|
7339 | return 1 === w || 2 === w && L(b, 1) ? '-webkit-' + b + b : b;
|
7340 | }
|
7341 |
|
7342 | if (0 === w || 2 === w && !L(a, 1)) return a;
|
7343 |
|
7344 | switch (m) {
|
7345 | case 1015:
|
7346 | return 97 === a.charCodeAt(10) ? '-webkit-' + a + a : a;
|
7347 |
|
7348 | case 951:
|
7349 | return 116 === a.charCodeAt(3) ? '-webkit-' + a + a : a;
|
7350 |
|
7351 | case 963:
|
7352 | return 110 === a.charCodeAt(5) ? '-webkit-' + a + a : a;
|
7353 |
|
7354 | case 1009:
|
7355 | if (100 !== a.charCodeAt(4)) break;
|
7356 |
|
7357 | case 969:
|
7358 | case 942:
|
7359 | return '-webkit-' + a + a;
|
7360 |
|
7361 | case 978:
|
7362 | return '-webkit-' + a + '-moz-' + a + a;
|
7363 |
|
7364 | case 1019:
|
7365 | case 983:
|
7366 | return '-webkit-' + a + '-moz-' + a + '-ms-' + a + a;
|
7367 |
|
7368 | case 883:
|
7369 | if (45 === a.charCodeAt(8)) return '-webkit-' + a + a;
|
7370 | if (0 < a.indexOf('image-set(', 11)) return a.replace(ja, '$1-webkit-$2') + a;
|
7371 | break;
|
7372 |
|
7373 | case 932:
|
7374 | if (45 === a.charCodeAt(4)) switch (a.charCodeAt(5)) {
|
7375 | case 103:
|
7376 | return '-webkit-box-' + a.replace('-grow', '') + '-webkit-' + a + '-ms-' + a.replace('grow', 'positive') + a;
|
7377 |
|
7378 | case 115:
|
7379 | return '-webkit-' + a + '-ms-' + a.replace('shrink', 'negative') + a;
|
7380 |
|
7381 | case 98:
|
7382 | return '-webkit-' + a + '-ms-' + a.replace('basis', 'preferred-size') + a;
|
7383 | }
|
7384 | return '-webkit-' + a + '-ms-' + a + a;
|
7385 |
|
7386 | case 964:
|
7387 | return '-webkit-' + a + '-ms-flex-' + a + a;
|
7388 |
|
7389 | case 1023:
|
7390 | if (99 !== a.charCodeAt(8)) break;
|
7391 | b = a.substring(a.indexOf(':', 15)).replace('flex-', '').replace('space-between', 'justify');
|
7392 | return '-webkit-box-pack' + b + '-webkit-' + a + '-ms-flex-pack' + b + a;
|
7393 |
|
7394 | case 1005:
|
7395 | return ka.test(a) ? a.replace(aa, ':-webkit-') + a.replace(aa, ':-moz-') + a : a;
|
7396 |
|
7397 | case 1e3:
|
7398 | b = a.substring(13).trim();
|
7399 | c = b.indexOf('-') + 1;
|
7400 |
|
7401 | switch (b.charCodeAt(0) + b.charCodeAt(c)) {
|
7402 | case 226:
|
7403 | b = a.replace(G, 'tb');
|
7404 | break;
|
7405 |
|
7406 | case 232:
|
7407 | b = a.replace(G, 'tb-rl');
|
7408 | break;
|
7409 |
|
7410 | case 220:
|
7411 | b = a.replace(G, 'lr');
|
7412 | break;
|
7413 |
|
7414 | default:
|
7415 | return a;
|
7416 | }
|
7417 |
|
7418 | return '-webkit-' + a + '-ms-' + b + a;
|
7419 |
|
7420 | case 1017:
|
7421 | if (-1 === a.indexOf('sticky', 9)) break;
|
7422 |
|
7423 | case 975:
|
7424 | c = (a = d).length - 10;
|
7425 | b = (33 === a.charCodeAt(c) ? a.substring(0, c) : a).substring(d.indexOf(':', 7) + 1).trim();
|
7426 |
|
7427 | switch (m = b.charCodeAt(0) + (b.charCodeAt(7) | 0)) {
|
7428 | case 203:
|
7429 | if (111 > b.charCodeAt(8)) break;
|
7430 |
|
7431 | case 115:
|
7432 | a = a.replace(b, '-webkit-' + b) + ';' + a;
|
7433 | break;
|
7434 |
|
7435 | case 207:
|
7436 | case 102:
|
7437 | a = a.replace(b, '-webkit-' + (102 < m ? 'inline-' : '') + 'box') + ';' + a.replace(b, '-webkit-' + b) + ';' + a.replace(b, '-ms-' + b + 'box') + ';' + a;
|
7438 | }
|
7439 |
|
7440 | return a + ';';
|
7441 |
|
7442 | case 938:
|
7443 | if (45 === a.charCodeAt(5)) switch (a.charCodeAt(6)) {
|
7444 | case 105:
|
7445 | return b = a.replace('-items', ''), '-webkit-' + a + '-webkit-box-' + b + '-ms-flex-' + b + a;
|
7446 |
|
7447 | case 115:
|
7448 | return '-webkit-' + a + '-ms-flex-item-' + a.replace(ba, '') + a;
|
7449 |
|
7450 | default:
|
7451 | return '-webkit-' + a + '-ms-flex-line-pack' + a.replace('align-content', '').replace(ba, '') + a;
|
7452 | }
|
7453 | break;
|
7454 |
|
7455 | case 973:
|
7456 | case 989:
|
7457 | if (45 !== a.charCodeAt(3) || 122 === a.charCodeAt(4)) break;
|
7458 |
|
7459 | case 931:
|
7460 | case 953:
|
7461 | if (!0 === la.test(d)) return 115 === (b = d.substring(d.indexOf(':') + 1)).charCodeAt(0) ? P(d.replace('stretch', 'fill-available'), c, e, h).replace(':fill-available', ':stretch') : a.replace(b, '-webkit-' + b) + a.replace(b, '-moz-' + b.replace('fill-', '')) + a;
|
7462 | break;
|
7463 |
|
7464 | case 962:
|
7465 | if (a = '-webkit-' + a + (102 === a.charCodeAt(5) ? '-ms-' + a : '') + a, 211 === e + h && 105 === a.charCodeAt(13) && 0 < a.indexOf('transform', 10)) return a.substring(0, a.indexOf(';', 27) + 1).replace(ma, '$1-webkit-$2') + a;
|
7466 | }
|
7467 |
|
7468 | return a;
|
7469 | }
|
7470 |
|
7471 | function L(d, c) {
|
7472 | var e = d.indexOf(1 === c ? ':' : '{'),
|
7473 | h = d.substring(0, 3 !== c ? e : 10);
|
7474 | e = d.substring(e + 1, d.length - 1);
|
7475 | return R(2 !== c ? h : h.replace(na, '$1'), e, c);
|
7476 | }
|
7477 |
|
7478 | function ea(d, c) {
|
7479 | var e = P(c, c.charCodeAt(0), c.charCodeAt(1), c.charCodeAt(2));
|
7480 | return e !== c + ';' ? e.replace(oa, ' or ($1)').substring(4) : '(' + c + ')';
|
7481 | }
|
7482 |
|
7483 | function H(d, c, e, h, a, m, b, v, n, q) {
|
7484 | for (var g = 0, x = c, w; g < A; ++g) {
|
7485 | switch (w = S[g].call(B, d, x, e, h, a, m, b, v, n, q)) {
|
7486 | case void 0:
|
7487 | case !1:
|
7488 | case !0:
|
7489 | case null:
|
7490 | break;
|
7491 |
|
7492 | default:
|
7493 | x = w;
|
7494 | }
|
7495 | }
|
7496 |
|
7497 | if (x !== c) return x;
|
7498 | }
|
7499 |
|
7500 | function T(d) {
|
7501 | switch (d) {
|
7502 | case void 0:
|
7503 | case null:
|
7504 | A = S.length = 0;
|
7505 | break;
|
7506 |
|
7507 | default:
|
7508 | switch (d.constructor) {
|
7509 | case Array:
|
7510 | for (var c = 0, e = d.length; c < e; ++c) {
|
7511 | T(d[c]);
|
7512 | }
|
7513 |
|
7514 | break;
|
7515 |
|
7516 | case Function:
|
7517 | S[A++] = d;
|
7518 | break;
|
7519 |
|
7520 | case Boolean:
|
7521 | Y = !!d | 0;
|
7522 | }
|
7523 |
|
7524 | }
|
7525 |
|
7526 | return T;
|
7527 | }
|
7528 |
|
7529 | function U(d) {
|
7530 | d = d.prefix;
|
7531 | void 0 !== d && (R = null, d ? 'function' !== typeof d ? w = 1 : (w = 2, R = d) : w = 0);
|
7532 | return U;
|
7533 | }
|
7534 |
|
7535 | function B(d, c) {
|
7536 | var e = d;
|
7537 | 33 > e.charCodeAt(0) && (e = e.trim());
|
7538 | V = e;
|
7539 | e = [V];
|
7540 |
|
7541 | if (0 < A) {
|
7542 | var h = H(-1, c, e, e, D, z, 0, 0, 0, 0);
|
7543 | void 0 !== h && 'string' === typeof h && (c = h);
|
7544 | }
|
7545 |
|
7546 | var a = M(O, e, c, 0, 0);
|
7547 | 0 < A && (h = H(-2, a, e, e, D, z, a.length, 0, 0, 0), void 0 !== h && (a = h));
|
7548 | V = '';
|
7549 | E = 0;
|
7550 | z = D = 1;
|
7551 | return a;
|
7552 | }
|
7553 |
|
7554 | var ca = /^\0+/g,
|
7555 | N = /[\0\r\f]/g,
|
7556 | aa = /: */g,
|
7557 | ka = /zoo|gra/,
|
7558 | ma = /([,: ])(transform)/g,
|
7559 | ia = /,\r+?/g,
|
7560 | F = /([\t\r\n ])*\f?&/g,
|
7561 | fa = /@(k\w+)\s*(\S*)\s*/,
|
7562 | Q = /::(place)/g,
|
7563 | ha = /:(read-only)/g,
|
7564 | G = /[svh]\w+-[tblr]{2}/,
|
7565 | da = /\(\s*(.*)\s*\)/g,
|
7566 | oa = /([\s\S]*?);/g,
|
7567 | ba = /-self|flex-/g,
|
7568 | na = /[^]*?(:[rp][el]a[\w-]+)[^]*/,
|
7569 | la = /stretch|:\s*\w+\-(?:conte|avail)/,
|
7570 | ja = /([^-])(image-set\()/,
|
7571 | z = 1,
|
7572 | D = 1,
|
7573 | E = 0,
|
7574 | w = 1,
|
7575 | O = [],
|
7576 | S = [],
|
7577 | A = 0,
|
7578 | R = null,
|
7579 | Y = 0,
|
7580 | V = '';
|
7581 | B.use = T;
|
7582 | B.set = U;
|
7583 | void 0 !== W && U(W);
|
7584 | return B;
|
7585 | }
|
7586 |
|
7587 | var stylisRuleSheet = createCommonjsModule(function (module, exports) {
|
7588 | (function (factory) {
|
7589 | module['exports'] = factory();
|
7590 | }(function () {
|
7591 |
|
7592 | return function (insertRule) {
|
7593 | var delimiter = '/*|*/';
|
7594 | var needle = delimiter+'}';
|
7595 |
|
7596 | function toSheet (block) {
|
7597 | if (block)
|
7598 | try {
|
7599 | insertRule(block + '}');
|
7600 | } catch (e) {}
|
7601 | }
|
7602 |
|
7603 | return function ruleSheet (context, content, selectors, parents, line, column, length, ns, depth, at) {
|
7604 | switch (context) {
|
7605 | // property
|
7606 | case 1:
|
7607 | // @import
|
7608 | if (depth === 0 && content.charCodeAt(0) === 64)
|
7609 | return insertRule(content+';'), ''
|
7610 | break
|
7611 | // selector
|
7612 | case 2:
|
7613 | if (ns === 0)
|
7614 | return content + delimiter
|
7615 | break
|
7616 | // at-rule
|
7617 | case 3:
|
7618 | switch (ns) {
|
7619 | // @font-face, @page
|
7620 | case 102:
|
7621 | case 112:
|
7622 | return insertRule(selectors[0]+content), ''
|
7623 | default:
|
7624 | return content + (at === 0 ? delimiter : '')
|
7625 | }
|
7626 | case -2:
|
7627 | content.split(needle).forEach(toSheet);
|
7628 | }
|
7629 | }
|
7630 | }
|
7631 | }));
|
7632 | });
|
7633 |
|
7634 | var hyphenateRegex = /[A-Z]|^ms/g;
|
7635 | var processStyleName = memoize(function (styleName) {
|
7636 | return styleName.replace(hyphenateRegex, '-$&').toLowerCase();
|
7637 | });
|
7638 | var processStyleValue = function processStyleValue(key, value) {
|
7639 | if (value == null || typeof value === 'boolean') {
|
7640 | return '';
|
7641 | }
|
7642 |
|
7643 | if (unitlessKeys[key] !== 1 && key.charCodeAt(1) !== 45 && // custom properties
|
7644 | !isNaN(value) && value !== 0) {
|
7645 | return value + 'px';
|
7646 | }
|
7647 |
|
7648 | return value;
|
7649 | };
|
7650 |
|
7651 | if (process.env.NODE_ENV !== 'production') {
|
7652 | var contentValuePattern = /(attr|calc|counters?|url)\(/;
|
7653 | var contentValues = ['normal', 'none', 'counter', 'open-quote', 'close-quote', 'no-open-quote', 'no-close-quote', 'initial', 'inherit', 'unset'];
|
7654 | var oldProcessStyleValue = processStyleValue;
|
7655 |
|
7656 | processStyleValue = function processStyleValue(key, value) {
|
7657 | if (key === 'content') {
|
7658 | if (typeof value !== 'string' || contentValues.indexOf(value) === -1 && !contentValuePattern.test(value) && (value.charAt(0) !== value.charAt(value.length - 1) || value.charAt(0) !== '"' && value.charAt(0) !== "'")) {
|
7659 | console.error("You seem to be using a value for 'content' without quotes, try replacing it with `content: '\"" + value + "\"'`");
|
7660 | }
|
7661 | }
|
7662 |
|
7663 | return oldProcessStyleValue(key, value);
|
7664 | };
|
7665 | }
|
7666 |
|
7667 | var classnames$1 = function classnames(args) {
|
7668 | var len = args.length;
|
7669 | var i = 0;
|
7670 | var cls = '';
|
7671 |
|
7672 | for (; i < len; i++) {
|
7673 | var arg = args[i];
|
7674 | if (arg == null) continue;
|
7675 | var toAdd = void 0;
|
7676 |
|
7677 | switch (typeof arg) {
|
7678 | case 'boolean':
|
7679 | break;
|
7680 |
|
7681 | case 'function':
|
7682 | if (process.env.NODE_ENV !== 'production') {
|
7683 | console.error('Passing functions to cx is deprecated and will be removed in the next major version of Emotion.\n' + 'Please call the function before passing it to cx.');
|
7684 | }
|
7685 |
|
7686 | toAdd = classnames([arg()]);
|
7687 | break;
|
7688 |
|
7689 | case 'object':
|
7690 | {
|
7691 | if (Array.isArray(arg)) {
|
7692 | toAdd = classnames(arg);
|
7693 | } else {
|
7694 | toAdd = '';
|
7695 |
|
7696 | for (var k in arg) {
|
7697 | if (arg[k] && k) {
|
7698 | toAdd && (toAdd += ' ');
|
7699 | toAdd += k;
|
7700 | }
|
7701 | }
|
7702 | }
|
7703 |
|
7704 | break;
|
7705 | }
|
7706 |
|
7707 | default:
|
7708 | {
|
7709 | toAdd = arg;
|
7710 | }
|
7711 | }
|
7712 |
|
7713 | if (toAdd) {
|
7714 | cls && (cls += ' ');
|
7715 | cls += toAdd;
|
7716 | }
|
7717 | }
|
7718 |
|
7719 | return cls;
|
7720 | };
|
7721 | var isBrowser = typeof document !== 'undefined';
|
7722 |
|
7723 | /*
|
7724 |
|
7725 | high performance StyleSheet for css-in-js systems
|
7726 |
|
7727 | - uses multiple style tags behind the scenes for millions of rules
|
7728 | - uses `insertRule` for appending in production for *much* faster performance
|
7729 | - 'polyfills' on server side
|
7730 |
|
7731 | // usage
|
7732 |
|
7733 | import StyleSheet from 'glamor/lib/sheet'
|
7734 | let styleSheet = new StyleSheet()
|
7735 |
|
7736 | styleSheet.inject()
|
7737 | - 'injects' the stylesheet into the page (or into memory if on server)
|
7738 |
|
7739 | styleSheet.insert('#box { border: 1px solid red; }')
|
7740 | - appends a css rule into the stylesheet
|
7741 |
|
7742 | styleSheet.flush()
|
7743 | - empties the stylesheet of all its contents
|
7744 |
|
7745 | */
|
7746 | // $FlowFixMe
|
7747 | function sheetForTag(tag) {
|
7748 | if (tag.sheet) {
|
7749 | // $FlowFixMe
|
7750 | return tag.sheet;
|
7751 | } // this weirdness brought to you by firefox
|
7752 |
|
7753 |
|
7754 | for (var i = 0; i < document.styleSheets.length; i++) {
|
7755 | if (document.styleSheets[i].ownerNode === tag) {
|
7756 | // $FlowFixMe
|
7757 | return document.styleSheets[i];
|
7758 | }
|
7759 | }
|
7760 | }
|
7761 |
|
7762 | function makeStyleTag(opts) {
|
7763 | var tag = document.createElement('style');
|
7764 | tag.setAttribute('data-emotion', opts.key || '');
|
7765 |
|
7766 | if (opts.nonce !== undefined) {
|
7767 | tag.setAttribute('nonce', opts.nonce);
|
7768 | }
|
7769 |
|
7770 | tag.appendChild(document.createTextNode('')) // $FlowFixMe
|
7771 | ;
|
7772 | (opts.container !== undefined ? opts.container : document.head).appendChild(tag);
|
7773 | return tag;
|
7774 | }
|
7775 |
|
7776 | var StyleSheet =
|
7777 | /*#__PURE__*/
|
7778 | function () {
|
7779 | function StyleSheet(options) {
|
7780 | this.isSpeedy = process.env.NODE_ENV === 'production'; // the big drawback here is that the css won't be editable in devtools
|
7781 |
|
7782 | this.tags = [];
|
7783 | this.ctr = 0;
|
7784 | this.opts = options;
|
7785 | }
|
7786 |
|
7787 | var _proto = StyleSheet.prototype;
|
7788 |
|
7789 | _proto.inject = function inject() {
|
7790 | if (this.injected) {
|
7791 | throw new Error('already injected!');
|
7792 | }
|
7793 |
|
7794 | this.tags[0] = makeStyleTag(this.opts);
|
7795 | this.injected = true;
|
7796 | };
|
7797 |
|
7798 | _proto.speedy = function speedy(bool) {
|
7799 | if (this.ctr !== 0) {
|
7800 | // cannot change speedy mode after inserting any rule to sheet. Either call speedy(${bool}) earlier in your app, or call flush() before speedy(${bool})
|
7801 | throw new Error("cannot change speedy now");
|
7802 | }
|
7803 |
|
7804 | this.isSpeedy = !!bool;
|
7805 | };
|
7806 |
|
7807 | _proto.insert = function insert(rule, sourceMap) {
|
7808 | // this is the ultrafast version, works across browsers
|
7809 | if (this.isSpeedy) {
|
7810 | var tag = this.tags[this.tags.length - 1];
|
7811 | var sheet = sheetForTag(tag);
|
7812 |
|
7813 | try {
|
7814 | sheet.insertRule(rule, sheet.cssRules.length);
|
7815 | } catch (e) {
|
7816 | if (process.env.NODE_ENV !== 'production') {
|
7817 | console.warn('illegal rule', rule); // eslint-disable-line no-console
|
7818 | }
|
7819 | }
|
7820 | } else {
|
7821 | var _tag = makeStyleTag(this.opts);
|
7822 |
|
7823 | this.tags.push(_tag);
|
7824 |
|
7825 | _tag.appendChild(document.createTextNode(rule + (sourceMap || '')));
|
7826 | }
|
7827 |
|
7828 | this.ctr++;
|
7829 |
|
7830 | if (this.ctr % 65000 === 0) {
|
7831 | this.tags.push(makeStyleTag(this.opts));
|
7832 | }
|
7833 | };
|
7834 |
|
7835 | _proto.flush = function flush() {
|
7836 | // $FlowFixMe
|
7837 | this.tags.forEach(function (tag) {
|
7838 | return tag.parentNode.removeChild(tag);
|
7839 | });
|
7840 | this.tags = [];
|
7841 | this.ctr = 0; // todo - look for remnants in document.styleSheets
|
7842 |
|
7843 | this.injected = false;
|
7844 | };
|
7845 |
|
7846 | return StyleSheet;
|
7847 | }();
|
7848 |
|
7849 | function createEmotion(context, options) {
|
7850 | if (context.__SECRET_EMOTION__ !== undefined) {
|
7851 | return context.__SECRET_EMOTION__;
|
7852 | }
|
7853 |
|
7854 | if (options === undefined) options = {};
|
7855 | var key = options.key || 'css';
|
7856 |
|
7857 | if (process.env.NODE_ENV !== 'production') {
|
7858 | if (/[^a-z-]/.test(key)) {
|
7859 | throw new Error("Emotion key must only contain lower case alphabetical characters and - but \"" + key + "\" was passed");
|
7860 | }
|
7861 | }
|
7862 |
|
7863 | var current;
|
7864 |
|
7865 | function insertRule(rule) {
|
7866 | current += rule;
|
7867 |
|
7868 | if (isBrowser) {
|
7869 | sheet.insert(rule, currentSourceMap);
|
7870 | }
|
7871 | }
|
7872 |
|
7873 | var insertionPlugin = stylisRuleSheet(insertRule);
|
7874 | var stylisOptions;
|
7875 |
|
7876 | if (options.prefix !== undefined) {
|
7877 | stylisOptions = {
|
7878 | prefix: options.prefix
|
7879 | };
|
7880 | }
|
7881 |
|
7882 | var caches = {
|
7883 | registered: {},
|
7884 | inserted: {},
|
7885 | nonce: options.nonce,
|
7886 | key: key
|
7887 | };
|
7888 | var sheet = new StyleSheet(options);
|
7889 |
|
7890 | if (isBrowser) {
|
7891 | // 🚀
|
7892 | sheet.inject();
|
7893 | }
|
7894 |
|
7895 | var stylis = new stylis_min(stylisOptions);
|
7896 | stylis.use(options.stylisPlugins)(insertionPlugin);
|
7897 | var currentSourceMap = '';
|
7898 |
|
7899 | function handleInterpolation(interpolation, couldBeSelectorInterpolation) {
|
7900 | if (interpolation == null) {
|
7901 | return '';
|
7902 | }
|
7903 |
|
7904 | switch (typeof interpolation) {
|
7905 | case 'boolean':
|
7906 | return '';
|
7907 |
|
7908 | case 'function':
|
7909 | if (interpolation.__emotion_styles !== undefined) {
|
7910 | var selector = interpolation.toString();
|
7911 |
|
7912 | if (selector === 'NO_COMPONENT_SELECTOR' && process.env.NODE_ENV !== 'production') {
|
7913 | throw new Error('Component selectors can only be used in conjunction with babel-plugin-emotion.');
|
7914 | }
|
7915 |
|
7916 | return selector;
|
7917 | }
|
7918 |
|
7919 | if (this === undefined && process.env.NODE_ENV !== 'production') {
|
7920 | console.error('Interpolating functions in css calls is deprecated and will be removed in the next major version of Emotion.\n' + 'If you want to have a css call based on props, create a function that returns a css call like this\n' + 'let dynamicStyle = (props) => css`color: ${props.color}`\n' + 'It can be called directly with props or interpolated in a styled call like this\n' + "let SomeComponent = styled('div')`${dynamicStyle}`");
|
7921 | }
|
7922 |
|
7923 | return handleInterpolation.call(this, this === undefined ? interpolation() : // $FlowFixMe
|
7924 | interpolation(this.mergedProps, this.context), couldBeSelectorInterpolation);
|
7925 |
|
7926 | case 'object':
|
7927 | return createStringFromObject.call(this, interpolation);
|
7928 |
|
7929 | default:
|
7930 | var cached = caches.registered[interpolation];
|
7931 | return couldBeSelectorInterpolation === false && cached !== undefined ? cached : interpolation;
|
7932 | }
|
7933 | }
|
7934 |
|
7935 | var objectToStringCache = new WeakMap();
|
7936 |
|
7937 | function createStringFromObject(obj) {
|
7938 | if (objectToStringCache.has(obj)) {
|
7939 | // $FlowFixMe
|
7940 | return objectToStringCache.get(obj);
|
7941 | }
|
7942 |
|
7943 | var string = '';
|
7944 |
|
7945 | if (Array.isArray(obj)) {
|
7946 | obj.forEach(function (interpolation) {
|
7947 | string += handleInterpolation.call(this, interpolation, false);
|
7948 | }, this);
|
7949 | } else {
|
7950 | Object.keys(obj).forEach(function (key) {
|
7951 | if (typeof obj[key] !== 'object') {
|
7952 | if (caches.registered[obj[key]] !== undefined) {
|
7953 | string += key + "{" + caches.registered[obj[key]] + "}";
|
7954 | } else {
|
7955 | string += processStyleName(key) + ":" + processStyleValue(key, obj[key]) + ";";
|
7956 | }
|
7957 | } else {
|
7958 | if (key === 'NO_COMPONENT_SELECTOR' && process.env.NODE_ENV !== 'production') {
|
7959 | throw new Error('Component selectors can only be used in conjunction with babel-plugin-emotion.');
|
7960 | }
|
7961 |
|
7962 | if (Array.isArray(obj[key]) && typeof obj[key][0] === 'string' && caches.registered[obj[key][0]] === undefined) {
|
7963 | obj[key].forEach(function (value) {
|
7964 | string += processStyleName(key) + ":" + processStyleValue(key, value) + ";";
|
7965 | });
|
7966 | } else {
|
7967 | string += key + "{" + handleInterpolation.call(this, obj[key], false) + "}";
|
7968 | }
|
7969 | }
|
7970 | }, this);
|
7971 | }
|
7972 |
|
7973 | objectToStringCache.set(obj, string);
|
7974 | return string;
|
7975 | }
|
7976 |
|
7977 | var name;
|
7978 | var stylesWithLabel;
|
7979 | var labelPattern = /label:\s*([^\s;\n{]+)\s*;/g;
|
7980 |
|
7981 | var createClassName = function createClassName(styles, identifierName) {
|
7982 | return murmurhash2_32_gc(styles + identifierName) + identifierName;
|
7983 | };
|
7984 |
|
7985 | if (process.env.NODE_ENV !== 'production') {
|
7986 | var oldCreateClassName = createClassName;
|
7987 | var sourceMappingUrlPattern = /\/\*#\ssourceMappingURL=data:application\/json;\S+\s+\*\//g;
|
7988 |
|
7989 | createClassName = function createClassName(styles, identifierName) {
|
7990 | return oldCreateClassName(styles.replace(sourceMappingUrlPattern, function (sourceMap) {
|
7991 | currentSourceMap = sourceMap;
|
7992 | return '';
|
7993 | }), identifierName);
|
7994 | };
|
7995 | }
|
7996 |
|
7997 | var createStyles = function createStyles(strings) {
|
7998 | var stringMode = true;
|
7999 | var styles = '';
|
8000 | var identifierName = '';
|
8001 |
|
8002 | if (strings == null || strings.raw === undefined) {
|
8003 | stringMode = false;
|
8004 | styles += handleInterpolation.call(this, strings, false);
|
8005 | } else {
|
8006 | styles += strings[0];
|
8007 | }
|
8008 |
|
8009 | for (var _len = arguments.length, interpolations = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
8010 | interpolations[_key - 1] = arguments[_key];
|
8011 | }
|
8012 |
|
8013 | interpolations.forEach(function (interpolation, i) {
|
8014 | styles += handleInterpolation.call(this, interpolation, styles.charCodeAt(styles.length - 1) === 46 // .
|
8015 | );
|
8016 |
|
8017 | if (stringMode === true && strings[i + 1] !== undefined) {
|
8018 | styles += strings[i + 1];
|
8019 | }
|
8020 | }, this);
|
8021 | stylesWithLabel = styles;
|
8022 | styles = styles.replace(labelPattern, function (match, p1) {
|
8023 | identifierName += "-" + p1;
|
8024 | return '';
|
8025 | });
|
8026 | name = createClassName(styles, identifierName);
|
8027 | return styles;
|
8028 | };
|
8029 |
|
8030 | if (process.env.NODE_ENV !== 'production') {
|
8031 | var oldStylis = stylis;
|
8032 |
|
8033 | stylis = function stylis(selector, styles) {
|
8034 | oldStylis(selector, styles);
|
8035 | currentSourceMap = '';
|
8036 | };
|
8037 | }
|
8038 |
|
8039 | function insert(scope, styles) {
|
8040 | if (caches.inserted[name] === undefined) {
|
8041 | current = '';
|
8042 | stylis(scope, styles);
|
8043 | caches.inserted[name] = current;
|
8044 | }
|
8045 | }
|
8046 |
|
8047 | var css$$1 = function css$$1() {
|
8048 | var styles = createStyles.apply(this, arguments);
|
8049 | var selector = key + "-" + name;
|
8050 |
|
8051 | if (caches.registered[selector] === undefined) {
|
8052 | caches.registered[selector] = stylesWithLabel;
|
8053 | }
|
8054 |
|
8055 | insert("." + selector, styles);
|
8056 | return selector;
|
8057 | };
|
8058 |
|
8059 | var keyframes = function keyframes() {
|
8060 | var styles = createStyles.apply(this, arguments);
|
8061 | var animation = "animation-" + name;
|
8062 | insert('', "@keyframes " + animation + "{" + styles + "}");
|
8063 | return animation;
|
8064 | };
|
8065 |
|
8066 | var injectGlobal = function injectGlobal() {
|
8067 | var styles = createStyles.apply(this, arguments);
|
8068 | insert('', styles);
|
8069 | };
|
8070 |
|
8071 | function getRegisteredStyles(registeredStyles, classNames) {
|
8072 | var rawClassName = '';
|
8073 | classNames.split(' ').forEach(function (className) {
|
8074 | if (caches.registered[className] !== undefined) {
|
8075 | registeredStyles.push(className);
|
8076 | } else {
|
8077 | rawClassName += className + " ";
|
8078 | }
|
8079 | });
|
8080 | return rawClassName;
|
8081 | }
|
8082 |
|
8083 | function merge(className, sourceMap) {
|
8084 | var registeredStyles = [];
|
8085 | var rawClassName = getRegisteredStyles(registeredStyles, className);
|
8086 |
|
8087 | if (registeredStyles.length < 2) {
|
8088 | return className;
|
8089 | }
|
8090 |
|
8091 | return rawClassName + css$$1(registeredStyles, sourceMap);
|
8092 | }
|
8093 |
|
8094 | function cx() {
|
8095 | for (var _len2 = arguments.length, classNames = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
8096 | classNames[_key2] = arguments[_key2];
|
8097 | }
|
8098 |
|
8099 | return merge(classnames$1(classNames));
|
8100 | }
|
8101 |
|
8102 | function hydrateSingleId(id) {
|
8103 | caches.inserted[id] = true;
|
8104 | }
|
8105 |
|
8106 | function hydrate(ids) {
|
8107 | ids.forEach(hydrateSingleId);
|
8108 | }
|
8109 |
|
8110 | function flush() {
|
8111 | if (isBrowser) {
|
8112 | sheet.flush();
|
8113 | sheet.inject();
|
8114 | }
|
8115 |
|
8116 | caches.inserted = {};
|
8117 | caches.registered = {};
|
8118 | }
|
8119 |
|
8120 | if (isBrowser) {
|
8121 | var chunks = document.querySelectorAll("[data-emotion-" + key + "]");
|
8122 | Array.prototype.forEach.call(chunks, function (node) {
|
8123 | // $FlowFixMe
|
8124 | sheet.tags[0].parentNode.insertBefore(node, sheet.tags[0]); // $FlowFixMe
|
8125 |
|
8126 | node.getAttribute("data-emotion-" + key).split(' ').forEach(hydrateSingleId);
|
8127 | });
|
8128 | }
|
8129 |
|
8130 | var emotion = {
|
8131 | flush: flush,
|
8132 | hydrate: hydrate,
|
8133 | cx: cx,
|
8134 | merge: merge,
|
8135 | getRegisteredStyles: getRegisteredStyles,
|
8136 | injectGlobal: injectGlobal,
|
8137 | keyframes: keyframes,
|
8138 | css: css$$1,
|
8139 | sheet: sheet,
|
8140 | caches: caches
|
8141 | };
|
8142 | context.__SECRET_EMOTION__ = emotion;
|
8143 | return emotion;
|
8144 | }
|
8145 |
|
8146 | var context = typeof global !== 'undefined' ? global : {};
|
8147 |
|
8148 | var _createEmotion = createEmotion(context),
|
8149 | flush = _createEmotion.flush,
|
8150 | hydrate = _createEmotion.hydrate,
|
8151 | cx = _createEmotion.cx,
|
8152 | merge = _createEmotion.merge,
|
8153 | getRegisteredStyles = _createEmotion.getRegisteredStyles,
|
8154 | injectGlobal = _createEmotion.injectGlobal,
|
8155 | keyframes = _createEmotion.keyframes,
|
8156 | css$1 = _createEmotion.css,
|
8157 | sheet = _createEmotion.sheet,
|
8158 | caches = _createEmotion.caches;
|
8159 |
|
8160 | var performanceNow = createCommonjsModule(function (module) {
|
8161 | // Generated by CoffeeScript 1.12.2
|
8162 | (function() {
|
8163 | var getNanoSeconds, hrtime, loadTime, moduleLoadTime, nodeLoadTime, upTime;
|
8164 |
|
8165 | if ((typeof performance !== "undefined" && performance !== null) && performance.now) {
|
8166 | module.exports = function() {
|
8167 | return performance.now();
|
8168 | };
|
8169 | } else if ((typeof process !== "undefined" && process !== null) && process.hrtime) {
|
8170 | module.exports = function() {
|
8171 | return (getNanoSeconds() - nodeLoadTime) / 1e6;
|
8172 | };
|
8173 | hrtime = process.hrtime;
|
8174 | getNanoSeconds = function() {
|
8175 | var hr;
|
8176 | hr = hrtime();
|
8177 | return hr[0] * 1e9 + hr[1];
|
8178 | };
|
8179 | moduleLoadTime = getNanoSeconds();
|
8180 | upTime = process.uptime() * 1e9;
|
8181 | nodeLoadTime = moduleLoadTime - upTime;
|
8182 | } else if (Date.now) {
|
8183 | module.exports = function() {
|
8184 | return Date.now() - loadTime;
|
8185 | };
|
8186 | loadTime = Date.now();
|
8187 | } else {
|
8188 | module.exports = function() {
|
8189 | return new Date().getTime() - loadTime;
|
8190 | };
|
8191 | loadTime = new Date().getTime();
|
8192 | }
|
8193 |
|
8194 | }).call(commonjsGlobal);
|
8195 |
|
8196 |
|
8197 | });
|
8198 |
|
8199 | var root = typeof window === 'undefined' ? commonjsGlobal : window
|
8200 | , vendors = ['moz', 'webkit']
|
8201 | , suffix = 'AnimationFrame'
|
8202 | , raf = root['request' + suffix]
|
8203 | , caf = root['cancel' + suffix] || root['cancelRequest' + suffix];
|
8204 |
|
8205 | for(var i = 0; !raf && i < vendors.length; i++) {
|
8206 | raf = root[vendors[i] + 'Request' + suffix];
|
8207 | caf = root[vendors[i] + 'Cancel' + suffix]
|
8208 | || root[vendors[i] + 'CancelRequest' + suffix];
|
8209 | }
|
8210 |
|
8211 | // Some versions of FF have rAF but not cAF
|
8212 | if(!raf || !caf) {
|
8213 | var last = 0
|
8214 | , id = 0
|
8215 | , queue = []
|
8216 | , frameDuration = 1000 / 60;
|
8217 |
|
8218 | raf = function(callback) {
|
8219 | if(queue.length === 0) {
|
8220 | var _now = performanceNow()
|
8221 | , next = Math.max(0, frameDuration - (_now - last));
|
8222 | last = next + _now;
|
8223 | setTimeout(function() {
|
8224 | var cp = queue.slice(0);
|
8225 | // Clear queue here to prevent
|
8226 | // callbacks from appending listeners
|
8227 | // to the current frame's queue
|
8228 | queue.length = 0;
|
8229 | for(var i = 0; i < cp.length; i++) {
|
8230 | if(!cp[i].cancelled) {
|
8231 | try{
|
8232 | cp[i].callback(last);
|
8233 | } catch(e) {
|
8234 | setTimeout(function() { throw e }, 0);
|
8235 | }
|
8236 | }
|
8237 | }
|
8238 | }, Math.round(next));
|
8239 | }
|
8240 | queue.push({
|
8241 | handle: ++id,
|
8242 | callback: callback,
|
8243 | cancelled: false
|
8244 | });
|
8245 | return id
|
8246 | };
|
8247 |
|
8248 | caf = function(handle) {
|
8249 | for(var i = 0; i < queue.length; i++) {
|
8250 | if(queue[i].handle === handle) {
|
8251 | queue[i].cancelled = true;
|
8252 | }
|
8253 | }
|
8254 | };
|
8255 | }
|
8256 |
|
8257 | var raf_1 = function(fn) {
|
8258 | // Wrap in a new function to prevent
|
8259 | // `cancel` potentially being assigned
|
8260 | // to the native rAF function
|
8261 | return raf.call(root, fn)
|
8262 | };
|
8263 | var cancel = function() {
|
8264 | caf.apply(root, arguments);
|
8265 | };
|
8266 | var polyfill = function(object) {
|
8267 | if (!object) {
|
8268 | object = root;
|
8269 | }
|
8270 | object.requestAnimationFrame = raf;
|
8271 | object.cancelAnimationFrame = caf;
|
8272 | };
|
8273 | raf_1.cancel = cancel;
|
8274 | raf_1.polyfill = polyfill;
|
8275 |
|
8276 | var AutosizeInput_1 = createCommonjsModule(function (module, exports) {
|
8277 |
|
8278 | Object.defineProperty(exports, "__esModule", {
|
8279 | value: true
|
8280 | });
|
8281 |
|
8282 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
8283 |
|
8284 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
8285 |
|
8286 |
|
8287 |
|
8288 | var _react2 = _interopRequireDefault(React);
|
8289 |
|
8290 |
|
8291 |
|
8292 | var _propTypes2 = _interopRequireDefault(PropTypes);
|
8293 |
|
8294 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
8295 |
|
8296 | function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
8297 |
|
8298 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
8299 |
|
8300 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
8301 |
|
8302 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
8303 |
|
8304 | var sizerStyle = {
|
8305 | position: 'absolute',
|
8306 | top: 0,
|
8307 | left: 0,
|
8308 | visibility: 'hidden',
|
8309 | height: 0,
|
8310 | overflow: 'scroll',
|
8311 | whiteSpace: 'pre'
|
8312 | };
|
8313 |
|
8314 | var INPUT_PROPS_BLACKLIST = ['extraWidth', 'injectStyles', 'inputClassName', 'inputRef', 'inputStyle', 'minWidth', 'onAutosize', 'placeholderIsMinWidth'];
|
8315 |
|
8316 | var cleanInputProps = function cleanInputProps(inputProps) {
|
8317 | INPUT_PROPS_BLACKLIST.forEach(function (field) {
|
8318 | return delete inputProps[field];
|
8319 | });
|
8320 | return inputProps;
|
8321 | };
|
8322 |
|
8323 | var copyStyles = function copyStyles(styles, node) {
|
8324 | node.style.fontSize = styles.fontSize;
|
8325 | node.style.fontFamily = styles.fontFamily;
|
8326 | node.style.fontWeight = styles.fontWeight;
|
8327 | node.style.fontStyle = styles.fontStyle;
|
8328 | node.style.letterSpacing = styles.letterSpacing;
|
8329 | node.style.textTransform = styles.textTransform;
|
8330 | };
|
8331 |
|
8332 | var isIE = typeof window !== 'undefined' && window.navigator ? /MSIE |Trident\/|Edge\//.test(window.navigator.userAgent) : false;
|
8333 |
|
8334 | var generateId = function generateId() {
|
8335 | // we only need an auto-generated ID for stylesheet injection, which is only
|
8336 | // used for IE. so if the browser is not IE, this should return undefined.
|
8337 | return isIE ? '_' + Math.random().toString(36).substr(2, 12) : undefined;
|
8338 | };
|
8339 |
|
8340 | var AutosizeInput = function (_Component) {
|
8341 | _inherits(AutosizeInput, _Component);
|
8342 |
|
8343 | function AutosizeInput(props) {
|
8344 | _classCallCheck(this, AutosizeInput);
|
8345 |
|
8346 | var _this = _possibleConstructorReturn(this, (AutosizeInput.__proto__ || Object.getPrototypeOf(AutosizeInput)).call(this, props));
|
8347 |
|
8348 | _this.inputRef = function (el) {
|
8349 | _this.input = el;
|
8350 | if (typeof _this.props.inputRef === 'function') {
|
8351 | _this.props.inputRef(el);
|
8352 | }
|
8353 | };
|
8354 |
|
8355 | _this.placeHolderSizerRef = function (el) {
|
8356 | _this.placeHolderSizer = el;
|
8357 | };
|
8358 |
|
8359 | _this.sizerRef = function (el) {
|
8360 | _this.sizer = el;
|
8361 | };
|
8362 |
|
8363 | _this.state = {
|
8364 | inputWidth: props.minWidth,
|
8365 | inputId: props.id || generateId()
|
8366 | };
|
8367 | return _this;
|
8368 | }
|
8369 |
|
8370 | _createClass(AutosizeInput, [{
|
8371 | key: 'componentDidMount',
|
8372 | value: function componentDidMount() {
|
8373 | this.mounted = true;
|
8374 | this.copyInputStyles();
|
8375 | this.updateInputWidth();
|
8376 | }
|
8377 | }, {
|
8378 | key: 'componentWillReceiveProps',
|
8379 | value: function componentWillReceiveProps(nextProps) {
|
8380 | var id = nextProps.id;
|
8381 |
|
8382 | if (id !== this.props.id) {
|
8383 | this.setState({ inputId: id || generateId() });
|
8384 | }
|
8385 | }
|
8386 | }, {
|
8387 | key: 'componentDidUpdate',
|
8388 | value: function componentDidUpdate(prevProps, prevState) {
|
8389 | if (prevState.inputWidth !== this.state.inputWidth) {
|
8390 | if (typeof this.props.onAutosize === 'function') {
|
8391 | this.props.onAutosize(this.state.inputWidth);
|
8392 | }
|
8393 | }
|
8394 | this.updateInputWidth();
|
8395 | }
|
8396 | }, {
|
8397 | key: 'componentWillUnmount',
|
8398 | value: function componentWillUnmount() {
|
8399 | this.mounted = false;
|
8400 | }
|
8401 | }, {
|
8402 | key: 'copyInputStyles',
|
8403 | value: function copyInputStyles() {
|
8404 | if (!this.mounted || !window.getComputedStyle) {
|
8405 | return;
|
8406 | }
|
8407 | var inputStyles = this.input && window.getComputedStyle(this.input);
|
8408 | if (!inputStyles) {
|
8409 | return;
|
8410 | }
|
8411 | copyStyles(inputStyles, this.sizer);
|
8412 | if (this.placeHolderSizer) {
|
8413 | copyStyles(inputStyles, this.placeHolderSizer);
|
8414 | }
|
8415 | }
|
8416 | }, {
|
8417 | key: 'updateInputWidth',
|
8418 | value: function updateInputWidth() {
|
8419 | if (!this.mounted || !this.sizer || typeof this.sizer.scrollWidth === 'undefined') {
|
8420 | return;
|
8421 | }
|
8422 | var newInputWidth = void 0;
|
8423 | if (this.props.placeholder && (!this.props.value || this.props.value && this.props.placeholderIsMinWidth)) {
|
8424 | newInputWidth = Math.max(this.sizer.scrollWidth, this.placeHolderSizer.scrollWidth) + 2;
|
8425 | } else {
|
8426 | newInputWidth = this.sizer.scrollWidth + 2;
|
8427 | }
|
8428 | // add extraWidth to the detected width. for number types, this defaults to 16 to allow for the stepper UI
|
8429 | var extraWidth = this.props.type === 'number' && this.props.extraWidth === undefined ? 16 : parseInt(this.props.extraWidth) || 0;
|
8430 | newInputWidth += extraWidth;
|
8431 | if (newInputWidth < this.props.minWidth) {
|
8432 | newInputWidth = this.props.minWidth;
|
8433 | }
|
8434 | if (newInputWidth !== this.state.inputWidth) {
|
8435 | this.setState({
|
8436 | inputWidth: newInputWidth
|
8437 | });
|
8438 | }
|
8439 | }
|
8440 | }, {
|
8441 | key: 'getInput',
|
8442 | value: function getInput() {
|
8443 | return this.input;
|
8444 | }
|
8445 | }, {
|
8446 | key: 'focus',
|
8447 | value: function focus() {
|
8448 | this.input.focus();
|
8449 | }
|
8450 | }, {
|
8451 | key: 'blur',
|
8452 | value: function blur() {
|
8453 | this.input.blur();
|
8454 | }
|
8455 | }, {
|
8456 | key: 'select',
|
8457 | value: function select() {
|
8458 | this.input.select();
|
8459 | }
|
8460 | }, {
|
8461 | key: 'renderStyles',
|
8462 | value: function renderStyles() {
|
8463 | // this method injects styles to hide IE's clear indicator, which messes
|
8464 | // with input size detection. the stylesheet is only injected when the
|
8465 | // browser is IE, and can also be disabled by the `injectStyles` prop.
|
8466 | var injectStyles = this.props.injectStyles;
|
8467 |
|
8468 | return isIE && injectStyles ? _react2.default.createElement('style', { dangerouslySetInnerHTML: {
|
8469 | __html: 'input#' + this.state.inputId + '::-ms-clear {display: none;}'
|
8470 | } }) : null;
|
8471 | }
|
8472 | }, {
|
8473 | key: 'render',
|
8474 | value: function render() {
|
8475 | var sizerValue = [this.props.defaultValue, this.props.value, ''].reduce(function (previousValue, currentValue) {
|
8476 | if (previousValue !== null && previousValue !== undefined) {
|
8477 | return previousValue;
|
8478 | }
|
8479 | return currentValue;
|
8480 | });
|
8481 |
|
8482 | var wrapperStyle = _extends({}, this.props.style);
|
8483 | if (!wrapperStyle.display) wrapperStyle.display = 'inline-block';
|
8484 |
|
8485 | var inputStyle = _extends({
|
8486 | boxSizing: 'content-box',
|
8487 | width: this.state.inputWidth + 'px'
|
8488 | }, this.props.inputStyle);
|
8489 |
|
8490 | var inputProps = _objectWithoutProperties(this.props, []);
|
8491 |
|
8492 | cleanInputProps(inputProps);
|
8493 | inputProps.className = this.props.inputClassName;
|
8494 | inputProps.id = this.state.inputId;
|
8495 | inputProps.style = inputStyle;
|
8496 |
|
8497 | return _react2.default.createElement(
|
8498 | 'div',
|
8499 | { className: this.props.className, style: wrapperStyle },
|
8500 | this.renderStyles(),
|
8501 | _react2.default.createElement('input', _extends({}, inputProps, { ref: this.inputRef })),
|
8502 | _react2.default.createElement(
|
8503 | 'div',
|
8504 | { ref: this.sizerRef, style: sizerStyle },
|
8505 | sizerValue
|
8506 | ),
|
8507 | this.props.placeholder ? _react2.default.createElement(
|
8508 | 'div',
|
8509 | { ref: this.placeHolderSizerRef, style: sizerStyle },
|
8510 | this.props.placeholder
|
8511 | ) : null
|
8512 | );
|
8513 | }
|
8514 | }]);
|
8515 |
|
8516 | return AutosizeInput;
|
8517 | }(React.Component);
|
8518 |
|
8519 | AutosizeInput.propTypes = {
|
8520 | className: _propTypes2.default.string, // className for the outer element
|
8521 | defaultValue: _propTypes2.default.any, // default field value
|
8522 | extraWidth: _propTypes2.default.oneOfType([// additional width for input element
|
8523 | _propTypes2.default.number, _propTypes2.default.string]),
|
8524 | id: _propTypes2.default.string, // id to use for the input, can be set for consistent snapshots
|
8525 | injectStyles: _propTypes2.default.bool, // inject the custom stylesheet to hide clear UI, defaults to true
|
8526 | inputClassName: _propTypes2.default.string, // className for the input element
|
8527 | inputRef: _propTypes2.default.func, // ref callback for the input element
|
8528 | inputStyle: _propTypes2.default.object, // css styles for the input element
|
8529 | minWidth: _propTypes2.default.oneOfType([// minimum width for input element
|
8530 | _propTypes2.default.number, _propTypes2.default.string]),
|
8531 | onAutosize: _propTypes2.default.func, // onAutosize handler: function(newWidth) {}
|
8532 | onChange: _propTypes2.default.func, // onChange handler: function(event) {}
|
8533 | placeholder: _propTypes2.default.string, // placeholder text
|
8534 | placeholderIsMinWidth: _propTypes2.default.bool, // don't collapse size to less than the placeholder
|
8535 | style: _propTypes2.default.object, // css styles for the outer element
|
8536 | value: _propTypes2.default.any // field value
|
8537 | };
|
8538 | AutosizeInput.defaultProps = {
|
8539 | minWidth: 1,
|
8540 | injectStyles: true
|
8541 | };
|
8542 |
|
8543 | exports.default = AutosizeInput;
|
8544 | });
|
8545 |
|
8546 | var AutosizeInput = unwrapExports(AutosizeInput_1);
|
8547 |
|
8548 | var interopRequireDefault = createCommonjsModule(function (module) {
|
8549 | function _interopRequireDefault(obj) {
|
8550 | return obj && obj.__esModule ? obj : {
|
8551 | "default": obj
|
8552 | };
|
8553 | }
|
8554 |
|
8555 | module.exports = _interopRequireDefault;
|
8556 | });
|
8557 |
|
8558 | unwrapExports(interopRequireDefault);
|
8559 |
|
8560 | var hasClass_1 = createCommonjsModule(function (module, exports) {
|
8561 |
|
8562 | exports.__esModule = true;
|
8563 | exports.default = hasClass;
|
8564 |
|
8565 | function hasClass(element, className) {
|
8566 | if (element.classList) return !!className && element.classList.contains(className);else return (" " + (element.className.baseVal || element.className) + " ").indexOf(" " + className + " ") !== -1;
|
8567 | }
|
8568 |
|
8569 | module.exports = exports["default"];
|
8570 | });
|
8571 |
|
8572 | unwrapExports(hasClass_1);
|
8573 |
|
8574 | var addClass_1 = createCommonjsModule(function (module, exports) {
|
8575 |
|
8576 |
|
8577 |
|
8578 | exports.__esModule = true;
|
8579 | exports.default = addClass;
|
8580 |
|
8581 | var _hasClass = interopRequireDefault(hasClass_1);
|
8582 |
|
8583 | function addClass(element, className) {
|
8584 | if (element.classList) element.classList.add(className);else if (!(0, _hasClass.default)(element, className)) if (typeof element.className === 'string') element.className = element.className + ' ' + className;else element.setAttribute('class', (element.className && element.className.baseVal || '') + ' ' + className);
|
8585 | }
|
8586 |
|
8587 | module.exports = exports["default"];
|
8588 | });
|
8589 |
|
8590 | unwrapExports(addClass_1);
|
8591 |
|
8592 | function replaceClassName(origClass, classToRemove) {
|
8593 | return origClass.replace(new RegExp('(^|\\s)' + classToRemove + '(?:\\s|$)', 'g'), '$1').replace(/\s+/g, ' ').replace(/^\s*|\s*$/g, '');
|
8594 | }
|
8595 |
|
8596 | var removeClass = function removeClass(element, className) {
|
8597 | if (element.classList) element.classList.remove(className);else if (typeof element.className === 'string') element.className = replaceClassName(element.className, className);else element.setAttribute('class', replaceClassName(element.className && element.className.baseVal || '', className));
|
8598 | };
|
8599 |
|
8600 | /**
|
8601 | * Copyright (c) 2013-present, Facebook, Inc.
|
8602 | *
|
8603 | * This source code is licensed under the MIT license found in the
|
8604 | * LICENSE file in the root directory of this source tree.
|
8605 | */
|
8606 |
|
8607 | function componentWillMount() {
|
8608 | // Call this.constructor.gDSFP to support sub-classes.
|
8609 | var state = this.constructor.getDerivedStateFromProps(this.props, this.state);
|
8610 | if (state !== null && state !== undefined) {
|
8611 | this.setState(state);
|
8612 | }
|
8613 | }
|
8614 |
|
8615 | function componentWillReceiveProps(nextProps) {
|
8616 | // Call this.constructor.gDSFP to support sub-classes.
|
8617 | // Use the setState() updater to ensure state isn't stale in certain edge cases.
|
8618 | function updater(prevState) {
|
8619 | var state = this.constructor.getDerivedStateFromProps(nextProps, prevState);
|
8620 | return state !== null && state !== undefined ? state : null;
|
8621 | }
|
8622 | // Binding "this" is important for shallow renderer support.
|
8623 | this.setState(updater.bind(this));
|
8624 | }
|
8625 |
|
8626 | function componentWillUpdate(nextProps, nextState) {
|
8627 | try {
|
8628 | var prevProps = this.props;
|
8629 | var prevState = this.state;
|
8630 | this.props = nextProps;
|
8631 | this.state = nextState;
|
8632 | this.__reactInternalSnapshotFlag = true;
|
8633 | this.__reactInternalSnapshot = this.getSnapshotBeforeUpdate(
|
8634 | prevProps,
|
8635 | prevState
|
8636 | );
|
8637 | } finally {
|
8638 | this.props = prevProps;
|
8639 | this.state = prevState;
|
8640 | }
|
8641 | }
|
8642 |
|
8643 | // React may warn about cWM/cWRP/cWU methods being deprecated.
|
8644 | // Add a flag to suppress these warnings for this special case.
|
8645 | componentWillMount.__suppressDeprecationWarning = true;
|
8646 | componentWillReceiveProps.__suppressDeprecationWarning = true;
|
8647 | componentWillUpdate.__suppressDeprecationWarning = true;
|
8648 |
|
8649 | function polyfill$1(Component$$1) {
|
8650 | var prototype = Component$$1.prototype;
|
8651 |
|
8652 | if (!prototype || !prototype.isReactComponent) {
|
8653 | throw new Error('Can only polyfill class components');
|
8654 | }
|
8655 |
|
8656 | if (
|
8657 | typeof Component$$1.getDerivedStateFromProps !== 'function' &&
|
8658 | typeof prototype.getSnapshotBeforeUpdate !== 'function'
|
8659 | ) {
|
8660 | return Component$$1;
|
8661 | }
|
8662 |
|
8663 | // If new component APIs are defined, "unsafe" lifecycles won't be called.
|
8664 | // Error if any of these lifecycles are present,
|
8665 | // Because they would work differently between older and newer (16.3+) versions of React.
|
8666 | var foundWillMountName = null;
|
8667 | var foundWillReceivePropsName = null;
|
8668 | var foundWillUpdateName = null;
|
8669 | if (typeof prototype.componentWillMount === 'function') {
|
8670 | foundWillMountName = 'componentWillMount';
|
8671 | } else if (typeof prototype.UNSAFE_componentWillMount === 'function') {
|
8672 | foundWillMountName = 'UNSAFE_componentWillMount';
|
8673 | }
|
8674 | if (typeof prototype.componentWillReceiveProps === 'function') {
|
8675 | foundWillReceivePropsName = 'componentWillReceiveProps';
|
8676 | } else if (typeof prototype.UNSAFE_componentWillReceiveProps === 'function') {
|
8677 | foundWillReceivePropsName = 'UNSAFE_componentWillReceiveProps';
|
8678 | }
|
8679 | if (typeof prototype.componentWillUpdate === 'function') {
|
8680 | foundWillUpdateName = 'componentWillUpdate';
|
8681 | } else if (typeof prototype.UNSAFE_componentWillUpdate === 'function') {
|
8682 | foundWillUpdateName = 'UNSAFE_componentWillUpdate';
|
8683 | }
|
8684 | if (
|
8685 | foundWillMountName !== null ||
|
8686 | foundWillReceivePropsName !== null ||
|
8687 | foundWillUpdateName !== null
|
8688 | ) {
|
8689 | var componentName = Component$$1.displayName || Component$$1.name;
|
8690 | var newApiName =
|
8691 | typeof Component$$1.getDerivedStateFromProps === 'function'
|
8692 | ? 'getDerivedStateFromProps()'
|
8693 | : 'getSnapshotBeforeUpdate()';
|
8694 |
|
8695 | throw Error(
|
8696 | 'Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n' +
|
8697 | componentName +
|
8698 | ' uses ' +
|
8699 | newApiName +
|
8700 | ' but also contains the following legacy lifecycles:' +
|
8701 | (foundWillMountName !== null ? '\n ' + foundWillMountName : '') +
|
8702 | (foundWillReceivePropsName !== null
|
8703 | ? '\n ' + foundWillReceivePropsName
|
8704 | : '') +
|
8705 | (foundWillUpdateName !== null ? '\n ' + foundWillUpdateName : '') +
|
8706 | '\n\nThe above lifecycles should be removed. Learn more about this warning here:\n' +
|
8707 | 'https://fb.me/react-async-component-lifecycle-hooks'
|
8708 | );
|
8709 | }
|
8710 |
|
8711 | // React <= 16.2 does not support static getDerivedStateFromProps.
|
8712 | // As a workaround, use cWM and cWRP to invoke the new static lifecycle.
|
8713 | // Newer versions of React will ignore these lifecycles if gDSFP exists.
|
8714 | if (typeof Component$$1.getDerivedStateFromProps === 'function') {
|
8715 | prototype.componentWillMount = componentWillMount;
|
8716 | prototype.componentWillReceiveProps = componentWillReceiveProps;
|
8717 | }
|
8718 |
|
8719 | // React <= 16.2 does not support getSnapshotBeforeUpdate.
|
8720 | // As a workaround, use cWU to invoke the new lifecycle.
|
8721 | // Newer versions of React will ignore that lifecycle if gSBU exists.
|
8722 | if (typeof prototype.getSnapshotBeforeUpdate === 'function') {
|
8723 | if (typeof prototype.componentDidUpdate !== 'function') {
|
8724 | throw new Error(
|
8725 | 'Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype'
|
8726 | );
|
8727 | }
|
8728 |
|
8729 | prototype.componentWillUpdate = componentWillUpdate;
|
8730 |
|
8731 | var componentDidUpdate = prototype.componentDidUpdate;
|
8732 |
|
8733 | prototype.componentDidUpdate = function componentDidUpdatePolyfill(
|
8734 | prevProps,
|
8735 | prevState,
|
8736 | maybeSnapshot
|
8737 | ) {
|
8738 | // 16.3+ will not execute our will-update method;
|
8739 | // It will pass a snapshot value to did-update though.
|
8740 | // Older versions will require our polyfilled will-update value.
|
8741 | // We need to handle both cases, but can't just check for the presence of "maybeSnapshot",
|
8742 | // Because for <= 15.x versions this might be a "prevContext" object.
|
8743 | // We also can't just check "__reactInternalSnapshot",
|
8744 | // Because get-snapshot might return a falsy value.
|
8745 | // So check for the explicit __reactInternalSnapshotFlag flag to determine behavior.
|
8746 | var snapshot = this.__reactInternalSnapshotFlag
|
8747 | ? this.__reactInternalSnapshot
|
8748 | : maybeSnapshot;
|
8749 |
|
8750 | componentDidUpdate.call(this, prevProps, prevState, snapshot);
|
8751 | };
|
8752 | }
|
8753 |
|
8754 | return Component$$1;
|
8755 | }
|
8756 |
|
8757 | var reactLifecyclesCompat_es = /*#__PURE__*/Object.freeze({
|
8758 | polyfill: polyfill$1
|
8759 | });
|
8760 |
|
8761 | var PropTypes$1 = createCommonjsModule(function (module, exports) {
|
8762 |
|
8763 | exports.__esModule = true;
|
8764 | exports.classNamesShape = exports.timeoutsShape = void 0;
|
8765 |
|
8766 | var _propTypes = _interopRequireDefault(PropTypes);
|
8767 |
|
8768 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
8769 |
|
8770 | var timeoutsShape = process.env.NODE_ENV !== 'production' ? _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.shape({
|
8771 | enter: _propTypes.default.number,
|
8772 | exit: _propTypes.default.number,
|
8773 | appear: _propTypes.default.number
|
8774 | }).isRequired]) : null;
|
8775 | exports.timeoutsShape = timeoutsShape;
|
8776 | var classNamesShape = process.env.NODE_ENV !== 'production' ? _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.shape({
|
8777 | enter: _propTypes.default.string,
|
8778 | exit: _propTypes.default.string,
|
8779 | active: _propTypes.default.string
|
8780 | }), _propTypes.default.shape({
|
8781 | enter: _propTypes.default.string,
|
8782 | enterDone: _propTypes.default.string,
|
8783 | enterActive: _propTypes.default.string,
|
8784 | exit: _propTypes.default.string,
|
8785 | exitDone: _propTypes.default.string,
|
8786 | exitActive: _propTypes.default.string
|
8787 | })]) : null;
|
8788 | exports.classNamesShape = classNamesShape;
|
8789 | });
|
8790 |
|
8791 | unwrapExports(PropTypes$1);
|
8792 | var PropTypes_1 = PropTypes$1.classNamesShape;
|
8793 | var PropTypes_2 = PropTypes$1.timeoutsShape;
|
8794 |
|
8795 | var Transition_1 = createCommonjsModule(function (module, exports) {
|
8796 |
|
8797 | exports.__esModule = true;
|
8798 | exports.default = exports.EXITING = exports.ENTERED = exports.ENTERING = exports.EXITED = exports.UNMOUNTED = void 0;
|
8799 |
|
8800 | var PropTypes$$1 = _interopRequireWildcard(PropTypes);
|
8801 |
|
8802 | var _react = _interopRequireDefault(React);
|
8803 |
|
8804 | var _reactDom = _interopRequireDefault(reactDom);
|
8805 |
|
8806 |
|
8807 |
|
8808 |
|
8809 |
|
8810 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
8811 |
|
8812 | function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
8813 |
|
8814 | function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
8815 |
|
8816 | function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
8817 |
|
8818 | var UNMOUNTED = 'unmounted';
|
8819 | exports.UNMOUNTED = UNMOUNTED;
|
8820 | var EXITED = 'exited';
|
8821 | exports.EXITED = EXITED;
|
8822 | var ENTERING = 'entering';
|
8823 | exports.ENTERING = ENTERING;
|
8824 | var ENTERED = 'entered';
|
8825 | exports.ENTERED = ENTERED;
|
8826 | var EXITING = 'exiting';
|
8827 | /**
|
8828 | * The Transition component lets you describe a transition from one component
|
8829 | * state to another _over time_ with a simple declarative API. Most commonly
|
8830 | * it's used to animate the mounting and unmounting of a component, but can also
|
8831 | * be used to describe in-place transition states as well.
|
8832 | *
|
8833 | * ---
|
8834 | *
|
8835 | * **Note**: `Transition` is a platform-agnostic base component. If you're using
|
8836 | * transitions in CSS, you'll probably want to use
|
8837 | * [`CSSTransition`](https://reactcommunity.org/react-transition-group/css-transition)
|
8838 | * instead. It inherits all the features of `Transition`, but contains
|
8839 | * additional features necessary to play nice with CSS transitions (hence the
|
8840 | * name of the component).
|
8841 | *
|
8842 | * ---
|
8843 | *
|
8844 | * By default the `Transition` component does not alter the behavior of the
|
8845 | * component it renders, it only tracks "enter" and "exit" states for the
|
8846 | * components. It's up to you to give meaning and effect to those states. For
|
8847 | * example we can add styles to a component when it enters or exits:
|
8848 | *
|
8849 | * ```jsx
|
8850 | * import { Transition } from 'react-transition-group';
|
8851 | *
|
8852 | * const duration = 300;
|
8853 | *
|
8854 | * const defaultStyle = {
|
8855 | * transition: `opacity ${duration}ms ease-in-out`,
|
8856 | * opacity: 0,
|
8857 | * }
|
8858 | *
|
8859 | * const transitionStyles = {
|
8860 | * entering: { opacity: 0 },
|
8861 | * entered: { opacity: 1 },
|
8862 | * };
|
8863 | *
|
8864 | * const Fade = ({ in: inProp }) => (
|
8865 | * <Transition in={inProp} timeout={duration}>
|
8866 | * {state => (
|
8867 | * <div style={{
|
8868 | * ...defaultStyle,
|
8869 | * ...transitionStyles[state]
|
8870 | * }}>
|
8871 | * I'm a fade Transition!
|
8872 | * </div>
|
8873 | * )}
|
8874 | * </Transition>
|
8875 | * );
|
8876 | * ```
|
8877 | *
|
8878 | * There are 4 main states a Transition can be in:
|
8879 | * - `'entering'`
|
8880 | * - `'entered'`
|
8881 | * - `'exiting'`
|
8882 | * - `'exited'`
|
8883 | *
|
8884 | * Transition state is toggled via the `in` prop. When `true` the component
|
8885 | * begins the "Enter" stage. During this stage, the component will shift from
|
8886 | * its current transition state, to `'entering'` for the duration of the
|
8887 | * transition and then to the `'entered'` stage once it's complete. Let's take
|
8888 | * the following example (we'll use the
|
8889 | * [useState](https://reactjs.org/docs/hooks-reference.html#usestate) hook):
|
8890 | *
|
8891 | * ```jsx
|
8892 | * function App() {
|
8893 | * const [inProp, setInProp] = useState(false);
|
8894 | * return (
|
8895 | * <div>
|
8896 | * <Transition in={inProp} timeout={500}>
|
8897 | * {state => (
|
8898 | * // ...
|
8899 | * )}
|
8900 | * </Transition>
|
8901 | * <button onClick={() => setInProp(true)}>
|
8902 | * Click to Enter
|
8903 | * </button>
|
8904 | * </div>
|
8905 | * );
|
8906 | * }
|
8907 | * ```
|
8908 | *
|
8909 | * When the button is clicked the component will shift to the `'entering'` state
|
8910 | * and stay there for 500ms (the value of `timeout`) before it finally switches
|
8911 | * to `'entered'`.
|
8912 | *
|
8913 | * When `in` is `false` the same thing happens except the state moves from
|
8914 | * `'exiting'` to `'exited'`.
|
8915 | */
|
8916 |
|
8917 | exports.EXITING = EXITING;
|
8918 |
|
8919 | var Transition =
|
8920 | /*#__PURE__*/
|
8921 | function (_React$Component) {
|
8922 | _inheritsLoose(Transition, _React$Component);
|
8923 |
|
8924 | function Transition(props, context) {
|
8925 | var _this;
|
8926 |
|
8927 | _this = _React$Component.call(this, props, context) || this;
|
8928 | var parentGroup = context.transitionGroup; // In the context of a TransitionGroup all enters are really appears
|
8929 |
|
8930 | var appear = parentGroup && !parentGroup.isMounting ? props.enter : props.appear;
|
8931 | var initialStatus;
|
8932 | _this.appearStatus = null;
|
8933 |
|
8934 | if (props.in) {
|
8935 | if (appear) {
|
8936 | initialStatus = EXITED;
|
8937 | _this.appearStatus = ENTERING;
|
8938 | } else {
|
8939 | initialStatus = ENTERED;
|
8940 | }
|
8941 | } else {
|
8942 | if (props.unmountOnExit || props.mountOnEnter) {
|
8943 | initialStatus = UNMOUNTED;
|
8944 | } else {
|
8945 | initialStatus = EXITED;
|
8946 | }
|
8947 | }
|
8948 |
|
8949 | _this.state = {
|
8950 | status: initialStatus
|
8951 | };
|
8952 | _this.nextCallback = null;
|
8953 | return _this;
|
8954 | }
|
8955 |
|
8956 | var _proto = Transition.prototype;
|
8957 |
|
8958 | _proto.getChildContext = function getChildContext() {
|
8959 | return {
|
8960 | transitionGroup: null // allows for nested Transitions
|
8961 |
|
8962 | };
|
8963 | };
|
8964 |
|
8965 | Transition.getDerivedStateFromProps = function getDerivedStateFromProps(_ref, prevState) {
|
8966 | var nextIn = _ref.in;
|
8967 |
|
8968 | if (nextIn && prevState.status === UNMOUNTED) {
|
8969 | return {
|
8970 | status: EXITED
|
8971 | };
|
8972 | }
|
8973 |
|
8974 | return null;
|
8975 | }; // getSnapshotBeforeUpdate(prevProps) {
|
8976 | // let nextStatus = null
|
8977 | // if (prevProps !== this.props) {
|
8978 | // const { status } = this.state
|
8979 | // if (this.props.in) {
|
8980 | // if (status !== ENTERING && status !== ENTERED) {
|
8981 | // nextStatus = ENTERING
|
8982 | // }
|
8983 | // } else {
|
8984 | // if (status === ENTERING || status === ENTERED) {
|
8985 | // nextStatus = EXITING
|
8986 | // }
|
8987 | // }
|
8988 | // }
|
8989 | // return { nextStatus }
|
8990 | // }
|
8991 |
|
8992 |
|
8993 | _proto.componentDidMount = function componentDidMount() {
|
8994 | this.updateStatus(true, this.appearStatus);
|
8995 | };
|
8996 |
|
8997 | _proto.componentDidUpdate = function componentDidUpdate(prevProps) {
|
8998 | var nextStatus = null;
|
8999 |
|
9000 | if (prevProps !== this.props) {
|
9001 | var status = this.state.status;
|
9002 |
|
9003 | if (this.props.in) {
|
9004 | if (status !== ENTERING && status !== ENTERED) {
|
9005 | nextStatus = ENTERING;
|
9006 | }
|
9007 | } else {
|
9008 | if (status === ENTERING || status === ENTERED) {
|
9009 | nextStatus = EXITING;
|
9010 | }
|
9011 | }
|
9012 | }
|
9013 |
|
9014 | this.updateStatus(false, nextStatus);
|
9015 | };
|
9016 |
|
9017 | _proto.componentWillUnmount = function componentWillUnmount() {
|
9018 | this.cancelNextCallback();
|
9019 | };
|
9020 |
|
9021 | _proto.getTimeouts = function getTimeouts() {
|
9022 | var timeout = this.props.timeout;
|
9023 | var exit, enter, appear;
|
9024 | exit = enter = appear = timeout;
|
9025 |
|
9026 | if (timeout != null && typeof timeout !== 'number') {
|
9027 | exit = timeout.exit;
|
9028 | enter = timeout.enter; // TODO: remove fallback for next major
|
9029 |
|
9030 | appear = timeout.appear !== undefined ? timeout.appear : enter;
|
9031 | }
|
9032 |
|
9033 | return {
|
9034 | exit: exit,
|
9035 | enter: enter,
|
9036 | appear: appear
|
9037 | };
|
9038 | };
|
9039 |
|
9040 | _proto.updateStatus = function updateStatus(mounting, nextStatus) {
|
9041 | if (mounting === void 0) {
|
9042 | mounting = false;
|
9043 | }
|
9044 |
|
9045 | if (nextStatus !== null) {
|
9046 | // nextStatus will always be ENTERING or EXITING.
|
9047 | this.cancelNextCallback();
|
9048 |
|
9049 | var node = _reactDom.default.findDOMNode(this);
|
9050 |
|
9051 | if (nextStatus === ENTERING) {
|
9052 | this.performEnter(node, mounting);
|
9053 | } else {
|
9054 | this.performExit(node);
|
9055 | }
|
9056 | } else if (this.props.unmountOnExit && this.state.status === EXITED) {
|
9057 | this.setState({
|
9058 | status: UNMOUNTED
|
9059 | });
|
9060 | }
|
9061 | };
|
9062 |
|
9063 | _proto.performEnter = function performEnter(node, mounting) {
|
9064 | var _this2 = this;
|
9065 |
|
9066 | var enter = this.props.enter;
|
9067 | var appearing = this.context.transitionGroup ? this.context.transitionGroup.isMounting : mounting;
|
9068 | var timeouts = this.getTimeouts();
|
9069 | var enterTimeout = appearing ? timeouts.appear : timeouts.enter; // no enter animation skip right to ENTERED
|
9070 | // if we are mounting and running this it means appear _must_ be set
|
9071 |
|
9072 | if (!mounting && !enter) {
|
9073 | this.safeSetState({
|
9074 | status: ENTERED
|
9075 | }, function () {
|
9076 | _this2.props.onEntered(node);
|
9077 | });
|
9078 | return;
|
9079 | }
|
9080 |
|
9081 | this.props.onEnter(node, appearing);
|
9082 | this.safeSetState({
|
9083 | status: ENTERING
|
9084 | }, function () {
|
9085 | _this2.props.onEntering(node, appearing);
|
9086 |
|
9087 | _this2.onTransitionEnd(node, enterTimeout, function () {
|
9088 | _this2.safeSetState({
|
9089 | status: ENTERED
|
9090 | }, function () {
|
9091 | _this2.props.onEntered(node, appearing);
|
9092 | });
|
9093 | });
|
9094 | });
|
9095 | };
|
9096 |
|
9097 | _proto.performExit = function performExit(node) {
|
9098 | var _this3 = this;
|
9099 |
|
9100 | var exit = this.props.exit;
|
9101 | var timeouts = this.getTimeouts(); // no exit animation skip right to EXITED
|
9102 |
|
9103 | if (!exit) {
|
9104 | this.safeSetState({
|
9105 | status: EXITED
|
9106 | }, function () {
|
9107 | _this3.props.onExited(node);
|
9108 | });
|
9109 | return;
|
9110 | }
|
9111 |
|
9112 | this.props.onExit(node);
|
9113 | this.safeSetState({
|
9114 | status: EXITING
|
9115 | }, function () {
|
9116 | _this3.props.onExiting(node);
|
9117 |
|
9118 | _this3.onTransitionEnd(node, timeouts.exit, function () {
|
9119 | _this3.safeSetState({
|
9120 | status: EXITED
|
9121 | }, function () {
|
9122 | _this3.props.onExited(node);
|
9123 | });
|
9124 | });
|
9125 | });
|
9126 | };
|
9127 |
|
9128 | _proto.cancelNextCallback = function cancelNextCallback() {
|
9129 | if (this.nextCallback !== null) {
|
9130 | this.nextCallback.cancel();
|
9131 | this.nextCallback = null;
|
9132 | }
|
9133 | };
|
9134 |
|
9135 | _proto.safeSetState = function safeSetState(nextState, callback) {
|
9136 | // This shouldn't be necessary, but there are weird race conditions with
|
9137 | // setState callbacks and unmounting in testing, so always make sure that
|
9138 | // we can cancel any pending setState callbacks after we unmount.
|
9139 | callback = this.setNextCallback(callback);
|
9140 | this.setState(nextState, callback);
|
9141 | };
|
9142 |
|
9143 | _proto.setNextCallback = function setNextCallback(callback) {
|
9144 | var _this4 = this;
|
9145 |
|
9146 | var active = true;
|
9147 |
|
9148 | this.nextCallback = function (event) {
|
9149 | if (active) {
|
9150 | active = false;
|
9151 | _this4.nextCallback = null;
|
9152 | callback(event);
|
9153 | }
|
9154 | };
|
9155 |
|
9156 | this.nextCallback.cancel = function () {
|
9157 | active = false;
|
9158 | };
|
9159 |
|
9160 | return this.nextCallback;
|
9161 | };
|
9162 |
|
9163 | _proto.onTransitionEnd = function onTransitionEnd(node, timeout, handler) {
|
9164 | this.setNextCallback(handler);
|
9165 | var doesNotHaveTimeoutOrListener = timeout == null && !this.props.addEndListener;
|
9166 |
|
9167 | if (!node || doesNotHaveTimeoutOrListener) {
|
9168 | setTimeout(this.nextCallback, 0);
|
9169 | return;
|
9170 | }
|
9171 |
|
9172 | if (this.props.addEndListener) {
|
9173 | this.props.addEndListener(node, this.nextCallback);
|
9174 | }
|
9175 |
|
9176 | if (timeout != null) {
|
9177 | setTimeout(this.nextCallback, timeout);
|
9178 | }
|
9179 | };
|
9180 |
|
9181 | _proto.render = function render() {
|
9182 | var status = this.state.status;
|
9183 |
|
9184 | if (status === UNMOUNTED) {
|
9185 | return null;
|
9186 | }
|
9187 |
|
9188 | var _this$props = this.props,
|
9189 | children = _this$props.children,
|
9190 | childProps = _objectWithoutPropertiesLoose(_this$props, ["children"]); // filter props for Transtition
|
9191 |
|
9192 |
|
9193 | delete childProps.in;
|
9194 | delete childProps.mountOnEnter;
|
9195 | delete childProps.unmountOnExit;
|
9196 | delete childProps.appear;
|
9197 | delete childProps.enter;
|
9198 | delete childProps.exit;
|
9199 | delete childProps.timeout;
|
9200 | delete childProps.addEndListener;
|
9201 | delete childProps.onEnter;
|
9202 | delete childProps.onEntering;
|
9203 | delete childProps.onEntered;
|
9204 | delete childProps.onExit;
|
9205 | delete childProps.onExiting;
|
9206 | delete childProps.onExited;
|
9207 |
|
9208 | if (typeof children === 'function') {
|
9209 | return children(status, childProps);
|
9210 | }
|
9211 |
|
9212 | var child = _react.default.Children.only(children);
|
9213 |
|
9214 | return _react.default.cloneElement(child, childProps);
|
9215 | };
|
9216 |
|
9217 | return Transition;
|
9218 | }(_react.default.Component);
|
9219 |
|
9220 | Transition.contextTypes = {
|
9221 | transitionGroup: PropTypes$$1.object
|
9222 | };
|
9223 | Transition.childContextTypes = {
|
9224 | transitionGroup: function transitionGroup() {}
|
9225 | };
|
9226 | Transition.propTypes = process.env.NODE_ENV !== "production" ? {
|
9227 | /**
|
9228 | * A `function` child can be used instead of a React element. This function is
|
9229 | * called with the current transition status (`'entering'`, `'entered'`,
|
9230 | * `'exiting'`, `'exited'`, `'unmounted'`), which can be used to apply context
|
9231 | * specific props to a component.
|
9232 | *
|
9233 | * ```jsx
|
9234 | * <Transition in={this.state.in} timeout={150}>
|
9235 | * {state => (
|
9236 | * <MyComponent className={`fade fade-${state}`} />
|
9237 | * )}
|
9238 | * </Transition>
|
9239 | * ```
|
9240 | */
|
9241 | children: PropTypes$$1.oneOfType([PropTypes$$1.func.isRequired, PropTypes$$1.element.isRequired]).isRequired,
|
9242 |
|
9243 | /**
|
9244 | * Show the component; triggers the enter or exit states
|
9245 | */
|
9246 | in: PropTypes$$1.bool,
|
9247 |
|
9248 | /**
|
9249 | * By default the child component is mounted immediately along with
|
9250 | * the parent `Transition` component. If you want to "lazy mount" the component on the
|
9251 | * first `in={true}` you can set `mountOnEnter`. After the first enter transition the component will stay
|
9252 | * mounted, even on "exited", unless you also specify `unmountOnExit`.
|
9253 | */
|
9254 | mountOnEnter: PropTypes$$1.bool,
|
9255 |
|
9256 | /**
|
9257 | * By default the child component stays mounted after it reaches the `'exited'` state.
|
9258 | * Set `unmountOnExit` if you'd prefer to unmount the component after it finishes exiting.
|
9259 | */
|
9260 | unmountOnExit: PropTypes$$1.bool,
|
9261 |
|
9262 | /**
|
9263 | * Normally a component is not transitioned if it is shown when the `<Transition>` component mounts.
|
9264 | * If you want to transition on the first mount set `appear` to `true`, and the
|
9265 | * component will transition in as soon as the `<Transition>` mounts.
|
9266 | *
|
9267 | * > Note: there are no specific "appear" states. `appear` only adds an additional `enter` transition.
|
9268 | */
|
9269 | appear: PropTypes$$1.bool,
|
9270 |
|
9271 | /**
|
9272 | * Enable or disable enter transitions.
|
9273 | */
|
9274 | enter: PropTypes$$1.bool,
|
9275 |
|
9276 | /**
|
9277 | * Enable or disable exit transitions.
|
9278 | */
|
9279 | exit: PropTypes$$1.bool,
|
9280 |
|
9281 | /**
|
9282 | * The duration of the transition, in milliseconds.
|
9283 | * Required unless `addEndListener` is provided.
|
9284 | *
|
9285 | * You may specify a single timeout for all transitions:
|
9286 | *
|
9287 | * ```jsx
|
9288 | * timeout={500}
|
9289 | * ```
|
9290 | *
|
9291 | * or individually:
|
9292 | *
|
9293 | * ```jsx
|
9294 | * timeout={{
|
9295 | * appear: 500,
|
9296 | * enter: 300,
|
9297 | * exit: 500,
|
9298 | * }}
|
9299 | * ```
|
9300 | *
|
9301 | * - `appear` defaults to the value of `enter`
|
9302 | * - `enter` defaults to `0`
|
9303 | * - `exit` defaults to `0`
|
9304 | *
|
9305 | * @type {number | { enter?: number, exit?: number, appear?: number }}
|
9306 | */
|
9307 | timeout: function timeout(props) {
|
9308 | var pt = PropTypes$1.timeoutsShape;
|
9309 | if (!props.addEndListener) pt = pt.isRequired;
|
9310 |
|
9311 | for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
9312 | args[_key - 1] = arguments[_key];
|
9313 | }
|
9314 |
|
9315 | return pt.apply(void 0, [props].concat(args));
|
9316 | },
|
9317 |
|
9318 | /**
|
9319 | * Add a custom transition end trigger. Called with the transitioning
|
9320 | * DOM node and a `done` callback. Allows for more fine grained transition end
|
9321 | * logic. **Note:** Timeouts are still used as a fallback if provided.
|
9322 | *
|
9323 | * ```jsx
|
9324 | * addEndListener={(node, done) => {
|
9325 | * // use the css transitionend event to mark the finish of a transition
|
9326 | * node.addEventListener('transitionend', done, false);
|
9327 | * }}
|
9328 | * ```
|
9329 | */
|
9330 | addEndListener: PropTypes$$1.func,
|
9331 |
|
9332 | /**
|
9333 | * Callback fired before the "entering" status is applied. An extra parameter
|
9334 | * `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount
|
9335 | *
|
9336 | * @type Function(node: HtmlElement, isAppearing: bool) -> void
|
9337 | */
|
9338 | onEnter: PropTypes$$1.func,
|
9339 |
|
9340 | /**
|
9341 | * Callback fired after the "entering" status is applied. An extra parameter
|
9342 | * `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount
|
9343 | *
|
9344 | * @type Function(node: HtmlElement, isAppearing: bool)
|
9345 | */
|
9346 | onEntering: PropTypes$$1.func,
|
9347 |
|
9348 | /**
|
9349 | * Callback fired after the "entered" status is applied. An extra parameter
|
9350 | * `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount
|
9351 | *
|
9352 | * @type Function(node: HtmlElement, isAppearing: bool) -> void
|
9353 | */
|
9354 | onEntered: PropTypes$$1.func,
|
9355 |
|
9356 | /**
|
9357 | * Callback fired before the "exiting" status is applied.
|
9358 | *
|
9359 | * @type Function(node: HtmlElement) -> void
|
9360 | */
|
9361 | onExit: PropTypes$$1.func,
|
9362 |
|
9363 | /**
|
9364 | * Callback fired after the "exiting" status is applied.
|
9365 | *
|
9366 | * @type Function(node: HtmlElement) -> void
|
9367 | */
|
9368 | onExiting: PropTypes$$1.func,
|
9369 |
|
9370 | /**
|
9371 | * Callback fired after the "exited" status is applied.
|
9372 | *
|
9373 | * @type Function(node: HtmlElement) -> void
|
9374 | */
|
9375 | onExited: PropTypes$$1.func // Name the function so it is clearer in the documentation
|
9376 |
|
9377 | } : {};
|
9378 |
|
9379 | function noop() {}
|
9380 |
|
9381 | Transition.defaultProps = {
|
9382 | in: false,
|
9383 | mountOnEnter: false,
|
9384 | unmountOnExit: false,
|
9385 | appear: false,
|
9386 | enter: true,
|
9387 | exit: true,
|
9388 | onEnter: noop,
|
9389 | onEntering: noop,
|
9390 | onEntered: noop,
|
9391 | onExit: noop,
|
9392 | onExiting: noop,
|
9393 | onExited: noop
|
9394 | };
|
9395 | Transition.UNMOUNTED = 0;
|
9396 | Transition.EXITED = 1;
|
9397 | Transition.ENTERING = 2;
|
9398 | Transition.ENTERED = 3;
|
9399 | Transition.EXITING = 4;
|
9400 |
|
9401 | var _default = (0, reactLifecyclesCompat_es.polyfill)(Transition);
|
9402 |
|
9403 | exports.default = _default;
|
9404 | });
|
9405 |
|
9406 | unwrapExports(Transition_1);
|
9407 | var Transition_2 = Transition_1.EXITING;
|
9408 | var Transition_3 = Transition_1.ENTERED;
|
9409 | var Transition_4 = Transition_1.ENTERING;
|
9410 | var Transition_5 = Transition_1.EXITED;
|
9411 | var Transition_6 = Transition_1.UNMOUNTED;
|
9412 |
|
9413 | var CSSTransition_1 = createCommonjsModule(function (module, exports) {
|
9414 |
|
9415 | exports.__esModule = true;
|
9416 | exports.default = void 0;
|
9417 |
|
9418 | var PropTypes$$1 = _interopRequireWildcard(PropTypes);
|
9419 |
|
9420 | var _addClass = _interopRequireDefault(addClass_1);
|
9421 |
|
9422 | var _removeClass = _interopRequireDefault(removeClass);
|
9423 |
|
9424 | var _react = _interopRequireDefault(React);
|
9425 |
|
9426 | var _Transition = _interopRequireDefault(Transition_1);
|
9427 |
|
9428 |
|
9429 |
|
9430 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
9431 |
|
9432 | function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
9433 |
|
9434 | function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
9435 |
|
9436 | function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
9437 |
|
9438 | var addClass = function addClass(node, classes) {
|
9439 | return node && classes && classes.split(' ').forEach(function (c) {
|
9440 | return (0, _addClass.default)(node, c);
|
9441 | });
|
9442 | };
|
9443 |
|
9444 | var removeClass$$1 = function removeClass$$1(node, classes) {
|
9445 | return node && classes && classes.split(' ').forEach(function (c) {
|
9446 | return (0, _removeClass.default)(node, c);
|
9447 | });
|
9448 | };
|
9449 | /**
|
9450 | * A transition component inspired by the excellent
|
9451 | * [ng-animate](http://www.nganimate.org/) library, you should use it if you're
|
9452 | * using CSS transitions or animations. It's built upon the
|
9453 | * [`Transition`](https://reactcommunity.org/react-transition-group/transition)
|
9454 | * component, so it inherits all of its props.
|
9455 | *
|
9456 | * `CSSTransition` applies a pair of class names during the `appear`, `enter`,
|
9457 | * and `exit` states of the transition. The first class is applied and then a
|
9458 | * second `*-active` class in order to activate the CSSS transition. After the
|
9459 | * transition, matching `*-done` class names are applied to persist the
|
9460 | * transition state.
|
9461 | *
|
9462 | * ```jsx
|
9463 | * function App() {
|
9464 | * const [inProp, setInProp] = useState(false);
|
9465 | * return (
|
9466 | * <div>
|
9467 | * <CSSTransition in={inProp} timeout={200} classNames="my-node">
|
9468 | * <div>
|
9469 | * {"I'll receive my-node-* classes"}
|
9470 | * </div>
|
9471 | * </CSSTransition>
|
9472 | * <button type="button" onClick={() => setInProp(true)}>
|
9473 | * Click to Enter
|
9474 | * </button>
|
9475 | * </div>
|
9476 | * );
|
9477 | * }
|
9478 | * ```
|
9479 | *
|
9480 | * When the `in` prop is set to `true`, the child component will first receive
|
9481 | * the class `example-enter`, then the `example-enter-active` will be added in
|
9482 | * the next tick. `CSSTransition` [forces a
|
9483 | * reflow](https://github.com/reactjs/react-transition-group/blob/5007303e729a74be66a21c3e2205e4916821524b/src/CSSTransition.js#L208-L215)
|
9484 | * between before adding the `example-enter-active`. This is an important trick
|
9485 | * because it allows us to transition between `example-enter` and
|
9486 | * `example-enter-active` even though they were added immediately one after
|
9487 | * another. Most notably, this is what makes it possible for us to animate
|
9488 | * _appearance_.
|
9489 | *
|
9490 | * ```css
|
9491 | * .my-node-enter {
|
9492 | * opacity: 0;
|
9493 | * }
|
9494 | * .my-node-enter-active {
|
9495 | * opacity: 1;
|
9496 | * transition: opacity 200ms;
|
9497 | * }
|
9498 | * .my-node-exit {
|
9499 | * opacity: 1;
|
9500 | * }
|
9501 | * .my-node-exit-active {
|
9502 | * opacity: 0;
|
9503 | * transition: opacity: 200ms;
|
9504 | * }
|
9505 | * ```
|
9506 | *
|
9507 | * `*-active` classes represent which styles you want to animate **to**.
|
9508 | */
|
9509 |
|
9510 |
|
9511 | var CSSTransition =
|
9512 | /*#__PURE__*/
|
9513 | function (_React$Component) {
|
9514 | _inheritsLoose(CSSTransition, _React$Component);
|
9515 |
|
9516 | function CSSTransition() {
|
9517 | var _this;
|
9518 |
|
9519 | for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
9520 | args[_key] = arguments[_key];
|
9521 | }
|
9522 |
|
9523 | _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
|
9524 |
|
9525 | _this.onEnter = function (node, appearing) {
|
9526 | var _this$getClassNames = _this.getClassNames(appearing ? 'appear' : 'enter'),
|
9527 | className = _this$getClassNames.className;
|
9528 |
|
9529 | _this.removeClasses(node, 'exit');
|
9530 |
|
9531 | addClass(node, className);
|
9532 |
|
9533 | if (_this.props.onEnter) {
|
9534 | _this.props.onEnter(node, appearing);
|
9535 | }
|
9536 | };
|
9537 |
|
9538 | _this.onEntering = function (node, appearing) {
|
9539 | var _this$getClassNames2 = _this.getClassNames(appearing ? 'appear' : 'enter'),
|
9540 | activeClassName = _this$getClassNames2.activeClassName;
|
9541 |
|
9542 | _this.reflowAndAddClass(node, activeClassName);
|
9543 |
|
9544 | if (_this.props.onEntering) {
|
9545 | _this.props.onEntering(node, appearing);
|
9546 | }
|
9547 | };
|
9548 |
|
9549 | _this.onEntered = function (node, appearing) {
|
9550 | var appearClassName = _this.getClassNames('appear').doneClassName;
|
9551 |
|
9552 | var enterClassName = _this.getClassNames('enter').doneClassName;
|
9553 |
|
9554 | var doneClassName = appearing ? appearClassName + " " + enterClassName : enterClassName;
|
9555 |
|
9556 | _this.removeClasses(node, appearing ? 'appear' : 'enter');
|
9557 |
|
9558 | addClass(node, doneClassName);
|
9559 |
|
9560 | if (_this.props.onEntered) {
|
9561 | _this.props.onEntered(node, appearing);
|
9562 | }
|
9563 | };
|
9564 |
|
9565 | _this.onExit = function (node) {
|
9566 | var _this$getClassNames3 = _this.getClassNames('exit'),
|
9567 | className = _this$getClassNames3.className;
|
9568 |
|
9569 | _this.removeClasses(node, 'appear');
|
9570 |
|
9571 | _this.removeClasses(node, 'enter');
|
9572 |
|
9573 | addClass(node, className);
|
9574 |
|
9575 | if (_this.props.onExit) {
|
9576 | _this.props.onExit(node);
|
9577 | }
|
9578 | };
|
9579 |
|
9580 | _this.onExiting = function (node) {
|
9581 | var _this$getClassNames4 = _this.getClassNames('exit'),
|
9582 | activeClassName = _this$getClassNames4.activeClassName;
|
9583 |
|
9584 | _this.reflowAndAddClass(node, activeClassName);
|
9585 |
|
9586 | if (_this.props.onExiting) {
|
9587 | _this.props.onExiting(node);
|
9588 | }
|
9589 | };
|
9590 |
|
9591 | _this.onExited = function (node) {
|
9592 | var _this$getClassNames5 = _this.getClassNames('exit'),
|
9593 | doneClassName = _this$getClassNames5.doneClassName;
|
9594 |
|
9595 | _this.removeClasses(node, 'exit');
|
9596 |
|
9597 | addClass(node, doneClassName);
|
9598 |
|
9599 | if (_this.props.onExited) {
|
9600 | _this.props.onExited(node);
|
9601 | }
|
9602 | };
|
9603 |
|
9604 | _this.getClassNames = function (type) {
|
9605 | var classNames = _this.props.classNames;
|
9606 | var isStringClassNames = typeof classNames === 'string';
|
9607 | var prefix = isStringClassNames && classNames ? classNames + '-' : '';
|
9608 | var className = isStringClassNames ? prefix + type : classNames[type];
|
9609 | var activeClassName = isStringClassNames ? className + '-active' : classNames[type + 'Active'];
|
9610 | var doneClassName = isStringClassNames ? className + '-done' : classNames[type + 'Done'];
|
9611 | return {
|
9612 | className: className,
|
9613 | activeClassName: activeClassName,
|
9614 | doneClassName: doneClassName
|
9615 | };
|
9616 | };
|
9617 |
|
9618 | return _this;
|
9619 | }
|
9620 |
|
9621 | var _proto = CSSTransition.prototype;
|
9622 |
|
9623 | _proto.removeClasses = function removeClasses(node, type) {
|
9624 | var _this$getClassNames6 = this.getClassNames(type),
|
9625 | className = _this$getClassNames6.className,
|
9626 | activeClassName = _this$getClassNames6.activeClassName,
|
9627 | doneClassName = _this$getClassNames6.doneClassName;
|
9628 |
|
9629 | className && removeClass$$1(node, className);
|
9630 | activeClassName && removeClass$$1(node, activeClassName);
|
9631 | doneClassName && removeClass$$1(node, doneClassName);
|
9632 | };
|
9633 |
|
9634 | _proto.reflowAndAddClass = function reflowAndAddClass(node, className) {
|
9635 | // This is for to force a repaint,
|
9636 | // which is necessary in order to transition styles when adding a class name.
|
9637 | if (className) {
|
9638 | /* eslint-disable no-unused-expressions */
|
9639 | node && node.scrollTop;
|
9640 | /* eslint-enable no-unused-expressions */
|
9641 |
|
9642 | addClass(node, className);
|
9643 | }
|
9644 | };
|
9645 |
|
9646 | _proto.render = function render() {
|
9647 | var props = _extends({}, this.props);
|
9648 |
|
9649 | delete props.classNames;
|
9650 | return _react.default.createElement(_Transition.default, _extends({}, props, {
|
9651 | onEnter: this.onEnter,
|
9652 | onEntered: this.onEntered,
|
9653 | onEntering: this.onEntering,
|
9654 | onExit: this.onExit,
|
9655 | onExiting: this.onExiting,
|
9656 | onExited: this.onExited
|
9657 | }));
|
9658 | };
|
9659 |
|
9660 | return CSSTransition;
|
9661 | }(_react.default.Component);
|
9662 |
|
9663 | CSSTransition.defaultProps = {
|
9664 | classNames: ''
|
9665 | };
|
9666 | CSSTransition.propTypes = process.env.NODE_ENV !== "production" ? _extends({}, _Transition.default.propTypes, {
|
9667 | /**
|
9668 | * The animation classNames applied to the component as it enters, exits or
|
9669 | * has finished the transition. A single name can be provided and it will be
|
9670 | * suffixed for each stage: e.g.
|
9671 | *
|
9672 | * `classNames="fade"` applies `fade-enter`, `fade-enter-active`,
|
9673 | * `fade-enter-done`, `fade-exit`, `fade-exit-active`, `fade-exit-done`,
|
9674 | * `fade-appear`, `fade-appear-active`, and `fade-appear-done`.
|
9675 | *
|
9676 | * **Note**: `fade-appear-done` and `fade-enter-done` will _both_ be applied.
|
9677 | * This allows you to define different behavior for when appearing is done and
|
9678 | * when regular entering is done, using selectors like
|
9679 | * `.fade-enter-done:not(.fade-appear-done)`. For example, you could apply an
|
9680 | * epic entrance animation when element first appears in the DOM using
|
9681 | * [Animate.css](https://daneden.github.io/animate.css/). Otherwise you can
|
9682 | * simply use `fade-enter-done` for defining both cases.
|
9683 | *
|
9684 | * Each individual classNames can also be specified independently like:
|
9685 | *
|
9686 | * ```js
|
9687 | * classNames={{
|
9688 | * appear: 'my-appear',
|
9689 | * appearActive: 'my-active-appear',
|
9690 | * appearDone: 'my-done-appear',
|
9691 | * enter: 'my-enter',
|
9692 | * enterActive: 'my-active-enter',
|
9693 | * enterDone: 'my-done-enter',
|
9694 | * exit: 'my-exit',
|
9695 | * exitActive: 'my-active-exit',
|
9696 | * exitDone: 'my-done-exit',
|
9697 | * }}
|
9698 | * ```
|
9699 | *
|
9700 | * If you want to set these classes using CSS Modules:
|
9701 | *
|
9702 | * ```js
|
9703 | * import styles from './styles.css';
|
9704 | * ```
|
9705 | *
|
9706 | * you might want to use camelCase in your CSS file, that way could simply
|
9707 | * spread them instead of listing them one by one:
|
9708 | *
|
9709 | * ```js
|
9710 | * classNames={{ ...styles }}
|
9711 | * ```
|
9712 | *
|
9713 | * @type {string | {
|
9714 | * appear?: string,
|
9715 | * appearActive?: string,
|
9716 | * appearDone?: string,
|
9717 | * enter?: string,
|
9718 | * enterActive?: string,
|
9719 | * enterDone?: string,
|
9720 | * exit?: string,
|
9721 | * exitActive?: string,
|
9722 | * exitDone?: string,
|
9723 | * }}
|
9724 | */
|
9725 | classNames: PropTypes$1.classNamesShape,
|
9726 |
|
9727 | /**
|
9728 | * A `<Transition>` callback fired immediately after the 'enter' or 'appear' class is
|
9729 | * applied.
|
9730 | *
|
9731 | * @type Function(node: HtmlElement, isAppearing: bool)
|
9732 | */
|
9733 | onEnter: PropTypes$$1.func,
|
9734 |
|
9735 | /**
|
9736 | * A `<Transition>` callback fired immediately after the 'enter-active' or
|
9737 | * 'appear-active' class is applied.
|
9738 | *
|
9739 | * @type Function(node: HtmlElement, isAppearing: bool)
|
9740 | */
|
9741 | onEntering: PropTypes$$1.func,
|
9742 |
|
9743 | /**
|
9744 | * A `<Transition>` callback fired immediately after the 'enter' or
|
9745 | * 'appear' classes are **removed** and the `done` class is added to the DOM node.
|
9746 | *
|
9747 | * @type Function(node: HtmlElement, isAppearing: bool)
|
9748 | */
|
9749 | onEntered: PropTypes$$1.func,
|
9750 |
|
9751 | /**
|
9752 | * A `<Transition>` callback fired immediately after the 'exit' class is
|
9753 | * applied.
|
9754 | *
|
9755 | * @type Function(node: HtmlElement)
|
9756 | */
|
9757 | onExit: PropTypes$$1.func,
|
9758 |
|
9759 | /**
|
9760 | * A `<Transition>` callback fired immediately after the 'exit-active' is applied.
|
9761 | *
|
9762 | * @type Function(node: HtmlElement)
|
9763 | */
|
9764 | onExiting: PropTypes$$1.func,
|
9765 |
|
9766 | /**
|
9767 | * A `<Transition>` callback fired immediately after the 'exit' classes
|
9768 | * are **removed** and the `exit-done` class is added to the DOM node.
|
9769 | *
|
9770 | * @type Function(node: HtmlElement)
|
9771 | */
|
9772 | onExited: PropTypes$$1.func
|
9773 | }) : {};
|
9774 | var _default = CSSTransition;
|
9775 | exports.default = _default;
|
9776 | module.exports = exports["default"];
|
9777 | });
|
9778 |
|
9779 | unwrapExports(CSSTransition_1);
|
9780 |
|
9781 | var ChildMapping = createCommonjsModule(function (module, exports) {
|
9782 |
|
9783 | exports.__esModule = true;
|
9784 | exports.getChildMapping = getChildMapping;
|
9785 | exports.mergeChildMappings = mergeChildMappings;
|
9786 | exports.getInitialChildMapping = getInitialChildMapping;
|
9787 | exports.getNextChildMapping = getNextChildMapping;
|
9788 |
|
9789 |
|
9790 |
|
9791 | /**
|
9792 | * Given `this.props.children`, return an object mapping key to child.
|
9793 | *
|
9794 | * @param {*} children `this.props.children`
|
9795 | * @return {object} Mapping of key to child
|
9796 | */
|
9797 | function getChildMapping(children, mapFn) {
|
9798 | var mapper = function mapper(child) {
|
9799 | return mapFn && (0, React.isValidElement)(child) ? mapFn(child) : child;
|
9800 | };
|
9801 |
|
9802 | var result = Object.create(null);
|
9803 | if (children) React.Children.map(children, function (c) {
|
9804 | return c;
|
9805 | }).forEach(function (child) {
|
9806 | // run the map function here instead so that the key is the computed one
|
9807 | result[child.key] = mapper(child);
|
9808 | });
|
9809 | return result;
|
9810 | }
|
9811 | /**
|
9812 | * When you're adding or removing children some may be added or removed in the
|
9813 | * same render pass. We want to show *both* since we want to simultaneously
|
9814 | * animate elements in and out. This function takes a previous set of keys
|
9815 | * and a new set of keys and merges them with its best guess of the correct
|
9816 | * ordering. In the future we may expose some of the utilities in
|
9817 | * ReactMultiChild to make this easy, but for now React itself does not
|
9818 | * directly have this concept of the union of prevChildren and nextChildren
|
9819 | * so we implement it here.
|
9820 | *
|
9821 | * @param {object} prev prev children as returned from
|
9822 | * `ReactTransitionChildMapping.getChildMapping()`.
|
9823 | * @param {object} next next children as returned from
|
9824 | * `ReactTransitionChildMapping.getChildMapping()`.
|
9825 | * @return {object} a key set that contains all keys in `prev` and all keys
|
9826 | * in `next` in a reasonable order.
|
9827 | */
|
9828 |
|
9829 |
|
9830 | function mergeChildMappings(prev, next) {
|
9831 | prev = prev || {};
|
9832 | next = next || {};
|
9833 |
|
9834 | function getValueForKey(key) {
|
9835 | return key in next ? next[key] : prev[key];
|
9836 | } // For each key of `next`, the list of keys to insert before that key in
|
9837 | // the combined list
|
9838 |
|
9839 |
|
9840 | var nextKeysPending = Object.create(null);
|
9841 | var pendingKeys = [];
|
9842 |
|
9843 | for (var prevKey in prev) {
|
9844 | if (prevKey in next) {
|
9845 | if (pendingKeys.length) {
|
9846 | nextKeysPending[prevKey] = pendingKeys;
|
9847 | pendingKeys = [];
|
9848 | }
|
9849 | } else {
|
9850 | pendingKeys.push(prevKey);
|
9851 | }
|
9852 | }
|
9853 |
|
9854 | var i;
|
9855 | var childMapping = {};
|
9856 |
|
9857 | for (var nextKey in next) {
|
9858 | if (nextKeysPending[nextKey]) {
|
9859 | for (i = 0; i < nextKeysPending[nextKey].length; i++) {
|
9860 | var pendingNextKey = nextKeysPending[nextKey][i];
|
9861 | childMapping[nextKeysPending[nextKey][i]] = getValueForKey(pendingNextKey);
|
9862 | }
|
9863 | }
|
9864 |
|
9865 | childMapping[nextKey] = getValueForKey(nextKey);
|
9866 | } // Finally, add the keys which didn't appear before any key in `next`
|
9867 |
|
9868 |
|
9869 | for (i = 0; i < pendingKeys.length; i++) {
|
9870 | childMapping[pendingKeys[i]] = getValueForKey(pendingKeys[i]);
|
9871 | }
|
9872 |
|
9873 | return childMapping;
|
9874 | }
|
9875 |
|
9876 | function getProp(child, prop, props) {
|
9877 | return props[prop] != null ? props[prop] : child.props[prop];
|
9878 | }
|
9879 |
|
9880 | function getInitialChildMapping(props, onExited) {
|
9881 | return getChildMapping(props.children, function (child) {
|
9882 | return (0, React.cloneElement)(child, {
|
9883 | onExited: onExited.bind(null, child),
|
9884 | in: true,
|
9885 | appear: getProp(child, 'appear', props),
|
9886 | enter: getProp(child, 'enter', props),
|
9887 | exit: getProp(child, 'exit', props)
|
9888 | });
|
9889 | });
|
9890 | }
|
9891 |
|
9892 | function getNextChildMapping(nextProps, prevChildMapping, onExited) {
|
9893 | var nextChildMapping = getChildMapping(nextProps.children);
|
9894 | var children = mergeChildMappings(prevChildMapping, nextChildMapping);
|
9895 | Object.keys(children).forEach(function (key) {
|
9896 | var child = children[key];
|
9897 | if (!(0, React.isValidElement)(child)) return;
|
9898 | var hasPrev = key in prevChildMapping;
|
9899 | var hasNext = key in nextChildMapping;
|
9900 | var prevChild = prevChildMapping[key];
|
9901 | var isLeaving = (0, React.isValidElement)(prevChild) && !prevChild.props.in; // item is new (entering)
|
9902 |
|
9903 | if (hasNext && (!hasPrev || isLeaving)) {
|
9904 | // console.log('entering', key)
|
9905 | children[key] = (0, React.cloneElement)(child, {
|
9906 | onExited: onExited.bind(null, child),
|
9907 | in: true,
|
9908 | exit: getProp(child, 'exit', nextProps),
|
9909 | enter: getProp(child, 'enter', nextProps)
|
9910 | });
|
9911 | } else if (!hasNext && hasPrev && !isLeaving) {
|
9912 | // item is old (exiting)
|
9913 | // console.log('leaving', key)
|
9914 | children[key] = (0, React.cloneElement)(child, {
|
9915 | in: false
|
9916 | });
|
9917 | } else if (hasNext && hasPrev && (0, React.isValidElement)(prevChild)) {
|
9918 | // item hasn't changed transition states
|
9919 | // copy over the last transition props;
|
9920 | // console.log('unchanged', key)
|
9921 | children[key] = (0, React.cloneElement)(child, {
|
9922 | onExited: onExited.bind(null, child),
|
9923 | in: prevChild.props.in,
|
9924 | exit: getProp(child, 'exit', nextProps),
|
9925 | enter: getProp(child, 'enter', nextProps)
|
9926 | });
|
9927 | }
|
9928 | });
|
9929 | return children;
|
9930 | }
|
9931 | });
|
9932 |
|
9933 | unwrapExports(ChildMapping);
|
9934 | var ChildMapping_1 = ChildMapping.getChildMapping;
|
9935 | var ChildMapping_2 = ChildMapping.mergeChildMappings;
|
9936 | var ChildMapping_3 = ChildMapping.getInitialChildMapping;
|
9937 | var ChildMapping_4 = ChildMapping.getNextChildMapping;
|
9938 |
|
9939 | var TransitionGroup_1 = createCommonjsModule(function (module, exports) {
|
9940 |
|
9941 | exports.__esModule = true;
|
9942 | exports.default = void 0;
|
9943 |
|
9944 | var _propTypes = _interopRequireDefault(PropTypes);
|
9945 |
|
9946 | var _react = _interopRequireDefault(React);
|
9947 |
|
9948 |
|
9949 |
|
9950 |
|
9951 |
|
9952 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
9953 |
|
9954 | function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
9955 |
|
9956 | function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
9957 |
|
9958 | function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
9959 |
|
9960 | function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
9961 |
|
9962 | var values = Object.values || function (obj) {
|
9963 | return Object.keys(obj).map(function (k) {
|
9964 | return obj[k];
|
9965 | });
|
9966 | };
|
9967 |
|
9968 | var defaultProps = {
|
9969 | component: 'div',
|
9970 | childFactory: function childFactory(child) {
|
9971 | return child;
|
9972 | }
|
9973 | /**
|
9974 | * The `<TransitionGroup>` component manages a set of transition components
|
9975 | * (`<Transition>` and `<CSSTransition>`) in a list. Like with the transition
|
9976 | * components, `<TransitionGroup>` is a state machine for managing the mounting
|
9977 | * and unmounting of components over time.
|
9978 | *
|
9979 | * Consider the example below. As items are removed or added to the TodoList the
|
9980 | * `in` prop is toggled automatically by the `<TransitionGroup>`.
|
9981 | *
|
9982 | * Note that `<TransitionGroup>` does not define any animation behavior!
|
9983 | * Exactly _how_ a list item animates is up to the individual transition
|
9984 | * component. This means you can mix and match animations across different list
|
9985 | * items.
|
9986 | */
|
9987 |
|
9988 | };
|
9989 |
|
9990 | var TransitionGroup =
|
9991 | /*#__PURE__*/
|
9992 | function (_React$Component) {
|
9993 | _inheritsLoose(TransitionGroup, _React$Component);
|
9994 |
|
9995 | function TransitionGroup(props, context) {
|
9996 | var _this;
|
9997 |
|
9998 | _this = _React$Component.call(this, props, context) || this;
|
9999 |
|
10000 | var handleExited = _this.handleExited.bind(_assertThisInitialized(_assertThisInitialized(_this))); // Initial children should all be entering, dependent on appear
|
10001 |
|
10002 |
|
10003 | _this.state = {
|
10004 | handleExited: handleExited,
|
10005 | firstRender: true
|
10006 | };
|
10007 | return _this;
|
10008 | }
|
10009 |
|
10010 | var _proto = TransitionGroup.prototype;
|
10011 |
|
10012 | _proto.getChildContext = function getChildContext() {
|
10013 | return {
|
10014 | transitionGroup: {
|
10015 | isMounting: !this.appeared
|
10016 | }
|
10017 | };
|
10018 | };
|
10019 |
|
10020 | _proto.componentDidMount = function componentDidMount() {
|
10021 | this.appeared = true;
|
10022 | this.mounted = true;
|
10023 | };
|
10024 |
|
10025 | _proto.componentWillUnmount = function componentWillUnmount() {
|
10026 | this.mounted = false;
|
10027 | };
|
10028 |
|
10029 | TransitionGroup.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, _ref) {
|
10030 | var prevChildMapping = _ref.children,
|
10031 | handleExited = _ref.handleExited,
|
10032 | firstRender = _ref.firstRender;
|
10033 | return {
|
10034 | children: firstRender ? (0, ChildMapping.getInitialChildMapping)(nextProps, handleExited) : (0, ChildMapping.getNextChildMapping)(nextProps, prevChildMapping, handleExited),
|
10035 | firstRender: false
|
10036 | };
|
10037 | };
|
10038 |
|
10039 | _proto.handleExited = function handleExited(child, node) {
|
10040 | var currentChildMapping = (0, ChildMapping.getChildMapping)(this.props.children);
|
10041 | if (child.key in currentChildMapping) return;
|
10042 |
|
10043 | if (child.props.onExited) {
|
10044 | child.props.onExited(node);
|
10045 | }
|
10046 |
|
10047 | if (this.mounted) {
|
10048 | this.setState(function (state) {
|
10049 | var children = _extends({}, state.children);
|
10050 |
|
10051 | delete children[child.key];
|
10052 | return {
|
10053 | children: children
|
10054 | };
|
10055 | });
|
10056 | }
|
10057 | };
|
10058 |
|
10059 | _proto.render = function render() {
|
10060 | var _this$props = this.props,
|
10061 | Component$$1 = _this$props.component,
|
10062 | childFactory = _this$props.childFactory,
|
10063 | props = _objectWithoutPropertiesLoose(_this$props, ["component", "childFactory"]);
|
10064 |
|
10065 | var children = values(this.state.children).map(childFactory);
|
10066 | delete props.appear;
|
10067 | delete props.enter;
|
10068 | delete props.exit;
|
10069 |
|
10070 | if (Component$$1 === null) {
|
10071 | return children;
|
10072 | }
|
10073 |
|
10074 | return _react.default.createElement(Component$$1, props, children);
|
10075 | };
|
10076 |
|
10077 | return TransitionGroup;
|
10078 | }(_react.default.Component);
|
10079 |
|
10080 | TransitionGroup.childContextTypes = {
|
10081 | transitionGroup: _propTypes.default.object.isRequired
|
10082 | };
|
10083 | TransitionGroup.propTypes = process.env.NODE_ENV !== "production" ? {
|
10084 | /**
|
10085 | * `<TransitionGroup>` renders a `<div>` by default. You can change this
|
10086 | * behavior by providing a `component` prop.
|
10087 | * If you use React v16+ and would like to avoid a wrapping `<div>` element
|
10088 | * you can pass in `component={null}`. This is useful if the wrapping div
|
10089 | * borks your css styles.
|
10090 | */
|
10091 | component: _propTypes.default.any,
|
10092 |
|
10093 | /**
|
10094 | * A set of `<Transition>` components, that are toggled `in` and out as they
|
10095 | * leave. the `<TransitionGroup>` will inject specific transition props, so
|
10096 | * remember to spread them through if you are wrapping the `<Transition>` as
|
10097 | * with our `<Fade>` example.
|
10098 | *
|
10099 | * While this component is meant for multiple `Transition` or `CSSTransition`
|
10100 | * children, sometimes you may want to have a single transition child with
|
10101 | * content that you want to be transitioned out and in when you change it
|
10102 | * (e.g. routes, images etc.) In that case you can change the `key` prop of
|
10103 | * the transition child as you change its content, this will cause
|
10104 | * `TransitionGroup` to transition the child out and back in.
|
10105 | */
|
10106 | children: _propTypes.default.node,
|
10107 |
|
10108 | /**
|
10109 | * A convenience prop that enables or disables appear animations
|
10110 | * for all children. Note that specifying this will override any defaults set
|
10111 | * on individual children Transitions.
|
10112 | */
|
10113 | appear: _propTypes.default.bool,
|
10114 |
|
10115 | /**
|
10116 | * A convenience prop that enables or disables enter animations
|
10117 | * for all children. Note that specifying this will override any defaults set
|
10118 | * on individual children Transitions.
|
10119 | */
|
10120 | enter: _propTypes.default.bool,
|
10121 |
|
10122 | /**
|
10123 | * A convenience prop that enables or disables exit animations
|
10124 | * for all children. Note that specifying this will override any defaults set
|
10125 | * on individual children Transitions.
|
10126 | */
|
10127 | exit: _propTypes.default.bool,
|
10128 |
|
10129 | /**
|
10130 | * You may need to apply reactive updates to a child as it is exiting.
|
10131 | * This is generally done by using `cloneElement` however in the case of an exiting
|
10132 | * child the element has already been removed and not accessible to the consumer.
|
10133 | *
|
10134 | * If you do need to update a child as it leaves you can provide a `childFactory`
|
10135 | * to wrap every child, even the ones that are leaving.
|
10136 | *
|
10137 | * @type Function(child: ReactElement) -> ReactElement
|
10138 | */
|
10139 | childFactory: _propTypes.default.func
|
10140 | } : {};
|
10141 | TransitionGroup.defaultProps = defaultProps;
|
10142 |
|
10143 | var _default = (0, reactLifecyclesCompat_es.polyfill)(TransitionGroup);
|
10144 |
|
10145 | exports.default = _default;
|
10146 | module.exports = exports["default"];
|
10147 | });
|
10148 |
|
10149 | unwrapExports(TransitionGroup_1);
|
10150 |
|
10151 | var ReplaceTransition_1 = createCommonjsModule(function (module, exports) {
|
10152 |
|
10153 | exports.__esModule = true;
|
10154 | exports.default = void 0;
|
10155 |
|
10156 | var _propTypes = _interopRequireDefault(PropTypes);
|
10157 |
|
10158 | var _react = _interopRequireDefault(React);
|
10159 |
|
10160 |
|
10161 |
|
10162 | var _TransitionGroup = _interopRequireDefault(TransitionGroup_1);
|
10163 |
|
10164 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
10165 |
|
10166 | function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
10167 |
|
10168 | function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
10169 |
|
10170 | /**
|
10171 | * The `<ReplaceTransition>` component is a specialized `Transition` component
|
10172 | * that animates between two children.
|
10173 | *
|
10174 | * ```jsx
|
10175 | * <ReplaceTransition in>
|
10176 | * <Fade><div>I appear first</div></Fade>
|
10177 | * <Fade><div>I replace the above</div></Fade>
|
10178 | * </ReplaceTransition>
|
10179 | * ```
|
10180 | */
|
10181 | var ReplaceTransition =
|
10182 | /*#__PURE__*/
|
10183 | function (_React$Component) {
|
10184 | _inheritsLoose(ReplaceTransition, _React$Component);
|
10185 |
|
10186 | function ReplaceTransition() {
|
10187 | var _this;
|
10188 |
|
10189 | for (var _len = arguments.length, _args = new Array(_len), _key = 0; _key < _len; _key++) {
|
10190 | _args[_key] = arguments[_key];
|
10191 | }
|
10192 |
|
10193 | _this = _React$Component.call.apply(_React$Component, [this].concat(_args)) || this;
|
10194 |
|
10195 | _this.handleEnter = function () {
|
10196 | for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
10197 | args[_key2] = arguments[_key2];
|
10198 | }
|
10199 |
|
10200 | return _this.handleLifecycle('onEnter', 0, args);
|
10201 | };
|
10202 |
|
10203 | _this.handleEntering = function () {
|
10204 | for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
10205 | args[_key3] = arguments[_key3];
|
10206 | }
|
10207 |
|
10208 | return _this.handleLifecycle('onEntering', 0, args);
|
10209 | };
|
10210 |
|
10211 | _this.handleEntered = function () {
|
10212 | for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
10213 | args[_key4] = arguments[_key4];
|
10214 | }
|
10215 |
|
10216 | return _this.handleLifecycle('onEntered', 0, args);
|
10217 | };
|
10218 |
|
10219 | _this.handleExit = function () {
|
10220 | for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
10221 | args[_key5] = arguments[_key5];
|
10222 | }
|
10223 |
|
10224 | return _this.handleLifecycle('onExit', 1, args);
|
10225 | };
|
10226 |
|
10227 | _this.handleExiting = function () {
|
10228 | for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
10229 | args[_key6] = arguments[_key6];
|
10230 | }
|
10231 |
|
10232 | return _this.handleLifecycle('onExiting', 1, args);
|
10233 | };
|
10234 |
|
10235 | _this.handleExited = function () {
|
10236 | for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
|
10237 | args[_key7] = arguments[_key7];
|
10238 | }
|
10239 |
|
10240 | return _this.handleLifecycle('onExited', 1, args);
|
10241 | };
|
10242 |
|
10243 | return _this;
|
10244 | }
|
10245 |
|
10246 | var _proto = ReplaceTransition.prototype;
|
10247 |
|
10248 | _proto.handleLifecycle = function handleLifecycle(handler, idx, originalArgs) {
|
10249 | var _child$props;
|
10250 |
|
10251 | var children = this.props.children;
|
10252 |
|
10253 | var child = _react.default.Children.toArray(children)[idx];
|
10254 |
|
10255 | if (child.props[handler]) (_child$props = child.props)[handler].apply(_child$props, originalArgs);
|
10256 | if (this.props[handler]) this.props[handler]((0, reactDom.findDOMNode)(this));
|
10257 | };
|
10258 |
|
10259 | _proto.render = function render() {
|
10260 | var _this$props = this.props,
|
10261 | children = _this$props.children,
|
10262 | inProp = _this$props.in,
|
10263 | props = _objectWithoutPropertiesLoose(_this$props, ["children", "in"]);
|
10264 |
|
10265 | var _React$Children$toArr = _react.default.Children.toArray(children),
|
10266 | first = _React$Children$toArr[0],
|
10267 | second = _React$Children$toArr[1];
|
10268 |
|
10269 | delete props.onEnter;
|
10270 | delete props.onEntering;
|
10271 | delete props.onEntered;
|
10272 | delete props.onExit;
|
10273 | delete props.onExiting;
|
10274 | delete props.onExited;
|
10275 | return _react.default.createElement(_TransitionGroup.default, props, inProp ? _react.default.cloneElement(first, {
|
10276 | key: 'first',
|
10277 | onEnter: this.handleEnter,
|
10278 | onEntering: this.handleEntering,
|
10279 | onEntered: this.handleEntered
|
10280 | }) : _react.default.cloneElement(second, {
|
10281 | key: 'second',
|
10282 | onEnter: this.handleExit,
|
10283 | onEntering: this.handleExiting,
|
10284 | onEntered: this.handleExited
|
10285 | }));
|
10286 | };
|
10287 |
|
10288 | return ReplaceTransition;
|
10289 | }(_react.default.Component);
|
10290 |
|
10291 | ReplaceTransition.propTypes = process.env.NODE_ENV !== "production" ? {
|
10292 | in: _propTypes.default.bool.isRequired,
|
10293 | children: function children(props, propName) {
|
10294 | if (_react.default.Children.count(props[propName]) !== 2) return new Error("\"" + propName + "\" must be exactly two transition components.");
|
10295 | return null;
|
10296 | }
|
10297 | } : {};
|
10298 | var _default = ReplaceTransition;
|
10299 | exports.default = _default;
|
10300 | module.exports = exports["default"];
|
10301 | });
|
10302 |
|
10303 | unwrapExports(ReplaceTransition_1);
|
10304 |
|
10305 | var reactTransitionGroup = createCommonjsModule(function (module) {
|
10306 |
|
10307 | var _CSSTransition = _interopRequireDefault(CSSTransition_1);
|
10308 |
|
10309 | var _ReplaceTransition = _interopRequireDefault(ReplaceTransition_1);
|
10310 |
|
10311 | var _TransitionGroup = _interopRequireDefault(TransitionGroup_1);
|
10312 |
|
10313 | var _Transition = _interopRequireDefault(Transition_1);
|
10314 |
|
10315 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
10316 |
|
10317 | module.exports = {
|
10318 | Transition: _Transition.default,
|
10319 | TransitionGroup: _TransitionGroup.default,
|
10320 | ReplaceTransition: _ReplaceTransition.default,
|
10321 | CSSTransition: _CSSTransition.default
|
10322 | };
|
10323 | });
|
10324 |
|
10325 | unwrapExports(reactTransitionGroup);
|
10326 | var reactTransitionGroup_1 = reactTransitionGroup.Transition;
|
10327 | var reactTransitionGroup_2 = reactTransitionGroup.TransitionGroup;
|
10328 | var reactTransitionGroup_3 = reactTransitionGroup.ReplaceTransition;
|
10329 | var reactTransitionGroup_4 = reactTransitionGroup.CSSTransition;
|
10330 |
|
10331 | function _typeof(obj) {
|
10332 | if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
10333 | _typeof = function (obj) {
|
10334 | return typeof obj;
|
10335 | };
|
10336 | } else {
|
10337 | _typeof = function (obj) {
|
10338 | return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
10339 | };
|
10340 | }
|
10341 |
|
10342 | return _typeof(obj);
|
10343 | }
|
10344 |
|
10345 | function _classCallCheck(instance, Constructor) {
|
10346 | if (!(instance instanceof Constructor)) {
|
10347 | throw new TypeError("Cannot call a class as a function");
|
10348 | }
|
10349 | }
|
10350 |
|
10351 | function _defineProperties(target, props) {
|
10352 | for (var i = 0; i < props.length; i++) {
|
10353 | var descriptor = props[i];
|
10354 | descriptor.enumerable = descriptor.enumerable || false;
|
10355 | descriptor.configurable = true;
|
10356 | if ("value" in descriptor) descriptor.writable = true;
|
10357 | Object.defineProperty(target, descriptor.key, descriptor);
|
10358 | }
|
10359 | }
|
10360 |
|
10361 | function _createClass(Constructor, protoProps, staticProps) {
|
10362 | if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
10363 | if (staticProps) _defineProperties(Constructor, staticProps);
|
10364 | return Constructor;
|
10365 | }
|
10366 |
|
10367 | function _defineProperty$1(obj, key, value) {
|
10368 | if (key in obj) {
|
10369 | Object.defineProperty(obj, key, {
|
10370 | value: value,
|
10371 | enumerable: true,
|
10372 | configurable: true,
|
10373 | writable: true
|
10374 | });
|
10375 | } else {
|
10376 | obj[key] = value;
|
10377 | }
|
10378 |
|
10379 | return obj;
|
10380 | }
|
10381 |
|
10382 | function _extends$2() {
|
10383 | _extends$2 = Object.assign || function (target) {
|
10384 | for (var i = 1; i < arguments.length; i++) {
|
10385 | var source = arguments[i];
|
10386 |
|
10387 | for (var key in source) {
|
10388 | if (Object.prototype.hasOwnProperty.call(source, key)) {
|
10389 | target[key] = source[key];
|
10390 | }
|
10391 | }
|
10392 | }
|
10393 |
|
10394 | return target;
|
10395 | };
|
10396 |
|
10397 | return _extends$2.apply(this, arguments);
|
10398 | }
|
10399 |
|
10400 | function _objectSpread(target) {
|
10401 | for (var i = 1; i < arguments.length; i++) {
|
10402 | var source = arguments[i] != null ? arguments[i] : {};
|
10403 | var ownKeys = Object.keys(source);
|
10404 |
|
10405 | if (typeof Object.getOwnPropertySymbols === 'function') {
|
10406 | ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
|
10407 | return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
10408 | }));
|
10409 | }
|
10410 |
|
10411 | ownKeys.forEach(function (key) {
|
10412 | _defineProperty$1(target, key, source[key]);
|
10413 | });
|
10414 | }
|
10415 |
|
10416 | return target;
|
10417 | }
|
10418 |
|
10419 | function _inherits(subClass, superClass) {
|
10420 | if (typeof superClass !== "function" && superClass !== null) {
|
10421 | throw new TypeError("Super expression must either be null or a function");
|
10422 | }
|
10423 |
|
10424 | subClass.prototype = Object.create(superClass && superClass.prototype, {
|
10425 | constructor: {
|
10426 | value: subClass,
|
10427 | writable: true,
|
10428 | configurable: true
|
10429 | }
|
10430 | });
|
10431 | if (superClass) _setPrototypeOf(subClass, superClass);
|
10432 | }
|
10433 |
|
10434 | function _getPrototypeOf(o) {
|
10435 | _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
10436 | return o.__proto__ || Object.getPrototypeOf(o);
|
10437 | };
|
10438 | return _getPrototypeOf(o);
|
10439 | }
|
10440 |
|
10441 | function _setPrototypeOf(o, p) {
|
10442 | _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
10443 | o.__proto__ = p;
|
10444 | return o;
|
10445 | };
|
10446 |
|
10447 | return _setPrototypeOf(o, p);
|
10448 | }
|
10449 |
|
10450 | function _objectWithoutPropertiesLoose$1(source, excluded) {
|
10451 | if (source == null) return {};
|
10452 | var target = {};
|
10453 | var sourceKeys = Object.keys(source);
|
10454 | var key, i;
|
10455 |
|
10456 | for (i = 0; i < sourceKeys.length; i++) {
|
10457 | key = sourceKeys[i];
|
10458 | if (excluded.indexOf(key) >= 0) continue;
|
10459 | target[key] = source[key];
|
10460 | }
|
10461 |
|
10462 | return target;
|
10463 | }
|
10464 |
|
10465 | function _objectWithoutProperties(source, excluded) {
|
10466 | if (source == null) return {};
|
10467 |
|
10468 | var target = _objectWithoutPropertiesLoose$1(source, excluded);
|
10469 |
|
10470 | var key, i;
|
10471 |
|
10472 | if (Object.getOwnPropertySymbols) {
|
10473 | var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
10474 |
|
10475 | for (i = 0; i < sourceSymbolKeys.length; i++) {
|
10476 | key = sourceSymbolKeys[i];
|
10477 | if (excluded.indexOf(key) >= 0) continue;
|
10478 | if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
10479 | target[key] = source[key];
|
10480 | }
|
10481 | }
|
10482 |
|
10483 | return target;
|
10484 | }
|
10485 |
|
10486 | function _assertThisInitialized$1(self) {
|
10487 | if (self === void 0) {
|
10488 | throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
10489 | }
|
10490 |
|
10491 | return self;
|
10492 | }
|
10493 |
|
10494 | function _possibleConstructorReturn(self, call) {
|
10495 | if (call && (typeof call === "object" || typeof call === "function")) {
|
10496 | return call;
|
10497 | }
|
10498 |
|
10499 | return _assertThisInitialized$1(self);
|
10500 | }
|
10501 |
|
10502 | function _toConsumableArray(arr) {
|
10503 | return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
|
10504 | }
|
10505 |
|
10506 | function _arrayWithoutHoles(arr) {
|
10507 | if (Array.isArray(arr)) {
|
10508 | for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
|
10509 |
|
10510 | return arr2;
|
10511 | }
|
10512 | }
|
10513 |
|
10514 | function _iterableToArray(iter) {
|
10515 | if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
|
10516 | }
|
10517 |
|
10518 | function _nonIterableSpread() {
|
10519 | throw new TypeError("Invalid attempt to spread non-iterable instance");
|
10520 | }
|
10521 |
|
10522 | // ==============================
|
10523 | // NO OP
|
10524 | // ==============================
|
10525 | var noop = function noop() {};
|
10526 | // Class Name Prefixer
|
10527 | // ==============================
|
10528 |
|
10529 | /**
|
10530 | String representation of component state for styling with class names.
|
10531 |
|
10532 | Expects an array of strings OR a string/object pair:
|
10533 | - className(['comp', 'comp-arg', 'comp-arg-2'])
|
10534 | @returns 'react-select__comp react-select__comp-arg react-select__comp-arg-2'
|
10535 | - className('comp', { some: true, state: false })
|
10536 | @returns 'react-select__comp react-select__comp--some'
|
10537 | */
|
10538 |
|
10539 | function applyPrefixToName(prefix, name) {
|
10540 | if (!name) {
|
10541 | return prefix;
|
10542 | } else if (name[0] === '-') {
|
10543 | return prefix + name;
|
10544 | } else {
|
10545 | return prefix + '__' + name;
|
10546 | }
|
10547 | }
|
10548 |
|
10549 | function classNames(prefix, cssKey, state, className) {
|
10550 | var arr = [cssKey, className];
|
10551 |
|
10552 | if (state && prefix) {
|
10553 | for (var key in state) {
|
10554 | if (state.hasOwnProperty(key) && state[key]) {
|
10555 | arr.push("".concat(applyPrefixToName(prefix, key)));
|
10556 | }
|
10557 | }
|
10558 | }
|
10559 |
|
10560 | return arr.filter(function (i) {
|
10561 | return i;
|
10562 | }).map(function (i) {
|
10563 | return String(i).trim();
|
10564 | }).join(' ');
|
10565 | } // ==============================
|
10566 | // Clean Value
|
10567 | // ==============================
|
10568 |
|
10569 | var cleanValue = function cleanValue(value) {
|
10570 | if (Array.isArray(value)) return value.filter(Boolean);
|
10571 | if (_typeof(value) === 'object' && value !== null) return [value];
|
10572 | return [];
|
10573 | }; // ==============================
|
10574 | // Handle Input Change
|
10575 | // ==============================
|
10576 |
|
10577 | function handleInputChange(inputValue, actionMeta, onInputChange) {
|
10578 | if (onInputChange) {
|
10579 | var newValue = onInputChange(inputValue, actionMeta);
|
10580 | if (typeof newValue === 'string') return newValue;
|
10581 | }
|
10582 |
|
10583 | return inputValue;
|
10584 | } // ==============================
|
10585 | // Scroll Helpers
|
10586 | // ==============================
|
10587 |
|
10588 | function isDocumentElement(el) {
|
10589 | return [document.documentElement, document.body, window].indexOf(el) > -1;
|
10590 | } // Normalized Scroll Top
|
10591 | // ------------------------------
|
10592 |
|
10593 | function getScrollTop(el) {
|
10594 | if (isDocumentElement(el)) {
|
10595 | return window.pageYOffset;
|
10596 | }
|
10597 |
|
10598 | return el.scrollTop;
|
10599 | }
|
10600 | function scrollTo(el, top) {
|
10601 | // with a scroll distance, we perform scroll on the element
|
10602 | if (isDocumentElement(el)) {
|
10603 | window.scrollTo(0, top);
|
10604 | return;
|
10605 | }
|
10606 |
|
10607 | el.scrollTop = top;
|
10608 | } // Get Scroll Parent
|
10609 | // ------------------------------
|
10610 |
|
10611 | function getScrollParent(element) {
|
10612 | var style = getComputedStyle(element);
|
10613 | var excludeStaticParent = style.position === 'absolute';
|
10614 | var overflowRx = /(auto|scroll)/;
|
10615 | var docEl = document.documentElement; // suck it, flow...
|
10616 |
|
10617 | if (style.position === 'fixed') return docEl;
|
10618 |
|
10619 | for (var parent = element; parent = parent.parentElement;) {
|
10620 | style = getComputedStyle(parent);
|
10621 |
|
10622 | if (excludeStaticParent && style.position === 'static') {
|
10623 | continue;
|
10624 | }
|
10625 |
|
10626 | if (overflowRx.test(style.overflow + style.overflowY + style.overflowX)) {
|
10627 | return parent;
|
10628 | }
|
10629 | }
|
10630 |
|
10631 | return docEl;
|
10632 | } // Animated Scroll To
|
10633 | // ------------------------------
|
10634 |
|
10635 | /**
|
10636 | @param t: time (elapsed)
|
10637 | @param b: initial value
|
10638 | @param c: amount of change
|
10639 | @param d: duration
|
10640 | */
|
10641 |
|
10642 | function easeOutCubic(t, b, c, d) {
|
10643 | return c * ((t = t / d - 1) * t * t + 1) + b;
|
10644 | }
|
10645 |
|
10646 | function animatedScrollTo(element, to) {
|
10647 | var duration = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 200;
|
10648 | var callback = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : noop;
|
10649 | var start = getScrollTop(element);
|
10650 | var change = to - start;
|
10651 | var increment = 10;
|
10652 | var currentTime = 0;
|
10653 |
|
10654 | function animateScroll() {
|
10655 | currentTime += increment;
|
10656 | var val = easeOutCubic(currentTime, start, change, duration);
|
10657 | scrollTo(element, val);
|
10658 |
|
10659 | if (currentTime < duration) {
|
10660 | raf_1(animateScroll);
|
10661 | } else {
|
10662 | callback(element);
|
10663 | }
|
10664 | }
|
10665 |
|
10666 | animateScroll();
|
10667 | } // Scroll Into View
|
10668 | // ------------------------------
|
10669 |
|
10670 | function scrollIntoView(menuEl, focusedEl) {
|
10671 | var menuRect = menuEl.getBoundingClientRect();
|
10672 | var focusedRect = focusedEl.getBoundingClientRect();
|
10673 | var overScroll = focusedEl.offsetHeight / 3;
|
10674 |
|
10675 | if (focusedRect.bottom + overScroll > menuRect.bottom) {
|
10676 | scrollTo(menuEl, Math.min(focusedEl.offsetTop + focusedEl.clientHeight - menuEl.offsetHeight + overScroll, menuEl.scrollHeight));
|
10677 | } else if (focusedRect.top - overScroll < menuRect.top) {
|
10678 | scrollTo(menuEl, Math.max(focusedEl.offsetTop - overScroll, 0));
|
10679 | }
|
10680 | } // ==============================
|
10681 | // Get bounding client object
|
10682 | // ==============================
|
10683 | // cannot get keys using array notation with DOMRect
|
10684 |
|
10685 | function getBoundingClientObj(element) {
|
10686 | var rect = element.getBoundingClientRect();
|
10687 | return {
|
10688 | bottom: rect.bottom,
|
10689 | height: rect.height,
|
10690 | left: rect.left,
|
10691 | right: rect.right,
|
10692 | top: rect.top,
|
10693 | width: rect.width
|
10694 | };
|
10695 | }
|
10696 | // Touch Capability Detector
|
10697 | // ==============================
|
10698 |
|
10699 | function isTouchCapable() {
|
10700 | try {
|
10701 | document.createEvent('TouchEvent');
|
10702 | return true;
|
10703 | } catch (e) {
|
10704 | return false;
|
10705 | }
|
10706 | } // ==============================
|
10707 | // Mobile Device Detector
|
10708 | // ==============================
|
10709 |
|
10710 | function isMobileDevice() {
|
10711 | try {
|
10712 | return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
|
10713 | } catch (e) {
|
10714 | return false;
|
10715 | }
|
10716 | }
|
10717 |
|
10718 | function getMenuPlacement(_ref) {
|
10719 | var maxHeight = _ref.maxHeight,
|
10720 | menuEl = _ref.menuEl,
|
10721 | minHeight = _ref.minHeight,
|
10722 | placement = _ref.placement,
|
10723 | shouldScroll = _ref.shouldScroll,
|
10724 | isFixedPosition = _ref.isFixedPosition,
|
10725 | theme = _ref.theme;
|
10726 | var spacing = theme.spacing;
|
10727 | var scrollParent = getScrollParent(menuEl);
|
10728 | var defaultState = {
|
10729 | placement: 'bottom',
|
10730 | maxHeight: maxHeight
|
10731 | }; // something went wrong, return default state
|
10732 |
|
10733 | if (!menuEl || !menuEl.offsetParent) return defaultState; // we can't trust `scrollParent.scrollHeight` --> it may increase when
|
10734 | // the menu is rendered
|
10735 |
|
10736 | var _scrollParent$getBoun = scrollParent.getBoundingClientRect(),
|
10737 | scrollHeight = _scrollParent$getBoun.height;
|
10738 |
|
10739 | var _menuEl$getBoundingCl = menuEl.getBoundingClientRect(),
|
10740 | menuBottom = _menuEl$getBoundingCl.bottom,
|
10741 | menuHeight = _menuEl$getBoundingCl.height,
|
10742 | menuTop = _menuEl$getBoundingCl.top;
|
10743 |
|
10744 | var _menuEl$offsetParent$ = menuEl.offsetParent.getBoundingClientRect(),
|
10745 | containerTop = _menuEl$offsetParent$.top;
|
10746 |
|
10747 | var viewHeight = window.innerHeight;
|
10748 | var scrollTop = getScrollTop(scrollParent);
|
10749 | var marginBottom = parseInt(getComputedStyle(menuEl).marginBottom, 10);
|
10750 | var marginTop = parseInt(getComputedStyle(menuEl).marginTop, 10);
|
10751 | var viewSpaceAbove = containerTop - marginTop;
|
10752 | var viewSpaceBelow = viewHeight - menuTop;
|
10753 | var scrollSpaceAbove = viewSpaceAbove + scrollTop;
|
10754 | var scrollSpaceBelow = scrollHeight - scrollTop - menuTop;
|
10755 | var scrollDown = menuBottom - viewHeight + scrollTop + marginBottom;
|
10756 | var scrollUp = scrollTop + menuTop - marginTop;
|
10757 | var scrollDuration = 160;
|
10758 |
|
10759 | switch (placement) {
|
10760 | case 'auto':
|
10761 | case 'bottom':
|
10762 | // 1: the menu will fit, do nothing
|
10763 | if (viewSpaceBelow >= menuHeight) {
|
10764 | return {
|
10765 | placement: 'bottom',
|
10766 | maxHeight: maxHeight
|
10767 | };
|
10768 | } // 2: the menu will fit, if scrolled
|
10769 |
|
10770 |
|
10771 | if (scrollSpaceBelow >= menuHeight && !isFixedPosition) {
|
10772 | if (shouldScroll) {
|
10773 | animatedScrollTo(scrollParent, scrollDown, scrollDuration);
|
10774 | }
|
10775 |
|
10776 | return {
|
10777 | placement: 'bottom',
|
10778 | maxHeight: maxHeight
|
10779 | };
|
10780 | } // 3: the menu will fit, if constrained
|
10781 |
|
10782 |
|
10783 | if (!isFixedPosition && scrollSpaceBelow >= minHeight || isFixedPosition && viewSpaceBelow >= minHeight) {
|
10784 | if (shouldScroll) {
|
10785 | animatedScrollTo(scrollParent, scrollDown, scrollDuration);
|
10786 | } // we want to provide as much of the menu as possible to the user,
|
10787 | // so give them whatever is available below rather than the minHeight.
|
10788 |
|
10789 |
|
10790 | var constrainedHeight = isFixedPosition ? viewSpaceBelow - marginBottom : scrollSpaceBelow - marginBottom;
|
10791 | return {
|
10792 | placement: 'bottom',
|
10793 | maxHeight: constrainedHeight
|
10794 | };
|
10795 | } // 4. Forked beviour when there isn't enough space below
|
10796 | // AUTO: flip the menu, render above
|
10797 |
|
10798 |
|
10799 | if (placement === 'auto' || isFixedPosition) {
|
10800 | // may need to be constrained after flipping
|
10801 | var _constrainedHeight = maxHeight;
|
10802 | var spaceAbove = isFixedPosition ? viewSpaceAbove : scrollSpaceAbove;
|
10803 |
|
10804 | if (spaceAbove >= minHeight) {
|
10805 | _constrainedHeight = Math.min(spaceAbove - marginBottom - spacing.controlHeight, maxHeight);
|
10806 | }
|
10807 |
|
10808 | return {
|
10809 | placement: 'top',
|
10810 | maxHeight: _constrainedHeight
|
10811 | };
|
10812 | } // BOTTOM: allow browser to increase scrollable area and immediately set scroll
|
10813 |
|
10814 |
|
10815 | if (placement === 'bottom') {
|
10816 | scrollTo(scrollParent, scrollDown);
|
10817 | return {
|
10818 | placement: 'bottom',
|
10819 | maxHeight: maxHeight
|
10820 | };
|
10821 | }
|
10822 |
|
10823 | break;
|
10824 |
|
10825 | case 'top':
|
10826 | // 1: the menu will fit, do nothing
|
10827 | if (viewSpaceAbove >= menuHeight) {
|
10828 | return {
|
10829 | placement: 'top',
|
10830 | maxHeight: maxHeight
|
10831 | };
|
10832 | } // 2: the menu will fit, if scrolled
|
10833 |
|
10834 |
|
10835 | if (scrollSpaceAbove >= menuHeight && !isFixedPosition) {
|
10836 | if (shouldScroll) {
|
10837 | animatedScrollTo(scrollParent, scrollUp, scrollDuration);
|
10838 | }
|
10839 |
|
10840 | return {
|
10841 | placement: 'top',
|
10842 | maxHeight: maxHeight
|
10843 | };
|
10844 | } // 3: the menu will fit, if constrained
|
10845 |
|
10846 |
|
10847 | if (!isFixedPosition && scrollSpaceAbove >= minHeight || isFixedPosition && viewSpaceAbove >= minHeight) {
|
10848 | var _constrainedHeight2 = maxHeight; // we want to provide as much of the menu as possible to the user,
|
10849 | // so give them whatever is available below rather than the minHeight.
|
10850 |
|
10851 | if (!isFixedPosition && scrollSpaceAbove >= minHeight || isFixedPosition && viewSpaceAbove >= minHeight) {
|
10852 | _constrainedHeight2 = isFixedPosition ? viewSpaceAbove - marginTop : scrollSpaceAbove - marginTop;
|
10853 | }
|
10854 |
|
10855 | if (shouldScroll) {
|
10856 | animatedScrollTo(scrollParent, scrollUp, scrollDuration);
|
10857 | }
|
10858 |
|
10859 | return {
|
10860 | placement: 'top',
|
10861 | maxHeight: _constrainedHeight2
|
10862 | };
|
10863 | } // 4. not enough space, the browser WILL NOT increase scrollable area when
|
10864 | // absolutely positioned element rendered above the viewport (only below).
|
10865 | // Flip the menu, render below
|
10866 |
|
10867 |
|
10868 | return {
|
10869 | placement: 'bottom',
|
10870 | maxHeight: maxHeight
|
10871 | };
|
10872 |
|
10873 | default:
|
10874 | throw new Error("Invalid placement provided \"".concat(placement, "\"."));
|
10875 | } // fulfil contract with flow: implicit return value of undefined
|
10876 |
|
10877 |
|
10878 | return defaultState;
|
10879 | } // Menu Component
|
10880 | // ------------------------------
|
10881 |
|
10882 | function alignToControl(placement) {
|
10883 | var placementToCSSProp = {
|
10884 | bottom: 'top',
|
10885 | top: 'bottom'
|
10886 | };
|
10887 | return placement ? placementToCSSProp[placement] : 'bottom';
|
10888 | }
|
10889 |
|
10890 | var coercePlacement = function coercePlacement(p) {
|
10891 | return p === 'auto' ? 'bottom' : p;
|
10892 | };
|
10893 |
|
10894 | var menuCSS = function menuCSS(_ref2) {
|
10895 | var _ref3;
|
10896 |
|
10897 | var placement = _ref2.placement,
|
10898 | _ref2$theme = _ref2.theme,
|
10899 | borderRadius = _ref2$theme.borderRadius,
|
10900 | spacing = _ref2$theme.spacing,
|
10901 | colors = _ref2$theme.colors;
|
10902 | return _ref3 = {
|
10903 | label: 'menu'
|
10904 | }, _defineProperty$1(_ref3, alignToControl(placement), '100%'), _defineProperty$1(_ref3, "backgroundColor", colors.neutral0), _defineProperty$1(_ref3, "borderRadius", borderRadius), _defineProperty$1(_ref3, "boxShadow", '0 0 0 1px hsla(0, 0%, 0%, 0.1), 0 4px 11px hsla(0, 0%, 0%, 0.1)'), _defineProperty$1(_ref3, "marginBottom", spacing.menuGutter), _defineProperty$1(_ref3, "marginTop", spacing.menuGutter), _defineProperty$1(_ref3, "position", 'absolute'), _defineProperty$1(_ref3, "width", '100%'), _defineProperty$1(_ref3, "zIndex", 1), _ref3;
|
10905 | }; // NOTE: internal only
|
10906 |
|
10907 | var MenuPlacer =
|
10908 | /*#__PURE__*/
|
10909 | function (_Component) {
|
10910 | _inherits(MenuPlacer, _Component);
|
10911 |
|
10912 | function MenuPlacer() {
|
10913 | var _getPrototypeOf2;
|
10914 |
|
10915 | var _this;
|
10916 |
|
10917 | _classCallCheck(this, MenuPlacer);
|
10918 |
|
10919 | for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
10920 | args[_key] = arguments[_key];
|
10921 | }
|
10922 |
|
10923 | _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(MenuPlacer)).call.apply(_getPrototypeOf2, [this].concat(args)));
|
10924 |
|
10925 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "state", {
|
10926 | maxHeight: _this.props.maxMenuHeight,
|
10927 | placement: null
|
10928 | });
|
10929 |
|
10930 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "getPlacement", function (ref) {
|
10931 | var _this$props = _this.props,
|
10932 | minMenuHeight = _this$props.minMenuHeight,
|
10933 | maxMenuHeight = _this$props.maxMenuHeight,
|
10934 | menuPlacement = _this$props.menuPlacement,
|
10935 | menuPosition = _this$props.menuPosition,
|
10936 | menuShouldScrollIntoView = _this$props.menuShouldScrollIntoView,
|
10937 | theme = _this$props.theme;
|
10938 | var getPortalPlacement = _this.context.getPortalPlacement;
|
10939 | if (!ref) return; // DO NOT scroll if position is fixed
|
10940 |
|
10941 | var isFixedPosition = menuPosition === 'fixed';
|
10942 | var shouldScroll = menuShouldScrollIntoView && !isFixedPosition;
|
10943 | var state = getMenuPlacement({
|
10944 | maxHeight: maxMenuHeight,
|
10945 | menuEl: ref,
|
10946 | minHeight: minMenuHeight,
|
10947 | placement: menuPlacement,
|
10948 | shouldScroll: shouldScroll,
|
10949 | isFixedPosition: isFixedPosition,
|
10950 | theme: theme
|
10951 | });
|
10952 | if (getPortalPlacement) getPortalPlacement(state);
|
10953 |
|
10954 | _this.setState(state);
|
10955 | });
|
10956 |
|
10957 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "getUpdatedProps", function () {
|
10958 | var menuPlacement = _this.props.menuPlacement;
|
10959 | var placement = _this.state.placement || coercePlacement(menuPlacement);
|
10960 | return _objectSpread({}, _this.props, {
|
10961 | placement: placement,
|
10962 | maxHeight: _this.state.maxHeight
|
10963 | });
|
10964 | });
|
10965 |
|
10966 | return _this;
|
10967 | }
|
10968 |
|
10969 | _createClass(MenuPlacer, [{
|
10970 | key: "render",
|
10971 | value: function render() {
|
10972 | var children = this.props.children;
|
10973 | return children({
|
10974 | ref: this.getPlacement,
|
10975 | placerProps: this.getUpdatedProps()
|
10976 | });
|
10977 | }
|
10978 | }]);
|
10979 |
|
10980 | return MenuPlacer;
|
10981 | }(Component);
|
10982 |
|
10983 | _defineProperty$1(MenuPlacer, "contextTypes", {
|
10984 | getPortalPlacement: PropTypes.func
|
10985 | });
|
10986 |
|
10987 | var Menu$1 = function Menu$$1(props) {
|
10988 | var children = props.children,
|
10989 | className = props.className,
|
10990 | cx$$1 = props.cx,
|
10991 | getStyles = props.getStyles,
|
10992 | innerRef = props.innerRef,
|
10993 | innerProps = props.innerProps;
|
10994 | var cn = cx$$1(
|
10995 | /*#__PURE__*/
|
10996 | css$1(getStyles('menu', props)), {
|
10997 | menu: true
|
10998 | }, className);
|
10999 | return React.createElement("div", _extends$2({
|
11000 | className: cn
|
11001 | }, innerProps, {
|
11002 | ref: innerRef
|
11003 | }), children);
|
11004 | };
|
11005 | // Menu List
|
11006 | // ==============================
|
11007 |
|
11008 | var menuListCSS = function menuListCSS(_ref4) {
|
11009 | var maxHeight = _ref4.maxHeight,
|
11010 | baseUnit = _ref4.theme.spacing.baseUnit;
|
11011 | return {
|
11012 | maxHeight: maxHeight,
|
11013 | overflowY: 'auto',
|
11014 | paddingBottom: baseUnit,
|
11015 | paddingTop: baseUnit,
|
11016 | position: 'relative',
|
11017 | // required for offset[Height, Top] > keyboard scroll
|
11018 | WebkitOverflowScrolling: 'touch'
|
11019 | };
|
11020 | };
|
11021 | var MenuList = function MenuList(props) {
|
11022 | var children = props.children,
|
11023 | className = props.className,
|
11024 | cx$$1 = props.cx,
|
11025 | getStyles = props.getStyles,
|
11026 | isMulti = props.isMulti,
|
11027 | innerRef = props.innerRef;
|
11028 | return React.createElement("div", {
|
11029 | className: cx$$1(
|
11030 | /*#__PURE__*/
|
11031 | css$1(getStyles('menuList', props)), {
|
11032 | 'menu-list': true,
|
11033 | 'menu-list--is-multi': isMulti
|
11034 | }, className),
|
11035 | ref: innerRef
|
11036 | }, children);
|
11037 | }; // ==============================
|
11038 | // Menu Notices
|
11039 | // ==============================
|
11040 |
|
11041 | var noticeCSS = function noticeCSS(_ref5) {
|
11042 | var _ref5$theme = _ref5.theme,
|
11043 | baseUnit = _ref5$theme.spacing.baseUnit,
|
11044 | colors = _ref5$theme.colors;
|
11045 | return {
|
11046 | color: colors.neutral40,
|
11047 | padding: "".concat(baseUnit * 2, "px ").concat(baseUnit * 3, "px"),
|
11048 | textAlign: 'center'
|
11049 | };
|
11050 | };
|
11051 |
|
11052 | var noOptionsMessageCSS = noticeCSS;
|
11053 | var loadingMessageCSS = noticeCSS;
|
11054 | var NoOptionsMessage = function NoOptionsMessage(props) {
|
11055 | var children = props.children,
|
11056 | className = props.className,
|
11057 | cx$$1 = props.cx,
|
11058 | getStyles = props.getStyles,
|
11059 | innerProps = props.innerProps;
|
11060 | return React.createElement("div", _extends$2({
|
11061 | className: cx$$1(
|
11062 | /*#__PURE__*/
|
11063 | css$1(getStyles('noOptionsMessage', props)), {
|
11064 | 'menu-notice': true,
|
11065 | 'menu-notice--no-options': true
|
11066 | }, className)
|
11067 | }, innerProps), children);
|
11068 | };
|
11069 | NoOptionsMessage.defaultProps = {
|
11070 | children: 'No options'
|
11071 | };
|
11072 | var LoadingMessage = function LoadingMessage(props) {
|
11073 | var children = props.children,
|
11074 | className = props.className,
|
11075 | cx$$1 = props.cx,
|
11076 | getStyles = props.getStyles,
|
11077 | innerProps = props.innerProps;
|
11078 | return React.createElement("div", _extends$2({
|
11079 | className: cx$$1(
|
11080 | /*#__PURE__*/
|
11081 | css$1(getStyles('loadingMessage', props)), {
|
11082 | 'menu-notice': true,
|
11083 | 'menu-notice--loading': true
|
11084 | }, className)
|
11085 | }, innerProps), children);
|
11086 | };
|
11087 | LoadingMessage.defaultProps = {
|
11088 | children: 'Loading...'
|
11089 | }; // ==============================
|
11090 | // Menu Portal
|
11091 | // ==============================
|
11092 |
|
11093 | var menuPortalCSS = function menuPortalCSS(_ref6) {
|
11094 | var rect = _ref6.rect,
|
11095 | offset = _ref6.offset,
|
11096 | position = _ref6.position;
|
11097 | return {
|
11098 | left: rect.left,
|
11099 | position: position,
|
11100 | top: offset,
|
11101 | width: rect.width,
|
11102 | zIndex: 1
|
11103 | };
|
11104 | };
|
11105 | var MenuPortal =
|
11106 | /*#__PURE__*/
|
11107 | function (_Component2) {
|
11108 | _inherits(MenuPortal, _Component2);
|
11109 |
|
11110 | function MenuPortal() {
|
11111 | var _getPrototypeOf3;
|
11112 |
|
11113 | var _this2;
|
11114 |
|
11115 | _classCallCheck(this, MenuPortal);
|
11116 |
|
11117 | for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
11118 | args[_key2] = arguments[_key2];
|
11119 | }
|
11120 |
|
11121 | _this2 = _possibleConstructorReturn(this, (_getPrototypeOf3 = _getPrototypeOf(MenuPortal)).call.apply(_getPrototypeOf3, [this].concat(args)));
|
11122 |
|
11123 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this2)), "state", {
|
11124 | placement: null
|
11125 | });
|
11126 |
|
11127 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this2)), "getPortalPlacement", function (_ref7) {
|
11128 | var placement = _ref7.placement;
|
11129 | var initialPlacement = coercePlacement(_this2.props.menuPlacement); // avoid re-renders if the placement has not changed
|
11130 |
|
11131 | if (placement !== initialPlacement) {
|
11132 | _this2.setState({
|
11133 | placement: placement
|
11134 | });
|
11135 | }
|
11136 | });
|
11137 |
|
11138 | return _this2;
|
11139 | }
|
11140 |
|
11141 | _createClass(MenuPortal, [{
|
11142 | key: "getChildContext",
|
11143 | value: function getChildContext() {
|
11144 | return {
|
11145 | getPortalPlacement: this.getPortalPlacement
|
11146 | };
|
11147 | } // callback for occassions where the menu must "flip"
|
11148 |
|
11149 | }, {
|
11150 | key: "render",
|
11151 | value: function render() {
|
11152 | var _this$props2 = this.props,
|
11153 | appendTo = _this$props2.appendTo,
|
11154 | children = _this$props2.children,
|
11155 | controlElement = _this$props2.controlElement,
|
11156 | menuPlacement = _this$props2.menuPlacement,
|
11157 | position = _this$props2.menuPosition,
|
11158 | getStyles = _this$props2.getStyles;
|
11159 | var isFixed = position === 'fixed'; // bail early if required elements aren't present
|
11160 |
|
11161 | if (!appendTo && !isFixed || !controlElement) {
|
11162 | return null;
|
11163 | }
|
11164 |
|
11165 | var placement = this.state.placement || coercePlacement(menuPlacement);
|
11166 | var rect = getBoundingClientObj(controlElement);
|
11167 | var scrollDistance = isFixed ? 0 : window.pageYOffset;
|
11168 | var offset = rect[placement] + scrollDistance;
|
11169 | var state = {
|
11170 | offset: offset,
|
11171 | position: position,
|
11172 | rect: rect
|
11173 | }; // same wrapper element whether fixed or portalled
|
11174 |
|
11175 | var menuWrapper = React.createElement("div", {
|
11176 | className:
|
11177 | /*#__PURE__*/
|
11178 |
|
11179 | /*#__PURE__*/
|
11180 | css$1(getStyles('menuPortal', state))
|
11181 | }, children);
|
11182 | return appendTo ? createPortal(menuWrapper, appendTo) : menuWrapper;
|
11183 | }
|
11184 | }]);
|
11185 |
|
11186 | return MenuPortal;
|
11187 | }(Component);
|
11188 |
|
11189 | _defineProperty$1(MenuPortal, "childContextTypes", {
|
11190 | getPortalPlacement: PropTypes.func
|
11191 | });
|
11192 |
|
11193 | var isArray = Array.isArray;
|
11194 | var keyList = Object.keys;
|
11195 | var hasProp = Object.prototype.hasOwnProperty;
|
11196 |
|
11197 | function equal(a, b) {
|
11198 | // fast-deep-equal index.js 2.0.1
|
11199 | if (a === b) return true;
|
11200 |
|
11201 | if (a && b && _typeof(a) == 'object' && _typeof(b) == 'object') {
|
11202 | var arrA = isArray(a),
|
11203 | arrB = isArray(b),
|
11204 | i,
|
11205 | length,
|
11206 | key;
|
11207 |
|
11208 | if (arrA && arrB) {
|
11209 | length = a.length;
|
11210 | if (length != b.length) return false;
|
11211 |
|
11212 | for (i = length; i-- !== 0;) {
|
11213 | if (!equal(a[i], b[i])) return false;
|
11214 | }
|
11215 |
|
11216 | return true;
|
11217 | }
|
11218 |
|
11219 | if (arrA != arrB) return false;
|
11220 | var dateA = a instanceof Date,
|
11221 | dateB = b instanceof Date;
|
11222 | if (dateA != dateB) return false;
|
11223 | if (dateA && dateB) return a.getTime() == b.getTime();
|
11224 | var regexpA = a instanceof RegExp,
|
11225 | regexpB = b instanceof RegExp;
|
11226 | if (regexpA != regexpB) return false;
|
11227 | if (regexpA && regexpB) return a.toString() == b.toString();
|
11228 | var keys = keyList(a);
|
11229 | length = keys.length;
|
11230 |
|
11231 | if (length !== keyList(b).length) {
|
11232 | return false;
|
11233 | }
|
11234 |
|
11235 | for (i = length; i-- !== 0;) {
|
11236 | if (!hasProp.call(b, keys[i])) return false;
|
11237 | } // end fast-deep-equal
|
11238 | // Custom handling for React
|
11239 |
|
11240 |
|
11241 | for (i = length; i-- !== 0;) {
|
11242 | key = keys[i];
|
11243 |
|
11244 | if (key === '_owner' && a.$$typeof) {
|
11245 | // React-specific: avoid traversing React elements' _owner.
|
11246 | // _owner contains circular references
|
11247 | // and is not needed when comparing the actual elements (and not their owners)
|
11248 | // .$$typeof and ._store on just reasonable markers of a react element
|
11249 | continue;
|
11250 | } else {
|
11251 | // all other properties should be traversed as usual
|
11252 | if (!equal(a[key], b[key])) return false;
|
11253 | }
|
11254 | } // fast-deep-equal index.js 2.0.1
|
11255 |
|
11256 |
|
11257 | return true;
|
11258 | }
|
11259 |
|
11260 | return a !== a && b !== b;
|
11261 | } // end fast-deep-equal
|
11262 |
|
11263 |
|
11264 | function exportedEqual(a, b) {
|
11265 | try {
|
11266 | return equal(a, b);
|
11267 | } catch (error) {
|
11268 | if (error.message && error.message.match(/stack|recursion/i)) {
|
11269 | // warn on circular references, don't crash
|
11270 | // browsers give this different errors name and messages:
|
11271 | // chrome/safari: "RangeError", "Maximum call stack size exceeded"
|
11272 | // firefox: "InternalError", too much recursion"
|
11273 | // edge: "Error", "Out of stack space"
|
11274 | console.warn('Warning: react-fast-compare does not handle circular references.', error.name, error.message);
|
11275 | return false;
|
11276 | } // some other error. we should definitely know about these
|
11277 |
|
11278 |
|
11279 | throw error;
|
11280 | }
|
11281 | }
|
11282 |
|
11283 | var diacritics = [{
|
11284 | base: 'A',
|
11285 | letters: /[\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F]/g
|
11286 | }, {
|
11287 | base: 'AA',
|
11288 | letters: /[\uA732]/g
|
11289 | }, {
|
11290 | base: 'AE',
|
11291 | letters: /[\u00C6\u01FC\u01E2]/g
|
11292 | }, {
|
11293 | base: 'AO',
|
11294 | letters: /[\uA734]/g
|
11295 | }, {
|
11296 | base: 'AU',
|
11297 | letters: /[\uA736]/g
|
11298 | }, {
|
11299 | base: 'AV',
|
11300 | letters: /[\uA738\uA73A]/g
|
11301 | }, {
|
11302 | base: 'AY',
|
11303 | letters: /[\uA73C]/g
|
11304 | }, {
|
11305 | base: 'B',
|
11306 | letters: /[\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181]/g
|
11307 | }, {
|
11308 | base: 'C',
|
11309 | letters: /[\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E]/g
|
11310 | }, {
|
11311 | base: 'D',
|
11312 | letters: /[\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779]/g
|
11313 | }, {
|
11314 | base: 'DZ',
|
11315 | letters: /[\u01F1\u01C4]/g
|
11316 | }, {
|
11317 | base: 'Dz',
|
11318 | letters: /[\u01F2\u01C5]/g
|
11319 | }, {
|
11320 | base: 'E',
|
11321 | letters: /[\u0045\u24BA\uFF25\u00C8\u00C9\u00CA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\u00CB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E]/g
|
11322 | }, {
|
11323 | base: 'F',
|
11324 | letters: /[\u0046\u24BB\uFF26\u1E1E\u0191\uA77B]/g
|
11325 | }, {
|
11326 | base: 'G',
|
11327 | letters: /[\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E]/g
|
11328 | }, {
|
11329 | base: 'H',
|
11330 | letters: /[\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D]/g
|
11331 | }, {
|
11332 | base: 'I',
|
11333 | letters: /[\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197]/g
|
11334 | }, {
|
11335 | base: 'J',
|
11336 | letters: /[\u004A\u24BF\uFF2A\u0134\u0248]/g
|
11337 | }, {
|
11338 | base: 'K',
|
11339 | letters: /[\u004B\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2]/g
|
11340 | }, {
|
11341 | base: 'L',
|
11342 | letters: /[\u004C\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780]/g
|
11343 | }, {
|
11344 | base: 'LJ',
|
11345 | letters: /[\u01C7]/g
|
11346 | }, {
|
11347 | base: 'Lj',
|
11348 | letters: /[\u01C8]/g
|
11349 | }, {
|
11350 | base: 'M',
|
11351 | letters: /[\u004D\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C]/g
|
11352 | }, {
|
11353 | base: 'N',
|
11354 | letters: /[\u004E\u24C3\uFF2E\u01F8\u0143\u00D1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4]/g
|
11355 | }, {
|
11356 | base: 'NJ',
|
11357 | letters: /[\u01CA]/g
|
11358 | }, {
|
11359 | base: 'Nj',
|
11360 | letters: /[\u01CB]/g
|
11361 | }, {
|
11362 | base: 'O',
|
11363 | letters: /[\u004F\u24C4\uFF2F\u00D2\u00D3\u00D4\u1ED2\u1ED0\u1ED6\u1ED4\u00D5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\u00D6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\u00D8\u01FE\u0186\u019F\uA74A\uA74C]/g
|
11364 | }, {
|
11365 | base: 'OI',
|
11366 | letters: /[\u01A2]/g
|
11367 | }, {
|
11368 | base: 'OO',
|
11369 | letters: /[\uA74E]/g
|
11370 | }, {
|
11371 | base: 'OU',
|
11372 | letters: /[\u0222]/g
|
11373 | }, {
|
11374 | base: 'P',
|
11375 | letters: /[\u0050\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754]/g
|
11376 | }, {
|
11377 | base: 'Q',
|
11378 | letters: /[\u0051\u24C6\uFF31\uA756\uA758\u024A]/g
|
11379 | }, {
|
11380 | base: 'R',
|
11381 | letters: /[\u0052\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782]/g
|
11382 | }, {
|
11383 | base: 'S',
|
11384 | letters: /[\u0053\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784]/g
|
11385 | }, {
|
11386 | base: 'T',
|
11387 | letters: /[\u0054\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786]/g
|
11388 | }, {
|
11389 | base: 'TZ',
|
11390 | letters: /[\uA728]/g
|
11391 | }, {
|
11392 | base: 'U',
|
11393 | letters: /[\u0055\u24CA\uFF35\u00D9\u00DA\u00DB\u0168\u1E78\u016A\u1E7A\u016C\u00DC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244]/g
|
11394 | }, {
|
11395 | base: 'V',
|
11396 | letters: /[\u0056\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245]/g
|
11397 | }, {
|
11398 | base: 'VY',
|
11399 | letters: /[\uA760]/g
|
11400 | }, {
|
11401 | base: 'W',
|
11402 | letters: /[\u0057\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72]/g
|
11403 | }, {
|
11404 | base: 'X',
|
11405 | letters: /[\u0058\u24CD\uFF38\u1E8A\u1E8C]/g
|
11406 | }, {
|
11407 | base: 'Y',
|
11408 | letters: /[\u0059\u24CE\uFF39\u1EF2\u00DD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE]/g
|
11409 | }, {
|
11410 | base: 'Z',
|
11411 | letters: /[\u005A\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762]/g
|
11412 | }, {
|
11413 | base: 'a',
|
11414 | letters: /[\u0061\u24D0\uFF41\u1E9A\u00E0\u00E1\u00E2\u1EA7\u1EA5\u1EAB\u1EA9\u00E3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\u00E4\u01DF\u1EA3\u00E5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250]/g
|
11415 | }, {
|
11416 | base: 'aa',
|
11417 | letters: /[\uA733]/g
|
11418 | }, {
|
11419 | base: 'ae',
|
11420 | letters: /[\u00E6\u01FD\u01E3]/g
|
11421 | }, {
|
11422 | base: 'ao',
|
11423 | letters: /[\uA735]/g
|
11424 | }, {
|
11425 | base: 'au',
|
11426 | letters: /[\uA737]/g
|
11427 | }, {
|
11428 | base: 'av',
|
11429 | letters: /[\uA739\uA73B]/g
|
11430 | }, {
|
11431 | base: 'ay',
|
11432 | letters: /[\uA73D]/g
|
11433 | }, {
|
11434 | base: 'b',
|
11435 | letters: /[\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253]/g
|
11436 | }, {
|
11437 | base: 'c',
|
11438 | letters: /[\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184]/g
|
11439 | }, {
|
11440 | base: 'd',
|
11441 | letters: /[\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A]/g
|
11442 | }, {
|
11443 | base: 'dz',
|
11444 | letters: /[\u01F3\u01C6]/g
|
11445 | }, {
|
11446 | base: 'e',
|
11447 | letters: /[\u0065\u24D4\uFF45\u00E8\u00E9\u00EA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\u00EB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD]/g
|
11448 | }, {
|
11449 | base: 'f',
|
11450 | letters: /[\u0066\u24D5\uFF46\u1E1F\u0192\uA77C]/g
|
11451 | }, {
|
11452 | base: 'g',
|
11453 | letters: /[\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F]/g
|
11454 | }, {
|
11455 | base: 'h',
|
11456 | letters: /[\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265]/g
|
11457 | }, {
|
11458 | base: 'hv',
|
11459 | letters: /[\u0195]/g
|
11460 | }, {
|
11461 | base: 'i',
|
11462 | letters: /[\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131]/g
|
11463 | }, {
|
11464 | base: 'j',
|
11465 | letters: /[\u006A\u24D9\uFF4A\u0135\u01F0\u0249]/g
|
11466 | }, {
|
11467 | base: 'k',
|
11468 | letters: /[\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3]/g
|
11469 | }, {
|
11470 | base: 'l',
|
11471 | letters: /[\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747]/g
|
11472 | }, {
|
11473 | base: 'lj',
|
11474 | letters: /[\u01C9]/g
|
11475 | }, {
|
11476 | base: 'm',
|
11477 | letters: /[\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F]/g
|
11478 | }, {
|
11479 | base: 'n',
|
11480 | letters: /[\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5]/g
|
11481 | }, {
|
11482 | base: 'nj',
|
11483 | letters: /[\u01CC]/g
|
11484 | }, {
|
11485 | base: 'o',
|
11486 | letters: /[\u006F\u24DE\uFF4F\u00F2\u00F3\u00F4\u1ED3\u1ED1\u1ED7\u1ED5\u00F5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\u00F6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\u00F8\u01FF\u0254\uA74B\uA74D\u0275]/g
|
11487 | }, {
|
11488 | base: 'oi',
|
11489 | letters: /[\u01A3]/g
|
11490 | }, {
|
11491 | base: 'ou',
|
11492 | letters: /[\u0223]/g
|
11493 | }, {
|
11494 | base: 'oo',
|
11495 | letters: /[\uA74F]/g
|
11496 | }, {
|
11497 | base: 'p',
|
11498 | letters: /[\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755]/g
|
11499 | }, {
|
11500 | base: 'q',
|
11501 | letters: /[\u0071\u24E0\uFF51\u024B\uA757\uA759]/g
|
11502 | }, {
|
11503 | base: 'r',
|
11504 | letters: /[\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783]/g
|
11505 | }, {
|
11506 | base: 's',
|
11507 | letters: /[\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B]/g
|
11508 | }, {
|
11509 | base: 't',
|
11510 | letters: /[\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787]/g
|
11511 | }, {
|
11512 | base: 'tz',
|
11513 | letters: /[\uA729]/g
|
11514 | }, {
|
11515 | base: 'u',
|
11516 | letters: /[\u0075\u24E4\uFF55\u00F9\u00FA\u00FB\u0169\u1E79\u016B\u1E7B\u016D\u00FC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289]/g
|
11517 | }, {
|
11518 | base: 'v',
|
11519 | letters: /[\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C]/g
|
11520 | }, {
|
11521 | base: 'vy',
|
11522 | letters: /[\uA761]/g
|
11523 | }, {
|
11524 | base: 'w',
|
11525 | letters: /[\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73]/g
|
11526 | }, {
|
11527 | base: 'x',
|
11528 | letters: /[\u0078\u24E7\uFF58\u1E8B\u1E8D]/g
|
11529 | }, {
|
11530 | base: 'y',
|
11531 | letters: /[\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF]/g
|
11532 | }, {
|
11533 | base: 'z',
|
11534 | letters: /[\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763]/g
|
11535 | }];
|
11536 | var stripDiacritics = function stripDiacritics(str) {
|
11537 | for (var i = 0; i < diacritics.length; i++) {
|
11538 | str = str.replace(diacritics[i].letters, diacritics[i].base);
|
11539 | }
|
11540 |
|
11541 | return str;
|
11542 | };
|
11543 |
|
11544 | var trimString = function trimString(str) {
|
11545 | return str.replace(/^\s+|\s+$/g, '');
|
11546 | };
|
11547 |
|
11548 | var defaultStringify = function defaultStringify(option) {
|
11549 | return "".concat(option.label, " ").concat(option.value);
|
11550 | };
|
11551 |
|
11552 | var createFilter = function createFilter(config) {
|
11553 | return function (option, rawInput) {
|
11554 | var _ignoreCase$ignoreAcc = _objectSpread({
|
11555 | ignoreCase: true,
|
11556 | ignoreAccents: true,
|
11557 | stringify: defaultStringify,
|
11558 | trim: true,
|
11559 | matchFrom: 'any'
|
11560 | }, config),
|
11561 | ignoreCase = _ignoreCase$ignoreAcc.ignoreCase,
|
11562 | ignoreAccents = _ignoreCase$ignoreAcc.ignoreAccents,
|
11563 | stringify = _ignoreCase$ignoreAcc.stringify,
|
11564 | trim = _ignoreCase$ignoreAcc.trim,
|
11565 | matchFrom = _ignoreCase$ignoreAcc.matchFrom;
|
11566 |
|
11567 | var input = trim ? trimString(rawInput) : rawInput;
|
11568 | var candidate = trim ? trimString(stringify(option)) : stringify(option);
|
11569 |
|
11570 | if (ignoreCase) {
|
11571 | input = input.toLowerCase();
|
11572 | candidate = candidate.toLowerCase();
|
11573 | }
|
11574 |
|
11575 | if (ignoreAccents) {
|
11576 | input = stripDiacritics(input);
|
11577 | candidate = stripDiacritics(candidate);
|
11578 | }
|
11579 |
|
11580 | return matchFrom === 'start' ? candidate.substr(0, input.length) === input : candidate.indexOf(input) > -1;
|
11581 | };
|
11582 | };
|
11583 |
|
11584 | var A11yText = function A11yText(props) {
|
11585 | return React.createElement("span", _extends$2({
|
11586 | className:
|
11587 | /*#__PURE__*/
|
11588 |
|
11589 | /*#__PURE__*/
|
11590 | css$1({
|
11591 | label: 'a11yText',
|
11592 | zIndex: 9999,
|
11593 | border: 0,
|
11594 | clip: 'rect(1px, 1px, 1px, 1px)',
|
11595 | height: 1,
|
11596 | width: 1,
|
11597 | position: 'absolute',
|
11598 | overflow: 'hidden',
|
11599 | padding: 0,
|
11600 | whiteSpace: 'nowrap',
|
11601 | backgroundColor: 'red',
|
11602 | color: 'blue'
|
11603 | })
|
11604 | }, props));
|
11605 | };
|
11606 |
|
11607 | var DummyInput =
|
11608 | /*#__PURE__*/
|
11609 | function (_Component) {
|
11610 | _inherits(DummyInput, _Component);
|
11611 |
|
11612 | function DummyInput() {
|
11613 | _classCallCheck(this, DummyInput);
|
11614 |
|
11615 | return _possibleConstructorReturn(this, _getPrototypeOf(DummyInput).apply(this, arguments));
|
11616 | }
|
11617 |
|
11618 | _createClass(DummyInput, [{
|
11619 | key: "render",
|
11620 | value: function render() {
|
11621 | var _this$props = this.props,
|
11622 | inProp = _this$props.in,
|
11623 | out = _this$props.out,
|
11624 | onExited = _this$props.onExited,
|
11625 | appear = _this$props.appear,
|
11626 | enter = _this$props.enter,
|
11627 | exit = _this$props.exit,
|
11628 | innerRef = _this$props.innerRef,
|
11629 | emotion = _this$props.emotion,
|
11630 | props = _objectWithoutProperties(_this$props, ["in", "out", "onExited", "appear", "enter", "exit", "innerRef", "emotion"]);
|
11631 |
|
11632 | return React.createElement("input", _extends$2({
|
11633 | ref: innerRef
|
11634 | }, props, {
|
11635 | className:
|
11636 | /*#__PURE__*/
|
11637 |
|
11638 | /*#__PURE__*/
|
11639 | css$1({
|
11640 | label: 'dummyInput',
|
11641 | // get rid of any default styles
|
11642 | background: 0,
|
11643 | border: 0,
|
11644 | fontSize: 'inherit',
|
11645 | outline: 0,
|
11646 | padding: 0,
|
11647 | // important! without `width` browsers won't allow focus
|
11648 | width: 1,
|
11649 | // remove cursor on desktop
|
11650 | color: 'transparent',
|
11651 | // remove cursor on mobile whilst maintaining "scroll into view" behaviour
|
11652 | left: -100,
|
11653 | opacity: 0,
|
11654 | position: 'relative',
|
11655 | transform: 'scale(0)'
|
11656 | })
|
11657 | }));
|
11658 | }
|
11659 | }]);
|
11660 |
|
11661 | return DummyInput;
|
11662 | }(Component);
|
11663 |
|
11664 | var NodeResolver =
|
11665 | /*#__PURE__*/
|
11666 | function (_Component) {
|
11667 | _inherits(NodeResolver, _Component);
|
11668 |
|
11669 | function NodeResolver() {
|
11670 | _classCallCheck(this, NodeResolver);
|
11671 |
|
11672 | return _possibleConstructorReturn(this, _getPrototypeOf(NodeResolver).apply(this, arguments));
|
11673 | }
|
11674 |
|
11675 | _createClass(NodeResolver, [{
|
11676 | key: "componentDidMount",
|
11677 | value: function componentDidMount() {
|
11678 | this.props.innerRef(findDOMNode(this));
|
11679 | }
|
11680 | }, {
|
11681 | key: "componentWillUnmount",
|
11682 | value: function componentWillUnmount() {
|
11683 | this.props.innerRef(null);
|
11684 | }
|
11685 | }, {
|
11686 | key: "render",
|
11687 | value: function render() {
|
11688 | return this.props.children;
|
11689 | }
|
11690 | }]);
|
11691 |
|
11692 | return NodeResolver;
|
11693 | }(Component);
|
11694 |
|
11695 | var STYLE_KEYS = ['boxSizing', 'height', 'overflow', 'paddingRight', 'position'];
|
11696 | var LOCK_STYLES = {
|
11697 | boxSizing: 'border-box',
|
11698 | // account for possible declaration `width: 100%;` on body
|
11699 | overflow: 'hidden',
|
11700 | position: 'relative',
|
11701 | height: '100%'
|
11702 | };
|
11703 |
|
11704 | function preventTouchMove(e) {
|
11705 | e.preventDefault();
|
11706 | }
|
11707 | function allowTouchMove(e) {
|
11708 | e.stopPropagation();
|
11709 | }
|
11710 | function preventInertiaScroll() {
|
11711 | var top = this.scrollTop;
|
11712 | var totalScroll = this.scrollHeight;
|
11713 | var currentScroll = top + this.offsetHeight;
|
11714 |
|
11715 | if (top === 0) {
|
11716 | this.scrollTop = 1;
|
11717 | } else if (currentScroll === totalScroll) {
|
11718 | this.scrollTop = top - 1;
|
11719 | }
|
11720 | } // `ontouchstart` check works on most browsers
|
11721 | // `maxTouchPoints` works on IE10/11 and Surface
|
11722 |
|
11723 | function isTouchDevice() {
|
11724 | return 'ontouchstart' in window || navigator.maxTouchPoints;
|
11725 | }
|
11726 |
|
11727 | var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
|
11728 | var activeScrollLocks = 0;
|
11729 |
|
11730 | var ScrollLock =
|
11731 | /*#__PURE__*/
|
11732 | function (_Component) {
|
11733 | _inherits(ScrollLock, _Component);
|
11734 |
|
11735 | function ScrollLock() {
|
11736 | var _getPrototypeOf2;
|
11737 |
|
11738 | var _this;
|
11739 |
|
11740 | _classCallCheck(this, ScrollLock);
|
11741 |
|
11742 | for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
11743 | args[_key] = arguments[_key];
|
11744 | }
|
11745 |
|
11746 | _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(ScrollLock)).call.apply(_getPrototypeOf2, [this].concat(args)));
|
11747 |
|
11748 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "originalStyles", {});
|
11749 |
|
11750 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "listenerOptions", {
|
11751 | capture: false,
|
11752 | passive: false
|
11753 | });
|
11754 |
|
11755 | return _this;
|
11756 | }
|
11757 |
|
11758 | _createClass(ScrollLock, [{
|
11759 | key: "componentDidMount",
|
11760 | value: function componentDidMount() {
|
11761 | var _this2 = this;
|
11762 |
|
11763 | if (!canUseDOM) return;
|
11764 | var _this$props = this.props,
|
11765 | accountForScrollbars = _this$props.accountForScrollbars,
|
11766 | touchScrollTarget = _this$props.touchScrollTarget;
|
11767 | var target = document.body;
|
11768 | var targetStyle = target && target.style;
|
11769 |
|
11770 | if (accountForScrollbars) {
|
11771 | // store any styles already applied to the body
|
11772 | STYLE_KEYS.forEach(function (key) {
|
11773 | var val = targetStyle && targetStyle[key];
|
11774 | _this2.originalStyles[key] = val;
|
11775 | });
|
11776 | } // apply the lock styles and padding if this is the first scroll lock
|
11777 |
|
11778 |
|
11779 | if (accountForScrollbars && activeScrollLocks < 1) {
|
11780 | var currentPadding = parseInt(this.originalStyles.paddingRight, 10) || 0;
|
11781 | var clientWidth = document.body ? document.body.clientWidth : 0;
|
11782 | var adjustedPadding = window.innerWidth - clientWidth + currentPadding || 0;
|
11783 | Object.keys(LOCK_STYLES).forEach(function (key) {
|
11784 | var val = LOCK_STYLES[key];
|
11785 |
|
11786 | if (targetStyle) {
|
11787 | targetStyle[key] = val;
|
11788 | }
|
11789 | });
|
11790 |
|
11791 | if (targetStyle) {
|
11792 | targetStyle.paddingRight = "".concat(adjustedPadding, "px");
|
11793 | }
|
11794 | } // account for touch devices
|
11795 |
|
11796 |
|
11797 | if (target && isTouchDevice()) {
|
11798 | // Mobile Safari ignores { overflow: hidden } declaration on the body.
|
11799 | target.addEventListener('touchmove', preventTouchMove, this.listenerOptions); // Allow scroll on provided target
|
11800 |
|
11801 | if (touchScrollTarget) {
|
11802 | touchScrollTarget.addEventListener('touchstart', preventInertiaScroll, this.listenerOptions);
|
11803 | touchScrollTarget.addEventListener('touchmove', allowTouchMove, this.listenerOptions);
|
11804 | }
|
11805 | } // increment active scroll locks
|
11806 |
|
11807 |
|
11808 | activeScrollLocks += 1;
|
11809 | }
|
11810 | }, {
|
11811 | key: "componentWillUnmount",
|
11812 | value: function componentWillUnmount() {
|
11813 | var _this3 = this;
|
11814 |
|
11815 | if (!canUseDOM) return;
|
11816 | var _this$props2 = this.props,
|
11817 | accountForScrollbars = _this$props2.accountForScrollbars,
|
11818 | touchScrollTarget = _this$props2.touchScrollTarget;
|
11819 | var target = document.body;
|
11820 | var targetStyle = target && target.style; // safely decrement active scroll locks
|
11821 |
|
11822 | activeScrollLocks = Math.max(activeScrollLocks - 1, 0); // reapply original body styles, if any
|
11823 |
|
11824 | if (accountForScrollbars && activeScrollLocks < 1) {
|
11825 | STYLE_KEYS.forEach(function (key) {
|
11826 | var val = _this3.originalStyles[key];
|
11827 |
|
11828 | if (targetStyle) {
|
11829 | targetStyle[key] = val;
|
11830 | }
|
11831 | });
|
11832 | } // remove touch listeners
|
11833 |
|
11834 |
|
11835 | if (target && isTouchDevice()) {
|
11836 | target.removeEventListener('touchmove', preventTouchMove, this.listenerOptions);
|
11837 |
|
11838 | if (touchScrollTarget) {
|
11839 | touchScrollTarget.removeEventListener('touchstart', preventInertiaScroll, this.listenerOptions);
|
11840 | touchScrollTarget.removeEventListener('touchmove', allowTouchMove, this.listenerOptions);
|
11841 | }
|
11842 | }
|
11843 | }
|
11844 | }, {
|
11845 | key: "render",
|
11846 | value: function render() {
|
11847 | return null;
|
11848 | }
|
11849 | }]);
|
11850 |
|
11851 | return ScrollLock;
|
11852 | }(Component);
|
11853 |
|
11854 | _defineProperty$1(ScrollLock, "defaultProps", {
|
11855 | accountForScrollbars: true
|
11856 | });
|
11857 |
|
11858 | // NOTE:
|
11859 | // We shouldn't need this after updating to React v16.3.0, which introduces:
|
11860 | // - createRef() https://reactjs.org/docs/react-api.html#reactcreateref
|
11861 | // - forwardRef() https://reactjs.org/docs/react-api.html#reactforwardref
|
11862 | var ScrollBlock =
|
11863 | /*#__PURE__*/
|
11864 | function (_PureComponent) {
|
11865 | _inherits(ScrollBlock, _PureComponent);
|
11866 |
|
11867 | function ScrollBlock() {
|
11868 | var _getPrototypeOf2;
|
11869 |
|
11870 | var _this;
|
11871 |
|
11872 | _classCallCheck(this, ScrollBlock);
|
11873 |
|
11874 | for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
11875 | args[_key] = arguments[_key];
|
11876 | }
|
11877 |
|
11878 | _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(ScrollBlock)).call.apply(_getPrototypeOf2, [this].concat(args)));
|
11879 |
|
11880 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "state", {
|
11881 | touchScrollTarget: null
|
11882 | });
|
11883 |
|
11884 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "getScrollTarget", function (ref) {
|
11885 | if (ref === _this.state.touchScrollTarget) return;
|
11886 |
|
11887 | _this.setState({
|
11888 | touchScrollTarget: ref
|
11889 | });
|
11890 | });
|
11891 |
|
11892 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "blurSelectInput", function () {
|
11893 | if (document.activeElement) {
|
11894 | document.activeElement.blur();
|
11895 | }
|
11896 | });
|
11897 |
|
11898 | return _this;
|
11899 | }
|
11900 |
|
11901 | _createClass(ScrollBlock, [{
|
11902 | key: "render",
|
11903 | value: function render() {
|
11904 | var _this$props = this.props,
|
11905 | children = _this$props.children,
|
11906 | isEnabled = _this$props.isEnabled;
|
11907 | var touchScrollTarget = this.state.touchScrollTarget; // bail early if not enabled
|
11908 |
|
11909 | if (!isEnabled) return children;
|
11910 | /*
|
11911 | * Div
|
11912 | * ------------------------------
|
11913 | * blocks scrolling on non-body elements behind the menu
|
11914 | * NodeResolver
|
11915 | * ------------------------------
|
11916 | * we need a reference to the scrollable element to "unlock" scroll on
|
11917 | * mobile devices
|
11918 | * ScrollLock
|
11919 | * ------------------------------
|
11920 | * actually does the scroll locking
|
11921 | */
|
11922 |
|
11923 | return React.createElement("div", null, React.createElement("div", {
|
11924 | onClick: this.blurSelectInput,
|
11925 | className:
|
11926 | /*#__PURE__*/
|
11927 |
|
11928 | /*#__PURE__*/
|
11929 | css$1({
|
11930 | position: 'fixed',
|
11931 | left: 0,
|
11932 | bottom: 0,
|
11933 | right: 0,
|
11934 | top: 0
|
11935 | })
|
11936 | }), React.createElement(NodeResolver, {
|
11937 | innerRef: this.getScrollTarget
|
11938 | }, children), touchScrollTarget ? React.createElement(ScrollLock, {
|
11939 | touchScrollTarget: touchScrollTarget
|
11940 | }) : null);
|
11941 | }
|
11942 | }]);
|
11943 |
|
11944 | return ScrollBlock;
|
11945 | }(PureComponent);
|
11946 |
|
11947 | var ScrollCaptor =
|
11948 | /*#__PURE__*/
|
11949 | function (_Component) {
|
11950 | _inherits(ScrollCaptor, _Component);
|
11951 |
|
11952 | function ScrollCaptor() {
|
11953 | var _getPrototypeOf2;
|
11954 |
|
11955 | var _this;
|
11956 |
|
11957 | _classCallCheck(this, ScrollCaptor);
|
11958 |
|
11959 | for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
11960 | args[_key] = arguments[_key];
|
11961 | }
|
11962 |
|
11963 | _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(ScrollCaptor)).call.apply(_getPrototypeOf2, [this].concat(args)));
|
11964 |
|
11965 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "isBottom", false);
|
11966 |
|
11967 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "isTop", false);
|
11968 |
|
11969 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "scrollTarget", void 0);
|
11970 |
|
11971 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "touchStart", void 0);
|
11972 |
|
11973 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "cancelScroll", function (event) {
|
11974 | event.preventDefault();
|
11975 | event.stopPropagation();
|
11976 | });
|
11977 |
|
11978 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "handleEventDelta", function (event, delta) {
|
11979 | var _this$props = _this.props,
|
11980 | onBottomArrive = _this$props.onBottomArrive,
|
11981 | onBottomLeave = _this$props.onBottomLeave,
|
11982 | onTopArrive = _this$props.onTopArrive,
|
11983 | onTopLeave = _this$props.onTopLeave;
|
11984 | var _this$scrollTarget = _this.scrollTarget,
|
11985 | scrollTop = _this$scrollTarget.scrollTop,
|
11986 | scrollHeight = _this$scrollTarget.scrollHeight,
|
11987 | clientHeight = _this$scrollTarget.clientHeight;
|
11988 | var target = _this.scrollTarget;
|
11989 | var isDeltaPositive = delta > 0;
|
11990 | var availableScroll = scrollHeight - clientHeight - scrollTop;
|
11991 | var shouldCancelScroll = false; // reset bottom/top flags
|
11992 |
|
11993 | if (availableScroll > delta && _this.isBottom) {
|
11994 | if (onBottomLeave) onBottomLeave(event);
|
11995 | _this.isBottom = false;
|
11996 | }
|
11997 |
|
11998 | if (isDeltaPositive && _this.isTop) {
|
11999 | if (onTopLeave) onTopLeave(event);
|
12000 | _this.isTop = false;
|
12001 | } // bottom limit
|
12002 |
|
12003 |
|
12004 | if (isDeltaPositive && delta > availableScroll) {
|
12005 | if (onBottomArrive && !_this.isBottom) {
|
12006 | onBottomArrive(event);
|
12007 | }
|
12008 |
|
12009 | target.scrollTop = scrollHeight;
|
12010 | shouldCancelScroll = true;
|
12011 | _this.isBottom = true; // top limit
|
12012 | } else if (!isDeltaPositive && -delta > scrollTop) {
|
12013 | if (onTopArrive && !_this.isTop) {
|
12014 | onTopArrive(event);
|
12015 | }
|
12016 |
|
12017 | target.scrollTop = 0;
|
12018 | shouldCancelScroll = true;
|
12019 | _this.isTop = true;
|
12020 | } // cancel scroll
|
12021 |
|
12022 |
|
12023 | if (shouldCancelScroll) {
|
12024 | _this.cancelScroll(event);
|
12025 | }
|
12026 | });
|
12027 |
|
12028 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "onWheel", function (event) {
|
12029 | _this.handleEventDelta(event, event.deltaY);
|
12030 | });
|
12031 |
|
12032 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "onTouchStart", function (event) {
|
12033 | // set touch start so we can calculate touchmove delta
|
12034 | _this.touchStart = event.changedTouches[0].clientY;
|
12035 | });
|
12036 |
|
12037 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "onTouchMove", function (event) {
|
12038 | var deltaY = _this.touchStart - event.changedTouches[0].clientY;
|
12039 |
|
12040 | _this.handleEventDelta(event, deltaY);
|
12041 | });
|
12042 |
|
12043 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "getScrollTarget", function (ref) {
|
12044 | _this.scrollTarget = ref;
|
12045 | });
|
12046 |
|
12047 | return _this;
|
12048 | }
|
12049 |
|
12050 | _createClass(ScrollCaptor, [{
|
12051 | key: "componentDidMount",
|
12052 | value: function componentDidMount() {
|
12053 | this.startListening(this.scrollTarget);
|
12054 | }
|
12055 | }, {
|
12056 | key: "componentWillUnmount",
|
12057 | value: function componentWillUnmount() {
|
12058 | this.stopListening(this.scrollTarget);
|
12059 | }
|
12060 | }, {
|
12061 | key: "startListening",
|
12062 | value: function startListening(el) {
|
12063 | // bail early if no scroll available
|
12064 | if (!el) return;
|
12065 | if (el.scrollHeight <= el.clientHeight) return; // all the if statements are to appease Flow 😢
|
12066 |
|
12067 | if (typeof el.addEventListener === 'function') {
|
12068 | el.addEventListener('wheel', this.onWheel, false);
|
12069 | }
|
12070 |
|
12071 | if (typeof el.addEventListener === 'function') {
|
12072 | el.addEventListener('touchstart', this.onTouchStart, false);
|
12073 | }
|
12074 |
|
12075 | if (typeof el.addEventListener === 'function') {
|
12076 | el.addEventListener('touchmove', this.onTouchMove, false);
|
12077 | }
|
12078 | }
|
12079 | }, {
|
12080 | key: "stopListening",
|
12081 | value: function stopListening(el) {
|
12082 | // bail early if no scroll available
|
12083 | if (el.scrollHeight <= el.clientHeight) return; // all the if statements are to appease Flow 😢
|
12084 |
|
12085 | if (typeof el.removeEventListener === 'function') {
|
12086 | el.removeEventListener('wheel', this.onWheel, false);
|
12087 | }
|
12088 |
|
12089 | if (typeof el.removeEventListener === 'function') {
|
12090 | el.removeEventListener('touchstart', this.onTouchStart, false);
|
12091 | }
|
12092 |
|
12093 | if (typeof el.removeEventListener === 'function') {
|
12094 | el.removeEventListener('touchmove', this.onTouchMove, false);
|
12095 | }
|
12096 | }
|
12097 | }, {
|
12098 | key: "render",
|
12099 | value: function render() {
|
12100 | return React.createElement(NodeResolver, {
|
12101 | innerRef: this.getScrollTarget
|
12102 | }, this.props.children);
|
12103 | }
|
12104 | }]);
|
12105 |
|
12106 | return ScrollCaptor;
|
12107 | }(Component);
|
12108 |
|
12109 | var ScrollCaptorSwitch =
|
12110 | /*#__PURE__*/
|
12111 | function (_Component2) {
|
12112 | _inherits(ScrollCaptorSwitch, _Component2);
|
12113 |
|
12114 | function ScrollCaptorSwitch() {
|
12115 | _classCallCheck(this, ScrollCaptorSwitch);
|
12116 |
|
12117 | return _possibleConstructorReturn(this, _getPrototypeOf(ScrollCaptorSwitch).apply(this, arguments));
|
12118 | }
|
12119 |
|
12120 | _createClass(ScrollCaptorSwitch, [{
|
12121 | key: "render",
|
12122 | value: function render() {
|
12123 | var _this$props2 = this.props,
|
12124 | isEnabled = _this$props2.isEnabled,
|
12125 | props = _objectWithoutProperties(_this$props2, ["isEnabled"]);
|
12126 |
|
12127 | return isEnabled ? React.createElement(ScrollCaptor, props) : this.props.children;
|
12128 | }
|
12129 | }]);
|
12130 |
|
12131 | return ScrollCaptorSwitch;
|
12132 | }(Component);
|
12133 |
|
12134 | _defineProperty$1(ScrollCaptorSwitch, "defaultProps", {
|
12135 | isEnabled: true
|
12136 | });
|
12137 |
|
12138 | var instructionsAriaMessage = function instructionsAriaMessage(event) {
|
12139 | var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
12140 | var isSearchable = context.isSearchable,
|
12141 | isMulti = context.isMulti,
|
12142 | label = context.label,
|
12143 | isDisabled = context.isDisabled;
|
12144 |
|
12145 | switch (event) {
|
12146 | case 'menu':
|
12147 | return "Use Up and Down to choose options".concat(isDisabled ? '' : ', press Enter to select the currently focused option', ", press Escape to exit the menu, press Tab to select the option and exit the menu.");
|
12148 |
|
12149 | case 'input':
|
12150 | return "".concat(label ? label : 'Select', " is focused ").concat(isSearchable ? ',type to refine list' : '', ", press Down to open the menu, ").concat(isMulti ? ' press left to focus selected values' : '');
|
12151 |
|
12152 | case 'value':
|
12153 | return 'Use left and right to toggle between focused values, press Backspace to remove the currently focused value';
|
12154 | }
|
12155 | };
|
12156 | var valueEventAriaMessage = function valueEventAriaMessage(event, context) {
|
12157 | var value = context.value,
|
12158 | isDisabled = context.isDisabled;
|
12159 | if (!value) return;
|
12160 |
|
12161 | switch (event) {
|
12162 | case 'deselect-option':
|
12163 | case 'pop-value':
|
12164 | case 'remove-value':
|
12165 | return "option ".concat(value, ", deselected.");
|
12166 |
|
12167 | case 'select-option':
|
12168 | return isDisabled ? "option ".concat(value, " is disabled. Select another option.") : "option ".concat(value, ", selected.");
|
12169 | }
|
12170 | };
|
12171 | var valueFocusAriaMessage = function valueFocusAriaMessage(_ref) {
|
12172 | var focusedValue = _ref.focusedValue,
|
12173 | getOptionLabel = _ref.getOptionLabel,
|
12174 | selectValue = _ref.selectValue;
|
12175 | return "value ".concat(getOptionLabel(focusedValue), " focused, ").concat(selectValue.indexOf(focusedValue) + 1, " of ").concat(selectValue.length, ".");
|
12176 | };
|
12177 | var optionFocusAriaMessage = function optionFocusAriaMessage(_ref2) {
|
12178 | var focusedOption = _ref2.focusedOption,
|
12179 | getOptionLabel = _ref2.getOptionLabel,
|
12180 | options = _ref2.options;
|
12181 | return "option ".concat(getOptionLabel(focusedOption), " focused").concat(focusedOption.isDisabled ? ' disabled' : '', ", ").concat(options.indexOf(focusedOption) + 1, " of ").concat(options.length, ".");
|
12182 | };
|
12183 | var resultsAriaMessage = function resultsAriaMessage(_ref3) {
|
12184 | var inputValue = _ref3.inputValue,
|
12185 | screenReaderMessage = _ref3.screenReaderMessage;
|
12186 | return "".concat(screenReaderMessage).concat(inputValue ? ' for search term ' + inputValue : '', ".");
|
12187 | };
|
12188 |
|
12189 | var formatGroupLabel = function formatGroupLabel(group) {
|
12190 | return group.label;
|
12191 | };
|
12192 | var getOptionLabel = function getOptionLabel(option) {
|
12193 | return option.label;
|
12194 | };
|
12195 | var getOptionValue = function getOptionValue(option) {
|
12196 | return option.value;
|
12197 | };
|
12198 | var isOptionDisabled = function isOptionDisabled(option) {
|
12199 | return !!option.isDisabled;
|
12200 | };
|
12201 |
|
12202 | var containerCSS = function containerCSS(_ref) {
|
12203 | var isDisabled = _ref.isDisabled,
|
12204 | isRtl = _ref.isRtl;
|
12205 | return {
|
12206 | label: 'container',
|
12207 | direction: isRtl ? 'rtl' : null,
|
12208 | pointerEvents: isDisabled ? 'none' : null,
|
12209 | // cancel mouse events when disabled
|
12210 | position: 'relative'
|
12211 | };
|
12212 | };
|
12213 | var SelectContainer = function SelectContainer(props) {
|
12214 | var children = props.children,
|
12215 | className = props.className,
|
12216 | cx$$1 = props.cx,
|
12217 | getStyles = props.getStyles,
|
12218 | innerProps = props.innerProps,
|
12219 | isDisabled = props.isDisabled,
|
12220 | isRtl = props.isRtl;
|
12221 | return React.createElement("div", _extends$2({
|
12222 | className: cx$$1(
|
12223 | /*#__PURE__*/
|
12224 | css$1(getStyles('container', props)), {
|
12225 | '--is-disabled': isDisabled,
|
12226 | '--is-rtl': isRtl
|
12227 | }, className)
|
12228 | }, innerProps), children);
|
12229 | }; // ==============================
|
12230 | // Value Container
|
12231 | // ==============================
|
12232 |
|
12233 | var valueContainerCSS = function valueContainerCSS(_ref2) {
|
12234 | var spacing = _ref2.theme.spacing;
|
12235 | return {
|
12236 | alignItems: 'center',
|
12237 | display: 'flex',
|
12238 | flex: 1,
|
12239 | flexWrap: 'wrap',
|
12240 | padding: "".concat(spacing.baseUnit / 2, "px ").concat(spacing.baseUnit * 2, "px"),
|
12241 | WebkitOverflowScrolling: 'touch',
|
12242 | position: 'relative',
|
12243 | overflow: 'hidden'
|
12244 | };
|
12245 | };
|
12246 | var ValueContainer =
|
12247 | /*#__PURE__*/
|
12248 | function (_Component) {
|
12249 | _inherits(ValueContainer, _Component);
|
12250 |
|
12251 | function ValueContainer() {
|
12252 | _classCallCheck(this, ValueContainer);
|
12253 |
|
12254 | return _possibleConstructorReturn(this, _getPrototypeOf(ValueContainer).apply(this, arguments));
|
12255 | }
|
12256 |
|
12257 | _createClass(ValueContainer, [{
|
12258 | key: "render",
|
12259 | value: function render() {
|
12260 | var _this$props = this.props,
|
12261 | children = _this$props.children,
|
12262 | className = _this$props.className,
|
12263 | cx$$1 = _this$props.cx,
|
12264 | isMulti = _this$props.isMulti,
|
12265 | getStyles = _this$props.getStyles,
|
12266 | hasValue = _this$props.hasValue;
|
12267 | return React.createElement("div", {
|
12268 | className: cx$$1(
|
12269 | /*#__PURE__*/
|
12270 | css$1(getStyles('valueContainer', this.props)), {
|
12271 | 'value-container': true,
|
12272 | 'value-container--is-multi': isMulti,
|
12273 | 'value-container--has-value': hasValue
|
12274 | }, className)
|
12275 | }, children);
|
12276 | }
|
12277 | }]);
|
12278 |
|
12279 | return ValueContainer;
|
12280 | }(Component); // ==============================
|
12281 | // Indicator Container
|
12282 | // ==============================
|
12283 |
|
12284 | var indicatorsContainerCSS = function indicatorsContainerCSS() {
|
12285 | return {
|
12286 | alignItems: 'center',
|
12287 | alignSelf: 'stretch',
|
12288 | display: 'flex',
|
12289 | flexShrink: 0
|
12290 | };
|
12291 | };
|
12292 | var IndicatorsContainer = function IndicatorsContainer(props) {
|
12293 | var children = props.children,
|
12294 | className = props.className,
|
12295 | cx$$1 = props.cx,
|
12296 | getStyles = props.getStyles;
|
12297 | return React.createElement("div", {
|
12298 | className: cx$$1(
|
12299 | /*#__PURE__*/
|
12300 | css$1(getStyles('indicatorsContainer', props)), {
|
12301 | 'indicators': true
|
12302 | }, className)
|
12303 | }, children);
|
12304 | };
|
12305 |
|
12306 | // ==============================
|
12307 | // Dropdown & Clear Icons
|
12308 | // ==============================
|
12309 | var Svg = function Svg(_ref) {
|
12310 | var size = _ref.size,
|
12311 | props = _objectWithoutProperties(_ref, ["size"]);
|
12312 |
|
12313 | return React.createElement("svg", _extends$2({
|
12314 | height: size,
|
12315 | width: size,
|
12316 | viewBox: "0 0 20 20",
|
12317 | "aria-hidden": "true",
|
12318 | focusable: "false",
|
12319 | className:
|
12320 | /*#__PURE__*/
|
12321 |
|
12322 | /*#__PURE__*/
|
12323 | css$1({
|
12324 | display: 'inline-block',
|
12325 | fill: 'currentColor',
|
12326 | lineHeight: 1,
|
12327 | stroke: 'currentColor',
|
12328 | strokeWidth: 0
|
12329 | })
|
12330 | }, props));
|
12331 | };
|
12332 |
|
12333 | var CrossIcon = function CrossIcon(props) {
|
12334 | return React.createElement(Svg, _extends$2({
|
12335 | size: 20
|
12336 | }, props), React.createElement("path", {
|
12337 | d: "M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"
|
12338 | }));
|
12339 | };
|
12340 | var DownChevron = function DownChevron(props) {
|
12341 | return React.createElement(Svg, _extends$2({
|
12342 | size: 20
|
12343 | }, props), React.createElement("path", {
|
12344 | d: "M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"
|
12345 | }));
|
12346 | }; // ==============================
|
12347 | // Dropdown & Clear Buttons
|
12348 | // ==============================
|
12349 |
|
12350 | var baseCSS = function baseCSS(_ref2) {
|
12351 | var isFocused = _ref2.isFocused,
|
12352 | _ref2$theme = _ref2.theme,
|
12353 | baseUnit = _ref2$theme.spacing.baseUnit,
|
12354 | colors = _ref2$theme.colors;
|
12355 | return {
|
12356 | label: 'indicatorContainer',
|
12357 | color: isFocused ? colors.neutral60 : colors.neutral20,
|
12358 | display: 'flex',
|
12359 | padding: baseUnit * 2,
|
12360 | transition: 'color 150ms',
|
12361 | ':hover': {
|
12362 | color: isFocused ? colors.neutral80 : colors.neutral40
|
12363 | }
|
12364 | };
|
12365 | };
|
12366 |
|
12367 | var dropdownIndicatorCSS = baseCSS;
|
12368 | var DropdownIndicator = function DropdownIndicator(props) {
|
12369 | var children = props.children,
|
12370 | className = props.className,
|
12371 | cx$$1 = props.cx,
|
12372 | getStyles = props.getStyles,
|
12373 | innerProps = props.innerProps;
|
12374 | return React.createElement("div", _extends$2({}, innerProps, {
|
12375 | className: cx$$1(
|
12376 | /*#__PURE__*/
|
12377 | css$1(getStyles('dropdownIndicator', props)), {
|
12378 | 'indicator': true,
|
12379 | 'dropdown-indicator': true
|
12380 | }, className)
|
12381 | }), children || React.createElement(DownChevron, null));
|
12382 | };
|
12383 | var clearIndicatorCSS = baseCSS;
|
12384 | var ClearIndicator = function ClearIndicator(props) {
|
12385 | var children = props.children,
|
12386 | className = props.className,
|
12387 | cx$$1 = props.cx,
|
12388 | getStyles = props.getStyles,
|
12389 | innerProps = props.innerProps;
|
12390 | return React.createElement("div", _extends$2({}, innerProps, {
|
12391 | className: cx$$1(
|
12392 | /*#__PURE__*/
|
12393 | css$1(getStyles('clearIndicator', props)), {
|
12394 | 'indicator': true,
|
12395 | 'clear-indicator': true
|
12396 | }, className)
|
12397 | }), children || React.createElement(CrossIcon, null));
|
12398 | }; // ==============================
|
12399 | // Separator
|
12400 | // ==============================
|
12401 |
|
12402 | var indicatorSeparatorCSS = function indicatorSeparatorCSS(_ref3) {
|
12403 | var isDisabled = _ref3.isDisabled,
|
12404 | _ref3$theme = _ref3.theme,
|
12405 | baseUnit = _ref3$theme.spacing.baseUnit,
|
12406 | colors = _ref3$theme.colors;
|
12407 | return {
|
12408 | label: 'indicatorSeparator',
|
12409 | alignSelf: 'stretch',
|
12410 | backgroundColor: isDisabled ? colors.neutral10 : colors.neutral20,
|
12411 | marginBottom: baseUnit * 2,
|
12412 | marginTop: baseUnit * 2,
|
12413 | width: 1
|
12414 | };
|
12415 | };
|
12416 | var IndicatorSeparator = function IndicatorSeparator(props) {
|
12417 | var className = props.className,
|
12418 | cx$$1 = props.cx,
|
12419 | getStyles = props.getStyles,
|
12420 | innerProps = props.innerProps;
|
12421 | return React.createElement("span", _extends$2({}, innerProps, {
|
12422 | className: cx$$1(
|
12423 | /*#__PURE__*/
|
12424 | css$1(getStyles('indicatorSeparator', props)), {
|
12425 | 'indicator-separator': true
|
12426 | }, className)
|
12427 | }));
|
12428 | }; // ==============================
|
12429 | // Loading
|
12430 | // ==============================
|
12431 |
|
12432 | var keyframesName = 'react-select-loading-indicator';
|
12433 | var keyframesInjected = false;
|
12434 | var loadingIndicatorCSS = function loadingIndicatorCSS(_ref4) {
|
12435 | var isFocused = _ref4.isFocused,
|
12436 | size = _ref4.size,
|
12437 | _ref4$theme = _ref4.theme,
|
12438 | colors = _ref4$theme.colors,
|
12439 | baseUnit = _ref4$theme.spacing.baseUnit;
|
12440 | return {
|
12441 | label: 'loadingIndicator',
|
12442 | color: isFocused ? colors.neutral60 : colors.neutral20,
|
12443 | display: 'flex',
|
12444 | padding: baseUnit * 2,
|
12445 | transition: 'color 150ms',
|
12446 | alignSelf: 'center',
|
12447 | fontSize: size,
|
12448 | lineHeight: 1,
|
12449 | marginRight: size,
|
12450 | textAlign: 'center',
|
12451 | verticalAlign: 'middle'
|
12452 | };
|
12453 | };
|
12454 |
|
12455 | var LoadingDot = function LoadingDot(_ref5) {
|
12456 | var color = _ref5.color,
|
12457 | delay = _ref5.delay,
|
12458 | offset = _ref5.offset;
|
12459 | return React.createElement("span", {
|
12460 | className:
|
12461 | /*#__PURE__*/
|
12462 |
|
12463 | /*#__PURE__*/
|
12464 | css$1({
|
12465 | animationDuration: '1s',
|
12466 | animationDelay: "".concat(delay, "ms"),
|
12467 | animationIterationCount: 'infinite',
|
12468 | animationName: keyframesName,
|
12469 | animationTimingFunction: 'ease-in-out',
|
12470 | backgroundColor: color,
|
12471 | borderRadius: '1em',
|
12472 | display: 'inline-block',
|
12473 | marginLeft: offset ? '1em' : null,
|
12474 | height: '1em',
|
12475 | verticalAlign: 'top',
|
12476 | width: '1em'
|
12477 | })
|
12478 | });
|
12479 | };
|
12480 |
|
12481 | var LoadingIndicator = function LoadingIndicator(props) {
|
12482 | var className = props.className,
|
12483 | cx$$1 = props.cx,
|
12484 | getStyles = props.getStyles,
|
12485 | innerProps = props.innerProps,
|
12486 | isFocused = props.isFocused,
|
12487 | isRtl = props.isRtl,
|
12488 | colors = props.theme.colors;
|
12489 | var color = isFocused ? colors.neutral80 : colors.neutral20;
|
12490 |
|
12491 | if (!keyframesInjected) {
|
12492 | // eslint-disable-next-line no-unused-expressions
|
12493 | injectGlobal("@keyframes ", keyframesName, "{0%,80%,100%{opacity:0;}40%{opacity:1;}};");
|
12494 | keyframesInjected = true;
|
12495 | }
|
12496 |
|
12497 | return React.createElement("div", _extends$2({}, innerProps, {
|
12498 | className: cx$$1(
|
12499 | /*#__PURE__*/
|
12500 | css$1(getStyles('loadingIndicator', props)), {
|
12501 | 'indicator': true,
|
12502 | 'loading-indicator': true
|
12503 | }, className)
|
12504 | }), React.createElement(LoadingDot, {
|
12505 | color: color,
|
12506 | delay: 0,
|
12507 | offset: isRtl
|
12508 | }), React.createElement(LoadingDot, {
|
12509 | color: color,
|
12510 | delay: 160,
|
12511 | offset: true
|
12512 | }), React.createElement(LoadingDot, {
|
12513 | color: color,
|
12514 | delay: 320,
|
12515 | offset: !isRtl
|
12516 | }));
|
12517 | };
|
12518 | LoadingIndicator.defaultProps = {
|
12519 | size: 4
|
12520 | };
|
12521 |
|
12522 | var css$1$1 = function css$$1(_ref) {
|
12523 | var isDisabled = _ref.isDisabled,
|
12524 | isFocused = _ref.isFocused,
|
12525 | _ref$theme = _ref.theme,
|
12526 | colors = _ref$theme.colors,
|
12527 | borderRadius = _ref$theme.borderRadius,
|
12528 | spacing = _ref$theme.spacing;
|
12529 | return {
|
12530 | label: 'control',
|
12531 | alignItems: 'center',
|
12532 | backgroundColor: isDisabled ? colors.neutral5 : colors.neutral0,
|
12533 | borderColor: isDisabled ? colors.neutral10 : isFocused ? colors.primary : colors.neutral20,
|
12534 | borderRadius: borderRadius,
|
12535 | borderStyle: 'solid',
|
12536 | borderWidth: 1,
|
12537 | boxShadow: isFocused ? "0 0 0 1px ".concat(colors.primary) : null,
|
12538 | cursor: 'default',
|
12539 | display: 'flex',
|
12540 | flexWrap: 'wrap',
|
12541 | justifyContent: 'space-between',
|
12542 | minHeight: spacing.controlHeight,
|
12543 | outline: '0 !important',
|
12544 | position: 'relative',
|
12545 | transition: 'all 100ms',
|
12546 | '&:hover': {
|
12547 | borderColor: isFocused ? colors.primary : colors.neutral30
|
12548 | }
|
12549 | };
|
12550 | };
|
12551 |
|
12552 | var Control = function Control(props) {
|
12553 | var children = props.children,
|
12554 | cx$$1 = props.cx,
|
12555 | getStyles = props.getStyles,
|
12556 | className = props.className,
|
12557 | isDisabled = props.isDisabled,
|
12558 | isFocused = props.isFocused,
|
12559 | innerRef = props.innerRef,
|
12560 | innerProps = props.innerProps,
|
12561 | menuIsOpen = props.menuIsOpen;
|
12562 | return React.createElement("div", _extends$2({
|
12563 | ref: innerRef,
|
12564 | className: cx$$1(
|
12565 | /*#__PURE__*/
|
12566 | css$1(getStyles('control', props)), {
|
12567 | 'control': true,
|
12568 | 'control--is-disabled': isDisabled,
|
12569 | 'control--is-focused': isFocused,
|
12570 | 'control--menu-is-open': menuIsOpen
|
12571 | }, className)
|
12572 | }, innerProps), children);
|
12573 | };
|
12574 |
|
12575 | var groupCSS = function groupCSS(_ref) {
|
12576 | var spacing = _ref.theme.spacing;
|
12577 | return {
|
12578 | paddingBottom: spacing.baseUnit * 2,
|
12579 | paddingTop: spacing.baseUnit * 2
|
12580 | };
|
12581 | };
|
12582 |
|
12583 | var Group = function Group(props) {
|
12584 | var children = props.children,
|
12585 | className = props.className,
|
12586 | cx$$1 = props.cx,
|
12587 | getStyles = props.getStyles,
|
12588 | Heading = props.Heading,
|
12589 | headingProps = props.headingProps,
|
12590 | label = props.label,
|
12591 | theme = props.theme,
|
12592 | selectProps = props.selectProps;
|
12593 | return React.createElement("div", {
|
12594 | className: cx$$1(
|
12595 | /*#__PURE__*/
|
12596 | css$1(getStyles('group', props)), {
|
12597 | 'group': true
|
12598 | }, className)
|
12599 | }, React.createElement(Heading, _extends$2({}, headingProps, {
|
12600 | selectProps: selectProps,
|
12601 | theme: theme,
|
12602 | getStyles: getStyles,
|
12603 | cx: cx$$1
|
12604 | }), label), React.createElement("div", null, children));
|
12605 | };
|
12606 |
|
12607 | var groupHeadingCSS = function groupHeadingCSS(_ref2) {
|
12608 | var spacing = _ref2.theme.spacing;
|
12609 | return {
|
12610 | label: 'group',
|
12611 | color: '#999',
|
12612 | cursor: 'default',
|
12613 | display: 'block',
|
12614 | fontSize: '75%',
|
12615 | fontWeight: '500',
|
12616 | marginBottom: '0.25em',
|
12617 | paddingLeft: spacing.baseUnit * 3,
|
12618 | paddingRight: spacing.baseUnit * 3,
|
12619 | textTransform: 'uppercase'
|
12620 | };
|
12621 | };
|
12622 | var GroupHeading = function GroupHeading(props) {
|
12623 | var className = props.className,
|
12624 | cx$$1 = props.cx,
|
12625 | getStyles = props.getStyles,
|
12626 | theme = props.theme,
|
12627 | selectProps = props.selectProps,
|
12628 | cleanProps = _objectWithoutProperties(props, ["className", "cx", "getStyles", "theme", "selectProps"]);
|
12629 |
|
12630 | return React.createElement("div", _extends$2({
|
12631 | className: cx$$1(
|
12632 | /*#__PURE__*/
|
12633 | css$1(getStyles('groupHeading', _objectSpread({
|
12634 | theme: theme
|
12635 | }, cleanProps))), {
|
12636 | 'group-heading': true
|
12637 | }, className)
|
12638 | }, cleanProps));
|
12639 | };
|
12640 |
|
12641 | var inputCSS = function inputCSS(_ref) {
|
12642 | var isDisabled = _ref.isDisabled,
|
12643 | _ref$theme = _ref.theme,
|
12644 | spacing = _ref$theme.spacing,
|
12645 | colors = _ref$theme.colors;
|
12646 | return {
|
12647 | margin: spacing.baseUnit / 2,
|
12648 | paddingBottom: spacing.baseUnit / 2,
|
12649 | paddingTop: spacing.baseUnit / 2,
|
12650 | visibility: isDisabled ? 'hidden' : 'visible',
|
12651 | color: colors.neutral80
|
12652 | };
|
12653 | };
|
12654 |
|
12655 | var inputStyle = function inputStyle(isHidden) {
|
12656 | return {
|
12657 | label: 'input',
|
12658 | background: 0,
|
12659 | border: 0,
|
12660 | fontSize: 'inherit',
|
12661 | opacity: isHidden ? 0 : 1,
|
12662 | outline: 0,
|
12663 | padding: 0,
|
12664 | color: 'inherit'
|
12665 | };
|
12666 | };
|
12667 |
|
12668 | var Input$3 = function Input$$1(_ref2) {
|
12669 | var className = _ref2.className,
|
12670 | cx$$1 = _ref2.cx,
|
12671 | getStyles = _ref2.getStyles,
|
12672 | innerRef = _ref2.innerRef,
|
12673 | isHidden = _ref2.isHidden,
|
12674 | isDisabled = _ref2.isDisabled,
|
12675 | theme = _ref2.theme,
|
12676 | selectProps = _ref2.selectProps,
|
12677 | props = _objectWithoutProperties(_ref2, ["className", "cx", "getStyles", "innerRef", "isHidden", "isDisabled", "theme", "selectProps"]);
|
12678 |
|
12679 | return React.createElement("div", {
|
12680 | className:
|
12681 | /*#__PURE__*/
|
12682 |
|
12683 | /*#__PURE__*/
|
12684 | css$1(getStyles('input', _objectSpread({
|
12685 | theme: theme
|
12686 | }, props)))
|
12687 | }, React.createElement(AutosizeInput, _extends$2({
|
12688 | className: cx$$1(null, {
|
12689 | 'input': true
|
12690 | }, className),
|
12691 | inputRef: innerRef,
|
12692 | inputStyle: inputStyle(isHidden),
|
12693 | disabled: isDisabled
|
12694 | }, props)));
|
12695 | };
|
12696 |
|
12697 | var multiValueCSS = function multiValueCSS(_ref) {
|
12698 | var _ref$theme = _ref.theme,
|
12699 | spacing = _ref$theme.spacing,
|
12700 | borderRadius = _ref$theme.borderRadius,
|
12701 | colors = _ref$theme.colors;
|
12702 | return {
|
12703 | label: 'multiValue',
|
12704 | backgroundColor: colors.neutral10,
|
12705 | borderRadius: borderRadius / 2,
|
12706 | display: 'flex',
|
12707 | margin: spacing.baseUnit / 2,
|
12708 | minWidth: 0 // resolves flex/text-overflow bug
|
12709 |
|
12710 | };
|
12711 | };
|
12712 | var multiValueLabelCSS = function multiValueLabelCSS(_ref2) {
|
12713 | var _ref2$theme = _ref2.theme,
|
12714 | borderRadius = _ref2$theme.borderRadius,
|
12715 | colors = _ref2$theme.colors,
|
12716 | cropWithEllipsis = _ref2.cropWithEllipsis;
|
12717 | return {
|
12718 | borderRadius: borderRadius / 2,
|
12719 | color: colors.neutral80,
|
12720 | fontSize: '85%',
|
12721 | overflow: 'hidden',
|
12722 | padding: 3,
|
12723 | paddingLeft: 6,
|
12724 | textOverflow: cropWithEllipsis ? 'ellipsis' : null,
|
12725 | whiteSpace: 'nowrap'
|
12726 | };
|
12727 | };
|
12728 | var multiValueRemoveCSS = function multiValueRemoveCSS(_ref3) {
|
12729 | var _ref3$theme = _ref3.theme,
|
12730 | spacing = _ref3$theme.spacing,
|
12731 | borderRadius = _ref3$theme.borderRadius,
|
12732 | colors = _ref3$theme.colors,
|
12733 | isFocused = _ref3.isFocused;
|
12734 | return {
|
12735 | alignItems: 'center',
|
12736 | borderRadius: borderRadius / 2,
|
12737 | backgroundColor: isFocused && colors.dangerLight,
|
12738 | display: 'flex',
|
12739 | paddingLeft: spacing.baseUnit,
|
12740 | paddingRight: spacing.baseUnit,
|
12741 | ':hover': {
|
12742 | backgroundColor: colors.dangerLight,
|
12743 | color: colors.danger
|
12744 | }
|
12745 | };
|
12746 | };
|
12747 | var MultiValueGeneric = function MultiValueGeneric(_ref4) {
|
12748 | var children = _ref4.children,
|
12749 | innerProps = _ref4.innerProps;
|
12750 | return React.createElement("div", innerProps, children);
|
12751 | };
|
12752 | var MultiValueContainer = MultiValueGeneric;
|
12753 | var MultiValueLabel = MultiValueGeneric;
|
12754 | var MultiValueRemove =
|
12755 | /*#__PURE__*/
|
12756 | function (_Component) {
|
12757 | _inherits(MultiValueRemove, _Component);
|
12758 |
|
12759 | function MultiValueRemove() {
|
12760 | _classCallCheck(this, MultiValueRemove);
|
12761 |
|
12762 | return _possibleConstructorReturn(this, _getPrototypeOf(MultiValueRemove).apply(this, arguments));
|
12763 | }
|
12764 |
|
12765 | _createClass(MultiValueRemove, [{
|
12766 | key: "render",
|
12767 | value: function render() {
|
12768 | var _this$props = this.props,
|
12769 | children = _this$props.children,
|
12770 | innerProps = _this$props.innerProps;
|
12771 | return React.createElement("div", innerProps, children || React.createElement(CrossIcon, {
|
12772 | size: 14
|
12773 | }));
|
12774 | }
|
12775 | }]);
|
12776 |
|
12777 | return MultiValueRemove;
|
12778 | }(Component);
|
12779 |
|
12780 | var MultiValue =
|
12781 | /*#__PURE__*/
|
12782 | function (_Component2) {
|
12783 | _inherits(MultiValue, _Component2);
|
12784 |
|
12785 | function MultiValue() {
|
12786 | _classCallCheck(this, MultiValue);
|
12787 |
|
12788 | return _possibleConstructorReturn(this, _getPrototypeOf(MultiValue).apply(this, arguments));
|
12789 | }
|
12790 |
|
12791 | _createClass(MultiValue, [{
|
12792 | key: "render",
|
12793 | value: function render() {
|
12794 | var _this$props2 = this.props,
|
12795 | children = _this$props2.children,
|
12796 | className = _this$props2.className,
|
12797 | components = _this$props2.components,
|
12798 | cx$$1 = _this$props2.cx,
|
12799 | data = _this$props2.data,
|
12800 | getStyles = _this$props2.getStyles,
|
12801 | innerProps = _this$props2.innerProps,
|
12802 | isDisabled = _this$props2.isDisabled,
|
12803 | removeProps = _this$props2.removeProps,
|
12804 | selectProps = _this$props2.selectProps;
|
12805 | var Container = components.Container,
|
12806 | Label$$1 = components.Label,
|
12807 | Remove = components.Remove;
|
12808 |
|
12809 | var containerInnerProps = _objectSpread({
|
12810 | className: cx$$1(
|
12811 | /*#__PURE__*/
|
12812 | css$1(getStyles('multiValue', this.props)), {
|
12813 | 'multi-value': true,
|
12814 | 'multi-value--is-disabled': isDisabled
|
12815 | }, className)
|
12816 | }, innerProps);
|
12817 |
|
12818 | var labelInnerProps = {
|
12819 | className: cx$$1(
|
12820 | /*#__PURE__*/
|
12821 | css$1(getStyles('multiValueLabel', this.props)), {
|
12822 | 'multi-value__label': true
|
12823 | }, className)
|
12824 | };
|
12825 |
|
12826 | var removeInnerProps = _objectSpread({
|
12827 | className: cx$$1(
|
12828 | /*#__PURE__*/
|
12829 | css$1(getStyles('multiValueRemove', this.props)), {
|
12830 | 'multi-value__remove': true
|
12831 | }, className)
|
12832 | }, removeProps);
|
12833 |
|
12834 | return React.createElement(Container, {
|
12835 | data: data,
|
12836 | innerProps: containerInnerProps,
|
12837 | selectProps: selectProps
|
12838 | }, React.createElement(Label$$1, {
|
12839 | data: data,
|
12840 | innerProps: labelInnerProps,
|
12841 | selectProps: selectProps
|
12842 | }, children), React.createElement(Remove, {
|
12843 | data: data,
|
12844 | innerProps: removeInnerProps,
|
12845 | selectProps: selectProps
|
12846 | }));
|
12847 | }
|
12848 | }]);
|
12849 |
|
12850 | return MultiValue;
|
12851 | }(Component);
|
12852 |
|
12853 | _defineProperty$1(MultiValue, "defaultProps", {
|
12854 | cropWithEllipsis: true
|
12855 | });
|
12856 |
|
12857 | var optionCSS = function optionCSS(_ref) {
|
12858 | var isDisabled = _ref.isDisabled,
|
12859 | isFocused = _ref.isFocused,
|
12860 | isSelected = _ref.isSelected,
|
12861 | _ref$theme = _ref.theme,
|
12862 | spacing = _ref$theme.spacing,
|
12863 | colors = _ref$theme.colors;
|
12864 | return {
|
12865 | label: 'option',
|
12866 | backgroundColor: isSelected ? colors.primary : isFocused ? colors.primary25 : 'transparent',
|
12867 | color: isDisabled ? colors.neutral20 : isSelected ? colors.neutral0 : 'inherit',
|
12868 | cursor: 'default',
|
12869 | display: 'block',
|
12870 | fontSize: 'inherit',
|
12871 | padding: "".concat(spacing.baseUnit * 2, "px ").concat(spacing.baseUnit * 3, "px"),
|
12872 | width: '100%',
|
12873 | userSelect: 'none',
|
12874 | WebkitTapHighlightColor: 'rgba(0, 0, 0, 0)',
|
12875 | // provide some affordance on touch devices
|
12876 | ':active': {
|
12877 | backgroundColor: isSelected ? colors.primary : colors.primary50
|
12878 | }
|
12879 | };
|
12880 | };
|
12881 |
|
12882 | var Option = function Option(props) {
|
12883 | var children = props.children,
|
12884 | className = props.className,
|
12885 | cx$$1 = props.cx,
|
12886 | getStyles = props.getStyles,
|
12887 | isDisabled = props.isDisabled,
|
12888 | isFocused = props.isFocused,
|
12889 | isSelected = props.isSelected,
|
12890 | innerRef = props.innerRef,
|
12891 | innerProps = props.innerProps;
|
12892 | return React.createElement("div", _extends$2({
|
12893 | ref: innerRef,
|
12894 | className: cx$$1(
|
12895 | /*#__PURE__*/
|
12896 | css$1(getStyles('option', props)), {
|
12897 | 'option': true,
|
12898 | 'option--is-disabled': isDisabled,
|
12899 | 'option--is-focused': isFocused,
|
12900 | 'option--is-selected': isSelected
|
12901 | }, className)
|
12902 | }, innerProps), children);
|
12903 | };
|
12904 |
|
12905 | var placeholderCSS = function placeholderCSS(_ref) {
|
12906 | var _ref$theme = _ref.theme,
|
12907 | spacing = _ref$theme.spacing,
|
12908 | colors = _ref$theme.colors;
|
12909 | return {
|
12910 | label: 'placeholder',
|
12911 | color: colors.neutral50,
|
12912 | marginLeft: spacing.baseUnit / 2,
|
12913 | marginRight: spacing.baseUnit / 2,
|
12914 | position: 'absolute',
|
12915 | top: '50%',
|
12916 | transform: 'translateY(-50%)'
|
12917 | };
|
12918 | };
|
12919 |
|
12920 | var Placeholder = function Placeholder(props) {
|
12921 | var children = props.children,
|
12922 | className = props.className,
|
12923 | cx$$1 = props.cx,
|
12924 | getStyles = props.getStyles,
|
12925 | innerProps = props.innerProps;
|
12926 | return React.createElement("div", _extends$2({
|
12927 | className: cx$$1(
|
12928 | /*#__PURE__*/
|
12929 | css$1(getStyles('placeholder', props)), {
|
12930 | 'placeholder': true
|
12931 | }, className)
|
12932 | }, innerProps), children);
|
12933 | };
|
12934 |
|
12935 | var css$2 = function css$$1(_ref) {
|
12936 | var isDisabled = _ref.isDisabled,
|
12937 | _ref$theme = _ref.theme,
|
12938 | spacing = _ref$theme.spacing,
|
12939 | colors = _ref$theme.colors;
|
12940 | return {
|
12941 | label: 'singleValue',
|
12942 | color: isDisabled ? colors.neutral40 : colors.neutral80,
|
12943 | marginLeft: spacing.baseUnit / 2,
|
12944 | marginRight: spacing.baseUnit / 2,
|
12945 | maxWidth: "calc(100% - ".concat(spacing.baseUnit * 2, "px)"),
|
12946 | overflow: 'hidden',
|
12947 | position: 'absolute',
|
12948 | textOverflow: 'ellipsis',
|
12949 | whiteSpace: 'nowrap',
|
12950 | top: '50%',
|
12951 | transform: 'translateY(-50%)'
|
12952 | };
|
12953 | };
|
12954 |
|
12955 | var SingleValue = function SingleValue(props) {
|
12956 | var children = props.children,
|
12957 | className = props.className,
|
12958 | cx$$1 = props.cx,
|
12959 | getStyles = props.getStyles,
|
12960 | isDisabled = props.isDisabled,
|
12961 | innerProps = props.innerProps;
|
12962 | return React.createElement("div", _extends$2({
|
12963 | className: cx$$1(
|
12964 | /*#__PURE__*/
|
12965 | css$1(getStyles('singleValue', props)), {
|
12966 | 'single-value': true,
|
12967 | 'single-value--is-disabled': isDisabled
|
12968 | }, className)
|
12969 | }, innerProps), children);
|
12970 | };
|
12971 |
|
12972 | var components = {
|
12973 | ClearIndicator: ClearIndicator,
|
12974 | Control: Control,
|
12975 | DropdownIndicator: DropdownIndicator,
|
12976 | DownChevron: DownChevron,
|
12977 | CrossIcon: CrossIcon,
|
12978 | Group: Group,
|
12979 | GroupHeading: GroupHeading,
|
12980 | IndicatorsContainer: IndicatorsContainer,
|
12981 | IndicatorSeparator: IndicatorSeparator,
|
12982 | Input: Input$3,
|
12983 | LoadingIndicator: LoadingIndicator,
|
12984 | Menu: Menu$1,
|
12985 | MenuList: MenuList,
|
12986 | MenuPortal: MenuPortal,
|
12987 | LoadingMessage: LoadingMessage,
|
12988 | NoOptionsMessage: NoOptionsMessage,
|
12989 | MultiValue: MultiValue,
|
12990 | MultiValueContainer: MultiValueContainer,
|
12991 | MultiValueLabel: MultiValueLabel,
|
12992 | MultiValueRemove: MultiValueRemove,
|
12993 | Option: Option,
|
12994 | Placeholder: Placeholder,
|
12995 | SelectContainer: SelectContainer,
|
12996 | SingleValue: SingleValue,
|
12997 | ValueContainer: ValueContainer
|
12998 | };
|
12999 | var defaultComponents = function defaultComponents(props) {
|
13000 | return _objectSpread({}, components, props.components);
|
13001 | };
|
13002 |
|
13003 | var defaultStyles = {
|
13004 | clearIndicator: clearIndicatorCSS,
|
13005 | container: containerCSS,
|
13006 | control: css$1$1,
|
13007 | dropdownIndicator: dropdownIndicatorCSS,
|
13008 | group: groupCSS,
|
13009 | groupHeading: groupHeadingCSS,
|
13010 | indicatorsContainer: indicatorsContainerCSS,
|
13011 | indicatorSeparator: indicatorSeparatorCSS,
|
13012 | input: inputCSS,
|
13013 | loadingIndicator: loadingIndicatorCSS,
|
13014 | loadingMessage: loadingMessageCSS,
|
13015 | menu: menuCSS,
|
13016 | menuList: menuListCSS,
|
13017 | menuPortal: menuPortalCSS,
|
13018 | multiValue: multiValueCSS,
|
13019 | multiValueLabel: multiValueLabelCSS,
|
13020 | multiValueRemove: multiValueRemoveCSS,
|
13021 | noOptionsMessage: noOptionsMessageCSS,
|
13022 | option: optionCSS,
|
13023 | placeholder: placeholderCSS,
|
13024 | singleValue: css$2,
|
13025 | valueContainer: valueContainerCSS
|
13026 | }; // Merge Utility
|
13027 |
|
13028 | var colors$1 = {
|
13029 | primary: '#2684FF',
|
13030 | primary75: '#4C9AFF',
|
13031 | primary50: '#B2D4FF',
|
13032 | primary25: '#DEEBFF',
|
13033 | danger: '#DE350B',
|
13034 | dangerLight: '#FFBDAD',
|
13035 | neutral0: 'hsl(0, 0%, 100%)',
|
13036 | neutral5: 'hsl(0, 0%, 95%)',
|
13037 | neutral10: 'hsl(0, 0%, 90%)',
|
13038 | neutral20: 'hsl(0, 0%, 80%)',
|
13039 | neutral30: 'hsl(0, 0%, 70%)',
|
13040 | neutral40: 'hsl(0, 0%, 60%)',
|
13041 | neutral50: 'hsl(0, 0%, 50%)',
|
13042 | neutral60: 'hsl(0, 0%, 40%)',
|
13043 | neutral70: 'hsl(0, 0%, 30%)',
|
13044 | neutral80: 'hsl(0, 0%, 20%)',
|
13045 | neutral90: 'hsl(0, 0%, 10%)'
|
13046 | };
|
13047 | var borderRadius = 4;
|
13048 | var baseUnit = 4;
|
13049 | /* Used to calculate consistent margin/padding on elements */
|
13050 |
|
13051 | var controlHeight = 38;
|
13052 | /* The minimum height of the control */
|
13053 |
|
13054 | var menuGutter = baseUnit * 2;
|
13055 | /* The amount of space between the control and menu */
|
13056 |
|
13057 | var spacing = {
|
13058 | baseUnit: baseUnit,
|
13059 | controlHeight: controlHeight,
|
13060 | menuGutter: menuGutter
|
13061 | };
|
13062 | var defaultTheme = {
|
13063 | borderRadius: borderRadius,
|
13064 | colors: colors$1,
|
13065 | spacing: spacing
|
13066 | };
|
13067 |
|
13068 | var defaultProps = {
|
13069 | backspaceRemovesValue: true,
|
13070 | blurInputOnSelect: isTouchCapable(),
|
13071 | captureMenuScroll: !isTouchCapable(),
|
13072 | closeMenuOnSelect: true,
|
13073 | closeMenuOnScroll: false,
|
13074 | components: {},
|
13075 | controlShouldRenderValue: true,
|
13076 | escapeClearsValue: false,
|
13077 | filterOption: createFilter(),
|
13078 | formatGroupLabel: formatGroupLabel,
|
13079 | getOptionLabel: getOptionLabel,
|
13080 | getOptionValue: getOptionValue,
|
13081 | isDisabled: false,
|
13082 | isLoading: false,
|
13083 | isMulti: false,
|
13084 | isRtl: false,
|
13085 | isSearchable: true,
|
13086 | isOptionDisabled: isOptionDisabled,
|
13087 | loadingMessage: function loadingMessage() {
|
13088 | return 'Loading...';
|
13089 | },
|
13090 | maxMenuHeight: 300,
|
13091 | minMenuHeight: 140,
|
13092 | menuIsOpen: false,
|
13093 | menuPlacement: 'bottom',
|
13094 | menuPosition: 'absolute',
|
13095 | menuShouldBlockScroll: false,
|
13096 | menuShouldScrollIntoView: !isMobileDevice(),
|
13097 | noOptionsMessage: function noOptionsMessage() {
|
13098 | return 'No options';
|
13099 | },
|
13100 | openMenuOnFocus: false,
|
13101 | openMenuOnClick: true,
|
13102 | options: [],
|
13103 | pageSize: 5,
|
13104 | placeholder: 'Select...',
|
13105 | screenReaderStatus: function screenReaderStatus(_ref) {
|
13106 | var count = _ref.count;
|
13107 | return "".concat(count, " result").concat(count !== 1 ? 's' : '', " available");
|
13108 | },
|
13109 | styles: {},
|
13110 | tabIndex: '0',
|
13111 | tabSelectsValue: true
|
13112 | };
|
13113 | var instanceId = 1;
|
13114 |
|
13115 | var Select =
|
13116 | /*#__PURE__*/
|
13117 | function (_Component) {
|
13118 | _inherits(Select, _Component);
|
13119 |
|
13120 | // Misc. Instance Properties
|
13121 | // ------------------------------
|
13122 | // TODO
|
13123 | // Refs
|
13124 | // ------------------------------
|
13125 | // Lifecycle
|
13126 | // ------------------------------
|
13127 | function Select(_props) {
|
13128 | var _this;
|
13129 |
|
13130 | _classCallCheck(this, Select);
|
13131 |
|
13132 | _this = _possibleConstructorReturn(this, _getPrototypeOf(Select).call(this, _props));
|
13133 |
|
13134 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "state", {
|
13135 | ariaLiveSelection: '',
|
13136 | ariaLiveContext: '',
|
13137 | focusedOption: null,
|
13138 | focusedValue: null,
|
13139 | inputIsHidden: false,
|
13140 | isFocused: false,
|
13141 | isComposing: false,
|
13142 | menuOptions: {
|
13143 | render: [],
|
13144 | focusable: []
|
13145 | },
|
13146 | selectValue: []
|
13147 | });
|
13148 |
|
13149 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "blockOptionHover", false);
|
13150 |
|
13151 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "clearFocusValueOnUpdate", false);
|
13152 |
|
13153 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "commonProps", void 0);
|
13154 |
|
13155 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "components", void 0);
|
13156 |
|
13157 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "hasGroups", false);
|
13158 |
|
13159 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "initialTouchX", 0);
|
13160 |
|
13161 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "initialTouchY", 0);
|
13162 |
|
13163 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "inputIsHiddenAfterUpdate", void 0);
|
13164 |
|
13165 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "instancePrefix", '');
|
13166 |
|
13167 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "openAfterFocus", false);
|
13168 |
|
13169 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "scrollToFocusedOptionOnUpdate", false);
|
13170 |
|
13171 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "userIsDragging", void 0);
|
13172 |
|
13173 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "controlRef", null);
|
13174 |
|
13175 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "getControlRef", function (ref) {
|
13176 | _this.controlRef = ref;
|
13177 | });
|
13178 |
|
13179 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "focusedOptionRef", null);
|
13180 |
|
13181 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "getFocusedOptionRef", function (ref) {
|
13182 | _this.focusedOptionRef = ref;
|
13183 | });
|
13184 |
|
13185 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "menuListRef", null);
|
13186 |
|
13187 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "getMenuListRef", function (ref) {
|
13188 | _this.menuListRef = ref;
|
13189 | });
|
13190 |
|
13191 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "inputRef", null);
|
13192 |
|
13193 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "getInputRef", function (ref) {
|
13194 | _this.inputRef = ref;
|
13195 | });
|
13196 |
|
13197 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "cacheComponents", function (components$$1) {
|
13198 | _this.components = defaultComponents({
|
13199 | components: components$$1
|
13200 | });
|
13201 | });
|
13202 |
|
13203 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "focus", _this.focusInput);
|
13204 |
|
13205 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "blur", _this.blurInput);
|
13206 |
|
13207 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "onChange", function (newValue, actionMeta) {
|
13208 | var _this$props = _this.props,
|
13209 | onChange = _this$props.onChange,
|
13210 | name = _this$props.name;
|
13211 | onChange(newValue, _objectSpread({}, actionMeta, {
|
13212 | name: name
|
13213 | }));
|
13214 | });
|
13215 |
|
13216 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "setValue", function (newValue) {
|
13217 | var action = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'set-value';
|
13218 | var option = arguments.length > 2 ? arguments[2] : undefined;
|
13219 | var _this$props2 = _this.props,
|
13220 | closeMenuOnSelect = _this$props2.closeMenuOnSelect,
|
13221 | isMulti = _this$props2.isMulti;
|
13222 |
|
13223 | _this.onInputChange('', {
|
13224 | action: 'set-value'
|
13225 | });
|
13226 |
|
13227 | if (closeMenuOnSelect) {
|
13228 | _this.inputIsHiddenAfterUpdate = !isMulti;
|
13229 |
|
13230 | _this.onMenuClose();
|
13231 | } // when the select value should change, we should reset focusedValue
|
13232 |
|
13233 |
|
13234 | _this.clearFocusValueOnUpdate = true;
|
13235 |
|
13236 | _this.onChange(newValue, {
|
13237 | action: action,
|
13238 | option: option
|
13239 | });
|
13240 | });
|
13241 |
|
13242 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "selectOption", function (newValue) {
|
13243 | var _this$props3 = _this.props,
|
13244 | blurInputOnSelect = _this$props3.blurInputOnSelect,
|
13245 | isMulti = _this$props3.isMulti;
|
13246 | var selectValue = _this.state.selectValue;
|
13247 |
|
13248 | if (isMulti) {
|
13249 | if (_this.isOptionSelected(newValue, selectValue)) {
|
13250 | var candidate = _this.getOptionValue(newValue);
|
13251 |
|
13252 | _this.setValue(selectValue.filter(function (i) {
|
13253 | return _this.getOptionValue(i) !== candidate;
|
13254 | }), 'deselect-option', newValue);
|
13255 |
|
13256 | _this.announceAriaLiveSelection({
|
13257 | event: 'deselect-option',
|
13258 | context: {
|
13259 | value: _this.getOptionLabel(newValue)
|
13260 | }
|
13261 | });
|
13262 | } else {
|
13263 | if (!_this.isOptionDisabled(newValue, selectValue)) {
|
13264 | _this.setValue([].concat(_toConsumableArray(selectValue), [newValue]), 'select-option', newValue);
|
13265 |
|
13266 | _this.announceAriaLiveSelection({
|
13267 | event: 'select-option',
|
13268 | context: {
|
13269 | value: _this.getOptionLabel(newValue)
|
13270 | }
|
13271 | });
|
13272 | } else {
|
13273 | // announce that option is disabled
|
13274 | _this.announceAriaLiveSelection({
|
13275 | event: 'select-option',
|
13276 | context: {
|
13277 | value: _this.getOptionLabel(newValue),
|
13278 | isDisabled: true
|
13279 | }
|
13280 | });
|
13281 | }
|
13282 | }
|
13283 | } else {
|
13284 | if (!_this.isOptionDisabled(newValue, selectValue)) {
|
13285 | _this.setValue(newValue, 'select-option');
|
13286 |
|
13287 | _this.announceAriaLiveSelection({
|
13288 | event: 'select-option',
|
13289 | context: {
|
13290 | value: _this.getOptionLabel(newValue)
|
13291 | }
|
13292 | });
|
13293 | } else {
|
13294 | // announce that option is disabled
|
13295 | _this.announceAriaLiveSelection({
|
13296 | event: 'select-option',
|
13297 | context: {
|
13298 | value: _this.getOptionLabel(newValue),
|
13299 | isDisabled: true
|
13300 | }
|
13301 | });
|
13302 | }
|
13303 | }
|
13304 |
|
13305 | if (blurInputOnSelect) {
|
13306 | _this.blurInput();
|
13307 | }
|
13308 | });
|
13309 |
|
13310 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "removeValue", function (removedValue) {
|
13311 | var selectValue = _this.state.selectValue;
|
13312 |
|
13313 | var candidate = _this.getOptionValue(removedValue);
|
13314 |
|
13315 | _this.onChange(selectValue.filter(function (i) {
|
13316 | return _this.getOptionValue(i) !== candidate;
|
13317 | }), {
|
13318 | action: 'remove-value',
|
13319 | removedValue: removedValue
|
13320 | });
|
13321 |
|
13322 | _this.announceAriaLiveSelection({
|
13323 | event: 'remove-value',
|
13324 | context: {
|
13325 | value: removedValue ? _this.getOptionLabel(removedValue) : ''
|
13326 | }
|
13327 | });
|
13328 |
|
13329 | _this.focusInput();
|
13330 | });
|
13331 |
|
13332 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "clearValue", function () {
|
13333 | var isMulti = _this.props.isMulti;
|
13334 |
|
13335 | _this.onChange(isMulti ? [] : null, {
|
13336 | action: 'clear'
|
13337 | });
|
13338 | });
|
13339 |
|
13340 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "popValue", function () {
|
13341 | var selectValue = _this.state.selectValue;
|
13342 | var lastSelectedValue = selectValue[selectValue.length - 1];
|
13343 |
|
13344 | _this.announceAriaLiveSelection({
|
13345 | event: 'pop-value',
|
13346 | context: {
|
13347 | value: lastSelectedValue ? _this.getOptionLabel(lastSelectedValue) : ''
|
13348 | }
|
13349 | });
|
13350 |
|
13351 | _this.onChange(selectValue.slice(0, selectValue.length - 1), {
|
13352 | action: 'pop-value',
|
13353 | removedValue: lastSelectedValue
|
13354 | });
|
13355 | });
|
13356 |
|
13357 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "getOptionLabel", function (data) {
|
13358 | return _this.props.getOptionLabel(data);
|
13359 | });
|
13360 |
|
13361 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "getOptionValue", function (data) {
|
13362 | return _this.props.getOptionValue(data);
|
13363 | });
|
13364 |
|
13365 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "getStyles", function (key, props) {
|
13366 | var base = defaultStyles[key](props);
|
13367 | base.boxSizing = 'border-box';
|
13368 | var custom = _this.props.styles[key];
|
13369 | return custom ? custom(base, props) : base;
|
13370 | });
|
13371 |
|
13372 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "getElementId", function (element) {
|
13373 | return "".concat(_this.instancePrefix, "-").concat(element);
|
13374 | });
|
13375 |
|
13376 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "getActiveDescendentId", function () {
|
13377 | var menuIsOpen = _this.props.menuIsOpen;
|
13378 | var _this$state = _this.state,
|
13379 | menuOptions = _this$state.menuOptions,
|
13380 | focusedOption = _this$state.focusedOption;
|
13381 | if (!focusedOption || !menuIsOpen) return undefined;
|
13382 | var index = menuOptions.focusable.indexOf(focusedOption);
|
13383 | var option = menuOptions.render[index];
|
13384 | return option && option.key;
|
13385 | });
|
13386 |
|
13387 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "announceAriaLiveSelection", function (_ref2) {
|
13388 | var event = _ref2.event,
|
13389 | context = _ref2.context;
|
13390 |
|
13391 | _this.setState({
|
13392 | ariaLiveSelection: valueEventAriaMessage(event, context)
|
13393 | });
|
13394 | });
|
13395 |
|
13396 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "announceAriaLiveContext", function (_ref3) {
|
13397 | var event = _ref3.event,
|
13398 | context = _ref3.context;
|
13399 |
|
13400 | _this.setState({
|
13401 | ariaLiveContext: instructionsAriaMessage(event, _objectSpread({}, context, {
|
13402 | label: _this.props['aria-label']
|
13403 | }))
|
13404 | });
|
13405 | });
|
13406 |
|
13407 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "onMenuMouseDown", function (event) {
|
13408 | if (event.button !== 0) {
|
13409 | return;
|
13410 | }
|
13411 |
|
13412 | event.stopPropagation();
|
13413 | event.preventDefault();
|
13414 |
|
13415 | _this.focusInput();
|
13416 | });
|
13417 |
|
13418 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "onMenuMouseMove", function (event) {
|
13419 | _this.blockOptionHover = false;
|
13420 | });
|
13421 |
|
13422 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "onControlMouseDown", function (event) {
|
13423 | var openMenuOnClick = _this.props.openMenuOnClick;
|
13424 |
|
13425 | if (!_this.state.isFocused) {
|
13426 | if (openMenuOnClick) {
|
13427 | _this.openAfterFocus = true;
|
13428 | }
|
13429 |
|
13430 | _this.focusInput();
|
13431 | } else if (!_this.props.menuIsOpen) {
|
13432 | if (openMenuOnClick) {
|
13433 | _this.openMenu('first');
|
13434 | }
|
13435 | } else {
|
13436 | //$FlowFixMe
|
13437 | if (event.target.tagName !== 'INPUT') {
|
13438 | _this.onMenuClose();
|
13439 | }
|
13440 | } //$FlowFixMe
|
13441 |
|
13442 |
|
13443 | if (event.target.tagName !== 'INPUT') {
|
13444 | event.preventDefault();
|
13445 | }
|
13446 | });
|
13447 |
|
13448 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "onDropdownIndicatorMouseDown", function (event) {
|
13449 | // ignore mouse events that weren't triggered by the primary button
|
13450 | if (event && event.type === 'mousedown' && event.button !== 0) {
|
13451 | return;
|
13452 | }
|
13453 |
|
13454 | if (_this.props.isDisabled) return;
|
13455 | var _this$props4 = _this.props,
|
13456 | isMulti = _this$props4.isMulti,
|
13457 | menuIsOpen = _this$props4.menuIsOpen;
|
13458 |
|
13459 | _this.focusInput();
|
13460 |
|
13461 | if (menuIsOpen) {
|
13462 | _this.inputIsHiddenAfterUpdate = !isMulti;
|
13463 |
|
13464 | _this.onMenuClose();
|
13465 | } else {
|
13466 | _this.openMenu('first');
|
13467 | }
|
13468 |
|
13469 | event.preventDefault();
|
13470 | event.stopPropagation();
|
13471 | });
|
13472 |
|
13473 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "onClearIndicatorMouseDown", function (event) {
|
13474 | // ignore mouse events that weren't triggered by the primary button
|
13475 | if (event && event.type === 'mousedown' && event.button !== 0) {
|
13476 | return;
|
13477 | }
|
13478 |
|
13479 | _this.clearValue();
|
13480 |
|
13481 | event.stopPropagation();
|
13482 | _this.openAfterFocus = false;
|
13483 | setTimeout(function () {
|
13484 | return _this.focusInput();
|
13485 | });
|
13486 | });
|
13487 |
|
13488 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "onScroll", function (event) {
|
13489 | if (typeof _this.props.closeMenuOnScroll === 'boolean') {
|
13490 | if (event.target instanceof HTMLElement && isDocumentElement(event.target)) {
|
13491 | _this.props.onMenuClose();
|
13492 | }
|
13493 | } else if (typeof _this.props.closeMenuOnScroll === 'function') {
|
13494 | if (_this.props.closeMenuOnScroll(event)) {
|
13495 | _this.props.onMenuClose();
|
13496 | }
|
13497 | }
|
13498 | });
|
13499 |
|
13500 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "onCompositionStart", function () {
|
13501 | _this.setState({
|
13502 | isComposing: true
|
13503 | });
|
13504 | });
|
13505 |
|
13506 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "onCompositionEnd", function () {
|
13507 | _this.setState({
|
13508 | isComposing: false
|
13509 | });
|
13510 | });
|
13511 |
|
13512 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "onTouchStart", function (_ref4) {
|
13513 | var touches = _ref4.touches;
|
13514 | var touch = touches.item(0);
|
13515 |
|
13516 | if (!touch) {
|
13517 | return;
|
13518 | }
|
13519 |
|
13520 | _this.initialTouchX = touch.clientX;
|
13521 | _this.initialTouchY = touch.clientY;
|
13522 | _this.userIsDragging = false;
|
13523 | });
|
13524 |
|
13525 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "onTouchMove", function (_ref5) {
|
13526 | var touches = _ref5.touches;
|
13527 | var touch = touches.item(0);
|
13528 |
|
13529 | if (!touch) {
|
13530 | return;
|
13531 | }
|
13532 |
|
13533 | var deltaX = Math.abs(touch.clientX - _this.initialTouchX);
|
13534 | var deltaY = Math.abs(touch.clientY - _this.initialTouchY);
|
13535 | var moveThreshold = 5;
|
13536 | _this.userIsDragging = deltaX > moveThreshold || deltaY > moveThreshold;
|
13537 | });
|
13538 |
|
13539 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "onTouchEnd", function (event) {
|
13540 | if (_this.userIsDragging) return; // close the menu if the user taps outside
|
13541 | // we're checking on event.target here instead of event.currentTarget, because we want to assert information
|
13542 | // on events on child elements, not the document (which we've attached this handler to).
|
13543 |
|
13544 | if (_this.controlRef && !_this.controlRef.contains(event.target) && _this.menuListRef && !_this.menuListRef.contains(event.target)) {
|
13545 | _this.blurInput();
|
13546 | } // reset move vars
|
13547 |
|
13548 |
|
13549 | _this.initialTouchX = 0;
|
13550 | _this.initialTouchY = 0;
|
13551 | });
|
13552 |
|
13553 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "onControlTouchEnd", function (event) {
|
13554 | if (_this.userIsDragging) return;
|
13555 |
|
13556 | _this.onControlMouseDown(event);
|
13557 | });
|
13558 |
|
13559 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "onClearIndicatorTouchEnd", function (event) {
|
13560 | if (_this.userIsDragging) return;
|
13561 |
|
13562 | _this.onClearIndicatorMouseDown(event);
|
13563 | });
|
13564 |
|
13565 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "onDropdownIndicatorTouchEnd", function (event) {
|
13566 | if (_this.userIsDragging) return;
|
13567 |
|
13568 | _this.onDropdownIndicatorMouseDown(event);
|
13569 | });
|
13570 |
|
13571 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "handleInputChange", function (event) {
|
13572 | var inputValue = event.currentTarget.value;
|
13573 | _this.inputIsHiddenAfterUpdate = false;
|
13574 |
|
13575 | _this.onInputChange(inputValue, {
|
13576 | action: 'input-change'
|
13577 | });
|
13578 |
|
13579 | _this.onMenuOpen();
|
13580 | });
|
13581 |
|
13582 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "onInputFocus", function (event) {
|
13583 | var _this$props5 = _this.props,
|
13584 | isSearchable = _this$props5.isSearchable,
|
13585 | isMulti = _this$props5.isMulti;
|
13586 |
|
13587 | if (_this.props.onFocus) {
|
13588 | _this.props.onFocus(event);
|
13589 | }
|
13590 |
|
13591 | _this.inputIsHiddenAfterUpdate = false;
|
13592 |
|
13593 | _this.announceAriaLiveContext({
|
13594 | event: 'input',
|
13595 | context: {
|
13596 | isSearchable: isSearchable,
|
13597 | isMulti: isMulti
|
13598 | }
|
13599 | });
|
13600 |
|
13601 | _this.setState({
|
13602 | isFocused: true
|
13603 | });
|
13604 |
|
13605 | if (_this.openAfterFocus || _this.props.openMenuOnFocus) {
|
13606 | _this.openMenu('first');
|
13607 | }
|
13608 |
|
13609 | _this.openAfterFocus = false;
|
13610 | });
|
13611 |
|
13612 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "onInputBlur", function (event) {
|
13613 | if (_this.menuListRef && _this.menuListRef.contains(document.activeElement)) {
|
13614 | _this.inputRef.focus();
|
13615 |
|
13616 | return;
|
13617 | }
|
13618 |
|
13619 | if (_this.props.onBlur) {
|
13620 | _this.props.onBlur(event);
|
13621 | }
|
13622 |
|
13623 | _this.onInputChange('', {
|
13624 | action: 'input-blur'
|
13625 | });
|
13626 |
|
13627 | _this.onMenuClose();
|
13628 |
|
13629 | _this.setState({
|
13630 | focusedValue: null,
|
13631 | isFocused: false
|
13632 | });
|
13633 | });
|
13634 |
|
13635 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "onOptionHover", function (focusedOption) {
|
13636 | if (_this.blockOptionHover || _this.state.focusedOption === focusedOption) {
|
13637 | return;
|
13638 | }
|
13639 |
|
13640 | _this.setState({
|
13641 | focusedOption: focusedOption
|
13642 | });
|
13643 | });
|
13644 |
|
13645 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "shouldHideSelectedOptions", function () {
|
13646 | var _this$props6 = _this.props,
|
13647 | hideSelectedOptions = _this$props6.hideSelectedOptions,
|
13648 | isMulti = _this$props6.isMulti;
|
13649 | if (hideSelectedOptions === undefined) return isMulti;
|
13650 | return hideSelectedOptions;
|
13651 | });
|
13652 |
|
13653 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "onKeyDown", function (event) {
|
13654 | var _this$props7 = _this.props,
|
13655 | isMulti = _this$props7.isMulti,
|
13656 | backspaceRemovesValue = _this$props7.backspaceRemovesValue,
|
13657 | escapeClearsValue = _this$props7.escapeClearsValue,
|
13658 | inputValue = _this$props7.inputValue,
|
13659 | isClearable = _this$props7.isClearable,
|
13660 | isDisabled = _this$props7.isDisabled,
|
13661 | menuIsOpen = _this$props7.menuIsOpen,
|
13662 | onKeyDown = _this$props7.onKeyDown,
|
13663 | tabSelectsValue = _this$props7.tabSelectsValue,
|
13664 | openMenuOnFocus = _this$props7.openMenuOnFocus;
|
13665 | var _this$state2 = _this.state,
|
13666 | isComposing = _this$state2.isComposing,
|
13667 | focusedOption = _this$state2.focusedOption,
|
13668 | focusedValue = _this$state2.focusedValue,
|
13669 | selectValue = _this$state2.selectValue;
|
13670 | if (isDisabled) return;
|
13671 |
|
13672 | if (typeof onKeyDown === 'function') {
|
13673 | onKeyDown(event);
|
13674 |
|
13675 | if (event.defaultPrevented) {
|
13676 | return;
|
13677 | }
|
13678 | } // Block option hover events when the user has just pressed a key
|
13679 |
|
13680 |
|
13681 | _this.blockOptionHover = true;
|
13682 |
|
13683 | switch (event.key) {
|
13684 | case 'ArrowLeft':
|
13685 | if (!isMulti || inputValue) return;
|
13686 |
|
13687 | _this.focusValue('previous');
|
13688 |
|
13689 | break;
|
13690 |
|
13691 | case 'ArrowRight':
|
13692 | if (!isMulti || inputValue) return;
|
13693 |
|
13694 | _this.focusValue('next');
|
13695 |
|
13696 | break;
|
13697 |
|
13698 | case 'Delete':
|
13699 | case 'Backspace':
|
13700 | if (inputValue) return;
|
13701 |
|
13702 | if (focusedValue) {
|
13703 | _this.removeValue(focusedValue);
|
13704 | } else {
|
13705 | if (!backspaceRemovesValue) return;
|
13706 |
|
13707 | if (isMulti) {
|
13708 | _this.popValue();
|
13709 | } else if (isClearable) {
|
13710 | _this.clearValue();
|
13711 | }
|
13712 | }
|
13713 |
|
13714 | break;
|
13715 |
|
13716 | case 'Tab':
|
13717 | if (isComposing) return;
|
13718 |
|
13719 | if (event.shiftKey || !menuIsOpen || !tabSelectsValue || !focusedOption || // don't capture the event if the menu opens on focus and the focused
|
13720 | // option is already selected; it breaks the flow of navigation
|
13721 | openMenuOnFocus && _this.isOptionSelected(focusedOption, selectValue)) {
|
13722 | return;
|
13723 | }
|
13724 |
|
13725 | _this.selectOption(focusedOption);
|
13726 |
|
13727 | break;
|
13728 |
|
13729 | case 'Enter':
|
13730 | if (event.keyCode === 229) {
|
13731 | // ignore the keydown event from an Input Method Editor(IME)
|
13732 | // ref. https://www.w3.org/TR/uievents/#determine-keydown-keyup-keyCode
|
13733 | break;
|
13734 | }
|
13735 |
|
13736 | if (menuIsOpen) {
|
13737 | if (!focusedOption) return;
|
13738 | if (isComposing) return;
|
13739 |
|
13740 | _this.selectOption(focusedOption);
|
13741 |
|
13742 | break;
|
13743 | }
|
13744 |
|
13745 | return;
|
13746 |
|
13747 | case 'Escape':
|
13748 | if (menuIsOpen) {
|
13749 | _this.inputIsHiddenAfterUpdate = false;
|
13750 |
|
13751 | _this.onInputChange('', {
|
13752 | action: 'menu-close'
|
13753 | });
|
13754 |
|
13755 | _this.onMenuClose();
|
13756 | } else if (isClearable && escapeClearsValue) {
|
13757 | _this.clearValue();
|
13758 | }
|
13759 |
|
13760 | break;
|
13761 |
|
13762 | case ' ':
|
13763 | // space
|
13764 | if (inputValue) {
|
13765 | return;
|
13766 | }
|
13767 |
|
13768 | if (!menuIsOpen) {
|
13769 | _this.openMenu('first');
|
13770 |
|
13771 | break;
|
13772 | }
|
13773 |
|
13774 | if (!focusedOption) return;
|
13775 |
|
13776 | _this.selectOption(focusedOption);
|
13777 |
|
13778 | break;
|
13779 |
|
13780 | case 'ArrowUp':
|
13781 | if (menuIsOpen) {
|
13782 | _this.focusOption('up');
|
13783 | } else {
|
13784 | _this.openMenu('last');
|
13785 | }
|
13786 |
|
13787 | break;
|
13788 |
|
13789 | case 'ArrowDown':
|
13790 | if (menuIsOpen) {
|
13791 | _this.focusOption('down');
|
13792 | } else {
|
13793 | _this.openMenu('first');
|
13794 | }
|
13795 |
|
13796 | break;
|
13797 |
|
13798 | case 'PageUp':
|
13799 | if (!menuIsOpen) return;
|
13800 |
|
13801 | _this.focusOption('pageup');
|
13802 |
|
13803 | break;
|
13804 |
|
13805 | case 'PageDown':
|
13806 | if (!menuIsOpen) return;
|
13807 |
|
13808 | _this.focusOption('pagedown');
|
13809 |
|
13810 | break;
|
13811 |
|
13812 | case 'Home':
|
13813 | if (!menuIsOpen) return;
|
13814 |
|
13815 | _this.focusOption('first');
|
13816 |
|
13817 | break;
|
13818 |
|
13819 | case 'End':
|
13820 | if (!menuIsOpen) return;
|
13821 |
|
13822 | _this.focusOption('last');
|
13823 |
|
13824 | break;
|
13825 |
|
13826 | default:
|
13827 | return;
|
13828 | }
|
13829 |
|
13830 | event.preventDefault();
|
13831 | });
|
13832 |
|
13833 | var value = _props.value;
|
13834 | _this.cacheComponents = index$2(_this.cacheComponents, exportedEqual).bind(_assertThisInitialized$1(_assertThisInitialized$1(_this)));
|
13835 |
|
13836 | _this.cacheComponents(_props.components);
|
13837 |
|
13838 | _this.instancePrefix = 'react-select-' + (_this.props.instanceId || ++instanceId);
|
13839 |
|
13840 | var _selectValue = cleanValue(value);
|
13841 |
|
13842 | var _menuOptions = _this.buildMenuOptions(_props, _selectValue);
|
13843 |
|
13844 | _this.state.menuOptions = _menuOptions;
|
13845 | _this.state.selectValue = _selectValue;
|
13846 | return _this;
|
13847 | }
|
13848 |
|
13849 | _createClass(Select, [{
|
13850 | key: "componentDidMount",
|
13851 | value: function componentDidMount() {
|
13852 | this.startListeningComposition();
|
13853 | this.startListeningToTouch();
|
13854 |
|
13855 | if (this.props.closeMenuOnScroll && document && document.addEventListener) {
|
13856 | // Listen to all scroll events, and filter them out inside of 'onScroll'
|
13857 | document.addEventListener('scroll', this.onScroll, true);
|
13858 | }
|
13859 |
|
13860 | if (this.props.autoFocus) {
|
13861 | this.focusInput();
|
13862 | }
|
13863 | }
|
13864 | }, {
|
13865 | key: "componentWillReceiveProps",
|
13866 | value: function componentWillReceiveProps(nextProps) {
|
13867 | var _this$props8 = this.props,
|
13868 | options = _this$props8.options,
|
13869 | value = _this$props8.value,
|
13870 | inputValue = _this$props8.inputValue; // re-cache custom components
|
13871 |
|
13872 | this.cacheComponents(nextProps.components); // rebuild the menu options
|
13873 |
|
13874 | if (nextProps.value !== value || nextProps.options !== options || nextProps.inputValue !== inputValue) {
|
13875 | var selectValue = cleanValue(nextProps.value);
|
13876 | var menuOptions = this.buildMenuOptions(nextProps, selectValue);
|
13877 | var focusedValue = this.getNextFocusedValue(selectValue);
|
13878 | var focusedOption = this.getNextFocusedOption(menuOptions.focusable);
|
13879 | this.setState({
|
13880 | menuOptions: menuOptions,
|
13881 | selectValue: selectValue,
|
13882 | focusedOption: focusedOption,
|
13883 | focusedValue: focusedValue
|
13884 | });
|
13885 | } // some updates should toggle the state of the input visibility
|
13886 |
|
13887 |
|
13888 | if (this.inputIsHiddenAfterUpdate != null) {
|
13889 | this.setState({
|
13890 | inputIsHidden: this.inputIsHiddenAfterUpdate
|
13891 | });
|
13892 | delete this.inputIsHiddenAfterUpdate;
|
13893 | }
|
13894 | }
|
13895 | }, {
|
13896 | key: "componentDidUpdate",
|
13897 | value: function componentDidUpdate(prevProps) {
|
13898 | var _this$props9 = this.props,
|
13899 | isDisabled = _this$props9.isDisabled,
|
13900 | menuIsOpen = _this$props9.menuIsOpen;
|
13901 | var isFocused = this.state.isFocused;
|
13902 |
|
13903 | if ( // ensure focus is restored correctly when the control becomes enabled
|
13904 | isFocused && !isDisabled && prevProps.isDisabled || // ensure focus is on the Input when the menu opens
|
13905 | isFocused && menuIsOpen && !prevProps.menuIsOpen) {
|
13906 | this.focusInput();
|
13907 | } // scroll the focused option into view if necessary
|
13908 |
|
13909 |
|
13910 | if (this.menuListRef && this.focusedOptionRef && this.scrollToFocusedOptionOnUpdate) {
|
13911 | scrollIntoView(this.menuListRef, this.focusedOptionRef);
|
13912 | }
|
13913 |
|
13914 | this.scrollToFocusedOptionOnUpdate = false;
|
13915 | }
|
13916 | }, {
|
13917 | key: "componentWillUnmount",
|
13918 | value: function componentWillUnmount() {
|
13919 | this.stopListeningComposition();
|
13920 | this.stopListeningToTouch();
|
13921 | document.removeEventListener('scroll', this.onScroll, true);
|
13922 | }
|
13923 | }, {
|
13924 | key: "onMenuOpen",
|
13925 | // ==============================
|
13926 | // Consumer Handlers
|
13927 | // ==============================
|
13928 | value: function onMenuOpen() {
|
13929 | this.props.onMenuOpen();
|
13930 | }
|
13931 | }, {
|
13932 | key: "onMenuClose",
|
13933 | value: function onMenuClose() {
|
13934 | var _this$props10 = this.props,
|
13935 | isSearchable = _this$props10.isSearchable,
|
13936 | isMulti = _this$props10.isMulti;
|
13937 | this.announceAriaLiveContext({
|
13938 | event: 'input',
|
13939 | context: {
|
13940 | isSearchable: isSearchable,
|
13941 | isMulti: isMulti
|
13942 | }
|
13943 | });
|
13944 | this.onInputChange('', {
|
13945 | action: 'menu-close'
|
13946 | });
|
13947 | this.props.onMenuClose();
|
13948 | }
|
13949 | }, {
|
13950 | key: "onInputChange",
|
13951 | value: function onInputChange(newValue, actionMeta) {
|
13952 | this.props.onInputChange(newValue, actionMeta);
|
13953 | } // ==============================
|
13954 | // Methods
|
13955 | // ==============================
|
13956 |
|
13957 | }, {
|
13958 | key: "focusInput",
|
13959 | value: function focusInput() {
|
13960 | if (!this.inputRef) return;
|
13961 | this.inputRef.focus();
|
13962 | }
|
13963 | }, {
|
13964 | key: "blurInput",
|
13965 | value: function blurInput() {
|
13966 | if (!this.inputRef) return;
|
13967 | this.inputRef.blur();
|
13968 | } // aliased for consumers
|
13969 |
|
13970 | }, {
|
13971 | key: "openMenu",
|
13972 | value: function openMenu(focusOption) {
|
13973 | var _this$state3 = this.state,
|
13974 | menuOptions = _this$state3.menuOptions,
|
13975 | selectValue = _this$state3.selectValue,
|
13976 | isFocused = _this$state3.isFocused;
|
13977 | var isMulti = this.props.isMulti;
|
13978 | var openAtIndex = focusOption === 'first' ? 0 : menuOptions.focusable.length - 1;
|
13979 |
|
13980 | if (!isMulti) {
|
13981 | var selectedIndex = menuOptions.focusable.indexOf(selectValue[0]);
|
13982 |
|
13983 | if (selectedIndex > -1) {
|
13984 | openAtIndex = selectedIndex;
|
13985 | }
|
13986 | } // only scroll if the menu isn't already open
|
13987 |
|
13988 |
|
13989 | this.scrollToFocusedOptionOnUpdate = !(isFocused && this.menuListRef);
|
13990 | this.inputIsHiddenAfterUpdate = false;
|
13991 | this.onMenuOpen();
|
13992 | this.setState({
|
13993 | focusedValue: null,
|
13994 | focusedOption: menuOptions.focusable[openAtIndex]
|
13995 | });
|
13996 | this.announceAriaLiveContext({
|
13997 | event: 'menu'
|
13998 | });
|
13999 | }
|
14000 | }, {
|
14001 | key: "focusValue",
|
14002 | value: function focusValue(direction) {
|
14003 | var _this$props11 = this.props,
|
14004 | isMulti = _this$props11.isMulti,
|
14005 | isSearchable = _this$props11.isSearchable;
|
14006 | var _this$state4 = this.state,
|
14007 | selectValue = _this$state4.selectValue,
|
14008 | focusedValue = _this$state4.focusedValue; // Only multiselects support value focusing
|
14009 |
|
14010 | if (!isMulti) return;
|
14011 | this.setState({
|
14012 | focusedOption: null
|
14013 | });
|
14014 | var focusedIndex = selectValue.indexOf(focusedValue);
|
14015 |
|
14016 | if (!focusedValue) {
|
14017 | focusedIndex = -1;
|
14018 | this.announceAriaLiveContext({
|
14019 | event: 'value'
|
14020 | });
|
14021 | }
|
14022 |
|
14023 | var lastIndex = selectValue.length - 1;
|
14024 | var nextFocus = -1;
|
14025 | if (!selectValue.length) return;
|
14026 |
|
14027 | switch (direction) {
|
14028 | case 'previous':
|
14029 | if (focusedIndex === 0) {
|
14030 | // don't cycle from the start to the end
|
14031 | nextFocus = 0;
|
14032 | } else if (focusedIndex === -1) {
|
14033 | // if nothing is focused, focus the last value first
|
14034 | nextFocus = lastIndex;
|
14035 | } else {
|
14036 | nextFocus = focusedIndex - 1;
|
14037 | }
|
14038 |
|
14039 | break;
|
14040 |
|
14041 | case 'next':
|
14042 | if (focusedIndex > -1 && focusedIndex < lastIndex) {
|
14043 | nextFocus = focusedIndex + 1;
|
14044 | }
|
14045 |
|
14046 | break;
|
14047 | }
|
14048 |
|
14049 | if (nextFocus === -1) {
|
14050 | this.announceAriaLiveContext({
|
14051 | event: 'input',
|
14052 | context: {
|
14053 | isSearchable: isSearchable,
|
14054 | isMulti: isMulti
|
14055 | }
|
14056 | });
|
14057 | }
|
14058 |
|
14059 | this.setState({
|
14060 | inputIsHidden: nextFocus === -1 ? false : true,
|
14061 | focusedValue: selectValue[nextFocus]
|
14062 | });
|
14063 | }
|
14064 | }, {
|
14065 | key: "focusOption",
|
14066 | value: function focusOption() {
|
14067 | var direction = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'first';
|
14068 | var pageSize = this.props.pageSize;
|
14069 | var _this$state5 = this.state,
|
14070 | focusedOption = _this$state5.focusedOption,
|
14071 | menuOptions = _this$state5.menuOptions;
|
14072 | var options = menuOptions.focusable;
|
14073 | if (!options.length) return;
|
14074 | var nextFocus = 0; // handles 'first'
|
14075 |
|
14076 | var focusedIndex = options.indexOf(focusedOption);
|
14077 |
|
14078 | if (!focusedOption) {
|
14079 | focusedIndex = -1;
|
14080 | this.announceAriaLiveContext({
|
14081 | event: 'menu'
|
14082 | });
|
14083 | }
|
14084 |
|
14085 | if (direction === 'up') {
|
14086 | nextFocus = focusedIndex > 0 ? focusedIndex - 1 : options.length - 1;
|
14087 | } else if (direction === 'down') {
|
14088 | nextFocus = (focusedIndex + 1) % options.length;
|
14089 | } else if (direction === 'pageup') {
|
14090 | nextFocus = focusedIndex - pageSize;
|
14091 | if (nextFocus < 0) nextFocus = 0;
|
14092 | } else if (direction === 'pagedown') {
|
14093 | nextFocus = focusedIndex + pageSize;
|
14094 | if (nextFocus > options.length - 1) nextFocus = options.length - 1;
|
14095 | } else if (direction === 'last') {
|
14096 | nextFocus = options.length - 1;
|
14097 | }
|
14098 |
|
14099 | this.scrollToFocusedOptionOnUpdate = true;
|
14100 | this.setState({
|
14101 | focusedOption: options[nextFocus],
|
14102 | focusedValue: null
|
14103 | });
|
14104 | this.announceAriaLiveContext({
|
14105 | event: 'menu',
|
14106 | context: {
|
14107 | isDisabled: isOptionDisabled(options[nextFocus])
|
14108 | }
|
14109 | });
|
14110 | }
|
14111 | }, {
|
14112 | key: "getTheme",
|
14113 | // ==============================
|
14114 | // Getters
|
14115 | // ==============================
|
14116 | value: function getTheme() {
|
14117 | // Use the default theme if there are no customizations.
|
14118 | if (!this.props.theme) {
|
14119 | return defaultTheme;
|
14120 | } // If the theme prop is a function, assume the function
|
14121 | // knows how to merge the passed-in default theme with
|
14122 | // its own modifications.
|
14123 |
|
14124 |
|
14125 | if (typeof this.props.theme === 'function') {
|
14126 | return this.props.theme(defaultTheme);
|
14127 | } // Otherwise, if a plain theme object was passed in,
|
14128 | // overlay it with the default theme.
|
14129 |
|
14130 |
|
14131 | return _objectSpread({}, defaultTheme, this.props.theme);
|
14132 | }
|
14133 | }, {
|
14134 | key: "getCommonProps",
|
14135 | value: function getCommonProps() {
|
14136 | var clearValue = this.clearValue,
|
14137 | getStyles = this.getStyles,
|
14138 | setValue = this.setValue,
|
14139 | selectOption = this.selectOption,
|
14140 | props = this.props;
|
14141 | var classNamePrefix = props.classNamePrefix,
|
14142 | isMulti = props.isMulti,
|
14143 | isRtl = props.isRtl,
|
14144 | options = props.options;
|
14145 | var selectValue = this.state.selectValue;
|
14146 | var hasValue = this.hasValue();
|
14147 |
|
14148 | var getValue = function getValue() {
|
14149 | return selectValue;
|
14150 | };
|
14151 |
|
14152 | var cx$$1 = classNames.bind(null, classNamePrefix);
|
14153 | return {
|
14154 | cx: cx$$1,
|
14155 | clearValue: clearValue,
|
14156 | getStyles: getStyles,
|
14157 | getValue: getValue,
|
14158 | hasValue: hasValue,
|
14159 | isMulti: isMulti,
|
14160 | isRtl: isRtl,
|
14161 | options: options,
|
14162 | selectOption: selectOption,
|
14163 | setValue: setValue,
|
14164 | selectProps: props,
|
14165 | theme: this.getTheme()
|
14166 | };
|
14167 | }
|
14168 | }, {
|
14169 | key: "getNextFocusedValue",
|
14170 | value: function getNextFocusedValue(nextSelectValue) {
|
14171 | if (this.clearFocusValueOnUpdate) {
|
14172 | this.clearFocusValueOnUpdate = false;
|
14173 | return null;
|
14174 | }
|
14175 |
|
14176 | var _this$state6 = this.state,
|
14177 | focusedValue = _this$state6.focusedValue,
|
14178 | lastSelectValue = _this$state6.selectValue;
|
14179 | var lastFocusedIndex = lastSelectValue.indexOf(focusedValue);
|
14180 |
|
14181 | if (lastFocusedIndex > -1) {
|
14182 | var nextFocusedIndex = nextSelectValue.indexOf(focusedValue);
|
14183 |
|
14184 | if (nextFocusedIndex > -1) {
|
14185 | // the focused value is still in the selectValue, return it
|
14186 | return focusedValue;
|
14187 | } else if (lastFocusedIndex < nextSelectValue.length) {
|
14188 | // the focusedValue is not present in the next selectValue array by
|
14189 | // reference, so return the new value at the same index
|
14190 | return nextSelectValue[lastFocusedIndex];
|
14191 | }
|
14192 | }
|
14193 |
|
14194 | return null;
|
14195 | }
|
14196 | }, {
|
14197 | key: "getNextFocusedOption",
|
14198 | value: function getNextFocusedOption(options) {
|
14199 | var lastFocusedOption = this.state.focusedOption;
|
14200 | return lastFocusedOption && options.indexOf(lastFocusedOption) > -1 ? lastFocusedOption : options[0];
|
14201 | }
|
14202 | }, {
|
14203 | key: "hasValue",
|
14204 | value: function hasValue() {
|
14205 | var selectValue = this.state.selectValue;
|
14206 | return selectValue.length > 0;
|
14207 | }
|
14208 | }, {
|
14209 | key: "hasOptions",
|
14210 | value: function hasOptions() {
|
14211 | return !!this.state.menuOptions.render.length;
|
14212 | }
|
14213 | }, {
|
14214 | key: "countOptions",
|
14215 | value: function countOptions() {
|
14216 | return this.state.menuOptions.focusable.length;
|
14217 | }
|
14218 | }, {
|
14219 | key: "isClearable",
|
14220 | value: function isClearable() {
|
14221 | var _this$props12 = this.props,
|
14222 | isClearable = _this$props12.isClearable,
|
14223 | isMulti = _this$props12.isMulti; // single select, by default, IS NOT clearable
|
14224 | // multi select, by default, IS clearable
|
14225 |
|
14226 | if (isClearable === undefined) return isMulti;
|
14227 | return isClearable;
|
14228 | }
|
14229 | }, {
|
14230 | key: "isOptionDisabled",
|
14231 | value: function isOptionDisabled$$1(option, selectValue) {
|
14232 | return typeof this.props.isOptionDisabled === 'function' ? this.props.isOptionDisabled(option, selectValue) : false;
|
14233 | }
|
14234 | }, {
|
14235 | key: "isOptionSelected",
|
14236 | value: function isOptionSelected(option, selectValue) {
|
14237 | var _this2 = this;
|
14238 |
|
14239 | if (selectValue.indexOf(option) > -1) return true;
|
14240 |
|
14241 | if (typeof this.props.isOptionSelected === 'function') {
|
14242 | return this.props.isOptionSelected(option, selectValue);
|
14243 | }
|
14244 |
|
14245 | var candidate = this.getOptionValue(option);
|
14246 | return selectValue.some(function (i) {
|
14247 | return _this2.getOptionValue(i) === candidate;
|
14248 | });
|
14249 | }
|
14250 | }, {
|
14251 | key: "filterOption",
|
14252 | value: function filterOption(option, inputValue) {
|
14253 | return this.props.filterOption ? this.props.filterOption(option, inputValue) : true;
|
14254 | }
|
14255 | }, {
|
14256 | key: "formatOptionLabel",
|
14257 | value: function formatOptionLabel(data, context) {
|
14258 | if (typeof this.props.formatOptionLabel === 'function') {
|
14259 | var inputValue = this.props.inputValue;
|
14260 | var selectValue = this.state.selectValue;
|
14261 | return this.props.formatOptionLabel(data, {
|
14262 | context: context,
|
14263 | inputValue: inputValue,
|
14264 | selectValue: selectValue
|
14265 | });
|
14266 | } else {
|
14267 | return this.getOptionLabel(data);
|
14268 | }
|
14269 | }
|
14270 | }, {
|
14271 | key: "formatGroupLabel",
|
14272 | value: function formatGroupLabel$$1(data) {
|
14273 | return this.props.formatGroupLabel(data);
|
14274 | } // ==============================
|
14275 | // Mouse Handlers
|
14276 | // ==============================
|
14277 |
|
14278 | }, {
|
14279 | key: "startListeningComposition",
|
14280 | // ==============================
|
14281 | // Composition Handlers
|
14282 | // ==============================
|
14283 | value: function startListeningComposition() {
|
14284 | if (document && document.addEventListener) {
|
14285 | document.addEventListener('compositionstart', this.onCompositionStart, false);
|
14286 | document.addEventListener('compositionend', this.onCompositionEnd, false);
|
14287 | }
|
14288 | }
|
14289 | }, {
|
14290 | key: "stopListeningComposition",
|
14291 | value: function stopListeningComposition() {
|
14292 | if (document && document.removeEventListener) {
|
14293 | document.removeEventListener('compositionstart', this.onCompositionStart);
|
14294 | document.removeEventListener('compositionend', this.onCompositionEnd);
|
14295 | }
|
14296 | }
|
14297 | }, {
|
14298 | key: "startListeningToTouch",
|
14299 | // ==============================
|
14300 | // Touch Handlers
|
14301 | // ==============================
|
14302 | value: function startListeningToTouch() {
|
14303 | if (document && document.addEventListener) {
|
14304 | document.addEventListener('touchstart', this.onTouchStart, false);
|
14305 | document.addEventListener('touchmove', this.onTouchMove, false);
|
14306 | document.addEventListener('touchend', this.onTouchEnd, false);
|
14307 | }
|
14308 | }
|
14309 | }, {
|
14310 | key: "stopListeningToTouch",
|
14311 | value: function stopListeningToTouch() {
|
14312 | if (document && document.removeEventListener) {
|
14313 | document.removeEventListener('touchstart', this.onTouchStart);
|
14314 | document.removeEventListener('touchmove', this.onTouchMove);
|
14315 | document.removeEventListener('touchend', this.onTouchEnd);
|
14316 | }
|
14317 | }
|
14318 | }, {
|
14319 | key: "buildMenuOptions",
|
14320 | // ==============================
|
14321 | // Menu Options
|
14322 | // ==============================
|
14323 | value: function buildMenuOptions(props, selectValue) {
|
14324 | var _this3 = this;
|
14325 |
|
14326 | var _props$inputValue = props.inputValue,
|
14327 | inputValue = _props$inputValue === void 0 ? '' : _props$inputValue,
|
14328 | options = props.options;
|
14329 |
|
14330 | var toOption = function toOption(option, id) {
|
14331 | var isDisabled = _this3.isOptionDisabled(option, selectValue);
|
14332 |
|
14333 | var isSelected = _this3.isOptionSelected(option, selectValue);
|
14334 |
|
14335 | var label = _this3.getOptionLabel(option);
|
14336 |
|
14337 | var value = _this3.getOptionValue(option);
|
14338 |
|
14339 | if (_this3.shouldHideSelectedOptions() && isSelected || !_this3.filterOption({
|
14340 | label: label,
|
14341 | value: value,
|
14342 | data: option
|
14343 | }, inputValue)) {
|
14344 | return;
|
14345 | }
|
14346 |
|
14347 | var onHover = isDisabled ? undefined : function () {
|
14348 | return _this3.onOptionHover(option);
|
14349 | };
|
14350 | var onSelect = isDisabled ? undefined : function () {
|
14351 | return _this3.selectOption(option);
|
14352 | };
|
14353 | var optionId = "".concat(_this3.getElementId('option'), "-").concat(id);
|
14354 | return {
|
14355 | innerProps: {
|
14356 | id: optionId,
|
14357 | onClick: onSelect,
|
14358 | onMouseMove: onHover,
|
14359 | onMouseOver: onHover,
|
14360 | tabIndex: -1
|
14361 | },
|
14362 | data: option,
|
14363 | isDisabled: isDisabled,
|
14364 | isSelected: isSelected,
|
14365 | key: optionId,
|
14366 | label: label,
|
14367 | type: 'option',
|
14368 | value: value
|
14369 | };
|
14370 | };
|
14371 |
|
14372 | return options.reduce(function (acc, item, itemIndex) {
|
14373 | if (item.options) {
|
14374 | // TODO needs a tidier implementation
|
14375 | if (!_this3.hasGroups) _this3.hasGroups = true;
|
14376 | var items = item.options;
|
14377 | var children = items.map(function (child, i) {
|
14378 | var option = toOption(child, "".concat(itemIndex, "-").concat(i));
|
14379 | if (option) acc.focusable.push(child);
|
14380 | return option;
|
14381 | }).filter(Boolean);
|
14382 |
|
14383 | if (children.length) {
|
14384 | var groupId = "".concat(_this3.getElementId('group'), "-").concat(itemIndex);
|
14385 | acc.render.push({
|
14386 | type: 'group',
|
14387 | key: groupId,
|
14388 | data: item,
|
14389 | options: children
|
14390 | });
|
14391 | }
|
14392 | } else {
|
14393 | var option = toOption(item, "".concat(itemIndex));
|
14394 |
|
14395 | if (option) {
|
14396 | acc.render.push(option);
|
14397 | acc.focusable.push(item);
|
14398 | }
|
14399 | }
|
14400 |
|
14401 | return acc;
|
14402 | }, {
|
14403 | render: [],
|
14404 | focusable: []
|
14405 | });
|
14406 | } // ==============================
|
14407 | // Renderers
|
14408 | // ==============================
|
14409 |
|
14410 | }, {
|
14411 | key: "constructAriaLiveMessage",
|
14412 | value: function constructAriaLiveMessage() {
|
14413 | var _this$state7 = this.state,
|
14414 | ariaLiveContext = _this$state7.ariaLiveContext,
|
14415 | selectValue = _this$state7.selectValue,
|
14416 | focusedValue = _this$state7.focusedValue,
|
14417 | focusedOption = _this$state7.focusedOption;
|
14418 | var _this$props13 = this.props,
|
14419 | options = _this$props13.options,
|
14420 | menuIsOpen = _this$props13.menuIsOpen,
|
14421 | inputValue = _this$props13.inputValue,
|
14422 | screenReaderStatus = _this$props13.screenReaderStatus; // An aria live message representing the currently focused value in the select.
|
14423 |
|
14424 | var focusedValueMsg = focusedValue ? valueFocusAriaMessage({
|
14425 | focusedValue: focusedValue,
|
14426 | getOptionLabel: this.getOptionLabel,
|
14427 | selectValue: selectValue
|
14428 | }) : ''; // An aria live message representing the currently focused option in the select.
|
14429 |
|
14430 | var focusedOptionMsg = focusedOption && menuIsOpen ? optionFocusAriaMessage({
|
14431 | focusedOption: focusedOption,
|
14432 | getOptionLabel: this.getOptionLabel,
|
14433 | options: options
|
14434 | }) : ''; // An aria live message representing the set of focusable results and current searchterm/inputvalue.
|
14435 |
|
14436 | var resultsMsg = resultsAriaMessage({
|
14437 | inputValue: inputValue,
|
14438 | screenReaderMessage: screenReaderStatus({
|
14439 | count: this.countOptions()
|
14440 | })
|
14441 | });
|
14442 | return "".concat(focusedValueMsg, " ").concat(focusedOptionMsg, " ").concat(resultsMsg, " ").concat(ariaLiveContext);
|
14443 | }
|
14444 | }, {
|
14445 | key: "renderInput",
|
14446 | value: function renderInput() {
|
14447 | var _this$props14 = this.props,
|
14448 | isDisabled = _this$props14.isDisabled,
|
14449 | isSearchable = _this$props14.isSearchable,
|
14450 | inputId = _this$props14.inputId,
|
14451 | inputValue = _this$props14.inputValue,
|
14452 | tabIndex = _this$props14.tabIndex;
|
14453 | var Input$$1 = this.components.Input;
|
14454 | var inputIsHidden = this.state.inputIsHidden;
|
14455 | var id = inputId || this.getElementId('input');
|
14456 |
|
14457 | if (!isSearchable) {
|
14458 | // use a dummy input to maintain focus/blur functionality
|
14459 | return React.createElement(DummyInput, {
|
14460 | id: id,
|
14461 | innerRef: this.getInputRef,
|
14462 | onBlur: this.onInputBlur,
|
14463 | onChange: noop,
|
14464 | onFocus: this.onInputFocus,
|
14465 | readOnly: true,
|
14466 | disabled: isDisabled,
|
14467 | tabIndex: tabIndex,
|
14468 | value: ""
|
14469 | });
|
14470 | } // aria attributes makes the JSX "noisy", separated for clarity
|
14471 |
|
14472 |
|
14473 | var ariaAttributes = {
|
14474 | 'aria-autocomplete': 'list',
|
14475 | 'aria-label': this.props['aria-label'],
|
14476 | 'aria-labelledby': this.props['aria-labelledby']
|
14477 | };
|
14478 | var _this$commonProps = this.commonProps,
|
14479 | cx$$1 = _this$commonProps.cx,
|
14480 | theme = _this$commonProps.theme,
|
14481 | selectProps = _this$commonProps.selectProps;
|
14482 | return React.createElement(Input$$1, _extends$2({
|
14483 | autoCapitalize: "none",
|
14484 | autoComplete: "off",
|
14485 | autoCorrect: "off",
|
14486 | cx: cx$$1,
|
14487 | getStyles: this.getStyles,
|
14488 | id: id,
|
14489 | innerRef: this.getInputRef,
|
14490 | isDisabled: isDisabled,
|
14491 | isHidden: inputIsHidden,
|
14492 | onBlur: this.onInputBlur,
|
14493 | onChange: this.handleInputChange,
|
14494 | onFocus: this.onInputFocus,
|
14495 | selectProps: selectProps,
|
14496 | spellCheck: "false",
|
14497 | tabIndex: tabIndex,
|
14498 | theme: theme,
|
14499 | type: "text",
|
14500 | value: inputValue
|
14501 | }, ariaAttributes));
|
14502 | }
|
14503 | }, {
|
14504 | key: "renderPlaceholderOrValue",
|
14505 | value: function renderPlaceholderOrValue() {
|
14506 | var _this4 = this;
|
14507 |
|
14508 | var _this$components = this.components,
|
14509 | MultiValue = _this$components.MultiValue,
|
14510 | MultiValueContainer = _this$components.MultiValueContainer,
|
14511 | MultiValueLabel = _this$components.MultiValueLabel,
|
14512 | MultiValueRemove = _this$components.MultiValueRemove,
|
14513 | SingleValue = _this$components.SingleValue,
|
14514 | Placeholder = _this$components.Placeholder;
|
14515 | var commonProps = this.commonProps;
|
14516 | var _this$props15 = this.props,
|
14517 | controlShouldRenderValue = _this$props15.controlShouldRenderValue,
|
14518 | isDisabled = _this$props15.isDisabled,
|
14519 | isMulti = _this$props15.isMulti,
|
14520 | inputValue = _this$props15.inputValue,
|
14521 | placeholder = _this$props15.placeholder;
|
14522 | var _this$state8 = this.state,
|
14523 | selectValue = _this$state8.selectValue,
|
14524 | focusedValue = _this$state8.focusedValue,
|
14525 | isFocused = _this$state8.isFocused;
|
14526 |
|
14527 | if (!this.hasValue() || !controlShouldRenderValue) {
|
14528 | return inputValue ? null : React.createElement(Placeholder, _extends$2({}, commonProps, {
|
14529 | key: "placeholder",
|
14530 | isDisabled: isDisabled,
|
14531 | isFocused: isFocused
|
14532 | }), placeholder);
|
14533 | }
|
14534 |
|
14535 | if (isMulti) {
|
14536 | var selectValues = selectValue.map(function (opt) {
|
14537 | var isOptionFocused = opt === focusedValue;
|
14538 | return React.createElement(MultiValue, _extends$2({}, commonProps, {
|
14539 | components: {
|
14540 | Container: MultiValueContainer,
|
14541 | Label: MultiValueLabel,
|
14542 | Remove: MultiValueRemove
|
14543 | },
|
14544 | isFocused: isOptionFocused,
|
14545 | isDisabled: isDisabled,
|
14546 | key: _this4.getOptionValue(opt),
|
14547 | removeProps: {
|
14548 | onClick: function onClick() {
|
14549 | return _this4.removeValue(opt);
|
14550 | },
|
14551 | onTouchEnd: function onTouchEnd() {
|
14552 | return _this4.removeValue(opt);
|
14553 | },
|
14554 | onMouseDown: function onMouseDown(e) {
|
14555 | e.preventDefault();
|
14556 | e.stopPropagation();
|
14557 | }
|
14558 | },
|
14559 | data: opt
|
14560 | }), _this4.formatOptionLabel(opt, 'value'));
|
14561 | });
|
14562 | return selectValues;
|
14563 | }
|
14564 |
|
14565 | if (inputValue) {
|
14566 | return null;
|
14567 | }
|
14568 |
|
14569 | var singleValue = selectValue[0];
|
14570 | return React.createElement(SingleValue, _extends$2({}, commonProps, {
|
14571 | data: singleValue,
|
14572 | isDisabled: isDisabled
|
14573 | }), this.formatOptionLabel(singleValue, 'value'));
|
14574 | }
|
14575 | }, {
|
14576 | key: "renderClearIndicator",
|
14577 | value: function renderClearIndicator() {
|
14578 | var ClearIndicator = this.components.ClearIndicator;
|
14579 | var commonProps = this.commonProps;
|
14580 | var _this$props16 = this.props,
|
14581 | isDisabled = _this$props16.isDisabled,
|
14582 | isLoading = _this$props16.isLoading;
|
14583 | var isFocused = this.state.isFocused;
|
14584 |
|
14585 | if (!this.isClearable() || !ClearIndicator || isDisabled || !this.hasValue() || isLoading) {
|
14586 | return null;
|
14587 | }
|
14588 |
|
14589 | var innerProps = {
|
14590 | onMouseDown: this.onClearIndicatorMouseDown,
|
14591 | onTouchEnd: this.onClearIndicatorTouchEnd,
|
14592 | 'aria-hidden': 'true'
|
14593 | };
|
14594 | return React.createElement(ClearIndicator, _extends$2({}, commonProps, {
|
14595 | innerProps: innerProps,
|
14596 | isFocused: isFocused
|
14597 | }));
|
14598 | }
|
14599 | }, {
|
14600 | key: "renderLoadingIndicator",
|
14601 | value: function renderLoadingIndicator() {
|
14602 | var LoadingIndicator = this.components.LoadingIndicator;
|
14603 | var commonProps = this.commonProps;
|
14604 | var _this$props17 = this.props,
|
14605 | isDisabled = _this$props17.isDisabled,
|
14606 | isLoading = _this$props17.isLoading;
|
14607 | var isFocused = this.state.isFocused;
|
14608 | if (!LoadingIndicator || !isLoading) return null;
|
14609 | var innerProps = {
|
14610 | 'aria-hidden': 'true'
|
14611 | };
|
14612 | return React.createElement(LoadingIndicator, _extends$2({}, commonProps, {
|
14613 | innerProps: innerProps,
|
14614 | isDisabled: isDisabled,
|
14615 | isFocused: isFocused
|
14616 | }));
|
14617 | }
|
14618 | }, {
|
14619 | key: "renderIndicatorSeparator",
|
14620 | value: function renderIndicatorSeparator() {
|
14621 | var _this$components2 = this.components,
|
14622 | DropdownIndicator = _this$components2.DropdownIndicator,
|
14623 | IndicatorSeparator = _this$components2.IndicatorSeparator; // separator doesn't make sense without the dropdown indicator
|
14624 |
|
14625 | if (!DropdownIndicator || !IndicatorSeparator) return null;
|
14626 | var commonProps = this.commonProps;
|
14627 | var isDisabled = this.props.isDisabled;
|
14628 | var isFocused = this.state.isFocused;
|
14629 | return React.createElement(IndicatorSeparator, _extends$2({}, commonProps, {
|
14630 | isDisabled: isDisabled,
|
14631 | isFocused: isFocused
|
14632 | }));
|
14633 | }
|
14634 | }, {
|
14635 | key: "renderDropdownIndicator",
|
14636 | value: function renderDropdownIndicator() {
|
14637 | var DropdownIndicator = this.components.DropdownIndicator;
|
14638 | if (!DropdownIndicator) return null;
|
14639 | var commonProps = this.commonProps;
|
14640 | var isDisabled = this.props.isDisabled;
|
14641 | var isFocused = this.state.isFocused;
|
14642 | var innerProps = {
|
14643 | onMouseDown: this.onDropdownIndicatorMouseDown,
|
14644 | onTouchEnd: this.onDropdownIndicatorTouchEnd,
|
14645 | 'aria-hidden': 'true'
|
14646 | };
|
14647 | return React.createElement(DropdownIndicator, _extends$2({}, commonProps, {
|
14648 | innerProps: innerProps,
|
14649 | isDisabled: isDisabled,
|
14650 | isFocused: isFocused
|
14651 | }));
|
14652 | }
|
14653 | }, {
|
14654 | key: "renderMenu",
|
14655 | value: function renderMenu() {
|
14656 | var _this5 = this;
|
14657 |
|
14658 | var _this$components3 = this.components,
|
14659 | Group = _this$components3.Group,
|
14660 | GroupHeading = _this$components3.GroupHeading,
|
14661 | Menu$$1 = _this$components3.Menu,
|
14662 | MenuList$$1 = _this$components3.MenuList,
|
14663 | MenuPortal$$1 = _this$components3.MenuPortal,
|
14664 | LoadingMessage$$1 = _this$components3.LoadingMessage,
|
14665 | NoOptionsMessage$$1 = _this$components3.NoOptionsMessage,
|
14666 | Option = _this$components3.Option;
|
14667 | var commonProps = this.commonProps;
|
14668 | var _this$state9 = this.state,
|
14669 | focusedOption = _this$state9.focusedOption,
|
14670 | menuOptions = _this$state9.menuOptions;
|
14671 | var _this$props18 = this.props,
|
14672 | captureMenuScroll = _this$props18.captureMenuScroll,
|
14673 | inputValue = _this$props18.inputValue,
|
14674 | isLoading = _this$props18.isLoading,
|
14675 | loadingMessage = _this$props18.loadingMessage,
|
14676 | minMenuHeight = _this$props18.minMenuHeight,
|
14677 | maxMenuHeight = _this$props18.maxMenuHeight,
|
14678 | menuIsOpen = _this$props18.menuIsOpen,
|
14679 | menuPlacement = _this$props18.menuPlacement,
|
14680 | menuPosition = _this$props18.menuPosition,
|
14681 | menuPortalTarget = _this$props18.menuPortalTarget,
|
14682 | menuShouldBlockScroll = _this$props18.menuShouldBlockScroll,
|
14683 | menuShouldScrollIntoView = _this$props18.menuShouldScrollIntoView,
|
14684 | noOptionsMessage = _this$props18.noOptionsMessage,
|
14685 | onMenuScrollToTop = _this$props18.onMenuScrollToTop,
|
14686 | onMenuScrollToBottom = _this$props18.onMenuScrollToBottom;
|
14687 | if (!menuIsOpen) return null; // TODO: Internal Option Type here
|
14688 |
|
14689 | var render = function render(props) {
|
14690 | // for performance, the menu options in state aren't changed when the
|
14691 | // focused option changes so we calculate additional props based on that
|
14692 | var isFocused = focusedOption === props.data;
|
14693 | props.innerRef = isFocused ? _this5.getFocusedOptionRef : undefined;
|
14694 | return React.createElement(Option, _extends$2({}, commonProps, props, {
|
14695 | isFocused: isFocused
|
14696 | }), _this5.formatOptionLabel(props.data, 'menu'));
|
14697 | };
|
14698 |
|
14699 | var menuUI;
|
14700 |
|
14701 | if (this.hasOptions()) {
|
14702 | menuUI = menuOptions.render.map(function (item) {
|
14703 | if (item.type === 'group') {
|
14704 | var type = item.type,
|
14705 | group = _objectWithoutProperties(item, ["type"]);
|
14706 |
|
14707 | var headingId = "".concat(item.key, "-heading");
|
14708 | return React.createElement(Group, _extends$2({}, commonProps, group, {
|
14709 | Heading: GroupHeading,
|
14710 | headingProps: {
|
14711 | id: headingId
|
14712 | },
|
14713 | label: _this5.formatGroupLabel(item.data)
|
14714 | }), item.options.map(function (option) {
|
14715 | return render(option);
|
14716 | }));
|
14717 | } else if (item.type === 'option') {
|
14718 | return render(item);
|
14719 | }
|
14720 | });
|
14721 | } else if (isLoading) {
|
14722 | var message = loadingMessage({
|
14723 | inputValue: inputValue
|
14724 | });
|
14725 | if (message === null) return null;
|
14726 | menuUI = React.createElement(LoadingMessage$$1, commonProps, message);
|
14727 | } else {
|
14728 | var _message = noOptionsMessage({
|
14729 | inputValue: inputValue
|
14730 | });
|
14731 |
|
14732 | if (_message === null) return null;
|
14733 | menuUI = React.createElement(NoOptionsMessage$$1, commonProps, _message);
|
14734 | }
|
14735 |
|
14736 | var menuPlacementProps = {
|
14737 | minMenuHeight: minMenuHeight,
|
14738 | maxMenuHeight: maxMenuHeight,
|
14739 | menuPlacement: menuPlacement,
|
14740 | menuPosition: menuPosition,
|
14741 | menuShouldScrollIntoView: menuShouldScrollIntoView
|
14742 | };
|
14743 | var menuElement = React.createElement(MenuPlacer, _extends$2({}, commonProps, menuPlacementProps), function (_ref6) {
|
14744 | var ref = _ref6.ref,
|
14745 | _ref6$placerProps = _ref6.placerProps,
|
14746 | placement = _ref6$placerProps.placement,
|
14747 | maxHeight = _ref6$placerProps.maxHeight;
|
14748 | return React.createElement(Menu$$1, _extends$2({}, commonProps, menuPlacementProps, {
|
14749 | innerRef: ref,
|
14750 | innerProps: {
|
14751 | onMouseDown: _this5.onMenuMouseDown,
|
14752 | onMouseMove: _this5.onMenuMouseMove
|
14753 | },
|
14754 | isLoading: isLoading,
|
14755 | placement: placement
|
14756 | }), React.createElement(ScrollCaptorSwitch, {
|
14757 | isEnabled: captureMenuScroll,
|
14758 | onTopArrive: onMenuScrollToTop,
|
14759 | onBottomArrive: onMenuScrollToBottom
|
14760 | }, React.createElement(ScrollBlock, {
|
14761 | isEnabled: menuShouldBlockScroll
|
14762 | }, React.createElement(MenuList$$1, _extends$2({}, commonProps, {
|
14763 | innerRef: _this5.getMenuListRef,
|
14764 | isLoading: isLoading,
|
14765 | maxHeight: maxHeight
|
14766 | }), menuUI))));
|
14767 | }); // positioning behaviour is almost identical for portalled and fixed,
|
14768 | // so we use the same component. the actual portalling logic is forked
|
14769 | // within the component based on `menuPosition`
|
14770 |
|
14771 | return menuPortalTarget || menuPosition === 'fixed' ? React.createElement(MenuPortal$$1, _extends$2({}, commonProps, {
|
14772 | appendTo: menuPortalTarget,
|
14773 | controlElement: this.controlRef,
|
14774 | menuPlacement: menuPlacement,
|
14775 | menuPosition: menuPosition
|
14776 | }), menuElement) : menuElement;
|
14777 | }
|
14778 | }, {
|
14779 | key: "renderFormField",
|
14780 | value: function renderFormField() {
|
14781 | var _this6 = this;
|
14782 |
|
14783 | var _this$props19 = this.props,
|
14784 | delimiter = _this$props19.delimiter,
|
14785 | isDisabled = _this$props19.isDisabled,
|
14786 | isMulti = _this$props19.isMulti,
|
14787 | name = _this$props19.name;
|
14788 | var selectValue = this.state.selectValue;
|
14789 | if (!name || isDisabled) return;
|
14790 |
|
14791 | if (isMulti) {
|
14792 | if (delimiter) {
|
14793 | var value = selectValue.map(function (opt) {
|
14794 | return _this6.getOptionValue(opt);
|
14795 | }).join(delimiter);
|
14796 | return React.createElement("input", {
|
14797 | name: name,
|
14798 | type: "hidden",
|
14799 | value: value
|
14800 | });
|
14801 | } else {
|
14802 | var input = selectValue.length > 0 ? selectValue.map(function (opt, i) {
|
14803 | return React.createElement("input", {
|
14804 | key: "i-".concat(i),
|
14805 | name: name,
|
14806 | type: "hidden",
|
14807 | value: _this6.getOptionValue(opt)
|
14808 | });
|
14809 | }) : React.createElement("input", {
|
14810 | name: name,
|
14811 | type: "hidden"
|
14812 | });
|
14813 | return React.createElement("div", null, input);
|
14814 | }
|
14815 | } else {
|
14816 | var _value = selectValue[0] ? this.getOptionValue(selectValue[0]) : '';
|
14817 |
|
14818 | return React.createElement("input", {
|
14819 | name: name,
|
14820 | type: "hidden",
|
14821 | value: _value
|
14822 | });
|
14823 | }
|
14824 | }
|
14825 | }, {
|
14826 | key: "renderLiveRegion",
|
14827 | value: function renderLiveRegion() {
|
14828 | if (!this.state.isFocused) return null;
|
14829 | return React.createElement(A11yText, {
|
14830 | "aria-live": "assertive"
|
14831 | }, React.createElement("p", {
|
14832 | id: "aria-selection-event"
|
14833 | }, "\xA0", this.state.ariaLiveSelection), React.createElement("p", {
|
14834 | id: "aria-context"
|
14835 | }, "\xA0", this.constructAriaLiveMessage()));
|
14836 | }
|
14837 | }, {
|
14838 | key: "render",
|
14839 | value: function render() {
|
14840 | var _this$components4 = this.components,
|
14841 | Control = _this$components4.Control,
|
14842 | IndicatorsContainer = _this$components4.IndicatorsContainer,
|
14843 | SelectContainer = _this$components4.SelectContainer,
|
14844 | ValueContainer = _this$components4.ValueContainer;
|
14845 | var _this$props20 = this.props,
|
14846 | className = _this$props20.className,
|
14847 | id = _this$props20.id,
|
14848 | isDisabled = _this$props20.isDisabled,
|
14849 | menuIsOpen = _this$props20.menuIsOpen;
|
14850 | var isFocused = this.state.isFocused;
|
14851 | var commonProps = this.commonProps = this.getCommonProps();
|
14852 | return React.createElement(SelectContainer, _extends$2({}, commonProps, {
|
14853 | className: className,
|
14854 | innerProps: {
|
14855 | id: id,
|
14856 | onKeyDown: this.onKeyDown
|
14857 | },
|
14858 | isDisabled: isDisabled,
|
14859 | isFocused: isFocused
|
14860 | }), this.renderLiveRegion(), React.createElement(Control, _extends$2({}, commonProps, {
|
14861 | innerRef: this.getControlRef,
|
14862 | innerProps: {
|
14863 | onMouseDown: this.onControlMouseDown,
|
14864 | onTouchEnd: this.onControlTouchEnd
|
14865 | },
|
14866 | isDisabled: isDisabled,
|
14867 | isFocused: isFocused,
|
14868 | menuIsOpen: menuIsOpen
|
14869 | }), React.createElement(ValueContainer, _extends$2({}, commonProps, {
|
14870 | isDisabled: isDisabled
|
14871 | }), this.renderPlaceholderOrValue(), this.renderInput()), React.createElement(IndicatorsContainer, _extends$2({}, commonProps, {
|
14872 | isDisabled: isDisabled
|
14873 | }), this.renderClearIndicator(), this.renderLoadingIndicator(), this.renderIndicatorSeparator(), this.renderDropdownIndicator())), this.renderMenu(), this.renderFormField());
|
14874 | }
|
14875 | }]);
|
14876 |
|
14877 | return Select;
|
14878 | }(Component);
|
14879 |
|
14880 | _defineProperty$1(Select, "defaultProps", defaultProps);
|
14881 |
|
14882 | var defaultProps$1 = {
|
14883 | defaultInputValue: '',
|
14884 | defaultMenuIsOpen: false,
|
14885 | defaultValue: null
|
14886 | };
|
14887 |
|
14888 | var manageState = function manageState(SelectComponent) {
|
14889 | var _class, _temp;
|
14890 |
|
14891 | return _temp = _class =
|
14892 | /*#__PURE__*/
|
14893 | function (_Component) {
|
14894 | _inherits(StateManager, _Component);
|
14895 |
|
14896 | function StateManager() {
|
14897 | var _getPrototypeOf2;
|
14898 |
|
14899 | var _this;
|
14900 |
|
14901 | _classCallCheck(this, StateManager);
|
14902 |
|
14903 | for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
14904 | args[_key] = arguments[_key];
|
14905 | }
|
14906 |
|
14907 | _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(StateManager)).call.apply(_getPrototypeOf2, [this].concat(args)));
|
14908 |
|
14909 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "select", void 0);
|
14910 |
|
14911 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "state", {
|
14912 | inputValue: _this.props.inputValue !== undefined ? _this.props.inputValue : _this.props.defaultInputValue,
|
14913 | menuIsOpen: _this.props.menuIsOpen !== undefined ? _this.props.menuIsOpen : _this.props.defaultMenuIsOpen,
|
14914 | value: _this.props.value !== undefined ? _this.props.value : _this.props.defaultValue
|
14915 | });
|
14916 |
|
14917 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "onChange", function (value, actionMeta) {
|
14918 | _this.callProp('onChange', value, actionMeta);
|
14919 |
|
14920 | _this.setState({
|
14921 | value: value
|
14922 | });
|
14923 | });
|
14924 |
|
14925 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "onInputChange", function (value, actionMeta) {
|
14926 | // TODO: for backwards compatibility, we allow the prop to return a new
|
14927 | // value, but now inputValue is a controllable prop we probably shouldn't
|
14928 | var newValue = _this.callProp('onInputChange', value, actionMeta);
|
14929 |
|
14930 | _this.setState({
|
14931 | inputValue: newValue !== undefined ? newValue : value
|
14932 | });
|
14933 | });
|
14934 |
|
14935 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "onMenuOpen", function () {
|
14936 | _this.callProp('onMenuOpen');
|
14937 |
|
14938 | _this.setState({
|
14939 | menuIsOpen: true
|
14940 | });
|
14941 | });
|
14942 |
|
14943 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "onMenuClose", function () {
|
14944 | _this.callProp('onMenuClose');
|
14945 |
|
14946 | _this.setState({
|
14947 | menuIsOpen: false
|
14948 | });
|
14949 | });
|
14950 |
|
14951 | return _this;
|
14952 | }
|
14953 |
|
14954 | _createClass(StateManager, [{
|
14955 | key: "focus",
|
14956 | value: function focus() {
|
14957 | this.select.focus();
|
14958 | }
|
14959 | }, {
|
14960 | key: "blur",
|
14961 | value: function blur() {
|
14962 | this.select.blur();
|
14963 | } // FIXME: untyped flow code, return any
|
14964 |
|
14965 | }, {
|
14966 | key: "getProp",
|
14967 | value: function getProp(key) {
|
14968 | return this.props[key] !== undefined ? this.props[key] : this.state[key];
|
14969 | } // FIXME: untyped flow code, return any
|
14970 |
|
14971 | }, {
|
14972 | key: "callProp",
|
14973 | value: function callProp(name) {
|
14974 | if (typeof this.props[name] === 'function') {
|
14975 | var _this$props;
|
14976 |
|
14977 | for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
14978 | args[_key2 - 1] = arguments[_key2];
|
14979 | }
|
14980 |
|
14981 | return (_this$props = this.props)[name].apply(_this$props, args);
|
14982 | }
|
14983 | }
|
14984 | }, {
|
14985 | key: "render",
|
14986 | value: function render() {
|
14987 | var _this2 = this;
|
14988 |
|
14989 | var _this$props2 = this.props,
|
14990 | defaultInputValue = _this$props2.defaultInputValue,
|
14991 | defaultMenuIsOpen = _this$props2.defaultMenuIsOpen,
|
14992 | defaultValue = _this$props2.defaultValue,
|
14993 | props = _objectWithoutProperties(_this$props2, ["defaultInputValue", "defaultMenuIsOpen", "defaultValue"]);
|
14994 |
|
14995 | return React.createElement(SelectComponent, _extends$2({}, props, {
|
14996 | ref: function ref(_ref) {
|
14997 | _this2.select = _ref;
|
14998 | },
|
14999 | inputValue: this.getProp('inputValue'),
|
15000 | menuIsOpen: this.getProp('menuIsOpen'),
|
15001 | onChange: this.onChange,
|
15002 | onInputChange: this.onInputChange,
|
15003 | onMenuClose: this.onMenuClose,
|
15004 | onMenuOpen: this.onMenuOpen,
|
15005 | value: this.getProp('value')
|
15006 | }));
|
15007 | }
|
15008 | }]);
|
15009 |
|
15010 | return StateManager;
|
15011 | }(Component), _defineProperty$1(_class, "defaultProps", defaultProps$1), _temp;
|
15012 | };
|
15013 |
|
15014 | var defaultProps$2 = {
|
15015 | cacheOptions: false,
|
15016 | defaultOptions: false,
|
15017 | filterOption: null
|
15018 | };
|
15019 | var makeAsyncSelect = function makeAsyncSelect(SelectComponent) {
|
15020 | var _class, _temp;
|
15021 |
|
15022 | return _temp = _class =
|
15023 | /*#__PURE__*/
|
15024 | function (_Component) {
|
15025 | _inherits(Async, _Component);
|
15026 |
|
15027 | function Async(props) {
|
15028 | var _this;
|
15029 |
|
15030 | _classCallCheck(this, Async);
|
15031 |
|
15032 | _this = _possibleConstructorReturn(this, _getPrototypeOf(Async).call(this));
|
15033 |
|
15034 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "select", void 0);
|
15035 |
|
15036 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "lastRequest", void 0);
|
15037 |
|
15038 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "mounted", false);
|
15039 |
|
15040 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "optionsCache", {});
|
15041 |
|
15042 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "handleInputChange", function (newValue, actionMeta) {
|
15043 | var _this$props = _this.props,
|
15044 | cacheOptions = _this$props.cacheOptions,
|
15045 | onInputChange = _this$props.onInputChange; // TODO
|
15046 |
|
15047 | var inputValue = handleInputChange(newValue, actionMeta, onInputChange);
|
15048 |
|
15049 | if (!inputValue) {
|
15050 | delete _this.lastRequest;
|
15051 |
|
15052 | _this.setState({
|
15053 | inputValue: '',
|
15054 | loadedInputValue: '',
|
15055 | loadedOptions: [],
|
15056 | isLoading: false,
|
15057 | passEmptyOptions: false
|
15058 | });
|
15059 |
|
15060 | return;
|
15061 | }
|
15062 |
|
15063 | if (cacheOptions && _this.optionsCache[inputValue]) {
|
15064 | _this.setState({
|
15065 | inputValue: inputValue,
|
15066 | loadedInputValue: inputValue,
|
15067 | loadedOptions: _this.optionsCache[inputValue],
|
15068 | isLoading: false,
|
15069 | passEmptyOptions: false
|
15070 | });
|
15071 | } else {
|
15072 | var request = _this.lastRequest = {};
|
15073 |
|
15074 | _this.setState({
|
15075 | inputValue: inputValue,
|
15076 | isLoading: true,
|
15077 | passEmptyOptions: !_this.state.loadedInputValue
|
15078 | }, function () {
|
15079 | _this.loadOptions(inputValue, function (options) {
|
15080 | if (!_this.mounted) return;
|
15081 |
|
15082 | if (options) {
|
15083 | _this.optionsCache[inputValue] = options;
|
15084 | }
|
15085 |
|
15086 | if (request !== _this.lastRequest) return;
|
15087 | delete _this.lastRequest;
|
15088 |
|
15089 | _this.setState({
|
15090 | isLoading: false,
|
15091 | loadedInputValue: inputValue,
|
15092 | loadedOptions: options || [],
|
15093 | passEmptyOptions: false
|
15094 | });
|
15095 | });
|
15096 | });
|
15097 | }
|
15098 |
|
15099 | return inputValue;
|
15100 | });
|
15101 |
|
15102 | _this.state = {
|
15103 | defaultOptions: Array.isArray(props.defaultOptions) ? props.defaultOptions : undefined,
|
15104 | inputValue: typeof props.inputValue !== 'undefined' ? props.inputValue : '',
|
15105 | isLoading: props.defaultOptions === true ? true : false,
|
15106 | loadedOptions: [],
|
15107 | passEmptyOptions: false
|
15108 | };
|
15109 | return _this;
|
15110 | }
|
15111 |
|
15112 | _createClass(Async, [{
|
15113 | key: "componentDidMount",
|
15114 | value: function componentDidMount() {
|
15115 | var _this2 = this;
|
15116 |
|
15117 | this.mounted = true;
|
15118 | var defaultOptions = this.props.defaultOptions;
|
15119 | var inputValue = this.state.inputValue;
|
15120 |
|
15121 | if (defaultOptions === true) {
|
15122 | this.loadOptions(inputValue, function (options) {
|
15123 | if (!_this2.mounted) return;
|
15124 | var isLoading = !!_this2.lastRequest;
|
15125 |
|
15126 | _this2.setState({
|
15127 | defaultOptions: options || [],
|
15128 | isLoading: isLoading
|
15129 | });
|
15130 | });
|
15131 | }
|
15132 | }
|
15133 | }, {
|
15134 | key: "componentWillReceiveProps",
|
15135 | value: function componentWillReceiveProps(nextProps) {
|
15136 | // if the cacheOptions prop changes, clear the cache
|
15137 | if (nextProps.cacheOptions !== this.props.cacheOptions) {
|
15138 | this.optionsCache = {};
|
15139 | }
|
15140 |
|
15141 | if (nextProps.defaultOptions !== this.props.defaultOptions) {
|
15142 | this.setState({
|
15143 | defaultOptions: Array.isArray(nextProps.defaultOptions) ? nextProps.defaultOptions : undefined
|
15144 | });
|
15145 | }
|
15146 | }
|
15147 | }, {
|
15148 | key: "componentWillUnmount",
|
15149 | value: function componentWillUnmount() {
|
15150 | this.mounted = false;
|
15151 | }
|
15152 | }, {
|
15153 | key: "focus",
|
15154 | value: function focus() {
|
15155 | this.select.focus();
|
15156 | }
|
15157 | }, {
|
15158 | key: "blur",
|
15159 | value: function blur() {
|
15160 | this.select.blur();
|
15161 | }
|
15162 | }, {
|
15163 | key: "loadOptions",
|
15164 | value: function loadOptions(inputValue, callback) {
|
15165 | var loadOptions = this.props.loadOptions;
|
15166 | if (!loadOptions) return callback();
|
15167 | var loader = loadOptions(inputValue, callback);
|
15168 |
|
15169 | if (loader && typeof loader.then === 'function') {
|
15170 | loader.then(callback, function () {
|
15171 | return callback();
|
15172 | });
|
15173 | }
|
15174 | }
|
15175 | }, {
|
15176 | key: "render",
|
15177 | value: function render() {
|
15178 | var _this3 = this;
|
15179 |
|
15180 | var _this$props2 = this.props,
|
15181 | loadOptions = _this$props2.loadOptions,
|
15182 | props = _objectWithoutProperties(_this$props2, ["loadOptions"]);
|
15183 |
|
15184 | var _this$state = this.state,
|
15185 | defaultOptions = _this$state.defaultOptions,
|
15186 | inputValue = _this$state.inputValue,
|
15187 | isLoading = _this$state.isLoading,
|
15188 | loadedInputValue = _this$state.loadedInputValue,
|
15189 | loadedOptions = _this$state.loadedOptions,
|
15190 | passEmptyOptions = _this$state.passEmptyOptions;
|
15191 | var options = passEmptyOptions ? [] : inputValue && loadedInputValue ? loadedOptions : defaultOptions || [];
|
15192 | return React.createElement(SelectComponent, _extends$2({}, props, {
|
15193 | ref: function ref(_ref) {
|
15194 | _this3.select = _ref;
|
15195 | },
|
15196 | options: options,
|
15197 | isLoading: isLoading,
|
15198 | onInputChange: this.handleInputChange
|
15199 | }));
|
15200 | }
|
15201 | }]);
|
15202 |
|
15203 | return Async;
|
15204 | }(Component), _defineProperty$1(_class, "defaultProps", defaultProps$2), _temp;
|
15205 | };
|
15206 | var SelectState = manageState(Select);
|
15207 | var Async = makeAsyncSelect(SelectState);
|
15208 |
|
15209 | var compareOption = function compareOption() {
|
15210 | var inputValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
15211 | var option = arguments.length > 1 ? arguments[1] : undefined;
|
15212 | var candidate = String(inputValue).toLowerCase();
|
15213 | var optionValue = String(option.value).toLowerCase();
|
15214 | var optionLabel = String(option.label).toLowerCase();
|
15215 | return optionValue === candidate || optionLabel === candidate;
|
15216 | };
|
15217 |
|
15218 | var builtins = {
|
15219 | formatCreateLabel: function formatCreateLabel(inputValue) {
|
15220 | return "Create \"".concat(inputValue, "\"");
|
15221 | },
|
15222 | isValidNewOption: function isValidNewOption(inputValue, selectValue, selectOptions) {
|
15223 | return !(!inputValue || selectValue.some(function (option) {
|
15224 | return compareOption(inputValue, option);
|
15225 | }) || selectOptions.some(function (option) {
|
15226 | return compareOption(inputValue, option);
|
15227 | }));
|
15228 | },
|
15229 | getNewOptionData: function getNewOptionData(inputValue, optionLabel) {
|
15230 | return {
|
15231 | label: optionLabel,
|
15232 | value: inputValue,
|
15233 | __isNew__: true
|
15234 | };
|
15235 | }
|
15236 | };
|
15237 | var defaultProps$3 = _objectSpread({
|
15238 | allowCreateWhileLoading: false,
|
15239 | createOptionPosition: 'last'
|
15240 | }, builtins);
|
15241 | var makeCreatableSelect = function makeCreatableSelect(SelectComponent) {
|
15242 | var _class, _temp;
|
15243 |
|
15244 | return _temp = _class =
|
15245 | /*#__PURE__*/
|
15246 | function (_Component) {
|
15247 | _inherits(Creatable, _Component);
|
15248 |
|
15249 | function Creatable(props) {
|
15250 | var _this;
|
15251 |
|
15252 | _classCallCheck(this, Creatable);
|
15253 |
|
15254 | _this = _possibleConstructorReturn(this, _getPrototypeOf(Creatable).call(this, props));
|
15255 |
|
15256 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "select", void 0);
|
15257 |
|
15258 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "onChange", function (newValue, actionMeta) {
|
15259 | var _this$props = _this.props,
|
15260 | getNewOptionData = _this$props.getNewOptionData,
|
15261 | inputValue = _this$props.inputValue,
|
15262 | isMulti = _this$props.isMulti,
|
15263 | onChange = _this$props.onChange,
|
15264 | onCreateOption = _this$props.onCreateOption,
|
15265 | value = _this$props.value;
|
15266 |
|
15267 | if (actionMeta.action !== 'select-option') {
|
15268 | return onChange(newValue, actionMeta);
|
15269 | }
|
15270 |
|
15271 | var newOption = _this.state.newOption;
|
15272 | var valueArray = Array.isArray(newValue) ? newValue : [newValue];
|
15273 |
|
15274 | if (valueArray[valueArray.length - 1] === newOption) {
|
15275 | if (onCreateOption) onCreateOption(inputValue);else {
|
15276 | var newOptionData = getNewOptionData(inputValue, inputValue);
|
15277 | var newActionMeta = {
|
15278 | action: 'create-option'
|
15279 | };
|
15280 |
|
15281 | if (isMulti) {
|
15282 | onChange([].concat(_toConsumableArray(cleanValue(value)), [newOptionData]), newActionMeta);
|
15283 | } else {
|
15284 | onChange(newOptionData, newActionMeta);
|
15285 | }
|
15286 | }
|
15287 | return;
|
15288 | }
|
15289 |
|
15290 | onChange(newValue, actionMeta);
|
15291 | });
|
15292 |
|
15293 | var options = props.options || [];
|
15294 | _this.state = {
|
15295 | newOption: undefined,
|
15296 | options: options
|
15297 | };
|
15298 | return _this;
|
15299 | }
|
15300 |
|
15301 | _createClass(Creatable, [{
|
15302 | key: "componentWillReceiveProps",
|
15303 | value: function componentWillReceiveProps(nextProps) {
|
15304 | var allowCreateWhileLoading = nextProps.allowCreateWhileLoading,
|
15305 | createOptionPosition = nextProps.createOptionPosition,
|
15306 | formatCreateLabel = nextProps.formatCreateLabel,
|
15307 | getNewOptionData = nextProps.getNewOptionData,
|
15308 | inputValue = nextProps.inputValue,
|
15309 | isLoading = nextProps.isLoading,
|
15310 | isValidNewOption = nextProps.isValidNewOption,
|
15311 | value = nextProps.value;
|
15312 | var options = nextProps.options || [];
|
15313 | var newOption = this.state.newOption;
|
15314 |
|
15315 | if (isValidNewOption(inputValue, cleanValue(value), options)) {
|
15316 | newOption = getNewOptionData(inputValue, formatCreateLabel(inputValue));
|
15317 | } else {
|
15318 | newOption = undefined;
|
15319 | }
|
15320 |
|
15321 | this.setState({
|
15322 | newOption: newOption,
|
15323 | options: (allowCreateWhileLoading || !isLoading) && newOption ? createOptionPosition === 'first' ? [newOption].concat(_toConsumableArray(options)) : [].concat(_toConsumableArray(options), [newOption]) : options
|
15324 | });
|
15325 | }
|
15326 | }, {
|
15327 | key: "focus",
|
15328 | value: function focus() {
|
15329 | this.select.focus();
|
15330 | }
|
15331 | }, {
|
15332 | key: "blur",
|
15333 | value: function blur() {
|
15334 | this.select.blur();
|
15335 | }
|
15336 | }, {
|
15337 | key: "render",
|
15338 | value: function render() {
|
15339 | var _this2 = this;
|
15340 |
|
15341 | var props = _extends$2({}, this.props);
|
15342 |
|
15343 | var options = this.state.options;
|
15344 | return React.createElement(SelectComponent, _extends$2({}, props, {
|
15345 | ref: function ref(_ref) {
|
15346 | _this2.select = _ref;
|
15347 | },
|
15348 | options: options,
|
15349 | onChange: this.onChange
|
15350 | }));
|
15351 | }
|
15352 | }]);
|
15353 |
|
15354 | return Creatable;
|
15355 | }(Component), _defineProperty$1(_class, "defaultProps", defaultProps$3), _temp;
|
15356 | }; // TODO: do this in package entrypoint
|
15357 |
|
15358 | var SelectCreatable = makeCreatableSelect(Select);
|
15359 | var Creatable = manageState(SelectCreatable);
|
15360 |
|
15361 | var SelectCreatable$1 = makeCreatableSelect(Select);
|
15362 | var SelectCreatableState = manageState(SelectCreatable$1);
|
15363 | var AsyncCreatable = makeAsyncSelect(SelectCreatableState);
|
15364 |
|
15365 | // strip transition props off before spreading onto select component
|
15366 | // note we need to be explicit about innerRef for flow
|
15367 | var AnimatedInput = function AnimatedInput(WrappedComponent) {
|
15368 | return function (_ref) {
|
15369 | var inProp = _ref.in,
|
15370 | onExited = _ref.onExited,
|
15371 | appear = _ref.appear,
|
15372 | enter = _ref.enter,
|
15373 | exit = _ref.exit,
|
15374 | props = _objectWithoutProperties(_ref, ["in", "onExited", "appear", "enter", "exit"]);
|
15375 |
|
15376 | return React.createElement(WrappedComponent, props);
|
15377 | };
|
15378 | };
|
15379 |
|
15380 | var Fade = function Fade(_ref) {
|
15381 | var Tag = _ref.component,
|
15382 | _ref$duration = _ref.duration,
|
15383 | duration = _ref$duration === void 0 ? 1 : _ref$duration,
|
15384 | inProp = _ref.in,
|
15385 | onExited = _ref.onExited,
|
15386 | props = _objectWithoutProperties(_ref, ["component", "duration", "in", "onExited"]);
|
15387 |
|
15388 | var transition = {
|
15389 | entering: {
|
15390 | opacity: 0
|
15391 | },
|
15392 | entered: {
|
15393 | opacity: 1,
|
15394 | transition: "opacity ".concat(duration, "ms")
|
15395 | },
|
15396 | exiting: {
|
15397 | opacity: 0
|
15398 | },
|
15399 | exited: {
|
15400 | opacity: 0
|
15401 | }
|
15402 | };
|
15403 | return React.createElement(reactTransitionGroup_1, {
|
15404 | mountOnEnter: true,
|
15405 | unmountOnExit: true,
|
15406 | in: inProp,
|
15407 | timeout: duration
|
15408 | }, function (state) {
|
15409 | var innerProps = {
|
15410 | style: _objectSpread({}, transition[state])
|
15411 | };
|
15412 | return React.createElement(Tag, _extends$2({
|
15413 | innerProps: innerProps
|
15414 | }, props));
|
15415 | });
|
15416 | }; // ==============================
|
15417 | // Collapse Transition
|
15418 | // ==============================
|
15419 |
|
15420 | var collapseDuration = 260;
|
15421 | // wrap each MultiValue with a collapse transition; decreases width until
|
15422 | // finally removing from DOM
|
15423 | var Collapse =
|
15424 | /*#__PURE__*/
|
15425 | function (_Component) {
|
15426 | _inherits(Collapse, _Component);
|
15427 |
|
15428 | function Collapse() {
|
15429 | var _getPrototypeOf2;
|
15430 |
|
15431 | var _this;
|
15432 |
|
15433 | _classCallCheck(this, Collapse);
|
15434 |
|
15435 | for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
15436 | args[_key] = arguments[_key];
|
15437 | }
|
15438 |
|
15439 | _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(Collapse)).call.apply(_getPrototypeOf2, [this].concat(args)));
|
15440 |
|
15441 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "duration", collapseDuration);
|
15442 |
|
15443 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "rafID", void 0);
|
15444 |
|
15445 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "state", {
|
15446 | width: 'auto'
|
15447 | });
|
15448 |
|
15449 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "transition", {
|
15450 | exiting: {
|
15451 | width: 0,
|
15452 | transition: "width ".concat(_this.duration, "ms ease-out")
|
15453 | },
|
15454 | exited: {
|
15455 | width: 0
|
15456 | }
|
15457 | });
|
15458 |
|
15459 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "getWidth", function (ref) {
|
15460 | if (ref && isNaN(_this.state.width)) {
|
15461 | /*
|
15462 | Here we're invoking requestAnimationFrame with a callback invoking our
|
15463 | call to getBoundingClientRect and setState in order to resolve an edge case
|
15464 | around portalling. Certain portalling solutions briefly remove children from the DOM
|
15465 | before appending them to the target node. This is to avoid us trying to call getBoundingClientrect
|
15466 | while the Select component is in this state.
|
15467 | */
|
15468 | // cannot use `offsetWidth` because it is rounded
|
15469 | _this.rafID = window.requestAnimationFrame(function () {
|
15470 | var _ref$getBoundingClien = ref.getBoundingClientRect(),
|
15471 | width = _ref$getBoundingClien.width;
|
15472 |
|
15473 | _this.setState({
|
15474 | width: width
|
15475 | });
|
15476 | });
|
15477 | }
|
15478 | });
|
15479 |
|
15480 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "getStyle", function (width) {
|
15481 | return {
|
15482 | overflow: 'hidden',
|
15483 | whiteSpace: 'nowrap',
|
15484 | width: width
|
15485 | };
|
15486 | });
|
15487 |
|
15488 | _defineProperty$1(_assertThisInitialized$1(_assertThisInitialized$1(_this)), "getTransition", function (state) {
|
15489 | return _this.transition[state];
|
15490 | });
|
15491 |
|
15492 | return _this;
|
15493 | }
|
15494 |
|
15495 | _createClass(Collapse, [{
|
15496 | key: "componentWillUnmount",
|
15497 | value: function componentWillUnmount() {
|
15498 | if (this.rafID) {
|
15499 | window.cancelAnimationFrame(this.rafID);
|
15500 | }
|
15501 | } // width must be calculated; cannot transition from `undefined` to `number`
|
15502 |
|
15503 | }, {
|
15504 | key: "render",
|
15505 | value: function render() {
|
15506 | var _this2 = this;
|
15507 |
|
15508 | var _this$props = this.props,
|
15509 | children = _this$props.children,
|
15510 | inProp = _this$props.in;
|
15511 | var width = this.state.width;
|
15512 | return React.createElement(reactTransitionGroup_1, {
|
15513 | enter: false,
|
15514 | mountOnEnter: true,
|
15515 | unmountOnExit: true,
|
15516 | in: inProp,
|
15517 | timeout: this.duration
|
15518 | }, function (state) {
|
15519 | var style = _objectSpread({}, _this2.getStyle(width), _this2.getTransition(state));
|
15520 |
|
15521 | return React.createElement("div", {
|
15522 | ref: _this2.getWidth,
|
15523 | style: style
|
15524 | }, children);
|
15525 | });
|
15526 | }
|
15527 | }]);
|
15528 |
|
15529 | return Collapse;
|
15530 | }(Component);
|
15531 |
|
15532 | var AnimatedMultiValue = function AnimatedMultiValue(WrappedComponent) {
|
15533 | return function (_ref) {
|
15534 | var inProp = _ref.in,
|
15535 | onExited = _ref.onExited,
|
15536 | props = _objectWithoutProperties(_ref, ["in", "onExited"]);
|
15537 |
|
15538 | return React.createElement(Collapse, {
|
15539 | in: inProp,
|
15540 | onExited: onExited
|
15541 | }, React.createElement(WrappedComponent, _extends$2({
|
15542 | cropWithEllipsis: inProp
|
15543 | }, props)));
|
15544 | };
|
15545 | };
|
15546 |
|
15547 | var AnimatedPlaceholder = function AnimatedPlaceholder(WrappedComponent) {
|
15548 | return function (props) {
|
15549 | return React.createElement(Fade, _extends$2({
|
15550 | component: WrappedComponent,
|
15551 | duration: props.isMulti ? collapseDuration : 1
|
15552 | }, props));
|
15553 | };
|
15554 | };
|
15555 |
|
15556 | var AnimatedSingleValue = function AnimatedSingleValue(WrappedComponent) {
|
15557 | return function (props) {
|
15558 | return React.createElement(Fade, _extends$2({
|
15559 | component: WrappedComponent
|
15560 | }, props));
|
15561 | };
|
15562 | };
|
15563 |
|
15564 | // make ValueContainer a transition group
|
15565 | var AnimatedValueContainer = function AnimatedValueContainer(WrappedComponent) {
|
15566 | return function (props) {
|
15567 | return React.createElement(reactTransitionGroup_2, _extends$2({
|
15568 | component: WrappedComponent
|
15569 | }, props));
|
15570 | };
|
15571 | };
|
15572 |
|
15573 | var makeAnimated = function makeAnimated() {
|
15574 | var externalComponents = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
15575 | var components$$1 = defaultComponents({
|
15576 | components: externalComponents
|
15577 | });
|
15578 |
|
15579 | var Input$$1 = components$$1.Input,
|
15580 | MultiValue = components$$1.MultiValue,
|
15581 | Placeholder = components$$1.Placeholder,
|
15582 | SingleValue = components$$1.SingleValue,
|
15583 | ValueContainer = components$$1.ValueContainer,
|
15584 | rest = _objectWithoutProperties(components$$1, ["Input", "MultiValue", "Placeholder", "SingleValue", "ValueContainer"]);
|
15585 |
|
15586 | return _objectSpread({
|
15587 | Input: AnimatedInput(Input$$1),
|
15588 | MultiValue: AnimatedMultiValue(MultiValue),
|
15589 | Placeholder: AnimatedPlaceholder(Placeholder),
|
15590 | SingleValue: AnimatedSingleValue(SingleValue),
|
15591 | ValueContainer: AnimatedValueContainer(ValueContainer)
|
15592 | }, rest);
|
15593 | };
|
15594 |
|
15595 | var AnimatedComponents = makeAnimated();
|
15596 | var Input$1$1 = AnimatedComponents.Input;
|
15597 | var MultiValue$1 = AnimatedComponents.MultiValue;
|
15598 | var Placeholder$1 = AnimatedComponents.Placeholder;
|
15599 | var SingleValue$1 = AnimatedComponents.SingleValue;
|
15600 | var ValueContainer$1 = AnimatedComponents.ValueContainer;
|
15601 | var index$4 = index$2(makeAnimated, exportedEqual);
|
15602 |
|
15603 | var index$1$1 = manageState(Select);
|
15604 |
|
15605 | function _templateObject$L() {
|
15606 | var data = taggedTemplateLiteralLoose(["\n\tpointer-events: none;\n"]);
|
15607 |
|
15608 | _templateObject$L = function _templateObject() {
|
15609 | return data;
|
15610 | };
|
15611 |
|
15612 | return data;
|
15613 | }
|
15614 |
|
15615 | var MultiInputOption = function MultiInputOption(_ref) {
|
15616 | var children = _ref.children,
|
15617 | isSelected = _ref.isSelected,
|
15618 | props = objectWithoutPropertiesLoose(_ref, ["children", "isSelected"]);
|
15619 |
|
15620 | return React.createElement(components.Option, props, React.createElement(CheckboxEventLess, null, React.createElement(Checkbox$1, {
|
15621 | label: children,
|
15622 | checked: isSelected
|
15623 | })));
|
15624 | };
|
15625 |
|
15626 | var CheckboxEventLess = styled.div(_templateObject$L());
|
15627 | MultiInputOption.defaultProps = {
|
15628 | classNamePrefix: 'multi-input-option',
|
15629 | children: null,
|
15630 | isSelected: false
|
15631 | };
|
15632 | MultiInputOption.displayName = 'MultiInputOption';
|
15633 | MultiInputOption.propTypes = {
|
15634 | isSelected: PropTypes.bool,
|
15635 | children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),
|
15636 | classNamePrefix: PropTypes.string
|
15637 | };
|
15638 |
|
15639 | var MultiInputValueContainer = function MultiInputValueContainer(_ref) {
|
15640 | var children = _ref.children,
|
15641 | getValue = _ref.getValue,
|
15642 | selectProps = _ref.selectProps,
|
15643 | props = objectWithoutPropertiesLoose(_ref, ["children", "getValue", "selectProps"]);
|
15644 |
|
15645 | var valueLength = getValue().length;
|
15646 | var inputValue = selectProps.inputValue,
|
15647 | formatMessage = selectProps.formatMessage;
|
15648 | return React.createElement(components.ValueContainer, props, !inputValue && formatMessage(valueLength), React.Children.map(children, function (child) {
|
15649 | return child && child.type === components.Input ? child : null;
|
15650 | }));
|
15651 | };
|
15652 |
|
15653 | MultiInputValueContainer.defaultProps = {
|
15654 | getValue: undefined,
|
15655 | selectProps: {},
|
15656 | children: null
|
15657 | };
|
15658 | MultiInputValueContainer.propTypes = {
|
15659 | getValue: PropTypes.func,
|
15660 | selectProps: PropTypes.shape({
|
15661 | inputValue: PropTypes.string,
|
15662 | formatMessage: PropTypes.func
|
15663 | }),
|
15664 | children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node])
|
15665 | };
|
15666 |
|
15667 | function _templateObject$M() {
|
15668 | var data = taggedTemplateLiteralLoose(["\n\t& .select__placeholder {\n\t\tcolor: ", ";\n\t}\n\t& .select__control {\n\t\tmin-height: 34px;\n\t\tborder-radius: ", ";\n\t}\n\t& .select__menu {\n\t\tz-index: 3;\n\t\tpadding: ", ";\n\t\tborder-radius: ", ";\n\t}\n\t& .select__option {\n\t\tmargin-top: 2px;\n\t\tmargin-bottom: 2px;\n\t\tborder-radius: ", " !important;\n\t\tcursor: pointer;\n\t}\n\t& .select__option--is-focused {\n\t\tbackground-color: ", " !important;\n\t}\n\t& .select__option--is-selected {\n\t\tbackground-color: ", " !important;\n\t}\n\t& .select__value-container {\n\t\tpadding: 0 8px;\n\t}\n\t& .select__indicator {\n\t\twidth: 32px;\n\t\theight: 32px;\n\t}\n\t& .select__indicator-separator {\n\t\tdisplay: none;\n\t}\n"]);
|
15669 |
|
15670 | _templateObject$M = function _templateObject() {
|
15671 | return data;
|
15672 | };
|
15673 |
|
15674 | return data;
|
15675 | }
|
15676 | var SelectStyled = styled(index$1$1)(_templateObject$M(), function (_ref) {
|
15677 | var theme = _ref.theme;
|
15678 | return theme.select.placeholderColor;
|
15679 | }, function (_ref2) {
|
15680 | var theme = _ref2.theme;
|
15681 | return theme.select.borderRadius;
|
15682 | }, function (_ref3) {
|
15683 | var theme = _ref3.theme;
|
15684 | return theme.select.menuPadding;
|
15685 | }, function (_ref4) {
|
15686 | var theme = _ref4.theme;
|
15687 | return theme.select.borderRadius;
|
15688 | }, function (_ref5) {
|
15689 | var theme = _ref5.theme;
|
15690 | return theme.select.borderRadius;
|
15691 | }, function (_ref6) {
|
15692 | var theme = _ref6.theme;
|
15693 | return theme.select.focusedBackgroundColor;
|
15694 | }, function (_ref7) {
|
15695 | var theme = _ref7.theme;
|
15696 | return theme.select.selectedBackgroundColor;
|
15697 | });
|
15698 |
|
15699 | var Select$1 = function Select$$1(_ref8) {
|
15700 | var isMulti = _ref8.isMulti,
|
15701 | props = objectWithoutPropertiesLoose(_ref8, ["isMulti"]);
|
15702 |
|
15703 | if (isMulti) {
|
15704 | props = _extends_1({}, props, {
|
15705 | isMulti: isMulti,
|
15706 | hideSelectedOptions: false,
|
15707 | closeMenuOnSelect: false,
|
15708 | components: {
|
15709 | Option: MultiInputOption,
|
15710 | ValueContainer: MultiInputValueContainer
|
15711 | }
|
15712 | });
|
15713 | }
|
15714 |
|
15715 | return React.createElement(SelectStyled, props);
|
15716 | };
|
15717 |
|
15718 | Select$1.defaultProps = {
|
15719 | isMulti: false,
|
15720 | classNamePrefix: 'select',
|
15721 | formatMessage: function formatMessage(elem) {
|
15722 | return elem;
|
15723 | }
|
15724 | };
|
15725 | Select$1.displayName = 'Select';
|
15726 | Select$1.propTypes = {
|
15727 | /** If users are allowed to select more than one option */
|
15728 | isMulti: PropTypes.bool,
|
15729 |
|
15730 | /** String to be pre-appended to internal classNames */
|
15731 | classNamePrefix: PropTypes.string,
|
15732 |
|
15733 | /** Function to format multi select label container */
|
15734 | formatMessage: PropTypes.func
|
15735 | };
|
15736 |
|
15737 | function _templateObject$N() {
|
15738 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: inline-block;\n\tcursor: pointer;\n"]);
|
15739 |
|
15740 | _templateObject$N = function _templateObject() {
|
15741 | return data;
|
15742 | };
|
15743 |
|
15744 | return data;
|
15745 | }
|
15746 |
|
15747 | var Collapse$1 = function Collapse(_ref) {
|
15748 | var trigger = _ref.trigger,
|
15749 | children = _ref.children;
|
15750 |
|
15751 | var _useState = useState(false),
|
15752 | open = _useState[0],
|
15753 | setOpen = _useState[1];
|
15754 |
|
15755 | return React.createElement(Fragment, null, React.createElement(Wrapper, {
|
15756 | onClick: function onClick() {
|
15757 | return setOpen(!open);
|
15758 | }
|
15759 | }, trigger), React.createElement(Spring, {
|
15760 | from: {
|
15761 | height: open ? 0 : 'auto',
|
15762 | opacity: open ? 0 : 1
|
15763 | },
|
15764 | to: {
|
15765 | height: open ? 'auto' : 0,
|
15766 | opacity: open ? 1 : 0
|
15767 | },
|
15768 | after: {
|
15769 | display: open ? 'block' : 'none'
|
15770 | }
|
15771 | }, function (props) {
|
15772 | return React.createElement("div", {
|
15773 | open: open,
|
15774 | className: "show",
|
15775 | style: props
|
15776 | }, children);
|
15777 | }));
|
15778 | };
|
15779 |
|
15780 | var Wrapper = styled.div(_templateObject$N());
|
15781 | Wrapper.displayName = 'Wrapper';
|
15782 | Collapse$1.displayName = 'Collapse';
|
15783 | Collapse$1.defaultPropTypes = {
|
15784 | children: null,
|
15785 | trigger: null
|
15786 | };
|
15787 | Collapse$1.propTypes = {
|
15788 | /** Trigger element */
|
15789 | trigger: PropTypes.node.isRequired,
|
15790 |
|
15791 | /** hidden element */
|
15792 | children: PropTypes.node.isRequired
|
15793 | };
|
15794 |
|
15795 | function _templateObject6$3() {
|
15796 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: ", ";\n\tpadding: 20px;\n\tborder: thin solid ", ";\n\tborder-radius: 0 0 4px 4px;\n"]);
|
15797 |
|
15798 | _templateObject6$3 = function _templateObject6() {
|
15799 | return data;
|
15800 | };
|
15801 |
|
15802 | return data;
|
15803 | }
|
15804 |
|
15805 | function _templateObject5$4() {
|
15806 | var data = taggedTemplateLiteralLoose(["\n\tmargin-right: 6px;\n\tcolor: ", ";\n\tfont-size: 13px;\n\ttext-transform: uppercase;\n"]);
|
15807 |
|
15808 | _templateObject5$4 = function _templateObject5() {
|
15809 | return data;
|
15810 | };
|
15811 |
|
15812 | return data;
|
15813 | }
|
15814 |
|
15815 | function _templateObject4$9() {
|
15816 | var data = taggedTemplateLiteralLoose(["\n\tcolor: ", " !important;\n\ttransform: ", ";\n\ttransition: 0.33s;\n"]);
|
15817 |
|
15818 | _templateObject4$9 = function _templateObject4() {
|
15819 | return data;
|
15820 | };
|
15821 |
|
15822 | return data;
|
15823 | }
|
15824 |
|
15825 | function _templateObject3$c() {
|
15826 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\talign-items: center;\n"]);
|
15827 |
|
15828 | _templateObject3$c = function _templateObject3() {
|
15829 | return data;
|
15830 | };
|
15831 |
|
15832 | return data;
|
15833 | }
|
15834 |
|
15835 | function _templateObject2$h() {
|
15836 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\twidth: 100%;\n\talign-items: center;\n\tjustify-content: space-between;\n\tpadding: 12px 20px;\n\n\tbackground: ", ";\n\tborder-radius: ", ";\n\tcolor: white;\n\tcursor: ", ";\n"]);
|
15837 |
|
15838 | _templateObject2$h = function _templateObject2() {
|
15839 | return data;
|
15840 | };
|
15841 |
|
15842 | return data;
|
15843 | }
|
15844 |
|
15845 | function _templateObject$O() {
|
15846 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: inline-flex;\n\tmargin-right: 18px;\n\tmargin-left: auto;\n"]);
|
15847 |
|
15848 | _templateObject$O = function _templateObject() {
|
15849 | return data;
|
15850 | };
|
15851 |
|
15852 | return data;
|
15853 | }
|
15854 |
|
15855 | var Expandable = function Expandable(_ref) {
|
15856 | var title = _ref.title,
|
15857 | icon = _ref.icon,
|
15858 | tooltip = _ref.tooltip,
|
15859 | children = _ref.children,
|
15860 | open = _ref.open,
|
15861 | disabled = _ref.disabled,
|
15862 | onClick = _ref.onClick,
|
15863 | headerComponent = _ref.headerComponent,
|
15864 | props = objectWithoutPropertiesLoose(_ref, ["title", "icon", "tooltip", "children", "open", "disabled", "onClick", "headerComponent"]);
|
15865 |
|
15866 | var id = title.replace(/ /g, '-');
|
15867 | var color = disabled ? colors.gray : colors.yellow;
|
15868 | var text = disabled ? '' : tooltip;
|
15869 |
|
15870 | var handleOnClick = function handleOnClick(e) {
|
15871 | return disabled ? e.stopPropagation() : onClick();
|
15872 | };
|
15873 |
|
15874 | return React.createElement(Fragment, null, React.createElement(ExpandableHeader, _extends_1({
|
15875 | onClick: handleOnClick,
|
15876 | open: open,
|
15877 | disabled: disabled
|
15878 | }, props), React.createElement(Flex$1, null, React.createElement(Title$1, {
|
15879 | disabled: disabled
|
15880 | }, title), icon && React.createElement(HelpTooltip, {
|
15881 | id: id,
|
15882 | disabled: disabled,
|
15883 | icon: icon,
|
15884 | color: color,
|
15885 | text: text,
|
15886 | place: "bottom",
|
15887 | multiline: true
|
15888 | })), headerComponent && React.createElement(HeaderComponentContainer, {
|
15889 | onClick: function onClick(e) {
|
15890 | return e.stopPropagation();
|
15891 | }
|
15892 | }, headerComponent), React.createElement(IconAnimated, {
|
15893 | open: open,
|
15894 | icon: "select-down",
|
15895 | color: "#FFF",
|
15896 | disabled: disabled
|
15897 | })), React.createElement(ExpandableContent, {
|
15898 | open: open,
|
15899 | disabled: disabled
|
15900 | }, children));
|
15901 | };
|
15902 |
|
15903 | var HeaderComponentContainer = styled.div(_templateObject$O());
|
15904 | HeaderComponentContainer.displayName = 'HeaderComponentContainer';
|
15905 | var ExpandableHeader = styled.div(_templateObject2$h(), function (_ref2) {
|
15906 | var open = _ref2.open,
|
15907 | disabled = _ref2.disabled,
|
15908 | theme = _ref2.theme;
|
15909 | return disabled ? theme.colors.strokeGray : open ? theme.colors.deepBlue : theme.colors.activeBlue;
|
15910 | }, function (_ref3) {
|
15911 | var open = _ref3.open;
|
15912 | return open ? '4px 4px 0 0' : '4px';
|
15913 | }, function (_ref4) {
|
15914 | var disabled = _ref4.disabled;
|
15915 | return disabled ? 'not-allowed' : 'pointer';
|
15916 | });
|
15917 | ExpandableHeader.displayName = 'ExpandableHeader';
|
15918 | var Flex$1 = styled.div(_templateObject3$c());
|
15919 | var IconAnimated = styled(Icon$1)(_templateObject4$9(), function (_ref5) {
|
15920 | var disabled = _ref5.disabled,
|
15921 | theme = _ref5.theme;
|
15922 | return disabled ? theme.colors.gray : 'white';
|
15923 | }, function (_ref6) {
|
15924 | var open = _ref6.open;
|
15925 | return open && 'rotate(180deg)';
|
15926 | });
|
15927 | IconAnimated.displayName = 'IconAnimated';
|
15928 | var Title$1 = styled.div(_templateObject5$4(), function (_ref7) {
|
15929 | var disabled = _ref7.disabled,
|
15930 | theme = _ref7.theme;
|
15931 | return disabled ? theme.colors.gray : 'white';
|
15932 | });
|
15933 | var ExpandableContent = styled.div(_templateObject6$3(), function (_ref8) {
|
15934 | var open = _ref8.open;
|
15935 | return open ? 'block' : 'none';
|
15936 | }, function (_ref9) {
|
15937 | var disabled = _ref9.disabled,
|
15938 | theme = _ref9.theme;
|
15939 | return disabled ? theme.colors.strokeGray : theme.colors.deepBlue;
|
15940 | });
|
15941 | ExpandableContent.displayName = 'ExpandableContent';
|
15942 | Expandable.displayName = 'Expandable';
|
15943 | Expandable.defaultProps = {
|
15944 | icon: null,
|
15945 | tooltip: null,
|
15946 | disabled: false,
|
15947 | headerComponent: null
|
15948 | };
|
15949 | Expandable.propTypes = {
|
15950 | /** Title */
|
15951 | title: PropTypes.string.isRequired,
|
15952 |
|
15953 | /** Disabled flag */
|
15954 | disabled: PropTypes.bool,
|
15955 |
|
15956 | /** Warning icon name */
|
15957 | icon: PropTypes.string,
|
15958 |
|
15959 | /** Anything that can be rendered */
|
15960 | children: PropTypes.node.isRequired,
|
15961 |
|
15962 | /** Tooltip text message */
|
15963 | tooltip: PropTypes.string,
|
15964 |
|
15965 | /** If it is open prop */
|
15966 | open: PropTypes.bool.isRequired,
|
15967 |
|
15968 | /** Set onClick handler */
|
15969 | onClick: PropTypes.func.isRequired,
|
15970 |
|
15971 | /** Displayed component to the arrow's left side */
|
15972 | headerComponent: PropTypes.node
|
15973 | };
|
15974 |
|
15975 | var ExpandableSection = function ExpandableSection(_ref) {
|
15976 | var title = _ref.title,
|
15977 | icon = _ref.icon,
|
15978 | children = _ref.children,
|
15979 | tooltip = _ref.tooltip,
|
15980 | disabled = _ref.disabled,
|
15981 | props = objectWithoutPropertiesLoose(_ref, ["title", "icon", "children", "tooltip", "disabled"]);
|
15982 |
|
15983 | var _useState = useState(false),
|
15984 | open = _useState[0],
|
15985 | setOpen = _useState[1];
|
15986 |
|
15987 | return React.createElement(Expandable, _extends_1({
|
15988 | title: title,
|
15989 | icon: icon,
|
15990 | tooltip: tooltip,
|
15991 | onClick: function onClick() {
|
15992 | return setOpen(!open);
|
15993 | },
|
15994 | open: open,
|
15995 | disabled: disabled
|
15996 | }, props), children);
|
15997 | };
|
15998 |
|
15999 | ExpandableSection.displayName = 'ExpandableSection';
|
16000 | ExpandableSection.defaultProps = {
|
16001 | icon: null,
|
16002 | tooltip: null,
|
16003 | disabled: false,
|
16004 | headerComponent: null
|
16005 | };
|
16006 | ExpandableSection.propTypes = {
|
16007 | /** Title */
|
16008 | title: PropTypes.string.isRequired,
|
16009 |
|
16010 | /** Warning icon name */
|
16011 | icon: PropTypes.string,
|
16012 |
|
16013 | /** Anything that can be rendered */
|
16014 | children: PropTypes.node.isRequired,
|
16015 |
|
16016 | /** Tooltip text message */
|
16017 | tooltip: PropTypes.string,
|
16018 |
|
16019 | /** Disabled flag */
|
16020 | disabled: PropTypes.bool,
|
16021 |
|
16022 | /** Displayed component to the arrow's left side */
|
16023 | headerComponent: PropTypes.node
|
16024 | };
|
16025 |
|
16026 | var moment = createCommonjsModule(function (module, exports) {
|
16027 | (function (global, factory) {
|
16028 | module.exports = factory();
|
16029 | }(commonjsGlobal, (function () {
|
16030 | var hookCallback;
|
16031 |
|
16032 | function hooks () {
|
16033 | return hookCallback.apply(null, arguments);
|
16034 | }
|
16035 |
|
16036 | // This is done to register the method called with moment()
|
16037 | // without creating circular dependencies.
|
16038 | function setHookCallback (callback) {
|
16039 | hookCallback = callback;
|
16040 | }
|
16041 |
|
16042 | function isArray(input) {
|
16043 | return input instanceof Array || Object.prototype.toString.call(input) === '[object Array]';
|
16044 | }
|
16045 |
|
16046 | function isObject(input) {
|
16047 | // IE8 will treat undefined and null as object if it wasn't for
|
16048 | // input != null
|
16049 | return input != null && Object.prototype.toString.call(input) === '[object Object]';
|
16050 | }
|
16051 |
|
16052 | function isObjectEmpty(obj) {
|
16053 | if (Object.getOwnPropertyNames) {
|
16054 | return (Object.getOwnPropertyNames(obj).length === 0);
|
16055 | } else {
|
16056 | var k;
|
16057 | for (k in obj) {
|
16058 | if (obj.hasOwnProperty(k)) {
|
16059 | return false;
|
16060 | }
|
16061 | }
|
16062 | return true;
|
16063 | }
|
16064 | }
|
16065 |
|
16066 | function isUndefined(input) {
|
16067 | return input === void 0;
|
16068 | }
|
16069 |
|
16070 | function isNumber(input) {
|
16071 | return typeof input === 'number' || Object.prototype.toString.call(input) === '[object Number]';
|
16072 | }
|
16073 |
|
16074 | function isDate(input) {
|
16075 | return input instanceof Date || Object.prototype.toString.call(input) === '[object Date]';
|
16076 | }
|
16077 |
|
16078 | function map(arr, fn) {
|
16079 | var res = [], i;
|
16080 | for (i = 0; i < arr.length; ++i) {
|
16081 | res.push(fn(arr[i], i));
|
16082 | }
|
16083 | return res;
|
16084 | }
|
16085 |
|
16086 | function hasOwnProp(a, b) {
|
16087 | return Object.prototype.hasOwnProperty.call(a, b);
|
16088 | }
|
16089 |
|
16090 | function extend(a, b) {
|
16091 | for (var i in b) {
|
16092 | if (hasOwnProp(b, i)) {
|
16093 | a[i] = b[i];
|
16094 | }
|
16095 | }
|
16096 |
|
16097 | if (hasOwnProp(b, 'toString')) {
|
16098 | a.toString = b.toString;
|
16099 | }
|
16100 |
|
16101 | if (hasOwnProp(b, 'valueOf')) {
|
16102 | a.valueOf = b.valueOf;
|
16103 | }
|
16104 |
|
16105 | return a;
|
16106 | }
|
16107 |
|
16108 | function createUTC (input, format, locale, strict) {
|
16109 | return createLocalOrUTC(input, format, locale, strict, true).utc();
|
16110 | }
|
16111 |
|
16112 | function defaultParsingFlags() {
|
16113 | // We need to deep clone this object.
|
16114 | return {
|
16115 | empty : false,
|
16116 | unusedTokens : [],
|
16117 | unusedInput : [],
|
16118 | overflow : -2,
|
16119 | charsLeftOver : 0,
|
16120 | nullInput : false,
|
16121 | invalidMonth : null,
|
16122 | invalidFormat : false,
|
16123 | userInvalidated : false,
|
16124 | iso : false,
|
16125 | parsedDateParts : [],
|
16126 | meridiem : null,
|
16127 | rfc2822 : false,
|
16128 | weekdayMismatch : false
|
16129 | };
|
16130 | }
|
16131 |
|
16132 | function getParsingFlags(m) {
|
16133 | if (m._pf == null) {
|
16134 | m._pf = defaultParsingFlags();
|
16135 | }
|
16136 | return m._pf;
|
16137 | }
|
16138 |
|
16139 | var some;
|
16140 | if (Array.prototype.some) {
|
16141 | some = Array.prototype.some;
|
16142 | } else {
|
16143 | some = function (fun) {
|
16144 | var t = Object(this);
|
16145 | var len = t.length >>> 0;
|
16146 |
|
16147 | for (var i = 0; i < len; i++) {
|
16148 | if (i in t && fun.call(this, t[i], i, t)) {
|
16149 | return true;
|
16150 | }
|
16151 | }
|
16152 |
|
16153 | return false;
|
16154 | };
|
16155 | }
|
16156 |
|
16157 | function isValid(m) {
|
16158 | if (m._isValid == null) {
|
16159 | var flags = getParsingFlags(m);
|
16160 | var parsedParts = some.call(flags.parsedDateParts, function (i) {
|
16161 | return i != null;
|
16162 | });
|
16163 | var isNowValid = !isNaN(m._d.getTime()) &&
|
16164 | flags.overflow < 0 &&
|
16165 | !flags.empty &&
|
16166 | !flags.invalidMonth &&
|
16167 | !flags.invalidWeekday &&
|
16168 | !flags.weekdayMismatch &&
|
16169 | !flags.nullInput &&
|
16170 | !flags.invalidFormat &&
|
16171 | !flags.userInvalidated &&
|
16172 | (!flags.meridiem || (flags.meridiem && parsedParts));
|
16173 |
|
16174 | if (m._strict) {
|
16175 | isNowValid = isNowValid &&
|
16176 | flags.charsLeftOver === 0 &&
|
16177 | flags.unusedTokens.length === 0 &&
|
16178 | flags.bigHour === undefined;
|
16179 | }
|
16180 |
|
16181 | if (Object.isFrozen == null || !Object.isFrozen(m)) {
|
16182 | m._isValid = isNowValid;
|
16183 | }
|
16184 | else {
|
16185 | return isNowValid;
|
16186 | }
|
16187 | }
|
16188 | return m._isValid;
|
16189 | }
|
16190 |
|
16191 | function createInvalid (flags) {
|
16192 | var m = createUTC(NaN);
|
16193 | if (flags != null) {
|
16194 | extend(getParsingFlags(m), flags);
|
16195 | }
|
16196 | else {
|
16197 | getParsingFlags(m).userInvalidated = true;
|
16198 | }
|
16199 |
|
16200 | return m;
|
16201 | }
|
16202 |
|
16203 | // Plugins that add properties should also add the key here (null value),
|
16204 | // so we can properly clone ourselves.
|
16205 | var momentProperties = hooks.momentProperties = [];
|
16206 |
|
16207 | function copyConfig(to, from) {
|
16208 | var i, prop, val;
|
16209 |
|
16210 | if (!isUndefined(from._isAMomentObject)) {
|
16211 | to._isAMomentObject = from._isAMomentObject;
|
16212 | }
|
16213 | if (!isUndefined(from._i)) {
|
16214 | to._i = from._i;
|
16215 | }
|
16216 | if (!isUndefined(from._f)) {
|
16217 | to._f = from._f;
|
16218 | }
|
16219 | if (!isUndefined(from._l)) {
|
16220 | to._l = from._l;
|
16221 | }
|
16222 | if (!isUndefined(from._strict)) {
|
16223 | to._strict = from._strict;
|
16224 | }
|
16225 | if (!isUndefined(from._tzm)) {
|
16226 | to._tzm = from._tzm;
|
16227 | }
|
16228 | if (!isUndefined(from._isUTC)) {
|
16229 | to._isUTC = from._isUTC;
|
16230 | }
|
16231 | if (!isUndefined(from._offset)) {
|
16232 | to._offset = from._offset;
|
16233 | }
|
16234 | if (!isUndefined(from._pf)) {
|
16235 | to._pf = getParsingFlags(from);
|
16236 | }
|
16237 | if (!isUndefined(from._locale)) {
|
16238 | to._locale = from._locale;
|
16239 | }
|
16240 |
|
16241 | if (momentProperties.length > 0) {
|
16242 | for (i = 0; i < momentProperties.length; i++) {
|
16243 | prop = momentProperties[i];
|
16244 | val = from[prop];
|
16245 | if (!isUndefined(val)) {
|
16246 | to[prop] = val;
|
16247 | }
|
16248 | }
|
16249 | }
|
16250 |
|
16251 | return to;
|
16252 | }
|
16253 |
|
16254 | var updateInProgress = false;
|
16255 |
|
16256 | // Moment prototype object
|
16257 | function Moment(config) {
|
16258 | copyConfig(this, config);
|
16259 | this._d = new Date(config._d != null ? config._d.getTime() : NaN);
|
16260 | if (!this.isValid()) {
|
16261 | this._d = new Date(NaN);
|
16262 | }
|
16263 | // Prevent infinite loop in case updateOffset creates new moment
|
16264 | // objects.
|
16265 | if (updateInProgress === false) {
|
16266 | updateInProgress = true;
|
16267 | hooks.updateOffset(this);
|
16268 | updateInProgress = false;
|
16269 | }
|
16270 | }
|
16271 |
|
16272 | function isMoment (obj) {
|
16273 | return obj instanceof Moment || (obj != null && obj._isAMomentObject != null);
|
16274 | }
|
16275 |
|
16276 | function absFloor (number) {
|
16277 | if (number < 0) {
|
16278 | // -0 -> 0
|
16279 | return Math.ceil(number) || 0;
|
16280 | } else {
|
16281 | return Math.floor(number);
|
16282 | }
|
16283 | }
|
16284 |
|
16285 | function toInt(argumentForCoercion) {
|
16286 | var coercedNumber = +argumentForCoercion,
|
16287 | value = 0;
|
16288 |
|
16289 | if (coercedNumber !== 0 && isFinite(coercedNumber)) {
|
16290 | value = absFloor(coercedNumber);
|
16291 | }
|
16292 |
|
16293 | return value;
|
16294 | }
|
16295 |
|
16296 | // compare two arrays, return the number of differences
|
16297 | function compareArrays(array1, array2, dontConvert) {
|
16298 | var len = Math.min(array1.length, array2.length),
|
16299 | lengthDiff = Math.abs(array1.length - array2.length),
|
16300 | diffs = 0,
|
16301 | i;
|
16302 | for (i = 0; i < len; i++) {
|
16303 | if ((dontConvert && array1[i] !== array2[i]) ||
|
16304 | (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {
|
16305 | diffs++;
|
16306 | }
|
16307 | }
|
16308 | return diffs + lengthDiff;
|
16309 | }
|
16310 |
|
16311 | function warn(msg) {
|
16312 | if (hooks.suppressDeprecationWarnings === false &&
|
16313 | (typeof console !== 'undefined') && console.warn) {
|
16314 | console.warn('Deprecation warning: ' + msg);
|
16315 | }
|
16316 | }
|
16317 |
|
16318 | function deprecate(msg, fn) {
|
16319 | var firstTime = true;
|
16320 |
|
16321 | return extend(function () {
|
16322 | if (hooks.deprecationHandler != null) {
|
16323 | hooks.deprecationHandler(null, msg);
|
16324 | }
|
16325 | if (firstTime) {
|
16326 | var args = [];
|
16327 | var arg;
|
16328 | for (var i = 0; i < arguments.length; i++) {
|
16329 | arg = '';
|
16330 | if (typeof arguments[i] === 'object') {
|
16331 | arg += '\n[' + i + '] ';
|
16332 | for (var key in arguments[0]) {
|
16333 | arg += key + ': ' + arguments[0][key] + ', ';
|
16334 | }
|
16335 | arg = arg.slice(0, -2); // Remove trailing comma and space
|
16336 | } else {
|
16337 | arg = arguments[i];
|
16338 | }
|
16339 | args.push(arg);
|
16340 | }
|
16341 | warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + (new Error()).stack);
|
16342 | firstTime = false;
|
16343 | }
|
16344 | return fn.apply(this, arguments);
|
16345 | }, fn);
|
16346 | }
|
16347 |
|
16348 | var deprecations = {};
|
16349 |
|
16350 | function deprecateSimple(name, msg) {
|
16351 | if (hooks.deprecationHandler != null) {
|
16352 | hooks.deprecationHandler(name, msg);
|
16353 | }
|
16354 | if (!deprecations[name]) {
|
16355 | warn(msg);
|
16356 | deprecations[name] = true;
|
16357 | }
|
16358 | }
|
16359 |
|
16360 | hooks.suppressDeprecationWarnings = false;
|
16361 | hooks.deprecationHandler = null;
|
16362 |
|
16363 | function isFunction(input) {
|
16364 | return input instanceof Function || Object.prototype.toString.call(input) === '[object Function]';
|
16365 | }
|
16366 |
|
16367 | function set (config) {
|
16368 | var prop, i;
|
16369 | for (i in config) {
|
16370 | prop = config[i];
|
16371 | if (isFunction(prop)) {
|
16372 | this[i] = prop;
|
16373 | } else {
|
16374 | this['_' + i] = prop;
|
16375 | }
|
16376 | }
|
16377 | this._config = config;
|
16378 | // Lenient ordinal parsing accepts just a number in addition to
|
16379 | // number + (possibly) stuff coming from _dayOfMonthOrdinalParse.
|
16380 | // TODO: Remove "ordinalParse" fallback in next major release.
|
16381 | this._dayOfMonthOrdinalParseLenient = new RegExp(
|
16382 | (this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) +
|
16383 | '|' + (/\d{1,2}/).source);
|
16384 | }
|
16385 |
|
16386 | function mergeConfigs(parentConfig, childConfig) {
|
16387 | var res = extend({}, parentConfig), prop;
|
16388 | for (prop in childConfig) {
|
16389 | if (hasOwnProp(childConfig, prop)) {
|
16390 | if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) {
|
16391 | res[prop] = {};
|
16392 | extend(res[prop], parentConfig[prop]);
|
16393 | extend(res[prop], childConfig[prop]);
|
16394 | } else if (childConfig[prop] != null) {
|
16395 | res[prop] = childConfig[prop];
|
16396 | } else {
|
16397 | delete res[prop];
|
16398 | }
|
16399 | }
|
16400 | }
|
16401 | for (prop in parentConfig) {
|
16402 | if (hasOwnProp(parentConfig, prop) &&
|
16403 | !hasOwnProp(childConfig, prop) &&
|
16404 | isObject(parentConfig[prop])) {
|
16405 | // make sure changes to properties don't modify parent config
|
16406 | res[prop] = extend({}, res[prop]);
|
16407 | }
|
16408 | }
|
16409 | return res;
|
16410 | }
|
16411 |
|
16412 | function Locale(config) {
|
16413 | if (config != null) {
|
16414 | this.set(config);
|
16415 | }
|
16416 | }
|
16417 |
|
16418 | var keys;
|
16419 |
|
16420 | if (Object.keys) {
|
16421 | keys = Object.keys;
|
16422 | } else {
|
16423 | keys = function (obj) {
|
16424 | var i, res = [];
|
16425 | for (i in obj) {
|
16426 | if (hasOwnProp(obj, i)) {
|
16427 | res.push(i);
|
16428 | }
|
16429 | }
|
16430 | return res;
|
16431 | };
|
16432 | }
|
16433 |
|
16434 | var defaultCalendar = {
|
16435 | sameDay : '[Today at] LT',
|
16436 | nextDay : '[Tomorrow at] LT',
|
16437 | nextWeek : 'dddd [at] LT',
|
16438 | lastDay : '[Yesterday at] LT',
|
16439 | lastWeek : '[Last] dddd [at] LT',
|
16440 | sameElse : 'L'
|
16441 | };
|
16442 |
|
16443 | function calendar (key, mom, now) {
|
16444 | var output = this._calendar[key] || this._calendar['sameElse'];
|
16445 | return isFunction(output) ? output.call(mom, now) : output;
|
16446 | }
|
16447 |
|
16448 | var defaultLongDateFormat = {
|
16449 | LTS : 'h:mm:ss A',
|
16450 | LT : 'h:mm A',
|
16451 | L : 'MM/DD/YYYY',
|
16452 | LL : 'MMMM D, YYYY',
|
16453 | LLL : 'MMMM D, YYYY h:mm A',
|
16454 | LLLL : 'dddd, MMMM D, YYYY h:mm A'
|
16455 | };
|
16456 |
|
16457 | function longDateFormat (key) {
|
16458 | var format = this._longDateFormat[key],
|
16459 | formatUpper = this._longDateFormat[key.toUpperCase()];
|
16460 |
|
16461 | if (format || !formatUpper) {
|
16462 | return format;
|
16463 | }
|
16464 |
|
16465 | this._longDateFormat[key] = formatUpper.replace(/MMMM|MM|DD|dddd/g, function (val) {
|
16466 | return val.slice(1);
|
16467 | });
|
16468 |
|
16469 | return this._longDateFormat[key];
|
16470 | }
|
16471 |
|
16472 | var defaultInvalidDate = 'Invalid date';
|
16473 |
|
16474 | function invalidDate () {
|
16475 | return this._invalidDate;
|
16476 | }
|
16477 |
|
16478 | var defaultOrdinal = '%d';
|
16479 | var defaultDayOfMonthOrdinalParse = /\d{1,2}/;
|
16480 |
|
16481 | function ordinal (number) {
|
16482 | return this._ordinal.replace('%d', number);
|
16483 | }
|
16484 |
|
16485 | var defaultRelativeTime = {
|
16486 | future : 'in %s',
|
16487 | past : '%s ago',
|
16488 | s : 'a few seconds',
|
16489 | ss : '%d seconds',
|
16490 | m : 'a minute',
|
16491 | mm : '%d minutes',
|
16492 | h : 'an hour',
|
16493 | hh : '%d hours',
|
16494 | d : 'a day',
|
16495 | dd : '%d days',
|
16496 | M : 'a month',
|
16497 | MM : '%d months',
|
16498 | y : 'a year',
|
16499 | yy : '%d years'
|
16500 | };
|
16501 |
|
16502 | function relativeTime (number, withoutSuffix, string, isFuture) {
|
16503 | var output = this._relativeTime[string];
|
16504 | return (isFunction(output)) ?
|
16505 | output(number, withoutSuffix, string, isFuture) :
|
16506 | output.replace(/%d/i, number);
|
16507 | }
|
16508 |
|
16509 | function pastFuture (diff, output) {
|
16510 | var format = this._relativeTime[diff > 0 ? 'future' : 'past'];
|
16511 | return isFunction(format) ? format(output) : format.replace(/%s/i, output);
|
16512 | }
|
16513 |
|
16514 | var aliases = {};
|
16515 |
|
16516 | function addUnitAlias (unit, shorthand) {
|
16517 | var lowerCase = unit.toLowerCase();
|
16518 | aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit;
|
16519 | }
|
16520 |
|
16521 | function normalizeUnits(units) {
|
16522 | return typeof units === 'string' ? aliases[units] || aliases[units.toLowerCase()] : undefined;
|
16523 | }
|
16524 |
|
16525 | function normalizeObjectUnits(inputObject) {
|
16526 | var normalizedInput = {},
|
16527 | normalizedProp,
|
16528 | prop;
|
16529 |
|
16530 | for (prop in inputObject) {
|
16531 | if (hasOwnProp(inputObject, prop)) {
|
16532 | normalizedProp = normalizeUnits(prop);
|
16533 | if (normalizedProp) {
|
16534 | normalizedInput[normalizedProp] = inputObject[prop];
|
16535 | }
|
16536 | }
|
16537 | }
|
16538 |
|
16539 | return normalizedInput;
|
16540 | }
|
16541 |
|
16542 | var priorities = {};
|
16543 |
|
16544 | function addUnitPriority(unit, priority) {
|
16545 | priorities[unit] = priority;
|
16546 | }
|
16547 |
|
16548 | function getPrioritizedUnits(unitsObj) {
|
16549 | var units = [];
|
16550 | for (var u in unitsObj) {
|
16551 | units.push({unit: u, priority: priorities[u]});
|
16552 | }
|
16553 | units.sort(function (a, b) {
|
16554 | return a.priority - b.priority;
|
16555 | });
|
16556 | return units;
|
16557 | }
|
16558 |
|
16559 | function zeroFill(number, targetLength, forceSign) {
|
16560 | var absNumber = '' + Math.abs(number),
|
16561 | zerosToFill = targetLength - absNumber.length,
|
16562 | sign = number >= 0;
|
16563 | return (sign ? (forceSign ? '+' : '') : '-') +
|
16564 | Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber;
|
16565 | }
|
16566 |
|
16567 | var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g;
|
16568 |
|
16569 | var localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g;
|
16570 |
|
16571 | var formatFunctions = {};
|
16572 |
|
16573 | var formatTokenFunctions = {};
|
16574 |
|
16575 | // token: 'M'
|
16576 | // padded: ['MM', 2]
|
16577 | // ordinal: 'Mo'
|
16578 | // callback: function () { this.month() + 1 }
|
16579 | function addFormatToken (token, padded, ordinal, callback) {
|
16580 | var func = callback;
|
16581 | if (typeof callback === 'string') {
|
16582 | func = function () {
|
16583 | return this[callback]();
|
16584 | };
|
16585 | }
|
16586 | if (token) {
|
16587 | formatTokenFunctions[token] = func;
|
16588 | }
|
16589 | if (padded) {
|
16590 | formatTokenFunctions[padded[0]] = function () {
|
16591 | return zeroFill(func.apply(this, arguments), padded[1], padded[2]);
|
16592 | };
|
16593 | }
|
16594 | if (ordinal) {
|
16595 | formatTokenFunctions[ordinal] = function () {
|
16596 | return this.localeData().ordinal(func.apply(this, arguments), token);
|
16597 | };
|
16598 | }
|
16599 | }
|
16600 |
|
16601 | function removeFormattingTokens(input) {
|
16602 | if (input.match(/\[[\s\S]/)) {
|
16603 | return input.replace(/^\[|\]$/g, '');
|
16604 | }
|
16605 | return input.replace(/\\/g, '');
|
16606 | }
|
16607 |
|
16608 | function makeFormatFunction(format) {
|
16609 | var array = format.match(formattingTokens), i, length;
|
16610 |
|
16611 | for (i = 0, length = array.length; i < length; i++) {
|
16612 | if (formatTokenFunctions[array[i]]) {
|
16613 | array[i] = formatTokenFunctions[array[i]];
|
16614 | } else {
|
16615 | array[i] = removeFormattingTokens(array[i]);
|
16616 | }
|
16617 | }
|
16618 |
|
16619 | return function (mom) {
|
16620 | var output = '', i;
|
16621 | for (i = 0; i < length; i++) {
|
16622 | output += isFunction(array[i]) ? array[i].call(mom, format) : array[i];
|
16623 | }
|
16624 | return output;
|
16625 | };
|
16626 | }
|
16627 |
|
16628 | // format date using native date object
|
16629 | function formatMoment(m, format) {
|
16630 | if (!m.isValid()) {
|
16631 | return m.localeData().invalidDate();
|
16632 | }
|
16633 |
|
16634 | format = expandFormat(format, m.localeData());
|
16635 | formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format);
|
16636 |
|
16637 | return formatFunctions[format](m);
|
16638 | }
|
16639 |
|
16640 | function expandFormat(format, locale) {
|
16641 | var i = 5;
|
16642 |
|
16643 | function replaceLongDateFormatTokens(input) {
|
16644 | return locale.longDateFormat(input) || input;
|
16645 | }
|
16646 |
|
16647 | localFormattingTokens.lastIndex = 0;
|
16648 | while (i >= 0 && localFormattingTokens.test(format)) {
|
16649 | format = format.replace(localFormattingTokens, replaceLongDateFormatTokens);
|
16650 | localFormattingTokens.lastIndex = 0;
|
16651 | i -= 1;
|
16652 | }
|
16653 |
|
16654 | return format;
|
16655 | }
|
16656 |
|
16657 | var match1 = /\d/; // 0 - 9
|
16658 | var match2 = /\d\d/; // 00 - 99
|
16659 | var match3 = /\d{3}/; // 000 - 999
|
16660 | var match4 = /\d{4}/; // 0000 - 9999
|
16661 | var match6 = /[+-]?\d{6}/; // -999999 - 999999
|
16662 | var match1to2 = /\d\d?/; // 0 - 99
|
16663 | var match3to4 = /\d\d\d\d?/; // 999 - 9999
|
16664 | var match5to6 = /\d\d\d\d\d\d?/; // 99999 - 999999
|
16665 | var match1to3 = /\d{1,3}/; // 0 - 999
|
16666 | var match1to4 = /\d{1,4}/; // 0 - 9999
|
16667 | var match1to6 = /[+-]?\d{1,6}/; // -999999 - 999999
|
16668 |
|
16669 | var matchUnsigned = /\d+/; // 0 - inf
|
16670 | var matchSigned = /[+-]?\d+/; // -inf - inf
|
16671 |
|
16672 | var matchOffset = /Z|[+-]\d\d:?\d\d/gi; // +00:00 -00:00 +0000 -0000 or Z
|
16673 | var matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi; // +00 -00 +00:00 -00:00 +0000 -0000 or Z
|
16674 |
|
16675 | var matchTimestamp = /[+-]?\d+(\.\d{1,3})?/; // 123456789 123456789.123
|
16676 |
|
16677 | // any word (or two) characters or numbers including two/three word month in arabic.
|
16678 | // includes scottish gaelic two word and hyphenated months
|
16679 | var matchWord = /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i;
|
16680 |
|
16681 | var regexes = {};
|
16682 |
|
16683 | function addRegexToken (token, regex, strictRegex) {
|
16684 | regexes[token] = isFunction(regex) ? regex : function (isStrict, localeData) {
|
16685 | return (isStrict && strictRegex) ? strictRegex : regex;
|
16686 | };
|
16687 | }
|
16688 |
|
16689 | function getParseRegexForToken (token, config) {
|
16690 | if (!hasOwnProp(regexes, token)) {
|
16691 | return new RegExp(unescapeFormat(token));
|
16692 | }
|
16693 |
|
16694 | return regexes[token](config._strict, config._locale);
|
16695 | }
|
16696 |
|
16697 | // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript
|
16698 | function unescapeFormat(s) {
|
16699 | return regexEscape(s.replace('\\', '').replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (matched, p1, p2, p3, p4) {
|
16700 | return p1 || p2 || p3 || p4;
|
16701 | }));
|
16702 | }
|
16703 |
|
16704 | function regexEscape(s) {
|
16705 | return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
|
16706 | }
|
16707 |
|
16708 | var tokens = {};
|
16709 |
|
16710 | function addParseToken (token, callback) {
|
16711 | var i, func = callback;
|
16712 | if (typeof token === 'string') {
|
16713 | token = [token];
|
16714 | }
|
16715 | if (isNumber(callback)) {
|
16716 | func = function (input, array) {
|
16717 | array[callback] = toInt(input);
|
16718 | };
|
16719 | }
|
16720 | for (i = 0; i < token.length; i++) {
|
16721 | tokens[token[i]] = func;
|
16722 | }
|
16723 | }
|
16724 |
|
16725 | function addWeekParseToken (token, callback) {
|
16726 | addParseToken(token, function (input, array, config, token) {
|
16727 | config._w = config._w || {};
|
16728 | callback(input, config._w, config, token);
|
16729 | });
|
16730 | }
|
16731 |
|
16732 | function addTimeToArrayFromToken(token, input, config) {
|
16733 | if (input != null && hasOwnProp(tokens, token)) {
|
16734 | tokens[token](input, config._a, config, token);
|
16735 | }
|
16736 | }
|
16737 |
|
16738 | var YEAR = 0;
|
16739 | var MONTH = 1;
|
16740 | var DATE = 2;
|
16741 | var HOUR = 3;
|
16742 | var MINUTE = 4;
|
16743 | var SECOND = 5;
|
16744 | var MILLISECOND = 6;
|
16745 | var WEEK = 7;
|
16746 | var WEEKDAY = 8;
|
16747 |
|
16748 | // FORMATTING
|
16749 |
|
16750 | addFormatToken('Y', 0, 0, function () {
|
16751 | var y = this.year();
|
16752 | return y <= 9999 ? '' + y : '+' + y;
|
16753 | });
|
16754 |
|
16755 | addFormatToken(0, ['YY', 2], 0, function () {
|
16756 | return this.year() % 100;
|
16757 | });
|
16758 |
|
16759 | addFormatToken(0, ['YYYY', 4], 0, 'year');
|
16760 | addFormatToken(0, ['YYYYY', 5], 0, 'year');
|
16761 | addFormatToken(0, ['YYYYYY', 6, true], 0, 'year');
|
16762 |
|
16763 | // ALIASES
|
16764 |
|
16765 | addUnitAlias('year', 'y');
|
16766 |
|
16767 | // PRIORITIES
|
16768 |
|
16769 | addUnitPriority('year', 1);
|
16770 |
|
16771 | // PARSING
|
16772 |
|
16773 | addRegexToken('Y', matchSigned);
|
16774 | addRegexToken('YY', match1to2, match2);
|
16775 | addRegexToken('YYYY', match1to4, match4);
|
16776 | addRegexToken('YYYYY', match1to6, match6);
|
16777 | addRegexToken('YYYYYY', match1to6, match6);
|
16778 |
|
16779 | addParseToken(['YYYYY', 'YYYYYY'], YEAR);
|
16780 | addParseToken('YYYY', function (input, array) {
|
16781 | array[YEAR] = input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input);
|
16782 | });
|
16783 | addParseToken('YY', function (input, array) {
|
16784 | array[YEAR] = hooks.parseTwoDigitYear(input);
|
16785 | });
|
16786 | addParseToken('Y', function (input, array) {
|
16787 | array[YEAR] = parseInt(input, 10);
|
16788 | });
|
16789 |
|
16790 | // HELPERS
|
16791 |
|
16792 | function daysInYear(year) {
|
16793 | return isLeapYear(year) ? 366 : 365;
|
16794 | }
|
16795 |
|
16796 | function isLeapYear(year) {
|
16797 | return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
|
16798 | }
|
16799 |
|
16800 | // HOOKS
|
16801 |
|
16802 | hooks.parseTwoDigitYear = function (input) {
|
16803 | return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);
|
16804 | };
|
16805 |
|
16806 | // MOMENTS
|
16807 |
|
16808 | var getSetYear = makeGetSet('FullYear', true);
|
16809 |
|
16810 | function getIsLeapYear () {
|
16811 | return isLeapYear(this.year());
|
16812 | }
|
16813 |
|
16814 | function makeGetSet (unit, keepTime) {
|
16815 | return function (value) {
|
16816 | if (value != null) {
|
16817 | set$1(this, unit, value);
|
16818 | hooks.updateOffset(this, keepTime);
|
16819 | return this;
|
16820 | } else {
|
16821 | return get(this, unit);
|
16822 | }
|
16823 | };
|
16824 | }
|
16825 |
|
16826 | function get (mom, unit) {
|
16827 | return mom.isValid() ?
|
16828 | mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]() : NaN;
|
16829 | }
|
16830 |
|
16831 | function set$1 (mom, unit, value) {
|
16832 | if (mom.isValid() && !isNaN(value)) {
|
16833 | if (unit === 'FullYear' && isLeapYear(mom.year()) && mom.month() === 1 && mom.date() === 29) {
|
16834 | mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value, mom.month(), daysInMonth(value, mom.month()));
|
16835 | }
|
16836 | else {
|
16837 | mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value);
|
16838 | }
|
16839 | }
|
16840 | }
|
16841 |
|
16842 | // MOMENTS
|
16843 |
|
16844 | function stringGet (units) {
|
16845 | units = normalizeUnits(units);
|
16846 | if (isFunction(this[units])) {
|
16847 | return this[units]();
|
16848 | }
|
16849 | return this;
|
16850 | }
|
16851 |
|
16852 |
|
16853 | function stringSet (units, value) {
|
16854 | if (typeof units === 'object') {
|
16855 | units = normalizeObjectUnits(units);
|
16856 | var prioritized = getPrioritizedUnits(units);
|
16857 | for (var i = 0; i < prioritized.length; i++) {
|
16858 | this[prioritized[i].unit](units[prioritized[i].unit]);
|
16859 | }
|
16860 | } else {
|
16861 | units = normalizeUnits(units);
|
16862 | if (isFunction(this[units])) {
|
16863 | return this[units](value);
|
16864 | }
|
16865 | }
|
16866 | return this;
|
16867 | }
|
16868 |
|
16869 | function mod(n, x) {
|
16870 | return ((n % x) + x) % x;
|
16871 | }
|
16872 |
|
16873 | var indexOf;
|
16874 |
|
16875 | if (Array.prototype.indexOf) {
|
16876 | indexOf = Array.prototype.indexOf;
|
16877 | } else {
|
16878 | indexOf = function (o) {
|
16879 | // I know
|
16880 | var i;
|
16881 | for (i = 0; i < this.length; ++i) {
|
16882 | if (this[i] === o) {
|
16883 | return i;
|
16884 | }
|
16885 | }
|
16886 | return -1;
|
16887 | };
|
16888 | }
|
16889 |
|
16890 | function daysInMonth(year, month) {
|
16891 | if (isNaN(year) || isNaN(month)) {
|
16892 | return NaN;
|
16893 | }
|
16894 | var modMonth = mod(month, 12);
|
16895 | year += (month - modMonth) / 12;
|
16896 | return modMonth === 1 ? (isLeapYear(year) ? 29 : 28) : (31 - modMonth % 7 % 2);
|
16897 | }
|
16898 |
|
16899 | // FORMATTING
|
16900 |
|
16901 | addFormatToken('M', ['MM', 2], 'Mo', function () {
|
16902 | return this.month() + 1;
|
16903 | });
|
16904 |
|
16905 | addFormatToken('MMM', 0, 0, function (format) {
|
16906 | return this.localeData().monthsShort(this, format);
|
16907 | });
|
16908 |
|
16909 | addFormatToken('MMMM', 0, 0, function (format) {
|
16910 | return this.localeData().months(this, format);
|
16911 | });
|
16912 |
|
16913 | // ALIASES
|
16914 |
|
16915 | addUnitAlias('month', 'M');
|
16916 |
|
16917 | // PRIORITY
|
16918 |
|
16919 | addUnitPriority('month', 8);
|
16920 |
|
16921 | // PARSING
|
16922 |
|
16923 | addRegexToken('M', match1to2);
|
16924 | addRegexToken('MM', match1to2, match2);
|
16925 | addRegexToken('MMM', function (isStrict, locale) {
|
16926 | return locale.monthsShortRegex(isStrict);
|
16927 | });
|
16928 | addRegexToken('MMMM', function (isStrict, locale) {
|
16929 | return locale.monthsRegex(isStrict);
|
16930 | });
|
16931 |
|
16932 | addParseToken(['M', 'MM'], function (input, array) {
|
16933 | array[MONTH] = toInt(input) - 1;
|
16934 | });
|
16935 |
|
16936 | addParseToken(['MMM', 'MMMM'], function (input, array, config, token) {
|
16937 | var month = config._locale.monthsParse(input, token, config._strict);
|
16938 | // if we didn't find a month name, mark the date as invalid.
|
16939 | if (month != null) {
|
16940 | array[MONTH] = month;
|
16941 | } else {
|
16942 | getParsingFlags(config).invalidMonth = input;
|
16943 | }
|
16944 | });
|
16945 |
|
16946 | // LOCALES
|
16947 |
|
16948 | var MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/;
|
16949 | var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_');
|
16950 | function localeMonths (m, format) {
|
16951 | if (!m) {
|
16952 | return isArray(this._months) ? this._months :
|
16953 | this._months['standalone'];
|
16954 | }
|
16955 | return isArray(this._months) ? this._months[m.month()] :
|
16956 | this._months[(this._months.isFormat || MONTHS_IN_FORMAT).test(format) ? 'format' : 'standalone'][m.month()];
|
16957 | }
|
16958 |
|
16959 | var defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_');
|
16960 | function localeMonthsShort (m, format) {
|
16961 | if (!m) {
|
16962 | return isArray(this._monthsShort) ? this._monthsShort :
|
16963 | this._monthsShort['standalone'];
|
16964 | }
|
16965 | return isArray(this._monthsShort) ? this._monthsShort[m.month()] :
|
16966 | this._monthsShort[MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'][m.month()];
|
16967 | }
|
16968 |
|
16969 | function handleStrictParse(monthName, format, strict) {
|
16970 | var i, ii, mom, llc = monthName.toLocaleLowerCase();
|
16971 | if (!this._monthsParse) {
|
16972 | // this is not used
|
16973 | this._monthsParse = [];
|
16974 | this._longMonthsParse = [];
|
16975 | this._shortMonthsParse = [];
|
16976 | for (i = 0; i < 12; ++i) {
|
16977 | mom = createUTC([2000, i]);
|
16978 | this._shortMonthsParse[i] = this.monthsShort(mom, '').toLocaleLowerCase();
|
16979 | this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase();
|
16980 | }
|
16981 | }
|
16982 |
|
16983 | if (strict) {
|
16984 | if (format === 'MMM') {
|
16985 | ii = indexOf.call(this._shortMonthsParse, llc);
|
16986 | return ii !== -1 ? ii : null;
|
16987 | } else {
|
16988 | ii = indexOf.call(this._longMonthsParse, llc);
|
16989 | return ii !== -1 ? ii : null;
|
16990 | }
|
16991 | } else {
|
16992 | if (format === 'MMM') {
|
16993 | ii = indexOf.call(this._shortMonthsParse, llc);
|
16994 | if (ii !== -1) {
|
16995 | return ii;
|
16996 | }
|
16997 | ii = indexOf.call(this._longMonthsParse, llc);
|
16998 | return ii !== -1 ? ii : null;
|
16999 | } else {
|
17000 | ii = indexOf.call(this._longMonthsParse, llc);
|
17001 | if (ii !== -1) {
|
17002 | return ii;
|
17003 | }
|
17004 | ii = indexOf.call(this._shortMonthsParse, llc);
|
17005 | return ii !== -1 ? ii : null;
|
17006 | }
|
17007 | }
|
17008 | }
|
17009 |
|
17010 | function localeMonthsParse (monthName, format, strict) {
|
17011 | var i, mom, regex;
|
17012 |
|
17013 | if (this._monthsParseExact) {
|
17014 | return handleStrictParse.call(this, monthName, format, strict);
|
17015 | }
|
17016 |
|
17017 | if (!this._monthsParse) {
|
17018 | this._monthsParse = [];
|
17019 | this._longMonthsParse = [];
|
17020 | this._shortMonthsParse = [];
|
17021 | }
|
17022 |
|
17023 | // TODO: add sorting
|
17024 | // Sorting makes sure if one month (or abbr) is a prefix of another
|
17025 | // see sorting in computeMonthsParse
|
17026 | for (i = 0; i < 12; i++) {
|
17027 | // make the regex if we don't have it already
|
17028 | mom = createUTC([2000, i]);
|
17029 | if (strict && !this._longMonthsParse[i]) {
|
17030 | this._longMonthsParse[i] = new RegExp('^' + this.months(mom, '').replace('.', '') + '$', 'i');
|
17031 | this._shortMonthsParse[i] = new RegExp('^' + this.monthsShort(mom, '').replace('.', '') + '$', 'i');
|
17032 | }
|
17033 | if (!strict && !this._monthsParse[i]) {
|
17034 | regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, '');
|
17035 | this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i');
|
17036 | }
|
17037 | // test the regex
|
17038 | if (strict && format === 'MMMM' && this._longMonthsParse[i].test(monthName)) {
|
17039 | return i;
|
17040 | } else if (strict && format === 'MMM' && this._shortMonthsParse[i].test(monthName)) {
|
17041 | return i;
|
17042 | } else if (!strict && this._monthsParse[i].test(monthName)) {
|
17043 | return i;
|
17044 | }
|
17045 | }
|
17046 | }
|
17047 |
|
17048 | // MOMENTS
|
17049 |
|
17050 | function setMonth (mom, value) {
|
17051 | var dayOfMonth;
|
17052 |
|
17053 | if (!mom.isValid()) {
|
17054 | // No op
|
17055 | return mom;
|
17056 | }
|
17057 |
|
17058 | if (typeof value === 'string') {
|
17059 | if (/^\d+$/.test(value)) {
|
17060 | value = toInt(value);
|
17061 | } else {
|
17062 | value = mom.localeData().monthsParse(value);
|
17063 | // TODO: Another silent failure?
|
17064 | if (!isNumber(value)) {
|
17065 | return mom;
|
17066 | }
|
17067 | }
|
17068 | }
|
17069 |
|
17070 | dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value));
|
17071 | mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth);
|
17072 | return mom;
|
17073 | }
|
17074 |
|
17075 | function getSetMonth (value) {
|
17076 | if (value != null) {
|
17077 | setMonth(this, value);
|
17078 | hooks.updateOffset(this, true);
|
17079 | return this;
|
17080 | } else {
|
17081 | return get(this, 'Month');
|
17082 | }
|
17083 | }
|
17084 |
|
17085 | function getDaysInMonth () {
|
17086 | return daysInMonth(this.year(), this.month());
|
17087 | }
|
17088 |
|
17089 | var defaultMonthsShortRegex = matchWord;
|
17090 | function monthsShortRegex (isStrict) {
|
17091 | if (this._monthsParseExact) {
|
17092 | if (!hasOwnProp(this, '_monthsRegex')) {
|
17093 | computeMonthsParse.call(this);
|
17094 | }
|
17095 | if (isStrict) {
|
17096 | return this._monthsShortStrictRegex;
|
17097 | } else {
|
17098 | return this._monthsShortRegex;
|
17099 | }
|
17100 | } else {
|
17101 | if (!hasOwnProp(this, '_monthsShortRegex')) {
|
17102 | this._monthsShortRegex = defaultMonthsShortRegex;
|
17103 | }
|
17104 | return this._monthsShortStrictRegex && isStrict ?
|
17105 | this._monthsShortStrictRegex : this._monthsShortRegex;
|
17106 | }
|
17107 | }
|
17108 |
|
17109 | var defaultMonthsRegex = matchWord;
|
17110 | function monthsRegex (isStrict) {
|
17111 | if (this._monthsParseExact) {
|
17112 | if (!hasOwnProp(this, '_monthsRegex')) {
|
17113 | computeMonthsParse.call(this);
|
17114 | }
|
17115 | if (isStrict) {
|
17116 | return this._monthsStrictRegex;
|
17117 | } else {
|
17118 | return this._monthsRegex;
|
17119 | }
|
17120 | } else {
|
17121 | if (!hasOwnProp(this, '_monthsRegex')) {
|
17122 | this._monthsRegex = defaultMonthsRegex;
|
17123 | }
|
17124 | return this._monthsStrictRegex && isStrict ?
|
17125 | this._monthsStrictRegex : this._monthsRegex;
|
17126 | }
|
17127 | }
|
17128 |
|
17129 | function computeMonthsParse () {
|
17130 | function cmpLenRev(a, b) {
|
17131 | return b.length - a.length;
|
17132 | }
|
17133 |
|
17134 | var shortPieces = [], longPieces = [], mixedPieces = [],
|
17135 | i, mom;
|
17136 | for (i = 0; i < 12; i++) {
|
17137 | // make the regex if we don't have it already
|
17138 | mom = createUTC([2000, i]);
|
17139 | shortPieces.push(this.monthsShort(mom, ''));
|
17140 | longPieces.push(this.months(mom, ''));
|
17141 | mixedPieces.push(this.months(mom, ''));
|
17142 | mixedPieces.push(this.monthsShort(mom, ''));
|
17143 | }
|
17144 | // Sorting makes sure if one month (or abbr) is a prefix of another it
|
17145 | // will match the longer piece.
|
17146 | shortPieces.sort(cmpLenRev);
|
17147 | longPieces.sort(cmpLenRev);
|
17148 | mixedPieces.sort(cmpLenRev);
|
17149 | for (i = 0; i < 12; i++) {
|
17150 | shortPieces[i] = regexEscape(shortPieces[i]);
|
17151 | longPieces[i] = regexEscape(longPieces[i]);
|
17152 | }
|
17153 | for (i = 0; i < 24; i++) {
|
17154 | mixedPieces[i] = regexEscape(mixedPieces[i]);
|
17155 | }
|
17156 |
|
17157 | this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
|
17158 | this._monthsShortRegex = this._monthsRegex;
|
17159 | this._monthsStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i');
|
17160 | this._monthsShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i');
|
17161 | }
|
17162 |
|
17163 | function createDate (y, m, d, h, M, s, ms) {
|
17164 | // can't just apply() to create a date:
|
17165 | // https://stackoverflow.com/q/181348
|
17166 | var date;
|
17167 | // the date constructor remaps years 0-99 to 1900-1999
|
17168 | if (y < 100 && y >= 0) {
|
17169 | // preserve leap years using a full 400 year cycle, then reset
|
17170 | date = new Date(y + 400, m, d, h, M, s, ms);
|
17171 | if (isFinite(date.getFullYear())) {
|
17172 | date.setFullYear(y);
|
17173 | }
|
17174 | } else {
|
17175 | date = new Date(y, m, d, h, M, s, ms);
|
17176 | }
|
17177 |
|
17178 | return date;
|
17179 | }
|
17180 |
|
17181 | function createUTCDate (y) {
|
17182 | var date;
|
17183 | // the Date.UTC function remaps years 0-99 to 1900-1999
|
17184 | if (y < 100 && y >= 0) {
|
17185 | var args = Array.prototype.slice.call(arguments);
|
17186 | // preserve leap years using a full 400 year cycle, then reset
|
17187 | args[0] = y + 400;
|
17188 | date = new Date(Date.UTC.apply(null, args));
|
17189 | if (isFinite(date.getUTCFullYear())) {
|
17190 | date.setUTCFullYear(y);
|
17191 | }
|
17192 | } else {
|
17193 | date = new Date(Date.UTC.apply(null, arguments));
|
17194 | }
|
17195 |
|
17196 | return date;
|
17197 | }
|
17198 |
|
17199 | // start-of-first-week - start-of-year
|
17200 | function firstWeekOffset(year, dow, doy) {
|
17201 | var // first-week day -- which january is always in the first week (4 for iso, 1 for other)
|
17202 | fwd = 7 + dow - doy,
|
17203 | // first-week day local weekday -- which local weekday is fwd
|
17204 | fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7;
|
17205 |
|
17206 | return -fwdlw + fwd - 1;
|
17207 | }
|
17208 |
|
17209 | // https://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday
|
17210 | function dayOfYearFromWeeks(year, week, weekday, dow, doy) {
|
17211 | var localWeekday = (7 + weekday - dow) % 7,
|
17212 | weekOffset = firstWeekOffset(year, dow, doy),
|
17213 | dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset,
|
17214 | resYear, resDayOfYear;
|
17215 |
|
17216 | if (dayOfYear <= 0) {
|
17217 | resYear = year - 1;
|
17218 | resDayOfYear = daysInYear(resYear) + dayOfYear;
|
17219 | } else if (dayOfYear > daysInYear(year)) {
|
17220 | resYear = year + 1;
|
17221 | resDayOfYear = dayOfYear - daysInYear(year);
|
17222 | } else {
|
17223 | resYear = year;
|
17224 | resDayOfYear = dayOfYear;
|
17225 | }
|
17226 |
|
17227 | return {
|
17228 | year: resYear,
|
17229 | dayOfYear: resDayOfYear
|
17230 | };
|
17231 | }
|
17232 |
|
17233 | function weekOfYear(mom, dow, doy) {
|
17234 | var weekOffset = firstWeekOffset(mom.year(), dow, doy),
|
17235 | week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1,
|
17236 | resWeek, resYear;
|
17237 |
|
17238 | if (week < 1) {
|
17239 | resYear = mom.year() - 1;
|
17240 | resWeek = week + weeksInYear(resYear, dow, doy);
|
17241 | } else if (week > weeksInYear(mom.year(), dow, doy)) {
|
17242 | resWeek = week - weeksInYear(mom.year(), dow, doy);
|
17243 | resYear = mom.year() + 1;
|
17244 | } else {
|
17245 | resYear = mom.year();
|
17246 | resWeek = week;
|
17247 | }
|
17248 |
|
17249 | return {
|
17250 | week: resWeek,
|
17251 | year: resYear
|
17252 | };
|
17253 | }
|
17254 |
|
17255 | function weeksInYear(year, dow, doy) {
|
17256 | var weekOffset = firstWeekOffset(year, dow, doy),
|
17257 | weekOffsetNext = firstWeekOffset(year + 1, dow, doy);
|
17258 | return (daysInYear(year) - weekOffset + weekOffsetNext) / 7;
|
17259 | }
|
17260 |
|
17261 | // FORMATTING
|
17262 |
|
17263 | addFormatToken('w', ['ww', 2], 'wo', 'week');
|
17264 | addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek');
|
17265 |
|
17266 | // ALIASES
|
17267 |
|
17268 | addUnitAlias('week', 'w');
|
17269 | addUnitAlias('isoWeek', 'W');
|
17270 |
|
17271 | // PRIORITIES
|
17272 |
|
17273 | addUnitPriority('week', 5);
|
17274 | addUnitPriority('isoWeek', 5);
|
17275 |
|
17276 | // PARSING
|
17277 |
|
17278 | addRegexToken('w', match1to2);
|
17279 | addRegexToken('ww', match1to2, match2);
|
17280 | addRegexToken('W', match1to2);
|
17281 | addRegexToken('WW', match1to2, match2);
|
17282 |
|
17283 | addWeekParseToken(['w', 'ww', 'W', 'WW'], function (input, week, config, token) {
|
17284 | week[token.substr(0, 1)] = toInt(input);
|
17285 | });
|
17286 |
|
17287 | // HELPERS
|
17288 |
|
17289 | // LOCALES
|
17290 |
|
17291 | function localeWeek (mom) {
|
17292 | return weekOfYear(mom, this._week.dow, this._week.doy).week;
|
17293 | }
|
17294 |
|
17295 | var defaultLocaleWeek = {
|
17296 | dow : 0, // Sunday is the first day of the week.
|
17297 | doy : 6 // The week that contains Jan 6th is the first week of the year.
|
17298 | };
|
17299 |
|
17300 | function localeFirstDayOfWeek () {
|
17301 | return this._week.dow;
|
17302 | }
|
17303 |
|
17304 | function localeFirstDayOfYear () {
|
17305 | return this._week.doy;
|
17306 | }
|
17307 |
|
17308 | // MOMENTS
|
17309 |
|
17310 | function getSetWeek (input) {
|
17311 | var week = this.localeData().week(this);
|
17312 | return input == null ? week : this.add((input - week) * 7, 'd');
|
17313 | }
|
17314 |
|
17315 | function getSetISOWeek (input) {
|
17316 | var week = weekOfYear(this, 1, 4).week;
|
17317 | return input == null ? week : this.add((input - week) * 7, 'd');
|
17318 | }
|
17319 |
|
17320 | // FORMATTING
|
17321 |
|
17322 | addFormatToken('d', 0, 'do', 'day');
|
17323 |
|
17324 | addFormatToken('dd', 0, 0, function (format) {
|
17325 | return this.localeData().weekdaysMin(this, format);
|
17326 | });
|
17327 |
|
17328 | addFormatToken('ddd', 0, 0, function (format) {
|
17329 | return this.localeData().weekdaysShort(this, format);
|
17330 | });
|
17331 |
|
17332 | addFormatToken('dddd', 0, 0, function (format) {
|
17333 | return this.localeData().weekdays(this, format);
|
17334 | });
|
17335 |
|
17336 | addFormatToken('e', 0, 0, 'weekday');
|
17337 | addFormatToken('E', 0, 0, 'isoWeekday');
|
17338 |
|
17339 | // ALIASES
|
17340 |
|
17341 | addUnitAlias('day', 'd');
|
17342 | addUnitAlias('weekday', 'e');
|
17343 | addUnitAlias('isoWeekday', 'E');
|
17344 |
|
17345 | // PRIORITY
|
17346 | addUnitPriority('day', 11);
|
17347 | addUnitPriority('weekday', 11);
|
17348 | addUnitPriority('isoWeekday', 11);
|
17349 |
|
17350 | // PARSING
|
17351 |
|
17352 | addRegexToken('d', match1to2);
|
17353 | addRegexToken('e', match1to2);
|
17354 | addRegexToken('E', match1to2);
|
17355 | addRegexToken('dd', function (isStrict, locale) {
|
17356 | return locale.weekdaysMinRegex(isStrict);
|
17357 | });
|
17358 | addRegexToken('ddd', function (isStrict, locale) {
|
17359 | return locale.weekdaysShortRegex(isStrict);
|
17360 | });
|
17361 | addRegexToken('dddd', function (isStrict, locale) {
|
17362 | return locale.weekdaysRegex(isStrict);
|
17363 | });
|
17364 |
|
17365 | addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) {
|
17366 | var weekday = config._locale.weekdaysParse(input, token, config._strict);
|
17367 | // if we didn't get a weekday name, mark the date as invalid
|
17368 | if (weekday != null) {
|
17369 | week.d = weekday;
|
17370 | } else {
|
17371 | getParsingFlags(config).invalidWeekday = input;
|
17372 | }
|
17373 | });
|
17374 |
|
17375 | addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) {
|
17376 | week[token] = toInt(input);
|
17377 | });
|
17378 |
|
17379 | // HELPERS
|
17380 |
|
17381 | function parseWeekday(input, locale) {
|
17382 | if (typeof input !== 'string') {
|
17383 | return input;
|
17384 | }
|
17385 |
|
17386 | if (!isNaN(input)) {
|
17387 | return parseInt(input, 10);
|
17388 | }
|
17389 |
|
17390 | input = locale.weekdaysParse(input);
|
17391 | if (typeof input === 'number') {
|
17392 | return input;
|
17393 | }
|
17394 |
|
17395 | return null;
|
17396 | }
|
17397 |
|
17398 | function parseIsoWeekday(input, locale) {
|
17399 | if (typeof input === 'string') {
|
17400 | return locale.weekdaysParse(input) % 7 || 7;
|
17401 | }
|
17402 | return isNaN(input) ? null : input;
|
17403 | }
|
17404 |
|
17405 | // LOCALES
|
17406 | function shiftWeekdays (ws, n) {
|
17407 | return ws.slice(n, 7).concat(ws.slice(0, n));
|
17408 | }
|
17409 |
|
17410 | var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_');
|
17411 | function localeWeekdays (m, format) {
|
17412 | var weekdays = isArray(this._weekdays) ? this._weekdays :
|
17413 | this._weekdays[(m && m !== true && this._weekdays.isFormat.test(format)) ? 'format' : 'standalone'];
|
17414 | return (m === true) ? shiftWeekdays(weekdays, this._week.dow)
|
17415 | : (m) ? weekdays[m.day()] : weekdays;
|
17416 | }
|
17417 |
|
17418 | var defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_');
|
17419 | function localeWeekdaysShort (m) {
|
17420 | return (m === true) ? shiftWeekdays(this._weekdaysShort, this._week.dow)
|
17421 | : (m) ? this._weekdaysShort[m.day()] : this._weekdaysShort;
|
17422 | }
|
17423 |
|
17424 | var defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_');
|
17425 | function localeWeekdaysMin (m) {
|
17426 | return (m === true) ? shiftWeekdays(this._weekdaysMin, this._week.dow)
|
17427 | : (m) ? this._weekdaysMin[m.day()] : this._weekdaysMin;
|
17428 | }
|
17429 |
|
17430 | function handleStrictParse$1(weekdayName, format, strict) {
|
17431 | var i, ii, mom, llc = weekdayName.toLocaleLowerCase();
|
17432 | if (!this._weekdaysParse) {
|
17433 | this._weekdaysParse = [];
|
17434 | this._shortWeekdaysParse = [];
|
17435 | this._minWeekdaysParse = [];
|
17436 |
|
17437 | for (i = 0; i < 7; ++i) {
|
17438 | mom = createUTC([2000, 1]).day(i);
|
17439 | this._minWeekdaysParse[i] = this.weekdaysMin(mom, '').toLocaleLowerCase();
|
17440 | this._shortWeekdaysParse[i] = this.weekdaysShort(mom, '').toLocaleLowerCase();
|
17441 | this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase();
|
17442 | }
|
17443 | }
|
17444 |
|
17445 | if (strict) {
|
17446 | if (format === 'dddd') {
|
17447 | ii = indexOf.call(this._weekdaysParse, llc);
|
17448 | return ii !== -1 ? ii : null;
|
17449 | } else if (format === 'ddd') {
|
17450 | ii = indexOf.call(this._shortWeekdaysParse, llc);
|
17451 | return ii !== -1 ? ii : null;
|
17452 | } else {
|
17453 | ii = indexOf.call(this._minWeekdaysParse, llc);
|
17454 | return ii !== -1 ? ii : null;
|
17455 | }
|
17456 | } else {
|
17457 | if (format === 'dddd') {
|
17458 | ii = indexOf.call(this._weekdaysParse, llc);
|
17459 | if (ii !== -1) {
|
17460 | return ii;
|
17461 | }
|
17462 | ii = indexOf.call(this._shortWeekdaysParse, llc);
|
17463 | if (ii !== -1) {
|
17464 | return ii;
|
17465 | }
|
17466 | ii = indexOf.call(this._minWeekdaysParse, llc);
|
17467 | return ii !== -1 ? ii : null;
|
17468 | } else if (format === 'ddd') {
|
17469 | ii = indexOf.call(this._shortWeekdaysParse, llc);
|
17470 | if (ii !== -1) {
|
17471 | return ii;
|
17472 | }
|
17473 | ii = indexOf.call(this._weekdaysParse, llc);
|
17474 | if (ii !== -1) {
|
17475 | return ii;
|
17476 | }
|
17477 | ii = indexOf.call(this._minWeekdaysParse, llc);
|
17478 | return ii !== -1 ? ii : null;
|
17479 | } else {
|
17480 | ii = indexOf.call(this._minWeekdaysParse, llc);
|
17481 | if (ii !== -1) {
|
17482 | return ii;
|
17483 | }
|
17484 | ii = indexOf.call(this._weekdaysParse, llc);
|
17485 | if (ii !== -1) {
|
17486 | return ii;
|
17487 | }
|
17488 | ii = indexOf.call(this._shortWeekdaysParse, llc);
|
17489 | return ii !== -1 ? ii : null;
|
17490 | }
|
17491 | }
|
17492 | }
|
17493 |
|
17494 | function localeWeekdaysParse (weekdayName, format, strict) {
|
17495 | var i, mom, regex;
|
17496 |
|
17497 | if (this._weekdaysParseExact) {
|
17498 | return handleStrictParse$1.call(this, weekdayName, format, strict);
|
17499 | }
|
17500 |
|
17501 | if (!this._weekdaysParse) {
|
17502 | this._weekdaysParse = [];
|
17503 | this._minWeekdaysParse = [];
|
17504 | this._shortWeekdaysParse = [];
|
17505 | this._fullWeekdaysParse = [];
|
17506 | }
|
17507 |
|
17508 | for (i = 0; i < 7; i++) {
|
17509 | // make the regex if we don't have it already
|
17510 |
|
17511 | mom = createUTC([2000, 1]).day(i);
|
17512 | if (strict && !this._fullWeekdaysParse[i]) {
|
17513 | this._fullWeekdaysParse[i] = new RegExp('^' + this.weekdays(mom, '').replace('.', '\\.?') + '$', 'i');
|
17514 | this._shortWeekdaysParse[i] = new RegExp('^' + this.weekdaysShort(mom, '').replace('.', '\\.?') + '$', 'i');
|
17515 | this._minWeekdaysParse[i] = new RegExp('^' + this.weekdaysMin(mom, '').replace('.', '\\.?') + '$', 'i');
|
17516 | }
|
17517 | if (!this._weekdaysParse[i]) {
|
17518 | regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, '');
|
17519 | this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i');
|
17520 | }
|
17521 | // test the regex
|
17522 | if (strict && format === 'dddd' && this._fullWeekdaysParse[i].test(weekdayName)) {
|
17523 | return i;
|
17524 | } else if (strict && format === 'ddd' && this._shortWeekdaysParse[i].test(weekdayName)) {
|
17525 | return i;
|
17526 | } else if (strict && format === 'dd' && this._minWeekdaysParse[i].test(weekdayName)) {
|
17527 | return i;
|
17528 | } else if (!strict && this._weekdaysParse[i].test(weekdayName)) {
|
17529 | return i;
|
17530 | }
|
17531 | }
|
17532 | }
|
17533 |
|
17534 | // MOMENTS
|
17535 |
|
17536 | function getSetDayOfWeek (input) {
|
17537 | if (!this.isValid()) {
|
17538 | return input != null ? this : NaN;
|
17539 | }
|
17540 | var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay();
|
17541 | if (input != null) {
|
17542 | input = parseWeekday(input, this.localeData());
|
17543 | return this.add(input - day, 'd');
|
17544 | } else {
|
17545 | return day;
|
17546 | }
|
17547 | }
|
17548 |
|
17549 | function getSetLocaleDayOfWeek (input) {
|
17550 | if (!this.isValid()) {
|
17551 | return input != null ? this : NaN;
|
17552 | }
|
17553 | var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7;
|
17554 | return input == null ? weekday : this.add(input - weekday, 'd');
|
17555 | }
|
17556 |
|
17557 | function getSetISODayOfWeek (input) {
|
17558 | if (!this.isValid()) {
|
17559 | return input != null ? this : NaN;
|
17560 | }
|
17561 |
|
17562 | // behaves the same as moment#day except
|
17563 | // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6)
|
17564 | // as a setter, sunday should belong to the previous week.
|
17565 |
|
17566 | if (input != null) {
|
17567 | var weekday = parseIsoWeekday(input, this.localeData());
|
17568 | return this.day(this.day() % 7 ? weekday : weekday - 7);
|
17569 | } else {
|
17570 | return this.day() || 7;
|
17571 | }
|
17572 | }
|
17573 |
|
17574 | var defaultWeekdaysRegex = matchWord;
|
17575 | function weekdaysRegex (isStrict) {
|
17576 | if (this._weekdaysParseExact) {
|
17577 | if (!hasOwnProp(this, '_weekdaysRegex')) {
|
17578 | computeWeekdaysParse.call(this);
|
17579 | }
|
17580 | if (isStrict) {
|
17581 | return this._weekdaysStrictRegex;
|
17582 | } else {
|
17583 | return this._weekdaysRegex;
|
17584 | }
|
17585 | } else {
|
17586 | if (!hasOwnProp(this, '_weekdaysRegex')) {
|
17587 | this._weekdaysRegex = defaultWeekdaysRegex;
|
17588 | }
|
17589 | return this._weekdaysStrictRegex && isStrict ?
|
17590 | this._weekdaysStrictRegex : this._weekdaysRegex;
|
17591 | }
|
17592 | }
|
17593 |
|
17594 | var defaultWeekdaysShortRegex = matchWord;
|
17595 | function weekdaysShortRegex (isStrict) {
|
17596 | if (this._weekdaysParseExact) {
|
17597 | if (!hasOwnProp(this, '_weekdaysRegex')) {
|
17598 | computeWeekdaysParse.call(this);
|
17599 | }
|
17600 | if (isStrict) {
|
17601 | return this._weekdaysShortStrictRegex;
|
17602 | } else {
|
17603 | return this._weekdaysShortRegex;
|
17604 | }
|
17605 | } else {
|
17606 | if (!hasOwnProp(this, '_weekdaysShortRegex')) {
|
17607 | this._weekdaysShortRegex = defaultWeekdaysShortRegex;
|
17608 | }
|
17609 | return this._weekdaysShortStrictRegex && isStrict ?
|
17610 | this._weekdaysShortStrictRegex : this._weekdaysShortRegex;
|
17611 | }
|
17612 | }
|
17613 |
|
17614 | var defaultWeekdaysMinRegex = matchWord;
|
17615 | function weekdaysMinRegex (isStrict) {
|
17616 | if (this._weekdaysParseExact) {
|
17617 | if (!hasOwnProp(this, '_weekdaysRegex')) {
|
17618 | computeWeekdaysParse.call(this);
|
17619 | }
|
17620 | if (isStrict) {
|
17621 | return this._weekdaysMinStrictRegex;
|
17622 | } else {
|
17623 | return this._weekdaysMinRegex;
|
17624 | }
|
17625 | } else {
|
17626 | if (!hasOwnProp(this, '_weekdaysMinRegex')) {
|
17627 | this._weekdaysMinRegex = defaultWeekdaysMinRegex;
|
17628 | }
|
17629 | return this._weekdaysMinStrictRegex && isStrict ?
|
17630 | this._weekdaysMinStrictRegex : this._weekdaysMinRegex;
|
17631 | }
|
17632 | }
|
17633 |
|
17634 |
|
17635 | function computeWeekdaysParse () {
|
17636 | function cmpLenRev(a, b) {
|
17637 | return b.length - a.length;
|
17638 | }
|
17639 |
|
17640 | var minPieces = [], shortPieces = [], longPieces = [], mixedPieces = [],
|
17641 | i, mom, minp, shortp, longp;
|
17642 | for (i = 0; i < 7; i++) {
|
17643 | // make the regex if we don't have it already
|
17644 | mom = createUTC([2000, 1]).day(i);
|
17645 | minp = this.weekdaysMin(mom, '');
|
17646 | shortp = this.weekdaysShort(mom, '');
|
17647 | longp = this.weekdays(mom, '');
|
17648 | minPieces.push(minp);
|
17649 | shortPieces.push(shortp);
|
17650 | longPieces.push(longp);
|
17651 | mixedPieces.push(minp);
|
17652 | mixedPieces.push(shortp);
|
17653 | mixedPieces.push(longp);
|
17654 | }
|
17655 | // Sorting makes sure if one weekday (or abbr) is a prefix of another it
|
17656 | // will match the longer piece.
|
17657 | minPieces.sort(cmpLenRev);
|
17658 | shortPieces.sort(cmpLenRev);
|
17659 | longPieces.sort(cmpLenRev);
|
17660 | mixedPieces.sort(cmpLenRev);
|
17661 | for (i = 0; i < 7; i++) {
|
17662 | shortPieces[i] = regexEscape(shortPieces[i]);
|
17663 | longPieces[i] = regexEscape(longPieces[i]);
|
17664 | mixedPieces[i] = regexEscape(mixedPieces[i]);
|
17665 | }
|
17666 |
|
17667 | this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
|
17668 | this._weekdaysShortRegex = this._weekdaysRegex;
|
17669 | this._weekdaysMinRegex = this._weekdaysRegex;
|
17670 |
|
17671 | this._weekdaysStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i');
|
17672 | this._weekdaysShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i');
|
17673 | this._weekdaysMinStrictRegex = new RegExp('^(' + minPieces.join('|') + ')', 'i');
|
17674 | }
|
17675 |
|
17676 | // FORMATTING
|
17677 |
|
17678 | function hFormat() {
|
17679 | return this.hours() % 12 || 12;
|
17680 | }
|
17681 |
|
17682 | function kFormat() {
|
17683 | return this.hours() || 24;
|
17684 | }
|
17685 |
|
17686 | addFormatToken('H', ['HH', 2], 0, 'hour');
|
17687 | addFormatToken('h', ['hh', 2], 0, hFormat);
|
17688 | addFormatToken('k', ['kk', 2], 0, kFormat);
|
17689 |
|
17690 | addFormatToken('hmm', 0, 0, function () {
|
17691 | return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2);
|
17692 | });
|
17693 |
|
17694 | addFormatToken('hmmss', 0, 0, function () {
|
17695 | return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2) +
|
17696 | zeroFill(this.seconds(), 2);
|
17697 | });
|
17698 |
|
17699 | addFormatToken('Hmm', 0, 0, function () {
|
17700 | return '' + this.hours() + zeroFill(this.minutes(), 2);
|
17701 | });
|
17702 |
|
17703 | addFormatToken('Hmmss', 0, 0, function () {
|
17704 | return '' + this.hours() + zeroFill(this.minutes(), 2) +
|
17705 | zeroFill(this.seconds(), 2);
|
17706 | });
|
17707 |
|
17708 | function meridiem (token, lowercase) {
|
17709 | addFormatToken(token, 0, 0, function () {
|
17710 | return this.localeData().meridiem(this.hours(), this.minutes(), lowercase);
|
17711 | });
|
17712 | }
|
17713 |
|
17714 | meridiem('a', true);
|
17715 | meridiem('A', false);
|
17716 |
|
17717 | // ALIASES
|
17718 |
|
17719 | addUnitAlias('hour', 'h');
|
17720 |
|
17721 | // PRIORITY
|
17722 | addUnitPriority('hour', 13);
|
17723 |
|
17724 | // PARSING
|
17725 |
|
17726 | function matchMeridiem (isStrict, locale) {
|
17727 | return locale._meridiemParse;
|
17728 | }
|
17729 |
|
17730 | addRegexToken('a', matchMeridiem);
|
17731 | addRegexToken('A', matchMeridiem);
|
17732 | addRegexToken('H', match1to2);
|
17733 | addRegexToken('h', match1to2);
|
17734 | addRegexToken('k', match1to2);
|
17735 | addRegexToken('HH', match1to2, match2);
|
17736 | addRegexToken('hh', match1to2, match2);
|
17737 | addRegexToken('kk', match1to2, match2);
|
17738 |
|
17739 | addRegexToken('hmm', match3to4);
|
17740 | addRegexToken('hmmss', match5to6);
|
17741 | addRegexToken('Hmm', match3to4);
|
17742 | addRegexToken('Hmmss', match5to6);
|
17743 |
|
17744 | addParseToken(['H', 'HH'], HOUR);
|
17745 | addParseToken(['k', 'kk'], function (input, array, config) {
|
17746 | var kInput = toInt(input);
|
17747 | array[HOUR] = kInput === 24 ? 0 : kInput;
|
17748 | });
|
17749 | addParseToken(['a', 'A'], function (input, array, config) {
|
17750 | config._isPm = config._locale.isPM(input);
|
17751 | config._meridiem = input;
|
17752 | });
|
17753 | addParseToken(['h', 'hh'], function (input, array, config) {
|
17754 | array[HOUR] = toInt(input);
|
17755 | getParsingFlags(config).bigHour = true;
|
17756 | });
|
17757 | addParseToken('hmm', function (input, array, config) {
|
17758 | var pos = input.length - 2;
|
17759 | array[HOUR] = toInt(input.substr(0, pos));
|
17760 | array[MINUTE] = toInt(input.substr(pos));
|
17761 | getParsingFlags(config).bigHour = true;
|
17762 | });
|
17763 | addParseToken('hmmss', function (input, array, config) {
|
17764 | var pos1 = input.length - 4;
|
17765 | var pos2 = input.length - 2;
|
17766 | array[HOUR] = toInt(input.substr(0, pos1));
|
17767 | array[MINUTE] = toInt(input.substr(pos1, 2));
|
17768 | array[SECOND] = toInt(input.substr(pos2));
|
17769 | getParsingFlags(config).bigHour = true;
|
17770 | });
|
17771 | addParseToken('Hmm', function (input, array, config) {
|
17772 | var pos = input.length - 2;
|
17773 | array[HOUR] = toInt(input.substr(0, pos));
|
17774 | array[MINUTE] = toInt(input.substr(pos));
|
17775 | });
|
17776 | addParseToken('Hmmss', function (input, array, config) {
|
17777 | var pos1 = input.length - 4;
|
17778 | var pos2 = input.length - 2;
|
17779 | array[HOUR] = toInt(input.substr(0, pos1));
|
17780 | array[MINUTE] = toInt(input.substr(pos1, 2));
|
17781 | array[SECOND] = toInt(input.substr(pos2));
|
17782 | });
|
17783 |
|
17784 | // LOCALES
|
17785 |
|
17786 | function localeIsPM (input) {
|
17787 | // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays
|
17788 | // Using charAt should be more compatible.
|
17789 | return ((input + '').toLowerCase().charAt(0) === 'p');
|
17790 | }
|
17791 |
|
17792 | var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i;
|
17793 | function localeMeridiem (hours, minutes, isLower) {
|
17794 | if (hours > 11) {
|
17795 | return isLower ? 'pm' : 'PM';
|
17796 | } else {
|
17797 | return isLower ? 'am' : 'AM';
|
17798 | }
|
17799 | }
|
17800 |
|
17801 |
|
17802 | // MOMENTS
|
17803 |
|
17804 | // Setting the hour should keep the time, because the user explicitly
|
17805 | // specified which hour they want. So trying to maintain the same hour (in
|
17806 | // a new timezone) makes sense. Adding/subtracting hours does not follow
|
17807 | // this rule.
|
17808 | var getSetHour = makeGetSet('Hours', true);
|
17809 |
|
17810 | var baseConfig = {
|
17811 | calendar: defaultCalendar,
|
17812 | longDateFormat: defaultLongDateFormat,
|
17813 | invalidDate: defaultInvalidDate,
|
17814 | ordinal: defaultOrdinal,
|
17815 | dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse,
|
17816 | relativeTime: defaultRelativeTime,
|
17817 |
|
17818 | months: defaultLocaleMonths,
|
17819 | monthsShort: defaultLocaleMonthsShort,
|
17820 |
|
17821 | week: defaultLocaleWeek,
|
17822 |
|
17823 | weekdays: defaultLocaleWeekdays,
|
17824 | weekdaysMin: defaultLocaleWeekdaysMin,
|
17825 | weekdaysShort: defaultLocaleWeekdaysShort,
|
17826 |
|
17827 | meridiemParse: defaultLocaleMeridiemParse
|
17828 | };
|
17829 |
|
17830 | // internal storage for locale config files
|
17831 | var locales = {};
|
17832 | var localeFamilies = {};
|
17833 | var globalLocale;
|
17834 |
|
17835 | function normalizeLocale(key) {
|
17836 | return key ? key.toLowerCase().replace('_', '-') : key;
|
17837 | }
|
17838 |
|
17839 | // pick the locale from the array
|
17840 | // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each
|
17841 | // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root
|
17842 | function chooseLocale(names) {
|
17843 | var i = 0, j, next, locale, split;
|
17844 |
|
17845 | while (i < names.length) {
|
17846 | split = normalizeLocale(names[i]).split('-');
|
17847 | j = split.length;
|
17848 | next = normalizeLocale(names[i + 1]);
|
17849 | next = next ? next.split('-') : null;
|
17850 | while (j > 0) {
|
17851 | locale = loadLocale(split.slice(0, j).join('-'));
|
17852 | if (locale) {
|
17853 | return locale;
|
17854 | }
|
17855 | if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {
|
17856 | //the next array item is better than a shallower substring of this one
|
17857 | break;
|
17858 | }
|
17859 | j--;
|
17860 | }
|
17861 | i++;
|
17862 | }
|
17863 | return globalLocale;
|
17864 | }
|
17865 |
|
17866 | function loadLocale(name) {
|
17867 | var oldLocale = null;
|
17868 | // TODO: Find a better way to register and load all the locales in Node
|
17869 | if (!locales[name] && ('object' !== 'undefined') &&
|
17870 | module && module.exports) {
|
17871 | try {
|
17872 | oldLocale = globalLocale._abbr;
|
17873 | var aliasedRequire = commonjsRequire;
|
17874 | aliasedRequire('./locale/' + name);
|
17875 | getSetGlobalLocale(oldLocale);
|
17876 | } catch (e) {}
|
17877 | }
|
17878 | return locales[name];
|
17879 | }
|
17880 |
|
17881 | // This function will load locale and then set the global locale. If
|
17882 | // no arguments are passed in, it will simply return the current global
|
17883 | // locale key.
|
17884 | function getSetGlobalLocale (key, values) {
|
17885 | var data;
|
17886 | if (key) {
|
17887 | if (isUndefined(values)) {
|
17888 | data = getLocale(key);
|
17889 | }
|
17890 | else {
|
17891 | data = defineLocale(key, values);
|
17892 | }
|
17893 |
|
17894 | if (data) {
|
17895 | // moment.duration._locale = moment._locale = data;
|
17896 | globalLocale = data;
|
17897 | }
|
17898 | else {
|
17899 | if ((typeof console !== 'undefined') && console.warn) {
|
17900 | //warn user if arguments are passed but the locale could not be set
|
17901 | console.warn('Locale ' + key + ' not found. Did you forget to load it?');
|
17902 | }
|
17903 | }
|
17904 | }
|
17905 |
|
17906 | return globalLocale._abbr;
|
17907 | }
|
17908 |
|
17909 | function defineLocale (name, config) {
|
17910 | if (config !== null) {
|
17911 | var locale, parentConfig = baseConfig;
|
17912 | config.abbr = name;
|
17913 | if (locales[name] != null) {
|
17914 | deprecateSimple('defineLocaleOverride',
|
17915 | 'use moment.updateLocale(localeName, config) to change ' +
|
17916 | 'an existing locale. moment.defineLocale(localeName, ' +
|
17917 | 'config) should only be used for creating a new locale ' +
|
17918 | 'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.');
|
17919 | parentConfig = locales[name]._config;
|
17920 | } else if (config.parentLocale != null) {
|
17921 | if (locales[config.parentLocale] != null) {
|
17922 | parentConfig = locales[config.parentLocale]._config;
|
17923 | } else {
|
17924 | locale = loadLocale(config.parentLocale);
|
17925 | if (locale != null) {
|
17926 | parentConfig = locale._config;
|
17927 | } else {
|
17928 | if (!localeFamilies[config.parentLocale]) {
|
17929 | localeFamilies[config.parentLocale] = [];
|
17930 | }
|
17931 | localeFamilies[config.parentLocale].push({
|
17932 | name: name,
|
17933 | config: config
|
17934 | });
|
17935 | return null;
|
17936 | }
|
17937 | }
|
17938 | }
|
17939 | locales[name] = new Locale(mergeConfigs(parentConfig, config));
|
17940 |
|
17941 | if (localeFamilies[name]) {
|
17942 | localeFamilies[name].forEach(function (x) {
|
17943 | defineLocale(x.name, x.config);
|
17944 | });
|
17945 | }
|
17946 |
|
17947 | // backwards compat for now: also set the locale
|
17948 | // make sure we set the locale AFTER all child locales have been
|
17949 | // created, so we won't end up with the child locale set.
|
17950 | getSetGlobalLocale(name);
|
17951 |
|
17952 |
|
17953 | return locales[name];
|
17954 | } else {
|
17955 | // useful for testing
|
17956 | delete locales[name];
|
17957 | return null;
|
17958 | }
|
17959 | }
|
17960 |
|
17961 | function updateLocale(name, config) {
|
17962 | if (config != null) {
|
17963 | var locale, tmpLocale, parentConfig = baseConfig;
|
17964 | // MERGE
|
17965 | tmpLocale = loadLocale(name);
|
17966 | if (tmpLocale != null) {
|
17967 | parentConfig = tmpLocale._config;
|
17968 | }
|
17969 | config = mergeConfigs(parentConfig, config);
|
17970 | locale = new Locale(config);
|
17971 | locale.parentLocale = locales[name];
|
17972 | locales[name] = locale;
|
17973 |
|
17974 | // backwards compat for now: also set the locale
|
17975 | getSetGlobalLocale(name);
|
17976 | } else {
|
17977 | // pass null for config to unupdate, useful for tests
|
17978 | if (locales[name] != null) {
|
17979 | if (locales[name].parentLocale != null) {
|
17980 | locales[name] = locales[name].parentLocale;
|
17981 | } else if (locales[name] != null) {
|
17982 | delete locales[name];
|
17983 | }
|
17984 | }
|
17985 | }
|
17986 | return locales[name];
|
17987 | }
|
17988 |
|
17989 | // returns locale data
|
17990 | function getLocale (key) {
|
17991 | var locale;
|
17992 |
|
17993 | if (key && key._locale && key._locale._abbr) {
|
17994 | key = key._locale._abbr;
|
17995 | }
|
17996 |
|
17997 | if (!key) {
|
17998 | return globalLocale;
|
17999 | }
|
18000 |
|
18001 | if (!isArray(key)) {
|
18002 | //short-circuit everything else
|
18003 | locale = loadLocale(key);
|
18004 | if (locale) {
|
18005 | return locale;
|
18006 | }
|
18007 | key = [key];
|
18008 | }
|
18009 |
|
18010 | return chooseLocale(key);
|
18011 | }
|
18012 |
|
18013 | function listLocales() {
|
18014 | return keys(locales);
|
18015 | }
|
18016 |
|
18017 | function checkOverflow (m) {
|
18018 | var overflow;
|
18019 | var a = m._a;
|
18020 |
|
18021 | if (a && getParsingFlags(m).overflow === -2) {
|
18022 | overflow =
|
18023 | a[MONTH] < 0 || a[MONTH] > 11 ? MONTH :
|
18024 | a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) ? DATE :
|
18025 | a[HOUR] < 0 || a[HOUR] > 24 || (a[HOUR] === 24 && (a[MINUTE] !== 0 || a[SECOND] !== 0 || a[MILLISECOND] !== 0)) ? HOUR :
|
18026 | a[MINUTE] < 0 || a[MINUTE] > 59 ? MINUTE :
|
18027 | a[SECOND] < 0 || a[SECOND] > 59 ? SECOND :
|
18028 | a[MILLISECOND] < 0 || a[MILLISECOND] > 999 ? MILLISECOND :
|
18029 | -1;
|
18030 |
|
18031 | if (getParsingFlags(m)._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) {
|
18032 | overflow = DATE;
|
18033 | }
|
18034 | if (getParsingFlags(m)._overflowWeeks && overflow === -1) {
|
18035 | overflow = WEEK;
|
18036 | }
|
18037 | if (getParsingFlags(m)._overflowWeekday && overflow === -1) {
|
18038 | overflow = WEEKDAY;
|
18039 | }
|
18040 |
|
18041 | getParsingFlags(m).overflow = overflow;
|
18042 | }
|
18043 |
|
18044 | return m;
|
18045 | }
|
18046 |
|
18047 | // Pick the first defined of two or three arguments.
|
18048 | function defaults(a, b, c) {
|
18049 | if (a != null) {
|
18050 | return a;
|
18051 | }
|
18052 | if (b != null) {
|
18053 | return b;
|
18054 | }
|
18055 | return c;
|
18056 | }
|
18057 |
|
18058 | function currentDateArray(config) {
|
18059 | // hooks is actually the exported moment object
|
18060 | var nowValue = new Date(hooks.now());
|
18061 | if (config._useUTC) {
|
18062 | return [nowValue.getUTCFullYear(), nowValue.getUTCMonth(), nowValue.getUTCDate()];
|
18063 | }
|
18064 | return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()];
|
18065 | }
|
18066 |
|
18067 | // convert an array to a date.
|
18068 | // the array should mirror the parameters below
|
18069 | // note: all values past the year are optional and will default to the lowest possible value.
|
18070 | // [year, month, day , hour, minute, second, millisecond]
|
18071 | function configFromArray (config) {
|
18072 | var i, date, input = [], currentDate, expectedWeekday, yearToUse;
|
18073 |
|
18074 | if (config._d) {
|
18075 | return;
|
18076 | }
|
18077 |
|
18078 | currentDate = currentDateArray(config);
|
18079 |
|
18080 | //compute day of the year from weeks and weekdays
|
18081 | if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {
|
18082 | dayOfYearFromWeekInfo(config);
|
18083 | }
|
18084 |
|
18085 | //if the day of the year is set, figure out what it is
|
18086 | if (config._dayOfYear != null) {
|
18087 | yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);
|
18088 |
|
18089 | if (config._dayOfYear > daysInYear(yearToUse) || config._dayOfYear === 0) {
|
18090 | getParsingFlags(config)._overflowDayOfYear = true;
|
18091 | }
|
18092 |
|
18093 | date = createUTCDate(yearToUse, 0, config._dayOfYear);
|
18094 | config._a[MONTH] = date.getUTCMonth();
|
18095 | config._a[DATE] = date.getUTCDate();
|
18096 | }
|
18097 |
|
18098 | // Default to current date.
|
18099 | // * if no year, month, day of month are given, default to today
|
18100 | // * if day of month is given, default month and year
|
18101 | // * if month is given, default only year
|
18102 | // * if year is given, don't default anything
|
18103 | for (i = 0; i < 3 && config._a[i] == null; ++i) {
|
18104 | config._a[i] = input[i] = currentDate[i];
|
18105 | }
|
18106 |
|
18107 | // Zero out whatever was not defaulted, including time
|
18108 | for (; i < 7; i++) {
|
18109 | config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];
|
18110 | }
|
18111 |
|
18112 | // Check for 24:00:00.000
|
18113 | if (config._a[HOUR] === 24 &&
|
18114 | config._a[MINUTE] === 0 &&
|
18115 | config._a[SECOND] === 0 &&
|
18116 | config._a[MILLISECOND] === 0) {
|
18117 | config._nextDay = true;
|
18118 | config._a[HOUR] = 0;
|
18119 | }
|
18120 |
|
18121 | config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);
|
18122 | expectedWeekday = config._useUTC ? config._d.getUTCDay() : config._d.getDay();
|
18123 |
|
18124 | // Apply timezone offset from input. The actual utcOffset can be changed
|
18125 | // with parseZone.
|
18126 | if (config._tzm != null) {
|
18127 | config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
|
18128 | }
|
18129 |
|
18130 | if (config._nextDay) {
|
18131 | config._a[HOUR] = 24;
|
18132 | }
|
18133 |
|
18134 | // check for mismatching day of week
|
18135 | if (config._w && typeof config._w.d !== 'undefined' && config._w.d !== expectedWeekday) {
|
18136 | getParsingFlags(config).weekdayMismatch = true;
|
18137 | }
|
18138 | }
|
18139 |
|
18140 | function dayOfYearFromWeekInfo(config) {
|
18141 | var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow;
|
18142 |
|
18143 | w = config._w;
|
18144 | if (w.GG != null || w.W != null || w.E != null) {
|
18145 | dow = 1;
|
18146 | doy = 4;
|
18147 |
|
18148 | // TODO: We need to take the current isoWeekYear, but that depends on
|
18149 | // how we interpret now (local, utc, fixed offset). So create
|
18150 | // a now version of current config (take local/utc/offset flags, and
|
18151 | // create now).
|
18152 | weekYear = defaults(w.GG, config._a[YEAR], weekOfYear(createLocal(), 1, 4).year);
|
18153 | week = defaults(w.W, 1);
|
18154 | weekday = defaults(w.E, 1);
|
18155 | if (weekday < 1 || weekday > 7) {
|
18156 | weekdayOverflow = true;
|
18157 | }
|
18158 | } else {
|
18159 | dow = config._locale._week.dow;
|
18160 | doy = config._locale._week.doy;
|
18161 |
|
18162 | var curWeek = weekOfYear(createLocal(), dow, doy);
|
18163 |
|
18164 | weekYear = defaults(w.gg, config._a[YEAR], curWeek.year);
|
18165 |
|
18166 | // Default to current week.
|
18167 | week = defaults(w.w, curWeek.week);
|
18168 |
|
18169 | if (w.d != null) {
|
18170 | // weekday -- low day numbers are considered next week
|
18171 | weekday = w.d;
|
18172 | if (weekday < 0 || weekday > 6) {
|
18173 | weekdayOverflow = true;
|
18174 | }
|
18175 | } else if (w.e != null) {
|
18176 | // local weekday -- counting starts from beginning of week
|
18177 | weekday = w.e + dow;
|
18178 | if (w.e < 0 || w.e > 6) {
|
18179 | weekdayOverflow = true;
|
18180 | }
|
18181 | } else {
|
18182 | // default to beginning of week
|
18183 | weekday = dow;
|
18184 | }
|
18185 | }
|
18186 | if (week < 1 || week > weeksInYear(weekYear, dow, doy)) {
|
18187 | getParsingFlags(config)._overflowWeeks = true;
|
18188 | } else if (weekdayOverflow != null) {
|
18189 | getParsingFlags(config)._overflowWeekday = true;
|
18190 | } else {
|
18191 | temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy);
|
18192 | config._a[YEAR] = temp.year;
|
18193 | config._dayOfYear = temp.dayOfYear;
|
18194 | }
|
18195 | }
|
18196 |
|
18197 | // iso 8601 regex
|
18198 | // 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00)
|
18199 | var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/;
|
18200 | var basicIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/;
|
18201 |
|
18202 | var tzRegex = /Z|[+-]\d\d(?::?\d\d)?/;
|
18203 |
|
18204 | var isoDates = [
|
18205 | ['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/],
|
18206 | ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/],
|
18207 | ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/],
|
18208 | ['GGGG-[W]WW', /\d{4}-W\d\d/, false],
|
18209 | ['YYYY-DDD', /\d{4}-\d{3}/],
|
18210 | ['YYYY-MM', /\d{4}-\d\d/, false],
|
18211 | ['YYYYYYMMDD', /[+-]\d{10}/],
|
18212 | ['YYYYMMDD', /\d{8}/],
|
18213 | // YYYYMM is NOT allowed by the standard
|
18214 | ['GGGG[W]WWE', /\d{4}W\d{3}/],
|
18215 | ['GGGG[W]WW', /\d{4}W\d{2}/, false],
|
18216 | ['YYYYDDD', /\d{7}/]
|
18217 | ];
|
18218 |
|
18219 | // iso time formats and regexes
|
18220 | var isoTimes = [
|
18221 | ['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/],
|
18222 | ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/],
|
18223 | ['HH:mm:ss', /\d\d:\d\d:\d\d/],
|
18224 | ['HH:mm', /\d\d:\d\d/],
|
18225 | ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/],
|
18226 | ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/],
|
18227 | ['HHmmss', /\d\d\d\d\d\d/],
|
18228 | ['HHmm', /\d\d\d\d/],
|
18229 | ['HH', /\d\d/]
|
18230 | ];
|
18231 |
|
18232 | var aspNetJsonRegex = /^\/?Date\((\-?\d+)/i;
|
18233 |
|
18234 | // date from iso format
|
18235 | function configFromISO(config) {
|
18236 | var i, l,
|
18237 | string = config._i,
|
18238 | match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string),
|
18239 | allowTime, dateFormat, timeFormat, tzFormat;
|
18240 |
|
18241 | if (match) {
|
18242 | getParsingFlags(config).iso = true;
|
18243 |
|
18244 | for (i = 0, l = isoDates.length; i < l; i++) {
|
18245 | if (isoDates[i][1].exec(match[1])) {
|
18246 | dateFormat = isoDates[i][0];
|
18247 | allowTime = isoDates[i][2] !== false;
|
18248 | break;
|
18249 | }
|
18250 | }
|
18251 | if (dateFormat == null) {
|
18252 | config._isValid = false;
|
18253 | return;
|
18254 | }
|
18255 | if (match[3]) {
|
18256 | for (i = 0, l = isoTimes.length; i < l; i++) {
|
18257 | if (isoTimes[i][1].exec(match[3])) {
|
18258 | // match[2] should be 'T' or space
|
18259 | timeFormat = (match[2] || ' ') + isoTimes[i][0];
|
18260 | break;
|
18261 | }
|
18262 | }
|
18263 | if (timeFormat == null) {
|
18264 | config._isValid = false;
|
18265 | return;
|
18266 | }
|
18267 | }
|
18268 | if (!allowTime && timeFormat != null) {
|
18269 | config._isValid = false;
|
18270 | return;
|
18271 | }
|
18272 | if (match[4]) {
|
18273 | if (tzRegex.exec(match[4])) {
|
18274 | tzFormat = 'Z';
|
18275 | } else {
|
18276 | config._isValid = false;
|
18277 | return;
|
18278 | }
|
18279 | }
|
18280 | config._f = dateFormat + (timeFormat || '') + (tzFormat || '');
|
18281 | configFromStringAndFormat(config);
|
18282 | } else {
|
18283 | config._isValid = false;
|
18284 | }
|
18285 | }
|
18286 |
|
18287 | // RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3
|
18288 | var rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/;
|
18289 |
|
18290 | function extractFromRFC2822Strings(yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) {
|
18291 | var result = [
|
18292 | untruncateYear(yearStr),
|
18293 | defaultLocaleMonthsShort.indexOf(monthStr),
|
18294 | parseInt(dayStr, 10),
|
18295 | parseInt(hourStr, 10),
|
18296 | parseInt(minuteStr, 10)
|
18297 | ];
|
18298 |
|
18299 | if (secondStr) {
|
18300 | result.push(parseInt(secondStr, 10));
|
18301 | }
|
18302 |
|
18303 | return result;
|
18304 | }
|
18305 |
|
18306 | function untruncateYear(yearStr) {
|
18307 | var year = parseInt(yearStr, 10);
|
18308 | if (year <= 49) {
|
18309 | return 2000 + year;
|
18310 | } else if (year <= 999) {
|
18311 | return 1900 + year;
|
18312 | }
|
18313 | return year;
|
18314 | }
|
18315 |
|
18316 | function preprocessRFC2822(s) {
|
18317 | // Remove comments and folding whitespace and replace multiple-spaces with a single space
|
18318 | return s.replace(/\([^)]*\)|[\n\t]/g, ' ').replace(/(\s\s+)/g, ' ').replace(/^\s\s*/, '').replace(/\s\s*$/, '');
|
18319 | }
|
18320 |
|
18321 | function checkWeekday(weekdayStr, parsedInput, config) {
|
18322 | if (weekdayStr) {
|
18323 | // TODO: Replace the vanilla JS Date object with an indepentent day-of-week check.
|
18324 | var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr),
|
18325 | weekdayActual = new Date(parsedInput[0], parsedInput[1], parsedInput[2]).getDay();
|
18326 | if (weekdayProvided !== weekdayActual) {
|
18327 | getParsingFlags(config).weekdayMismatch = true;
|
18328 | config._isValid = false;
|
18329 | return false;
|
18330 | }
|
18331 | }
|
18332 | return true;
|
18333 | }
|
18334 |
|
18335 | var obsOffsets = {
|
18336 | UT: 0,
|
18337 | GMT: 0,
|
18338 | EDT: -4 * 60,
|
18339 | EST: -5 * 60,
|
18340 | CDT: -5 * 60,
|
18341 | CST: -6 * 60,
|
18342 | MDT: -6 * 60,
|
18343 | MST: -7 * 60,
|
18344 | PDT: -7 * 60,
|
18345 | PST: -8 * 60
|
18346 | };
|
18347 |
|
18348 | function calculateOffset(obsOffset, militaryOffset, numOffset) {
|
18349 | if (obsOffset) {
|
18350 | return obsOffsets[obsOffset];
|
18351 | } else if (militaryOffset) {
|
18352 | // the only allowed military tz is Z
|
18353 | return 0;
|
18354 | } else {
|
18355 | var hm = parseInt(numOffset, 10);
|
18356 | var m = hm % 100, h = (hm - m) / 100;
|
18357 | return h * 60 + m;
|
18358 | }
|
18359 | }
|
18360 |
|
18361 | // date and time from ref 2822 format
|
18362 | function configFromRFC2822(config) {
|
18363 | var match = rfc2822.exec(preprocessRFC2822(config._i));
|
18364 | if (match) {
|
18365 | var parsedArray = extractFromRFC2822Strings(match[4], match[3], match[2], match[5], match[6], match[7]);
|
18366 | if (!checkWeekday(match[1], parsedArray, config)) {
|
18367 | return;
|
18368 | }
|
18369 |
|
18370 | config._a = parsedArray;
|
18371 | config._tzm = calculateOffset(match[8], match[9], match[10]);
|
18372 |
|
18373 | config._d = createUTCDate.apply(null, config._a);
|
18374 | config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
|
18375 |
|
18376 | getParsingFlags(config).rfc2822 = true;
|
18377 | } else {
|
18378 | config._isValid = false;
|
18379 | }
|
18380 | }
|
18381 |
|
18382 | // date from iso format or fallback
|
18383 | function configFromString(config) {
|
18384 | var matched = aspNetJsonRegex.exec(config._i);
|
18385 |
|
18386 | if (matched !== null) {
|
18387 | config._d = new Date(+matched[1]);
|
18388 | return;
|
18389 | }
|
18390 |
|
18391 | configFromISO(config);
|
18392 | if (config._isValid === false) {
|
18393 | delete config._isValid;
|
18394 | } else {
|
18395 | return;
|
18396 | }
|
18397 |
|
18398 | configFromRFC2822(config);
|
18399 | if (config._isValid === false) {
|
18400 | delete config._isValid;
|
18401 | } else {
|
18402 | return;
|
18403 | }
|
18404 |
|
18405 | // Final attempt, use Input Fallback
|
18406 | hooks.createFromInputFallback(config);
|
18407 | }
|
18408 |
|
18409 | hooks.createFromInputFallback = deprecate(
|
18410 | 'value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), ' +
|
18411 | 'which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are ' +
|
18412 | 'discouraged and will be removed in an upcoming major release. Please refer to ' +
|
18413 | 'http://momentjs.com/guides/#/warnings/js-date/ for more info.',
|
18414 | function (config) {
|
18415 | config._d = new Date(config._i + (config._useUTC ? ' UTC' : ''));
|
18416 | }
|
18417 | );
|
18418 |
|
18419 | // constant that refers to the ISO standard
|
18420 | hooks.ISO_8601 = function () {};
|
18421 |
|
18422 | // constant that refers to the RFC 2822 form
|
18423 | hooks.RFC_2822 = function () {};
|
18424 |
|
18425 | // date from string and format string
|
18426 | function configFromStringAndFormat(config) {
|
18427 | // TODO: Move this to another part of the creation flow to prevent circular deps
|
18428 | if (config._f === hooks.ISO_8601) {
|
18429 | configFromISO(config);
|
18430 | return;
|
18431 | }
|
18432 | if (config._f === hooks.RFC_2822) {
|
18433 | configFromRFC2822(config);
|
18434 | return;
|
18435 | }
|
18436 | config._a = [];
|
18437 | getParsingFlags(config).empty = true;
|
18438 |
|
18439 | // This array is used to make a Date, either with `new Date` or `Date.UTC`
|
18440 | var string = '' + config._i,
|
18441 | i, parsedInput, tokens, token, skipped,
|
18442 | stringLength = string.length,
|
18443 | totalParsedInputLength = 0;
|
18444 |
|
18445 | tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];
|
18446 |
|
18447 | for (i = 0; i < tokens.length; i++) {
|
18448 | token = tokens[i];
|
18449 | parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];
|
18450 | // console.log('token', token, 'parsedInput', parsedInput,
|
18451 | // 'regex', getParseRegexForToken(token, config));
|
18452 | if (parsedInput) {
|
18453 | skipped = string.substr(0, string.indexOf(parsedInput));
|
18454 | if (skipped.length > 0) {
|
18455 | getParsingFlags(config).unusedInput.push(skipped);
|
18456 | }
|
18457 | string = string.slice(string.indexOf(parsedInput) + parsedInput.length);
|
18458 | totalParsedInputLength += parsedInput.length;
|
18459 | }
|
18460 | // don't parse if it's not a known token
|
18461 | if (formatTokenFunctions[token]) {
|
18462 | if (parsedInput) {
|
18463 | getParsingFlags(config).empty = false;
|
18464 | }
|
18465 | else {
|
18466 | getParsingFlags(config).unusedTokens.push(token);
|
18467 | }
|
18468 | addTimeToArrayFromToken(token, parsedInput, config);
|
18469 | }
|
18470 | else if (config._strict && !parsedInput) {
|
18471 | getParsingFlags(config).unusedTokens.push(token);
|
18472 | }
|
18473 | }
|
18474 |
|
18475 | // add remaining unparsed input length to the string
|
18476 | getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength;
|
18477 | if (string.length > 0) {
|
18478 | getParsingFlags(config).unusedInput.push(string);
|
18479 | }
|
18480 |
|
18481 | // clear _12h flag if hour is <= 12
|
18482 | if (config._a[HOUR] <= 12 &&
|
18483 | getParsingFlags(config).bigHour === true &&
|
18484 | config._a[HOUR] > 0) {
|
18485 | getParsingFlags(config).bigHour = undefined;
|
18486 | }
|
18487 |
|
18488 | getParsingFlags(config).parsedDateParts = config._a.slice(0);
|
18489 | getParsingFlags(config).meridiem = config._meridiem;
|
18490 | // handle meridiem
|
18491 | config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem);
|
18492 |
|
18493 | configFromArray(config);
|
18494 | checkOverflow(config);
|
18495 | }
|
18496 |
|
18497 |
|
18498 | function meridiemFixWrap (locale, hour, meridiem) {
|
18499 | var isPm;
|
18500 |
|
18501 | if (meridiem == null) {
|
18502 | // nothing to do
|
18503 | return hour;
|
18504 | }
|
18505 | if (locale.meridiemHour != null) {
|
18506 | return locale.meridiemHour(hour, meridiem);
|
18507 | } else if (locale.isPM != null) {
|
18508 | // Fallback
|
18509 | isPm = locale.isPM(meridiem);
|
18510 | if (isPm && hour < 12) {
|
18511 | hour += 12;
|
18512 | }
|
18513 | if (!isPm && hour === 12) {
|
18514 | hour = 0;
|
18515 | }
|
18516 | return hour;
|
18517 | } else {
|
18518 | // this is not supposed to happen
|
18519 | return hour;
|
18520 | }
|
18521 | }
|
18522 |
|
18523 | // date from string and array of format strings
|
18524 | function configFromStringAndArray(config) {
|
18525 | var tempConfig,
|
18526 | bestMoment,
|
18527 |
|
18528 | scoreToBeat,
|
18529 | i,
|
18530 | currentScore;
|
18531 |
|
18532 | if (config._f.length === 0) {
|
18533 | getParsingFlags(config).invalidFormat = true;
|
18534 | config._d = new Date(NaN);
|
18535 | return;
|
18536 | }
|
18537 |
|
18538 | for (i = 0; i < config._f.length; i++) {
|
18539 | currentScore = 0;
|
18540 | tempConfig = copyConfig({}, config);
|
18541 | if (config._useUTC != null) {
|
18542 | tempConfig._useUTC = config._useUTC;
|
18543 | }
|
18544 | tempConfig._f = config._f[i];
|
18545 | configFromStringAndFormat(tempConfig);
|
18546 |
|
18547 | if (!isValid(tempConfig)) {
|
18548 | continue;
|
18549 | }
|
18550 |
|
18551 | // if there is any input that was not parsed add a penalty for that format
|
18552 | currentScore += getParsingFlags(tempConfig).charsLeftOver;
|
18553 |
|
18554 | //or tokens
|
18555 | currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10;
|
18556 |
|
18557 | getParsingFlags(tempConfig).score = currentScore;
|
18558 |
|
18559 | if (scoreToBeat == null || currentScore < scoreToBeat) {
|
18560 | scoreToBeat = currentScore;
|
18561 | bestMoment = tempConfig;
|
18562 | }
|
18563 | }
|
18564 |
|
18565 | extend(config, bestMoment || tempConfig);
|
18566 | }
|
18567 |
|
18568 | function configFromObject(config) {
|
18569 | if (config._d) {
|
18570 | return;
|
18571 | }
|
18572 |
|
18573 | var i = normalizeObjectUnits(config._i);
|
18574 | config._a = map([i.year, i.month, i.day || i.date, i.hour, i.minute, i.second, i.millisecond], function (obj) {
|
18575 | return obj && parseInt(obj, 10);
|
18576 | });
|
18577 |
|
18578 | configFromArray(config);
|
18579 | }
|
18580 |
|
18581 | function createFromConfig (config) {
|
18582 | var res = new Moment(checkOverflow(prepareConfig(config)));
|
18583 | if (res._nextDay) {
|
18584 | // Adding is smart enough around DST
|
18585 | res.add(1, 'd');
|
18586 | res._nextDay = undefined;
|
18587 | }
|
18588 |
|
18589 | return res;
|
18590 | }
|
18591 |
|
18592 | function prepareConfig (config) {
|
18593 | var input = config._i,
|
18594 | format = config._f;
|
18595 |
|
18596 | config._locale = config._locale || getLocale(config._l);
|
18597 |
|
18598 | if (input === null || (format === undefined && input === '')) {
|
18599 | return createInvalid({nullInput: true});
|
18600 | }
|
18601 |
|
18602 | if (typeof input === 'string') {
|
18603 | config._i = input = config._locale.preparse(input);
|
18604 | }
|
18605 |
|
18606 | if (isMoment(input)) {
|
18607 | return new Moment(checkOverflow(input));
|
18608 | } else if (isDate(input)) {
|
18609 | config._d = input;
|
18610 | } else if (isArray(format)) {
|
18611 | configFromStringAndArray(config);
|
18612 | } else if (format) {
|
18613 | configFromStringAndFormat(config);
|
18614 | } else {
|
18615 | configFromInput(config);
|
18616 | }
|
18617 |
|
18618 | if (!isValid(config)) {
|
18619 | config._d = null;
|
18620 | }
|
18621 |
|
18622 | return config;
|
18623 | }
|
18624 |
|
18625 | function configFromInput(config) {
|
18626 | var input = config._i;
|
18627 | if (isUndefined(input)) {
|
18628 | config._d = new Date(hooks.now());
|
18629 | } else if (isDate(input)) {
|
18630 | config._d = new Date(input.valueOf());
|
18631 | } else if (typeof input === 'string') {
|
18632 | configFromString(config);
|
18633 | } else if (isArray(input)) {
|
18634 | config._a = map(input.slice(0), function (obj) {
|
18635 | return parseInt(obj, 10);
|
18636 | });
|
18637 | configFromArray(config);
|
18638 | } else if (isObject(input)) {
|
18639 | configFromObject(config);
|
18640 | } else if (isNumber(input)) {
|
18641 | // from milliseconds
|
18642 | config._d = new Date(input);
|
18643 | } else {
|
18644 | hooks.createFromInputFallback(config);
|
18645 | }
|
18646 | }
|
18647 |
|
18648 | function createLocalOrUTC (input, format, locale, strict, isUTC) {
|
18649 | var c = {};
|
18650 |
|
18651 | if (locale === true || locale === false) {
|
18652 | strict = locale;
|
18653 | locale = undefined;
|
18654 | }
|
18655 |
|
18656 | if ((isObject(input) && isObjectEmpty(input)) ||
|
18657 | (isArray(input) && input.length === 0)) {
|
18658 | input = undefined;
|
18659 | }
|
18660 | // object construction must be done this way.
|
18661 | // https://github.com/moment/moment/issues/1423
|
18662 | c._isAMomentObject = true;
|
18663 | c._useUTC = c._isUTC = isUTC;
|
18664 | c._l = locale;
|
18665 | c._i = input;
|
18666 | c._f = format;
|
18667 | c._strict = strict;
|
18668 |
|
18669 | return createFromConfig(c);
|
18670 | }
|
18671 |
|
18672 | function createLocal (input, format, locale, strict) {
|
18673 | return createLocalOrUTC(input, format, locale, strict, false);
|
18674 | }
|
18675 |
|
18676 | var prototypeMin = deprecate(
|
18677 | 'moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/',
|
18678 | function () {
|
18679 | var other = createLocal.apply(null, arguments);
|
18680 | if (this.isValid() && other.isValid()) {
|
18681 | return other < this ? this : other;
|
18682 | } else {
|
18683 | return createInvalid();
|
18684 | }
|
18685 | }
|
18686 | );
|
18687 |
|
18688 | var prototypeMax = deprecate(
|
18689 | 'moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/',
|
18690 | function () {
|
18691 | var other = createLocal.apply(null, arguments);
|
18692 | if (this.isValid() && other.isValid()) {
|
18693 | return other > this ? this : other;
|
18694 | } else {
|
18695 | return createInvalid();
|
18696 | }
|
18697 | }
|
18698 | );
|
18699 |
|
18700 | // Pick a moment m from moments so that m[fn](other) is true for all
|
18701 | // other. This relies on the function fn to be transitive.
|
18702 | //
|
18703 | // moments should either be an array of moment objects or an array, whose
|
18704 | // first element is an array of moment objects.
|
18705 | function pickBy(fn, moments) {
|
18706 | var res, i;
|
18707 | if (moments.length === 1 && isArray(moments[0])) {
|
18708 | moments = moments[0];
|
18709 | }
|
18710 | if (!moments.length) {
|
18711 | return createLocal();
|
18712 | }
|
18713 | res = moments[0];
|
18714 | for (i = 1; i < moments.length; ++i) {
|
18715 | if (!moments[i].isValid() || moments[i][fn](res)) {
|
18716 | res = moments[i];
|
18717 | }
|
18718 | }
|
18719 | return res;
|
18720 | }
|
18721 |
|
18722 | // TODO: Use [].sort instead?
|
18723 | function min () {
|
18724 | var args = [].slice.call(arguments, 0);
|
18725 |
|
18726 | return pickBy('isBefore', args);
|
18727 | }
|
18728 |
|
18729 | function max () {
|
18730 | var args = [].slice.call(arguments, 0);
|
18731 |
|
18732 | return pickBy('isAfter', args);
|
18733 | }
|
18734 |
|
18735 | var now = function () {
|
18736 | return Date.now ? Date.now() : +(new Date());
|
18737 | };
|
18738 |
|
18739 | var ordering = ['year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', 'millisecond'];
|
18740 |
|
18741 | function isDurationValid(m) {
|
18742 | for (var key in m) {
|
18743 | if (!(indexOf.call(ordering, key) !== -1 && (m[key] == null || !isNaN(m[key])))) {
|
18744 | return false;
|
18745 | }
|
18746 | }
|
18747 |
|
18748 | var unitHasDecimal = false;
|
18749 | for (var i = 0; i < ordering.length; ++i) {
|
18750 | if (m[ordering[i]]) {
|
18751 | if (unitHasDecimal) {
|
18752 | return false; // only allow non-integers for smallest unit
|
18753 | }
|
18754 | if (parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]])) {
|
18755 | unitHasDecimal = true;
|
18756 | }
|
18757 | }
|
18758 | }
|
18759 |
|
18760 | return true;
|
18761 | }
|
18762 |
|
18763 | function isValid$1() {
|
18764 | return this._isValid;
|
18765 | }
|
18766 |
|
18767 | function createInvalid$1() {
|
18768 | return createDuration(NaN);
|
18769 | }
|
18770 |
|
18771 | function Duration (duration) {
|
18772 | var normalizedInput = normalizeObjectUnits(duration),
|
18773 | years = normalizedInput.year || 0,
|
18774 | quarters = normalizedInput.quarter || 0,
|
18775 | months = normalizedInput.month || 0,
|
18776 | weeks = normalizedInput.week || normalizedInput.isoWeek || 0,
|
18777 | days = normalizedInput.day || 0,
|
18778 | hours = normalizedInput.hour || 0,
|
18779 | minutes = normalizedInput.minute || 0,
|
18780 | seconds = normalizedInput.second || 0,
|
18781 | milliseconds = normalizedInput.millisecond || 0;
|
18782 |
|
18783 | this._isValid = isDurationValid(normalizedInput);
|
18784 |
|
18785 | // representation for dateAddRemove
|
18786 | this._milliseconds = +milliseconds +
|
18787 | seconds * 1e3 + // 1000
|
18788 | minutes * 6e4 + // 1000 * 60
|
18789 | hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978
|
18790 | // Because of dateAddRemove treats 24 hours as different from a
|
18791 | // day when working around DST, we need to store them separately
|
18792 | this._days = +days +
|
18793 | weeks * 7;
|
18794 | // It is impossible to translate months into days without knowing
|
18795 | // which months you are are talking about, so we have to store
|
18796 | // it separately.
|
18797 | this._months = +months +
|
18798 | quarters * 3 +
|
18799 | years * 12;
|
18800 |
|
18801 | this._data = {};
|
18802 |
|
18803 | this._locale = getLocale();
|
18804 |
|
18805 | this._bubble();
|
18806 | }
|
18807 |
|
18808 | function isDuration (obj) {
|
18809 | return obj instanceof Duration;
|
18810 | }
|
18811 |
|
18812 | function absRound (number) {
|
18813 | if (number < 0) {
|
18814 | return Math.round(-1 * number) * -1;
|
18815 | } else {
|
18816 | return Math.round(number);
|
18817 | }
|
18818 | }
|
18819 |
|
18820 | // FORMATTING
|
18821 |
|
18822 | function offset (token, separator) {
|
18823 | addFormatToken(token, 0, 0, function () {
|
18824 | var offset = this.utcOffset();
|
18825 | var sign = '+';
|
18826 | if (offset < 0) {
|
18827 | offset = -offset;
|
18828 | sign = '-';
|
18829 | }
|
18830 | return sign + zeroFill(~~(offset / 60), 2) + separator + zeroFill(~~(offset) % 60, 2);
|
18831 | });
|
18832 | }
|
18833 |
|
18834 | offset('Z', ':');
|
18835 | offset('ZZ', '');
|
18836 |
|
18837 | // PARSING
|
18838 |
|
18839 | addRegexToken('Z', matchShortOffset);
|
18840 | addRegexToken('ZZ', matchShortOffset);
|
18841 | addParseToken(['Z', 'ZZ'], function (input, array, config) {
|
18842 | config._useUTC = true;
|
18843 | config._tzm = offsetFromString(matchShortOffset, input);
|
18844 | });
|
18845 |
|
18846 | // HELPERS
|
18847 |
|
18848 | // timezone chunker
|
18849 | // '+10:00' > ['10', '00']
|
18850 | // '-1530' > ['-15', '30']
|
18851 | var chunkOffset = /([\+\-]|\d\d)/gi;
|
18852 |
|
18853 | function offsetFromString(matcher, string) {
|
18854 | var matches = (string || '').match(matcher);
|
18855 |
|
18856 | if (matches === null) {
|
18857 | return null;
|
18858 | }
|
18859 |
|
18860 | var chunk = matches[matches.length - 1] || [];
|
18861 | var parts = (chunk + '').match(chunkOffset) || ['-', 0, 0];
|
18862 | var minutes = +(parts[1] * 60) + toInt(parts[2]);
|
18863 |
|
18864 | return minutes === 0 ?
|
18865 | 0 :
|
18866 | parts[0] === '+' ? minutes : -minutes;
|
18867 | }
|
18868 |
|
18869 | // Return a moment from input, that is local/utc/zone equivalent to model.
|
18870 | function cloneWithOffset(input, model) {
|
18871 | var res, diff;
|
18872 | if (model._isUTC) {
|
18873 | res = model.clone();
|
18874 | diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();
|
18875 | // Use low-level api, because this fn is low-level api.
|
18876 | res._d.setTime(res._d.valueOf() + diff);
|
18877 | hooks.updateOffset(res, false);
|
18878 | return res;
|
18879 | } else {
|
18880 | return createLocal(input).local();
|
18881 | }
|
18882 | }
|
18883 |
|
18884 | function getDateOffset (m) {
|
18885 | // On Firefox.24 Date#getTimezoneOffset returns a floating point.
|
18886 | // https://github.com/moment/moment/pull/1871
|
18887 | return -Math.round(m._d.getTimezoneOffset() / 15) * 15;
|
18888 | }
|
18889 |
|
18890 | // HOOKS
|
18891 |
|
18892 | // This function will be called whenever a moment is mutated.
|
18893 | // It is intended to keep the offset in sync with the timezone.
|
18894 | hooks.updateOffset = function () {};
|
18895 |
|
18896 | // MOMENTS
|
18897 |
|
18898 | // keepLocalTime = true means only change the timezone, without
|
18899 | // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]-->
|
18900 | // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset
|
18901 | // +0200, so we adjust the time as needed, to be valid.
|
18902 | //
|
18903 | // Keeping the time actually adds/subtracts (one hour)
|
18904 | // from the actual represented time. That is why we call updateOffset
|
18905 | // a second time. In case it wants us to change the offset again
|
18906 | // _changeInProgress == true case, then we have to adjust, because
|
18907 | // there is no such time in the given timezone.
|
18908 | function getSetOffset (input, keepLocalTime, keepMinutes) {
|
18909 | var offset = this._offset || 0,
|
18910 | localAdjust;
|
18911 | if (!this.isValid()) {
|
18912 | return input != null ? this : NaN;
|
18913 | }
|
18914 | if (input != null) {
|
18915 | if (typeof input === 'string') {
|
18916 | input = offsetFromString(matchShortOffset, input);
|
18917 | if (input === null) {
|
18918 | return this;
|
18919 | }
|
18920 | } else if (Math.abs(input) < 16 && !keepMinutes) {
|
18921 | input = input * 60;
|
18922 | }
|
18923 | if (!this._isUTC && keepLocalTime) {
|
18924 | localAdjust = getDateOffset(this);
|
18925 | }
|
18926 | this._offset = input;
|
18927 | this._isUTC = true;
|
18928 | if (localAdjust != null) {
|
18929 | this.add(localAdjust, 'm');
|
18930 | }
|
18931 | if (offset !== input) {
|
18932 | if (!keepLocalTime || this._changeInProgress) {
|
18933 | addSubtract(this, createDuration(input - offset, 'm'), 1, false);
|
18934 | } else if (!this._changeInProgress) {
|
18935 | this._changeInProgress = true;
|
18936 | hooks.updateOffset(this, true);
|
18937 | this._changeInProgress = null;
|
18938 | }
|
18939 | }
|
18940 | return this;
|
18941 | } else {
|
18942 | return this._isUTC ? offset : getDateOffset(this);
|
18943 | }
|
18944 | }
|
18945 |
|
18946 | function getSetZone (input, keepLocalTime) {
|
18947 | if (input != null) {
|
18948 | if (typeof input !== 'string') {
|
18949 | input = -input;
|
18950 | }
|
18951 |
|
18952 | this.utcOffset(input, keepLocalTime);
|
18953 |
|
18954 | return this;
|
18955 | } else {
|
18956 | return -this.utcOffset();
|
18957 | }
|
18958 | }
|
18959 |
|
18960 | function setOffsetToUTC (keepLocalTime) {
|
18961 | return this.utcOffset(0, keepLocalTime);
|
18962 | }
|
18963 |
|
18964 | function setOffsetToLocal (keepLocalTime) {
|
18965 | if (this._isUTC) {
|
18966 | this.utcOffset(0, keepLocalTime);
|
18967 | this._isUTC = false;
|
18968 |
|
18969 | if (keepLocalTime) {
|
18970 | this.subtract(getDateOffset(this), 'm');
|
18971 | }
|
18972 | }
|
18973 | return this;
|
18974 | }
|
18975 |
|
18976 | function setOffsetToParsedOffset () {
|
18977 | if (this._tzm != null) {
|
18978 | this.utcOffset(this._tzm, false, true);
|
18979 | } else if (typeof this._i === 'string') {
|
18980 | var tZone = offsetFromString(matchOffset, this._i);
|
18981 | if (tZone != null) {
|
18982 | this.utcOffset(tZone);
|
18983 | }
|
18984 | else {
|
18985 | this.utcOffset(0, true);
|
18986 | }
|
18987 | }
|
18988 | return this;
|
18989 | }
|
18990 |
|
18991 | function hasAlignedHourOffset (input) {
|
18992 | if (!this.isValid()) {
|
18993 | return false;
|
18994 | }
|
18995 | input = input ? createLocal(input).utcOffset() : 0;
|
18996 |
|
18997 | return (this.utcOffset() - input) % 60 === 0;
|
18998 | }
|
18999 |
|
19000 | function isDaylightSavingTime () {
|
19001 | return (
|
19002 | this.utcOffset() > this.clone().month(0).utcOffset() ||
|
19003 | this.utcOffset() > this.clone().month(5).utcOffset()
|
19004 | );
|
19005 | }
|
19006 |
|
19007 | function isDaylightSavingTimeShifted () {
|
19008 | if (!isUndefined(this._isDSTShifted)) {
|
19009 | return this._isDSTShifted;
|
19010 | }
|
19011 |
|
19012 | var c = {};
|
19013 |
|
19014 | copyConfig(c, this);
|
19015 | c = prepareConfig(c);
|
19016 |
|
19017 | if (c._a) {
|
19018 | var other = c._isUTC ? createUTC(c._a) : createLocal(c._a);
|
19019 | this._isDSTShifted = this.isValid() &&
|
19020 | compareArrays(c._a, other.toArray()) > 0;
|
19021 | } else {
|
19022 | this._isDSTShifted = false;
|
19023 | }
|
19024 |
|
19025 | return this._isDSTShifted;
|
19026 | }
|
19027 |
|
19028 | function isLocal () {
|
19029 | return this.isValid() ? !this._isUTC : false;
|
19030 | }
|
19031 |
|
19032 | function isUtcOffset () {
|
19033 | return this.isValid() ? this._isUTC : false;
|
19034 | }
|
19035 |
|
19036 | function isUtc () {
|
19037 | return this.isValid() ? this._isUTC && this._offset === 0 : false;
|
19038 | }
|
19039 |
|
19040 | // ASP.NET json date format regex
|
19041 | var aspNetRegex = /^(\-|\+)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/;
|
19042 |
|
19043 | // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html
|
19044 | // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere
|
19045 | // and further modified to allow for strings containing both week and day
|
19046 | var isoRegex = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;
|
19047 |
|
19048 | function createDuration (input, key) {
|
19049 | var duration = input,
|
19050 | // matching against regexp is expensive, do it on demand
|
19051 | match = null,
|
19052 | sign,
|
19053 | ret,
|
19054 | diffRes;
|
19055 |
|
19056 | if (isDuration(input)) {
|
19057 | duration = {
|
19058 | ms : input._milliseconds,
|
19059 | d : input._days,
|
19060 | M : input._months
|
19061 | };
|
19062 | } else if (isNumber(input)) {
|
19063 | duration = {};
|
19064 | if (key) {
|
19065 | duration[key] = input;
|
19066 | } else {
|
19067 | duration.milliseconds = input;
|
19068 | }
|
19069 | } else if (!!(match = aspNetRegex.exec(input))) {
|
19070 | sign = (match[1] === '-') ? -1 : 1;
|
19071 | duration = {
|
19072 | y : 0,
|
19073 | d : toInt(match[DATE]) * sign,
|
19074 | h : toInt(match[HOUR]) * sign,
|
19075 | m : toInt(match[MINUTE]) * sign,
|
19076 | s : toInt(match[SECOND]) * sign,
|
19077 | ms : toInt(absRound(match[MILLISECOND] * 1000)) * sign // the millisecond decimal point is included in the match
|
19078 | };
|
19079 | } else if (!!(match = isoRegex.exec(input))) {
|
19080 | sign = (match[1] === '-') ? -1 : 1;
|
19081 | duration = {
|
19082 | y : parseIso(match[2], sign),
|
19083 | M : parseIso(match[3], sign),
|
19084 | w : parseIso(match[4], sign),
|
19085 | d : parseIso(match[5], sign),
|
19086 | h : parseIso(match[6], sign),
|
19087 | m : parseIso(match[7], sign),
|
19088 | s : parseIso(match[8], sign)
|
19089 | };
|
19090 | } else if (duration == null) {// checks for null or undefined
|
19091 | duration = {};
|
19092 | } else if (typeof duration === 'object' && ('from' in duration || 'to' in duration)) {
|
19093 | diffRes = momentsDifference(createLocal(duration.from), createLocal(duration.to));
|
19094 |
|
19095 | duration = {};
|
19096 | duration.ms = diffRes.milliseconds;
|
19097 | duration.M = diffRes.months;
|
19098 | }
|
19099 |
|
19100 | ret = new Duration(duration);
|
19101 |
|
19102 | if (isDuration(input) && hasOwnProp(input, '_locale')) {
|
19103 | ret._locale = input._locale;
|
19104 | }
|
19105 |
|
19106 | return ret;
|
19107 | }
|
19108 |
|
19109 | createDuration.fn = Duration.prototype;
|
19110 | createDuration.invalid = createInvalid$1;
|
19111 |
|
19112 | function parseIso (inp, sign) {
|
19113 | // We'd normally use ~~inp for this, but unfortunately it also
|
19114 | // converts floats to ints.
|
19115 | // inp may be undefined, so careful calling replace on it.
|
19116 | var res = inp && parseFloat(inp.replace(',', '.'));
|
19117 | // apply sign while we're at it
|
19118 | return (isNaN(res) ? 0 : res) * sign;
|
19119 | }
|
19120 |
|
19121 | function positiveMomentsDifference(base, other) {
|
19122 | var res = {};
|
19123 |
|
19124 | res.months = other.month() - base.month() +
|
19125 | (other.year() - base.year()) * 12;
|
19126 | if (base.clone().add(res.months, 'M').isAfter(other)) {
|
19127 | --res.months;
|
19128 | }
|
19129 |
|
19130 | res.milliseconds = +other - +(base.clone().add(res.months, 'M'));
|
19131 |
|
19132 | return res;
|
19133 | }
|
19134 |
|
19135 | function momentsDifference(base, other) {
|
19136 | var res;
|
19137 | if (!(base.isValid() && other.isValid())) {
|
19138 | return {milliseconds: 0, months: 0};
|
19139 | }
|
19140 |
|
19141 | other = cloneWithOffset(other, base);
|
19142 | if (base.isBefore(other)) {
|
19143 | res = positiveMomentsDifference(base, other);
|
19144 | } else {
|
19145 | res = positiveMomentsDifference(other, base);
|
19146 | res.milliseconds = -res.milliseconds;
|
19147 | res.months = -res.months;
|
19148 | }
|
19149 |
|
19150 | return res;
|
19151 | }
|
19152 |
|
19153 | // TODO: remove 'name' arg after deprecation is removed
|
19154 | function createAdder(direction, name) {
|
19155 | return function (val, period) {
|
19156 | var dur, tmp;
|
19157 | //invert the arguments, but complain about it
|
19158 | if (period !== null && !isNaN(+period)) {
|
19159 | deprecateSimple(name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period). ' +
|
19160 | 'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.');
|
19161 | tmp = val; val = period; period = tmp;
|
19162 | }
|
19163 |
|
19164 | val = typeof val === 'string' ? +val : val;
|
19165 | dur = createDuration(val, period);
|
19166 | addSubtract(this, dur, direction);
|
19167 | return this;
|
19168 | };
|
19169 | }
|
19170 |
|
19171 | function addSubtract (mom, duration, isAdding, updateOffset) {
|
19172 | var milliseconds = duration._milliseconds,
|
19173 | days = absRound(duration._days),
|
19174 | months = absRound(duration._months);
|
19175 |
|
19176 | if (!mom.isValid()) {
|
19177 | // No op
|
19178 | return;
|
19179 | }
|
19180 |
|
19181 | updateOffset = updateOffset == null ? true : updateOffset;
|
19182 |
|
19183 | if (months) {
|
19184 | setMonth(mom, get(mom, 'Month') + months * isAdding);
|
19185 | }
|
19186 | if (days) {
|
19187 | set$1(mom, 'Date', get(mom, 'Date') + days * isAdding);
|
19188 | }
|
19189 | if (milliseconds) {
|
19190 | mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding);
|
19191 | }
|
19192 | if (updateOffset) {
|
19193 | hooks.updateOffset(mom, days || months);
|
19194 | }
|
19195 | }
|
19196 |
|
19197 | var add = createAdder(1, 'add');
|
19198 | var subtract = createAdder(-1, 'subtract');
|
19199 |
|
19200 | function getCalendarFormat(myMoment, now) {
|
19201 | var diff = myMoment.diff(now, 'days', true);
|
19202 | return diff < -6 ? 'sameElse' :
|
19203 | diff < -1 ? 'lastWeek' :
|
19204 | diff < 0 ? 'lastDay' :
|
19205 | diff < 1 ? 'sameDay' :
|
19206 | diff < 2 ? 'nextDay' :
|
19207 | diff < 7 ? 'nextWeek' : 'sameElse';
|
19208 | }
|
19209 |
|
19210 | function calendar$1 (time, formats) {
|
19211 | // We want to compare the start of today, vs this.
|
19212 | // Getting start-of-today depends on whether we're local/utc/offset or not.
|
19213 | var now = time || createLocal(),
|
19214 | sod = cloneWithOffset(now, this).startOf('day'),
|
19215 | format = hooks.calendarFormat(this, sod) || 'sameElse';
|
19216 |
|
19217 | var output = formats && (isFunction(formats[format]) ? formats[format].call(this, now) : formats[format]);
|
19218 |
|
19219 | return this.format(output || this.localeData().calendar(format, this, createLocal(now)));
|
19220 | }
|
19221 |
|
19222 | function clone () {
|
19223 | return new Moment(this);
|
19224 | }
|
19225 |
|
19226 | function isAfter (input, units) {
|
19227 | var localInput = isMoment(input) ? input : createLocal(input);
|
19228 | if (!(this.isValid() && localInput.isValid())) {
|
19229 | return false;
|
19230 | }
|
19231 | units = normalizeUnits(units) || 'millisecond';
|
19232 | if (units === 'millisecond') {
|
19233 | return this.valueOf() > localInput.valueOf();
|
19234 | } else {
|
19235 | return localInput.valueOf() < this.clone().startOf(units).valueOf();
|
19236 | }
|
19237 | }
|
19238 |
|
19239 | function isBefore (input, units) {
|
19240 | var localInput = isMoment(input) ? input : createLocal(input);
|
19241 | if (!(this.isValid() && localInput.isValid())) {
|
19242 | return false;
|
19243 | }
|
19244 | units = normalizeUnits(units) || 'millisecond';
|
19245 | if (units === 'millisecond') {
|
19246 | return this.valueOf() < localInput.valueOf();
|
19247 | } else {
|
19248 | return this.clone().endOf(units).valueOf() < localInput.valueOf();
|
19249 | }
|
19250 | }
|
19251 |
|
19252 | function isBetween (from, to, units, inclusivity) {
|
19253 | var localFrom = isMoment(from) ? from : createLocal(from),
|
19254 | localTo = isMoment(to) ? to : createLocal(to);
|
19255 | if (!(this.isValid() && localFrom.isValid() && localTo.isValid())) {
|
19256 | return false;
|
19257 | }
|
19258 | inclusivity = inclusivity || '()';
|
19259 | return (inclusivity[0] === '(' ? this.isAfter(localFrom, units) : !this.isBefore(localFrom, units)) &&
|
19260 | (inclusivity[1] === ')' ? this.isBefore(localTo, units) : !this.isAfter(localTo, units));
|
19261 | }
|
19262 |
|
19263 | function isSame (input, units) {
|
19264 | var localInput = isMoment(input) ? input : createLocal(input),
|
19265 | inputMs;
|
19266 | if (!(this.isValid() && localInput.isValid())) {
|
19267 | return false;
|
19268 | }
|
19269 | units = normalizeUnits(units) || 'millisecond';
|
19270 | if (units === 'millisecond') {
|
19271 | return this.valueOf() === localInput.valueOf();
|
19272 | } else {
|
19273 | inputMs = localInput.valueOf();
|
19274 | return this.clone().startOf(units).valueOf() <= inputMs && inputMs <= this.clone().endOf(units).valueOf();
|
19275 | }
|
19276 | }
|
19277 |
|
19278 | function isSameOrAfter (input, units) {
|
19279 | return this.isSame(input, units) || this.isAfter(input, units);
|
19280 | }
|
19281 |
|
19282 | function isSameOrBefore (input, units) {
|
19283 | return this.isSame(input, units) || this.isBefore(input, units);
|
19284 | }
|
19285 |
|
19286 | function diff (input, units, asFloat) {
|
19287 | var that,
|
19288 | zoneDelta,
|
19289 | output;
|
19290 |
|
19291 | if (!this.isValid()) {
|
19292 | return NaN;
|
19293 | }
|
19294 |
|
19295 | that = cloneWithOffset(input, this);
|
19296 |
|
19297 | if (!that.isValid()) {
|
19298 | return NaN;
|
19299 | }
|
19300 |
|
19301 | zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4;
|
19302 |
|
19303 | units = normalizeUnits(units);
|
19304 |
|
19305 | switch (units) {
|
19306 | case 'year': output = monthDiff(this, that) / 12; break;
|
19307 | case 'month': output = monthDiff(this, that); break;
|
19308 | case 'quarter': output = monthDiff(this, that) / 3; break;
|
19309 | case 'second': output = (this - that) / 1e3; break; // 1000
|
19310 | case 'minute': output = (this - that) / 6e4; break; // 1000 * 60
|
19311 | case 'hour': output = (this - that) / 36e5; break; // 1000 * 60 * 60
|
19312 | case 'day': output = (this - that - zoneDelta) / 864e5; break; // 1000 * 60 * 60 * 24, negate dst
|
19313 | case 'week': output = (this - that - zoneDelta) / 6048e5; break; // 1000 * 60 * 60 * 24 * 7, negate dst
|
19314 | default: output = this - that;
|
19315 | }
|
19316 |
|
19317 | return asFloat ? output : absFloor(output);
|
19318 | }
|
19319 |
|
19320 | function monthDiff (a, b) {
|
19321 | // difference in months
|
19322 | var wholeMonthDiff = ((b.year() - a.year()) * 12) + (b.month() - a.month()),
|
19323 | // b is in (anchor - 1 month, anchor + 1 month)
|
19324 | anchor = a.clone().add(wholeMonthDiff, 'months'),
|
19325 | anchor2, adjust;
|
19326 |
|
19327 | if (b - anchor < 0) {
|
19328 | anchor2 = a.clone().add(wholeMonthDiff - 1, 'months');
|
19329 | // linear across the month
|
19330 | adjust = (b - anchor) / (anchor - anchor2);
|
19331 | } else {
|
19332 | anchor2 = a.clone().add(wholeMonthDiff + 1, 'months');
|
19333 | // linear across the month
|
19334 | adjust = (b - anchor) / (anchor2 - anchor);
|
19335 | }
|
19336 |
|
19337 | //check for negative zero, return zero if negative zero
|
19338 | return -(wholeMonthDiff + adjust) || 0;
|
19339 | }
|
19340 |
|
19341 | hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ';
|
19342 | hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]';
|
19343 |
|
19344 | function toString () {
|
19345 | return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ');
|
19346 | }
|
19347 |
|
19348 | function toISOString(keepOffset) {
|
19349 | if (!this.isValid()) {
|
19350 | return null;
|
19351 | }
|
19352 | var utc = keepOffset !== true;
|
19353 | var m = utc ? this.clone().utc() : this;
|
19354 | if (m.year() < 0 || m.year() > 9999) {
|
19355 | return formatMoment(m, utc ? 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYYYY-MM-DD[T]HH:mm:ss.SSSZ');
|
19356 | }
|
19357 | if (isFunction(Date.prototype.toISOString)) {
|
19358 | // native implementation is ~50x faster, use it when we can
|
19359 | if (utc) {
|
19360 | return this.toDate().toISOString();
|
19361 | } else {
|
19362 | return new Date(this.valueOf() + this.utcOffset() * 60 * 1000).toISOString().replace('Z', formatMoment(m, 'Z'));
|
19363 | }
|
19364 | }
|
19365 | return formatMoment(m, utc ? 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYY-MM-DD[T]HH:mm:ss.SSSZ');
|
19366 | }
|
19367 |
|
19368 | /**
|
19369 | * Return a human readable representation of a moment that can
|
19370 | * also be evaluated to get a new moment which is the same
|
19371 | *
|
19372 | * @link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects
|
19373 | */
|
19374 | function inspect () {
|
19375 | if (!this.isValid()) {
|
19376 | return 'moment.invalid(/* ' + this._i + ' */)';
|
19377 | }
|
19378 | var func = 'moment';
|
19379 | var zone = '';
|
19380 | if (!this.isLocal()) {
|
19381 | func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';
|
19382 | zone = 'Z';
|
19383 | }
|
19384 | var prefix = '[' + func + '("]';
|
19385 | var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';
|
19386 | var datetime = '-MM-DD[T]HH:mm:ss.SSS';
|
19387 | var suffix = zone + '[")]';
|
19388 |
|
19389 | return this.format(prefix + year + datetime + suffix);
|
19390 | }
|
19391 |
|
19392 | function format (inputString) {
|
19393 | if (!inputString) {
|
19394 | inputString = this.isUtc() ? hooks.defaultFormatUtc : hooks.defaultFormat;
|
19395 | }
|
19396 | var output = formatMoment(this, inputString);
|
19397 | return this.localeData().postformat(output);
|
19398 | }
|
19399 |
|
19400 | function from (time, withoutSuffix) {
|
19401 | if (this.isValid() &&
|
19402 | ((isMoment(time) && time.isValid()) ||
|
19403 | createLocal(time).isValid())) {
|
19404 | return createDuration({to: this, from: time}).locale(this.locale()).humanize(!withoutSuffix);
|
19405 | } else {
|
19406 | return this.localeData().invalidDate();
|
19407 | }
|
19408 | }
|
19409 |
|
19410 | function fromNow (withoutSuffix) {
|
19411 | return this.from(createLocal(), withoutSuffix);
|
19412 | }
|
19413 |
|
19414 | function to (time, withoutSuffix) {
|
19415 | if (this.isValid() &&
|
19416 | ((isMoment(time) && time.isValid()) ||
|
19417 | createLocal(time).isValid())) {
|
19418 | return createDuration({from: this, to: time}).locale(this.locale()).humanize(!withoutSuffix);
|
19419 | } else {
|
19420 | return this.localeData().invalidDate();
|
19421 | }
|
19422 | }
|
19423 |
|
19424 | function toNow (withoutSuffix) {
|
19425 | return this.to(createLocal(), withoutSuffix);
|
19426 | }
|
19427 |
|
19428 | // If passed a locale key, it will set the locale for this
|
19429 | // instance. Otherwise, it will return the locale configuration
|
19430 | // variables for this instance.
|
19431 | function locale (key) {
|
19432 | var newLocaleData;
|
19433 |
|
19434 | if (key === undefined) {
|
19435 | return this._locale._abbr;
|
19436 | } else {
|
19437 | newLocaleData = getLocale(key);
|
19438 | if (newLocaleData != null) {
|
19439 | this._locale = newLocaleData;
|
19440 | }
|
19441 | return this;
|
19442 | }
|
19443 | }
|
19444 |
|
19445 | var lang = deprecate(
|
19446 | 'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.',
|
19447 | function (key) {
|
19448 | if (key === undefined) {
|
19449 | return this.localeData();
|
19450 | } else {
|
19451 | return this.locale(key);
|
19452 | }
|
19453 | }
|
19454 | );
|
19455 |
|
19456 | function localeData () {
|
19457 | return this._locale;
|
19458 | }
|
19459 |
|
19460 | var MS_PER_SECOND = 1000;
|
19461 | var MS_PER_MINUTE = 60 * MS_PER_SECOND;
|
19462 | var MS_PER_HOUR = 60 * MS_PER_MINUTE;
|
19463 | var MS_PER_400_YEARS = (365 * 400 + 97) * 24 * MS_PER_HOUR;
|
19464 |
|
19465 | // actual modulo - handles negative numbers (for dates before 1970):
|
19466 | function mod$1(dividend, divisor) {
|
19467 | return (dividend % divisor + divisor) % divisor;
|
19468 | }
|
19469 |
|
19470 | function localStartOfDate(y, m, d) {
|
19471 | // the date constructor remaps years 0-99 to 1900-1999
|
19472 | if (y < 100 && y >= 0) {
|
19473 | // preserve leap years using a full 400 year cycle, then reset
|
19474 | return new Date(y + 400, m, d) - MS_PER_400_YEARS;
|
19475 | } else {
|
19476 | return new Date(y, m, d).valueOf();
|
19477 | }
|
19478 | }
|
19479 |
|
19480 | function utcStartOfDate(y, m, d) {
|
19481 | // Date.UTC remaps years 0-99 to 1900-1999
|
19482 | if (y < 100 && y >= 0) {
|
19483 | // preserve leap years using a full 400 year cycle, then reset
|
19484 | return Date.UTC(y + 400, m, d) - MS_PER_400_YEARS;
|
19485 | } else {
|
19486 | return Date.UTC(y, m, d);
|
19487 | }
|
19488 | }
|
19489 |
|
19490 | function startOf (units) {
|
19491 | var time;
|
19492 | units = normalizeUnits(units);
|
19493 | if (units === undefined || units === 'millisecond' || !this.isValid()) {
|
19494 | return this;
|
19495 | }
|
19496 |
|
19497 | var startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;
|
19498 |
|
19499 | switch (units) {
|
19500 | case 'year':
|
19501 | time = startOfDate(this.year(), 0, 1);
|
19502 | break;
|
19503 | case 'quarter':
|
19504 | time = startOfDate(this.year(), this.month() - this.month() % 3, 1);
|
19505 | break;
|
19506 | case 'month':
|
19507 | time = startOfDate(this.year(), this.month(), 1);
|
19508 | break;
|
19509 | case 'week':
|
19510 | time = startOfDate(this.year(), this.month(), this.date() - this.weekday());
|
19511 | break;
|
19512 | case 'isoWeek':
|
19513 | time = startOfDate(this.year(), this.month(), this.date() - (this.isoWeekday() - 1));
|
19514 | break;
|
19515 | case 'day':
|
19516 | case 'date':
|
19517 | time = startOfDate(this.year(), this.month(), this.date());
|
19518 | break;
|
19519 | case 'hour':
|
19520 | time = this._d.valueOf();
|
19521 | time -= mod$1(time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE), MS_PER_HOUR);
|
19522 | break;
|
19523 | case 'minute':
|
19524 | time = this._d.valueOf();
|
19525 | time -= mod$1(time, MS_PER_MINUTE);
|
19526 | break;
|
19527 | case 'second':
|
19528 | time = this._d.valueOf();
|
19529 | time -= mod$1(time, MS_PER_SECOND);
|
19530 | break;
|
19531 | }
|
19532 |
|
19533 | this._d.setTime(time);
|
19534 | hooks.updateOffset(this, true);
|
19535 | return this;
|
19536 | }
|
19537 |
|
19538 | function endOf (units) {
|
19539 | var time;
|
19540 | units = normalizeUnits(units);
|
19541 | if (units === undefined || units === 'millisecond' || !this.isValid()) {
|
19542 | return this;
|
19543 | }
|
19544 |
|
19545 | var startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;
|
19546 |
|
19547 | switch (units) {
|
19548 | case 'year':
|
19549 | time = startOfDate(this.year() + 1, 0, 1) - 1;
|
19550 | break;
|
19551 | case 'quarter':
|
19552 | time = startOfDate(this.year(), this.month() - this.month() % 3 + 3, 1) - 1;
|
19553 | break;
|
19554 | case 'month':
|
19555 | time = startOfDate(this.year(), this.month() + 1, 1) - 1;
|
19556 | break;
|
19557 | case 'week':
|
19558 | time = startOfDate(this.year(), this.month(), this.date() - this.weekday() + 7) - 1;
|
19559 | break;
|
19560 | case 'isoWeek':
|
19561 | time = startOfDate(this.year(), this.month(), this.date() - (this.isoWeekday() - 1) + 7) - 1;
|
19562 | break;
|
19563 | case 'day':
|
19564 | case 'date':
|
19565 | time = startOfDate(this.year(), this.month(), this.date() + 1) - 1;
|
19566 | break;
|
19567 | case 'hour':
|
19568 | time = this._d.valueOf();
|
19569 | time += MS_PER_HOUR - mod$1(time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE), MS_PER_HOUR) - 1;
|
19570 | break;
|
19571 | case 'minute':
|
19572 | time = this._d.valueOf();
|
19573 | time += MS_PER_MINUTE - mod$1(time, MS_PER_MINUTE) - 1;
|
19574 | break;
|
19575 | case 'second':
|
19576 | time = this._d.valueOf();
|
19577 | time += MS_PER_SECOND - mod$1(time, MS_PER_SECOND) - 1;
|
19578 | break;
|
19579 | }
|
19580 |
|
19581 | this._d.setTime(time);
|
19582 | hooks.updateOffset(this, true);
|
19583 | return this;
|
19584 | }
|
19585 |
|
19586 | function valueOf () {
|
19587 | return this._d.valueOf() - ((this._offset || 0) * 60000);
|
19588 | }
|
19589 |
|
19590 | function unix () {
|
19591 | return Math.floor(this.valueOf() / 1000);
|
19592 | }
|
19593 |
|
19594 | function toDate () {
|
19595 | return new Date(this.valueOf());
|
19596 | }
|
19597 |
|
19598 | function toArray () {
|
19599 | var m = this;
|
19600 | return [m.year(), m.month(), m.date(), m.hour(), m.minute(), m.second(), m.millisecond()];
|
19601 | }
|
19602 |
|
19603 | function toObject () {
|
19604 | var m = this;
|
19605 | return {
|
19606 | years: m.year(),
|
19607 | months: m.month(),
|
19608 | date: m.date(),
|
19609 | hours: m.hours(),
|
19610 | minutes: m.minutes(),
|
19611 | seconds: m.seconds(),
|
19612 | milliseconds: m.milliseconds()
|
19613 | };
|
19614 | }
|
19615 |
|
19616 | function toJSON () {
|
19617 | // new Date(NaN).toJSON() === null
|
19618 | return this.isValid() ? this.toISOString() : null;
|
19619 | }
|
19620 |
|
19621 | function isValid$2 () {
|
19622 | return isValid(this);
|
19623 | }
|
19624 |
|
19625 | function parsingFlags () {
|
19626 | return extend({}, getParsingFlags(this));
|
19627 | }
|
19628 |
|
19629 | function invalidAt () {
|
19630 | return getParsingFlags(this).overflow;
|
19631 | }
|
19632 |
|
19633 | function creationData() {
|
19634 | return {
|
19635 | input: this._i,
|
19636 | format: this._f,
|
19637 | locale: this._locale,
|
19638 | isUTC: this._isUTC,
|
19639 | strict: this._strict
|
19640 | };
|
19641 | }
|
19642 |
|
19643 | // FORMATTING
|
19644 |
|
19645 | addFormatToken(0, ['gg', 2], 0, function () {
|
19646 | return this.weekYear() % 100;
|
19647 | });
|
19648 |
|
19649 | addFormatToken(0, ['GG', 2], 0, function () {
|
19650 | return this.isoWeekYear() % 100;
|
19651 | });
|
19652 |
|
19653 | function addWeekYearFormatToken (token, getter) {
|
19654 | addFormatToken(0, [token, token.length], 0, getter);
|
19655 | }
|
19656 |
|
19657 | addWeekYearFormatToken('gggg', 'weekYear');
|
19658 | addWeekYearFormatToken('ggggg', 'weekYear');
|
19659 | addWeekYearFormatToken('GGGG', 'isoWeekYear');
|
19660 | addWeekYearFormatToken('GGGGG', 'isoWeekYear');
|
19661 |
|
19662 | // ALIASES
|
19663 |
|
19664 | addUnitAlias('weekYear', 'gg');
|
19665 | addUnitAlias('isoWeekYear', 'GG');
|
19666 |
|
19667 | // PRIORITY
|
19668 |
|
19669 | addUnitPriority('weekYear', 1);
|
19670 | addUnitPriority('isoWeekYear', 1);
|
19671 |
|
19672 |
|
19673 | // PARSING
|
19674 |
|
19675 | addRegexToken('G', matchSigned);
|
19676 | addRegexToken('g', matchSigned);
|
19677 | addRegexToken('GG', match1to2, match2);
|
19678 | addRegexToken('gg', match1to2, match2);
|
19679 | addRegexToken('GGGG', match1to4, match4);
|
19680 | addRegexToken('gggg', match1to4, match4);
|
19681 | addRegexToken('GGGGG', match1to6, match6);
|
19682 | addRegexToken('ggggg', match1to6, match6);
|
19683 |
|
19684 | addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (input, week, config, token) {
|
19685 | week[token.substr(0, 2)] = toInt(input);
|
19686 | });
|
19687 |
|
19688 | addWeekParseToken(['gg', 'GG'], function (input, week, config, token) {
|
19689 | week[token] = hooks.parseTwoDigitYear(input);
|
19690 | });
|
19691 |
|
19692 | // MOMENTS
|
19693 |
|
19694 | function getSetWeekYear (input) {
|
19695 | return getSetWeekYearHelper.call(this,
|
19696 | input,
|
19697 | this.week(),
|
19698 | this.weekday(),
|
19699 | this.localeData()._week.dow,
|
19700 | this.localeData()._week.doy);
|
19701 | }
|
19702 |
|
19703 | function getSetISOWeekYear (input) {
|
19704 | return getSetWeekYearHelper.call(this,
|
19705 | input, this.isoWeek(), this.isoWeekday(), 1, 4);
|
19706 | }
|
19707 |
|
19708 | function getISOWeeksInYear () {
|
19709 | return weeksInYear(this.year(), 1, 4);
|
19710 | }
|
19711 |
|
19712 | function getWeeksInYear () {
|
19713 | var weekInfo = this.localeData()._week;
|
19714 | return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy);
|
19715 | }
|
19716 |
|
19717 | function getSetWeekYearHelper(input, week, weekday, dow, doy) {
|
19718 | var weeksTarget;
|
19719 | if (input == null) {
|
19720 | return weekOfYear(this, dow, doy).year;
|
19721 | } else {
|
19722 | weeksTarget = weeksInYear(input, dow, doy);
|
19723 | if (week > weeksTarget) {
|
19724 | week = weeksTarget;
|
19725 | }
|
19726 | return setWeekAll.call(this, input, week, weekday, dow, doy);
|
19727 | }
|
19728 | }
|
19729 |
|
19730 | function setWeekAll(weekYear, week, weekday, dow, doy) {
|
19731 | var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy),
|
19732 | date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear);
|
19733 |
|
19734 | this.year(date.getUTCFullYear());
|
19735 | this.month(date.getUTCMonth());
|
19736 | this.date(date.getUTCDate());
|
19737 | return this;
|
19738 | }
|
19739 |
|
19740 | // FORMATTING
|
19741 |
|
19742 | addFormatToken('Q', 0, 'Qo', 'quarter');
|
19743 |
|
19744 | // ALIASES
|
19745 |
|
19746 | addUnitAlias('quarter', 'Q');
|
19747 |
|
19748 | // PRIORITY
|
19749 |
|
19750 | addUnitPriority('quarter', 7);
|
19751 |
|
19752 | // PARSING
|
19753 |
|
19754 | addRegexToken('Q', match1);
|
19755 | addParseToken('Q', function (input, array) {
|
19756 | array[MONTH] = (toInt(input) - 1) * 3;
|
19757 | });
|
19758 |
|
19759 | // MOMENTS
|
19760 |
|
19761 | function getSetQuarter (input) {
|
19762 | return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3);
|
19763 | }
|
19764 |
|
19765 | // FORMATTING
|
19766 |
|
19767 | addFormatToken('D', ['DD', 2], 'Do', 'date');
|
19768 |
|
19769 | // ALIASES
|
19770 |
|
19771 | addUnitAlias('date', 'D');
|
19772 |
|
19773 | // PRIORITY
|
19774 | addUnitPriority('date', 9);
|
19775 |
|
19776 | // PARSING
|
19777 |
|
19778 | addRegexToken('D', match1to2);
|
19779 | addRegexToken('DD', match1to2, match2);
|
19780 | addRegexToken('Do', function (isStrict, locale) {
|
19781 | // TODO: Remove "ordinalParse" fallback in next major release.
|
19782 | return isStrict ?
|
19783 | (locale._dayOfMonthOrdinalParse || locale._ordinalParse) :
|
19784 | locale._dayOfMonthOrdinalParseLenient;
|
19785 | });
|
19786 |
|
19787 | addParseToken(['D', 'DD'], DATE);
|
19788 | addParseToken('Do', function (input, array) {
|
19789 | array[DATE] = toInt(input.match(match1to2)[0]);
|
19790 | });
|
19791 |
|
19792 | // MOMENTS
|
19793 |
|
19794 | var getSetDayOfMonth = makeGetSet('Date', true);
|
19795 |
|
19796 | // FORMATTING
|
19797 |
|
19798 | addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear');
|
19799 |
|
19800 | // ALIASES
|
19801 |
|
19802 | addUnitAlias('dayOfYear', 'DDD');
|
19803 |
|
19804 | // PRIORITY
|
19805 | addUnitPriority('dayOfYear', 4);
|
19806 |
|
19807 | // PARSING
|
19808 |
|
19809 | addRegexToken('DDD', match1to3);
|
19810 | addRegexToken('DDDD', match3);
|
19811 | addParseToken(['DDD', 'DDDD'], function (input, array, config) {
|
19812 | config._dayOfYear = toInt(input);
|
19813 | });
|
19814 |
|
19815 | // HELPERS
|
19816 |
|
19817 | // MOMENTS
|
19818 |
|
19819 | function getSetDayOfYear (input) {
|
19820 | var dayOfYear = Math.round((this.clone().startOf('day') - this.clone().startOf('year')) / 864e5) + 1;
|
19821 | return input == null ? dayOfYear : this.add((input - dayOfYear), 'd');
|
19822 | }
|
19823 |
|
19824 | // FORMATTING
|
19825 |
|
19826 | addFormatToken('m', ['mm', 2], 0, 'minute');
|
19827 |
|
19828 | // ALIASES
|
19829 |
|
19830 | addUnitAlias('minute', 'm');
|
19831 |
|
19832 | // PRIORITY
|
19833 |
|
19834 | addUnitPriority('minute', 14);
|
19835 |
|
19836 | // PARSING
|
19837 |
|
19838 | addRegexToken('m', match1to2);
|
19839 | addRegexToken('mm', match1to2, match2);
|
19840 | addParseToken(['m', 'mm'], MINUTE);
|
19841 |
|
19842 | // MOMENTS
|
19843 |
|
19844 | var getSetMinute = makeGetSet('Minutes', false);
|
19845 |
|
19846 | // FORMATTING
|
19847 |
|
19848 | addFormatToken('s', ['ss', 2], 0, 'second');
|
19849 |
|
19850 | // ALIASES
|
19851 |
|
19852 | addUnitAlias('second', 's');
|
19853 |
|
19854 | // PRIORITY
|
19855 |
|
19856 | addUnitPriority('second', 15);
|
19857 |
|
19858 | // PARSING
|
19859 |
|
19860 | addRegexToken('s', match1to2);
|
19861 | addRegexToken('ss', match1to2, match2);
|
19862 | addParseToken(['s', 'ss'], SECOND);
|
19863 |
|
19864 | // MOMENTS
|
19865 |
|
19866 | var getSetSecond = makeGetSet('Seconds', false);
|
19867 |
|
19868 | // FORMATTING
|
19869 |
|
19870 | addFormatToken('S', 0, 0, function () {
|
19871 | return ~~(this.millisecond() / 100);
|
19872 | });
|
19873 |
|
19874 | addFormatToken(0, ['SS', 2], 0, function () {
|
19875 | return ~~(this.millisecond() / 10);
|
19876 | });
|
19877 |
|
19878 | addFormatToken(0, ['SSS', 3], 0, 'millisecond');
|
19879 | addFormatToken(0, ['SSSS', 4], 0, function () {
|
19880 | return this.millisecond() * 10;
|
19881 | });
|
19882 | addFormatToken(0, ['SSSSS', 5], 0, function () {
|
19883 | return this.millisecond() * 100;
|
19884 | });
|
19885 | addFormatToken(0, ['SSSSSS', 6], 0, function () {
|
19886 | return this.millisecond() * 1000;
|
19887 | });
|
19888 | addFormatToken(0, ['SSSSSSS', 7], 0, function () {
|
19889 | return this.millisecond() * 10000;
|
19890 | });
|
19891 | addFormatToken(0, ['SSSSSSSS', 8], 0, function () {
|
19892 | return this.millisecond() * 100000;
|
19893 | });
|
19894 | addFormatToken(0, ['SSSSSSSSS', 9], 0, function () {
|
19895 | return this.millisecond() * 1000000;
|
19896 | });
|
19897 |
|
19898 |
|
19899 | // ALIASES
|
19900 |
|
19901 | addUnitAlias('millisecond', 'ms');
|
19902 |
|
19903 | // PRIORITY
|
19904 |
|
19905 | addUnitPriority('millisecond', 16);
|
19906 |
|
19907 | // PARSING
|
19908 |
|
19909 | addRegexToken('S', match1to3, match1);
|
19910 | addRegexToken('SS', match1to3, match2);
|
19911 | addRegexToken('SSS', match1to3, match3);
|
19912 |
|
19913 | var token;
|
19914 | for (token = 'SSSS'; token.length <= 9; token += 'S') {
|
19915 | addRegexToken(token, matchUnsigned);
|
19916 | }
|
19917 |
|
19918 | function parseMs(input, array) {
|
19919 | array[MILLISECOND] = toInt(('0.' + input) * 1000);
|
19920 | }
|
19921 |
|
19922 | for (token = 'S'; token.length <= 9; token += 'S') {
|
19923 | addParseToken(token, parseMs);
|
19924 | }
|
19925 | // MOMENTS
|
19926 |
|
19927 | var getSetMillisecond = makeGetSet('Milliseconds', false);
|
19928 |
|
19929 | // FORMATTING
|
19930 |
|
19931 | addFormatToken('z', 0, 0, 'zoneAbbr');
|
19932 | addFormatToken('zz', 0, 0, 'zoneName');
|
19933 |
|
19934 | // MOMENTS
|
19935 |
|
19936 | function getZoneAbbr () {
|
19937 | return this._isUTC ? 'UTC' : '';
|
19938 | }
|
19939 |
|
19940 | function getZoneName () {
|
19941 | return this._isUTC ? 'Coordinated Universal Time' : '';
|
19942 | }
|
19943 |
|
19944 | var proto = Moment.prototype;
|
19945 |
|
19946 | proto.add = add;
|
19947 | proto.calendar = calendar$1;
|
19948 | proto.clone = clone;
|
19949 | proto.diff = diff;
|
19950 | proto.endOf = endOf;
|
19951 | proto.format = format;
|
19952 | proto.from = from;
|
19953 | proto.fromNow = fromNow;
|
19954 | proto.to = to;
|
19955 | proto.toNow = toNow;
|
19956 | proto.get = stringGet;
|
19957 | proto.invalidAt = invalidAt;
|
19958 | proto.isAfter = isAfter;
|
19959 | proto.isBefore = isBefore;
|
19960 | proto.isBetween = isBetween;
|
19961 | proto.isSame = isSame;
|
19962 | proto.isSameOrAfter = isSameOrAfter;
|
19963 | proto.isSameOrBefore = isSameOrBefore;
|
19964 | proto.isValid = isValid$2;
|
19965 | proto.lang = lang;
|
19966 | proto.locale = locale;
|
19967 | proto.localeData = localeData;
|
19968 | proto.max = prototypeMax;
|
19969 | proto.min = prototypeMin;
|
19970 | proto.parsingFlags = parsingFlags;
|
19971 | proto.set = stringSet;
|
19972 | proto.startOf = startOf;
|
19973 | proto.subtract = subtract;
|
19974 | proto.toArray = toArray;
|
19975 | proto.toObject = toObject;
|
19976 | proto.toDate = toDate;
|
19977 | proto.toISOString = toISOString;
|
19978 | proto.inspect = inspect;
|
19979 | proto.toJSON = toJSON;
|
19980 | proto.toString = toString;
|
19981 | proto.unix = unix;
|
19982 | proto.valueOf = valueOf;
|
19983 | proto.creationData = creationData;
|
19984 | proto.year = getSetYear;
|
19985 | proto.isLeapYear = getIsLeapYear;
|
19986 | proto.weekYear = getSetWeekYear;
|
19987 | proto.isoWeekYear = getSetISOWeekYear;
|
19988 | proto.quarter = proto.quarters = getSetQuarter;
|
19989 | proto.month = getSetMonth;
|
19990 | proto.daysInMonth = getDaysInMonth;
|
19991 | proto.week = proto.weeks = getSetWeek;
|
19992 | proto.isoWeek = proto.isoWeeks = getSetISOWeek;
|
19993 | proto.weeksInYear = getWeeksInYear;
|
19994 | proto.isoWeeksInYear = getISOWeeksInYear;
|
19995 | proto.date = getSetDayOfMonth;
|
19996 | proto.day = proto.days = getSetDayOfWeek;
|
19997 | proto.weekday = getSetLocaleDayOfWeek;
|
19998 | proto.isoWeekday = getSetISODayOfWeek;
|
19999 | proto.dayOfYear = getSetDayOfYear;
|
20000 | proto.hour = proto.hours = getSetHour;
|
20001 | proto.minute = proto.minutes = getSetMinute;
|
20002 | proto.second = proto.seconds = getSetSecond;
|
20003 | proto.millisecond = proto.milliseconds = getSetMillisecond;
|
20004 | proto.utcOffset = getSetOffset;
|
20005 | proto.utc = setOffsetToUTC;
|
20006 | proto.local = setOffsetToLocal;
|
20007 | proto.parseZone = setOffsetToParsedOffset;
|
20008 | proto.hasAlignedHourOffset = hasAlignedHourOffset;
|
20009 | proto.isDST = isDaylightSavingTime;
|
20010 | proto.isLocal = isLocal;
|
20011 | proto.isUtcOffset = isUtcOffset;
|
20012 | proto.isUtc = isUtc;
|
20013 | proto.isUTC = isUtc;
|
20014 | proto.zoneAbbr = getZoneAbbr;
|
20015 | proto.zoneName = getZoneName;
|
20016 | proto.dates = deprecate('dates accessor is deprecated. Use date instead.', getSetDayOfMonth);
|
20017 | proto.months = deprecate('months accessor is deprecated. Use month instead', getSetMonth);
|
20018 | proto.years = deprecate('years accessor is deprecated. Use year instead', getSetYear);
|
20019 | proto.zone = deprecate('moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/', getSetZone);
|
20020 | proto.isDSTShifted = deprecate('isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information', isDaylightSavingTimeShifted);
|
20021 |
|
20022 | function createUnix (input) {
|
20023 | return createLocal(input * 1000);
|
20024 | }
|
20025 |
|
20026 | function createInZone () {
|
20027 | return createLocal.apply(null, arguments).parseZone();
|
20028 | }
|
20029 |
|
20030 | function preParsePostFormat (string) {
|
20031 | return string;
|
20032 | }
|
20033 |
|
20034 | var proto$1 = Locale.prototype;
|
20035 |
|
20036 | proto$1.calendar = calendar;
|
20037 | proto$1.longDateFormat = longDateFormat;
|
20038 | proto$1.invalidDate = invalidDate;
|
20039 | proto$1.ordinal = ordinal;
|
20040 | proto$1.preparse = preParsePostFormat;
|
20041 | proto$1.postformat = preParsePostFormat;
|
20042 | proto$1.relativeTime = relativeTime;
|
20043 | proto$1.pastFuture = pastFuture;
|
20044 | proto$1.set = set;
|
20045 |
|
20046 | proto$1.months = localeMonths;
|
20047 | proto$1.monthsShort = localeMonthsShort;
|
20048 | proto$1.monthsParse = localeMonthsParse;
|
20049 | proto$1.monthsRegex = monthsRegex;
|
20050 | proto$1.monthsShortRegex = monthsShortRegex;
|
20051 | proto$1.week = localeWeek;
|
20052 | proto$1.firstDayOfYear = localeFirstDayOfYear;
|
20053 | proto$1.firstDayOfWeek = localeFirstDayOfWeek;
|
20054 |
|
20055 | proto$1.weekdays = localeWeekdays;
|
20056 | proto$1.weekdaysMin = localeWeekdaysMin;
|
20057 | proto$1.weekdaysShort = localeWeekdaysShort;
|
20058 | proto$1.weekdaysParse = localeWeekdaysParse;
|
20059 |
|
20060 | proto$1.weekdaysRegex = weekdaysRegex;
|
20061 | proto$1.weekdaysShortRegex = weekdaysShortRegex;
|
20062 | proto$1.weekdaysMinRegex = weekdaysMinRegex;
|
20063 |
|
20064 | proto$1.isPM = localeIsPM;
|
20065 | proto$1.meridiem = localeMeridiem;
|
20066 |
|
20067 | function get$1 (format, index, field, setter) {
|
20068 | var locale = getLocale();
|
20069 | var utc = createUTC().set(setter, index);
|
20070 | return locale[field](utc, format);
|
20071 | }
|
20072 |
|
20073 | function listMonthsImpl (format, index, field) {
|
20074 | if (isNumber(format)) {
|
20075 | index = format;
|
20076 | format = undefined;
|
20077 | }
|
20078 |
|
20079 | format = format || '';
|
20080 |
|
20081 | if (index != null) {
|
20082 | return get$1(format, index, field, 'month');
|
20083 | }
|
20084 |
|
20085 | var i;
|
20086 | var out = [];
|
20087 | for (i = 0; i < 12; i++) {
|
20088 | out[i] = get$1(format, i, field, 'month');
|
20089 | }
|
20090 | return out;
|
20091 | }
|
20092 |
|
20093 | // ()
|
20094 | // (5)
|
20095 | // (fmt, 5)
|
20096 | // (fmt)
|
20097 | // (true)
|
20098 | // (true, 5)
|
20099 | // (true, fmt, 5)
|
20100 | // (true, fmt)
|
20101 | function listWeekdaysImpl (localeSorted, format, index, field) {
|
20102 | if (typeof localeSorted === 'boolean') {
|
20103 | if (isNumber(format)) {
|
20104 | index = format;
|
20105 | format = undefined;
|
20106 | }
|
20107 |
|
20108 | format = format || '';
|
20109 | } else {
|
20110 | format = localeSorted;
|
20111 | index = format;
|
20112 | localeSorted = false;
|
20113 |
|
20114 | if (isNumber(format)) {
|
20115 | index = format;
|
20116 | format = undefined;
|
20117 | }
|
20118 |
|
20119 | format = format || '';
|
20120 | }
|
20121 |
|
20122 | var locale = getLocale(),
|
20123 | shift = localeSorted ? locale._week.dow : 0;
|
20124 |
|
20125 | if (index != null) {
|
20126 | return get$1(format, (index + shift) % 7, field, 'day');
|
20127 | }
|
20128 |
|
20129 | var i;
|
20130 | var out = [];
|
20131 | for (i = 0; i < 7; i++) {
|
20132 | out[i] = get$1(format, (i + shift) % 7, field, 'day');
|
20133 | }
|
20134 | return out;
|
20135 | }
|
20136 |
|
20137 | function listMonths (format, index) {
|
20138 | return listMonthsImpl(format, index, 'months');
|
20139 | }
|
20140 |
|
20141 | function listMonthsShort (format, index) {
|
20142 | return listMonthsImpl(format, index, 'monthsShort');
|
20143 | }
|
20144 |
|
20145 | function listWeekdays (localeSorted, format, index) {
|
20146 | return listWeekdaysImpl(localeSorted, format, index, 'weekdays');
|
20147 | }
|
20148 |
|
20149 | function listWeekdaysShort (localeSorted, format, index) {
|
20150 | return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort');
|
20151 | }
|
20152 |
|
20153 | function listWeekdaysMin (localeSorted, format, index) {
|
20154 | return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin');
|
20155 | }
|
20156 |
|
20157 | getSetGlobalLocale('en', {
|
20158 | dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/,
|
20159 | ordinal : function (number) {
|
20160 | var b = number % 10,
|
20161 | output = (toInt(number % 100 / 10) === 1) ? 'th' :
|
20162 | (b === 1) ? 'st' :
|
20163 | (b === 2) ? 'nd' :
|
20164 | (b === 3) ? 'rd' : 'th';
|
20165 | return number + output;
|
20166 | }
|
20167 | });
|
20168 |
|
20169 | // Side effect imports
|
20170 |
|
20171 | hooks.lang = deprecate('moment.lang is deprecated. Use moment.locale instead.', getSetGlobalLocale);
|
20172 | hooks.langData = deprecate('moment.langData is deprecated. Use moment.localeData instead.', getLocale);
|
20173 |
|
20174 | var mathAbs = Math.abs;
|
20175 |
|
20176 | function abs () {
|
20177 | var data = this._data;
|
20178 |
|
20179 | this._milliseconds = mathAbs(this._milliseconds);
|
20180 | this._days = mathAbs(this._days);
|
20181 | this._months = mathAbs(this._months);
|
20182 |
|
20183 | data.milliseconds = mathAbs(data.milliseconds);
|
20184 | data.seconds = mathAbs(data.seconds);
|
20185 | data.minutes = mathAbs(data.minutes);
|
20186 | data.hours = mathAbs(data.hours);
|
20187 | data.months = mathAbs(data.months);
|
20188 | data.years = mathAbs(data.years);
|
20189 |
|
20190 | return this;
|
20191 | }
|
20192 |
|
20193 | function addSubtract$1 (duration, input, value, direction) {
|
20194 | var other = createDuration(input, value);
|
20195 |
|
20196 | duration._milliseconds += direction * other._milliseconds;
|
20197 | duration._days += direction * other._days;
|
20198 | duration._months += direction * other._months;
|
20199 |
|
20200 | return duration._bubble();
|
20201 | }
|
20202 |
|
20203 | // supports only 2.0-style add(1, 's') or add(duration)
|
20204 | function add$1 (input, value) {
|
20205 | return addSubtract$1(this, input, value, 1);
|
20206 | }
|
20207 |
|
20208 | // supports only 2.0-style subtract(1, 's') or subtract(duration)
|
20209 | function subtract$1 (input, value) {
|
20210 | return addSubtract$1(this, input, value, -1);
|
20211 | }
|
20212 |
|
20213 | function absCeil (number) {
|
20214 | if (number < 0) {
|
20215 | return Math.floor(number);
|
20216 | } else {
|
20217 | return Math.ceil(number);
|
20218 | }
|
20219 | }
|
20220 |
|
20221 | function bubble () {
|
20222 | var milliseconds = this._milliseconds;
|
20223 | var days = this._days;
|
20224 | var months = this._months;
|
20225 | var data = this._data;
|
20226 | var seconds, minutes, hours, years, monthsFromDays;
|
20227 |
|
20228 | // if we have a mix of positive and negative values, bubble down first
|
20229 | // check: https://github.com/moment/moment/issues/2166
|
20230 | if (!((milliseconds >= 0 && days >= 0 && months >= 0) ||
|
20231 | (milliseconds <= 0 && days <= 0 && months <= 0))) {
|
20232 | milliseconds += absCeil(monthsToDays(months) + days) * 864e5;
|
20233 | days = 0;
|
20234 | months = 0;
|
20235 | }
|
20236 |
|
20237 | // The following code bubbles up values, see the tests for
|
20238 | // examples of what that means.
|
20239 | data.milliseconds = milliseconds % 1000;
|
20240 |
|
20241 | seconds = absFloor(milliseconds / 1000);
|
20242 | data.seconds = seconds % 60;
|
20243 |
|
20244 | minutes = absFloor(seconds / 60);
|
20245 | data.minutes = minutes % 60;
|
20246 |
|
20247 | hours = absFloor(minutes / 60);
|
20248 | data.hours = hours % 24;
|
20249 |
|
20250 | days += absFloor(hours / 24);
|
20251 |
|
20252 | // convert days to months
|
20253 | monthsFromDays = absFloor(daysToMonths(days));
|
20254 | months += monthsFromDays;
|
20255 | days -= absCeil(monthsToDays(monthsFromDays));
|
20256 |
|
20257 | // 12 months -> 1 year
|
20258 | years = absFloor(months / 12);
|
20259 | months %= 12;
|
20260 |
|
20261 | data.days = days;
|
20262 | data.months = months;
|
20263 | data.years = years;
|
20264 |
|
20265 | return this;
|
20266 | }
|
20267 |
|
20268 | function daysToMonths (days) {
|
20269 | // 400 years have 146097 days (taking into account leap year rules)
|
20270 | // 400 years have 12 months === 4800
|
20271 | return days * 4800 / 146097;
|
20272 | }
|
20273 |
|
20274 | function monthsToDays (months) {
|
20275 | // the reverse of daysToMonths
|
20276 | return months * 146097 / 4800;
|
20277 | }
|
20278 |
|
20279 | function as (units) {
|
20280 | if (!this.isValid()) {
|
20281 | return NaN;
|
20282 | }
|
20283 | var days;
|
20284 | var months;
|
20285 | var milliseconds = this._milliseconds;
|
20286 |
|
20287 | units = normalizeUnits(units);
|
20288 |
|
20289 | if (units === 'month' || units === 'quarter' || units === 'year') {
|
20290 | days = this._days + milliseconds / 864e5;
|
20291 | months = this._months + daysToMonths(days);
|
20292 | switch (units) {
|
20293 | case 'month': return months;
|
20294 | case 'quarter': return months / 3;
|
20295 | case 'year': return months / 12;
|
20296 | }
|
20297 | } else {
|
20298 | // handle milliseconds separately because of floating point math errors (issue #1867)
|
20299 | days = this._days + Math.round(monthsToDays(this._months));
|
20300 | switch (units) {
|
20301 | case 'week' : return days / 7 + milliseconds / 6048e5;
|
20302 | case 'day' : return days + milliseconds / 864e5;
|
20303 | case 'hour' : return days * 24 + milliseconds / 36e5;
|
20304 | case 'minute' : return days * 1440 + milliseconds / 6e4;
|
20305 | case 'second' : return days * 86400 + milliseconds / 1000;
|
20306 | // Math.floor prevents floating point math errors here
|
20307 | case 'millisecond': return Math.floor(days * 864e5) + milliseconds;
|
20308 | default: throw new Error('Unknown unit ' + units);
|
20309 | }
|
20310 | }
|
20311 | }
|
20312 |
|
20313 | // TODO: Use this.as('ms')?
|
20314 | function valueOf$1 () {
|
20315 | if (!this.isValid()) {
|
20316 | return NaN;
|
20317 | }
|
20318 | return (
|
20319 | this._milliseconds +
|
20320 | this._days * 864e5 +
|
20321 | (this._months % 12) * 2592e6 +
|
20322 | toInt(this._months / 12) * 31536e6
|
20323 | );
|
20324 | }
|
20325 |
|
20326 | function makeAs (alias) {
|
20327 | return function () {
|
20328 | return this.as(alias);
|
20329 | };
|
20330 | }
|
20331 |
|
20332 | var asMilliseconds = makeAs('ms');
|
20333 | var asSeconds = makeAs('s');
|
20334 | var asMinutes = makeAs('m');
|
20335 | var asHours = makeAs('h');
|
20336 | var asDays = makeAs('d');
|
20337 | var asWeeks = makeAs('w');
|
20338 | var asMonths = makeAs('M');
|
20339 | var asQuarters = makeAs('Q');
|
20340 | var asYears = makeAs('y');
|
20341 |
|
20342 | function clone$1 () {
|
20343 | return createDuration(this);
|
20344 | }
|
20345 |
|
20346 | function get$2 (units) {
|
20347 | units = normalizeUnits(units);
|
20348 | return this.isValid() ? this[units + 's']() : NaN;
|
20349 | }
|
20350 |
|
20351 | function makeGetter(name) {
|
20352 | return function () {
|
20353 | return this.isValid() ? this._data[name] : NaN;
|
20354 | };
|
20355 | }
|
20356 |
|
20357 | var milliseconds = makeGetter('milliseconds');
|
20358 | var seconds = makeGetter('seconds');
|
20359 | var minutes = makeGetter('minutes');
|
20360 | var hours = makeGetter('hours');
|
20361 | var days = makeGetter('days');
|
20362 | var months = makeGetter('months');
|
20363 | var years = makeGetter('years');
|
20364 |
|
20365 | function weeks () {
|
20366 | return absFloor(this.days() / 7);
|
20367 | }
|
20368 |
|
20369 | var round = Math.round;
|
20370 | var thresholds = {
|
20371 | ss: 44, // a few seconds to seconds
|
20372 | s : 45, // seconds to minute
|
20373 | m : 45, // minutes to hour
|
20374 | h : 22, // hours to day
|
20375 | d : 26, // days to month
|
20376 | M : 11 // months to year
|
20377 | };
|
20378 |
|
20379 | // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize
|
20380 | function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) {
|
20381 | return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture);
|
20382 | }
|
20383 |
|
20384 | function relativeTime$1 (posNegDuration, withoutSuffix, locale) {
|
20385 | var duration = createDuration(posNegDuration).abs();
|
20386 | var seconds = round(duration.as('s'));
|
20387 | var minutes = round(duration.as('m'));
|
20388 | var hours = round(duration.as('h'));
|
20389 | var days = round(duration.as('d'));
|
20390 | var months = round(duration.as('M'));
|
20391 | var years = round(duration.as('y'));
|
20392 |
|
20393 | var a = seconds <= thresholds.ss && ['s', seconds] ||
|
20394 | seconds < thresholds.s && ['ss', seconds] ||
|
20395 | minutes <= 1 && ['m'] ||
|
20396 | minutes < thresholds.m && ['mm', minutes] ||
|
20397 | hours <= 1 && ['h'] ||
|
20398 | hours < thresholds.h && ['hh', hours] ||
|
20399 | days <= 1 && ['d'] ||
|
20400 | days < thresholds.d && ['dd', days] ||
|
20401 | months <= 1 && ['M'] ||
|
20402 | months < thresholds.M && ['MM', months] ||
|
20403 | years <= 1 && ['y'] || ['yy', years];
|
20404 |
|
20405 | a[2] = withoutSuffix;
|
20406 | a[3] = +posNegDuration > 0;
|
20407 | a[4] = locale;
|
20408 | return substituteTimeAgo.apply(null, a);
|
20409 | }
|
20410 |
|
20411 | // This function allows you to set the rounding function for relative time strings
|
20412 | function getSetRelativeTimeRounding (roundingFunction) {
|
20413 | if (roundingFunction === undefined) {
|
20414 | return round;
|
20415 | }
|
20416 | if (typeof(roundingFunction) === 'function') {
|
20417 | round = roundingFunction;
|
20418 | return true;
|
20419 | }
|
20420 | return false;
|
20421 | }
|
20422 |
|
20423 | // This function allows you to set a threshold for relative time strings
|
20424 | function getSetRelativeTimeThreshold (threshold, limit) {
|
20425 | if (thresholds[threshold] === undefined) {
|
20426 | return false;
|
20427 | }
|
20428 | if (limit === undefined) {
|
20429 | return thresholds[threshold];
|
20430 | }
|
20431 | thresholds[threshold] = limit;
|
20432 | if (threshold === 's') {
|
20433 | thresholds.ss = limit - 1;
|
20434 | }
|
20435 | return true;
|
20436 | }
|
20437 |
|
20438 | function humanize (withSuffix) {
|
20439 | if (!this.isValid()) {
|
20440 | return this.localeData().invalidDate();
|
20441 | }
|
20442 |
|
20443 | var locale = this.localeData();
|
20444 | var output = relativeTime$1(this, !withSuffix, locale);
|
20445 |
|
20446 | if (withSuffix) {
|
20447 | output = locale.pastFuture(+this, output);
|
20448 | }
|
20449 |
|
20450 | return locale.postformat(output);
|
20451 | }
|
20452 |
|
20453 | var abs$1 = Math.abs;
|
20454 |
|
20455 | function sign(x) {
|
20456 | return ((x > 0) - (x < 0)) || +x;
|
20457 | }
|
20458 |
|
20459 | function toISOString$1() {
|
20460 | // for ISO strings we do not use the normal bubbling rules:
|
20461 | // * milliseconds bubble up until they become hours
|
20462 | // * days do not bubble at all
|
20463 | // * months bubble up until they become years
|
20464 | // This is because there is no context-free conversion between hours and days
|
20465 | // (think of clock changes)
|
20466 | // and also not between days and months (28-31 days per month)
|
20467 | if (!this.isValid()) {
|
20468 | return this.localeData().invalidDate();
|
20469 | }
|
20470 |
|
20471 | var seconds = abs$1(this._milliseconds) / 1000;
|
20472 | var days = abs$1(this._days);
|
20473 | var months = abs$1(this._months);
|
20474 | var minutes, hours, years;
|
20475 |
|
20476 | // 3600 seconds -> 60 minutes -> 1 hour
|
20477 | minutes = absFloor(seconds / 60);
|
20478 | hours = absFloor(minutes / 60);
|
20479 | seconds %= 60;
|
20480 | minutes %= 60;
|
20481 |
|
20482 | // 12 months -> 1 year
|
20483 | years = absFloor(months / 12);
|
20484 | months %= 12;
|
20485 |
|
20486 |
|
20487 | // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js
|
20488 | var Y = years;
|
20489 | var M = months;
|
20490 | var D = days;
|
20491 | var h = hours;
|
20492 | var m = minutes;
|
20493 | var s = seconds ? seconds.toFixed(3).replace(/\.?0+$/, '') : '';
|
20494 | var total = this.asSeconds();
|
20495 |
|
20496 | if (!total) {
|
20497 | // this is the same as C#'s (Noda) and python (isodate)...
|
20498 | // but not other JS (goog.date)
|
20499 | return 'P0D';
|
20500 | }
|
20501 |
|
20502 | var totalSign = total < 0 ? '-' : '';
|
20503 | var ymSign = sign(this._months) !== sign(total) ? '-' : '';
|
20504 | var daysSign = sign(this._days) !== sign(total) ? '-' : '';
|
20505 | var hmsSign = sign(this._milliseconds) !== sign(total) ? '-' : '';
|
20506 |
|
20507 | return totalSign + 'P' +
|
20508 | (Y ? ymSign + Y + 'Y' : '') +
|
20509 | (M ? ymSign + M + 'M' : '') +
|
20510 | (D ? daysSign + D + 'D' : '') +
|
20511 | ((h || m || s) ? 'T' : '') +
|
20512 | (h ? hmsSign + h + 'H' : '') +
|
20513 | (m ? hmsSign + m + 'M' : '') +
|
20514 | (s ? hmsSign + s + 'S' : '');
|
20515 | }
|
20516 |
|
20517 | var proto$2 = Duration.prototype;
|
20518 |
|
20519 | proto$2.isValid = isValid$1;
|
20520 | proto$2.abs = abs;
|
20521 | proto$2.add = add$1;
|
20522 | proto$2.subtract = subtract$1;
|
20523 | proto$2.as = as;
|
20524 | proto$2.asMilliseconds = asMilliseconds;
|
20525 | proto$2.asSeconds = asSeconds;
|
20526 | proto$2.asMinutes = asMinutes;
|
20527 | proto$2.asHours = asHours;
|
20528 | proto$2.asDays = asDays;
|
20529 | proto$2.asWeeks = asWeeks;
|
20530 | proto$2.asMonths = asMonths;
|
20531 | proto$2.asQuarters = asQuarters;
|
20532 | proto$2.asYears = asYears;
|
20533 | proto$2.valueOf = valueOf$1;
|
20534 | proto$2._bubble = bubble;
|
20535 | proto$2.clone = clone$1;
|
20536 | proto$2.get = get$2;
|
20537 | proto$2.milliseconds = milliseconds;
|
20538 | proto$2.seconds = seconds;
|
20539 | proto$2.minutes = minutes;
|
20540 | proto$2.hours = hours;
|
20541 | proto$2.days = days;
|
20542 | proto$2.weeks = weeks;
|
20543 | proto$2.months = months;
|
20544 | proto$2.years = years;
|
20545 | proto$2.humanize = humanize;
|
20546 | proto$2.toISOString = toISOString$1;
|
20547 | proto$2.toString = toISOString$1;
|
20548 | proto$2.toJSON = toISOString$1;
|
20549 | proto$2.locale = locale;
|
20550 | proto$2.localeData = localeData;
|
20551 |
|
20552 | proto$2.toIsoString = deprecate('toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)', toISOString$1);
|
20553 | proto$2.lang = lang;
|
20554 |
|
20555 | // Side effect imports
|
20556 |
|
20557 | // FORMATTING
|
20558 |
|
20559 | addFormatToken('X', 0, 0, 'unix');
|
20560 | addFormatToken('x', 0, 0, 'valueOf');
|
20561 |
|
20562 | // PARSING
|
20563 |
|
20564 | addRegexToken('x', matchSigned);
|
20565 | addRegexToken('X', matchTimestamp);
|
20566 | addParseToken('X', function (input, array, config) {
|
20567 | config._d = new Date(parseFloat(input, 10) * 1000);
|
20568 | });
|
20569 | addParseToken('x', function (input, array, config) {
|
20570 | config._d = new Date(toInt(input));
|
20571 | });
|
20572 |
|
20573 | // Side effect imports
|
20574 |
|
20575 |
|
20576 | hooks.version = '2.24.0';
|
20577 |
|
20578 | setHookCallback(createLocal);
|
20579 |
|
20580 | hooks.fn = proto;
|
20581 | hooks.min = min;
|
20582 | hooks.max = max;
|
20583 | hooks.now = now;
|
20584 | hooks.utc = createUTC;
|
20585 | hooks.unix = createUnix;
|
20586 | hooks.months = listMonths;
|
20587 | hooks.isDate = isDate;
|
20588 | hooks.locale = getSetGlobalLocale;
|
20589 | hooks.invalid = createInvalid;
|
20590 | hooks.duration = createDuration;
|
20591 | hooks.isMoment = isMoment;
|
20592 | hooks.weekdays = listWeekdays;
|
20593 | hooks.parseZone = createInZone;
|
20594 | hooks.localeData = getLocale;
|
20595 | hooks.isDuration = isDuration;
|
20596 | hooks.monthsShort = listMonthsShort;
|
20597 | hooks.weekdaysMin = listWeekdaysMin;
|
20598 | hooks.defineLocale = defineLocale;
|
20599 | hooks.updateLocale = updateLocale;
|
20600 | hooks.locales = listLocales;
|
20601 | hooks.weekdaysShort = listWeekdaysShort;
|
20602 | hooks.normalizeUnits = normalizeUnits;
|
20603 | hooks.relativeTimeRounding = getSetRelativeTimeRounding;
|
20604 | hooks.relativeTimeThreshold = getSetRelativeTimeThreshold;
|
20605 | hooks.calendarFormat = getCalendarFormat;
|
20606 | hooks.prototype = proto;
|
20607 |
|
20608 | // currently HTML5 input type only supports 24-hour formats
|
20609 | hooks.HTML5_FMT = {
|
20610 | DATETIME_LOCAL: 'YYYY-MM-DDTHH:mm', // <input type="datetime-local" />
|
20611 | DATETIME_LOCAL_SECONDS: 'YYYY-MM-DDTHH:mm:ss', // <input type="datetime-local" step="1" />
|
20612 | DATETIME_LOCAL_MS: 'YYYY-MM-DDTHH:mm:ss.SSS', // <input type="datetime-local" step="0.001" />
|
20613 | DATE: 'YYYY-MM-DD', // <input type="date" />
|
20614 | TIME: 'HH:mm', // <input type="time" />
|
20615 | TIME_SECONDS: 'HH:mm:ss', // <input type="time" step="1" />
|
20616 | TIME_MS: 'HH:mm:ss.SSS', // <input type="time" step="0.001" />
|
20617 | WEEK: 'GGGG-[W]WW', // <input type="week" />
|
20618 | MONTH: 'YYYY-MM' // <input type="month" />
|
20619 | };
|
20620 |
|
20621 | return hooks;
|
20622 |
|
20623 | })));
|
20624 | });
|
20625 |
|
20626 | function isValidMoment(testMoment) {
|
20627 | if (typeof moment.isMoment === 'function' && !moment.isMoment(testMoment)) {
|
20628 | return false;
|
20629 | }
|
20630 |
|
20631 | /* istanbul ignore else */
|
20632 | if (typeof testMoment.isValid === 'function') {
|
20633 | // moment 1.7.0+
|
20634 | return testMoment.isValid();
|
20635 | }
|
20636 |
|
20637 | /* istanbul ignore next */
|
20638 | return !isNaN(testMoment);
|
20639 | }
|
20640 |
|
20641 | var momentValidationWrapper = {
|
20642 | isValidMoment : isValidMoment,
|
20643 | };
|
20644 |
|
20645 | var messages = {
|
20646 | invalidPredicate: '`predicate` must be a function',
|
20647 | invalidPropValidator: '`propValidator` must be a function',
|
20648 | requiredCore: 'is marked as required',
|
20649 | invalidTypeCore: 'Invalid input type',
|
20650 | predicateFailureCore: 'Failed to succeed with predicate',
|
20651 | anonymousMessage: '<<anonymous>>',
|
20652 | baseInvalidMessage: 'Invalid ',
|
20653 | };
|
20654 |
|
20655 | function constructPropValidatorVariations(propValidator) {
|
20656 | if (typeof propValidator !== 'function') {
|
20657 | throw new Error(messages.invalidPropValidator);
|
20658 | }
|
20659 |
|
20660 | var requiredPropValidator = propValidator.bind(null, false, null);
|
20661 | requiredPropValidator.isRequired = propValidator.bind(null, true, null);
|
20662 |
|
20663 | requiredPropValidator.withPredicate = function predicateApplication(predicate) {
|
20664 | if (typeof predicate !== 'function') {
|
20665 | throw new Error(messages.invalidPredicate);
|
20666 | }
|
20667 | var basePropValidator = propValidator.bind(null, false, predicate);
|
20668 | basePropValidator.isRequired = propValidator.bind(null, true, predicate);
|
20669 | return basePropValidator;
|
20670 | };
|
20671 |
|
20672 | return requiredPropValidator;
|
20673 | }
|
20674 |
|
20675 | function createInvalidRequiredErrorMessage(propName, componentName, value) {
|
20676 | return new Error(
|
20677 | 'The prop `' + propName + '` ' + messages.requiredCore +
|
20678 | ' in `' + componentName + '`, but its value is `' + value + '`.'
|
20679 | );
|
20680 | }
|
20681 |
|
20682 | var independentGuardianValue = -1;
|
20683 |
|
20684 | function preValidationRequireCheck(isRequired, componentName, propFullName, propValue) {
|
20685 | var isPropValueUndefined = typeof propValue === 'undefined';
|
20686 | var isPropValueNull = propValue === null;
|
20687 |
|
20688 | if (isRequired) {
|
20689 | if (isPropValueUndefined) {
|
20690 | return createInvalidRequiredErrorMessage(propFullName, componentName, 'undefined');
|
20691 | } else if (isPropValueNull) {
|
20692 | return createInvalidRequiredErrorMessage(propFullName, componentName, 'null');
|
20693 | }
|
20694 | }
|
20695 |
|
20696 | if (isPropValueUndefined || isPropValueNull) {
|
20697 | return null;
|
20698 | }
|
20699 |
|
20700 | return independentGuardianValue;
|
20701 | }
|
20702 |
|
20703 | function createMomentChecker(type, typeValidator, validator, momentType) {
|
20704 |
|
20705 | function propValidator(
|
20706 | isRequired, // Bound parameter to indicate with the propType is required
|
20707 | predicate, // Bound parameter to allow user to add dynamic validation
|
20708 | props,
|
20709 | propName,
|
20710 | componentName,
|
20711 | location,
|
20712 | propFullName
|
20713 | ) {
|
20714 | var propValue = props[ propName ];
|
20715 | var propType = typeof propValue;
|
20716 |
|
20717 | componentName = componentName || messages.anonymousMessage;
|
20718 | propFullName = propFullName || propName;
|
20719 |
|
20720 | var preValidationRequireCheckValue = preValidationRequireCheck(
|
20721 | isRequired, componentName, propFullName, propValue
|
20722 | );
|
20723 |
|
20724 | if (preValidationRequireCheckValue !== independentGuardianValue) {
|
20725 | return preValidationRequireCheckValue;
|
20726 | }
|
20727 |
|
20728 | if (typeValidator && !typeValidator(propValue)) {
|
20729 | return new Error(
|
20730 | messages.invalidTypeCore + ': `' + propName + '` of type `' + propType + '` ' +
|
20731 | 'supplied to `' + componentName + '`, expected `' + type + '`.'
|
20732 | );
|
20733 | }
|
20734 |
|
20735 | if (!validator(propValue)) {
|
20736 | return new Error(
|
20737 | messages.baseInvalidMessage + location + ' `' + propName + '` of type `' + propType + '` ' +
|
20738 | 'supplied to `' + componentName + '`, expected `' + momentType + '`.'
|
20739 | );
|
20740 | }
|
20741 |
|
20742 | if (predicate && !predicate(propValue)) {
|
20743 | var predicateName = predicate.name || messages.anonymousMessage;
|
20744 | return new Error(
|
20745 | messages.baseInvalidMessage + location + ' `' + propName + '` of type `' + propType + '` ' +
|
20746 | 'supplied to `' + componentName + '`. ' + messages.predicateFailureCore + ' `' +
|
20747 | predicateName + '`.'
|
20748 | );
|
20749 | }
|
20750 |
|
20751 | return null;
|
20752 |
|
20753 | }
|
20754 |
|
20755 | return constructPropValidatorVariations(propValidator);
|
20756 |
|
20757 | }
|
20758 |
|
20759 | var core = {
|
20760 | constructPropValidatorVariations: constructPropValidatorVariations,
|
20761 | createMomentChecker: createMomentChecker,
|
20762 | messages: messages,
|
20763 | };
|
20764 |
|
20765 | var src = {
|
20766 |
|
20767 | momentObj : core.createMomentChecker(
|
20768 | 'object',
|
20769 | function(obj) {
|
20770 | return typeof obj === 'object';
|
20771 | },
|
20772 | function isValid(value) {
|
20773 | return momentValidationWrapper.isValidMoment(value);
|
20774 | },
|
20775 | 'Moment'
|
20776 | ),
|
20777 |
|
20778 | momentString : core.createMomentChecker(
|
20779 | 'string',
|
20780 | function(str) {
|
20781 | return typeof str === 'string';
|
20782 | },
|
20783 | function isValid(value) {
|
20784 | return momentValidationWrapper.isValidMoment(moment(value));
|
20785 | },
|
20786 | 'Moment'
|
20787 | ),
|
20788 |
|
20789 | momentDurationObj : core.createMomentChecker(
|
20790 | 'object',
|
20791 | function(obj) {
|
20792 | return typeof obj === 'object';
|
20793 | },
|
20794 | function isValid(value) {
|
20795 | return moment.isDuration(value);
|
20796 | },
|
20797 | 'Duration'
|
20798 | ),
|
20799 |
|
20800 | };
|
20801 | var src_1 = src.momentObj;
|
20802 |
|
20803 | function _templateObject$P() {
|
20804 | var data = taggedTemplateLiteralLoose(["\n\t.DayPicker__withBorder {\n\t\tbox-shadow: 0px 2px 4px rgba(0, 0, 0, 0.25);\n\t}\n\t.DateRangePickerInput {\n\t\tdisplay: flex;\n\t\tbackground-color: ", ";\n\t}\n\n\t.DateRangePickerInput__withBorder {\n\t\tborder: thin solid ", ";\n\t\tborder-radius: 4px;\n\t}\n\n\t.DateRangePickerInput_calendarIcon {\n\t\twidth: 34px;\n\t\theight: 34px;\n\t\tpadding: 0;\n\t\tmargin: 0;\n\t\toutline: none;\n\t}\n\n\t.DateInput {\n\t\twidth: 50%;\n\t}\n\n\t.DateInput:before {\n\t\tposition: absolute;\n\t\ttop: 20%;\n\t\tbottom: 20%;\n\t\tborder-right: thin solid ", ";\n\t\tcontent: '';\n\t}\n\n\t.DateInput_input {\n\t\tpadding: 7px 7px 5px 7px;\n\t\tfont-size: 15px;\n\t\tline-height: 20px;\n\t}\n\n\t.DateInput_input__focused {\n\t\tborder-bottom: 2px solid ", ";\n\t}\n\n\t.DateRangePickerInput_arrow {\n\t\tdisplay: none;\n\t\twidth: 0;\n\t\tmargin: 0 4px;\n\t}\n\n\t.DateRangePickerInput_arrow svg {\n\t\twidth: 22px;\n\t}\n\n\t/* NOTE: the order of these styles DO matter */\n\n\t.CalendarDay__default {\n\t\tborder: 1px solid transparent;\n\t\tbackground: ", ";\n\t\tcolor: ", ";\n\t}\n\n\t.CalendarDay__blocked_out_of_range:active,\n\t.CalendarDay__blocked_out_of_range:hover {\n\t\tborder: 1px solid transparent;\n\t\tbackground: ", ";\n\t\tcolor: ", ";\n\t}\n\t/* Will edit everything selected including everything between a range of dates */\n\t.CalendarDay__selected_span {\n\t\tborder: 1px solid transparent; /* default styles include a border */\n\t\tbackground: ", "; /* background */\n\t\tcolor: ", "; /* text */\n\t}\n\n\t.CalendarDay__selected_span:hover {\n\t\tborder: 1px solid transparent;\n\t\tbackground: ", "; /* background */\n\t\tcolor: ", "; /* text */\n\t}\n\n\t/* Will edit selected date or the endpoints of a range of dates */\n\t.CalendarDay__selected {\n\t\tborder: 1px solid transparent; /* default styles include a border */\n\t\tbackground: ", ";\n\t\tcolor: ", ";\n\t}\n\n\t/* Will edit when hovered over. _span style also has this property */\n\t.CalendarDay__selected:hover {\n\t\tborder: 1px solid transparent;\n\t\tbackground: ", ";\n\t\tcolor: ", ";\n\t}\n\n\t/* Will edit when the second date (end date) in a range of dates */\n\t/* is not yet selected. Edits the dates between your mouse and said date */\n\t.CalendarDay__hovered_span {\n\t\tborder: 1px solid transparent;\n\t\tbackground: ", "; /* background */\n\t}\n\n\t.CalendarDay__hovered_span:hover {\n\t\tborder: 1px solid transparent; /* default styles include a border */\n\t\tbackground: ", "; /* background */\n\t\tcolor: ", ";\n\t}\n"]);
|
20805 |
|
20806 | _templateObject$P = function _templateObject() {
|
20807 | return data;
|
20808 | };
|
20809 |
|
20810 | return data;
|
20811 | }
|
20812 |
|
20813 | var DatePicker = function DatePicker(props) {
|
20814 | return React.createElement(DatePickerStyledWrapper, null, React.createElement(DateRangePicker, _extends_1({}, props, {
|
20815 | hideKeyboardShortcutsPanel: true,
|
20816 | customInputIcon: React.createElement(Icon$1, {
|
20817 | icon: "calendar",
|
20818 | color: theme.colors.activeBlue
|
20819 | })
|
20820 | })));
|
20821 | };
|
20822 |
|
20823 | var DatePickerStyledWrapper = styled.div(_templateObject$P(), theme.colors.white, theme.colors.strokeGray, theme.colors.strokeGray, theme.colors.activeBlue, theme.colors.white, theme.colors.black, theme.colors.lightGray, theme.colors.strokeGray, theme.colors.strokeGray, theme.colors.black, theme.colors.activeBlue, theme.colors.white, theme.colors.deepBlue, theme.colors.white, theme.colors.activeBlue, theme.colors.white, theme.colors.lightBlue, theme.colors.lightBlue, theme.colors.activeBlue);
|
20824 | DatePicker.displayName = 'DatePicker';
|
20825 | DatePicker.defaultProps = {
|
20826 | startDatePlaceholderText: '',
|
20827 | endDatePlaceholderText: '',
|
20828 | startDate: null,
|
20829 | endDate: null,
|
20830 | startDateId: 'startDate',
|
20831 | endDateId: 'endDate'
|
20832 | };
|
20833 | DatePicker.propTypes = {
|
20834 | /** starDate placeholder text */
|
20835 | startDatePlaceholderText: PropTypes.string,
|
20836 |
|
20837 | /** endDate placeholder text */
|
20838 | endDatePlaceholderText: PropTypes.string,
|
20839 |
|
20840 | /** momentPropTypes.momentObj or null */
|
20841 | startDate: src_1,
|
20842 |
|
20843 | /** momentPropTypes.momentObj or null */
|
20844 | endDate: src_1,
|
20845 |
|
20846 | /** triggers when Dates changes */
|
20847 | onDatesChange: PropTypes.func.isRequired,
|
20848 |
|
20849 | /** triggers when focus changes */
|
20850 | onFocusChange: PropTypes.func.isRequired,
|
20851 |
|
20852 | /** START_DATE, END_DATE or null */
|
20853 | focusedInput: PropTypes.oneOf(['startDate', 'endDate']),
|
20854 | startDateId: PropTypes.string,
|
20855 | endDateId: PropTypes.string
|
20856 | };
|
20857 |
|
20858 | function _templateObject4$a() {
|
20859 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\talign-items: center;\n\tmargin: 16px;\n\n\t& > div {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tflex-direction: row-reverse;\n\t}\n\t& span {\n\t\twidth: 25%;\n\t\tpadding-right: 8px;\n\t\tfont-weight: bold;\n\t}\n\t& input {\n\t\tborder: 1px solid ", " !important;\n\t\tborder-radius: 4px !important;\n\t\tpadding: 7px;\n\t\twidth: 75%;\n\t\t:focus {\n\t\t\tborder: 1px solid ", " !important;\n\t\t\toutline: 0;\n\t\t}\n\t}\n"]);
|
20860 |
|
20861 | _templateObject4$a = function _templateObject4() {
|
20862 | return data;
|
20863 | };
|
20864 |
|
20865 | return data;
|
20866 | }
|
20867 |
|
20868 | function _templateObject3$d() {
|
20869 | var data = taggedTemplateLiteralLoose(["\n\tposition: relative;\n\theight: 14px;\n\tmargin: 16px;\n\t& .hue-horizontal {\n\t\tborder-radius: 5% / 50%;\n\t\t//Hue picker indicator\n\t\t& > div > div {\n\t\t\tmargin-top: 0 !important;\n\t\t\twidth: 14px !important;\n\t\t\tborder-radius: 50% !important;\n\t\t\theight: 14px !important;\n\t\t\ttransform: translateX(-7px) !important;\n\t\t}\n\t}\n"]);
|
20870 |
|
20871 | _templateObject3$d = function _templateObject3() {
|
20872 | return data;
|
20873 | };
|
20874 |
|
20875 | return data;
|
20876 | }
|
20877 |
|
20878 | function _templateObject2$i() {
|
20879 | var data = taggedTemplateLiteralLoose(["\n\tposition: relative;\n\theight: 180px;\n\n\t& .saturation-white > div > div {\n\t\twidth: 8px !important;\n\t\theight: 8px !important;\n\t\ttransform: translate(-4px, -4px) !important;\n\t}\n"]);
|
20880 |
|
20881 | _templateObject2$i = function _templateObject2() {
|
20882 | return data;
|
20883 | };
|
20884 |
|
20885 | return data;
|
20886 | }
|
20887 |
|
20888 | function _templateObject$Q() {
|
20889 | var data = taggedTemplateLiteralLoose(["\n\twidth: 180px;\n"]);
|
20890 |
|
20891 | _templateObject$Q = function _templateObject() {
|
20892 | return data;
|
20893 | };
|
20894 |
|
20895 | return data;
|
20896 | }
|
20897 |
|
20898 | var CustomColorPicker = function CustomColorPicker(_ref) {
|
20899 | var hex = _ref.hex,
|
20900 | hsl = _ref.hsl,
|
20901 | hsv = _ref.hsv,
|
20902 | onChange = _ref.onChange;
|
20903 | return React.createElement(CustomColorPickerContainer, null, React.createElement(SaturationContainer, null, React.createElement(Saturation, {
|
20904 | hsl: hsl,
|
20905 | hsv: hsv,
|
20906 | onChange: onChange
|
20907 | })), React.createElement(HueContainer, null, React.createElement(Hue, {
|
20908 | hsl: hsl,
|
20909 | onChange: onChange
|
20910 | })), React.createElement(EditableInputContainer, null, React.createElement(EditableInput, {
|
20911 | label: "hex",
|
20912 | value: hex,
|
20913 | onChange: onChange
|
20914 | })));
|
20915 | };
|
20916 |
|
20917 | CustomColorPicker.displayName = 'ColorPicker';
|
20918 | CustomColorPicker.defaultProps = {
|
20919 | hex: null,
|
20920 | hsv: null,
|
20921 | hsl: null,
|
20922 | onChange: null
|
20923 | };
|
20924 | CustomColorPicker.propTypes = {
|
20925 | hex: PropTypes.string,
|
20926 | hsl: PropTypes.shape({
|
20927 | h: PropTypes.number,
|
20928 | s: PropTypes.number,
|
20929 | l: PropTypes.number,
|
20930 | a: PropTypes.number
|
20931 | }),
|
20932 | hsv: PropTypes.shape({
|
20933 | h: PropTypes.number,
|
20934 | s: PropTypes.number,
|
20935 | v: PropTypes.number,
|
20936 | a: PropTypes.number
|
20937 | }),
|
20938 | onChange: PropTypes.func
|
20939 | };
|
20940 | var CustomColorPickerContainer = styled.div(_templateObject$Q());
|
20941 | var SaturationContainer = styled.div(_templateObject2$i());
|
20942 | var HueContainer = styled.div(_templateObject3$d());
|
20943 | var EditableInputContainer = styled.div(_templateObject4$a(), function (_ref2) {
|
20944 | var theme = _ref2.theme;
|
20945 | return theme.colors.strokeGray;
|
20946 | }, function (_ref3) {
|
20947 | var theme = _ref3.theme;
|
20948 | return theme.colors.deepBlue;
|
20949 | });
|
20950 | var CustomColorPicker$1 = CustomPicker(CustomColorPicker);
|
20951 |
|
20952 | function _templateObject2$j() {
|
20953 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\twidth: 180px;\n\theight: 20px;\n\tflex-direction: row-reverse;\n\talign-items: center;\n\n\tpadding: 5px;\n\n\tbackground: #424242;\n"]);
|
20954 |
|
20955 | _templateObject2$j = function _templateObject2() {
|
20956 | return data;
|
20957 | };
|
20958 |
|
20959 | return data;
|
20960 | }
|
20961 |
|
20962 | function _templateObject$R() {
|
20963 | var data = taggedTemplateLiteralLoose(["\n\tposition: ", ";\n\tz-index: 5;\n\n\tdisplay: ", ";\n\tbox-shadow: rgba(0, 0, 0, 0.3) 0px 0px 2px, rgba(0, 0, 0, 0.3) 0px 4px 8px;\n\tbackground-color: ", ";\n"]);
|
20964 |
|
20965 | _templateObject$R = function _templateObject() {
|
20966 | return data;
|
20967 | };
|
20968 |
|
20969 | return data;
|
20970 | }
|
20971 |
|
20972 | var ColorPicker =
|
20973 | /*#__PURE__*/
|
20974 | function (_Component) {
|
20975 | inheritsLoose(ColorPicker, _Component);
|
20976 |
|
20977 | function ColorPicker(props) {
|
20978 | var _this;
|
20979 |
|
20980 | _this = _Component.call(this, props) || this;
|
20981 |
|
20982 | defineProperty(assertThisInitialized(_this), "handleOnClose", function () {
|
20983 | var _this$props = _this.props,
|
20984 | onClose = _this$props.onClose,
|
20985 | setColor = _this$props.setColor;
|
20986 | var color = _this.state.color;
|
20987 | setColor(color);
|
20988 | onClose();
|
20989 | });
|
20990 |
|
20991 | var _color = props.color;
|
20992 | _this.state = {
|
20993 | color: _color
|
20994 | };
|
20995 | _this.setWrapperRef = _this.setWrapperRef.bind(assertThisInitialized(_this));
|
20996 | _this.handleClickOutside = _this.handleClickOutside.bind(assertThisInitialized(_this));
|
20997 | return _this;
|
20998 | }
|
20999 |
|
21000 | var _proto = ColorPicker.prototype;
|
21001 |
|
21002 | _proto.componentDidMount = function componentDidMount() {
|
21003 | document.addEventListener('mousedown', this.handleClickOutside);
|
21004 | };
|
21005 |
|
21006 | _proto.componentWillUnmount = function componentWillUnmount() {
|
21007 | document.removeEventListener('mousedown', this.handleClickOutside);
|
21008 | };
|
21009 |
|
21010 | _proto.setWrapperRef = function setWrapperRef(node) {
|
21011 | this.wrapperRef = node;
|
21012 | };
|
21013 |
|
21014 | _proto.handleClickOutside = function handleClickOutside(event) {
|
21015 | var _this$props2 = this.props,
|
21016 | isVisible = _this$props2.isVisible,
|
21017 | isDisplayerMode = _this$props2.isDisplayerMode;
|
21018 |
|
21019 | if (this.wrapperRef && !this.wrapperRef.contains(event.target) && isVisible && isDisplayerMode) {
|
21020 | this.handleOnClose();
|
21021 | }
|
21022 | };
|
21023 |
|
21024 | _proto.render = function render() {
|
21025 | var _this2 = this;
|
21026 |
|
21027 | var _this$props3 = this.props,
|
21028 | isVisible = _this$props3.isVisible,
|
21029 | isDisplayerMode = _this$props3.isDisplayerMode,
|
21030 | setColor = _this$props3.setColor,
|
21031 | props = objectWithoutPropertiesLoose(_this$props3, ["isVisible", "isDisplayerMode", "setColor"]);
|
21032 |
|
21033 | var color = this.state.color;
|
21034 | return React.createElement(ColorPickerStyled, {
|
21035 | className: "" + (isVisible && 'isActive'),
|
21036 | isVisible: isVisible,
|
21037 | isDisplayerMode: isDisplayerMode,
|
21038 | ref: this.setWrapperRef,
|
21039 | onClick: function onClick(e) {
|
21040 | return e.stopPropagation();
|
21041 | }
|
21042 | }, React.createElement(TopHeader, null, React.createElement(Icon$1, {
|
21043 | style: {
|
21044 | cursor: 'pointer'
|
21045 | },
|
21046 | icon: "error",
|
21047 | color: "white",
|
21048 | size: "tiny",
|
21049 | onClick: this.handleOnClose
|
21050 | })), React.createElement(CustomColorPicker$1, _extends_1({}, props, {
|
21051 | color: color,
|
21052 | onChangeComplete: function onChangeComplete(colorValue) {
|
21053 | return _this2.setState({
|
21054 | color: colorValue
|
21055 | }) || !isDisplayerMode && setColor(colorValue);
|
21056 | },
|
21057 | disableAlpha: true,
|
21058 | className: "color-picker"
|
21059 | })));
|
21060 | };
|
21061 |
|
21062 | return ColorPicker;
|
21063 | }(Component);
|
21064 |
|
21065 | var ColorPickerStyled = styled.div(_templateObject$R(), function (_ref) {
|
21066 | var isDisplayerMode = _ref.isDisplayerMode;
|
21067 | return isDisplayerMode ? 'absolute' : 'inherit';
|
21068 | }, function (_ref2) {
|
21069 | var isVisible = _ref2.isVisible;
|
21070 | return isVisible ? 'inline-block' : 'none';
|
21071 | }, function (_ref3) {
|
21072 | var theme = _ref3.theme;
|
21073 | return theme.colors.white;
|
21074 | });
|
21075 | ColorPickerStyled.displayName = 'ColorPickerStyled';
|
21076 | var TopHeader = styled.div(_templateObject2$j());
|
21077 | ColorPicker.displayName = 'ColorPicker';
|
21078 | ColorPicker.defaultProps = {
|
21079 | isVisible: true,
|
21080 | isDisplayerMode: true
|
21081 | };
|
21082 | ColorPicker.propTypes = {
|
21083 | isVisible: PropTypes.bool,
|
21084 | color: PropTypes.shape({
|
21085 | hex: PropTypes.string.isRequired
|
21086 | }).isRequired,
|
21087 | setColor: PropTypes.func.isRequired,
|
21088 | onClose: PropTypes.func.isRequired,
|
21089 | isDisplayerMode: PropTypes.bool
|
21090 | };
|
21091 |
|
21092 | function _templateObject3$e() {
|
21093 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: inline-block;\n\twidth: 22px;\n\theight: 22px;\n\tbackground: transparent;\n\tcursor: pointer;\n"]);
|
21094 |
|
21095 | _templateObject3$e = function _templateObject3() {
|
21096 | return data;
|
21097 | };
|
21098 |
|
21099 | return data;
|
21100 | }
|
21101 |
|
21102 | function _templateObject2$k() {
|
21103 | var data = taggedTemplateLiteralLoose(["\n\twidth: 100%;\n\theight: 100%;\n\tbackground: ", ";\n\tborder-radius: 50%;\n\tcursor: ", ";\n"]);
|
21104 |
|
21105 | _templateObject2$k = function _templateObject2() {
|
21106 | return data;
|
21107 | };
|
21108 |
|
21109 | return data;
|
21110 | }
|
21111 |
|
21112 | function _templateObject$S() {
|
21113 | var data = taggedTemplateLiteralLoose(["\n\tposition: fixed;\n\tdisplay: block;\n\twidth: 0;\n\theight: 0;\n\tborder: 0;\n\tbackground: transparent;\n\toutline: 0;\n"]);
|
21114 |
|
21115 | _templateObject$S = function _templateObject() {
|
21116 | return data;
|
21117 | };
|
21118 |
|
21119 | return data;
|
21120 | }
|
21121 |
|
21122 | var ColorDisplayer = function ColorDisplayer(_ref) {
|
21123 | var escKeyCall = _ref.escKeyCall,
|
21124 | color = _ref.color,
|
21125 | style = _ref.style,
|
21126 | onChange = _ref.onChange,
|
21127 | activeFocus = _ref.activeFocus,
|
21128 | disabled = _ref.disabled,
|
21129 | props = objectWithoutPropertiesLoose(_ref, ["escKeyCall", "color", "style", "onChange", "activeFocus", "disabled"]);
|
21130 |
|
21131 | var _useState = useState(false),
|
21132 | display = _useState[0],
|
21133 | setDisplay = _useState[1];
|
21134 |
|
21135 | var inputFocus = React.createRef();
|
21136 |
|
21137 | var handleEscKey = function handleEscKey(event) {
|
21138 | if (event.keyCode === 27) {
|
21139 | escKeyCall();
|
21140 | setDisplay(false);
|
21141 | }
|
21142 | };
|
21143 |
|
21144 | useEffect(function () {
|
21145 | document.addEventListener('keydown', handleEscKey);
|
21146 | return function () {
|
21147 | document.removeEventListener('keydown', handleEscKey);
|
21148 | };
|
21149 | });
|
21150 |
|
21151 | var handleOpen = function handleOpen(flag) {
|
21152 | if (activeFocus && flag) {
|
21153 | inputFocus.current.focus();
|
21154 | }
|
21155 |
|
21156 | setDisplay(flag);
|
21157 | };
|
21158 |
|
21159 | return React.createElement(Fragment, null, React.createElement(ColorButtonContainer, {
|
21160 | onClick: function onClick(event) {
|
21161 | event.stopPropagation();
|
21162 | if (!disabled) handleOpen(!display);
|
21163 | },
|
21164 | style: style
|
21165 | }, React.createElement(ColorBox, {
|
21166 | color: color,
|
21167 | disabled: disabled
|
21168 | })), activeFocus && React.createElement(InputHidden, {
|
21169 | ref: inputFocus
|
21170 | }), React.createElement(ColorPicker, _extends_1({}, props, {
|
21171 | isVisible: display,
|
21172 | color: color,
|
21173 | setColor: onChange,
|
21174 | onClose: function onClose() {
|
21175 | return setDisplay(false);
|
21176 | }
|
21177 | })));
|
21178 | };
|
21179 |
|
21180 | var InputHidden = styled.input(_templateObject$S());
|
21181 | var ColorBox = styled(function (_ref2) {
|
21182 | var color = _ref2.color,
|
21183 | disabled = _ref2.disabled,
|
21184 | props = objectWithoutPropertiesLoose(_ref2, ["color", "disabled"]);
|
21185 |
|
21186 | return React.createElement("div", props);
|
21187 | })(_templateObject2$k(), function (_ref3) {
|
21188 | var theme = _ref3.theme,
|
21189 | color = _ref3.color,
|
21190 | disabled = _ref3.disabled;
|
21191 | return disabled ? theme.colors.lightGray : color.hex;
|
21192 | }, function (_ref4) {
|
21193 | var disabled = _ref4.disabled;
|
21194 | return disabled ? 'not-allowed' : 'inherit';
|
21195 | });
|
21196 | ColorBox.displayName = 'ColorBox';
|
21197 | var ColorButtonContainer = styled.div(_templateObject3$e());
|
21198 | ColorButtonContainer.displayName = 'ColorButtonContainer';
|
21199 | ColorDisplayer.displayName = 'ColorDisplayer';
|
21200 | ColorDisplayer.defaultProps = {
|
21201 | escKeyCall: function escKeyCall() {},
|
21202 | color: {
|
21203 | hex: '#e10020'
|
21204 | },
|
21205 | activeFocus: false,
|
21206 | style: {},
|
21207 | disabled: false
|
21208 | };
|
21209 | ColorDisplayer.propTypes = {
|
21210 | escKeyCall: PropTypes.func,
|
21211 | onChange: PropTypes.func.isRequired,
|
21212 | style: PropTypes.shape({}),
|
21213 | color: PropTypes.shape({
|
21214 | hex: PropTypes.string.isRequired
|
21215 | }),
|
21216 | activeFocus: PropTypes.bool,
|
21217 | disabled: PropTypes.bool
|
21218 | };
|
21219 |
|
21220 | function _templateObject2$l() {
|
21221 | var data = taggedTemplateLiteralLoose(["\n\twidth: 5px;\n\tpadding-bottom: 2px;\n\tcolor: ", " !important;\n\ttext-align: center;\n"]);
|
21222 |
|
21223 | _templateObject2$l = function _templateObject2() {
|
21224 | return data;
|
21225 | };
|
21226 |
|
21227 | return data;
|
21228 | }
|
21229 |
|
21230 | function _templateObject$T() {
|
21231 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: inline-flex;\n\talign-items: center;\n"]);
|
21232 |
|
21233 | _templateObject$T = function _templateObject() {
|
21234 | return data;
|
21235 | };
|
21236 |
|
21237 | return data;
|
21238 | }
|
21239 |
|
21240 | var TimePicker =
|
21241 | /*#__PURE__*/
|
21242 | function (_Component) {
|
21243 | inheritsLoose(TimePicker, _Component);
|
21244 |
|
21245 | function TimePicker(props) {
|
21246 | var _this;
|
21247 |
|
21248 | _this = _Component.call(this, props) || this;
|
21249 |
|
21250 | defineProperty(assertThisInitialized(_this), "formatMomentDuration", function (value, format) {
|
21251 | return moment.utc(value.asMilliseconds()).format(format);
|
21252 | });
|
21253 |
|
21254 | defineProperty(assertThisInitialized(_this), "formatTimeItem", function (value) {
|
21255 | return ((value || '') + "00").substr(0, 2);
|
21256 | });
|
21257 |
|
21258 | defineProperty(assertThisInitialized(_this), "isNumber", function (value) {
|
21259 | return Number.isInteger(Number(value)) && String(value) === String(Number(value));
|
21260 | });
|
21261 |
|
21262 | defineProperty(assertThisInitialized(_this), "isValidTime", function (event, type, value) {
|
21263 | switch (type) {
|
21264 | case 'hours':
|
21265 | return event.target.selectionEnd === 0 || event.target.selectionEnd === 1 && Number(value.charAt(0)) < 3 || event.target.selectionEnd === 2 && Number(value.charAt(0)) < 2 || event.target.selectionEnd === 2 && Number(value.charAt(0)) === 2 && Number(value.charAt(1)) < 4;
|
21266 |
|
21267 | case 'minutes':
|
21268 | case 'seconds':
|
21269 | default:
|
21270 | return event.target.selectionEnd !== 1 || event.target.selectionEnd === 1 && Number(value.charAt(0)) < 6;
|
21271 | }
|
21272 | });
|
21273 |
|
21274 | defineProperty(assertThisInitialized(_this), "onInputChange", function (event, type) {
|
21275 | var oldValue = _this.state[type];
|
21276 | var _event$target = event.target,
|
21277 | inputValue = _event$target.value,
|
21278 | position = _event$target.selectionEnd;
|
21279 | var isTyped = inputValue.length > oldValue.length;
|
21280 | var cursorCharacter = inputValue[position - 1];
|
21281 | var addedCharacter = isTyped ? cursorCharacter : null;
|
21282 | var removedCharacter = isTyped ? null : oldValue[position - 1];
|
21283 | var replacedSingleCharacter = inputValue.length === oldValue.length ? oldValue[position - 1] : null;
|
21284 | var newValue = oldValue;
|
21285 | var newPosition = position;
|
21286 |
|
21287 | if (addedCharacter !== null) {
|
21288 | if (position > 2) {
|
21289 | newPosition = 2;
|
21290 | } else if (_this.isNumber(addedCharacter)) {
|
21291 | if (position === 2) {
|
21292 | newValue = "" + inputValue.substr(0, 1) + inputValue.substr(1, 1);
|
21293 | }
|
21294 |
|
21295 | if (position === 1) {
|
21296 | newValue = "" + inputValue.substr(0, 1) + inputValue.substr(2, 1);
|
21297 | }
|
21298 | } else {
|
21299 | newPosition = position - 1;
|
21300 | }
|
21301 | } else if (replacedSingleCharacter !== null) {
|
21302 | if (_this.isNumber(cursorCharacter)) {
|
21303 | newValue = inputValue;
|
21304 | } else {
|
21305 | newValue = oldValue;
|
21306 | newPosition = position - 1;
|
21307 | }
|
21308 | } else if (removedCharacter !== null) {
|
21309 | if (position === 0) newValue = "0" + inputValue.substr(0, 1);else newValue = inputValue.substr(0, 1);
|
21310 | }
|
21311 |
|
21312 | return {
|
21313 | newValue: newValue,
|
21314 | newPosition: newPosition
|
21315 | };
|
21316 | });
|
21317 |
|
21318 | defineProperty(assertThisInitialized(_this), "onChange", function (event, type, value) {
|
21319 | var onChange = _this.props.onChange;
|
21320 | var _this$state = _this.state,
|
21321 | hoursValue = _this$state.hoursValue,
|
21322 | minutesValue = _this$state.minutesValue,
|
21323 | secondsValue = _this$state.secondsValue;
|
21324 | var target = event.target,
|
21325 | nativeEvent = event.nativeEvent,
|
21326 | selectionEnd = event.target.selectionEnd;
|
21327 | var durationObject = {
|
21328 | hours: hoursValue,
|
21329 | minutes: minutesValue,
|
21330 | seconds: secondsValue
|
21331 | };
|
21332 | var typeValue = type + "Value";
|
21333 |
|
21334 | if (nativeEvent.type === 'click') {
|
21335 | var _this$setState, _extends2;
|
21336 |
|
21337 | _this.setState((_this$setState = {}, _this$setState[typeValue] = value, _this$setState));
|
21338 |
|
21339 | onChange(moment.duration(_extends_1({}, durationObject, (_extends2 = {}, _extends2[type] = value, _extends2))));
|
21340 | } else {
|
21341 | var _this$onInputChange = _this.onInputChange(event, typeValue),
|
21342 | newValue = _this$onInputChange.newValue,
|
21343 | newPosition = _this$onInputChange.newPosition;
|
21344 |
|
21345 | newValue = _this.formatTimeItem(newValue);
|
21346 |
|
21347 | if (_this.isValidTime(event, type, newValue)) {
|
21348 | var _this$setState2, _extends3;
|
21349 |
|
21350 | _this.setState((_this$setState2 = {}, _this$setState2[typeValue] = newValue, _this$setState2), function () {
|
21351 | target.selectionStart = newPosition;
|
21352 | target.selectionEnd = newPosition;
|
21353 | });
|
21354 |
|
21355 | onChange(moment.duration(_extends_1({}, durationObject, (_extends3 = {}, _extends3[type] = newValue, _extends3))));
|
21356 | } else {
|
21357 | _this.setState({}, function () {
|
21358 | target.selectionStart = selectionEnd - 1;
|
21359 | target.selectionEnd = selectionEnd - 1;
|
21360 | });
|
21361 | }
|
21362 | }
|
21363 | });
|
21364 |
|
21365 | defineProperty(assertThisInitialized(_this), "onBlur", function () {
|
21366 | var onBlur = _this.props.onBlur;
|
21367 | var _this$state2 = _this.state,
|
21368 | hoursValue = _this$state2.hoursValue,
|
21369 | minutesValue = _this$state2.minutesValue,
|
21370 | secondsValue = _this$state2.secondsValue;
|
21371 | onBlur(moment.duration({
|
21372 | hours: hoursValue,
|
21373 | minutes: minutesValue,
|
21374 | seconds: secondsValue
|
21375 | }));
|
21376 | });
|
21377 |
|
21378 | var _this$props = _this.props,
|
21379 | _value = _this$props.value,
|
21380 | hours = _this$props.hours,
|
21381 | minutes = _this$props.minutes,
|
21382 | seconds = _this$props.seconds;
|
21383 | _this.state = {
|
21384 | hoursValue: hours ? _this.formatMomentDuration(_value, 'HH') : 0,
|
21385 | minutesValue: minutes ? _this.formatMomentDuration(_value, 'mm') : 0,
|
21386 | secondsValue: seconds ? _this.formatMomentDuration(_value, 'ss') : 0
|
21387 | };
|
21388 | return _this;
|
21389 | }
|
21390 |
|
21391 | var _proto = TimePicker.prototype;
|
21392 |
|
21393 | _proto.componentDidUpdate = function componentDidUpdate(prevProps, prevState) {
|
21394 | var value = this.props.value;
|
21395 |
|
21396 | if (value.hours() !== Number(prevState.hoursValue)) {
|
21397 | this.setState({
|
21398 | hoursValue: this.formatMomentDuration(value, 'HH')
|
21399 | });
|
21400 | }
|
21401 |
|
21402 | if (value.minutes() !== Number(prevState.minutesValue)) {
|
21403 | this.setState({
|
21404 | minutesValue: this.formatMomentDuration(value, 'mm')
|
21405 | });
|
21406 | }
|
21407 |
|
21408 | if (value.seconds() !== Number(prevState.secondsValue)) {
|
21409 | this.setState({
|
21410 | secondsValue: this.formatMomentDuration(value, 'ss')
|
21411 | });
|
21412 | }
|
21413 | };
|
21414 |
|
21415 | _proto.render = function render() {
|
21416 | var _this2 = this;
|
21417 |
|
21418 | var _this$props2 = this.props,
|
21419 | disabled = _this$props2.disabled,
|
21420 | error = _this$props2.error,
|
21421 | hours = _this$props2.hours,
|
21422 | minutes = _this$props2.minutes,
|
21423 | seconds = _this$props2.seconds,
|
21424 | onChange = _this$props2.onChange,
|
21425 | onBlur = _this$props2.onBlur,
|
21426 | value = _this$props2.value,
|
21427 | props = objectWithoutPropertiesLoose(_this$props2, ["disabled", "error", "hours", "minutes", "seconds", "onChange", "onBlur", "value"]);
|
21428 |
|
21429 | var _this$state3 = this.state,
|
21430 | hoursValue = _this$state3.hoursValue,
|
21431 | minutesValue = _this$state3.minutesValue,
|
21432 | secondsValue = _this$state3.secondsValue;
|
21433 | return React.createElement(Container$1, null, hours && React.createElement("div", null, React.createElement(NumberSpinner, _extends_1({
|
21434 | name: "hours",
|
21435 | disabled: disabled,
|
21436 | error: error,
|
21437 | min: 0,
|
21438 | max: 23,
|
21439 | onChange: function onChange(event, val) {
|
21440 | return _this2.onChange(event, 'hours', val);
|
21441 | },
|
21442 | onBlur: this.onBlur,
|
21443 | value: hoursValue
|
21444 | }, props))), minutes && hours && React.createElement(MiddleColumn, {
|
21445 | disabled: disabled
|
21446 | }, ":"), minutes && React.createElement("div", null, React.createElement(NumberSpinner, _extends_1({
|
21447 | name: "minutes",
|
21448 | disabled: disabled,
|
21449 | error: error,
|
21450 | min: 0,
|
21451 | max: 59,
|
21452 | onChange: function onChange(event, val) {
|
21453 | return _this2.onChange(event, 'minutes', val);
|
21454 | },
|
21455 | onBlur: this.onBlur,
|
21456 | value: minutesValue
|
21457 | }, props))), seconds && minutes && React.createElement(MiddleColumn, {
|
21458 | disabled: disabled
|
21459 | }, ":"), seconds && React.createElement("div", null, React.createElement(NumberSpinner, _extends_1({
|
21460 | name: "seconds",
|
21461 | disabled: disabled,
|
21462 | error: error,
|
21463 | min: 0,
|
21464 | max: 59,
|
21465 | onChange: function onChange(event, val) {
|
21466 | return _this2.onChange(event, 'seconds', val);
|
21467 | },
|
21468 | onBlur: this.onBlur,
|
21469 | value: secondsValue
|
21470 | }, props))));
|
21471 | };
|
21472 |
|
21473 | return TimePicker;
|
21474 | }(Component);
|
21475 |
|
21476 | var hoursPropValidation = function hoursPropValidation(props, propName, componentName) {
|
21477 | var minutes = props.minutes,
|
21478 | seconds = props.seconds,
|
21479 | hours = props.hours;
|
21480 |
|
21481 | if (props[propName] === undefined || typeof props[propName] !== 'boolean') {
|
21482 | return new Error("Failed prop format: The prop '" + propName + "' is marked as required in " + componentName + ", but its value is " + typeof props[propName] + ".");
|
21483 | }
|
21484 |
|
21485 | if (minutes === false && seconds === true && hours === true || minutes === false && seconds === false && hours === false) {
|
21486 | return new Error('Please provide a valid time combination!');
|
21487 | }
|
21488 |
|
21489 | return null;
|
21490 | };
|
21491 |
|
21492 | TimePicker.defaultProps = {
|
21493 | disabled: false,
|
21494 | error: false,
|
21495 | onBlur: function onBlur() {}
|
21496 | };
|
21497 | TimePicker.displayName = 'TimePicker';
|
21498 | TimePicker.propTypes = {
|
21499 | onChange: PropTypes.func.isRequired,
|
21500 | onBlur: PropTypes.func,
|
21501 | name: PropTypes.string.isRequired,
|
21502 | value: PropTypes.objectOf(moment).isRequired,
|
21503 | disabled: PropTypes.bool,
|
21504 | error: PropTypes.bool,
|
21505 | seconds: PropTypes.bool.isRequired,
|
21506 | minutes: PropTypes.bool.isRequired,
|
21507 | hours: hoursPropValidation
|
21508 | };
|
21509 | var Container$1 = styled.div(_templateObject$T());
|
21510 | Container$1.displayName = 'Container';
|
21511 | var MiddleColumn = styled.div(_templateObject2$l(), function (_ref) {
|
21512 | var disabled = _ref.disabled,
|
21513 | theme = _ref.theme;
|
21514 | return disabled ? theme.timePicker.disabledColor : theme.timePicker.textColor;
|
21515 | });
|
21516 | MiddleColumn.displayName = 'MiddleColumn';
|
21517 |
|
21518 | var Header$2 = function Header$$1(_ref) {
|
21519 | var bold = _ref.bold,
|
21520 | italic = _ref.italic,
|
21521 | underlined = _ref.underlined,
|
21522 | uppercase = _ref.uppercase,
|
21523 | size = _ref.size,
|
21524 | color = _ref.color,
|
21525 | props = objectWithoutPropertiesLoose(_ref, ["bold", "italic", "underlined", "uppercase", "size", "color"]);
|
21526 |
|
21527 | return React.createElement(Header, _extends_1({
|
21528 | as: function as(textProps) {
|
21529 | return React.createElement(Text, _extends_1({
|
21530 | size: size,
|
21531 | color: color,
|
21532 | bold: bold,
|
21533 | underlined: underlined,
|
21534 | uppercase: uppercase
|
21535 | }, textProps));
|
21536 | }
|
21537 | }, props));
|
21538 | };
|
21539 |
|
21540 | Header$2.displayName = 'Header';
|
21541 | Header$2.defaultProps = {
|
21542 | color: 'darkGray',
|
21543 | italic: false,
|
21544 | uppercase: false,
|
21545 | size: 'xl',
|
21546 | bold: true,
|
21547 | underlined: false
|
21548 | };
|
21549 | Header$2.propTypes = {
|
21550 | color: PropTypes.string,
|
21551 | italic: PropTypes.bool,
|
21552 | uppercase: PropTypes.bool,
|
21553 | size: PropTypes.oneOf(['sm', 'md', 'lg', 'xl', 'xxl']),
|
21554 | bold: PropTypes.bool,
|
21555 | underlined: PropTypes.bool
|
21556 | };
|
21557 |
|
21558 | var BigHeader = function BigHeader(props) {
|
21559 | return React.createElement(Header$2, _extends_1({
|
21560 | color: "darkGray",
|
21561 | bold: true,
|
21562 | size: "xxl"
|
21563 | }, props));
|
21564 | };
|
21565 |
|
21566 | BigHeader.displayName = 'BigHeader';
|
21567 |
|
21568 | var SubHeader = function SubHeader(props) {
|
21569 | return React.createElement(Header$2, _extends_1({
|
21570 | color: "darkGray",
|
21571 | bold: true,
|
21572 | size: "lg"
|
21573 | }, props));
|
21574 | };
|
21575 |
|
21576 | SubHeader.displayName = 'SubHeader';
|
21577 |
|
21578 | var TextTruncate = function TextTruncate(_ref) {
|
21579 | var text = _ref.text,
|
21580 | length = _ref.length,
|
21581 | place = _ref.place;
|
21582 | var ending = '...';
|
21583 | var truncatedString = "" + text.substring(0, length - ending.length) + ending;
|
21584 | var slashedString = text.split(' ').join('_') + "-tooltip";
|
21585 | if (text.length < length) return text;
|
21586 | return React.createElement(Fragment, null, React.createElement(Tooltip, {
|
21587 | multiline: true,
|
21588 | id: slashedString,
|
21589 | place: place,
|
21590 | trigger: React.createElement("div", {
|
21591 | "data-tip": text,
|
21592 | "data-for": slashedString
|
21593 | }, truncatedString)
|
21594 | }));
|
21595 | };
|
21596 |
|
21597 | TextTruncate.defaultProps = {
|
21598 | length: 38,
|
21599 | place: 'top'
|
21600 | };
|
21601 | TextTruncate.propTypes = {
|
21602 | /** The string to truncate */
|
21603 | text: PropTypes.string.isRequired,
|
21604 |
|
21605 | /** Tooltip position */
|
21606 | place: PropTypes.oneOf(['top', 'right', 'left', 'bottom']),
|
21607 |
|
21608 | /** The max lenght of the visible string */
|
21609 | length: PropTypes.number
|
21610 | };
|
21611 |
|
21612 | function _templateObject4$b() {
|
21613 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tjustify-content: center;\n\talign-items: center;\n\tpadding-left: 0;\n\tpadding-right: 0;\n\theight: 100%;\n\tfont-weight: bold;\n"]);
|
21614 |
|
21615 | _templateObject4$b = function _templateObject4() {
|
21616 | return data;
|
21617 | };
|
21618 |
|
21619 | return data;
|
21620 | }
|
21621 |
|
21622 | function _templateObject3$f() {
|
21623 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tflex-direction: column;\n"]);
|
21624 |
|
21625 | _templateObject3$f = function _templateObject3() {
|
21626 | return data;
|
21627 | };
|
21628 |
|
21629 | return data;
|
21630 | }
|
21631 |
|
21632 | function _templateObject2$m() {
|
21633 | var data = taggedTemplateLiteralLoose(["\n\tmargin: 0 15px;\n"]);
|
21634 |
|
21635 | _templateObject2$m = function _templateObject2() {
|
21636 | return data;
|
21637 | };
|
21638 |
|
21639 | return data;
|
21640 | }
|
21641 |
|
21642 | function _templateObject$U() {
|
21643 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: inline-flex;\n\talign-items: center;\n"]);
|
21644 |
|
21645 | _templateObject$U = function _templateObject() {
|
21646 | return data;
|
21647 | };
|
21648 |
|
21649 | return data;
|
21650 | }
|
21651 | var FROM_LOWER_LIMIT = moment.duration('00:00').asMilliseconds();
|
21652 | var FROM_HIGHER_LIMIT = moment.duration('23:58').asMilliseconds();
|
21653 | var TO_LOWER_LIMIT = moment.duration('00:01').asMilliseconds();
|
21654 | var TO_HIGHER_LIMIT = moment.duration('23:59').asMilliseconds();
|
21655 |
|
21656 | var TimePickerGroup = function TimePickerGroup(_ref) {
|
21657 | var from = _ref.from,
|
21658 | to = _ref.to,
|
21659 | onChange = _ref.onChange,
|
21660 | disabled = _ref.disabled,
|
21661 | hours = _ref.hours,
|
21662 | minutes = _ref.minutes,
|
21663 | seconds = _ref.seconds,
|
21664 | fromLabel = _ref.fromLabel,
|
21665 | toLabel = _ref.toLabel,
|
21666 | middleLabel = _ref.middleLabel,
|
21667 | props = objectWithoutPropertiesLoose(_ref, ["from", "to", "onChange", "disabled", "hours", "minutes", "seconds", "fromLabel", "toLabel", "middleLabel"]);
|
21668 |
|
21669 | var _useState = useState(from),
|
21670 | beginTime = _useState[0],
|
21671 | setBeginTime = _useState[1];
|
21672 |
|
21673 | var _useState2 = useState(to),
|
21674 | endTime = _useState2[0],
|
21675 | setEndTime = _useState2[1];
|
21676 |
|
21677 | var getLeastSignificantValue = function getLeastSignificantValue() {
|
21678 | return seconds ? 's' : minutes ? 'm' : 'h';
|
21679 | };
|
21680 |
|
21681 | var checkBounds = function checkBounds(value, isFrom) {
|
21682 | if (isFrom === void 0) {
|
21683 | isFrom = false;
|
21684 | }
|
21685 |
|
21686 | return isFrom ? value >= FROM_LOWER_LIMIT && value <= FROM_HIGHER_LIMIT : value >= TO_LOWER_LIMIT && value <= TO_HIGHER_LIMIT;
|
21687 | };
|
21688 |
|
21689 | var handleChangeFrom = function handleChangeFrom(value) {
|
21690 | if (checkBounds(value, true)) {
|
21691 | var newEndTime = endTime;
|
21692 |
|
21693 | if (value.asMilliseconds() >= endTime.asMilliseconds()) {
|
21694 | newEndTime = value.clone().add(moment.duration(1, getLeastSignificantValue()));
|
21695 | setEndTime(newEndTime);
|
21696 | }
|
21697 |
|
21698 | setBeginTime(value);
|
21699 | onChange({
|
21700 | from: value,
|
21701 | to: newEndTime
|
21702 | });
|
21703 | } else {
|
21704 | setBeginTime(beginTime.clone());
|
21705 | }
|
21706 | };
|
21707 |
|
21708 | var handleChangeTo = function handleChangeTo(value) {
|
21709 | if (checkBounds(value)) {
|
21710 | var newBeginTime = beginTime;
|
21711 |
|
21712 | if (beginTime.asMilliseconds() >= value.asMilliseconds()) {
|
21713 | newBeginTime = value.clone().subtract(moment.duration(1, getLeastSignificantValue()));
|
21714 | setBeginTime(newBeginTime);
|
21715 | }
|
21716 |
|
21717 | setEndTime(value);
|
21718 | onChange({
|
21719 | from: newBeginTime,
|
21720 | to: value
|
21721 | });
|
21722 | } else {
|
21723 | setEndTime(endTime.clone());
|
21724 | }
|
21725 | };
|
21726 |
|
21727 | return React.createElement(Container$2, _extends_1({
|
21728 | middleLabel: middleLabel
|
21729 | }, props), React.createElement(TimePickerWithLabel, null, fromLabel && React.createElement(LabelText, null, fromLabel), React.createElement(TimePicker, {
|
21730 | name: "TimePickerFrom",
|
21731 | disabled: disabled,
|
21732 | onChange: handleChangeFrom,
|
21733 | hours: hours,
|
21734 | minutes: minutes,
|
21735 | seconds: seconds,
|
21736 | value: beginTime
|
21737 | })), React.createElement(MiddleLabel, null, middleLabel && React.createElement(SpanStyled, null, middleLabel)), React.createElement(TimePickerWithLabel, null, toLabel && React.createElement(LabelText, null, toLabel), React.createElement(TimePicker, {
|
21738 | name: "TimePickerTo",
|
21739 | disabled: disabled,
|
21740 | onChange: handleChangeTo,
|
21741 | hours: hours,
|
21742 | minutes: minutes,
|
21743 | seconds: seconds,
|
21744 | value: endTime
|
21745 | })));
|
21746 | };
|
21747 |
|
21748 | var Container$2 = styled.div(_templateObject$U());
|
21749 | Container$2.displayName = 'Container';
|
21750 | var MiddleLabel = styled.div(_templateObject2$m());
|
21751 | var TimePickerWithLabel = styled.div(_templateObject3$f());
|
21752 | var SpanStyled = styled.span(_templateObject4$b());
|
21753 | TimePickerGroup.defaultProps = {
|
21754 | fromLabel: '',
|
21755 | toLabel: '',
|
21756 | disabled: false,
|
21757 | hours: true,
|
21758 | minutes: true,
|
21759 | seconds: false,
|
21760 | middleLabel: ''
|
21761 | };
|
21762 | TimePickerGroup.propTypes = {
|
21763 | from: PropTypes.objectOf(moment).isRequired,
|
21764 | to: PropTypes.objectOf(moment).isRequired,
|
21765 | fromLabel: PropTypes.string,
|
21766 | toLabel: PropTypes.string,
|
21767 | onChange: PropTypes.func.isRequired,
|
21768 | disabled: PropTypes.bool,
|
21769 | hours: PropTypes.bool,
|
21770 | minutes: PropTypes.bool,
|
21771 | seconds: PropTypes.bool,
|
21772 | middleLabel: PropTypes.string
|
21773 | };
|
21774 |
|
21775 | var SmileyVeryBad = function SmileyVeryBad(_ref) {
|
21776 | var fill = _ref.fill,
|
21777 | width = _ref.width,
|
21778 | height = _ref.height;
|
21779 | return React.createElement("svg", {
|
21780 | width: width,
|
21781 | height: height,
|
21782 | viewBox: "0 0 88 88",
|
21783 | fill: "none",
|
21784 | xmlns: "http://www.w3.org/2000/svg"
|
21785 | }, React.createElement("path", {
|
21786 | d: "M43.9955 0C19.7366 0 0 19.7366 0 43.9965C0 68.2583 19.7366 87.996 43.9955 87.996C68.2583 87.996 87.998 68.2583 87.998 43.9965C87.998 19.7366 68.2593 0 43.9955 0ZM43.9955 81.9499C23.0716 81.9499 6.04707 64.9234 6.04707 43.9965C6.04707 23.0716 23.0716 6.04707 43.9955 6.04707C64.9244 6.04707 81.9509 23.0716 81.9509 43.9965C81.9509 64.9234 64.9244 81.9499 43.9955 81.9499Z",
|
21787 | fill: fill
|
21788 | }), React.createElement("path", {
|
21789 | d: "M44.0327 15.0532C27.882 15.0532 14.7427 28.1935 14.7427 44.3432C14.7427 60.4929 27.882 73.6322 44.0327 73.6322C60.1844 73.6322 73.3247 60.4929 73.3247 44.3432C73.3257 28.1925 60.1854 15.0532 44.0327 15.0532ZM28.784 31.1001C29.2587 30.2939 30.2998 30.0187 31.1111 30.4924L41.4516 36.5526C42.2629 37.0293 42.53 38.0674 42.0603 38.8787C41.7439 39.4179 41.1744 39.7192 40.5919 39.7192C40.3954 39.7192 40.1938 39.6708 40.0053 39.6013C39.958 39.6991 39.9227 39.7988 39.8693 39.8976C38.9168 41.5162 36.8336 42.0604 35.216 41.1121C33.5924 40.1627 33.0542 38.0764 34.0016 36.4599C34.051 36.3752 34.1155 36.3046 34.1689 36.228L29.3917 33.4303C28.5804 32.9515 28.3113 31.9104 28.784 31.1001ZM58.7331 57.2981C58.1052 57.9945 57.0288 58.0469 56.3354 57.417C52.9571 54.3723 48.5972 50.6775 44.0488 50.6775C39.4863 50.6775 35.1163 54.3814 31.738 57.4422C31.4134 57.7385 31.0053 57.8846 30.5981 57.8846C30.1375 57.8846 29.6769 57.6962 29.3403 57.3253C28.7084 56.6319 28.7618 55.5565 29.4562 54.9296C33.4604 51.2984 38.6427 47.2781 44.0518 47.2781C49.4418 47.2781 54.613 51.2822 58.6101 54.8933C59.3106 55.5273 59.363 56.6026 58.7331 57.2981ZM58.6767 33.4293L53.8975 36.223C53.9589 36.3036 54.0194 36.3742 54.0668 36.4588C55.0192 38.0754 54.4739 40.1617 52.8543 41.1111C51.2368 42.0564 49.1495 41.5112 48.2052 39.8946C48.1517 39.7978 48.1124 39.6981 48.0671 39.5953C47.8746 39.6668 47.6791 39.7152 47.4805 39.7152C46.8939 39.7152 46.3265 39.4169 46.0121 38.8757C45.5374 38.0664 45.8075 37.0283 46.6168 36.5516L56.9613 30.4914C57.7686 30.0167 58.8097 30.2848 59.2844 31.0991C59.7571 31.9104 59.487 32.9515 58.6767 33.4293Z",
|
21790 | fill: fill
|
21791 | }));
|
21792 | };
|
21793 |
|
21794 | SmileyVeryBad.defaultProps = {
|
21795 | fill: theme.colors.red,
|
21796 | width: 24,
|
21797 | height: 24
|
21798 | };
|
21799 | SmileyVeryBad.propTypes = {
|
21800 | fill: PropTypes.string,
|
21801 | width: PropTypes.number,
|
21802 | height: PropTypes.number
|
21803 | };
|
21804 |
|
21805 | var SmileyBad = function SmileyBad(_ref) {
|
21806 | var fill = _ref.fill,
|
21807 | width = _ref.width,
|
21808 | height = _ref.height;
|
21809 | return React.createElement("svg", {
|
21810 | width: width,
|
21811 | height: height,
|
21812 | viewBox: "0 0 89 88",
|
21813 | fill: "none",
|
21814 | xmlns: "http://www.w3.org/2000/svg"
|
21815 | }, React.createElement("path", {
|
21816 | d: "M44.0305 14.7104C27.8808 14.7104 14.7415 27.8507 14.7415 44.0015C14.7415 60.1512 27.8798 73.2904 44.0305 73.2904C60.1813 73.2904 73.3225 60.1512 73.3225 44.0015C73.3215 27.8497 60.1813 14.7104 44.0305 14.7104ZM50.8597 31.736C52.7393 31.736 54.2632 33.2568 54.2632 35.1364C54.2632 37.011 52.7393 38.5369 50.8597 38.5369C48.9841 38.5369 47.4622 37.011 47.4622 35.1364C47.4622 33.2568 48.9841 31.736 50.8597 31.736ZM36.7025 31.736C38.5862 31.736 40.102 33.2568 40.102 35.1364C40.102 37.011 38.5862 38.5369 36.7025 38.5369C34.8289 38.5369 33.305 37.011 33.305 35.1364C33.305 33.2568 34.8289 31.736 36.7025 31.736ZM58.7632 54.9366C58.1373 55.634 57.0589 55.6894 56.3635 55.0605C52.9913 52.0138 48.6293 50.3358 44.0799 50.3358C39.5214 50.3358 35.1494 52.0209 31.7731 55.0867C31.4466 55.379 31.0374 55.5272 30.6292 55.5272C30.1686 55.5272 29.708 55.3397 29.3714 54.9698C28.7395 54.2754 28.7949 53.2001 29.4914 52.5691C33.4955 48.9399 38.6779 46.9373 44.0799 46.9373C49.4739 46.9373 54.6442 48.9268 58.6423 52.5399C59.3357 53.1688 59.3911 54.2402 58.7632 54.9366Z",
|
21817 | fill: fill
|
21818 | }), React.createElement("path", {
|
21819 | d: "M44.0025 0C19.7386 0 0 19.7366 0 43.9975C0 68.2603 19.7386 88 44.0025 88C68.2624 88 88.002 68.2603 88.002 43.9975C88.002 19.7366 68.2624 0 44.0025 0ZM44.0025 81.9529C23.0746 81.9529 6.04707 64.9264 6.04707 43.9975C6.04707 23.0716 23.0746 6.04707 44.0025 6.04707C64.9304 6.04707 81.9549 23.0716 81.9549 43.9975C81.9549 64.9264 64.9304 81.9529 44.0025 81.9529Z",
|
21820 | fill: fill
|
21821 | }));
|
21822 | };
|
21823 |
|
21824 | SmileyBad.defaultProps = {
|
21825 | fill: theme.colors.red,
|
21826 | width: 24,
|
21827 | height: 24
|
21828 | };
|
21829 | SmileyBad.propTypes = {
|
21830 | fill: PropTypes.string,
|
21831 | width: PropTypes.number,
|
21832 | height: PropTypes.number
|
21833 | };
|
21834 |
|
21835 | var SmileyBlank = function SmileyBlank(_ref) {
|
21836 | var fill = _ref.fill,
|
21837 | width = _ref.width,
|
21838 | height = _ref.height;
|
21839 | return React.createElement("svg", {
|
21840 | width: width,
|
21841 | height: height,
|
21842 | viewBox: "0 0 89 88",
|
21843 | fill: "none",
|
21844 | xmlns: "http://www.w3.org/2000/svg"
|
21845 | }, React.createElement("path", {
|
21846 | d: "M44.0025 0C19.7386 0 0 19.7366 0 43.9975C0 68.2603 19.7386 88 44.0025 88C68.2624 88 88.002 68.2603 88.002 43.9975C88.002 19.7366 68.2624 0 44.0025 0ZM44.0025 81.9529C23.0746 81.9529 6.04707 64.9264 6.04707 43.9975C6.04707 23.0716 23.0746 6.04707 44.0025 6.04707C64.9304 6.04707 81.9549 23.0716 81.9549 43.9975C81.9549 64.9264 64.9304 81.9529 44.0025 81.9529Z",
|
21847 | fill: fill
|
21848 | }), React.createElement("path", {
|
21849 | d: "M44.0328 14.7126C27.8821 14.7126 14.7428 27.8519 14.7428 44.0016C14.7428 60.1513 27.8821 73.2896 44.0328 73.2896C60.1835 73.2896 73.3228 60.1503 73.3228 44.0006C73.3228 27.8509 60.1845 14.7126 44.0328 14.7126ZM51.1159 31.7341C52.9895 31.7341 54.5093 33.257 54.5093 35.1366C54.5093 37.0112 52.9895 38.5361 51.1159 38.5361C49.2383 38.5361 47.7165 37.0112 47.7165 35.1366C47.7165 33.257 49.2373 31.7341 51.1159 31.7341ZM36.9587 31.7341C38.8343 31.7341 40.3562 33.257 40.3562 35.1366C40.3562 37.0112 38.8343 38.5361 36.9587 38.5361C35.0771 38.5361 33.5552 37.0112 33.5552 35.1366C33.5552 33.257 35.0771 31.7341 36.9587 31.7341ZM53.4622 54.5235H34.6044C33.6691 54.5235 32.9092 53.7606 32.9092 52.8243C32.9092 51.885 33.6691 51.1241 34.6044 51.1241H53.4622C54.4015 51.1241 55.1614 51.885 55.1614 52.8243C55.1604 53.7606 54.4015 54.5235 53.4622 54.5235Z",
|
21850 | fill: fill
|
21851 | }));
|
21852 | };
|
21853 |
|
21854 | SmileyBlank.defaultProps = {
|
21855 | fill: '#FBDC3B',
|
21856 | width: 24,
|
21857 | height: 24
|
21858 | };
|
21859 | SmileyBlank.propTypes = {
|
21860 | fill: PropTypes.string,
|
21861 | width: PropTypes.number,
|
21862 | height: PropTypes.number
|
21863 | };
|
21864 |
|
21865 | var SmileyGood = function SmileyGood(_ref) {
|
21866 | var fill = _ref.fill,
|
21867 | width = _ref.width,
|
21868 | height = _ref.height;
|
21869 | return React.createElement("svg", {
|
21870 | width: width,
|
21871 | height: height,
|
21872 | viewBox: "0 0 89 88",
|
21873 | fill: "none",
|
21874 | xmlns: "http://www.w3.org/2000/svg"
|
21875 | }, React.createElement("path", {
|
21876 | d: "M44.0025 0C19.7386 0 0 19.7366 0 43.9975C0 68.2603 19.7386 88 44.0025 88C68.2624 88 88.002 68.2603 88.002 43.9975C88.002 19.7366 68.2624 0 44.0025 0ZM44.0025 81.9529C23.0746 81.9529 6.04707 64.9264 6.04707 43.9975C6.04707 23.0716 23.0746 6.04707 44.0025 6.04707C64.9304 6.04707 81.9549 23.0716 81.9549 43.9975C81.9549 64.9264 64.9304 81.9529 44.0025 81.9529Z",
|
21877 | fill: fill
|
21878 | }), React.createElement("path", {
|
21879 | d: "M44.0325 14.7126C27.8818 14.7126 14.7426 27.8519 14.7426 44.0016C14.7426 60.1513 27.8818 73.2896 44.0325 73.2896C60.1833 73.2896 73.3225 60.1503 73.3225 44.0006C73.3225 27.8509 60.1843 14.7126 44.0325 14.7126ZM51.1157 31.7341C52.9893 31.7341 54.5091 33.257 54.5091 35.1366C54.5091 37.0112 52.9893 38.5361 51.1157 38.5361C49.2381 38.5361 47.7162 37.0112 47.7162 35.1366C47.7162 33.257 49.2371 31.7341 51.1157 31.7341ZM36.9212 31.7341C38.7988 31.7341 40.3227 33.257 40.3227 35.1366C40.3227 37.0112 38.7988 38.5361 36.9212 38.5361C35.0416 38.5361 33.5237 37.0112 33.5237 35.1366C33.5237 33.257 35.0416 31.7341 36.9212 31.7341ZM58.5697 50.1777C54.5857 53.9259 50.6077 57.792 44.0114 57.792C37.4745 57.792 33.3262 53.9894 29.4188 50.1424C28.7526 49.4863 28.675 48.4402 29.3029 47.7448C29.9288 47.0514 31.0051 47 31.7026 47.6279C35.0768 50.6917 37.9643 54.3935 44.0114 54.3935C50.0585 54.3935 52.9207 50.7018 56.293 47.6541C56.9894 47.0252 58.0628 47.0806 58.6927 47.773C59.3195 48.4745 59.2671 49.5458 58.5697 50.1777Z",
|
21880 | fill: fill
|
21881 | }));
|
21882 | };
|
21883 |
|
21884 | SmileyGood.defaultProps = {
|
21885 | fill: '#44A40A',
|
21886 | width: 24,
|
21887 | height: 24
|
21888 | };
|
21889 | SmileyGood.propTypes = {
|
21890 | fill: PropTypes.string,
|
21891 | width: PropTypes.number,
|
21892 | height: PropTypes.number
|
21893 | };
|
21894 |
|
21895 | var SmileyVeryGood = function SmileyVeryGood(_ref) {
|
21896 | var fill = _ref.fill,
|
21897 | width = _ref.width,
|
21898 | height = _ref.height;
|
21899 | return React.createElement("svg", {
|
21900 | width: width,
|
21901 | height: height,
|
21902 | viewBox: "0 0 88 88",
|
21903 | fill: "none",
|
21904 | xmlns: "http://www.w3.org/2000/svg"
|
21905 | }, React.createElement("path", {
|
21906 | d: "M44.0025 0C19.7397 0 0 19.7366 0 43.9975C0 68.2603 19.7397 88 44.0025 88C68.2634 88 88.001 68.2603 88.001 43.9975C88.001 19.7366 68.2634 0 44.0025 0ZM44.0025 81.9529C23.0746 81.9529 6.04707 64.9264 6.04707 43.9975C6.04707 23.0716 23.0746 6.04707 44.0025 6.04707C64.9294 6.04707 81.9539 23.0716 81.9539 43.9975C81.9539 64.9264 64.9294 81.9529 44.0025 81.9529Z",
|
21907 | fill: fill
|
21908 | }), React.createElement("path", {
|
21909 | d: "M59.0276 46.9375H28.9757C28.6703 46.9375 28.4345 47.0212 28.3277 47.1653C28.2229 47.3104 28.2148 47.5603 28.3065 47.8526C28.4597 48.3283 32.2099 59.5799 44.0027 59.5799C54.4561 59.5799 59.457 47.768 59.5074 47.649C59.6384 47.3275 59.6071 47.1431 59.5709 47.0897C59.5346 47.0363 59.3764 46.9375 59.0276 46.9375Z",
|
21910 | fill: fill
|
21911 | }), React.createElement("path", {
|
21912 | d: "M43.9988 14.7126C27.8501 14.7126 14.7119 27.8519 14.7119 44.0016C14.7119 60.1513 27.8491 73.2906 43.9988 73.2906C60.1506 73.2906 73.2908 60.1513 73.2908 44.0016C73.2908 27.8519 60.1516 14.7126 43.9988 14.7126ZM51.3773 28.1936C54.1922 28.1936 56.481 30.4814 56.481 33.2953C56.481 34.2346 55.7211 34.9955 54.7818 34.9955C53.8424 34.9955 53.0825 34.2346 53.0825 33.2953C53.0825 32.354 52.3166 31.59 51.3763 31.59C50.4369 31.59 49.668 32.355 49.668 33.2953C49.668 34.2346 48.9101 34.9955 47.9707 34.9955C47.0375 34.9955 46.2735 34.2346 46.2735 33.2953C46.2745 30.4824 48.5624 28.1936 51.3773 28.1936ZM36.6254 28.1936C39.4383 28.1936 41.7271 30.4814 41.7271 33.2953C41.7271 34.2346 40.9672 34.9955 40.0299 34.9955C39.0926 34.9955 38.3307 34.2346 38.3307 33.2953C38.3307 32.354 37.5627 31.59 36.6244 31.59C35.6831 31.59 34.9202 32.355 34.9202 33.2953C34.9202 34.2346 34.1562 34.9955 33.2209 34.9955C32.2836 34.9955 31.5197 34.2346 31.5197 33.2953C31.5207 30.4824 33.8105 28.1936 36.6254 28.1936ZM62.3033 48.797C62.0725 49.3614 56.5001 62.6034 44.0029 62.6034C29.9676 62.6034 25.4676 48.9028 25.4242 48.7647C25.0372 47.5442 25.2065 46.3096 25.8889 45.3794C26.5712 44.4491 27.6959 43.914 28.9749 43.914H59.0268C60.332 43.914 61.4436 44.4582 62.0806 45.4046C62.7175 46.3529 62.7992 47.5896 62.3033 48.797Z",
|
21913 | fill: fill
|
21914 | }));
|
21915 | };
|
21916 |
|
21917 | SmileyVeryGood.defaultProps = {
|
21918 | fill: '#44A40A',
|
21919 | width: 24,
|
21920 | height: 24
|
21921 | };
|
21922 | SmileyVeryGood.propTypes = {
|
21923 | fill: PropTypes.string,
|
21924 | width: PropTypes.number,
|
21925 | height: PropTypes.number
|
21926 | };
|
21927 |
|
21928 | var Star = function Star(_ref) {
|
21929 | var fill = _ref.fill,
|
21930 | width = _ref.width,
|
21931 | height = _ref.height;
|
21932 | return React.createElement("svg", {
|
21933 | width: width,
|
21934 | height: height,
|
21935 | viewBox: "0 0 26 24",
|
21936 | fill: "none",
|
21937 | xmlns: "http://www.w3.org/2000/svg"
|
21938 | }, React.createElement("path", {
|
21939 | d: "M12.7502 0L16.6898 7.90022L25.5 9.16742L19.1249 15.3165L20.6298 24L12.7502 19.9004L4.87022 24L6.37512 15.3165L0 9.16742L8.81023 7.90022L12.7502 0Z",
|
21940 | fill: fill
|
21941 | }));
|
21942 | };
|
21943 |
|
21944 | Star.displayName = 'Star';
|
21945 | Star.defaultProps = {
|
21946 | fill: theme.colors.gray,
|
21947 | width: 26,
|
21948 | height: 24
|
21949 | };
|
21950 | Star.propTypes = {
|
21951 | fill: PropTypes.string,
|
21952 | width: PropTypes.number,
|
21953 | height: PropTypes.number
|
21954 | };
|
21955 |
|
21956 | function _templateObject$V() {
|
21957 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: inline-block;\n\tmargin: 0 2px;\n"]);
|
21958 |
|
21959 | _templateObject$V = function _templateObject() {
|
21960 | return data;
|
21961 | };
|
21962 |
|
21963 | return data;
|
21964 | }
|
21965 |
|
21966 | var Rating = function Rating(_ref) {
|
21967 | var number = _ref.number,
|
21968 | type = _ref.type;
|
21969 | var _theme$colors = theme.colors,
|
21970 | yellow = _theme$colors.yellow,
|
21971 | gray = _theme$colors.gray,
|
21972 | orange = _theme$colors.orange;
|
21973 | var threeStars = [yellow, yellow, gray];
|
21974 | var fiveStars = [yellow, yellow, yellow, gray, gray];
|
21975 | var threeSmileys = [function () {
|
21976 | return React.createElement(SmileyBad, null);
|
21977 | }, function () {
|
21978 | return React.createElement(SmileyBlank, null);
|
21979 | }, function () {
|
21980 | return React.createElement(SmileyGood, null);
|
21981 | }];
|
21982 | var fiveSmileys = [function () {
|
21983 | return React.createElement(SmileyVeryBad, null);
|
21984 | }, function () {
|
21985 | return React.createElement(SmileyBad, {
|
21986 | fill: orange
|
21987 | });
|
21988 | }, function () {
|
21989 | return React.createElement(SmileyBlank, null);
|
21990 | }, function () {
|
21991 | return React.createElement(SmileyGood, {
|
21992 | fill: "#95C623"
|
21993 | });
|
21994 | }, function () {
|
21995 | return React.createElement(SmileyVeryGood, null);
|
21996 | }];
|
21997 | var stars = number === 3 ? threeStars : fiveStars;
|
21998 | var smileys = number === 3 ? threeSmileys : fiveSmileys;
|
21999 |
|
22000 | var renderSmileys = function renderSmileys() {
|
22001 | return smileys.map(function (Smiley, index$$1) {
|
22002 | return React.createElement(SvgContainer, {
|
22003 | key: index$$1
|
22004 | }, React.createElement(Smiley, null));
|
22005 | });
|
22006 | };
|
22007 |
|
22008 | var renderStars = function renderStars() {
|
22009 | return stars.map(function (color, index$$1) {
|
22010 | return React.createElement(SvgContainer, {
|
22011 | key: index$$1
|
22012 | }, React.createElement(Star, {
|
22013 | fill: color
|
22014 | }));
|
22015 | });
|
22016 | };
|
22017 |
|
22018 | return React.createElement("div", null, type === 'stars' ? renderStars(stars) : renderSmileys(smileys));
|
22019 | };
|
22020 |
|
22021 | var SvgContainer = styled.div(_templateObject$V());
|
22022 | Rating.displayName = 'Rating';
|
22023 | Rating.defaultProps = {
|
22024 | number: 3,
|
22025 | type: 'stars'
|
22026 | };
|
22027 | Rating.propTypes = {
|
22028 | /** number of Rating elements */
|
22029 | number: PropTypes.oneOf([3, 5]),
|
22030 |
|
22031 | /** type of Rating */
|
22032 | type: PropTypes.oneOf(['stars', 'smileys'])
|
22033 | };
|
22034 |
|
22035 | function _templateObject$W() {
|
22036 | var data = taggedTemplateLiteralLoose(["\n\twidth: ", "px;\n\theight: ", "px;\n\tbox-sizing: border-box;\n\tborder: thin ", ";\n\tborder-color: ", ";\n\tborder-radius: 4px;\n\tbox-shadow: ", ";\n\n\t:active,\n\t:hover {\n\t\tborder-color: ", ";\n\t}\n\tcursor: pointer;\n\tuser-select: none;\n"]);
|
22037 |
|
22038 | _templateObject$W = function _templateObject() {
|
22039 | return data;
|
22040 | };
|
22041 |
|
22042 | return data;
|
22043 | }
|
22044 | var WidgetCardWrapper = styled.div(_templateObject$W(), function (_ref) {
|
22045 | var width = _ref.width;
|
22046 | return width;
|
22047 | }, function (_ref2) {
|
22048 | var height = _ref2.height;
|
22049 | return height;
|
22050 | }, function (_ref3) {
|
22051 | var borderStyle = _ref3.borderStyle;
|
22052 | return borderStyle;
|
22053 | }, function (_ref4) {
|
22054 | var theme = _ref4.theme,
|
22055 | selected = _ref4.selected;
|
22056 | return selected ? theme.colors.deepBlue : theme.colors.strokeGray;
|
22057 | }, function (_ref5) {
|
22058 | var borderStyle = _ref5.borderStyle;
|
22059 | return borderStyle === 'dashed' && '0px 0px 4px rgba(0, 0, 0, 0.25)';
|
22060 | }, function (_ref6) {
|
22061 | var theme = _ref6.theme;
|
22062 | return theme.colors.deepBlue;
|
22063 | });
|
22064 | WidgetCardWrapper.displayName = 'WidgetCardWrapper';
|
22065 | WidgetCardWrapper.defaultProps = {
|
22066 | borderStyle: 'solid',
|
22067 | width: 57,
|
22068 | height: 57,
|
22069 | selected: false
|
22070 | };
|
22071 | WidgetCardWrapper.propTypes = {
|
22072 | borderStyle: PropTypes.oneOf(['dashed', 'solid']),
|
22073 | width: PropTypes.number,
|
22074 | height: PropTypes.number,
|
22075 | selected: PropTypes.bool
|
22076 | };
|
22077 |
|
22078 | var WidgetCardContainer = function WidgetCardContainer(_ref) {
|
22079 | var borderStyle = _ref.borderStyle,
|
22080 | selected = _ref.selected,
|
22081 | children = _ref.children,
|
22082 | width = _ref.width,
|
22083 | height = _ref.height,
|
22084 | props = objectWithoutPropertiesLoose(_ref, ["borderStyle", "selected", "children", "width", "height"]);
|
22085 |
|
22086 | return React.createElement(WidgetCardWrapper, _extends_1({
|
22087 | borderStyle: borderStyle,
|
22088 | selected: selected,
|
22089 | width: width,
|
22090 | height: height
|
22091 | }, props), children);
|
22092 | };
|
22093 |
|
22094 | WidgetCardContainer.defaultProps = {
|
22095 | borderStyle: 'solid',
|
22096 | children: undefined,
|
22097 | width: 57,
|
22098 | height: 57,
|
22099 | selected: false
|
22100 | };
|
22101 | WidgetCardContainer.propTypes = {
|
22102 | /** Style of the border (can be dashed or solid) */
|
22103 | borderStyle: PropTypes.oneOf(['dashed', 'solid']),
|
22104 |
|
22105 | /** Card content */
|
22106 | children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),
|
22107 |
|
22108 | /** Card Width in pixels */
|
22109 | width: PropTypes.number,
|
22110 |
|
22111 | /** Card Height in pixels */
|
22112 | height: PropTypes.number,
|
22113 |
|
22114 | /** is selected */
|
22115 | selected: PropTypes.bool
|
22116 | };
|
22117 | WidgetCardContainer.displayName = 'WidgetCardContainer';
|
22118 |
|
22119 | function _templateObject3$g() {
|
22120 | var data = taggedTemplateLiteralLoose(["\n\tcolor: ", ";\n\tfont-size: 12px;\n"]);
|
22121 |
|
22122 | _templateObject3$g = function _templateObject3() {
|
22123 | return data;
|
22124 | };
|
22125 |
|
22126 | return data;
|
22127 | }
|
22128 |
|
22129 | function _templateObject2$n() {
|
22130 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n"]);
|
22131 |
|
22132 | _templateObject2$n = function _templateObject2() {
|
22133 | return data;
|
22134 | };
|
22135 |
|
22136 | return data;
|
22137 | }
|
22138 |
|
22139 | function _templateObject$X() {
|
22140 | var data = taggedTemplateLiteralLoose(["\n\twidth: fit-content;\n\ttext-align: center;\n\n\t:hover {\n\t\t.Rating-label {\n\t\t\tcolor: ", ";\n\t\t}\n\t}\n"]);
|
22141 |
|
22142 | _templateObject$X = function _templateObject() {
|
22143 | return data;
|
22144 | };
|
22145 |
|
22146 | return data;
|
22147 | }
|
22148 |
|
22149 | var RatingBox = function RatingBox(_ref) {
|
22150 | var number = _ref.number,
|
22151 | label = _ref.label,
|
22152 | type = _ref.type;
|
22153 | return React.createElement(RatingBoxStyled, null, React.createElement(RatingBoxWrapper, {
|
22154 | width: 169,
|
22155 | height: 60,
|
22156 | number: number
|
22157 | }, React.createElement(Rating, {
|
22158 | number: number,
|
22159 | type: type
|
22160 | })), label && React.createElement(Label$3, {
|
22161 | className: "Rating-label"
|
22162 | }, label));
|
22163 | };
|
22164 |
|
22165 | var RatingBoxStyled = styled.div(_templateObject$X(), function (_ref2) {
|
22166 | var theme = _ref2.theme;
|
22167 | return theme.colors.deepBlue;
|
22168 | });
|
22169 | var RatingBoxWrapper = styled(WidgetCardContainer)(_templateObject2$n());
|
22170 | var Label$3 = styled.div(_templateObject3$g(), function (_ref3) {
|
22171 | var theme = _ref3.theme;
|
22172 | return theme.colors.mediumGray;
|
22173 | });
|
22174 | RatingBox.displayName = 'RatingBox';
|
22175 | RatingBox.defaultProps = {
|
22176 | number: 3,
|
22177 | label: undefined,
|
22178 | type: 'stars'
|
22179 | };
|
22180 | RatingBox.propTypes = {
|
22181 | /** number of Rating elements */
|
22182 | number: PropTypes.oneOf([3, 5]),
|
22183 |
|
22184 | /** type of Rating */
|
22185 | type: PropTypes.oneOf(['stars', 'smileys']),
|
22186 |
|
22187 | /** Label bellow the box */
|
22188 | label: PropTypes.string
|
22189 | };
|
22190 |
|
22191 | var constant$2 = createCommonjsModule(function (module, exports) {
|
22192 |
|
22193 | exports.__esModule = true;
|
22194 | exports.ACTION = exports.TYPE = exports.POSITION = void 0;
|
22195 | var POSITION = {
|
22196 | TOP_LEFT: 'top-left',
|
22197 | TOP_RIGHT: 'top-right',
|
22198 | TOP_CENTER: 'top-center',
|
22199 | BOTTOM_LEFT: 'bottom-left',
|
22200 | BOTTOM_RIGHT: 'bottom-right',
|
22201 | BOTTOM_CENTER: 'bottom-center'
|
22202 | };
|
22203 | exports.POSITION = POSITION;
|
22204 | var TYPE = {
|
22205 | INFO: 'info',
|
22206 | SUCCESS: 'success',
|
22207 | WARNING: 'warning',
|
22208 | ERROR: 'error',
|
22209 | DEFAULT: 'default'
|
22210 | };
|
22211 | exports.TYPE = TYPE;
|
22212 | var ACTION = {
|
22213 | SHOW: 0,
|
22214 | CLEAR: 1,
|
22215 | DID_MOUNT: 2,
|
22216 | WILL_UNMOUNT: 3,
|
22217 | ON_CHANGE: 4
|
22218 | };
|
22219 | exports.ACTION = ACTION;
|
22220 | });
|
22221 |
|
22222 | unwrapExports(constant$2);
|
22223 | var constant_1 = constant$2.ACTION;
|
22224 | var constant_2 = constant$2.TYPE;
|
22225 | var constant_3 = constant$2.POSITION;
|
22226 |
|
22227 | var propValidator = createCommonjsModule(function (module, exports) {
|
22228 |
|
22229 | exports.__esModule = true;
|
22230 | exports.isValidDelay = isValidDelay;
|
22231 | exports.objectValues = objectValues;
|
22232 | exports.falseOrElement = exports.falseOrDelay = void 0;
|
22233 |
|
22234 |
|
22235 |
|
22236 | function isValidDelay(val) {
|
22237 | return typeof val === 'number' && !isNaN(val) && val > 0;
|
22238 | }
|
22239 |
|
22240 | function objectValues(obj) {
|
22241 | return Object.keys(obj).map(function (key) {
|
22242 | return obj[key];
|
22243 | });
|
22244 | }
|
22245 |
|
22246 | function withRequired(fn) {
|
22247 | fn.isRequired = function (props, propName, componentName) {
|
22248 | var prop = props[propName];
|
22249 |
|
22250 | if (typeof prop === 'undefined') {
|
22251 | return new Error("The prop " + propName + " is marked as required in \n " + componentName + ", but its value is undefined.");
|
22252 | }
|
22253 |
|
22254 | fn(props, propName, componentName);
|
22255 | };
|
22256 |
|
22257 | return fn;
|
22258 | }
|
22259 |
|
22260 | var falseOrDelay = withRequired(function (props, propName, componentName) {
|
22261 | var prop = props[propName];
|
22262 |
|
22263 | if (prop !== false && !isValidDelay(prop)) {
|
22264 | return new Error(componentName + " expect " + propName + " \n to be a valid Number > 0 or equal to false. " + prop + " given.");
|
22265 | }
|
22266 |
|
22267 | return null;
|
22268 | });
|
22269 | exports.falseOrDelay = falseOrDelay;
|
22270 | var falseOrElement = withRequired(function (props, propName, componentName) {
|
22271 | var prop = props[propName];
|
22272 |
|
22273 | if (prop !== false && !(0, React.isValidElement)(prop)) {
|
22274 | return new Error(componentName + " expect " + propName + " \n to be a valid react element or equal to false. " + prop + " given.");
|
22275 | }
|
22276 |
|
22277 | return null;
|
22278 | });
|
22279 | exports.falseOrElement = falseOrElement;
|
22280 | });
|
22281 |
|
22282 | unwrapExports(propValidator);
|
22283 | var propValidator_1 = propValidator.isValidDelay;
|
22284 | var propValidator_2 = propValidator.objectValues;
|
22285 | var propValidator_3 = propValidator.falseOrElement;
|
22286 | var propValidator_4 = propValidator.falseOrDelay;
|
22287 |
|
22288 | var ProgressBar_1 = createCommonjsModule(function (module, exports) {
|
22289 |
|
22290 | exports.__esModule = true;
|
22291 | exports.default = void 0;
|
22292 |
|
22293 | var _react = _interopRequireDefault(React);
|
22294 |
|
22295 | var _propTypes = _interopRequireDefault(PropTypes);
|
22296 |
|
22297 | var _classnames = _interopRequireDefault(classnames);
|
22298 |
|
22299 |
|
22300 |
|
22301 |
|
22302 |
|
22303 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
22304 |
|
22305 | function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
22306 |
|
22307 | function ProgressBar(_ref) {
|
22308 | var _animationEvent;
|
22309 |
|
22310 | var delay = _ref.delay,
|
22311 | isRunning = _ref.isRunning,
|
22312 | closeToast = _ref.closeToast,
|
22313 | type = _ref.type,
|
22314 | hide = _ref.hide,
|
22315 | className = _ref.className,
|
22316 | userStyle = _ref.style,
|
22317 | controlledProgress = _ref.controlledProgress,
|
22318 | progress = _ref.progress,
|
22319 | isProgressDone = _ref.isProgressDone,
|
22320 | rtl = _ref.rtl;
|
22321 |
|
22322 | var style = _extends({}, userStyle, {
|
22323 | animationDuration: delay + "ms",
|
22324 | animationPlayState: isRunning ? 'running' : 'paused',
|
22325 | opacity: hide ? 0 : 1,
|
22326 | transform: controlledProgress ? "scaleX(" + progress + ")" : null
|
22327 | });
|
22328 |
|
22329 | var classNames = (0, _classnames.default)('Toastify__progress-bar', controlledProgress ? 'Toastify__progress-bar--controlled' : 'Toastify__progress-bar--animated', "Toastify__progress-bar--" + type, {
|
22330 | 'Toastify__progress-bar--rtl': rtl
|
22331 | }, className);
|
22332 | var animationEvent = (_animationEvent = {}, _animationEvent[controlledProgress && isProgressDone ? 'onTransitionEnd' : 'onAnimationEnd'] = controlledProgress && !isProgressDone ? null : closeToast, _animationEvent);
|
22333 | return _react.default.createElement("div", _extends({
|
22334 | className: classNames,
|
22335 | style: style
|
22336 | }, animationEvent));
|
22337 | }
|
22338 |
|
22339 | ProgressBar.propTypes = {
|
22340 | /**
|
22341 | * The animation delay which determine when to close the toast
|
22342 | */
|
22343 | delay: propValidator.falseOrDelay.isRequired,
|
22344 |
|
22345 | /**
|
22346 | * Whether or not the animation is running or paused
|
22347 | */
|
22348 | isRunning: _propTypes.default.bool.isRequired,
|
22349 |
|
22350 | /**
|
22351 | * Func to close the current toast
|
22352 | */
|
22353 | closeToast: _propTypes.default.func.isRequired,
|
22354 |
|
22355 | /**
|
22356 | * Support rtl content
|
22357 | */
|
22358 | rtl: _propTypes.default.bool.isRequired,
|
22359 |
|
22360 | /**
|
22361 | * Optional type : info, success ...
|
22362 | */
|
22363 | type: _propTypes.default.string,
|
22364 |
|
22365 | /**
|
22366 | * Hide or not the progress bar
|
22367 | */
|
22368 | hide: _propTypes.default.bool,
|
22369 |
|
22370 | /**
|
22371 | * Optionnal className
|
22372 | */
|
22373 | className: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.object]),
|
22374 |
|
22375 | /**
|
22376 | * Controlled progress value
|
22377 | */
|
22378 | progress: _propTypes.default.number,
|
22379 |
|
22380 | /**
|
22381 | * Tell wether or not controlled progress bar is used
|
22382 | */
|
22383 | controlledProgress: _propTypes.default.bool,
|
22384 |
|
22385 | /**
|
22386 | * Helper to close the toast when using controlled progress value
|
22387 | */
|
22388 | isProgressDone: _propTypes.default.bool
|
22389 | };
|
22390 | ProgressBar.defaultProps = {
|
22391 | type: constant$2.TYPE.DEFAULT,
|
22392 | hide: false
|
22393 | };
|
22394 | var _default = ProgressBar;
|
22395 | exports.default = _default;
|
22396 | });
|
22397 |
|
22398 | unwrapExports(ProgressBar_1);
|
22399 |
|
22400 | var Toast_1 = createCommonjsModule(function (module, exports) {
|
22401 |
|
22402 | exports.__esModule = true;
|
22403 | exports.default = void 0;
|
22404 |
|
22405 | var _react = _interopRequireWildcard(React);
|
22406 |
|
22407 | var _propTypes = _interopRequireDefault(PropTypes);
|
22408 |
|
22409 | var _classnames = _interopRequireDefault(classnames);
|
22410 |
|
22411 | var _ProgressBar = _interopRequireDefault(ProgressBar_1);
|
22412 |
|
22413 |
|
22414 |
|
22415 |
|
22416 |
|
22417 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
22418 |
|
22419 | function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
22420 |
|
22421 | function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
22422 |
|
22423 | function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
22424 |
|
22425 | function getX(e) {
|
22426 | return e.targetTouches && e.targetTouches.length >= 1 ? e.targetTouches[0].clientX : e.clientX;
|
22427 | }
|
22428 |
|
22429 | function getY(e) {
|
22430 | return e.targetTouches && e.targetTouches.length >= 1 ? e.targetTouches[0].clientY : e.clientY;
|
22431 | }
|
22432 |
|
22433 | var noop = function noop() {};
|
22434 |
|
22435 | var Toast =
|
22436 | /*#__PURE__*/
|
22437 | function (_Component) {
|
22438 | _inheritsLoose(Toast, _Component);
|
22439 |
|
22440 | function Toast() {
|
22441 | var _this;
|
22442 |
|
22443 | for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
22444 | args[_key] = arguments[_key];
|
22445 | }
|
22446 |
|
22447 | _this = _Component.call.apply(_Component, [this].concat(args)) || this;
|
22448 | _this.state = {
|
22449 | isRunning: true,
|
22450 | preventExitTransition: false
|
22451 | };
|
22452 | _this.flag = {
|
22453 | canCloseOnClick: true,
|
22454 | canDrag: false
|
22455 | };
|
22456 | _this.drag = {
|
22457 | start: 0,
|
22458 | x: 0,
|
22459 | y: 0,
|
22460 | deltaX: 0,
|
22461 | removalDistance: 0
|
22462 | };
|
22463 | _this.ref = null;
|
22464 |
|
22465 | _this.pauseToast = function () {
|
22466 | if (_this.props.autoClose) {
|
22467 | _this.setState({
|
22468 | isRunning: false
|
22469 | });
|
22470 | }
|
22471 | };
|
22472 |
|
22473 | _this.playToast = function () {
|
22474 | if (_this.props.autoClose) {
|
22475 | _this.setState({
|
22476 | isRunning: true
|
22477 | });
|
22478 | }
|
22479 | };
|
22480 |
|
22481 | _this.onDragStart = function (e) {
|
22482 | _this.flag.canCloseOnClick = true;
|
22483 | _this.flag.canDrag = true;
|
22484 | _this.ref.style.transition = '';
|
22485 | _this.drag.start = _this.drag.x = getX(e.nativeEvent);
|
22486 | _this.drag.removalDistance = _this.ref.offsetWidth * (_this.props.draggablePercent / 100);
|
22487 | };
|
22488 |
|
22489 | _this.onDragMove = function (e) {
|
22490 | if (_this.flag.canDrag) {
|
22491 | if (_this.state.isRunning) {
|
22492 | _this.pauseToast();
|
22493 | }
|
22494 |
|
22495 | _this.drag.x = getX(e);
|
22496 | _this.drag.deltaX = _this.drag.x - _this.drag.start; // prevent false positif during a toast click
|
22497 |
|
22498 | _this.drag.start !== _this.drag.x && (_this.flag.canCloseOnClick = false);
|
22499 | _this.ref.style.transform = "translateX(" + _this.drag.deltaX + "px)";
|
22500 | _this.ref.style.opacity = 1 - Math.abs(_this.drag.deltaX / _this.drag.removalDistance);
|
22501 | }
|
22502 | };
|
22503 |
|
22504 | _this.onDragEnd = function (e) {
|
22505 | if (_this.flag.canDrag) {
|
22506 | _this.flag.canDrag = false;
|
22507 |
|
22508 | if (Math.abs(_this.drag.deltaX) > _this.drag.removalDistance) {
|
22509 | _this.setState({
|
22510 | preventExitTransition: true
|
22511 | }, _this.props.closeToast);
|
22512 |
|
22513 | return;
|
22514 | }
|
22515 |
|
22516 | _this.drag.y = getY(e);
|
22517 | _this.ref.style.transition = 'transform 0.2s, opacity 0.2s';
|
22518 | _this.ref.style.transform = 'translateX(0)';
|
22519 | _this.ref.style.opacity = 1;
|
22520 | }
|
22521 | };
|
22522 |
|
22523 | _this.onDragTransitionEnd = function () {
|
22524 | var _this$ref$getBounding = _this.ref.getBoundingClientRect(),
|
22525 | top = _this$ref$getBounding.top,
|
22526 | bottom = _this$ref$getBounding.bottom,
|
22527 | left = _this$ref$getBounding.left,
|
22528 | right = _this$ref$getBounding.right;
|
22529 |
|
22530 | if (_this.props.pauseOnHover && _this.drag.x >= left && _this.drag.x <= right && _this.drag.y >= top && _this.drag.y <= bottom) {
|
22531 | _this.pauseToast();
|
22532 | } else {
|
22533 | _this.playToast();
|
22534 | }
|
22535 | };
|
22536 |
|
22537 | return _this;
|
22538 | }
|
22539 |
|
22540 | var _proto = Toast.prototype;
|
22541 |
|
22542 | _proto.componentDidMount = function componentDidMount() {
|
22543 | this.props.onOpen(this.props.children.props);
|
22544 |
|
22545 | if (this.props.draggable) {
|
22546 | this.bindDragEvents();
|
22547 | } // Maybe I could bind the event in the ToastContainer and rely on delegation
|
22548 |
|
22549 |
|
22550 | if (this.props.pauseOnFocusLoss) {
|
22551 | this.bindFocusEvents();
|
22552 | }
|
22553 | };
|
22554 |
|
22555 | _proto.componentDidUpdate = function componentDidUpdate(prevProps) {
|
22556 | if (prevProps.draggable !== this.props.draggable) {
|
22557 | if (this.props.draggable) {
|
22558 | this.bindDragEvents();
|
22559 | } else {
|
22560 | this.unbindDragEvents();
|
22561 | }
|
22562 | }
|
22563 |
|
22564 | if (prevProps.pauseOnFocusLoss !== this.props.pauseOnFocusLoss) {
|
22565 | if (this.props.pauseOnFocusLoss) {
|
22566 | this.bindFocusEvents();
|
22567 | } else {
|
22568 | this.unbindFocusEvents();
|
22569 | }
|
22570 | }
|
22571 | };
|
22572 |
|
22573 | _proto.componentWillUnmount = function componentWillUnmount() {
|
22574 | this.props.onClose(this.props.children.props);
|
22575 |
|
22576 | if (this.props.draggable) {
|
22577 | this.unbindDragEvents();
|
22578 | }
|
22579 |
|
22580 | if (this.props.pauseOnFocusLoss) {
|
22581 | this.unbindFocusEvents();
|
22582 | }
|
22583 | };
|
22584 |
|
22585 | _proto.bindFocusEvents = function bindFocusEvents() {
|
22586 | window.addEventListener('focus', this.playToast);
|
22587 | window.addEventListener('blur', this.pauseToast);
|
22588 | };
|
22589 |
|
22590 | _proto.unbindFocusEvents = function unbindFocusEvents() {
|
22591 | window.removeEventListener('focus', this.playToast);
|
22592 | window.removeEventListener('blur', this.pauseToast);
|
22593 | };
|
22594 |
|
22595 | _proto.bindDragEvents = function bindDragEvents() {
|
22596 | document.addEventListener('mousemove', this.onDragMove);
|
22597 | document.addEventListener('mouseup', this.onDragEnd);
|
22598 | document.addEventListener('touchmove', this.onDragMove);
|
22599 | document.addEventListener('touchend', this.onDragEnd);
|
22600 | };
|
22601 |
|
22602 | _proto.unbindDragEvents = function unbindDragEvents() {
|
22603 | document.removeEventListener('mousemove', this.onDragMove);
|
22604 | document.removeEventListener('mouseup', this.onDragEnd);
|
22605 | document.removeEventListener('touchmove', this.onDragMove);
|
22606 | document.removeEventListener('touchend', this.onDragEnd);
|
22607 | };
|
22608 |
|
22609 | _proto.render = function render() {
|
22610 | var _this2 = this;
|
22611 |
|
22612 | var _this$props = this.props,
|
22613 | closeButton = _this$props.closeButton,
|
22614 | children = _this$props.children,
|
22615 | autoClose = _this$props.autoClose,
|
22616 | pauseOnHover = _this$props.pauseOnHover,
|
22617 | closeOnClick = _this$props.closeOnClick,
|
22618 | type = _this$props.type,
|
22619 | hideProgressBar = _this$props.hideProgressBar,
|
22620 | closeToast = _this$props.closeToast,
|
22621 | Transition = _this$props.transition,
|
22622 | position = _this$props.position,
|
22623 | onExited = _this$props.onExited,
|
22624 | className = _this$props.className,
|
22625 | bodyClassName = _this$props.bodyClassName,
|
22626 | progressClassName = _this$props.progressClassName,
|
22627 | progressStyle = _this$props.progressStyle,
|
22628 | updateId = _this$props.updateId,
|
22629 | role = _this$props.role,
|
22630 | progress = _this$props.progress,
|
22631 | isProgressDone = _this$props.isProgressDone,
|
22632 | rtl = _this$props.rtl;
|
22633 | var toastProps = {
|
22634 | className: (0, _classnames.default)('Toastify__toast', "Toastify__toast--" + type, {
|
22635 | 'Toastify__toast--rtl': rtl
|
22636 | }, className)
|
22637 | };
|
22638 |
|
22639 | if (autoClose && pauseOnHover) {
|
22640 | toastProps.onMouseEnter = this.pauseToast;
|
22641 | toastProps.onMouseLeave = this.playToast;
|
22642 | } // prevent toast from closing when user drags the toast
|
22643 |
|
22644 |
|
22645 | if (closeOnClick) {
|
22646 | toastProps.onClick = function () {
|
22647 | return _this2.flag.canCloseOnClick && closeToast();
|
22648 | };
|
22649 | }
|
22650 |
|
22651 | var controlledProgress = parseFloat(progress) === progress;
|
22652 | return _react.default.createElement(Transition, {
|
22653 | in: this.props.in,
|
22654 | appear: true,
|
22655 | unmountOnExit: true,
|
22656 | onExited: onExited,
|
22657 | position: position,
|
22658 | preventExitTransition: this.state.preventExitTransition
|
22659 | }, _react.default.createElement("div", _extends({}, toastProps, {
|
22660 | ref: function ref(_ref) {
|
22661 | return _this2.ref = _ref;
|
22662 | },
|
22663 | onMouseDown: this.onDragStart,
|
22664 | onTouchStart: this.onDragStart,
|
22665 | onTransitionEnd: this.onDragTransitionEnd
|
22666 | }), _react.default.createElement("div", _extends({}, this.props.in && {
|
22667 | role: role
|
22668 | }, {
|
22669 | className: (0, _classnames.default)('Toastify__toast-body', bodyClassName)
|
22670 | }), children), closeButton && closeButton, (autoClose || controlledProgress) && _react.default.createElement(_ProgressBar.default, _extends({}, updateId && !controlledProgress ? {
|
22671 | key: "pb-" + updateId
|
22672 | } : {}, {
|
22673 | rtl: rtl,
|
22674 | delay: autoClose,
|
22675 | isRunning: this.state.isRunning,
|
22676 | closeToast: closeToast,
|
22677 | hide: hideProgressBar,
|
22678 | type: type,
|
22679 | style: progressStyle,
|
22680 | className: progressClassName,
|
22681 | controlledProgress: controlledProgress,
|
22682 | isProgressDone: isProgressDone,
|
22683 | progress: progress
|
22684 | }))));
|
22685 | };
|
22686 |
|
22687 | return Toast;
|
22688 | }(_react.Component);
|
22689 |
|
22690 | Toast.propTypes = {
|
22691 | closeButton: propValidator.falseOrElement.isRequired,
|
22692 | autoClose: propValidator.falseOrDelay.isRequired,
|
22693 | children: _propTypes.default.node.isRequired,
|
22694 | closeToast: _propTypes.default.func.isRequired,
|
22695 | position: _propTypes.default.oneOf((0, propValidator.objectValues)(constant$2.POSITION)).isRequired,
|
22696 | pauseOnHover: _propTypes.default.bool.isRequired,
|
22697 | pauseOnFocusLoss: _propTypes.default.bool.isRequired,
|
22698 | closeOnClick: _propTypes.default.bool.isRequired,
|
22699 | transition: _propTypes.default.func.isRequired,
|
22700 | rtl: _propTypes.default.bool.isRequired,
|
22701 | hideProgressBar: _propTypes.default.bool.isRequired,
|
22702 | draggable: _propTypes.default.bool.isRequired,
|
22703 | draggablePercent: _propTypes.default.number.isRequired,
|
22704 | in: _propTypes.default.bool,
|
22705 | onExited: _propTypes.default.func,
|
22706 | onOpen: _propTypes.default.func,
|
22707 | onClose: _propTypes.default.func,
|
22708 | type: _propTypes.default.oneOf((0, propValidator.objectValues)(constant$2.TYPE)),
|
22709 | className: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.object]),
|
22710 | bodyClassName: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.object]),
|
22711 | progressClassName: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.object]),
|
22712 | progressStyle: _propTypes.default.object,
|
22713 | progress: _propTypes.default.number,
|
22714 | isProgressDone: _propTypes.default.bool,
|
22715 | updateId: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
22716 | ariaLabel: _propTypes.default.string
|
22717 | };
|
22718 | Toast.defaultProps = {
|
22719 | type: constant$2.TYPE.DEFAULT,
|
22720 | in: true,
|
22721 | onOpen: noop,
|
22722 | onClose: noop,
|
22723 | className: null,
|
22724 | bodyClassName: null,
|
22725 | progressClassName: null,
|
22726 | updateId: null,
|
22727 | role: 'alert'
|
22728 | };
|
22729 | var _default = Toast;
|
22730 | exports.default = _default;
|
22731 | });
|
22732 |
|
22733 | unwrapExports(Toast_1);
|
22734 |
|
22735 | var CloseButton_1 = createCommonjsModule(function (module, exports) {
|
22736 |
|
22737 | exports.__esModule = true;
|
22738 | exports.default = void 0;
|
22739 |
|
22740 | var _react = _interopRequireDefault(React);
|
22741 |
|
22742 | var _propTypes = _interopRequireDefault(PropTypes);
|
22743 |
|
22744 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
22745 |
|
22746 | function CloseButton(_ref) {
|
22747 | var closeToast = _ref.closeToast,
|
22748 | type = _ref.type,
|
22749 | ariaLabel = _ref.ariaLabel;
|
22750 | return _react.default.createElement("button", {
|
22751 | className: "Toastify__close-button Toastify__close-button--" + type,
|
22752 | type: "button",
|
22753 | onClick: closeToast,
|
22754 | "aria-label": ariaLabel
|
22755 | }, "\u2716");
|
22756 | }
|
22757 |
|
22758 | CloseButton.propTypes = {
|
22759 | closeToast: _propTypes.default.func,
|
22760 | arialLabel: _propTypes.default.string
|
22761 | };
|
22762 | CloseButton.defaultProps = {
|
22763 | ariaLabel: 'close'
|
22764 | };
|
22765 | var _default = CloseButton;
|
22766 | exports.default = _default;
|
22767 | });
|
22768 |
|
22769 | unwrapExports(CloseButton_1);
|
22770 |
|
22771 | var cssTransition = createCommonjsModule(function (module, exports) {
|
22772 |
|
22773 | exports.__esModule = true;
|
22774 | exports.default = _default;
|
22775 |
|
22776 | var _react = _interopRequireDefault(React);
|
22777 |
|
22778 | var _Transition = _interopRequireDefault(Transition_1);
|
22779 |
|
22780 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
22781 |
|
22782 | function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
22783 |
|
22784 | function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
22785 |
|
22786 | var noop = function noop() {};
|
22787 |
|
22788 | function _default(_ref) {
|
22789 | var enter = _ref.enter,
|
22790 | exit = _ref.exit,
|
22791 | _ref$duration = _ref.duration,
|
22792 | duration = _ref$duration === void 0 ? 750 : _ref$duration,
|
22793 | _ref$appendPosition = _ref.appendPosition,
|
22794 | appendPosition = _ref$appendPosition === void 0 ? false : _ref$appendPosition;
|
22795 | return function Animation(_ref2) {
|
22796 | var children = _ref2.children,
|
22797 | position = _ref2.position,
|
22798 | preventExitTransition = _ref2.preventExitTransition,
|
22799 | props = _objectWithoutPropertiesLoose(_ref2, ["children", "position", "preventExitTransition"]);
|
22800 |
|
22801 | var enterClassName = appendPosition ? enter + "--" + position : enter;
|
22802 | var exitClassName = appendPosition ? exit + "--" + position : exit;
|
22803 | var enterDuration, exitDuration;
|
22804 |
|
22805 | if (Array.isArray(duration) && duration.length === 2) {
|
22806 | enterDuration = duration[0];
|
22807 | exitDuration = duration[1];
|
22808 | } else {
|
22809 | enterDuration = exitDuration = duration;
|
22810 | }
|
22811 |
|
22812 | var onEnter = function onEnter(node) {
|
22813 | node.classList.add(enterClassName);
|
22814 | node.style.animationFillMode = 'forwards';
|
22815 | node.style.animationDuration = enterDuration * 0.001 + "s";
|
22816 | };
|
22817 |
|
22818 | var onEntered = function onEntered(node) {
|
22819 | node.classList.remove(enterClassName);
|
22820 | node.style.cssText = '';
|
22821 | };
|
22822 |
|
22823 | var onExit = function onExit(node) {
|
22824 | node.classList.add(exitClassName);
|
22825 | node.style.animationFillMode = 'forwards';
|
22826 | node.style.animationDuration = exitDuration * 0.001 + "s";
|
22827 | };
|
22828 |
|
22829 | return _react.default.createElement(_Transition.default, _extends({}, props, {
|
22830 | timeout: preventExitTransition ? 0 : {
|
22831 | enter: enterDuration,
|
22832 | exit: exitDuration
|
22833 | },
|
22834 | onEnter: onEnter,
|
22835 | onEntered: onEntered,
|
22836 | onExit: preventExitTransition ? noop : onExit
|
22837 | }), children);
|
22838 | };
|
22839 | }
|
22840 | });
|
22841 |
|
22842 | unwrapExports(cssTransition);
|
22843 |
|
22844 | var Transitions = createCommonjsModule(function (module, exports) {
|
22845 |
|
22846 | exports.__esModule = true;
|
22847 | exports.Flip = exports.Zoom = exports.Slide = exports.Bounce = void 0;
|
22848 |
|
22849 | var _cssTransition = _interopRequireDefault(cssTransition);
|
22850 |
|
22851 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
22852 |
|
22853 | var Bounce = (0, _cssTransition.default)({
|
22854 | enter: 'Toastify__bounce-enter',
|
22855 | exit: 'Toastify__bounce-exit',
|
22856 | appendPosition: true
|
22857 | });
|
22858 | exports.Bounce = Bounce;
|
22859 | var Slide = (0, _cssTransition.default)({
|
22860 | enter: 'Toastify__slide-enter',
|
22861 | exit: 'Toastify__slide-exit',
|
22862 | duration: [450, 750],
|
22863 | appendPosition: true
|
22864 | });
|
22865 | exports.Slide = Slide;
|
22866 | var Zoom = (0, _cssTransition.default)({
|
22867 | enter: 'Toastify__zoom-enter',
|
22868 | exit: 'Toastify__zoom-exit'
|
22869 | });
|
22870 | exports.Zoom = Zoom;
|
22871 | var Flip = (0, _cssTransition.default)({
|
22872 | enter: 'Toastify__flip-enter',
|
22873 | exit: 'Toastify__flip-exit'
|
22874 | });
|
22875 | exports.Flip = Flip;
|
22876 | });
|
22877 |
|
22878 | unwrapExports(Transitions);
|
22879 | var Transitions_1 = Transitions.Flip;
|
22880 | var Transitions_2 = Transitions.Zoom;
|
22881 | var Transitions_3 = Transitions.Slide;
|
22882 | var Transitions_4 = Transitions.Bounce;
|
22883 |
|
22884 | var eventManager_1 = createCommonjsModule(function (module, exports) {
|
22885 |
|
22886 | exports.__esModule = true;
|
22887 | exports.default = void 0;
|
22888 | var eventManager = {
|
22889 | list: new Map(),
|
22890 | on: function on(event, callback) {
|
22891 | this.list.has(event) || this.list.set(event, []);
|
22892 | this.list.get(event).push(callback);
|
22893 | return this;
|
22894 | },
|
22895 | off: function off(event) {
|
22896 | this.list.delete(event);
|
22897 | return this;
|
22898 | },
|
22899 | emit: function emit(event) {
|
22900 | for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
22901 | args[_key - 1] = arguments[_key];
|
22902 | }
|
22903 |
|
22904 | if (!this.list.has(event)) {
|
22905 | return false;
|
22906 | }
|
22907 |
|
22908 | this.list.get(event).forEach(function (callback) {
|
22909 | return setTimeout(function () {
|
22910 | return callback.call.apply(callback, [null].concat(args));
|
22911 | }, 0);
|
22912 | });
|
22913 | return true;
|
22914 | }
|
22915 | };
|
22916 | var _default = eventManager;
|
22917 | exports.default = _default;
|
22918 | });
|
22919 |
|
22920 | unwrapExports(eventManager_1);
|
22921 |
|
22922 | var ToastContainer_1 = createCommonjsModule(function (module, exports) {
|
22923 |
|
22924 | exports.__esModule = true;
|
22925 | exports.default = void 0;
|
22926 |
|
22927 | var _react = _interopRequireWildcard(React);
|
22928 |
|
22929 | var _propTypes = _interopRequireDefault(PropTypes);
|
22930 |
|
22931 | var _classnames = _interopRequireDefault(classnames);
|
22932 |
|
22933 | var _TransitionGroup = _interopRequireDefault(TransitionGroup_1);
|
22934 |
|
22935 | var _Toast = _interopRequireDefault(Toast_1);
|
22936 |
|
22937 | var _CloseButton = _interopRequireDefault(CloseButton_1);
|
22938 |
|
22939 |
|
22940 |
|
22941 |
|
22942 |
|
22943 | var _eventManager = _interopRequireDefault(eventManager_1);
|
22944 |
|
22945 |
|
22946 |
|
22947 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
22948 |
|
22949 | function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
22950 |
|
22951 | function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
|
22952 |
|
22953 | function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
|
22954 |
|
22955 | function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
|
22956 |
|
22957 | function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
|
22958 |
|
22959 | function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
22960 |
|
22961 | function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
|
22962 |
|
22963 | var ToastContainer =
|
22964 | /*#__PURE__*/
|
22965 | function (_Component) {
|
22966 | _inheritsLoose(ToastContainer, _Component);
|
22967 |
|
22968 | function ToastContainer() {
|
22969 | var _this;
|
22970 |
|
22971 | for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
22972 | args[_key] = arguments[_key];
|
22973 | }
|
22974 |
|
22975 | _this = _Component.call.apply(_Component, [this].concat(args)) || this;
|
22976 | _this.state = {
|
22977 | toast: []
|
22978 | };
|
22979 | _this.toastKey = 1;
|
22980 | _this.collection = {};
|
22981 |
|
22982 | _this.isToastActive = function (id) {
|
22983 | return _this.state.toast.indexOf(id) !== -1;
|
22984 | };
|
22985 |
|
22986 | return _this;
|
22987 | }
|
22988 |
|
22989 | var _proto = ToastContainer.prototype;
|
22990 |
|
22991 | _proto.componentDidMount = function componentDidMount() {
|
22992 | var _this2 = this;
|
22993 |
|
22994 | _eventManager.default.on(constant$2.ACTION.SHOW, function (content, options) {
|
22995 | return _this2.show(content, options);
|
22996 | }).on(constant$2.ACTION.CLEAR, function (id) {
|
22997 | return !id ? _this2.clear() : _this2.removeToast(id);
|
22998 | }).emit(constant$2.ACTION.DID_MOUNT, this);
|
22999 | };
|
23000 |
|
23001 | _proto.componentWillUnmount = function componentWillUnmount() {
|
23002 | _eventManager.default.off(constant$2.ACTION.SHOW).off(constant$2.ACTION.CLEAR).emit(constant$2.ACTION.WILL_UNMOUNT);
|
23003 | };
|
23004 |
|
23005 | _proto.removeToast = function removeToast(id) {
|
23006 | this.setState({
|
23007 | toast: this.state.toast.filter(function (v) {
|
23008 | return v !== id;
|
23009 | })
|
23010 | }, this.dispatchChange);
|
23011 | };
|
23012 |
|
23013 | _proto.dispatchChange = function dispatchChange() {
|
23014 | _eventManager.default.emit(constant$2.ACTION.ON_CHANGE, this.state.toast.length);
|
23015 | };
|
23016 |
|
23017 | _proto.makeCloseButton = function makeCloseButton(toastClose, toastId, type) {
|
23018 | var _this3 = this;
|
23019 |
|
23020 | var closeButton = this.props.closeButton;
|
23021 |
|
23022 | if ((0, _react.isValidElement)(toastClose) || toastClose === false) {
|
23023 | closeButton = toastClose;
|
23024 | }
|
23025 |
|
23026 | return closeButton === false ? false : (0, _react.cloneElement)(closeButton, {
|
23027 | closeToast: function closeToast() {
|
23028 | return _this3.removeToast(toastId);
|
23029 | },
|
23030 | type: type
|
23031 | });
|
23032 | };
|
23033 |
|
23034 | _proto.getAutoCloseDelay = function getAutoCloseDelay(toastAutoClose) {
|
23035 | return toastAutoClose === false || (0, propValidator.isValidDelay)(toastAutoClose) ? toastAutoClose : this.props.autoClose;
|
23036 | };
|
23037 |
|
23038 | _proto.canBeRendered = function canBeRendered(content) {
|
23039 | return (0, _react.isValidElement)(content) || typeof content === 'string' || typeof content === 'number' || typeof content === 'function';
|
23040 | };
|
23041 |
|
23042 | _proto.parseClassName = function parseClassName(prop) {
|
23043 | if (typeof prop === 'string') {
|
23044 | return prop;
|
23045 | } else if (prop !== null && typeof prop === 'object' && 'toString' in prop) {
|
23046 | return prop.toString();
|
23047 | }
|
23048 |
|
23049 | return null;
|
23050 | };
|
23051 |
|
23052 | _proto.show = function show(content, options) {
|
23053 | var _this4 = this,
|
23054 | _extends2;
|
23055 |
|
23056 | if (!this.canBeRendered(content)) {
|
23057 | throw new Error("The element you provided cannot be rendered. You provided an element of type " + typeof content);
|
23058 | }
|
23059 |
|
23060 | var toastId = options.toastId;
|
23061 |
|
23062 | var closeToast = function closeToast() {
|
23063 | return _this4.removeToast(toastId);
|
23064 | };
|
23065 |
|
23066 | var toastOptions = {
|
23067 | id: toastId,
|
23068 | // ⚠️ if no options.key, this.toastKey - 1 is assigned
|
23069 | key: options.key || this.toastKey++,
|
23070 | type: options.type,
|
23071 | closeToast: closeToast,
|
23072 | updateId: options.updateId,
|
23073 | rtl: this.props.rtl,
|
23074 | position: options.position || this.props.position,
|
23075 | transition: options.transition || this.props.transition,
|
23076 | className: this.parseClassName(options.className || this.props.toastClassName),
|
23077 | bodyClassName: this.parseClassName(options.bodyClassName || this.props.bodyClassName),
|
23078 | closeButton: this.makeCloseButton(options.closeButton, toastId, options.type),
|
23079 | pauseOnHover: typeof options.pauseOnHover === 'boolean' ? options.pauseOnHover : this.props.pauseOnHover,
|
23080 | pauseOnFocusLoss: typeof options.pauseOnFocusLoss === 'boolean' ? options.pauseOnFocusLoss : this.props.pauseOnFocusLoss,
|
23081 | draggable: typeof options.draggable === 'boolean' ? options.draggable : this.props.draggable,
|
23082 | draggablePercent: typeof options.draggablePercent === 'number' && !isNaN(options.draggablePercent) ? options.draggablePercent : this.props.draggablePercent,
|
23083 | closeOnClick: typeof options.closeOnClick === 'boolean' ? options.closeOnClick : this.props.closeOnClick,
|
23084 | progressClassName: this.parseClassName(options.progressClassName || this.props.progressClassName),
|
23085 | progressStyle: this.props.progressStyle,
|
23086 | autoClose: this.getAutoCloseDelay(options.autoClose),
|
23087 | hideProgressBar: typeof options.hideProgressBar === 'boolean' ? options.hideProgressBar : this.props.hideProgressBar,
|
23088 | progress: parseFloat(options.progress),
|
23089 | isProgressDone: options.isProgressDone
|
23090 | };
|
23091 | typeof options.onOpen === 'function' && (toastOptions.onOpen = options.onOpen);
|
23092 | typeof options.onClose === 'function' && (toastOptions.onClose = options.onClose); // add closeToast function to react component only
|
23093 |
|
23094 | if ((0, _react.isValidElement)(content) && typeof content.type !== 'string' && typeof content.type !== 'number') {
|
23095 | content = (0, _react.cloneElement)(content, {
|
23096 | closeToast: closeToast
|
23097 | });
|
23098 | } else if (typeof content === 'function') {
|
23099 | content = content({
|
23100 | closeToast: closeToast
|
23101 | });
|
23102 | }
|
23103 |
|
23104 | this.collection = _extends({}, this.collection, (_extends2 = {}, _extends2[toastId] = {
|
23105 | position: toastOptions.position,
|
23106 | options: toastOptions,
|
23107 | content: content
|
23108 | }, _extends2));
|
23109 | this.setState({
|
23110 | toast: (toastOptions.updateId ? _toConsumableArray(this.state.toast) : _toConsumableArray(this.state.toast).concat([toastId])).filter(function (id) {
|
23111 | return id !== options.staleToastId;
|
23112 | })
|
23113 | }, this.dispatchChange);
|
23114 | };
|
23115 |
|
23116 | _proto.makeToast = function makeToast(content, options) {
|
23117 | return _react.default.createElement(_Toast.default, _extends({}, options, {
|
23118 | isDocumentHidden: this.state.isDocumentHidden,
|
23119 | key: "toast-" + options.key
|
23120 | }), content);
|
23121 | };
|
23122 |
|
23123 | _proto.clear = function clear() {
|
23124 | this.setState({
|
23125 | toast: []
|
23126 | });
|
23127 | };
|
23128 |
|
23129 | _proto.renderToast = function renderToast() {
|
23130 | var _this5 = this;
|
23131 |
|
23132 | var toastToRender = {};
|
23133 | var _this$props = this.props,
|
23134 | className = _this$props.className,
|
23135 | style = _this$props.style,
|
23136 | newestOnTop = _this$props.newestOnTop;
|
23137 | var collection = newestOnTop ? Object.keys(this.collection).reverse() : Object.keys(this.collection); // group toast by position
|
23138 |
|
23139 | collection.forEach(function (toastId) {
|
23140 | var _this5$collection$toa = _this5.collection[toastId],
|
23141 | position = _this5$collection$toa.position,
|
23142 | options = _this5$collection$toa.options,
|
23143 | content = _this5$collection$toa.content;
|
23144 | toastToRender[position] || (toastToRender[position] = []);
|
23145 |
|
23146 | if (_this5.state.toast.indexOf(options.id) !== -1) {
|
23147 | toastToRender[position].push(_this5.makeToast(content, options));
|
23148 | } else {
|
23149 | toastToRender[position].push(null);
|
23150 | delete _this5.collection[toastId];
|
23151 | }
|
23152 | });
|
23153 | return Object.keys(toastToRender).map(function (position) {
|
23154 | var disablePointer = toastToRender[position].length === 1 && toastToRender[position][0] === null;
|
23155 | var props = {
|
23156 | className: (0, _classnames.default)('Toastify__toast-container', "Toastify__toast-container--" + position, {
|
23157 | 'Toastify__toast-container--rtl': _this5.props.rtl
|
23158 | }, _this5.parseClassName(className)),
|
23159 | style: disablePointer ? _extends({}, style, {
|
23160 | pointerEvents: 'none'
|
23161 | }) : _extends({}, style)
|
23162 | };
|
23163 | return _react.default.createElement(_TransitionGroup.default, _extends({}, props, {
|
23164 | key: "container-" + position
|
23165 | }), toastToRender[position]);
|
23166 | });
|
23167 | };
|
23168 |
|
23169 | _proto.render = function render() {
|
23170 | return _react.default.createElement("div", {
|
23171 | className: "Toastify"
|
23172 | }, this.renderToast());
|
23173 | };
|
23174 |
|
23175 | return ToastContainer;
|
23176 | }(_react.Component);
|
23177 |
|
23178 | ToastContainer.propTypes = {
|
23179 | /**
|
23180 | * Set toast position
|
23181 | */
|
23182 | position: _propTypes.default.oneOf((0, propValidator.objectValues)(constant$2.POSITION)),
|
23183 |
|
23184 | /**
|
23185 | * Disable or set autoClose delay
|
23186 | */
|
23187 | autoClose: propValidator.falseOrDelay,
|
23188 |
|
23189 | /**
|
23190 | * Disable or set a custom react element for the close button
|
23191 | */
|
23192 | closeButton: propValidator.falseOrElement,
|
23193 |
|
23194 | /**
|
23195 | * Hide or not progress bar when autoClose is enabled
|
23196 | */
|
23197 | hideProgressBar: _propTypes.default.bool,
|
23198 |
|
23199 | /**
|
23200 | * Pause toast duration on hover
|
23201 | */
|
23202 | pauseOnHover: _propTypes.default.bool,
|
23203 |
|
23204 | /**
|
23205 | * Dismiss toast on click
|
23206 | */
|
23207 | closeOnClick: _propTypes.default.bool,
|
23208 |
|
23209 | /**
|
23210 | * Newest on top
|
23211 | */
|
23212 | newestOnTop: _propTypes.default.bool,
|
23213 |
|
23214 | /**
|
23215 | * An optional className
|
23216 | */
|
23217 | className: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.object]),
|
23218 |
|
23219 | /**
|
23220 | * An optional style
|
23221 | */
|
23222 | style: _propTypes.default.object,
|
23223 |
|
23224 | /**
|
23225 | * An optional className for the toast
|
23226 | */
|
23227 | toastClassName: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.object]),
|
23228 |
|
23229 | /**
|
23230 | * An optional className for the toast body
|
23231 | */
|
23232 | bodyClassName: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.object]),
|
23233 |
|
23234 | /**
|
23235 | * An optional className for the toast progress bar
|
23236 | */
|
23237 | progressClassName: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.object]),
|
23238 |
|
23239 | /**
|
23240 | * An optional style for the toast progress bar
|
23241 | */
|
23242 | progressStyle: _propTypes.default.object,
|
23243 |
|
23244 | /**
|
23245 | * Define enter and exit transition using react-transition-group
|
23246 | */
|
23247 | transition: _propTypes.default.func,
|
23248 |
|
23249 | /**
|
23250 | * Support rtl display
|
23251 | */
|
23252 | rtl: _propTypes.default.bool,
|
23253 |
|
23254 | /**
|
23255 | * Allow toast to be draggable
|
23256 | */
|
23257 | draggable: _propTypes.default.bool,
|
23258 |
|
23259 | /**
|
23260 | * The percentage of the toast's width it takes for a drag to dismiss a toast
|
23261 | */
|
23262 | draggablePercent: _propTypes.default.number,
|
23263 |
|
23264 | /**
|
23265 | * Pause the toast on focus loss
|
23266 | */
|
23267 | pauseOnFocusLoss: _propTypes.default.bool
|
23268 | };
|
23269 | ToastContainer.defaultProps = {
|
23270 | position: constant$2.POSITION.TOP_RIGHT,
|
23271 | transition: Transitions.Bounce,
|
23272 | rtl: false,
|
23273 | autoClose: 5000,
|
23274 | hideProgressBar: false,
|
23275 | closeButton: _react.default.createElement(_CloseButton.default, null),
|
23276 | pauseOnHover: true,
|
23277 | pauseOnFocusLoss: true,
|
23278 | closeOnClick: true,
|
23279 | newestOnTop: false,
|
23280 | draggable: true,
|
23281 | draggablePercent: 80,
|
23282 | className: null,
|
23283 | style: null,
|
23284 | toastClassName: null,
|
23285 | bodyClassName: null,
|
23286 | progressClassName: null,
|
23287 | progressStyle: null
|
23288 | };
|
23289 | var _default = ToastContainer;
|
23290 | exports.default = _default;
|
23291 | });
|
23292 |
|
23293 | unwrapExports(ToastContainer_1);
|
23294 |
|
23295 | var toast_1 = createCommonjsModule(function (module, exports) {
|
23296 |
|
23297 | exports.__esModule = true;
|
23298 | exports.default = void 0;
|
23299 |
|
23300 | var _eventManager = _interopRequireDefault(eventManager_1);
|
23301 |
|
23302 |
|
23303 |
|
23304 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
23305 |
|
23306 | function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
23307 |
|
23308 | var container = null;
|
23309 | var queue = [];
|
23310 |
|
23311 | var noop = function noop() {
|
23312 | return false;
|
23313 | };
|
23314 | /**
|
23315 | * Merge provided options with the defaults settings and generate the toastId
|
23316 | */
|
23317 |
|
23318 |
|
23319 | function mergeOptions(options, type) {
|
23320 | return _extends({}, options, {
|
23321 | type: type,
|
23322 | toastId: getToastId(options)
|
23323 | });
|
23324 | }
|
23325 | /**
|
23326 | * Generate a random toastId
|
23327 | */
|
23328 |
|
23329 |
|
23330 | function generateToastId() {
|
23331 | return (Math.random().toString(36) + Date.now().toString(36)).substr(2, 10);
|
23332 | }
|
23333 | /**
|
23334 | * Generate the toastId either automatically or by provided toastId
|
23335 | */
|
23336 |
|
23337 |
|
23338 | function getToastId(options) {
|
23339 | if (options && (typeof options.toastId === 'string' || typeof options.toastId === 'number' && !isNaN(options.toastId))) {
|
23340 | return options.toastId;
|
23341 | }
|
23342 |
|
23343 | return generateToastId();
|
23344 | }
|
23345 | /**
|
23346 | * Dispatch toast. If the container is not mounted, the toast is enqueued
|
23347 | */
|
23348 |
|
23349 |
|
23350 | function emitEvent(content, options) {
|
23351 | if (container !== null) {
|
23352 | _eventManager.default.emit(constant$2.ACTION.SHOW, content, options);
|
23353 | } else {
|
23354 | queue.push({
|
23355 | action: constant$2.ACTION.SHOW,
|
23356 | content: content,
|
23357 | options: options
|
23358 | });
|
23359 | }
|
23360 |
|
23361 | return options.toastId;
|
23362 | }
|
23363 |
|
23364 | var toast = _extends(function (content, options) {
|
23365 | return emitEvent(content, mergeOptions(options, options && options.type || constant$2.TYPE.DEFAULT));
|
23366 | }, {
|
23367 | success: function success(content, options) {
|
23368 | return emitEvent(content, mergeOptions(options, constant$2.TYPE.SUCCESS));
|
23369 | },
|
23370 | info: function info(content, options) {
|
23371 | return emitEvent(content, mergeOptions(options, constant$2.TYPE.INFO));
|
23372 | },
|
23373 | warn: function warn(content, options) {
|
23374 | return emitEvent(content, mergeOptions(options, constant$2.TYPE.WARNING));
|
23375 | },
|
23376 | warning: function warning(content, options) {
|
23377 | return emitEvent(content, mergeOptions(options, constant$2.TYPE.WARNING));
|
23378 | },
|
23379 | error: function error(content, options) {
|
23380 | return emitEvent(content, mergeOptions(options, constant$2.TYPE.ERROR));
|
23381 | },
|
23382 | dismiss: function dismiss(id) {
|
23383 | if (id === void 0) {
|
23384 | id = null;
|
23385 | }
|
23386 |
|
23387 | return container && _eventManager.default.emit(constant$2.ACTION.CLEAR, id);
|
23388 | },
|
23389 | isActive: noop,
|
23390 | update: function update(toastId, options) {
|
23391 | setTimeout(function () {
|
23392 | if (container && typeof container.collection[toastId] !== 'undefined') {
|
23393 | var _container$collection = container.collection[toastId],
|
23394 | oldOptions = _container$collection.options,
|
23395 | oldContent = _container$collection.content;
|
23396 |
|
23397 | var nextOptions = _extends({}, oldOptions, options, {
|
23398 | toastId: options.toastId || toastId
|
23399 | });
|
23400 |
|
23401 | if (!options.toastId || options.toastId === toastId) {
|
23402 | nextOptions.updateId = generateToastId();
|
23403 | } else {
|
23404 | nextOptions.staleToastId = toastId;
|
23405 | }
|
23406 |
|
23407 | var content = typeof nextOptions.render !== 'undefined' ? nextOptions.render : oldContent;
|
23408 | delete nextOptions.render;
|
23409 | emitEvent(content, nextOptions);
|
23410 | }
|
23411 | }, 0);
|
23412 | },
|
23413 | done: function done(id, progress) {
|
23414 | if (progress === void 0) {
|
23415 | progress = 1;
|
23416 | }
|
23417 |
|
23418 | toast.update(id, {
|
23419 | progress: progress,
|
23420 | isProgressDone: true
|
23421 | });
|
23422 | },
|
23423 | onChange: function onChange(callback) {
|
23424 | if (typeof callback === 'function') {
|
23425 | _eventManager.default.on(constant$2.ACTION.ON_CHANGE, callback);
|
23426 | }
|
23427 | },
|
23428 | POSITION: constant$2.POSITION,
|
23429 | TYPE: constant$2.TYPE
|
23430 | });
|
23431 | /**
|
23432 | * Wait until the ToastContainer is mounted to dispatch the toast
|
23433 | * and attach isActive method
|
23434 | */
|
23435 |
|
23436 |
|
23437 | _eventManager.default.on(constant$2.ACTION.DID_MOUNT, function (containerInstance) {
|
23438 | container = containerInstance;
|
23439 |
|
23440 | toast.isActive = function (id) {
|
23441 | return container.isToastActive(id);
|
23442 | };
|
23443 |
|
23444 | queue.forEach(function (item) {
|
23445 | _eventManager.default.emit(item.action, item.content, item.options);
|
23446 | });
|
23447 | queue = [];
|
23448 | }).on(constant$2.ACTION.WILL_UNMOUNT, function () {
|
23449 | container = null;
|
23450 | toast.isActive = noop;
|
23451 | });
|
23452 |
|
23453 | var _default = toast;
|
23454 | exports.default = _default;
|
23455 | });
|
23456 |
|
23457 | unwrapExports(toast_1);
|
23458 |
|
23459 | var lib = createCommonjsModule(function (module, exports) {
|
23460 |
|
23461 | exports.__esModule = true;
|
23462 |
|
23463 | var _ToastContainer = _interopRequireDefault(ToastContainer_1);
|
23464 |
|
23465 | exports.ToastContainer = _ToastContainer.default;
|
23466 |
|
23467 |
|
23468 |
|
23469 | exports.Bounce = Transitions.Bounce;
|
23470 | exports.Slide = Transitions.Slide;
|
23471 | exports.Zoom = Transitions.Zoom;
|
23472 | exports.Flip = Transitions.Flip;
|
23473 |
|
23474 |
|
23475 |
|
23476 | exports.ToastPosition = constant$2.POSITION;
|
23477 | exports.ToastType = constant$2.TYPE;
|
23478 |
|
23479 | var _toast = _interopRequireDefault(toast_1);
|
23480 |
|
23481 | exports.toast = _toast.default;
|
23482 |
|
23483 | var _cssTransition = _interopRequireDefault(cssTransition);
|
23484 |
|
23485 | exports.cssTransition = _cssTransition.default;
|
23486 |
|
23487 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
23488 | });
|
23489 |
|
23490 | unwrapExports(lib);
|
23491 | var lib_1 = lib.ToastContainer;
|
23492 | var lib_2 = lib.Bounce;
|
23493 | var lib_3 = lib.Slide;
|
23494 | var lib_4 = lib.Zoom;
|
23495 | var lib_5 = lib.Flip;
|
23496 | var lib_6 = lib.ToastPosition;
|
23497 | var lib_7 = lib.ToastType;
|
23498 | var lib_8 = lib.toast;
|
23499 | var lib_9 = lib.cssTransition;
|
23500 |
|
23501 | function _templateObject$Y() {
|
23502 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\n\twidth: 60px;\n\theight: 60px;\n\talign-items: center;\n\tjustify-content: center;\n\tpadding: 0;\n\n\tbackground: ", ";\n"]);
|
23503 |
|
23504 | _templateObject$Y = function _templateObject() {
|
23505 | return data;
|
23506 | };
|
23507 |
|
23508 | return data;
|
23509 | }
|
23510 | var ToastIconWrapper = styled.div(_templateObject$Y(), function (_ref) {
|
23511 | var bgColor = _ref.bgColor;
|
23512 | return bgColor;
|
23513 | });
|
23514 | ToastIconWrapper.displayName = 'ToastIconWrapper';
|
23515 |
|
23516 | var ToastIcon = function ToastIcon(_ref2) {
|
23517 | var bgColor = _ref2.bgColor,
|
23518 | icon = _ref2.icon,
|
23519 | size = _ref2.size,
|
23520 | color = _ref2.color,
|
23521 | props = objectWithoutPropertiesLoose(_ref2, ["bgColor", "icon", "size", "color"]);
|
23522 |
|
23523 | return React.createElement(ToastIconWrapper, _extends_1({
|
23524 | bgColor: bgColor
|
23525 | }, props), React.createElement(Icon$1, {
|
23526 | icon: icon,
|
23527 | size: size,
|
23528 | color: color
|
23529 | }));
|
23530 | };
|
23531 |
|
23532 | ToastIcon.defaultProps = {
|
23533 | bgColor: theme.toast.successColor,
|
23534 | size: 'big',
|
23535 | color: 'white'
|
23536 | };
|
23537 | ToastIcon.propTypes = {
|
23538 | bgColor: PropTypes.string,
|
23539 | icon: PropTypes.oneOf(IconName).isRequired,
|
23540 | size: PropTypes.string,
|
23541 | color: PropTypes.string
|
23542 | };
|
23543 | ToastIcon.displayName = 'ToastIcon';
|
23544 |
|
23545 | function _templateObject2$o() {
|
23546 | var data = taggedTemplateLiteralLoose(["\n\tpadding-left: 16px;\n\n\tcolor: ", ";\n\tfont-size: 13px;\n"]);
|
23547 |
|
23548 | _templateObject2$o = function _templateObject2() {
|
23549 | return data;
|
23550 | };
|
23551 |
|
23552 | return data;
|
23553 | }
|
23554 |
|
23555 | function _templateObject$Z() {
|
23556 | var data = taggedTemplateLiteralLoose(["\n\tpadding: 8px 16px;\n\n\tcolor: ", ";\n\tfont-size: 15px;\n\tfont-weight: bold;\n"]);
|
23557 |
|
23558 | _templateObject$Z = function _templateObject() {
|
23559 | return data;
|
23560 | };
|
23561 |
|
23562 | return data;
|
23563 | }
|
23564 | var ToastTitle = styled.div(_templateObject$Z(), function (_ref) {
|
23565 | var theme = _ref.theme;
|
23566 | return theme.toast.titleColor;
|
23567 | });
|
23568 | var ToastMessage = styled.div(_templateObject2$o(), function (_ref2) {
|
23569 | var theme = _ref2.theme;
|
23570 | return theme.toast.messageColor;
|
23571 | });
|
23572 |
|
23573 | var ToastBody = function ToastBody(_ref3) {
|
23574 | var title = _ref3.title,
|
23575 | message = _ref3.message;
|
23576 | return React.createElement("div", null, React.createElement(ToastTitle, null, title), React.createElement(ToastMessage, null, message));
|
23577 | };
|
23578 |
|
23579 | ToastBody.defaultProps = {
|
23580 | title: ''
|
23581 | };
|
23582 | ToastBody.propTypes = {
|
23583 | /** Text that will show on top in the body */
|
23584 | title: PropTypes.string,
|
23585 |
|
23586 | /** Text that will show on bottom in the body, bellow title if exists */
|
23587 | message: PropTypes.string.isRequired
|
23588 | };
|
23589 | ToastBody.displayName = 'ToastBody';
|
23590 |
|
23591 | function _templateObject$_() {
|
23592 | var data = taggedTemplateLiteralLoose(["\n\t.Toastify__toast {\n\t\tmin-height: 0;\n\t\tpadding: 0;\n\t}\n\n\t.Toastify__toast-body {\n\t\tdisplay: flex;\n\t\tmargin: 0;\n\t}\n\n\t.Toastify__close-button.Toastify__close-button--default .qube {\n\t\twidth: 300px !important;\n\t\theight: 60px !important;\n\n\t\tbackground: transparent;\n\t\tborder-radius: 4px;\n\n\t\tbox-shadow: 0 0 3px rgba(0, 0, 0, 0.25);\n\t}\n"]);
|
23593 |
|
23594 | _templateObject$_ = function _templateObject() {
|
23595 | return data;
|
23596 | };
|
23597 |
|
23598 | return data;
|
23599 | }
|
23600 | var ToastWrapper = styled(lib_1)(_templateObject$_());
|
23601 | ToastWrapper.defaultProps = {
|
23602 | suppressClassNameWarning: true
|
23603 | };
|
23604 | ToastWrapper.displayName = 'ToastWrapper';
|
23605 |
|
23606 | var Toast$1 = function Toast(_ref) {
|
23607 | var bgColor = _ref.bgColor,
|
23608 | icon = _ref.icon,
|
23609 | title = _ref.title,
|
23610 | message = _ref.message,
|
23611 | size = _ref.size,
|
23612 | color = _ref.color;
|
23613 | return React.createElement(Fragment, null, React.createElement(ToastIcon, {
|
23614 | bgColor: bgColor,
|
23615 | icon: icon,
|
23616 | size: size,
|
23617 | color: color
|
23618 | }), React.createElement(ToastBody, {
|
23619 | title: title,
|
23620 | message: message
|
23621 | }));
|
23622 | };
|
23623 |
|
23624 | Toast$1.defaultProps = {
|
23625 | bgColor: theme.toast.successColor,
|
23626 | size: 'big',
|
23627 | title: '',
|
23628 | color: 'white'
|
23629 | };
|
23630 | Toast$1.propTypes = {
|
23631 | bgColor: PropTypes.string,
|
23632 | icon: PropTypes.oneOf(IconName).isRequired,
|
23633 | title: PropTypes.string,
|
23634 | message: PropTypes.string.isRequired,
|
23635 | size: PropTypes.string,
|
23636 | color: PropTypes.string
|
23637 | };
|
23638 | Toast$1.displayName = 'Toast';
|
23639 |
|
23640 | var notify = function notify(bgColor, icon, title, message, size, color, options) {
|
23641 | lib_8(React.createElement(Toast$1, {
|
23642 | bgColor: bgColor,
|
23643 | icon: icon,
|
23644 | title: title,
|
23645 | message: message,
|
23646 | size: size,
|
23647 | color: color
|
23648 | }), _extends_1({}, options));
|
23649 | };
|
23650 |
|
23651 | var notifyError = function notifyError(title, message, options) {
|
23652 | lib_8(React.createElement(Toast$1, {
|
23653 | bgColor: theme.toast.errorColor,
|
23654 | icon: "error",
|
23655 | title: title,
|
23656 | message: message,
|
23657 | size: "big",
|
23658 | color: "white"
|
23659 | }), _extends_1({
|
23660 | hideProgressBar: true,
|
23661 | closeButton: false,
|
23662 | autoClose: 5000,
|
23663 | pauseOnFocusLoss: false,
|
23664 | position: 'bottom-right'
|
23665 | }, options));
|
23666 | };
|
23667 |
|
23668 | var notifySuccess = function notifySuccess(title, message, options) {
|
23669 | lib_8(React.createElement(Toast$1, {
|
23670 | bgColor: theme.toast.successColor,
|
23671 | icon: "success",
|
23672 | title: title,
|
23673 | message: message,
|
23674 | size: "big",
|
23675 | color: "white"
|
23676 | }), _extends_1({
|
23677 | hideProgressBar: true,
|
23678 | closeButton: false,
|
23679 | autoClose: 5000,
|
23680 | pauseOnFocusLoss: false,
|
23681 | position: 'bottom-right'
|
23682 | }, options));
|
23683 | };
|
23684 |
|
23685 | var notifyWarning = function notifyWarning(title, message, options) {
|
23686 | lib_8(React.createElement(Toast$1, {
|
23687 | bgColor: theme.toast.warningColor,
|
23688 | icon: "warning",
|
23689 | title: title,
|
23690 | message: message,
|
23691 | size: "big",
|
23692 | color: "white"
|
23693 | }), _extends_1({
|
23694 | hideProgressBar: true,
|
23695 | closeButton: false,
|
23696 | autoClose: 5000,
|
23697 | pauseOnFocusLoss: false,
|
23698 | position: 'bottom-right'
|
23699 | }, options));
|
23700 | };
|
23701 |
|
23702 | function _templateObject$10() {
|
23703 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: block;\n\twidth: ", ";\n\theight: ", ";\n\tmargin: 0 auto;\n"]);
|
23704 |
|
23705 | _templateObject$10 = function _templateObject() {
|
23706 | return data;
|
23707 | };
|
23708 |
|
23709 | return data;
|
23710 | }
|
23711 | var CenteredGridStyled = styled.div(_templateObject$10(), function (_ref) {
|
23712 | var width = _ref.width;
|
23713 | return width.toString().indexOf('%') !== -1 ? width : width + "px";
|
23714 | }, function (_ref2) {
|
23715 | var height = _ref2.height;
|
23716 | return height.toString().indexOf('%') !== -1 ? height : height + "px";
|
23717 | });
|
23718 | /**
|
23719 | * @param children
|
23720 | * @param props height and width
|
23721 | */
|
23722 |
|
23723 | var CenteredGrid = function CenteredGrid(_ref3) {
|
23724 | var children = _ref3.children,
|
23725 | props = objectWithoutPropertiesLoose(_ref3, ["children"]);
|
23726 |
|
23727 | return React.createElement(CenteredGridStyled, props, React.createElement(Grid, {
|
23728 | verticalAlign: "middle",
|
23729 | style: {
|
23730 | height: '100%'
|
23731 | }
|
23732 | }, React.createElement(Grid.Row, null, React.createElement(Grid.Column, null, children))));
|
23733 | };
|
23734 |
|
23735 | CenteredGrid.defaultProps = {
|
23736 | width: '100%',
|
23737 | height: '100%'
|
23738 | };
|
23739 | CenteredGrid.propTypes = {
|
23740 | /** children nodes */
|
23741 | children: PropTypes.node.isRequired,
|
23742 |
|
23743 | /** width in pixels or percentage ('100' - pixels; '100%' - percentage) */
|
23744 | width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
23745 |
|
23746 | /** height in pixels or percentage ('100' - pixels; '100%' - percentage) */
|
23747 | height: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
|
23748 | };
|
23749 |
|
23750 | function _templateObject$11() {
|
23751 | var data = taggedTemplateLiteralLoose(["\n\tposition: relative;\n\tdisplay: block;\n\twidth: 100%;\n\tbox-sizing: border-box;\n\tpadding: 20px;\n\tmargin-bottom: 17px;\n\tborder: thin solid ", ";\n\tborder-radius: 4px;\n"]);
|
23752 |
|
23753 | _templateObject$11 = function _templateObject() {
|
23754 | return data;
|
23755 | };
|
23756 |
|
23757 | return data;
|
23758 | }
|
23759 | var Section = styled.div(_templateObject$11(), theme.colors.strokeGray);
|
23760 | Section.displayName = 'Section';
|
23761 |
|
23762 | function _templateObject2$p() {
|
23763 | var data = taggedTemplateLiteralLoose(["\n\tcolor: ", " !important;\n\tcursor: ", ";\n\tuser-select: ", ";\n\n\t:hover {\n\t\ttext-decoration: ", ";\n\t}\n"]);
|
23764 |
|
23765 | _templateObject2$p = function _templateObject2() {
|
23766 | return data;
|
23767 | };
|
23768 |
|
23769 | return data;
|
23770 | }
|
23771 |
|
23772 | function _templateObject$12() {
|
23773 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: inline;\n\n\t:after {\n\t\tcontent: ' > ';\n\t}\n"]);
|
23774 |
|
23775 | _templateObject$12 = function _templateObject() {
|
23776 | return data;
|
23777 | };
|
23778 |
|
23779 | return data;
|
23780 | }
|
23781 |
|
23782 | var Crumb = function Crumb(_ref) {
|
23783 | var crumbIndex = _ref.crumbIndex,
|
23784 | crumbs = _ref.crumbs,
|
23785 | _onClick = _ref.onClick,
|
23786 | children = _ref.children,
|
23787 | props = objectWithoutPropertiesLoose(_ref, ["crumbIndex", "crumbs", "onClick", "children"]);
|
23788 |
|
23789 | var newPath = [''].concat(crumbs.slice(0, crumbIndex + 1)).join('/');
|
23790 | return React.createElement(StyledCrumb, {
|
23791 | key: newPath
|
23792 | }, React.createElement(StyledCrumbSpan, _extends_1({
|
23793 | index: crumbIndex,
|
23794 | onClick: function onClick() {
|
23795 | return crumbIndex !== 0 && _onClick(newPath);
|
23796 | }
|
23797 | }, props), children));
|
23798 | };
|
23799 |
|
23800 | Crumb.displayName = 'Crumb';
|
23801 | Crumb.propTypes = {
|
23802 | /** specific location of the breadcrumb in the crumbs array */
|
23803 | crumbIndex: PropTypes.number.isRequired,
|
23804 |
|
23805 | /** Array of crumb keys to be translated */
|
23806 | crumbs: PropTypes.arrayOf(PropTypes.string.isRequired).isRequired,
|
23807 |
|
23808 | /** onClick crumb handler */
|
23809 | onClick: PropTypes.func.isRequired,
|
23810 |
|
23811 | /** children nodes */
|
23812 | children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired
|
23813 | };
|
23814 | var StyledCrumb = styled.span(_templateObject$12());
|
23815 | StyledCrumb.displayName = 'StyledCrumb';
|
23816 | var StyledCrumbSpan = styled.a(_templateObject2$p(), function (_ref2) {
|
23817 | var theme = _ref2.theme;
|
23818 | return theme.colors.gray;
|
23819 | }, function (_ref3) {
|
23820 | var index = _ref3.index;
|
23821 | return index !== 0 && 'pointer';
|
23822 | }, function (_ref4) {
|
23823 | var index = _ref4.index;
|
23824 | return index === 0 && 'none';
|
23825 | }, function (_ref5) {
|
23826 | var index = _ref5.index;
|
23827 | return index !== 0 && 'underline';
|
23828 | });
|
23829 | StyledCrumbSpan.displayName = 'StyledCrumbSpan';
|
23830 |
|
23831 | function _templateObject2$q() {
|
23832 | var data = taggedTemplateLiteralLoose(["\n\tuser-select: none;\n"]);
|
23833 |
|
23834 | _templateObject2$q = function _templateObject2() {
|
23835 | return data;
|
23836 | };
|
23837 |
|
23838 | return data;
|
23839 | }
|
23840 |
|
23841 | function _templateObject$13() {
|
23842 | var data = taggedTemplateLiteralLoose(["\n\tcolor: ", " !important;\n\tfont-size: 11px;\n"]);
|
23843 |
|
23844 | _templateObject$13 = function _templateObject() {
|
23845 | return data;
|
23846 | };
|
23847 |
|
23848 | return data;
|
23849 | }
|
23850 |
|
23851 | var isNotNumber = function isNotNumber(segment) {
|
23852 | return Number.isNaN(Number(segment));
|
23853 | };
|
23854 |
|
23855 | var BreadCrumbs = function BreadCrumbs(_ref) {
|
23856 | var path = _ref.path,
|
23857 | finalItem = _ref.finalItem,
|
23858 | onClick = _ref.onClick,
|
23859 | translationFunction = _ref.translationFunction,
|
23860 | props = objectWithoutPropertiesLoose(_ref, ["path", "finalItem", "onClick", "translationFunction"]);
|
23861 |
|
23862 | var items = path.split('/').filter(function (item) {
|
23863 | return item;
|
23864 | });
|
23865 | var lastItem = items.length > 1 ? items[items.length - 1] : null;
|
23866 | items = items.slice(0, items.length - 1);
|
23867 | return React.createElement(Text, _extends_1({}, props, {
|
23868 | color: theme.colors.gray,
|
23869 | size: "sm"
|
23870 | }), items.filter(isNotNumber).map(function (crumb, index$$1) {
|
23871 | return React.createElement(Crumb, _extends_1({
|
23872 | key: crumb,
|
23873 | crumbIndex: index$$1,
|
23874 | crumbs: items,
|
23875 | onClick: onClick
|
23876 | }, props), translationFunction(crumb));
|
23877 | }), lastItem && React.createElement(NoUserSelect, null, finalItem || translationFunction(lastItem)));
|
23878 | };
|
23879 |
|
23880 | BreadCrumbs.defaultProps = {
|
23881 | finalItem: ''
|
23882 | };
|
23883 | BreadCrumbs.displayName = 'BreadCrumbs';
|
23884 | BreadCrumbs.propTypes = {
|
23885 | /** Path of the page: with react router -> props.location.pathname */
|
23886 | path: PropTypes.string.isRequired,
|
23887 |
|
23888 | /** Custom Name for the last crumb name */
|
23889 | finalItem: PropTypes.string,
|
23890 |
|
23891 | /** Action for the crumb click */
|
23892 | onClick: PropTypes.func.isRequired,
|
23893 |
|
23894 | /** translation function applied to reach crumb item */
|
23895 | translationFunction: PropTypes.func.isRequired
|
23896 | };
|
23897 | var BreadCrumbsStyled = styled.p(_templateObject$13(), function (_ref2) {
|
23898 | var theme$$1 = _ref2.theme;
|
23899 | return theme$$1.colors.gray;
|
23900 | });
|
23901 | BreadCrumbsStyled.displayName = 'BreadCrumbsStyled';
|
23902 | var NoUserSelect = styled.span(_templateObject2$q());
|
23903 |
|
23904 | var lottie = createCommonjsModule(function (module) {
|
23905 | (typeof navigator !== "undefined") && (function(root, factory) {
|
23906 | if (module.exports) {
|
23907 | module.exports = factory(root);
|
23908 | } else {
|
23909 | root.lottie = factory(root);
|
23910 | root.bodymovin = root.lottie;
|
23911 | }
|
23912 | }((window || {}), function(window) {
|
23913 | var svgNS = "http://www.w3.org/2000/svg";
|
23914 |
|
23915 | var locationHref = '';
|
23916 |
|
23917 | var initialDefaultFrame = -999999;
|
23918 |
|
23919 | var subframeEnabled = true;
|
23920 | var expressionsPlugin;
|
23921 | var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
23922 | var bm_pow = Math.pow;
|
23923 | var bm_sqrt = Math.sqrt;
|
23924 | var bm_floor = Math.floor;
|
23925 | var bm_max = Math.max;
|
23926 | var bm_min = Math.min;
|
23927 |
|
23928 | var BMMath = {};
|
23929 | (function(){
|
23930 | var propertyNames = ["abs", "acos", "acosh", "asin", "asinh", "atan", "atanh", "atan2", "ceil", "cbrt", "expm1", "clz32", "cos", "cosh", "exp", "floor", "fround", "hypot", "imul", "log", "log1p", "log2", "log10", "max", "min", "pow", "random", "round", "sign", "sin", "sinh", "sqrt", "tan", "tanh", "trunc", "E", "LN10", "LN2", "LOG10E", "LOG2E", "PI", "SQRT1_2", "SQRT2"];
|
23931 | var i, len = propertyNames.length;
|
23932 | for(i=0;i<len;i+=1){
|
23933 | BMMath[propertyNames[i]] = Math[propertyNames[i]];
|
23934 | }
|
23935 | }());
|
23936 |
|
23937 | function ProjectInterface(){return {};}
|
23938 |
|
23939 | BMMath.random = Math.random;
|
23940 | BMMath.abs = function(val){
|
23941 | var tOfVal = typeof val;
|
23942 | if(tOfVal === 'object' && val.length){
|
23943 | var absArr = createSizedArray(val.length);
|
23944 | var i, len = val.length;
|
23945 | for(i=0;i<len;i+=1){
|
23946 | absArr[i] = Math.abs(val[i]);
|
23947 | }
|
23948 | return absArr;
|
23949 | }
|
23950 | return Math.abs(val);
|
23951 |
|
23952 | };
|
23953 | var defaultCurveSegments = 150;
|
23954 | var degToRads = Math.PI/180;
|
23955 | var roundCorner = 0.5519;
|
23956 |
|
23957 | function styleDiv(element){
|
23958 | element.style.position = 'absolute';
|
23959 | element.style.top = 0;
|
23960 | element.style.left = 0;
|
23961 | element.style.display = 'block';
|
23962 | element.style.transformOrigin = element.style.webkitTransformOrigin = '0 0';
|
23963 | element.style.backfaceVisibility = element.style.webkitBackfaceVisibility = 'visible';
|
23964 | element.style.transformStyle = element.style.webkitTransformStyle = element.style.mozTransformStyle = "preserve-3d";
|
23965 | }
|
23966 |
|
23967 | function BMEnterFrameEvent(n,c,t,d){
|
23968 | this.type = n;
|
23969 | this.currentTime = c;
|
23970 | this.totalTime = t;
|
23971 | this.direction = d < 0 ? -1:1;
|
23972 | }
|
23973 |
|
23974 | function BMCompleteEvent(n,d){
|
23975 | this.type = n;
|
23976 | this.direction = d < 0 ? -1:1;
|
23977 | }
|
23978 |
|
23979 | function BMCompleteLoopEvent(n,c,t,d){
|
23980 | this.type = n;
|
23981 | this.currentLoop = t;
|
23982 | this.totalLoops = c;
|
23983 | this.direction = d < 0 ? -1:1;
|
23984 | }
|
23985 |
|
23986 | function BMSegmentStartEvent(n,f,t){
|
23987 | this.type = n;
|
23988 | this.firstFrame = f;
|
23989 | this.totalFrames = t;
|
23990 | }
|
23991 |
|
23992 | function BMDestroyEvent(n,t){
|
23993 | this.type = n;
|
23994 | this.target = t;
|
23995 | }
|
23996 |
|
23997 | var createElementID = (function(){
|
23998 | var _count = 0;
|
23999 | return function createID() {
|
24000 | return '__lottie_element_' + ++_count
|
24001 | }
|
24002 | }());
|
24003 |
|
24004 | function HSVtoRGB(h, s, v) {
|
24005 | var r, g, b, i, f, p, q, t;
|
24006 | i = Math.floor(h * 6);
|
24007 | f = h * 6 - i;
|
24008 | p = v * (1 - s);
|
24009 | q = v * (1 - f * s);
|
24010 | t = v * (1 - (1 - f) * s);
|
24011 | switch (i % 6) {
|
24012 | case 0: r = v; g = t; b = p; break;
|
24013 | case 1: r = q; g = v; b = p; break;
|
24014 | case 2: r = p; g = v; b = t; break;
|
24015 | case 3: r = p; g = q; b = v; break;
|
24016 | case 4: r = t; g = p; b = v; break;
|
24017 | case 5: r = v; g = p; b = q; break;
|
24018 | }
|
24019 | return [ r,
|
24020 | g,
|
24021 | b ];
|
24022 | }
|
24023 |
|
24024 | function RGBtoHSV(r, g, b) {
|
24025 | var max = Math.max(r, g, b), min = Math.min(r, g, b),
|
24026 | d = max - min,
|
24027 | h,
|
24028 | s = (max === 0 ? 0 : d / max),
|
24029 | v = max / 255;
|
24030 |
|
24031 | switch (max) {
|
24032 | case min: h = 0; break;
|
24033 | case r: h = (g - b) + d * (g < b ? 6: 0); h /= 6 * d; break;
|
24034 | case g: h = (b - r) + d * 2; h /= 6 * d; break;
|
24035 | case b: h = (r - g) + d * 4; h /= 6 * d; break;
|
24036 | }
|
24037 |
|
24038 | return [
|
24039 | h,
|
24040 | s,
|
24041 | v
|
24042 | ];
|
24043 | }
|
24044 |
|
24045 | function addSaturationToRGB(color,offset){
|
24046 | var hsv = RGBtoHSV(color[0]*255,color[1]*255,color[2]*255);
|
24047 | hsv[1] += offset;
|
24048 | if (hsv[1] > 1) {
|
24049 | hsv[1] = 1;
|
24050 | }
|
24051 | else if (hsv[1] <= 0) {
|
24052 | hsv[1] = 0;
|
24053 | }
|
24054 | return HSVtoRGB(hsv[0],hsv[1],hsv[2]);
|
24055 | }
|
24056 |
|
24057 | function addBrightnessToRGB(color,offset){
|
24058 | var hsv = RGBtoHSV(color[0]*255,color[1]*255,color[2]*255);
|
24059 | hsv[2] += offset;
|
24060 | if (hsv[2] > 1) {
|
24061 | hsv[2] = 1;
|
24062 | }
|
24063 | else if (hsv[2] < 0) {
|
24064 | hsv[2] = 0;
|
24065 | }
|
24066 | return HSVtoRGB(hsv[0],hsv[1],hsv[2]);
|
24067 | }
|
24068 |
|
24069 | function addHueToRGB(color,offset) {
|
24070 | var hsv = RGBtoHSV(color[0]*255,color[1]*255,color[2]*255);
|
24071 | hsv[0] += offset/360;
|
24072 | if (hsv[0] > 1) {
|
24073 | hsv[0] -= 1;
|
24074 | }
|
24075 | else if (hsv[0] < 0) {
|
24076 | hsv[0] += 1;
|
24077 | }
|
24078 | return HSVtoRGB(hsv[0],hsv[1],hsv[2]);
|
24079 | }
|
24080 |
|
24081 | var rgbToHex = (function(){
|
24082 | var colorMap = [];
|
24083 | var i;
|
24084 | var hex;
|
24085 | for(i=0;i<256;i+=1){
|
24086 | hex = i.toString(16);
|
24087 | colorMap[i] = hex.length == 1 ? '0' + hex : hex;
|
24088 | }
|
24089 |
|
24090 | return function(r, g, b) {
|
24091 | if(r<0){
|
24092 | r = 0;
|
24093 | }
|
24094 | if(g<0){
|
24095 | g = 0;
|
24096 | }
|
24097 | if(b<0){
|
24098 | b = 0;
|
24099 | }
|
24100 | return '#' + colorMap[r] + colorMap[g] + colorMap[b];
|
24101 | };
|
24102 | }());
|
24103 | function BaseEvent(){}
|
24104 | BaseEvent.prototype = {
|
24105 | triggerEvent: function (eventName, args) {
|
24106 | if (this._cbs[eventName]) {
|
24107 | var len = this._cbs[eventName].length;
|
24108 | for (var i = 0; i < len; i++){
|
24109 | this._cbs[eventName][i](args);
|
24110 | }
|
24111 | }
|
24112 | },
|
24113 | addEventListener: function (eventName, callback) {
|
24114 | if (!this._cbs[eventName]){
|
24115 | this._cbs[eventName] = [];
|
24116 | }
|
24117 | this._cbs[eventName].push(callback);
|
24118 |
|
24119 | return function() {
|
24120 | this.removeEventListener(eventName, callback);
|
24121 | }.bind(this);
|
24122 | },
|
24123 | removeEventListener: function (eventName,callback){
|
24124 | if (!callback){
|
24125 | this._cbs[eventName] = null;
|
24126 | }else if(this._cbs[eventName]){
|
24127 | var i = 0, len = this._cbs[eventName].length;
|
24128 | while(i<len){
|
24129 | if(this._cbs[eventName][i] === callback){
|
24130 | this._cbs[eventName].splice(i,1);
|
24131 | i -=1;
|
24132 | len -= 1;
|
24133 | }
|
24134 | i += 1;
|
24135 | }
|
24136 | if(!this._cbs[eventName].length){
|
24137 | this._cbs[eventName] = null;
|
24138 | }
|
24139 | }
|
24140 | }
|
24141 | };
|
24142 | var createTypedArray = (function(){
|
24143 | function createRegularArray(type, len){
|
24144 | var i = 0, arr = [], value;
|
24145 | switch(type) {
|
24146 | case 'int16':
|
24147 | case 'uint8c':
|
24148 | value = 1;
|
24149 | break;
|
24150 | default:
|
24151 | value = 1.1;
|
24152 | break;
|
24153 | }
|
24154 | for(i = 0; i < len; i += 1) {
|
24155 | arr.push(value);
|
24156 | }
|
24157 | return arr;
|
24158 | }
|
24159 | function createTypedArray(type, len){
|
24160 | if(type === 'float32') {
|
24161 | return new Float32Array(len);
|
24162 | } else if(type === 'int16') {
|
24163 | return new Int16Array(len);
|
24164 | } else if(type === 'uint8c') {
|
24165 | return new Uint8ClampedArray(len);
|
24166 | }
|
24167 | }
|
24168 | if(typeof Uint8ClampedArray === 'function' && typeof Float32Array === 'function') {
|
24169 | return createTypedArray;
|
24170 | } else {
|
24171 | return createRegularArray;
|
24172 | }
|
24173 | }());
|
24174 |
|
24175 | function createSizedArray(len) {
|
24176 | return Array.apply(null,{length:len});
|
24177 | }
|
24178 | function createNS(type) {
|
24179 | //return {appendChild:function(){},setAttribute:function(){},style:{}}
|
24180 | return document.createElementNS(svgNS, type);
|
24181 | }
|
24182 | function createTag(type) {
|
24183 | //return {appendChild:function(){},setAttribute:function(){},style:{}}
|
24184 | return document.createElement(type);
|
24185 | }
|
24186 | function DynamicPropertyContainer(){}DynamicPropertyContainer.prototype = {
|
24187 | addDynamicProperty: function(prop) {
|
24188 | if(this.dynamicProperties.indexOf(prop) === -1) {
|
24189 | this.dynamicProperties.push(prop);
|
24190 | this.container.addDynamicProperty(this);
|
24191 | this._isAnimated = true;
|
24192 | }
|
24193 | },
|
24194 | iterateDynamicProperties: function(){
|
24195 | this._mdf = false;
|
24196 | var i, len = this.dynamicProperties.length;
|
24197 | for(i=0;i<len;i+=1){
|
24198 | this.dynamicProperties[i].getValue();
|
24199 | if(this.dynamicProperties[i]._mdf) {
|
24200 | this._mdf = true;
|
24201 | }
|
24202 | }
|
24203 | },
|
24204 | initDynamicPropertyContainer: function(container){
|
24205 | this.container = container;
|
24206 | this.dynamicProperties = [];
|
24207 | this._mdf = false;
|
24208 | this._isAnimated = false;
|
24209 | }
|
24210 | };
|
24211 | var getBlendMode = (function() {
|
24212 |
|
24213 | var blendModeEnums = {
|
24214 | 0:'source-over',
|
24215 | 1:'multiply',
|
24216 | 2:'screen',
|
24217 | 3:'overlay',
|
24218 | 4:'darken',
|
24219 | 5:'lighten',
|
24220 | 6:'color-dodge',
|
24221 | 7:'color-burn',
|
24222 | 8:'hard-light',
|
24223 | 9:'soft-light',
|
24224 | 10:'difference',
|
24225 | 11:'exclusion',
|
24226 | 12:'hue',
|
24227 | 13:'saturation',
|
24228 | 14:'color',
|
24229 | 15:'luminosity'
|
24230 | };
|
24231 |
|
24232 | return function(mode) {
|
24233 | return blendModeEnums[mode] || '';
|
24234 | }
|
24235 | }());
|
24236 | /*!
|
24237 | Transformation Matrix v2.0
|
24238 | (c) Epistemex 2014-2015
|
24239 | www.epistemex.com
|
24240 | By Ken Fyrstenberg
|
24241 | Contributions by leeoniya.
|
24242 | License: MIT, header required.
|
24243 | */
|
24244 |
|
24245 | /**
|
24246 | * 2D transformation matrix object initialized with identity matrix.
|
24247 | *
|
24248 | * The matrix can synchronize a canvas context by supplying the context
|
24249 | * as an argument, or later apply current absolute transform to an
|
24250 | * existing context.
|
24251 | *
|
24252 | * All values are handled as floating point values.
|
24253 | *
|
24254 | * @param {CanvasRenderingContext2D} [context] - Optional context to sync with Matrix
|
24255 | * @prop {number} a - scale x
|
24256 | * @prop {number} b - shear y
|
24257 | * @prop {number} c - shear x
|
24258 | * @prop {number} d - scale y
|
24259 | * @prop {number} e - translate x
|
24260 | * @prop {number} f - translate y
|
24261 | * @prop {CanvasRenderingContext2D|null} [context=null] - set or get current canvas context
|
24262 | * @constructor
|
24263 | */
|
24264 |
|
24265 | var Matrix = (function(){
|
24266 |
|
24267 | var _cos = Math.cos;
|
24268 | var _sin = Math.sin;
|
24269 | var _tan = Math.tan;
|
24270 | var _rnd = Math.round;
|
24271 |
|
24272 | function reset(){
|
24273 | this.props[0] = 1;
|
24274 | this.props[1] = 0;
|
24275 | this.props[2] = 0;
|
24276 | this.props[3] = 0;
|
24277 | this.props[4] = 0;
|
24278 | this.props[5] = 1;
|
24279 | this.props[6] = 0;
|
24280 | this.props[7] = 0;
|
24281 | this.props[8] = 0;
|
24282 | this.props[9] = 0;
|
24283 | this.props[10] = 1;
|
24284 | this.props[11] = 0;
|
24285 | this.props[12] = 0;
|
24286 | this.props[13] = 0;
|
24287 | this.props[14] = 0;
|
24288 | this.props[15] = 1;
|
24289 | return this;
|
24290 | }
|
24291 |
|
24292 | function rotate(angle) {
|
24293 | if(angle === 0){
|
24294 | return this;
|
24295 | }
|
24296 | var mCos = _cos(angle);
|
24297 | var mSin = _sin(angle);
|
24298 | return this._t(mCos, -mSin, 0, 0, mSin, mCos, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
|
24299 | }
|
24300 |
|
24301 | function rotateX(angle){
|
24302 | if(angle === 0){
|
24303 | return this;
|
24304 | }
|
24305 | var mCos = _cos(angle);
|
24306 | var mSin = _sin(angle);
|
24307 | return this._t(1, 0, 0, 0, 0, mCos, -mSin, 0, 0, mSin, mCos, 0, 0, 0, 0, 1);
|
24308 | }
|
24309 |
|
24310 | function rotateY(angle){
|
24311 | if(angle === 0){
|
24312 | return this;
|
24313 | }
|
24314 | var mCos = _cos(angle);
|
24315 | var mSin = _sin(angle);
|
24316 | return this._t(mCos, 0, mSin, 0, 0, 1, 0, 0, -mSin, 0, mCos, 0, 0, 0, 0, 1);
|
24317 | }
|
24318 |
|
24319 | function rotateZ(angle){
|
24320 | if(angle === 0){
|
24321 | return this;
|
24322 | }
|
24323 | var mCos = _cos(angle);
|
24324 | var mSin = _sin(angle);
|
24325 | return this._t(mCos, -mSin, 0, 0, mSin, mCos, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
|
24326 | }
|
24327 |
|
24328 | function shear(sx,sy){
|
24329 | return this._t(1, sy, sx, 1, 0, 0);
|
24330 | }
|
24331 |
|
24332 | function skew(ax, ay){
|
24333 | return this.shear(_tan(ax), _tan(ay));
|
24334 | }
|
24335 |
|
24336 | function skewFromAxis(ax, angle){
|
24337 | var mCos = _cos(angle);
|
24338 | var mSin = _sin(angle);
|
24339 | return this._t(mCos, mSin, 0, 0, -mSin, mCos, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)
|
24340 | ._t(1, 0, 0, 0, _tan(ax), 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)
|
24341 | ._t(mCos, -mSin, 0, 0, mSin, mCos, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
|
24342 | //return this._t(mCos, mSin, -mSin, mCos, 0, 0)._t(1, 0, _tan(ax), 1, 0, 0)._t(mCos, -mSin, mSin, mCos, 0, 0);
|
24343 | }
|
24344 |
|
24345 | function scale(sx, sy, sz) {
|
24346 | if(!sz && sz !== 0) {
|
24347 | sz = 1;
|
24348 | }
|
24349 | if(sx === 1 && sy === 1 && sz === 1){
|
24350 | return this;
|
24351 | }
|
24352 | return this._t(sx, 0, 0, 0, 0, sy, 0, 0, 0, 0, sz, 0, 0, 0, 0, 1);
|
24353 | }
|
24354 |
|
24355 | function setTransform(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) {
|
24356 | this.props[0] = a;
|
24357 | this.props[1] = b;
|
24358 | this.props[2] = c;
|
24359 | this.props[3] = d;
|
24360 | this.props[4] = e;
|
24361 | this.props[5] = f;
|
24362 | this.props[6] = g;
|
24363 | this.props[7] = h;
|
24364 | this.props[8] = i;
|
24365 | this.props[9] = j;
|
24366 | this.props[10] = k;
|
24367 | this.props[11] = l;
|
24368 | this.props[12] = m;
|
24369 | this.props[13] = n;
|
24370 | this.props[14] = o;
|
24371 | this.props[15] = p;
|
24372 | return this;
|
24373 | }
|
24374 |
|
24375 | function translate(tx, ty, tz) {
|
24376 | tz = tz || 0;
|
24377 | if(tx !== 0 || ty !== 0 || tz !== 0){
|
24378 | return this._t(1,0,0,0,0,1,0,0,0,0,1,0,tx,ty,tz,1);
|
24379 | }
|
24380 | return this;
|
24381 | }
|
24382 |
|
24383 | function transform(a2, b2, c2, d2, e2, f2, g2, h2, i2, j2, k2, l2, m2, n2, o2, p2) {
|
24384 |
|
24385 | var _p = this.props;
|
24386 |
|
24387 | if(a2 === 1 && b2 === 0 && c2 === 0 && d2 === 0 && e2 === 0 && f2 === 1 && g2 === 0 && h2 === 0 && i2 === 0 && j2 === 0 && k2 === 1 && l2 === 0){
|
24388 | //NOTE: commenting this condition because TurboFan deoptimizes code when present
|
24389 | //if(m2 !== 0 || n2 !== 0 || o2 !== 0){
|
24390 | _p[12] = _p[12] * a2 + _p[15] * m2;
|
24391 | _p[13] = _p[13] * f2 + _p[15] * n2;
|
24392 | _p[14] = _p[14] * k2 + _p[15] * o2;
|
24393 | _p[15] = _p[15] * p2;
|
24394 | //}
|
24395 | this._identityCalculated = false;
|
24396 | return this;
|
24397 | }
|
24398 |
|
24399 | var a1 = _p[0];
|
24400 | var b1 = _p[1];
|
24401 | var c1 = _p[2];
|
24402 | var d1 = _p[3];
|
24403 | var e1 = _p[4];
|
24404 | var f1 = _p[5];
|
24405 | var g1 = _p[6];
|
24406 | var h1 = _p[7];
|
24407 | var i1 = _p[8];
|
24408 | var j1 = _p[9];
|
24409 | var k1 = _p[10];
|
24410 | var l1 = _p[11];
|
24411 | var m1 = _p[12];
|
24412 | var n1 = _p[13];
|
24413 | var o1 = _p[14];
|
24414 | var p1 = _p[15];
|
24415 |
|
24416 | /* matrix order (canvas compatible):
|
24417 | * ace
|
24418 | * bdf
|
24419 | * 001
|
24420 | */
|
24421 | _p[0] = a1 * a2 + b1 * e2 + c1 * i2 + d1 * m2;
|
24422 | _p[1] = a1 * b2 + b1 * f2 + c1 * j2 + d1 * n2 ;
|
24423 | _p[2] = a1 * c2 + b1 * g2 + c1 * k2 + d1 * o2 ;
|
24424 | _p[3] = a1 * d2 + b1 * h2 + c1 * l2 + d1 * p2 ;
|
24425 |
|
24426 | _p[4] = e1 * a2 + f1 * e2 + g1 * i2 + h1 * m2 ;
|
24427 | _p[5] = e1 * b2 + f1 * f2 + g1 * j2 + h1 * n2 ;
|
24428 | _p[6] = e1 * c2 + f1 * g2 + g1 * k2 + h1 * o2 ;
|
24429 | _p[7] = e1 * d2 + f1 * h2 + g1 * l2 + h1 * p2 ;
|
24430 |
|
24431 | _p[8] = i1 * a2 + j1 * e2 + k1 * i2 + l1 * m2 ;
|
24432 | _p[9] = i1 * b2 + j1 * f2 + k1 * j2 + l1 * n2 ;
|
24433 | _p[10] = i1 * c2 + j1 * g2 + k1 * k2 + l1 * o2 ;
|
24434 | _p[11] = i1 * d2 + j1 * h2 + k1 * l2 + l1 * p2 ;
|
24435 |
|
24436 | _p[12] = m1 * a2 + n1 * e2 + o1 * i2 + p1 * m2 ;
|
24437 | _p[13] = m1 * b2 + n1 * f2 + o1 * j2 + p1 * n2 ;
|
24438 | _p[14] = m1 * c2 + n1 * g2 + o1 * k2 + p1 * o2 ;
|
24439 | _p[15] = m1 * d2 + n1 * h2 + o1 * l2 + p1 * p2 ;
|
24440 |
|
24441 | this._identityCalculated = false;
|
24442 | return this;
|
24443 | }
|
24444 |
|
24445 | function isIdentity() {
|
24446 | if(!this._identityCalculated){
|
24447 | this._identity = !(this.props[0] !== 1 || this.props[1] !== 0 || this.props[2] !== 0 || this.props[3] !== 0 || this.props[4] !== 0 || this.props[5] !== 1 || this.props[6] !== 0 || this.props[7] !== 0 || this.props[8] !== 0 || this.props[9] !== 0 || this.props[10] !== 1 || this.props[11] !== 0 || this.props[12] !== 0 || this.props[13] !== 0 || this.props[14] !== 0 || this.props[15] !== 1);
|
24448 | this._identityCalculated = true;
|
24449 | }
|
24450 | return this._identity;
|
24451 | }
|
24452 |
|
24453 | function equals(matr){
|
24454 | var i = 0;
|
24455 | while (i < 16) {
|
24456 | if(matr.props[i] !== this.props[i]) {
|
24457 | return false;
|
24458 | }
|
24459 | i+=1;
|
24460 | }
|
24461 | return true;
|
24462 | }
|
24463 |
|
24464 | function clone(matr){
|
24465 | var i;
|
24466 | for(i=0;i<16;i+=1){
|
24467 | matr.props[i] = this.props[i];
|
24468 | }
|
24469 | }
|
24470 |
|
24471 | function cloneFromProps(props){
|
24472 | var i;
|
24473 | for(i=0;i<16;i+=1){
|
24474 | this.props[i] = props[i];
|
24475 | }
|
24476 | }
|
24477 |
|
24478 | function applyToPoint(x, y, z) {
|
24479 |
|
24480 | return {
|
24481 | x: x * this.props[0] + y * this.props[4] + z * this.props[8] + this.props[12],
|
24482 | y: x * this.props[1] + y * this.props[5] + z * this.props[9] + this.props[13],
|
24483 | z: x * this.props[2] + y * this.props[6] + z * this.props[10] + this.props[14]
|
24484 | };
|
24485 | /*return {
|
24486 | x: x * me.a + y * me.c + me.e,
|
24487 | y: x * me.b + y * me.d + me.f
|
24488 | };*/
|
24489 | }
|
24490 | function applyToX(x, y, z) {
|
24491 | return x * this.props[0] + y * this.props[4] + z * this.props[8] + this.props[12];
|
24492 | }
|
24493 | function applyToY(x, y, z) {
|
24494 | return x * this.props[1] + y * this.props[5] + z * this.props[9] + this.props[13];
|
24495 | }
|
24496 | function applyToZ(x, y, z) {
|
24497 | return x * this.props[2] + y * this.props[6] + z * this.props[10] + this.props[14];
|
24498 | }
|
24499 |
|
24500 | function inversePoint(pt) {
|
24501 | var determinant = this.props[0] * this.props[5] - this.props[1] * this.props[4];
|
24502 | var a = this.props[5]/determinant;
|
24503 | var b = - this.props[1]/determinant;
|
24504 | var c = - this.props[4]/determinant;
|
24505 | var d = this.props[0]/determinant;
|
24506 | var e = (this.props[4] * this.props[13] - this.props[5] * this.props[12])/determinant;
|
24507 | var f = - (this.props[0] * this.props[13] - this.props[1] * this.props[12])/determinant;
|
24508 | return [pt[0] * a + pt[1] * c + e, pt[0] * b + pt[1] * d + f, 0];
|
24509 | }
|
24510 |
|
24511 | function inversePoints(pts){
|
24512 | var i, len = pts.length, retPts = [];
|
24513 | for(i=0;i<len;i+=1){
|
24514 | retPts[i] = inversePoint(pts[i]);
|
24515 | }
|
24516 | return retPts;
|
24517 | }
|
24518 |
|
24519 | function applyToTriplePoints(pt1, pt2, pt3) {
|
24520 | var arr = createTypedArray('float32', 6);
|
24521 | if(this.isIdentity()) {
|
24522 | arr[0] = pt1[0];
|
24523 | arr[1] = pt1[1];
|
24524 | arr[2] = pt2[0];
|
24525 | arr[3] = pt2[1];
|
24526 | arr[4] = pt3[0];
|
24527 | arr[5] = pt3[1];
|
24528 | } else {
|
24529 | var p0 = this.props[0], p1 = this.props[1], p4 = this.props[4], p5 = this.props[5], p12 = this.props[12], p13 = this.props[13];
|
24530 | arr[0] = pt1[0] * p0 + pt1[1] * p4 + p12;
|
24531 | arr[1] = pt1[0] * p1 + pt1[1] * p5 + p13;
|
24532 | arr[2] = pt2[0] * p0 + pt2[1] * p4 + p12;
|
24533 | arr[3] = pt2[0] * p1 + pt2[1] * p5 + p13;
|
24534 | arr[4] = pt3[0] * p0 + pt3[1] * p4 + p12;
|
24535 | arr[5] = pt3[0] * p1 + pt3[1] * p5 + p13;
|
24536 | }
|
24537 | return arr;
|
24538 | }
|
24539 |
|
24540 | function applyToPointArray(x,y,z){
|
24541 | var arr;
|
24542 | if(this.isIdentity()) {
|
24543 | arr = [x,y,z];
|
24544 | } else {
|
24545 | arr = [x * this.props[0] + y * this.props[4] + z * this.props[8] + this.props[12],x * this.props[1] + y * this.props[5] + z * this.props[9] + this.props[13],x * this.props[2] + y * this.props[6] + z * this.props[10] + this.props[14]];
|
24546 | }
|
24547 | return arr;
|
24548 | }
|
24549 |
|
24550 | function applyToPointStringified(x, y) {
|
24551 | if(this.isIdentity()) {
|
24552 | return x + ',' + y;
|
24553 | }
|
24554 | var _p = this.props;
|
24555 | return Math.round((x * _p[0] + y * _p[4] + _p[12]) * 100) / 100+','+ Math.round((x * _p[1] + y * _p[5] + _p[13]) * 100) / 100;
|
24556 | }
|
24557 |
|
24558 | function toCSS() {
|
24559 | //Doesn't make much sense to add this optimization. If it is an identity matrix, it's very likely this will get called only once since it won't be keyframed.
|
24560 | /*if(this.isIdentity()) {
|
24561 | return '';
|
24562 | }*/
|
24563 | var i = 0;
|
24564 | var props = this.props;
|
24565 | var cssValue = 'matrix3d(';
|
24566 | var v = 10000;
|
24567 | while(i<16){
|
24568 | cssValue += _rnd(props[i]*v)/v;
|
24569 | cssValue += i === 15 ? ')':',';
|
24570 | i += 1;
|
24571 | }
|
24572 | return cssValue;
|
24573 | }
|
24574 |
|
24575 | function roundMatrixProperty(val) {
|
24576 | var v = 10000;
|
24577 | if((val < 0.000001 && val > 0) || (val > -0.000001 && val < 0)) {
|
24578 | return _rnd(val * v) / v;
|
24579 | }
|
24580 | return val;
|
24581 | }
|
24582 |
|
24583 | function to2dCSS() {
|
24584 | //Doesn't make much sense to add this optimization. If it is an identity matrix, it's very likely this will get called only once since it won't be keyframed.
|
24585 | /*if(this.isIdentity()) {
|
24586 | return '';
|
24587 | }*/
|
24588 | var props = this.props;
|
24589 | var _a = roundMatrixProperty(props[0]);
|
24590 | var _b = roundMatrixProperty(props[1]);
|
24591 | var _c = roundMatrixProperty(props[4]);
|
24592 | var _d = roundMatrixProperty(props[5]);
|
24593 | var _e = roundMatrixProperty(props[12]);
|
24594 | var _f = roundMatrixProperty(props[13]);
|
24595 | return "matrix(" + _a + ',' + _b + ',' + _c + ',' + _d + ',' + _e + ',' + _f + ")";
|
24596 | }
|
24597 |
|
24598 | return function(){
|
24599 | this.reset = reset;
|
24600 | this.rotate = rotate;
|
24601 | this.rotateX = rotateX;
|
24602 | this.rotateY = rotateY;
|
24603 | this.rotateZ = rotateZ;
|
24604 | this.skew = skew;
|
24605 | this.skewFromAxis = skewFromAxis;
|
24606 | this.shear = shear;
|
24607 | this.scale = scale;
|
24608 | this.setTransform = setTransform;
|
24609 | this.translate = translate;
|
24610 | this.transform = transform;
|
24611 | this.applyToPoint = applyToPoint;
|
24612 | this.applyToX = applyToX;
|
24613 | this.applyToY = applyToY;
|
24614 | this.applyToZ = applyToZ;
|
24615 | this.applyToPointArray = applyToPointArray;
|
24616 | this.applyToTriplePoints = applyToTriplePoints;
|
24617 | this.applyToPointStringified = applyToPointStringified;
|
24618 | this.toCSS = toCSS;
|
24619 | this.to2dCSS = to2dCSS;
|
24620 | this.clone = clone;
|
24621 | this.cloneFromProps = cloneFromProps;
|
24622 | this.equals = equals;
|
24623 | this.inversePoints = inversePoints;
|
24624 | this.inversePoint = inversePoint;
|
24625 | this._t = this.transform;
|
24626 | this.isIdentity = isIdentity;
|
24627 | this._identity = true;
|
24628 | this._identityCalculated = false;
|
24629 |
|
24630 | this.props = createTypedArray('float32', 16);
|
24631 | this.reset();
|
24632 | };
|
24633 | }());
|
24634 |
|
24635 | /*
|
24636 | Copyright 2014 David Bau.
|
24637 |
|
24638 | Permission is hereby granted, free of charge, to any person obtaining
|
24639 | a copy of this software and associated documentation files (the
|
24640 | "Software"), to deal in the Software without restriction, including
|
24641 | without limitation the rights to use, copy, modify, merge, publish,
|
24642 | distribute, sublicense, and/or sell copies of the Software, and to
|
24643 | permit persons to whom the Software is furnished to do so, subject to
|
24644 | the following conditions:
|
24645 |
|
24646 | The above copyright notice and this permission notice shall be
|
24647 | included in all copies or substantial portions of the Software.
|
24648 |
|
24649 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
24650 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
24651 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
24652 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
24653 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
24654 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
24655 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
24656 |
|
24657 | */
|
24658 |
|
24659 | (function (pool, math) {
|
24660 | //
|
24661 | // The following constants are related to IEEE 754 limits.
|
24662 | //
|
24663 | var global = this,
|
24664 | width = 256, // each RC4 output is 0 <= x < 256
|
24665 | chunks = 6, // at least six RC4 outputs for each double
|
24666 | digits = 52, // there are 52 significant digits in a double
|
24667 | rngname = 'random', // rngname: name for Math.random and Math.seedrandom
|
24668 | startdenom = math.pow(width, chunks),
|
24669 | significance = math.pow(2, digits),
|
24670 | overflow = significance * 2,
|
24671 | mask = width - 1;
|
24672 | // node.js crypto module, initialized at the bottom.
|
24673 |
|
24674 | //
|
24675 | // seedrandom()
|
24676 | // This is the seedrandom function described above.
|
24677 | //
|
24678 | function seedrandom(seed, options, callback) {
|
24679 | var key = [];
|
24680 | options = (options === true) ? { entropy: true } : (options || {});
|
24681 |
|
24682 | // Flatten the seed string or build one from local entropy if needed.
|
24683 | var shortseed = mixkey(flatten(
|
24684 | options.entropy ? [seed, tostring(pool)] :
|
24685 | (seed === null) ? autoseed() : seed, 3), key);
|
24686 |
|
24687 | // Use the seed to initialize an ARC4 generator.
|
24688 | var arc4 = new ARC4(key);
|
24689 |
|
24690 | // This function returns a random double in [0, 1) that contains
|
24691 | // randomness in every bit of the mantissa of the IEEE 754 value.
|
24692 | var prng = function() {
|
24693 | var n = arc4.g(chunks), // Start with a numerator n < 2 ^ 48
|
24694 | d = startdenom, // and denominator d = 2 ^ 48.
|
24695 | x = 0; // and no 'extra last byte'.
|
24696 | while (n < significance) { // Fill up all significant digits by
|
24697 | n = (n + x) * width; // shifting numerator and
|
24698 | d *= width; // denominator and generating a
|
24699 | x = arc4.g(1); // new least-significant-byte.
|
24700 | }
|
24701 | while (n >= overflow) { // To avoid rounding up, before adding
|
24702 | n /= 2; // last byte, shift everything
|
24703 | d /= 2; // right using integer math until
|
24704 | x >>>= 1; // we have exactly the desired bits.
|
24705 | }
|
24706 | return (n + x) / d; // Form the number within [0, 1).
|
24707 | };
|
24708 |
|
24709 | prng.int32 = function() { return arc4.g(4) | 0; };
|
24710 | prng.quick = function() { return arc4.g(4) / 0x100000000; };
|
24711 | prng.double = prng;
|
24712 |
|
24713 | // Mix the randomness into accumulated entropy.
|
24714 | mixkey(tostring(arc4.S), pool);
|
24715 |
|
24716 | // Calling convention: what to return as a function of prng, seed, is_math.
|
24717 | return (options.pass || callback ||
|
24718 | function(prng, seed, is_math_call, state) {
|
24719 | if (state) {
|
24720 | // Load the arc4 state from the given state if it has an S array.
|
24721 | if (state.S) { copy(state, arc4); }
|
24722 | // Only provide the .state method if requested via options.state.
|
24723 | prng.state = function() { return copy(arc4, {}); };
|
24724 | }
|
24725 |
|
24726 | // If called as a method of Math (Math.seedrandom()), mutate
|
24727 | // Math.random because that is how seedrandom.js has worked since v1.0.
|
24728 | if (is_math_call) { math[rngname] = prng; return seed; }
|
24729 |
|
24730 | // Otherwise, it is a newer calling convention, so return the
|
24731 | // prng directly.
|
24732 | else return prng;
|
24733 | })(
|
24734 | prng,
|
24735 | shortseed,
|
24736 | 'global' in options ? options.global : (this == math),
|
24737 | options.state);
|
24738 | }
|
24739 | math['seed' + rngname] = seedrandom;
|
24740 |
|
24741 | //
|
24742 | // ARC4
|
24743 | //
|
24744 | // An ARC4 implementation. The constructor takes a key in the form of
|
24745 | // an array of at most (width) integers that should be 0 <= x < (width).
|
24746 | //
|
24747 | // The g(count) method returns a pseudorandom integer that concatenates
|
24748 | // the next (count) outputs from ARC4. Its return value is a number x
|
24749 | // that is in the range 0 <= x < (width ^ count).
|
24750 | //
|
24751 | function ARC4(key) {
|
24752 | var t, keylen = key.length,
|
24753 | me = this, i = 0, j = me.i = me.j = 0, s = me.S = [];
|
24754 |
|
24755 | // The empty key [] is treated as [0].
|
24756 | if (!keylen) { key = [keylen++]; }
|
24757 |
|
24758 | // Set up S using the standard key scheduling algorithm.
|
24759 | while (i < width) {
|
24760 | s[i] = i++;
|
24761 | }
|
24762 | for (i = 0; i < width; i++) {
|
24763 | s[i] = s[j = mask & (j + key[i % keylen] + (t = s[i]))];
|
24764 | s[j] = t;
|
24765 | }
|
24766 |
|
24767 | // The "g" method returns the next (count) outputs as one number.
|
24768 | me.g = function(count) {
|
24769 | // Using instance members instead of closure state nearly doubles speed.
|
24770 | var t, r = 0,
|
24771 | i = me.i, j = me.j, s = me.S;
|
24772 | while (count--) {
|
24773 | t = s[i = mask & (i + 1)];
|
24774 | r = r * width + s[mask & ((s[i] = s[j = mask & (j + t)]) + (s[j] = t))];
|
24775 | }
|
24776 | me.i = i; me.j = j;
|
24777 | return r;
|
24778 | // For robust unpredictability, the function call below automatically
|
24779 | // discards an initial batch of values. This is called RC4-drop[256].
|
24780 | // See http://google.com/search?q=rsa+fluhrer+response&btnI
|
24781 | };
|
24782 | }
|
24783 |
|
24784 | //
|
24785 | // copy()
|
24786 | // Copies internal state of ARC4 to or from a plain object.
|
24787 | //
|
24788 | function copy(f, t) {
|
24789 | t.i = f.i;
|
24790 | t.j = f.j;
|
24791 | t.S = f.S.slice();
|
24792 | return t;
|
24793 | }
|
24794 |
|
24795 | //
|
24796 | // flatten()
|
24797 | // Converts an object tree to nested arrays of strings.
|
24798 | //
|
24799 | function flatten(obj, depth) {
|
24800 | var result = [], typ = (typeof obj), prop;
|
24801 | if (depth && typ == 'object') {
|
24802 | for (prop in obj) {
|
24803 | try { result.push(flatten(obj[prop], depth - 1)); } catch (e) {}
|
24804 | }
|
24805 | }
|
24806 | return (result.length ? result : typ == 'string' ? obj : obj + '\0');
|
24807 | }
|
24808 |
|
24809 | //
|
24810 | // mixkey()
|
24811 | // Mixes a string seed into a key that is an array of integers, and
|
24812 | // returns a shortened string seed that is equivalent to the result key.
|
24813 | //
|
24814 | function mixkey(seed, key) {
|
24815 | var stringseed = seed + '', smear, j = 0;
|
24816 | while (j < stringseed.length) {
|
24817 | key[mask & j] =
|
24818 | mask & ((smear ^= key[mask & j] * 19) + stringseed.charCodeAt(j++));
|
24819 | }
|
24820 | return tostring(key);
|
24821 | }
|
24822 |
|
24823 | //
|
24824 | // autoseed()
|
24825 | // Returns an object for autoseeding, using window.crypto and Node crypto
|
24826 | // module if available.
|
24827 | //
|
24828 | function autoseed() {
|
24829 | try {
|
24830 | var out = new Uint8Array(width);
|
24831 | (global.crypto || global.msCrypto).getRandomValues(out);
|
24832 | return tostring(out);
|
24833 | } catch (e) {
|
24834 | var browser = global.navigator,
|
24835 | plugins = browser && browser.plugins;
|
24836 | return [+new Date(), global, plugins, global.screen, tostring(pool)];
|
24837 | }
|
24838 | }
|
24839 |
|
24840 | //
|
24841 | // tostring()
|
24842 | // Converts an array of charcodes to a string
|
24843 | //
|
24844 | function tostring(a) {
|
24845 | return String.fromCharCode.apply(0, a);
|
24846 | }
|
24847 |
|
24848 | //
|
24849 | // When seedrandom.js is loaded, we immediately mix a few bits
|
24850 | // from the built-in RNG into the entropy pool. Because we do
|
24851 | // not want to interfere with deterministic PRNG state later,
|
24852 | // seedrandom will not call math.random on its own again after
|
24853 | // initialization.
|
24854 | //
|
24855 | mixkey(math.random(), pool);
|
24856 |
|
24857 | //
|
24858 | // Nodejs and AMD support: export the implementation as a module using
|
24859 | // either convention.
|
24860 | //
|
24861 |
|
24862 | // End anonymous scope, and pass initial values.
|
24863 | })(
|
24864 | [], // pool: entropy pool starts empty
|
24865 | BMMath // math: package containing random, pow, and seedrandom
|
24866 | );
|
24867 | var BezierFactory = (function(){
|
24868 | /**
|
24869 | * BezierEasing - use bezier curve for transition easing function
|
24870 | * by Gaëtan Renaudeau 2014 - 2015 – MIT License
|
24871 | *
|
24872 | * Credits: is based on Firefox's nsSMILKeySpline.cpp
|
24873 | * Usage:
|
24874 | * var spline = BezierEasing([ 0.25, 0.1, 0.25, 1.0 ])
|
24875 | * spline.get(x) => returns the easing value | x must be in [0, 1] range
|
24876 | *
|
24877 | */
|
24878 |
|
24879 | var ob = {};
|
24880 | ob.getBezierEasing = getBezierEasing;
|
24881 | var beziers = {};
|
24882 |
|
24883 | function getBezierEasing(a,b,c,d,nm){
|
24884 | var str = nm || ('bez_' + a+'_'+b+'_'+c+'_'+d).replace(/\./g, 'p');
|
24885 | if(beziers[str]){
|
24886 | return beziers[str];
|
24887 | }
|
24888 | var bezEasing = new BezierEasing([a,b,c,d]);
|
24889 | beziers[str] = bezEasing;
|
24890 | return bezEasing;
|
24891 | }
|
24892 |
|
24893 | // These values are established by empiricism with tests (tradeoff: performance VS precision)
|
24894 | var NEWTON_ITERATIONS = 4;
|
24895 | var NEWTON_MIN_SLOPE = 0.001;
|
24896 | var SUBDIVISION_PRECISION = 0.0000001;
|
24897 | var SUBDIVISION_MAX_ITERATIONS = 10;
|
24898 |
|
24899 | var kSplineTableSize = 11;
|
24900 | var kSampleStepSize = 1.0 / (kSplineTableSize - 1.0);
|
24901 |
|
24902 | var float32ArraySupported = typeof Float32Array === "function";
|
24903 |
|
24904 | function A (aA1, aA2) { return 1.0 - 3.0 * aA2 + 3.0 * aA1; }
|
24905 | function B (aA1, aA2) { return 3.0 * aA2 - 6.0 * aA1; }
|
24906 | function C (aA1) { return 3.0 * aA1; }
|
24907 |
|
24908 | // Returns x(t) given t, x1, and x2, or y(t) given t, y1, and y2.
|
24909 | function calcBezier (aT, aA1, aA2) {
|
24910 | return ((A(aA1, aA2)*aT + B(aA1, aA2))*aT + C(aA1))*aT;
|
24911 | }
|
24912 |
|
24913 | // Returns dx/dt given t, x1, and x2, or dy/dt given t, y1, and y2.
|
24914 | function getSlope (aT, aA1, aA2) {
|
24915 | return 3.0 * A(aA1, aA2)*aT*aT + 2.0 * B(aA1, aA2) * aT + C(aA1);
|
24916 | }
|
24917 |
|
24918 | function binarySubdivide (aX, aA, aB, mX1, mX2) {
|
24919 | var currentX, currentT, i = 0;
|
24920 | do {
|
24921 | currentT = aA + (aB - aA) / 2.0;
|
24922 | currentX = calcBezier(currentT, mX1, mX2) - aX;
|
24923 | if (currentX > 0.0) {
|
24924 | aB = currentT;
|
24925 | } else {
|
24926 | aA = currentT;
|
24927 | }
|
24928 | } while (Math.abs(currentX) > SUBDIVISION_PRECISION && ++i < SUBDIVISION_MAX_ITERATIONS);
|
24929 | return currentT;
|
24930 | }
|
24931 |
|
24932 | function newtonRaphsonIterate (aX, aGuessT, mX1, mX2) {
|
24933 | for (var i = 0; i < NEWTON_ITERATIONS; ++i) {
|
24934 | var currentSlope = getSlope(aGuessT, mX1, mX2);
|
24935 | if (currentSlope === 0.0) return aGuessT;
|
24936 | var currentX = calcBezier(aGuessT, mX1, mX2) - aX;
|
24937 | aGuessT -= currentX / currentSlope;
|
24938 | }
|
24939 | return aGuessT;
|
24940 | }
|
24941 |
|
24942 | /**
|
24943 | * points is an array of [ mX1, mY1, mX2, mY2 ]
|
24944 | */
|
24945 | function BezierEasing (points) {
|
24946 | this._p = points;
|
24947 | this._mSampleValues = float32ArraySupported ? new Float32Array(kSplineTableSize) : new Array(kSplineTableSize);
|
24948 | this._precomputed = false;
|
24949 |
|
24950 | this.get = this.get.bind(this);
|
24951 | }
|
24952 |
|
24953 | BezierEasing.prototype = {
|
24954 |
|
24955 | get: function (x) {
|
24956 | var mX1 = this._p[0],
|
24957 | mY1 = this._p[1],
|
24958 | mX2 = this._p[2],
|
24959 | mY2 = this._p[3];
|
24960 | if (!this._precomputed) this._precompute();
|
24961 | if (mX1 === mY1 && mX2 === mY2) return x; // linear
|
24962 | // Because JavaScript number are imprecise, we should guarantee the extremes are right.
|
24963 | if (x === 0) return 0;
|
24964 | if (x === 1) return 1;
|
24965 | return calcBezier(this._getTForX(x), mY1, mY2);
|
24966 | },
|
24967 |
|
24968 | // Private part
|
24969 |
|
24970 | _precompute: function () {
|
24971 | var mX1 = this._p[0],
|
24972 | mY1 = this._p[1],
|
24973 | mX2 = this._p[2],
|
24974 | mY2 = this._p[3];
|
24975 | this._precomputed = true;
|
24976 | if (mX1 !== mY1 || mX2 !== mY2)
|
24977 | this._calcSampleValues();
|
24978 | },
|
24979 |
|
24980 | _calcSampleValues: function () {
|
24981 | var mX1 = this._p[0],
|
24982 | mX2 = this._p[2];
|
24983 | for (var i = 0; i < kSplineTableSize; ++i) {
|
24984 | this._mSampleValues[i] = calcBezier(i * kSampleStepSize, mX1, mX2);
|
24985 | }
|
24986 | },
|
24987 |
|
24988 | /**
|
24989 | * getTForX chose the fastest heuristic to determine the percentage value precisely from a given X projection.
|
24990 | */
|
24991 | _getTForX: function (aX) {
|
24992 | var mX1 = this._p[0],
|
24993 | mX2 = this._p[2],
|
24994 | mSampleValues = this._mSampleValues;
|
24995 |
|
24996 | var intervalStart = 0.0;
|
24997 | var currentSample = 1;
|
24998 | var lastSample = kSplineTableSize - 1;
|
24999 |
|
25000 | for (; currentSample !== lastSample && mSampleValues[currentSample] <= aX; ++currentSample) {
|
25001 | intervalStart += kSampleStepSize;
|
25002 | }
|
25003 | --currentSample;
|
25004 |
|
25005 | // Interpolate to provide an initial guess for t
|
25006 | var dist = (aX - mSampleValues[currentSample]) / (mSampleValues[currentSample+1] - mSampleValues[currentSample]);
|
25007 | var guessForT = intervalStart + dist * kSampleStepSize;
|
25008 |
|
25009 | var initialSlope = getSlope(guessForT, mX1, mX2);
|
25010 | if (initialSlope >= NEWTON_MIN_SLOPE) {
|
25011 | return newtonRaphsonIterate(aX, guessForT, mX1, mX2);
|
25012 | } else if (initialSlope === 0.0) {
|
25013 | return guessForT;
|
25014 | } else {
|
25015 | return binarySubdivide(aX, intervalStart, intervalStart + kSampleStepSize, mX1, mX2);
|
25016 | }
|
25017 | }
|
25018 | };
|
25019 |
|
25020 | return ob;
|
25021 |
|
25022 | }());
|
25023 | (function () {
|
25024 | var lastTime = 0;
|
25025 | var vendors = ['ms', 'moz', 'webkit', 'o'];
|
25026 | for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
|
25027 | window.requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame'];
|
25028 | window.cancelAnimationFrame = window[vendors[x] + 'CancelAnimationFrame'] || window[vendors[x] + 'CancelRequestAnimationFrame'];
|
25029 | }
|
25030 | if(!window.requestAnimationFrame)
|
25031 | window.requestAnimationFrame = function (callback, element) {
|
25032 | var currTime = new Date().getTime();
|
25033 | var timeToCall = Math.max(0, 16 - (currTime - lastTime));
|
25034 | var id = setTimeout(function () {
|
25035 | callback(currTime + timeToCall);
|
25036 | },
|
25037 | timeToCall);
|
25038 | lastTime = currTime + timeToCall;
|
25039 | return id;
|
25040 | };
|
25041 | if(!window.cancelAnimationFrame)
|
25042 | window.cancelAnimationFrame = function (id) {
|
25043 | clearTimeout(id);
|
25044 | };
|
25045 | }());
|
25046 |
|
25047 | function extendPrototype(sources,destination){
|
25048 | var i, len = sources.length, sourcePrototype;
|
25049 | for (i = 0;i < len;i += 1) {
|
25050 | sourcePrototype = sources[i].prototype;
|
25051 | for (var attr in sourcePrototype) {
|
25052 | if (sourcePrototype.hasOwnProperty(attr)) destination.prototype[attr] = sourcePrototype[attr];
|
25053 | }
|
25054 | }
|
25055 | }
|
25056 |
|
25057 | function getDescriptor(object, prop) {
|
25058 | return Object.getOwnPropertyDescriptor(object, prop);
|
25059 | }
|
25060 |
|
25061 | function createProxyFunction(prototype) {
|
25062 | function ProxyFunction(){}
|
25063 | ProxyFunction.prototype = prototype;
|
25064 | return ProxyFunction;
|
25065 | }
|
25066 | function bezFunction(){
|
25067 |
|
25068 | function pointOnLine2D(x1,y1, x2,y2, x3,y3){
|
25069 | var det1 = (x1*y2) + (y1*x3) + (x2*y3) - (x3*y2) - (y3*x1) - (x2*y1);
|
25070 | return det1 > -0.001 && det1 < 0.001;
|
25071 | }
|
25072 |
|
25073 | function pointOnLine3D(x1,y1,z1, x2,y2,z2, x3,y3,z3){
|
25074 | if(z1 === 0 && z2 === 0 && z3 === 0) {
|
25075 | return pointOnLine2D(x1,y1, x2,y2, x3,y3);
|
25076 | }
|
25077 | var dist1 = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2) + Math.pow(z2 - z1, 2));
|
25078 | var dist2 = Math.sqrt(Math.pow(x3 - x1, 2) + Math.pow(y3 - y1, 2) + Math.pow(z3 - z1, 2));
|
25079 | var dist3 = Math.sqrt(Math.pow(x3 - x2, 2) + Math.pow(y3 - y2, 2) + Math.pow(z3 - z2, 2));
|
25080 | var diffDist;
|
25081 | if(dist1 > dist2){
|
25082 | if(dist1 > dist3){
|
25083 | diffDist = dist1 - dist2 - dist3;
|
25084 | } else {
|
25085 | diffDist = dist3 - dist2 - dist1;
|
25086 | }
|
25087 | } else if(dist3 > dist2){
|
25088 | diffDist = dist3 - dist2 - dist1;
|
25089 | } else {
|
25090 | diffDist = dist2 - dist1 - dist3;
|
25091 | }
|
25092 | return diffDist > -0.0001 && diffDist < 0.0001;
|
25093 | }
|
25094 |
|
25095 | var getBezierLength = (function(){
|
25096 |
|
25097 | return function(pt1,pt2,pt3,pt4){
|
25098 | var curveSegments = defaultCurveSegments;
|
25099 | var k;
|
25100 | var i, len;
|
25101 | var ptCoord,perc,addedLength = 0;
|
25102 | var ptDistance;
|
25103 | var point = [],lastPoint = [];
|
25104 | var lengthData = bezier_length_pool.newElement();
|
25105 | len = pt3.length;
|
25106 | for(k=0;k<curveSegments;k+=1){
|
25107 | perc = k/(curveSegments-1);
|
25108 | ptDistance = 0;
|
25109 | for(i=0;i<len;i+=1){
|
25110 | ptCoord = bm_pow(1-perc,3)*pt1[i]+3*bm_pow(1-perc,2)*perc*pt3[i]+3*(1-perc)*bm_pow(perc,2)*pt4[i]+bm_pow(perc,3)*pt2[i];
|
25111 | point[i] = ptCoord;
|
25112 | if(lastPoint[i] !== null){
|
25113 | ptDistance += bm_pow(point[i] - lastPoint[i],2);
|
25114 | }
|
25115 | lastPoint[i] = point[i];
|
25116 | }
|
25117 | if(ptDistance){
|
25118 | ptDistance = bm_sqrt(ptDistance);
|
25119 | addedLength += ptDistance;
|
25120 | }
|
25121 | lengthData.percents[k] = perc;
|
25122 | lengthData.lengths[k] = addedLength;
|
25123 | }
|
25124 | lengthData.addedLength = addedLength;
|
25125 | return lengthData;
|
25126 | };
|
25127 | }());
|
25128 |
|
25129 | function getSegmentsLength(shapeData) {
|
25130 | var segmentsLength = segments_length_pool.newElement();
|
25131 | var closed = shapeData.c;
|
25132 | var pathV = shapeData.v;
|
25133 | var pathO = shapeData.o;
|
25134 | var pathI = shapeData.i;
|
25135 | var i, len = shapeData._length;
|
25136 | var lengths = segmentsLength.lengths;
|
25137 | var totalLength = 0;
|
25138 | for(i=0;i<len-1;i+=1){
|
25139 | lengths[i] = getBezierLength(pathV[i],pathV[i+1],pathO[i],pathI[i+1]);
|
25140 | totalLength += lengths[i].addedLength;
|
25141 | }
|
25142 | if(closed && len){
|
25143 | lengths[i] = getBezierLength(pathV[i],pathV[0],pathO[i],pathI[0]);
|
25144 | totalLength += lengths[i].addedLength;
|
25145 | }
|
25146 | segmentsLength.totalLength = totalLength;
|
25147 | return segmentsLength;
|
25148 | }
|
25149 |
|
25150 | function BezierData(length){
|
25151 | this.segmentLength = 0;
|
25152 | this.points = new Array(length);
|
25153 | }
|
25154 |
|
25155 | function PointData(partial,point){
|
25156 | this.partialLength = partial;
|
25157 | this.point = point;
|
25158 | }
|
25159 |
|
25160 | var buildBezierData = (function(){
|
25161 |
|
25162 | var storedData = {};
|
25163 |
|
25164 | return function (pt1, pt2, pt3, pt4){
|
25165 | var bezierName = (pt1[0]+'_'+pt1[1]+'_'+pt2[0]+'_'+pt2[1]+'_'+pt3[0]+'_'+pt3[1]+'_'+pt4[0]+'_'+pt4[1]).replace(/\./g, 'p');
|
25166 | if(!storedData[bezierName]){
|
25167 | var curveSegments = defaultCurveSegments;
|
25168 | var k, i, len;
|
25169 | var ptCoord,perc,addedLength = 0;
|
25170 | var ptDistance;
|
25171 | var point,lastPoint = null;
|
25172 | if (pt1.length === 2 && (pt1[0] != pt2[0] || pt1[1] != pt2[1]) && pointOnLine2D(pt1[0],pt1[1],pt2[0],pt2[1],pt1[0]+pt3[0],pt1[1]+pt3[1]) && pointOnLine2D(pt1[0],pt1[1],pt2[0],pt2[1],pt2[0]+pt4[0],pt2[1]+pt4[1])){
|
25173 | curveSegments = 2;
|
25174 | }
|
25175 | var bezierData = new BezierData(curveSegments);
|
25176 | len = pt3.length;
|
25177 | for (k = 0; k < curveSegments; k += 1) {
|
25178 | point = createSizedArray(len);
|
25179 | perc = k / (curveSegments - 1);
|
25180 | ptDistance = 0;
|
25181 | for (i = 0; i < len; i += 1){
|
25182 | ptCoord = bm_pow(1-perc,3)*pt1[i]+3*bm_pow(1-perc,2)*perc*(pt1[i] + pt3[i])+3*(1-perc)*bm_pow(perc,2)*(pt2[i] + pt4[i])+bm_pow(perc,3)*pt2[i];
|
25183 | point[i] = ptCoord;
|
25184 | if(lastPoint !== null){
|
25185 | ptDistance += bm_pow(point[i] - lastPoint[i],2);
|
25186 | }
|
25187 | }
|
25188 | ptDistance = bm_sqrt(ptDistance);
|
25189 | addedLength += ptDistance;
|
25190 | bezierData.points[k] = new PointData(ptDistance, point);
|
25191 | lastPoint = point;
|
25192 | }
|
25193 | bezierData.segmentLength = addedLength;
|
25194 | storedData[bezierName] = bezierData;
|
25195 | }
|
25196 | return storedData[bezierName];
|
25197 | };
|
25198 | }());
|
25199 |
|
25200 | function getDistancePerc(perc,bezierData){
|
25201 | var percents = bezierData.percents;
|
25202 | var lengths = bezierData.lengths;
|
25203 | var len = percents.length;
|
25204 | var initPos = bm_floor((len-1)*perc);
|
25205 | var lengthPos = perc*bezierData.addedLength;
|
25206 | var lPerc = 0;
|
25207 | if(initPos === len - 1 || initPos === 0 || lengthPos === lengths[initPos]){
|
25208 | return percents[initPos];
|
25209 | }else{
|
25210 | var dir = lengths[initPos] > lengthPos ? -1 : 1;
|
25211 | var flag = true;
|
25212 | while(flag){
|
25213 | if(lengths[initPos] <= lengthPos && lengths[initPos+1] > lengthPos){
|
25214 | lPerc = (lengthPos - lengths[initPos]) / (lengths[initPos+1] - lengths[initPos]);
|
25215 | flag = false;
|
25216 | }else{
|
25217 | initPos += dir;
|
25218 | }
|
25219 | if(initPos < 0 || initPos >= len - 1){
|
25220 | //FIX for TypedArrays that don't store floating point values with enough accuracy
|
25221 | if(initPos === len - 1) {
|
25222 | return percents[initPos];
|
25223 | }
|
25224 | flag = false;
|
25225 | }
|
25226 | }
|
25227 | return percents[initPos] + (percents[initPos+1] - percents[initPos])*lPerc;
|
25228 | }
|
25229 | }
|
25230 |
|
25231 | function getPointInSegment(pt1, pt2, pt3, pt4, percent, bezierData) {
|
25232 | var t1 = getDistancePerc(percent,bezierData);
|
25233 | var u1 = 1 - t1;
|
25234 | var ptX = Math.round((u1*u1*u1* pt1[0] + (t1*u1*u1 + u1*t1*u1 + u1*u1*t1)* pt3[0] + (t1*t1*u1 + u1*t1*t1 + t1*u1*t1)*pt4[0] + t1*t1*t1* pt2[0])* 1000) / 1000;
|
25235 | var ptY = Math.round((u1*u1*u1* pt1[1] + (t1*u1*u1 + u1*t1*u1 + u1*u1*t1)* pt3[1] + (t1*t1*u1 + u1*t1*t1 + t1*u1*t1)*pt4[1] + t1*t1*t1* pt2[1])* 1000) / 1000;
|
25236 | return [ptX, ptY];
|
25237 | }
|
25238 |
|
25239 | var bezier_segment_points = createTypedArray('float32', 8);
|
25240 |
|
25241 | function getNewSegment(pt1,pt2,pt3,pt4,startPerc,endPerc, bezierData){
|
25242 |
|
25243 | startPerc = startPerc < 0 ? 0 : startPerc > 1 ? 1 : startPerc;
|
25244 | var t0 = getDistancePerc(startPerc,bezierData);
|
25245 | endPerc = endPerc > 1 ? 1 : endPerc;
|
25246 | var t1 = getDistancePerc(endPerc,bezierData);
|
25247 | var i, len = pt1.length;
|
25248 | var u0 = 1 - t0;
|
25249 | var u1 = 1 - t1;
|
25250 | var u0u0u0 = u0*u0*u0;
|
25251 | var t0u0u0_3 = t0*u0*u0*3;
|
25252 | var t0t0u0_3 = t0*t0*u0*3;
|
25253 | var t0t0t0 = t0*t0*t0;
|
25254 | //
|
25255 | var u0u0u1 = u0*u0*u1;
|
25256 | var t0u0u1_3 = t0*u0*u1 + u0*t0*u1 + u0*u0*t1;
|
25257 | var t0t0u1_3 = t0*t0*u1 + u0*t0*t1 + t0*u0*t1;
|
25258 | var t0t0t1 = t0*t0*t1;
|
25259 | //
|
25260 | var u0u1u1 = u0*u1*u1;
|
25261 | var t0u1u1_3 = t0*u1*u1 + u0*t1*u1 + u0*u1*t1;
|
25262 | var t0t1u1_3 = t0*t1*u1 + u0*t1*t1 + t0*u1*t1;
|
25263 | var t0t1t1 = t0*t1*t1;
|
25264 | //
|
25265 | var u1u1u1 = u1*u1*u1;
|
25266 | var t1u1u1_3 = t1*u1*u1 + u1*t1*u1 + u1*u1*t1;
|
25267 | var t1t1u1_3 = t1*t1*u1 + u1*t1*t1 + t1*u1*t1;
|
25268 | var t1t1t1 = t1*t1*t1;
|
25269 | for(i=0;i<len;i+=1){
|
25270 | bezier_segment_points[i * 4] = Math.round((u0u0u0 * pt1[i] + t0u0u0_3 * pt3[i] + t0t0u0_3 * pt4[i] + t0t0t0 * pt2[i]) * 1000) / 1000;
|
25271 | bezier_segment_points[i * 4 + 1] = Math.round((u0u0u1 * pt1[i] + t0u0u1_3 * pt3[i] + t0t0u1_3 * pt4[i] + t0t0t1 * pt2[i]) * 1000) / 1000;
|
25272 | bezier_segment_points[i * 4 + 2] = Math.round((u0u1u1 * pt1[i] + t0u1u1_3 * pt3[i] + t0t1u1_3 * pt4[i] + t0t1t1 * pt2[i]) * 1000) / 1000;
|
25273 | bezier_segment_points[i * 4 + 3] = Math.round((u1u1u1 * pt1[i] + t1u1u1_3 * pt3[i] + t1t1u1_3 * pt4[i] + t1t1t1 * pt2[i]) * 1000) / 1000;
|
25274 | }
|
25275 |
|
25276 | return bezier_segment_points;
|
25277 | }
|
25278 |
|
25279 | return {
|
25280 | getSegmentsLength : getSegmentsLength,
|
25281 | getNewSegment : getNewSegment,
|
25282 | getPointInSegment : getPointInSegment,
|
25283 | buildBezierData : buildBezierData,
|
25284 | pointOnLine2D : pointOnLine2D,
|
25285 | pointOnLine3D : pointOnLine3D
|
25286 | };
|
25287 | }
|
25288 |
|
25289 | var bez = bezFunction();
|
25290 | function dataFunctionManager(){
|
25291 |
|
25292 | //var tCanvasHelper = createTag('canvas').getContext('2d');
|
25293 |
|
25294 | function completeLayers(layers, comps, fontManager){
|
25295 | var layerData;
|
25296 | var i, len = layers.length;
|
25297 | var j, jLen, k, kLen;
|
25298 | for(i=0;i<len;i+=1){
|
25299 | layerData = layers[i];
|
25300 | if(!('ks' in layerData) || layerData.completed){
|
25301 | continue;
|
25302 | }
|
25303 | layerData.completed = true;
|
25304 | if(layerData.tt){
|
25305 | layers[i-1].td = layerData.tt;
|
25306 | }
|
25307 | if(layerData.hasMask){
|
25308 | var maskProps = layerData.masksProperties;
|
25309 | jLen = maskProps.length;
|
25310 | for(j=0;j<jLen;j+=1){
|
25311 | if(maskProps[j].pt.k.i){
|
25312 | convertPathsToAbsoluteValues(maskProps[j].pt.k);
|
25313 | }else{
|
25314 | kLen = maskProps[j].pt.k.length;
|
25315 | for(k=0;k<kLen;k+=1){
|
25316 | if(maskProps[j].pt.k[k].s){
|
25317 | convertPathsToAbsoluteValues(maskProps[j].pt.k[k].s[0]);
|
25318 | }
|
25319 | if(maskProps[j].pt.k[k].e){
|
25320 | convertPathsToAbsoluteValues(maskProps[j].pt.k[k].e[0]);
|
25321 | }
|
25322 | }
|
25323 | }
|
25324 | }
|
25325 | }
|
25326 | if(layerData.ty===0){
|
25327 | layerData.layers = findCompLayers(layerData.refId, comps);
|
25328 | completeLayers(layerData.layers,comps, fontManager);
|
25329 | }else if(layerData.ty === 4){
|
25330 | completeShapes(layerData.shapes);
|
25331 | }else if(layerData.ty == 5){
|
25332 | completeText(layerData, fontManager);
|
25333 | }
|
25334 | }
|
25335 | }
|
25336 |
|
25337 | function findCompLayers(id,comps){
|
25338 | var i = 0, len = comps.length;
|
25339 | while(i<len){
|
25340 | if(comps[i].id === id){
|
25341 | if(!comps[i].layers.__used) {
|
25342 | comps[i].layers.__used = true;
|
25343 | return comps[i].layers;
|
25344 | }
|
25345 | return JSON.parse(JSON.stringify(comps[i].layers));
|
25346 | }
|
25347 | i += 1;
|
25348 | }
|
25349 | }
|
25350 |
|
25351 | function completeShapes(arr){
|
25352 | var i, len = arr.length;
|
25353 | var j, jLen;
|
25354 | for(i=len-1;i>=0;i-=1){
|
25355 | if(arr[i].ty == 'sh'){
|
25356 | if(arr[i].ks.k.i){
|
25357 | convertPathsToAbsoluteValues(arr[i].ks.k);
|
25358 | }else{
|
25359 | jLen = arr[i].ks.k.length;
|
25360 | for(j=0;j<jLen;j+=1){
|
25361 | if(arr[i].ks.k[j].s){
|
25362 | convertPathsToAbsoluteValues(arr[i].ks.k[j].s[0]);
|
25363 | }
|
25364 | if(arr[i].ks.k[j].e){
|
25365 | convertPathsToAbsoluteValues(arr[i].ks.k[j].e[0]);
|
25366 | }
|
25367 | }
|
25368 | }
|
25369 | }else if(arr[i].ty == 'gr'){
|
25370 | completeShapes(arr[i].it);
|
25371 | }
|
25372 | }
|
25373 | /*if(hasPaths){
|
25374 | //mx: distance
|
25375 | //ss: sensitivity
|
25376 | //dc: decay
|
25377 | arr.splice(arr.length-1,0,{
|
25378 | "ty": "ms",
|
25379 | "mx":20,
|
25380 | "ss":10,
|
25381 | "dc":0.001,
|
25382 | "maxDist":200
|
25383 | });
|
25384 | }*/
|
25385 | }
|
25386 |
|
25387 | function convertPathsToAbsoluteValues(path){
|
25388 | var i, len = path.i.length;
|
25389 | for(i=0;i<len;i+=1){
|
25390 | path.i[i][0] += path.v[i][0];
|
25391 | path.i[i][1] += path.v[i][1];
|
25392 | path.o[i][0] += path.v[i][0];
|
25393 | path.o[i][1] += path.v[i][1];
|
25394 | }
|
25395 | }
|
25396 |
|
25397 | function checkVersion(minimum,animVersionString){
|
25398 | var animVersion = animVersionString ? animVersionString.split('.') : [100,100,100];
|
25399 | if(minimum[0]>animVersion[0]){
|
25400 | return true;
|
25401 | } else if(animVersion[0] > minimum[0]){
|
25402 | return false;
|
25403 | }
|
25404 | if(minimum[1]>animVersion[1]){
|
25405 | return true;
|
25406 | } else if(animVersion[1] > minimum[1]){
|
25407 | return false;
|
25408 | }
|
25409 | if(minimum[2]>animVersion[2]){
|
25410 | return true;
|
25411 | } else if(animVersion[2] > minimum[2]){
|
25412 | return false;
|
25413 | }
|
25414 | }
|
25415 |
|
25416 | var checkText = (function(){
|
25417 | var minimumVersion = [4,4,14];
|
25418 |
|
25419 | function updateTextLayer(textLayer){
|
25420 | var documentData = textLayer.t.d;
|
25421 | textLayer.t.d = {
|
25422 | k: [
|
25423 | {
|
25424 | s:documentData,
|
25425 | t:0
|
25426 | }
|
25427 | ]
|
25428 | };
|
25429 | }
|
25430 |
|
25431 | function iterateLayers(layers){
|
25432 | var i, len = layers.length;
|
25433 | for(i=0;i<len;i+=1){
|
25434 | if(layers[i].ty === 5){
|
25435 | updateTextLayer(layers[i]);
|
25436 | }
|
25437 | }
|
25438 | }
|
25439 |
|
25440 | return function (animationData){
|
25441 | if(checkVersion(minimumVersion,animationData.v)){
|
25442 | iterateLayers(animationData.layers);
|
25443 | if(animationData.assets){
|
25444 | var i, len = animationData.assets.length;
|
25445 | for(i=0;i<len;i+=1){
|
25446 | if(animationData.assets[i].layers){
|
25447 | iterateLayers(animationData.assets[i].layers);
|
25448 |
|
25449 | }
|
25450 | }
|
25451 | }
|
25452 | }
|
25453 | };
|
25454 | }());
|
25455 |
|
25456 | var checkChars = (function() {
|
25457 | var minimumVersion = [4,7,99];
|
25458 | return function (animationData){
|
25459 | if(animationData.chars && !checkVersion(minimumVersion,animationData.v)){
|
25460 | var i, len = animationData.chars.length, j, jLen;
|
25461 | var pathData, paths;
|
25462 | for(i = 0; i < len; i += 1) {
|
25463 | if(animationData.chars[i].data && animationData.chars[i].data.shapes) {
|
25464 | paths = animationData.chars[i].data.shapes[0].it;
|
25465 | jLen = paths.length;
|
25466 |
|
25467 | for(j = 0; j < jLen; j += 1) {
|
25468 | pathData = paths[j].ks.k;
|
25469 | if(!pathData.__converted) {
|
25470 | convertPathsToAbsoluteValues(paths[j].ks.k);
|
25471 | pathData.__converted = true;
|
25472 | }
|
25473 | }
|
25474 | }
|
25475 | }
|
25476 | }
|
25477 | };
|
25478 | }());
|
25479 |
|
25480 | var checkColors = (function(){
|
25481 | var minimumVersion = [4,1,9];
|
25482 |
|
25483 | function iterateShapes(shapes){
|
25484 | var i, len = shapes.length;
|
25485 | var j, jLen;
|
25486 | for(i=0;i<len;i+=1){
|
25487 | if(shapes[i].ty === 'gr'){
|
25488 | iterateShapes(shapes[i].it);
|
25489 | }else if(shapes[i].ty === 'fl' || shapes[i].ty === 'st'){
|
25490 | if(shapes[i].c.k && shapes[i].c.k[0].i){
|
25491 | jLen = shapes[i].c.k.length;
|
25492 | for(j=0;j<jLen;j+=1){
|
25493 | if(shapes[i].c.k[j].s){
|
25494 | shapes[i].c.k[j].s[0] /= 255;
|
25495 | shapes[i].c.k[j].s[1] /= 255;
|
25496 | shapes[i].c.k[j].s[2] /= 255;
|
25497 | shapes[i].c.k[j].s[3] /= 255;
|
25498 | }
|
25499 | if(shapes[i].c.k[j].e){
|
25500 | shapes[i].c.k[j].e[0] /= 255;
|
25501 | shapes[i].c.k[j].e[1] /= 255;
|
25502 | shapes[i].c.k[j].e[2] /= 255;
|
25503 | shapes[i].c.k[j].e[3] /= 255;
|
25504 | }
|
25505 | }
|
25506 | } else {
|
25507 | shapes[i].c.k[0] /= 255;
|
25508 | shapes[i].c.k[1] /= 255;
|
25509 | shapes[i].c.k[2] /= 255;
|
25510 | shapes[i].c.k[3] /= 255;
|
25511 | }
|
25512 | }
|
25513 | }
|
25514 | }
|
25515 |
|
25516 | function iterateLayers(layers){
|
25517 | var i, len = layers.length;
|
25518 | for(i=0;i<len;i+=1){
|
25519 | if(layers[i].ty === 4){
|
25520 | iterateShapes(layers[i].shapes);
|
25521 | }
|
25522 | }
|
25523 | }
|
25524 |
|
25525 | return function (animationData){
|
25526 | if(checkVersion(minimumVersion,animationData.v)){
|
25527 | iterateLayers(animationData.layers);
|
25528 | if(animationData.assets){
|
25529 | var i, len = animationData.assets.length;
|
25530 | for(i=0;i<len;i+=1){
|
25531 | if(animationData.assets[i].layers){
|
25532 | iterateLayers(animationData.assets[i].layers);
|
25533 |
|
25534 | }
|
25535 | }
|
25536 | }
|
25537 | }
|
25538 | };
|
25539 | }());
|
25540 |
|
25541 | var checkShapes = (function(){
|
25542 | var minimumVersion = [4,4,18];
|
25543 |
|
25544 |
|
25545 |
|
25546 | function completeShapes(arr){
|
25547 | var i, len = arr.length;
|
25548 | var j, jLen;
|
25549 | for(i=len-1;i>=0;i-=1){
|
25550 | if(arr[i].ty == 'sh'){
|
25551 | if(arr[i].ks.k.i){
|
25552 | arr[i].ks.k.c = arr[i].closed;
|
25553 | }else{
|
25554 | jLen = arr[i].ks.k.length;
|
25555 | for(j=0;j<jLen;j+=1){
|
25556 | if(arr[i].ks.k[j].s){
|
25557 | arr[i].ks.k[j].s[0].c = arr[i].closed;
|
25558 | }
|
25559 | if(arr[i].ks.k[j].e){
|
25560 | arr[i].ks.k[j].e[0].c = arr[i].closed;
|
25561 | }
|
25562 | }
|
25563 | }
|
25564 | }else if(arr[i].ty == 'gr'){
|
25565 | completeShapes(arr[i].it);
|
25566 | }
|
25567 | }
|
25568 | }
|
25569 |
|
25570 | function iterateLayers(layers){
|
25571 | var layerData;
|
25572 | var i, len = layers.length;
|
25573 | var j, jLen, k, kLen;
|
25574 | for(i=0;i<len;i+=1){
|
25575 | layerData = layers[i];
|
25576 | if(layerData.hasMask){
|
25577 | var maskProps = layerData.masksProperties;
|
25578 | jLen = maskProps.length;
|
25579 | for(j=0;j<jLen;j+=1){
|
25580 | if(maskProps[j].pt.k.i){
|
25581 | maskProps[j].pt.k.c = maskProps[j].cl;
|
25582 | }else{
|
25583 | kLen = maskProps[j].pt.k.length;
|
25584 | for(k=0;k<kLen;k+=1){
|
25585 | if(maskProps[j].pt.k[k].s){
|
25586 | maskProps[j].pt.k[k].s[0].c = maskProps[j].cl;
|
25587 | }
|
25588 | if(maskProps[j].pt.k[k].e){
|
25589 | maskProps[j].pt.k[k].e[0].c = maskProps[j].cl;
|
25590 | }
|
25591 | }
|
25592 | }
|
25593 | }
|
25594 | }
|
25595 | if(layerData.ty === 4){
|
25596 | completeShapes(layerData.shapes);
|
25597 | }
|
25598 | }
|
25599 | }
|
25600 |
|
25601 | return function (animationData){
|
25602 | if(checkVersion(minimumVersion,animationData.v)){
|
25603 | iterateLayers(animationData.layers);
|
25604 | if(animationData.assets){
|
25605 | var i, len = animationData.assets.length;
|
25606 | for(i=0;i<len;i+=1){
|
25607 | if(animationData.assets[i].layers){
|
25608 | iterateLayers(animationData.assets[i].layers);
|
25609 |
|
25610 | }
|
25611 | }
|
25612 | }
|
25613 | }
|
25614 | };
|
25615 | }());
|
25616 |
|
25617 | function completeData(animationData, fontManager){
|
25618 | if(animationData.__complete){
|
25619 | return;
|
25620 | }
|
25621 | checkColors(animationData);
|
25622 | checkText(animationData);
|
25623 | checkChars(animationData);
|
25624 | checkShapes(animationData);
|
25625 | completeLayers(animationData.layers, animationData.assets, fontManager);
|
25626 | animationData.__complete = true;
|
25627 | //blitAnimation(animationData, animationData.assets, fontManager);
|
25628 | }
|
25629 |
|
25630 | function completeText(data, fontManager){
|
25631 | if(data.t.a.length === 0 && !('m' in data.t.p)){
|
25632 | data.singleShape = true;
|
25633 | }
|
25634 | }
|
25635 |
|
25636 | var moduleOb = {};
|
25637 | moduleOb.completeData = completeData;
|
25638 |
|
25639 | return moduleOb;
|
25640 | }
|
25641 |
|
25642 | var dataManager = dataFunctionManager();
|
25643 | var FontManager = (function(){
|
25644 |
|
25645 | var maxWaitingTime = 5000;
|
25646 | var emptyChar = {
|
25647 | w: 0,
|
25648 | size:0,
|
25649 | shapes:[]
|
25650 | };
|
25651 | var combinedCharacters = [];
|
25652 | //Hindi characters
|
25653 | combinedCharacters = combinedCharacters.concat([2304, 2305, 2306, 2307, 2362, 2363, 2364, 2364, 2366
|
25654 | , 2367, 2368, 2369, 2370, 2371, 2372, 2373, 2374, 2375, 2376, 2377, 2378, 2379
|
25655 | , 2380, 2381, 2382, 2383, 2387, 2388, 2389, 2390, 2391, 2402, 2403]);
|
25656 |
|
25657 | function setUpNode(font, family){
|
25658 | var parentNode = createTag('span');
|
25659 | parentNode.style.fontFamily = family;
|
25660 | var node = createTag('span');
|
25661 | // Characters that vary significantly among different fonts
|
25662 | node.innerHTML = 'giItT1WQy@!-/#';
|
25663 | // Visible - so we can measure it - but not on the screen
|
25664 | parentNode.style.position = 'absolute';
|
25665 | parentNode.style.left = '-10000px';
|
25666 | parentNode.style.top = '-10000px';
|
25667 | // Large font size makes even subtle changes obvious
|
25668 | parentNode.style.fontSize = '300px';
|
25669 | // Reset any font properties
|
25670 | parentNode.style.fontVariant = 'normal';
|
25671 | parentNode.style.fontStyle = 'normal';
|
25672 | parentNode.style.fontWeight = 'normal';
|
25673 | parentNode.style.letterSpacing = '0';
|
25674 | parentNode.appendChild(node);
|
25675 | document.body.appendChild(parentNode);
|
25676 |
|
25677 | // Remember width with no applied web font
|
25678 | var width = node.offsetWidth;
|
25679 | node.style.fontFamily = font + ', '+family;
|
25680 | return {node:node, w:width, parent:parentNode};
|
25681 | }
|
25682 |
|
25683 | function checkLoadedFonts() {
|
25684 | var i, len = this.fonts.length;
|
25685 | var node, w;
|
25686 | var loadedCount = len;
|
25687 | for(i=0;i<len; i+= 1){
|
25688 | if(this.fonts[i].loaded){
|
25689 | loadedCount -= 1;
|
25690 | continue;
|
25691 | }
|
25692 | if(this.fonts[i].fOrigin === 'n' || this.fonts[i].origin === 0){
|
25693 | this.fonts[i].loaded = true;
|
25694 | } else{
|
25695 | node = this.fonts[i].monoCase.node;
|
25696 | w = this.fonts[i].monoCase.w;
|
25697 | if(node.offsetWidth !== w){
|
25698 | loadedCount -= 1;
|
25699 | this.fonts[i].loaded = true;
|
25700 | }else{
|
25701 | node = this.fonts[i].sansCase.node;
|
25702 | w = this.fonts[i].sansCase.w;
|
25703 | if(node.offsetWidth !== w){
|
25704 | loadedCount -= 1;
|
25705 | this.fonts[i].loaded = true;
|
25706 | }
|
25707 | }
|
25708 | if(this.fonts[i].loaded){
|
25709 | this.fonts[i].sansCase.parent.parentNode.removeChild(this.fonts[i].sansCase.parent);
|
25710 | this.fonts[i].monoCase.parent.parentNode.removeChild(this.fonts[i].monoCase.parent);
|
25711 | }
|
25712 | }
|
25713 | }
|
25714 |
|
25715 | if(loadedCount !== 0 && Date.now() - this.initTime < maxWaitingTime){
|
25716 | setTimeout(this.checkLoadedFonts.bind(this),20);
|
25717 | }else{
|
25718 | setTimeout(function(){this.isLoaded = true;}.bind(this),0);
|
25719 |
|
25720 | }
|
25721 | }
|
25722 |
|
25723 | function createHelper(def, fontData){
|
25724 | var tHelper = createNS('text');
|
25725 | tHelper.style.fontSize = '100px';
|
25726 | //tHelper.style.fontFamily = fontData.fFamily;
|
25727 | tHelper.setAttribute('font-family', fontData.fFamily);
|
25728 | tHelper.setAttribute('font-style', fontData.fStyle);
|
25729 | tHelper.setAttribute('font-weight', fontData.fWeight);
|
25730 | tHelper.textContent = '1';
|
25731 | if(fontData.fClass){
|
25732 | tHelper.style.fontFamily = 'inherit';
|
25733 | tHelper.setAttribute('class', fontData.fClass);
|
25734 | } else {
|
25735 | tHelper.style.fontFamily = fontData.fFamily;
|
25736 | }
|
25737 | def.appendChild(tHelper);
|
25738 | var tCanvasHelper = createTag('canvas').getContext('2d');
|
25739 | tCanvasHelper.font = fontData.fWeight + ' ' + fontData.fStyle + ' 100px '+ fontData.fFamily;
|
25740 | //tCanvasHelper.font = ' 100px '+ fontData.fFamily;
|
25741 | return tHelper;
|
25742 | }
|
25743 |
|
25744 | function addFonts(fontData, defs){
|
25745 | if(!fontData){
|
25746 | this.isLoaded = true;
|
25747 | return;
|
25748 | }
|
25749 | if(this.chars){
|
25750 | this.isLoaded = true;
|
25751 | this.fonts = fontData.list;
|
25752 | return;
|
25753 | }
|
25754 |
|
25755 |
|
25756 | var fontArr = fontData.list;
|
25757 | var i, len = fontArr.length;
|
25758 | var _pendingFonts = len;
|
25759 | for(i=0; i<len; i+= 1){
|
25760 | var shouldLoadFont = true;
|
25761 | var loadedSelector;
|
25762 | var j;
|
25763 | fontArr[i].loaded = false;
|
25764 | fontArr[i].monoCase = setUpNode(fontArr[i].fFamily,'monospace');
|
25765 | fontArr[i].sansCase = setUpNode(fontArr[i].fFamily,'sans-serif');
|
25766 | if(!fontArr[i].fPath) {
|
25767 | fontArr[i].loaded = true;
|
25768 | _pendingFonts -= 1;
|
25769 | }else if(fontArr[i].fOrigin === 'p' || fontArr[i].origin === 3){
|
25770 | loadedSelector = document.querySelectorAll('style[f-forigin="p"][f-family="'+ fontArr[i].fFamily +'"], style[f-origin="3"][f-family="'+ fontArr[i].fFamily +'"]');
|
25771 |
|
25772 | if (loadedSelector.length > 0) {
|
25773 | shouldLoadFont = false;
|
25774 | }
|
25775 |
|
25776 | if (shouldLoadFont) {
|
25777 | var s = createTag('style');
|
25778 | s.setAttribute('f-forigin', fontArr[i].fOrigin);
|
25779 | s.setAttribute('f-origin', fontArr[i].origin);
|
25780 | s.setAttribute('f-family', fontArr[i].fFamily);
|
25781 | s.type = "text/css";
|
25782 | s.innerHTML = "@font-face {" + "font-family: "+fontArr[i].fFamily+"; font-style: normal; src: url('"+fontArr[i].fPath+"');}";
|
25783 | defs.appendChild(s);
|
25784 | }
|
25785 | } else if(fontArr[i].fOrigin === 'g' || fontArr[i].origin === 1){
|
25786 | loadedSelector = document.querySelectorAll('link[f-forigin="g"], link[f-origin="1"]');
|
25787 |
|
25788 | for (j = 0; j < loadedSelector.length; j++) {
|
25789 | if (loadedSelector[j].href.indexOf(fontArr[i].fPath) !== -1) {
|
25790 | // Font is already loaded
|
25791 | shouldLoadFont = false;
|
25792 | }
|
25793 | }
|
25794 |
|
25795 | if (shouldLoadFont) {
|
25796 | var l = createTag('link');
|
25797 | l.setAttribute('f-forigin', fontArr[i].fOrigin);
|
25798 | l.setAttribute('f-origin', fontArr[i].origin);
|
25799 | l.type = "text/css";
|
25800 | l.rel = "stylesheet";
|
25801 | l.href = fontArr[i].fPath;
|
25802 | document.body.appendChild(l);
|
25803 | }
|
25804 | } else if(fontArr[i].fOrigin === 't' || fontArr[i].origin === 2){
|
25805 | loadedSelector = document.querySelectorAll('script[f-forigin="t"], script[f-origin="2"]');
|
25806 |
|
25807 | for (j = 0; j < loadedSelector.length; j++) {
|
25808 | if (fontArr[i].fPath === loadedSelector[j].src) {
|
25809 | // Font is already loaded
|
25810 | shouldLoadFont = false;
|
25811 | }
|
25812 | }
|
25813 |
|
25814 | if (shouldLoadFont) {
|
25815 | var sc = createTag('link');
|
25816 | sc.setAttribute('f-forigin', fontArr[i].fOrigin);
|
25817 | sc.setAttribute('f-origin', fontArr[i].origin);
|
25818 | sc.setAttribute('rel','stylesheet');
|
25819 | sc.setAttribute('href',fontArr[i].fPath);
|
25820 | defs.appendChild(sc);
|
25821 | }
|
25822 | }
|
25823 | fontArr[i].helper = createHelper(defs,fontArr[i]);
|
25824 | fontArr[i].cache = {};
|
25825 | this.fonts.push(fontArr[i]);
|
25826 | }
|
25827 | if (_pendingFonts === 0) {
|
25828 | this.isLoaded = true;
|
25829 | } else {
|
25830 | //On some cases even if the font is loaded, it won't load correctly when measuring text on canvas.
|
25831 | //Adding this timeout seems to fix it
|
25832 | setTimeout(this.checkLoadedFonts.bind(this), 100);
|
25833 | }
|
25834 | }
|
25835 |
|
25836 | function addChars(chars){
|
25837 | if(!chars){
|
25838 | return;
|
25839 | }
|
25840 | if(!this.chars){
|
25841 | this.chars = [];
|
25842 | }
|
25843 | var i, len = chars.length;
|
25844 | var j, jLen = this.chars.length, found;
|
25845 | for(i=0;i<len;i+=1){
|
25846 | j = 0;
|
25847 | found = false;
|
25848 | while(j<jLen){
|
25849 | if(this.chars[j].style === chars[i].style && this.chars[j].fFamily === chars[i].fFamily && this.chars[j].ch === chars[i].ch){
|
25850 | found = true;
|
25851 | }
|
25852 | j += 1;
|
25853 | }
|
25854 | if(!found){
|
25855 | this.chars.push(chars[i]);
|
25856 | jLen += 1;
|
25857 | }
|
25858 | }
|
25859 | }
|
25860 |
|
25861 | function getCharData(char, style, font){
|
25862 | var i = 0, len = this.chars.length;
|
25863 | while( i < len) {
|
25864 | if(this.chars[i].ch === char && this.chars[i].style === style && this.chars[i].fFamily === font){
|
25865 | return this.chars[i];
|
25866 | }
|
25867 | i+= 1;
|
25868 | }
|
25869 | if(console && console.warn) {
|
25870 | console.warn('Missing character from exported characters list: ', char, style, font);
|
25871 | }
|
25872 | return emptyChar;
|
25873 | }
|
25874 |
|
25875 | function measureText(char, fontName, size) {
|
25876 | var fontData = this.getFontByName(fontName);
|
25877 | var index = char.charCodeAt(0);
|
25878 | if(!fontData.cache[index + 1]) {
|
25879 | var tHelper = fontData.helper;
|
25880 | //Canvas version
|
25881 | //fontData.cache[index] = tHelper.measureText(char).width / 100;
|
25882 | //SVG version
|
25883 | //console.log(tHelper.getBBox().width)
|
25884 | if (char === ' ') {
|
25885 | tHelper.textContent = '|' + char + '|';
|
25886 | var doubleSize = tHelper.getComputedTextLength();
|
25887 | tHelper.textContent = '||';
|
25888 | var singleSize = tHelper.getComputedTextLength();
|
25889 | fontData.cache[index + 1] = (doubleSize - singleSize)/100;
|
25890 | } else {
|
25891 | tHelper.textContent = char;
|
25892 | fontData.cache[index + 1] = (tHelper.getComputedTextLength())/100;
|
25893 | }
|
25894 | }
|
25895 | return fontData.cache[index + 1] * size;
|
25896 | }
|
25897 |
|
25898 | function getFontByName(name){
|
25899 | var i = 0, len = this.fonts.length;
|
25900 | while(i<len){
|
25901 | if(this.fonts[i].fName === name) {
|
25902 | return this.fonts[i];
|
25903 | }
|
25904 | i += 1;
|
25905 | }
|
25906 | return this.fonts[0];
|
25907 | }
|
25908 |
|
25909 | function getCombinedCharacterCodes() {
|
25910 | return combinedCharacters;
|
25911 | }
|
25912 |
|
25913 | function loaded() {
|
25914 | return this.isLoaded;
|
25915 | }
|
25916 |
|
25917 | var Font = function(){
|
25918 | this.fonts = [];
|
25919 | this.chars = null;
|
25920 | this.typekitLoaded = 0;
|
25921 | this.isLoaded = false;
|
25922 | this.initTime = Date.now();
|
25923 | };
|
25924 | //TODO: for now I'm adding these methods to the Class and not the prototype. Think of a better way to implement it.
|
25925 | Font.getCombinedCharacterCodes = getCombinedCharacterCodes;
|
25926 |
|
25927 | Font.prototype.addChars = addChars;
|
25928 | Font.prototype.addFonts = addFonts;
|
25929 | Font.prototype.getCharData = getCharData;
|
25930 | Font.prototype.getFontByName = getFontByName;
|
25931 | Font.prototype.measureText = measureText;
|
25932 | Font.prototype.checkLoadedFonts = checkLoadedFonts;
|
25933 | Font.prototype.loaded = loaded;
|
25934 |
|
25935 | return Font;
|
25936 |
|
25937 | }());
|
25938 | var PropertyFactory = (function(){
|
25939 |
|
25940 | var initFrame = initialDefaultFrame;
|
25941 | var math_abs = Math.abs;
|
25942 |
|
25943 | function interpolateValue(frameNum, caching) {
|
25944 | var offsetTime = this.offsetTime;
|
25945 | var newValue;
|
25946 | if (this.propType === 'multidimensional') {
|
25947 | newValue = createTypedArray('float32', this.pv.length);
|
25948 | }
|
25949 | var iterationIndex = caching.lastIndex;
|
25950 | var i = iterationIndex;
|
25951 | var len = this.keyframes.length - 1, flag = true;
|
25952 | var keyData, nextKeyData;
|
25953 |
|
25954 | while (flag) {
|
25955 | keyData = this.keyframes[i];
|
25956 | nextKeyData = this.keyframes[i + 1];
|
25957 | if (i === len - 1 && frameNum >= nextKeyData.t - offsetTime){
|
25958 | if(keyData.h){
|
25959 | keyData = nextKeyData;
|
25960 | }
|
25961 | iterationIndex = 0;
|
25962 | break;
|
25963 | }
|
25964 | if ((nextKeyData.t - offsetTime) > frameNum){
|
25965 | iterationIndex = i;
|
25966 | break;
|
25967 | }
|
25968 | if (i < len - 1){
|
25969 | i += 1;
|
25970 | } else {
|
25971 | iterationIndex = 0;
|
25972 | flag = false;
|
25973 | }
|
25974 | }
|
25975 |
|
25976 | var k, kLen, perc, jLen, j, fnc;
|
25977 | var nextKeyTime = nextKeyData.t - offsetTime;
|
25978 | var keyTime = keyData.t - offsetTime;
|
25979 | var endValue;
|
25980 | if (keyData.to) {
|
25981 | if (!keyData.bezierData) {
|
25982 | keyData.bezierData = bez.buildBezierData(keyData.s, nextKeyData.s || keyData.e, keyData.to, keyData.ti);
|
25983 | }
|
25984 | var bezierData = keyData.bezierData;
|
25985 | if (frameNum >= nextKeyTime || frameNum < keyTime) {
|
25986 | var ind = frameNum >= nextKeyTime ? bezierData.points.length - 1 : 0;
|
25987 | kLen = bezierData.points[ind].point.length;
|
25988 | for (k = 0; k < kLen; k += 1) {
|
25989 | newValue[k] = bezierData.points[ind].point[k];
|
25990 | }
|
25991 | // caching._lastKeyframeIndex = -1;
|
25992 | } else {
|
25993 | if (keyData.__fnct) {
|
25994 | fnc = keyData.__fnct;
|
25995 | } else {
|
25996 | fnc = BezierFactory.getBezierEasing(keyData.o.x, keyData.o.y, keyData.i.x, keyData.i.y, keyData.n).get;
|
25997 | keyData.__fnct = fnc;
|
25998 | }
|
25999 | perc = fnc((frameNum - keyTime) / (nextKeyTime - keyTime));
|
26000 | var distanceInLine = bezierData.segmentLength*perc;
|
26001 |
|
26002 | var segmentPerc;
|
26003 | var addedLength = (caching.lastFrame < frameNum && caching._lastKeyframeIndex === i) ? caching._lastAddedLength : 0;
|
26004 | j = (caching.lastFrame < frameNum && caching._lastKeyframeIndex === i) ? caching._lastPoint : 0;
|
26005 | flag = true;
|
26006 | jLen = bezierData.points.length;
|
26007 | while (flag) {
|
26008 | addedLength += bezierData.points[j].partialLength;
|
26009 | if (distanceInLine === 0 || perc === 0 || j === bezierData.points.length - 1) {
|
26010 | kLen = bezierData.points[j].point.length;
|
26011 | for (k = 0; k < kLen; k += 1) {
|
26012 | newValue[k] = bezierData.points[j].point[k];
|
26013 | }
|
26014 | break;
|
26015 | } else if (distanceInLine >= addedLength && distanceInLine < addedLength + bezierData.points[j + 1].partialLength) {
|
26016 | segmentPerc = (distanceInLine - addedLength) / bezierData.points[j + 1].partialLength;
|
26017 | kLen = bezierData.points[j].point.length;
|
26018 | for (k = 0; k < kLen; k += 1) {
|
26019 | newValue[k] = bezierData.points[j].point[k] + (bezierData.points[j + 1].point[k] - bezierData.points[j].point[k]) * segmentPerc;
|
26020 | }
|
26021 | break;
|
26022 | }
|
26023 | if (j < jLen - 1){
|
26024 | j += 1;
|
26025 | } else {
|
26026 | flag = false;
|
26027 | }
|
26028 | }
|
26029 | caching._lastPoint = j;
|
26030 | caching._lastAddedLength = addedLength - bezierData.points[j].partialLength;
|
26031 | caching._lastKeyframeIndex = i;
|
26032 | }
|
26033 | } else {
|
26034 | var outX, outY, inX, inY, keyValue;
|
26035 | len = keyData.s.length;
|
26036 | endValue = nextKeyData.s || keyData.e;
|
26037 | if (this.sh && keyData.h !== 1) {
|
26038 | if (frameNum >= nextKeyTime) {
|
26039 | newValue[0] = endValue[0];
|
26040 | newValue[1] = endValue[1];
|
26041 | newValue[2] = endValue[2];
|
26042 | } else if (frameNum <= keyTime) {
|
26043 | newValue[0] = keyData.s[0];
|
26044 | newValue[1] = keyData.s[1];
|
26045 | newValue[2] = keyData.s[2];
|
26046 | } else {
|
26047 | var quatStart = createQuaternion(keyData.s);
|
26048 | var quatEnd = createQuaternion(endValue);
|
26049 | var time = (frameNum - keyTime) / (nextKeyTime - keyTime);
|
26050 | quaternionToEuler(newValue, slerp(quatStart, quatEnd, time));
|
26051 | }
|
26052 |
|
26053 | } else {
|
26054 | for(i = 0; i < len; i += 1) {
|
26055 | if (keyData.h !== 1) {
|
26056 | if (frameNum >= nextKeyTime) {
|
26057 | perc = 1;
|
26058 | } else if(frameNum < keyTime) {
|
26059 | perc = 0;
|
26060 | } else {
|
26061 | if(keyData.o.x.constructor === Array) {
|
26062 | if (!keyData.__fnct) {
|
26063 | keyData.__fnct = [];
|
26064 | }
|
26065 | if (!keyData.__fnct[i]) {
|
26066 | outX = (typeof keyData.o.x[i] === 'undefined') ? keyData.o.x[0] : keyData.o.x[i];
|
26067 | outY = (typeof keyData.o.y[i] === 'undefined') ? keyData.o.y[0] : keyData.o.y[i];
|
26068 | inX = (typeof keyData.i.x[i] === 'undefined') ? keyData.i.x[0] : keyData.i.x[i];
|
26069 | inY = (typeof keyData.i.y[i] === 'undefined') ? keyData.i.y[0] : keyData.i.y[i];
|
26070 | fnc = BezierFactory.getBezierEasing(outX, outY, inX, inY).get;
|
26071 | keyData.__fnct[i] = fnc;
|
26072 | } else {
|
26073 | fnc = keyData.__fnct[i];
|
26074 | }
|
26075 | } else {
|
26076 | if (!keyData.__fnct) {
|
26077 | outX = keyData.o.x;
|
26078 | outY = keyData.o.y;
|
26079 | inX = keyData.i.x;
|
26080 | inY = keyData.i.y;
|
26081 | fnc = BezierFactory.getBezierEasing(outX, outY, inX, inY).get;
|
26082 | keyData.__fnct = fnc;
|
26083 | } else {
|
26084 | fnc = keyData.__fnct;
|
26085 | }
|
26086 | }
|
26087 | perc = fnc((frameNum - keyTime) / (nextKeyTime - keyTime ));
|
26088 | }
|
26089 | }
|
26090 |
|
26091 | endValue = nextKeyData.s || keyData.e;
|
26092 | keyValue = keyData.h === 1 ? keyData.s[i] : keyData.s[i] + (endValue[i] - keyData.s[i]) * perc;
|
26093 |
|
26094 | if (len === 1) {
|
26095 | newValue = keyValue;
|
26096 | } else {
|
26097 | newValue[i] = keyValue;
|
26098 | }
|
26099 | }
|
26100 | }
|
26101 | }
|
26102 | caching.lastIndex = iterationIndex;
|
26103 | return newValue;
|
26104 | }
|
26105 |
|
26106 | //based on @Toji's https://github.com/toji/gl-matrix/
|
26107 | function slerp(a, b, t) {
|
26108 | var out = [];
|
26109 | var ax = a[0], ay = a[1], az = a[2], aw = a[3],
|
26110 | bx = b[0], by = b[1], bz = b[2], bw = b[3];
|
26111 |
|
26112 | var omega, cosom, sinom, scale0, scale1;
|
26113 |
|
26114 | cosom = ax * bx + ay * by + az * bz + aw * bw;
|
26115 | if (cosom < 0.0) {
|
26116 | cosom = -cosom;
|
26117 | bx = -bx;
|
26118 | by = -by;
|
26119 | bz = -bz;
|
26120 | bw = -bw;
|
26121 | }
|
26122 | if ((1.0 - cosom) > 0.000001) {
|
26123 | omega = Math.acos(cosom);
|
26124 | sinom = Math.sin(omega);
|
26125 | scale0 = Math.sin((1.0 - t) * omega) / sinom;
|
26126 | scale1 = Math.sin(t * omega) / sinom;
|
26127 | } else {
|
26128 | scale0 = 1.0 - t;
|
26129 | scale1 = t;
|
26130 | }
|
26131 | out[0] = scale0 * ax + scale1 * bx;
|
26132 | out[1] = scale0 * ay + scale1 * by;
|
26133 | out[2] = scale0 * az + scale1 * bz;
|
26134 | out[3] = scale0 * aw + scale1 * bw;
|
26135 |
|
26136 | return out;
|
26137 | }
|
26138 |
|
26139 | function quaternionToEuler(out, quat) {
|
26140 | var qx = quat[0];
|
26141 | var qy = quat[1];
|
26142 | var qz = quat[2];
|
26143 | var qw = quat[3];
|
26144 | var heading = Math.atan2(2*qy*qw-2*qx*qz , 1 - 2*qy*qy - 2*qz*qz);
|
26145 | var attitude = Math.asin(2*qx*qy + 2*qz*qw);
|
26146 | var bank = Math.atan2(2*qx*qw-2*qy*qz , 1 - 2*qx*qx - 2*qz*qz);
|
26147 | out[0] = heading/degToRads;
|
26148 | out[1] = attitude/degToRads;
|
26149 | out[2] = bank/degToRads;
|
26150 | }
|
26151 |
|
26152 | function createQuaternion(values) {
|
26153 | var heading = values[0] * degToRads;
|
26154 | var attitude = values[1] * degToRads;
|
26155 | var bank = values[2] * degToRads;
|
26156 | var c1 = Math.cos(heading / 2);
|
26157 | var c2 = Math.cos(attitude / 2);
|
26158 | var c3 = Math.cos(bank / 2);
|
26159 | var s1 = Math.sin(heading / 2);
|
26160 | var s2 = Math.sin(attitude / 2);
|
26161 | var s3 = Math.sin(bank / 2);
|
26162 | var w = c1 * c2 * c3 - s1 * s2 * s3;
|
26163 | var x = s1 * s2 * c3 + c1 * c2 * s3;
|
26164 | var y = s1 * c2 * c3 + c1 * s2 * s3;
|
26165 | var z = c1 * s2 * c3 - s1 * c2 * s3;
|
26166 |
|
26167 | return [x,y,z,w];
|
26168 | }
|
26169 |
|
26170 | function getValueAtCurrentTime(){
|
26171 | var frameNum = this.comp.renderedFrame - this.offsetTime;
|
26172 | var initTime = this.keyframes[0].t - this.offsetTime;
|
26173 | var endTime = this.keyframes[this.keyframes.length- 1].t-this.offsetTime;
|
26174 | if(!(frameNum === this._caching.lastFrame || (this._caching.lastFrame !== initFrame && ((this._caching.lastFrame >= endTime && frameNum >= endTime) || (this._caching.lastFrame < initTime && frameNum < initTime))))){
|
26175 | if(this._caching.lastFrame >= frameNum) {
|
26176 | this._caching._lastKeyframeIndex = -1;
|
26177 | this._caching.lastIndex = 0;
|
26178 | }
|
26179 |
|
26180 | var renderResult = this.interpolateValue(frameNum, this._caching);
|
26181 | this.pv = renderResult;
|
26182 | }
|
26183 | this._caching.lastFrame = frameNum;
|
26184 | return this.pv;
|
26185 | }
|
26186 |
|
26187 | function setVValue(val) {
|
26188 | var multipliedValue;
|
26189 | if(this.propType === 'unidimensional') {
|
26190 | multipliedValue = val * this.mult;
|
26191 | if(math_abs(this.v - multipliedValue) > 0.00001) {
|
26192 | this.v = multipliedValue;
|
26193 | this._mdf = true;
|
26194 | }
|
26195 | } else {
|
26196 | var i = 0, len = this.v.length;
|
26197 | while (i < len) {
|
26198 | multipliedValue = val[i] * this.mult;
|
26199 | if (math_abs(this.v[i] - multipliedValue) > 0.00001) {
|
26200 | this.v[i] = multipliedValue;
|
26201 | this._mdf = true;
|
26202 | }
|
26203 | i += 1;
|
26204 | }
|
26205 | }
|
26206 | }
|
26207 |
|
26208 | function processEffectsSequence() {
|
26209 | if(this.elem.globalData.frameId === this.frameId || !this.effectsSequence.length) {
|
26210 | return;
|
26211 | }
|
26212 | if(this.lock) {
|
26213 | this.setVValue(this.pv);
|
26214 | return;
|
26215 | }
|
26216 | this.lock = true;
|
26217 | this._mdf = this._isFirstFrame;
|
26218 | var i, len = this.effectsSequence.length;
|
26219 | var finalValue = this.kf ? this.pv : this.data.k;
|
26220 | for(i = 0; i < len; i += 1) {
|
26221 | finalValue = this.effectsSequence[i](finalValue);
|
26222 | }
|
26223 | this.setVValue(finalValue);
|
26224 | this._isFirstFrame = false;
|
26225 | this.lock = false;
|
26226 | this.frameId = this.elem.globalData.frameId;
|
26227 | }
|
26228 |
|
26229 | function addEffect(effectFunction) {
|
26230 | this.effectsSequence.push(effectFunction);
|
26231 | this.container.addDynamicProperty(this);
|
26232 | }
|
26233 |
|
26234 | function ValueProperty(elem, data, mult, container){
|
26235 | this.propType = 'unidimensional';
|
26236 | this.mult = mult || 1;
|
26237 | this.data = data;
|
26238 | this.v = mult ? data.k * mult : data.k;
|
26239 | this.pv = data.k;
|
26240 | this._mdf = false;
|
26241 | this.elem = elem;
|
26242 | this.container = container;
|
26243 | this.comp = elem.comp;
|
26244 | this.k = false;
|
26245 | this.kf = false;
|
26246 | this.vel = 0;
|
26247 | this.effectsSequence = [];
|
26248 | this._isFirstFrame = true;
|
26249 | this.getValue = processEffectsSequence;
|
26250 | this.setVValue = setVValue;
|
26251 | this.addEffect = addEffect;
|
26252 | }
|
26253 |
|
26254 | function MultiDimensionalProperty(elem, data, mult, container) {
|
26255 | this.propType = 'multidimensional';
|
26256 | this.mult = mult || 1;
|
26257 | this.data = data;
|
26258 | this._mdf = false;
|
26259 | this.elem = elem;
|
26260 | this.container = container;
|
26261 | this.comp = elem.comp;
|
26262 | this.k = false;
|
26263 | this.kf = false;
|
26264 | this.frameId = -1;
|
26265 | var i, len = data.k.length;
|
26266 | this.v = createTypedArray('float32', len);
|
26267 | this.pv = createTypedArray('float32', len);
|
26268 | var arr = createTypedArray('float32', len);
|
26269 | this.vel = createTypedArray('float32', len);
|
26270 | for (i = 0; i < len; i += 1) {
|
26271 | this.v[i] = data.k[i] * this.mult;
|
26272 | this.pv[i] = data.k[i];
|
26273 | }
|
26274 | this._isFirstFrame = true;
|
26275 | this.effectsSequence = [];
|
26276 | this.getValue = processEffectsSequence;
|
26277 | this.setVValue = setVValue;
|
26278 | this.addEffect = addEffect;
|
26279 | }
|
26280 |
|
26281 | function KeyframedValueProperty(elem, data, mult, container) {
|
26282 | this.propType = 'unidimensional';
|
26283 | this.keyframes = data.k;
|
26284 | this.offsetTime = elem.data.st;
|
26285 | this.frameId = -1;
|
26286 | this._caching = {lastFrame: initFrame, lastIndex: 0, value: 0, _lastKeyframeIndex: -1};
|
26287 | this.k = true;
|
26288 | this.kf = true;
|
26289 | this.data = data;
|
26290 | this.mult = mult || 1;
|
26291 | this.elem = elem;
|
26292 | this.container = container;
|
26293 | this.comp = elem.comp;
|
26294 | this.v = initFrame;
|
26295 | this.pv = initFrame;
|
26296 | this._isFirstFrame = true;
|
26297 | this.getValue = processEffectsSequence;
|
26298 | this.setVValue = setVValue;
|
26299 | this.interpolateValue = interpolateValue;
|
26300 | this.effectsSequence = [getValueAtCurrentTime.bind(this)];
|
26301 | this.addEffect = addEffect;
|
26302 | }
|
26303 |
|
26304 | function KeyframedMultidimensionalProperty(elem, data, mult, container){
|
26305 | this.propType = 'multidimensional';
|
26306 | var i, len = data.k.length;
|
26307 | var s, e,to,ti;
|
26308 | for (i = 0; i < len - 1; i += 1) {
|
26309 | if (data.k[i].to && data.k[i].s && data.k[i].e) {
|
26310 | s = data.k[i].s;
|
26311 | e = data.k[i].e;
|
26312 | to = data.k[i].to;
|
26313 | ti = data.k[i].ti;
|
26314 | if((s.length === 2 && !(s[0] === e[0] && s[1] === e[1]) && bez.pointOnLine2D(s[0],s[1],e[0],e[1],s[0] + to[0],s[1] + to[1]) && bez.pointOnLine2D(s[0],s[1],e[0],e[1],e[0] + ti[0],e[1] + ti[1])) || (s.length === 3 && !(s[0] === e[0] && s[1] === e[1] && s[2] === e[2]) && bez.pointOnLine3D(s[0],s[1],s[2],e[0],e[1],e[2],s[0] + to[0],s[1] + to[1],s[2] + to[2]) && bez.pointOnLine3D(s[0],s[1],s[2],e[0],e[1],e[2],e[0] + ti[0],e[1] + ti[1],e[2] + ti[2]))){
|
26315 | data.k[i].to = null;
|
26316 | data.k[i].ti = null;
|
26317 | }
|
26318 | if(s[0] === e[0] && s[1] === e[1] && to[0] === 0 && to[1] === 0 && ti[0] === 0 && ti[1] === 0) {
|
26319 | if(s.length === 2 || (s[2] === e[2] && to[2] === 0 && ti[2] === 0)) {
|
26320 | data.k[i].to = null;
|
26321 | data.k[i].ti = null;
|
26322 | }
|
26323 | }
|
26324 | }
|
26325 | }
|
26326 | this.effectsSequence = [getValueAtCurrentTime.bind(this)];
|
26327 | this.keyframes = data.k;
|
26328 | this.offsetTime = elem.data.st;
|
26329 | this.k = true;
|
26330 | this.kf = true;
|
26331 | this._isFirstFrame = true;
|
26332 | this.mult = mult || 1;
|
26333 | this.elem = elem;
|
26334 | this.container = container;
|
26335 | this.comp = elem.comp;
|
26336 | this.getValue = processEffectsSequence;
|
26337 | this.setVValue = setVValue;
|
26338 | this.interpolateValue = interpolateValue;
|
26339 | this.frameId = -1;
|
26340 | var arrLen = data.k[0].s.length;
|
26341 | this.v = createTypedArray('float32', arrLen);
|
26342 | this.pv = createTypedArray('float32', arrLen);
|
26343 | for (i = 0; i < arrLen; i += 1) {
|
26344 | this.v[i] = initFrame;
|
26345 | this.pv[i] = initFrame;
|
26346 | }
|
26347 | this._caching={lastFrame:initFrame,lastIndex:0,value:createTypedArray('float32', arrLen)};
|
26348 | this.addEffect = addEffect;
|
26349 | }
|
26350 |
|
26351 | function getProp(elem,data,type, mult, container) {
|
26352 | var p;
|
26353 | if(!data.k.length){
|
26354 | p = new ValueProperty(elem,data, mult, container);
|
26355 | }else if(typeof(data.k[0]) === 'number'){
|
26356 | p = new MultiDimensionalProperty(elem,data, mult, container);
|
26357 | }else{
|
26358 | switch(type){
|
26359 | case 0:
|
26360 | p = new KeyframedValueProperty(elem,data,mult, container);
|
26361 | break;
|
26362 | case 1:
|
26363 | p = new KeyframedMultidimensionalProperty(elem,data,mult, container);
|
26364 | break;
|
26365 | }
|
26366 | }
|
26367 | if(p.effectsSequence.length){
|
26368 | container.addDynamicProperty(p);
|
26369 | }
|
26370 | return p;
|
26371 | }
|
26372 |
|
26373 | var ob = {
|
26374 | getProp: getProp
|
26375 | };
|
26376 | return ob;
|
26377 | }());
|
26378 | var TransformPropertyFactory = (function() {
|
26379 |
|
26380 | function applyToMatrix(mat) {
|
26381 | var _mdf = this._mdf;
|
26382 | this.iterateDynamicProperties();
|
26383 | this._mdf = this._mdf || _mdf;
|
26384 | if (this.a) {
|
26385 | mat.translate(-this.a.v[0], -this.a.v[1], this.a.v[2]);
|
26386 | }
|
26387 | if (this.s) {
|
26388 | mat.scale(this.s.v[0], this.s.v[1], this.s.v[2]);
|
26389 | }
|
26390 | if (this.sk) {
|
26391 | mat.skewFromAxis(-this.sk.v, this.sa.v);
|
26392 | }
|
26393 | if (this.r) {
|
26394 | mat.rotate(-this.r.v);
|
26395 | } else {
|
26396 | mat.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]);
|
26397 | }
|
26398 | if (this.data.p.s) {
|
26399 | if (this.data.p.z) {
|
26400 | mat.translate(this.px.v, this.py.v, -this.pz.v);
|
26401 | } else {
|
26402 | mat.translate(this.px.v, this.py.v, 0);
|
26403 | }
|
26404 | } else {
|
26405 | mat.translate(this.p.v[0], this.p.v[1], -this.p.v[2]);
|
26406 | }
|
26407 | }
|
26408 | function processKeys(forceRender){
|
26409 | if (this.elem.globalData.frameId === this.frameId) {
|
26410 | return;
|
26411 | }
|
26412 | if(this._isDirty) {
|
26413 | this.precalculateMatrix();
|
26414 | this._isDirty = false;
|
26415 | }
|
26416 |
|
26417 | this.iterateDynamicProperties();
|
26418 |
|
26419 | if (this._mdf || forceRender) {
|
26420 | this.v.cloneFromProps(this.pre.props);
|
26421 | if (this.appliedTransformations < 1) {
|
26422 | this.v.translate(-this.a.v[0], -this.a.v[1], this.a.v[2]);
|
26423 | }
|
26424 | if(this.appliedTransformations < 2) {
|
26425 | this.v.scale(this.s.v[0], this.s.v[1], this.s.v[2]);
|
26426 | }
|
26427 | if (this.sk && this.appliedTransformations < 3) {
|
26428 | this.v.skewFromAxis(-this.sk.v, this.sa.v);
|
26429 | }
|
26430 | if (this.r && this.appliedTransformations < 4) {
|
26431 | this.v.rotate(-this.r.v);
|
26432 | } else if (!this.r && this.appliedTransformations < 4){
|
26433 | this.v.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]);
|
26434 | }
|
26435 | if (this.autoOriented) {
|
26436 | var v1,v2, frameRate = this.elem.globalData.frameRate;
|
26437 | if(this.p && this.p.keyframes && this.p.getValueAtTime) {
|
26438 | if (this.p._caching.lastFrame+this.p.offsetTime <= this.p.keyframes[0].t) {
|
26439 | v1 = this.p.getValueAtTime((this.p.keyframes[0].t + 0.01) / frameRate,0);
|
26440 | v2 = this.p.getValueAtTime(this.p.keyframes[0].t / frameRate, 0);
|
26441 | } else if(this.p._caching.lastFrame+this.p.offsetTime >= this.p.keyframes[this.p.keyframes.length - 1].t) {
|
26442 | v1 = this.p.getValueAtTime((this.p.keyframes[this.p.keyframes.length - 1].t / frameRate), 0);
|
26443 | v2 = this.p.getValueAtTime((this.p.keyframes[this.p.keyframes.length - 1].t - 0.01) / frameRate, 0);
|
26444 | } else {
|
26445 | v1 = this.p.pv;
|
26446 | v2 = this.p.getValueAtTime((this.p._caching.lastFrame+this.p.offsetTime - 0.01) / frameRate, this.p.offsetTime);
|
26447 | }
|
26448 | } else if(this.px && this.px.keyframes && this.py.keyframes && this.px.getValueAtTime && this.py.getValueAtTime) {
|
26449 | v1 = [];
|
26450 | v2 = [];
|
26451 | var px = this.px, py = this.py, frameRate;
|
26452 | if (px._caching.lastFrame+px.offsetTime <= px.keyframes[0].t) {
|
26453 | v1[0] = px.getValueAtTime((px.keyframes[0].t + 0.01) / frameRate,0);
|
26454 | v1[1] = py.getValueAtTime((py.keyframes[0].t + 0.01) / frameRate,0);
|
26455 | v2[0] = px.getValueAtTime((px.keyframes[0].t) / frameRate,0);
|
26456 | v2[1] = py.getValueAtTime((py.keyframes[0].t) / frameRate,0);
|
26457 | } else if(px._caching.lastFrame+px.offsetTime >= px.keyframes[px.keyframes.length - 1].t) {
|
26458 | v1[0] = px.getValueAtTime((px.keyframes[px.keyframes.length - 1].t / frameRate),0);
|
26459 | v1[1] = py.getValueAtTime((py.keyframes[py.keyframes.length - 1].t / frameRate),0);
|
26460 | v2[0] = px.getValueAtTime((px.keyframes[px.keyframes.length - 1].t - 0.01) / frameRate,0);
|
26461 | v2[1] = py.getValueAtTime((py.keyframes[py.keyframes.length - 1].t - 0.01) / frameRate,0);
|
26462 | } else {
|
26463 | v1 = [px.pv, py.pv];
|
26464 | v2[0] = px.getValueAtTime((px._caching.lastFrame+px.offsetTime - 0.01) / frameRate,px.offsetTime);
|
26465 | v2[1] = py.getValueAtTime((py._caching.lastFrame+py.offsetTime - 0.01) / frameRate,py.offsetTime);
|
26466 | }
|
26467 | }
|
26468 | this.v.rotate(-Math.atan2(v1[1] - v2[1], v1[0] - v2[0]));
|
26469 | }
|
26470 | if(this.data.p && this.data.p.s){
|
26471 | if(this.data.p.z) {
|
26472 | this.v.translate(this.px.v, this.py.v, -this.pz.v);
|
26473 | } else {
|
26474 | this.v.translate(this.px.v, this.py.v, 0);
|
26475 | }
|
26476 | }else{
|
26477 | this.v.translate(this.p.v[0],this.p.v[1],-this.p.v[2]);
|
26478 | }
|
26479 | }
|
26480 | this.frameId = this.elem.globalData.frameId;
|
26481 | }
|
26482 |
|
26483 | function precalculateMatrix() {
|
26484 | if(!this.a.k) {
|
26485 | this.pre.translate(-this.a.v[0], -this.a.v[1], this.a.v[2]);
|
26486 | this.appliedTransformations = 1;
|
26487 | } else {
|
26488 | return;
|
26489 | }
|
26490 | if(!this.s.effectsSequence.length) {
|
26491 | this.pre.scale(this.s.v[0], this.s.v[1], this.s.v[2]);
|
26492 | this.appliedTransformations = 2;
|
26493 | } else {
|
26494 | return;
|
26495 | }
|
26496 | if(this.sk) {
|
26497 | if(!this.sk.effectsSequence.length && !this.sa.effectsSequence.length) {
|
26498 | this.pre.skewFromAxis(-this.sk.v, this.sa.v);
|
26499 | this.appliedTransformations = 3;
|
26500 | } else {
|
26501 | return;
|
26502 | }
|
26503 | }
|
26504 | if (this.r) {
|
26505 | if(!this.r.effectsSequence.length) {
|
26506 | this.pre.rotate(-this.r.v);
|
26507 | this.appliedTransformations = 4;
|
26508 | } else {
|
26509 | return;
|
26510 | }
|
26511 | } else if(!this.rz.effectsSequence.length && !this.ry.effectsSequence.length && !this.rx.effectsSequence.length && !this.or.effectsSequence.length) {
|
26512 | this.pre.rotateZ(-this.rz.v).rotateY(this.ry.v).rotateX(this.rx.v).rotateZ(-this.or.v[2]).rotateY(this.or.v[1]).rotateX(this.or.v[0]);
|
26513 | this.appliedTransformations = 4;
|
26514 | }
|
26515 | }
|
26516 |
|
26517 | function autoOrient(){
|
26518 | //
|
26519 | //var prevP = this.getValueAtTime();
|
26520 | }
|
26521 |
|
26522 | function addDynamicProperty(prop) {
|
26523 | this._addDynamicProperty(prop);
|
26524 | this.elem.addDynamicProperty(prop);
|
26525 | this._isDirty = true;
|
26526 | }
|
26527 |
|
26528 | function TransformProperty(elem,data,container){
|
26529 | this.elem = elem;
|
26530 | this.frameId = -1;
|
26531 | this.propType = 'transform';
|
26532 | this.data = data;
|
26533 | this.v = new Matrix();
|
26534 | //Precalculated matrix with non animated properties
|
26535 | this.pre = new Matrix();
|
26536 | this.appliedTransformations = 0;
|
26537 | this.initDynamicPropertyContainer(container || elem);
|
26538 | if(data.p && data.p.s){
|
26539 | this.px = PropertyFactory.getProp(elem,data.p.x,0,0,this);
|
26540 | this.py = PropertyFactory.getProp(elem,data.p.y,0,0,this);
|
26541 | if(data.p.z){
|
26542 | this.pz = PropertyFactory.getProp(elem,data.p.z,0,0,this);
|
26543 | }
|
26544 | }else{
|
26545 | this.p = PropertyFactory.getProp(elem,data.p || {k:[0,0,0]},1,0,this);
|
26546 | }
|
26547 | if(data.rx) {
|
26548 | this.rx = PropertyFactory.getProp(elem, data.rx, 0, degToRads, this);
|
26549 | this.ry = PropertyFactory.getProp(elem, data.ry, 0, degToRads, this);
|
26550 | this.rz = PropertyFactory.getProp(elem, data.rz, 0, degToRads, this);
|
26551 | if(data.or.k[0].ti) {
|
26552 | var i, len = data.or.k.length;
|
26553 | for(i=0;i<len;i+=1) {
|
26554 | data.or.k[i].to = data.or.k[i].ti = null;
|
26555 | }
|
26556 | }
|
26557 | this.or = PropertyFactory.getProp(elem, data.or, 1, degToRads, this);
|
26558 | //sh Indicates it needs to be capped between -180 and 180
|
26559 | this.or.sh = true;
|
26560 | } else {
|
26561 | this.r = PropertyFactory.getProp(elem, data.r || {k: 0}, 0, degToRads, this);
|
26562 | }
|
26563 | if(data.sk){
|
26564 | this.sk = PropertyFactory.getProp(elem, data.sk, 0, degToRads, this);
|
26565 | this.sa = PropertyFactory.getProp(elem, data.sa, 0, degToRads, this);
|
26566 | }
|
26567 | this.a = PropertyFactory.getProp(elem,data.a || {k:[0,0,0]},1,0,this);
|
26568 | this.s = PropertyFactory.getProp(elem,data.s || {k:[100,100,100]},1,0.01,this);
|
26569 | // Opacity is not part of the transform properties, that's why it won't use this.dynamicProperties. That way transforms won't get updated if opacity changes.
|
26570 | if(data.o){
|
26571 | this.o = PropertyFactory.getProp(elem,data.o,0,0.01,elem);
|
26572 | } else {
|
26573 | this.o = {_mdf:false,v:1};
|
26574 | }
|
26575 | this._isDirty = true;
|
26576 | if(!this.dynamicProperties.length){
|
26577 | this.getValue(true);
|
26578 | }
|
26579 | }
|
26580 |
|
26581 | TransformProperty.prototype = {
|
26582 | applyToMatrix: applyToMatrix,
|
26583 | getValue: processKeys,
|
26584 | precalculateMatrix: precalculateMatrix,
|
26585 | autoOrient: autoOrient
|
26586 | };
|
26587 |
|
26588 | extendPrototype([DynamicPropertyContainer], TransformProperty);
|
26589 | TransformProperty.prototype.addDynamicProperty = addDynamicProperty;
|
26590 | TransformProperty.prototype._addDynamicProperty = DynamicPropertyContainer.prototype.addDynamicProperty;
|
26591 |
|
26592 | function getTransformProperty(elem,data,container){
|
26593 | return new TransformProperty(elem,data,container);
|
26594 | }
|
26595 |
|
26596 | return {
|
26597 | getTransformProperty: getTransformProperty
|
26598 | };
|
26599 |
|
26600 | }());
|
26601 | function ShapePath(){
|
26602 | this.c = false;
|
26603 | this._length = 0;
|
26604 | this._maxLength = 8;
|
26605 | this.v = createSizedArray(this._maxLength);
|
26606 | this.o = createSizedArray(this._maxLength);
|
26607 | this.i = createSizedArray(this._maxLength);
|
26608 | }
|
26609 |
|
26610 | ShapePath.prototype.setPathData = function(closed, len) {
|
26611 | this.c = closed;
|
26612 | this.setLength(len);
|
26613 | var i = 0;
|
26614 | while(i < len){
|
26615 | this.v[i] = point_pool.newElement();
|
26616 | this.o[i] = point_pool.newElement();
|
26617 | this.i[i] = point_pool.newElement();
|
26618 | i += 1;
|
26619 | }
|
26620 | };
|
26621 |
|
26622 | ShapePath.prototype.setLength = function(len) {
|
26623 | while(this._maxLength < len) {
|
26624 | this.doubleArrayLength();
|
26625 | }
|
26626 | this._length = len;
|
26627 | };
|
26628 |
|
26629 | ShapePath.prototype.doubleArrayLength = function() {
|
26630 | this.v = this.v.concat(createSizedArray(this._maxLength));
|
26631 | this.i = this.i.concat(createSizedArray(this._maxLength));
|
26632 | this.o = this.o.concat(createSizedArray(this._maxLength));
|
26633 | this._maxLength *= 2;
|
26634 | };
|
26635 |
|
26636 | ShapePath.prototype.setXYAt = function(x, y, type, pos, replace) {
|
26637 | var arr;
|
26638 | this._length = Math.max(this._length, pos + 1);
|
26639 | if(this._length >= this._maxLength) {
|
26640 | this.doubleArrayLength();
|
26641 | }
|
26642 | switch(type){
|
26643 | case 'v':
|
26644 | arr = this.v;
|
26645 | break;
|
26646 | case 'i':
|
26647 | arr = this.i;
|
26648 | break;
|
26649 | case 'o':
|
26650 | arr = this.o;
|
26651 | break;
|
26652 | }
|
26653 | if(!arr[pos] || (arr[pos] && !replace)){
|
26654 | arr[pos] = point_pool.newElement();
|
26655 | }
|
26656 | arr[pos][0] = x;
|
26657 | arr[pos][1] = y;
|
26658 | };
|
26659 |
|
26660 | ShapePath.prototype.setTripleAt = function(vX,vY,oX,oY,iX,iY,pos, replace) {
|
26661 | this.setXYAt(vX,vY,'v',pos, replace);
|
26662 | this.setXYAt(oX,oY,'o',pos, replace);
|
26663 | this.setXYAt(iX,iY,'i',pos, replace);
|
26664 | };
|
26665 |
|
26666 | ShapePath.prototype.reverse = function() {
|
26667 | var newPath = new ShapePath();
|
26668 | newPath.setPathData(this.c, this._length);
|
26669 | var vertices = this.v, outPoints = this.o, inPoints = this.i;
|
26670 | var init = 0;
|
26671 | if (this.c) {
|
26672 | newPath.setTripleAt(vertices[0][0], vertices[0][1], inPoints[0][0], inPoints[0][1], outPoints[0][0], outPoints[0][1], 0, false);
|
26673 | init = 1;
|
26674 | }
|
26675 | var cnt = this._length - 1;
|
26676 | var len = this._length;
|
26677 |
|
26678 | var i;
|
26679 | for (i = init; i < len; i += 1) {
|
26680 | newPath.setTripleAt(vertices[cnt][0], vertices[cnt][1], inPoints[cnt][0], inPoints[cnt][1], outPoints[cnt][0], outPoints[cnt][1], i, false);
|
26681 | cnt -= 1;
|
26682 | }
|
26683 | return newPath;
|
26684 | };
|
26685 | var ShapePropertyFactory = (function(){
|
26686 |
|
26687 | var initFrame = -999999;
|
26688 |
|
26689 | function interpolateShape(frameNum, previousValue, caching) {
|
26690 | var iterationIndex = caching.lastIndex;
|
26691 | var keyPropS,keyPropE,isHold, j, k, jLen, kLen, perc, vertexValue;
|
26692 | var kf = this.keyframes;
|
26693 | if(frameNum < kf[0].t-this.offsetTime){
|
26694 | keyPropS = kf[0].s[0];
|
26695 | isHold = true;
|
26696 | iterationIndex = 0;
|
26697 | }else if(frameNum >= kf[kf.length - 1].t-this.offsetTime){
|
26698 | keyPropS = kf[kf.length - 1].s ? kf[kf.length - 1].s[0] : kf[kf.length - 2].e[0];
|
26699 | /*if(kf[kf.length - 1].s){
|
26700 | keyPropS = kf[kf.length - 1].s[0];
|
26701 | }else{
|
26702 | keyPropS = kf[kf.length - 2].e[0];
|
26703 | }*/
|
26704 | isHold = true;
|
26705 | }else{
|
26706 | var i = iterationIndex;
|
26707 | var len = kf.length- 1,flag = true,keyData,nextKeyData;
|
26708 | while(flag){
|
26709 | keyData = kf[i];
|
26710 | nextKeyData = kf[i+1];
|
26711 | if((nextKeyData.t - this.offsetTime) > frameNum){
|
26712 | break;
|
26713 | }
|
26714 | if(i < len - 1){
|
26715 | i += 1;
|
26716 | }else{
|
26717 | flag = false;
|
26718 | }
|
26719 | }
|
26720 | isHold = keyData.h === 1;
|
26721 | iterationIndex = i;
|
26722 | if(!isHold){
|
26723 | if(frameNum >= nextKeyData.t-this.offsetTime){
|
26724 | perc = 1;
|
26725 | }else if(frameNum < keyData.t-this.offsetTime){
|
26726 | perc = 0;
|
26727 | }else{
|
26728 | var fnc;
|
26729 | if(keyData.__fnct){
|
26730 | fnc = keyData.__fnct;
|
26731 | }else{
|
26732 | fnc = BezierFactory.getBezierEasing(keyData.o.x,keyData.o.y,keyData.i.x,keyData.i.y).get;
|
26733 | keyData.__fnct = fnc;
|
26734 | }
|
26735 | perc = fnc((frameNum-(keyData.t-this.offsetTime))/((nextKeyData.t-this.offsetTime)-(keyData.t-this.offsetTime)));
|
26736 | }
|
26737 | keyPropE = nextKeyData.s ? nextKeyData.s[0] : keyData.e[0];
|
26738 | }
|
26739 | keyPropS = keyData.s[0];
|
26740 | }
|
26741 | jLen = previousValue._length;
|
26742 | kLen = keyPropS.i[0].length;
|
26743 | caching.lastIndex = iterationIndex;
|
26744 |
|
26745 | for(j=0;j<jLen;j+=1){
|
26746 | for(k=0;k<kLen;k+=1){
|
26747 | vertexValue = isHold ? keyPropS.i[j][k] : keyPropS.i[j][k]+(keyPropE.i[j][k]-keyPropS.i[j][k])*perc;
|
26748 | previousValue.i[j][k] = vertexValue;
|
26749 | vertexValue = isHold ? keyPropS.o[j][k] : keyPropS.o[j][k]+(keyPropE.o[j][k]-keyPropS.o[j][k])*perc;
|
26750 | previousValue.o[j][k] = vertexValue;
|
26751 | vertexValue = isHold ? keyPropS.v[j][k] : keyPropS.v[j][k]+(keyPropE.v[j][k]-keyPropS.v[j][k])*perc;
|
26752 | previousValue.v[j][k] = vertexValue;
|
26753 | }
|
26754 | }
|
26755 | }
|
26756 |
|
26757 | function interpolateShapeCurrentTime(){
|
26758 | var frameNum = this.comp.renderedFrame - this.offsetTime;
|
26759 | var initTime = this.keyframes[0].t - this.offsetTime;
|
26760 | var endTime = this.keyframes[this.keyframes.length - 1].t - this.offsetTime;
|
26761 | var lastFrame = this._caching.lastFrame;
|
26762 | if(!(lastFrame !== initFrame && ((lastFrame < initTime && frameNum < initTime) || (lastFrame > endTime && frameNum > endTime)))){
|
26763 | ////
|
26764 | this._caching.lastIndex = lastFrame < frameNum ? this._caching.lastIndex : 0;
|
26765 | this.interpolateShape(frameNum, this.pv, this._caching);
|
26766 | ////
|
26767 | }
|
26768 | this._caching.lastFrame = frameNum;
|
26769 | return this.pv;
|
26770 | }
|
26771 |
|
26772 | function resetShape(){
|
26773 | this.paths = this.localShapeCollection;
|
26774 | }
|
26775 |
|
26776 | function shapesEqual(shape1, shape2) {
|
26777 | if(shape1._length !== shape2._length || shape1.c !== shape2.c){
|
26778 | return false;
|
26779 | }
|
26780 | var i, len = shape1._length;
|
26781 | for(i = 0; i < len; i += 1) {
|
26782 | if(shape1.v[i][0] !== shape2.v[i][0]
|
26783 | || shape1.v[i][1] !== shape2.v[i][1]
|
26784 | || shape1.o[i][0] !== shape2.o[i][0]
|
26785 | || shape1.o[i][1] !== shape2.o[i][1]
|
26786 | || shape1.i[i][0] !== shape2.i[i][0]
|
26787 | || shape1.i[i][1] !== shape2.i[i][1]) {
|
26788 | return false;
|
26789 | }
|
26790 | }
|
26791 | return true;
|
26792 | }
|
26793 |
|
26794 | function setVValue(newPath) {
|
26795 | if(!shapesEqual(this.v, newPath)) {
|
26796 | this.v = shape_pool.clone(newPath);
|
26797 | this.localShapeCollection.releaseShapes();
|
26798 | this.localShapeCollection.addShape(this.v);
|
26799 | this._mdf = true;
|
26800 | this.paths = this.localShapeCollection;
|
26801 | }
|
26802 | }
|
26803 |
|
26804 | function processEffectsSequence() {
|
26805 | if(this.elem.globalData.frameId === this.frameId || !this.effectsSequence.length) {
|
26806 | return;
|
26807 | }
|
26808 | if(this.lock) {
|
26809 | this.setVValue(this.pv);
|
26810 | return;
|
26811 | }
|
26812 | this.lock = true;
|
26813 | this._mdf = false;
|
26814 | var finalValue = this.kf ? this.pv : this.data.ks ? this.data.ks.k : this.data.pt.k;
|
26815 | var i, len = this.effectsSequence.length;
|
26816 | for(i = 0; i < len; i += 1) {
|
26817 | finalValue = this.effectsSequence[i](finalValue);
|
26818 | }
|
26819 | this.setVValue(finalValue);
|
26820 | this.lock = false;
|
26821 | this.frameId = this.elem.globalData.frameId;
|
26822 | }
|
26823 | function ShapeProperty(elem, data, type){
|
26824 | this.propType = 'shape';
|
26825 | this.comp = elem.comp;
|
26826 | this.container = elem;
|
26827 | this.elem = elem;
|
26828 | this.data = data;
|
26829 | this.k = false;
|
26830 | this.kf = false;
|
26831 | this._mdf = false;
|
26832 | var pathData = type === 3 ? data.pt.k : data.ks.k;
|
26833 | this.v = shape_pool.clone(pathData);
|
26834 | this.pv = shape_pool.clone(this.v);
|
26835 | this.localShapeCollection = shapeCollection_pool.newShapeCollection();
|
26836 | this.paths = this.localShapeCollection;
|
26837 | this.paths.addShape(this.v);
|
26838 | this.reset = resetShape;
|
26839 | this.effectsSequence = [];
|
26840 | }
|
26841 |
|
26842 | function addEffect(effectFunction) {
|
26843 | this.effectsSequence.push(effectFunction);
|
26844 | this.container.addDynamicProperty(this);
|
26845 | }
|
26846 |
|
26847 | ShapeProperty.prototype.interpolateShape = interpolateShape;
|
26848 | ShapeProperty.prototype.getValue = processEffectsSequence;
|
26849 | ShapeProperty.prototype.setVValue = setVValue;
|
26850 | ShapeProperty.prototype.addEffect = addEffect;
|
26851 |
|
26852 | function KeyframedShapeProperty(elem,data,type){
|
26853 | this.propType = 'shape';
|
26854 | this.comp = elem.comp;
|
26855 | this.elem = elem;
|
26856 | this.container = elem;
|
26857 | this.offsetTime = elem.data.st;
|
26858 | this.keyframes = type === 3 ? data.pt.k : data.ks.k;
|
26859 | this.k = true;
|
26860 | this.kf = true;
|
26861 | var len = this.keyframes[0].s[0].i.length;
|
26862 | var jLen = this.keyframes[0].s[0].i[0].length;
|
26863 | this.v = shape_pool.newElement();
|
26864 | this.v.setPathData(this.keyframes[0].s[0].c, len);
|
26865 | this.pv = shape_pool.clone(this.v);
|
26866 | this.localShapeCollection = shapeCollection_pool.newShapeCollection();
|
26867 | this.paths = this.localShapeCollection;
|
26868 | this.paths.addShape(this.v);
|
26869 | this.lastFrame = initFrame;
|
26870 | this.reset = resetShape;
|
26871 | this._caching = {lastFrame: initFrame, lastIndex: 0};
|
26872 | this.effectsSequence = [interpolateShapeCurrentTime.bind(this)];
|
26873 | }
|
26874 | KeyframedShapeProperty.prototype.getValue = processEffectsSequence;
|
26875 | KeyframedShapeProperty.prototype.interpolateShape = interpolateShape;
|
26876 | KeyframedShapeProperty.prototype.setVValue = setVValue;
|
26877 | KeyframedShapeProperty.prototype.addEffect = addEffect;
|
26878 |
|
26879 | var EllShapeProperty = (function(){
|
26880 |
|
26881 | var cPoint = roundCorner;
|
26882 |
|
26883 | function EllShapeProperty(elem,data) {
|
26884 | /*this.v = {
|
26885 | v: createSizedArray(4),
|
26886 | i: createSizedArray(4),
|
26887 | o: createSizedArray(4),
|
26888 | c: true
|
26889 | };*/
|
26890 | this.v = shape_pool.newElement();
|
26891 | this.v.setPathData(true, 4);
|
26892 | this.localShapeCollection = shapeCollection_pool.newShapeCollection();
|
26893 | this.paths = this.localShapeCollection;
|
26894 | this.localShapeCollection.addShape(this.v);
|
26895 | this.d = data.d;
|
26896 | this.elem = elem;
|
26897 | this.comp = elem.comp;
|
26898 | this.frameId = -1;
|
26899 | this.initDynamicPropertyContainer(elem);
|
26900 | this.p = PropertyFactory.getProp(elem,data.p,1,0,this);
|
26901 | this.s = PropertyFactory.getProp(elem,data.s,1,0,this);
|
26902 | if(this.dynamicProperties.length){
|
26903 | this.k = true;
|
26904 | }else{
|
26905 | this.k = false;
|
26906 | this.convertEllToPath();
|
26907 | }
|
26908 | }
|
26909 | EllShapeProperty.prototype = {
|
26910 | reset: resetShape,
|
26911 | getValue: function (){
|
26912 | if(this.elem.globalData.frameId === this.frameId){
|
26913 | return;
|
26914 | }
|
26915 | this.frameId = this.elem.globalData.frameId;
|
26916 | this.iterateDynamicProperties();
|
26917 |
|
26918 | if(this._mdf){
|
26919 | this.convertEllToPath();
|
26920 | }
|
26921 | },
|
26922 | convertEllToPath: function() {
|
26923 | var p0 = this.p.v[0], p1 = this.p.v[1], s0 = this.s.v[0]/2, s1 = this.s.v[1]/2;
|
26924 | var _cw = this.d !== 3;
|
26925 | var _v = this.v;
|
26926 | _v.v[0][0] = p0;
|
26927 | _v.v[0][1] = p1 - s1;
|
26928 | _v.v[1][0] = _cw ? p0 + s0 : p0 - s0;
|
26929 | _v.v[1][1] = p1;
|
26930 | _v.v[2][0] = p0;
|
26931 | _v.v[2][1] = p1 + s1;
|
26932 | _v.v[3][0] = _cw ? p0 - s0 : p0 + s0;
|
26933 | _v.v[3][1] = p1;
|
26934 | _v.i[0][0] = _cw ? p0 - s0 * cPoint : p0 + s0 * cPoint;
|
26935 | _v.i[0][1] = p1 - s1;
|
26936 | _v.i[1][0] = _cw ? p0 + s0 : p0 - s0;
|
26937 | _v.i[1][1] = p1 - s1 * cPoint;
|
26938 | _v.i[2][0] = _cw ? p0 + s0 * cPoint : p0 - s0 * cPoint;
|
26939 | _v.i[2][1] = p1 + s1;
|
26940 | _v.i[3][0] = _cw ? p0 - s0 : p0 + s0;
|
26941 | _v.i[3][1] = p1 + s1 * cPoint;
|
26942 | _v.o[0][0] = _cw ? p0 + s0 * cPoint : p0 - s0 * cPoint;
|
26943 | _v.o[0][1] = p1 - s1;
|
26944 | _v.o[1][0] = _cw ? p0 + s0 : p0 - s0;
|
26945 | _v.o[1][1] = p1 + s1 * cPoint;
|
26946 | _v.o[2][0] = _cw ? p0 - s0 * cPoint : p0 + s0 * cPoint;
|
26947 | _v.o[2][1] = p1 + s1;
|
26948 | _v.o[3][0] = _cw ? p0 - s0 : p0 + s0;
|
26949 | _v.o[3][1] = p1 - s1 * cPoint;
|
26950 | }
|
26951 | };
|
26952 |
|
26953 | extendPrototype([DynamicPropertyContainer], EllShapeProperty);
|
26954 |
|
26955 | return EllShapeProperty;
|
26956 | }());
|
26957 |
|
26958 | var StarShapeProperty = (function() {
|
26959 |
|
26960 | function StarShapeProperty(elem,data) {
|
26961 | this.v = shape_pool.newElement();
|
26962 | this.v.setPathData(true, 0);
|
26963 | this.elem = elem;
|
26964 | this.comp = elem.comp;
|
26965 | this.data = data;
|
26966 | this.frameId = -1;
|
26967 | this.d = data.d;
|
26968 | this.initDynamicPropertyContainer(elem);
|
26969 | if(data.sy === 1){
|
26970 | this.ir = PropertyFactory.getProp(elem,data.ir,0,0,this);
|
26971 | this.is = PropertyFactory.getProp(elem,data.is,0,0.01,this);
|
26972 | this.convertToPath = this.convertStarToPath;
|
26973 | } else {
|
26974 | this.convertToPath = this.convertPolygonToPath;
|
26975 | }
|
26976 | this.pt = PropertyFactory.getProp(elem,data.pt,0,0,this);
|
26977 | this.p = PropertyFactory.getProp(elem,data.p,1,0,this);
|
26978 | this.r = PropertyFactory.getProp(elem,data.r,0,degToRads,this);
|
26979 | this.or = PropertyFactory.getProp(elem,data.or,0,0,this);
|
26980 | this.os = PropertyFactory.getProp(elem,data.os,0,0.01,this);
|
26981 | this.localShapeCollection = shapeCollection_pool.newShapeCollection();
|
26982 | this.localShapeCollection.addShape(this.v);
|
26983 | this.paths = this.localShapeCollection;
|
26984 | if(this.dynamicProperties.length){
|
26985 | this.k = true;
|
26986 | }else{
|
26987 | this.k = false;
|
26988 | this.convertToPath();
|
26989 | }
|
26990 | }
|
26991 | StarShapeProperty.prototype = {
|
26992 | reset: resetShape,
|
26993 | getValue: function() {
|
26994 | if(this.elem.globalData.frameId === this.frameId){
|
26995 | return;
|
26996 | }
|
26997 | this.frameId = this.elem.globalData.frameId;
|
26998 | this.iterateDynamicProperties();
|
26999 | if(this._mdf){
|
27000 | this.convertToPath();
|
27001 | }
|
27002 | },
|
27003 | convertStarToPath: function() {
|
27004 | var numPts = Math.floor(this.pt.v)*2;
|
27005 | var angle = Math.PI*2/numPts;
|
27006 | /*this.v.v.length = numPts;
|
27007 | this.v.i.length = numPts;
|
27008 | this.v.o.length = numPts;*/
|
27009 | var longFlag = true;
|
27010 | var longRad = this.or.v;
|
27011 | var shortRad = this.ir.v;
|
27012 | var longRound = this.os.v;
|
27013 | var shortRound = this.is.v;
|
27014 | var longPerimSegment = 2*Math.PI*longRad/(numPts*2);
|
27015 | var shortPerimSegment = 2*Math.PI*shortRad/(numPts*2);
|
27016 | var i, rad,roundness,perimSegment, currentAng = -Math.PI/ 2;
|
27017 | currentAng += this.r.v;
|
27018 | var dir = this.data.d === 3 ? -1 : 1;
|
27019 | this.v._length = 0;
|
27020 | for(i=0;i<numPts;i+=1){
|
27021 | rad = longFlag ? longRad : shortRad;
|
27022 | roundness = longFlag ? longRound : shortRound;
|
27023 | perimSegment = longFlag ? longPerimSegment : shortPerimSegment;
|
27024 | var x = rad * Math.cos(currentAng);
|
27025 | var y = rad * Math.sin(currentAng);
|
27026 | var ox = x === 0 && y === 0 ? 0 : y/Math.sqrt(x*x + y*y);
|
27027 | var oy = x === 0 && y === 0 ? 0 : -x/Math.sqrt(x*x + y*y);
|
27028 | x += + this.p.v[0];
|
27029 | y += + this.p.v[1];
|
27030 | this.v.setTripleAt(x,y,x-ox*perimSegment*roundness*dir,y-oy*perimSegment*roundness*dir,x+ox*perimSegment*roundness*dir,y+oy*perimSegment*roundness*dir, i, true);
|
27031 |
|
27032 | /*this.v.v[i] = [x,y];
|
27033 | this.v.i[i] = [x+ox*perimSegment*roundness*dir,y+oy*perimSegment*roundness*dir];
|
27034 | this.v.o[i] = [x-ox*perimSegment*roundness*dir,y-oy*perimSegment*roundness*dir];
|
27035 | this.v._length = numPts;*/
|
27036 | longFlag = !longFlag;
|
27037 | currentAng += angle*dir;
|
27038 | }
|
27039 | },
|
27040 | convertPolygonToPath: function() {
|
27041 | var numPts = Math.floor(this.pt.v);
|
27042 | var angle = Math.PI*2/numPts;
|
27043 | var rad = this.or.v;
|
27044 | var roundness = this.os.v;
|
27045 | var perimSegment = 2*Math.PI*rad/(numPts*4);
|
27046 | var i, currentAng = -Math.PI/ 2;
|
27047 | var dir = this.data.d === 3 ? -1 : 1;
|
27048 | currentAng += this.r.v;
|
27049 | this.v._length = 0;
|
27050 | for(i=0;i<numPts;i+=1){
|
27051 | var x = rad * Math.cos(currentAng);
|
27052 | var y = rad * Math.sin(currentAng);
|
27053 | var ox = x === 0 && y === 0 ? 0 : y/Math.sqrt(x*x + y*y);
|
27054 | var oy = x === 0 && y === 0 ? 0 : -x/Math.sqrt(x*x + y*y);
|
27055 | x += + this.p.v[0];
|
27056 | y += + this.p.v[1];
|
27057 | this.v.setTripleAt(x,y,x-ox*perimSegment*roundness*dir,y-oy*perimSegment*roundness*dir,x+ox*perimSegment*roundness*dir,y+oy*perimSegment*roundness*dir, i, true);
|
27058 | currentAng += angle*dir;
|
27059 | }
|
27060 | this.paths.length = 0;
|
27061 | this.paths[0] = this.v;
|
27062 | }
|
27063 |
|
27064 | };
|
27065 | extendPrototype([DynamicPropertyContainer], StarShapeProperty);
|
27066 |
|
27067 | return StarShapeProperty;
|
27068 | }());
|
27069 |
|
27070 | var RectShapeProperty = (function() {
|
27071 |
|
27072 | function RectShapeProperty(elem,data) {
|
27073 | this.v = shape_pool.newElement();
|
27074 | this.v.c = true;
|
27075 | this.localShapeCollection = shapeCollection_pool.newShapeCollection();
|
27076 | this.localShapeCollection.addShape(this.v);
|
27077 | this.paths = this.localShapeCollection;
|
27078 | this.elem = elem;
|
27079 | this.comp = elem.comp;
|
27080 | this.frameId = -1;
|
27081 | this.d = data.d;
|
27082 | this.initDynamicPropertyContainer(elem);
|
27083 | this.p = PropertyFactory.getProp(elem,data.p,1,0,this);
|
27084 | this.s = PropertyFactory.getProp(elem,data.s,1,0,this);
|
27085 | this.r = PropertyFactory.getProp(elem,data.r,0,0,this);
|
27086 | if(this.dynamicProperties.length){
|
27087 | this.k = true;
|
27088 | }else{
|
27089 | this.k = false;
|
27090 | this.convertRectToPath();
|
27091 | }
|
27092 | }
|
27093 | RectShapeProperty.prototype = {
|
27094 | convertRectToPath: function (){
|
27095 | var p0 = this.p.v[0], p1 = this.p.v[1], v0 = this.s.v[0]/2, v1 = this.s.v[1]/2;
|
27096 | var round = bm_min(v0,v1,this.r.v);
|
27097 | var cPoint = round*(1-roundCorner);
|
27098 | this.v._length = 0;
|
27099 |
|
27100 | if(this.d === 2 || this.d === 1) {
|
27101 | this.v.setTripleAt(p0+v0, p1-v1+round,p0+v0, p1-v1+round,p0+v0,p1-v1+cPoint,0, true);
|
27102 | this.v.setTripleAt(p0+v0, p1+v1-round,p0+v0, p1+v1-cPoint,p0+v0, p1+v1-round,1, true);
|
27103 | if(round!== 0){
|
27104 | this.v.setTripleAt(p0+v0-round, p1+v1,p0+v0-round,p1+v1,p0+v0-cPoint,p1+v1,2, true);
|
27105 | this.v.setTripleAt(p0-v0+round,p1+v1,p0-v0+cPoint,p1+v1,p0-v0+round,p1+v1,3, true);
|
27106 | this.v.setTripleAt(p0-v0,p1+v1-round,p0-v0,p1+v1-round,p0-v0,p1+v1-cPoint,4, true);
|
27107 | this.v.setTripleAt(p0-v0,p1-v1+round,p0-v0,p1-v1+cPoint,p0-v0,p1-v1+round,5, true);
|
27108 | this.v.setTripleAt(p0-v0+round,p1-v1,p0-v0+round,p1-v1,p0-v0+cPoint,p1-v1,6, true);
|
27109 | this.v.setTripleAt(p0+v0-round,p1-v1,p0+v0-cPoint,p1-v1,p0+v0-round,p1-v1,7, true);
|
27110 | } else {
|
27111 | this.v.setTripleAt(p0-v0,p1+v1,p0-v0+cPoint,p1+v1,p0-v0,p1+v1,2);
|
27112 | this.v.setTripleAt(p0-v0,p1-v1,p0-v0,p1-v1+cPoint,p0-v0,p1-v1,3);
|
27113 | }
|
27114 | }else{
|
27115 | this.v.setTripleAt(p0+v0,p1-v1+round,p0+v0,p1-v1+cPoint,p0+v0,p1-v1+round,0, true);
|
27116 | if(round!== 0){
|
27117 | this.v.setTripleAt(p0+v0-round,p1-v1,p0+v0-round,p1-v1,p0+v0-cPoint,p1-v1,1, true);
|
27118 | this.v.setTripleAt(p0-v0+round,p1-v1,p0-v0+cPoint,p1-v1,p0-v0+round,p1-v1,2, true);
|
27119 | this.v.setTripleAt(p0-v0,p1-v1+round,p0-v0,p1-v1+round,p0-v0,p1-v1+cPoint,3, true);
|
27120 | this.v.setTripleAt(p0-v0,p1+v1-round,p0-v0,p1+v1-cPoint,p0-v0,p1+v1-round,4, true);
|
27121 | this.v.setTripleAt(p0-v0+round,p1+v1,p0-v0+round,p1+v1,p0-v0+cPoint,p1+v1,5, true);
|
27122 | this.v.setTripleAt(p0+v0-round,p1+v1,p0+v0-cPoint,p1+v1,p0+v0-round,p1+v1,6, true);
|
27123 | this.v.setTripleAt(p0+v0,p1+v1-round,p0+v0,p1+v1-round,p0+v0,p1+v1-cPoint,7, true);
|
27124 | } else {
|
27125 | this.v.setTripleAt(p0-v0,p1-v1,p0-v0+cPoint,p1-v1,p0-v0,p1-v1,1, true);
|
27126 | this.v.setTripleAt(p0-v0,p1+v1,p0-v0,p1+v1-cPoint,p0-v0,p1+v1,2, true);
|
27127 | this.v.setTripleAt(p0+v0,p1+v1,p0+v0-cPoint,p1+v1,p0+v0,p1+v1,3, true);
|
27128 |
|
27129 | }
|
27130 | }
|
27131 | },
|
27132 | getValue: function(frameNum){
|
27133 | if(this.elem.globalData.frameId === this.frameId){
|
27134 | return;
|
27135 | }
|
27136 | this.frameId = this.elem.globalData.frameId;
|
27137 | this.iterateDynamicProperties();
|
27138 | if(this._mdf){
|
27139 | this.convertRectToPath();
|
27140 | }
|
27141 |
|
27142 | },
|
27143 | reset: resetShape
|
27144 | };
|
27145 | extendPrototype([DynamicPropertyContainer], RectShapeProperty);
|
27146 |
|
27147 | return RectShapeProperty;
|
27148 | }());
|
27149 |
|
27150 | function getShapeProp(elem,data,type){
|
27151 | var prop;
|
27152 | if(type === 3 || type === 4){
|
27153 | var dataProp = type === 3 ? data.pt : data.ks;
|
27154 | var keys = dataProp.k;
|
27155 | if(keys.length){
|
27156 | prop = new KeyframedShapeProperty(elem, data, type);
|
27157 | }else{
|
27158 | prop = new ShapeProperty(elem, data, type);
|
27159 | }
|
27160 | }else if(type === 5){
|
27161 | prop = new RectShapeProperty(elem, data);
|
27162 | }else if(type === 6){
|
27163 | prop = new EllShapeProperty(elem, data);
|
27164 | }else if(type === 7){
|
27165 | prop = new StarShapeProperty(elem, data);
|
27166 | }
|
27167 | if(prop.k){
|
27168 | elem.addDynamicProperty(prop);
|
27169 | }
|
27170 | return prop;
|
27171 | }
|
27172 |
|
27173 | function getConstructorFunction() {
|
27174 | return ShapeProperty;
|
27175 | }
|
27176 |
|
27177 | function getKeyframedConstructorFunction() {
|
27178 | return KeyframedShapeProperty;
|
27179 | }
|
27180 |
|
27181 | var ob = {};
|
27182 | ob.getShapeProp = getShapeProp;
|
27183 | ob.getConstructorFunction = getConstructorFunction;
|
27184 | ob.getKeyframedConstructorFunction = getKeyframedConstructorFunction;
|
27185 | return ob;
|
27186 | }());
|
27187 | var ShapeModifiers = (function(){
|
27188 | var ob = {};
|
27189 | var modifiers = {};
|
27190 | ob.registerModifier = registerModifier;
|
27191 | ob.getModifier = getModifier;
|
27192 |
|
27193 | function registerModifier(nm,factory){
|
27194 | if(!modifiers[nm]){
|
27195 | modifiers[nm] = factory;
|
27196 | }
|
27197 | }
|
27198 |
|
27199 | function getModifier(nm,elem, data){
|
27200 | return new modifiers[nm](elem, data);
|
27201 | }
|
27202 |
|
27203 | return ob;
|
27204 | }());
|
27205 |
|
27206 | function ShapeModifier(){}
|
27207 | ShapeModifier.prototype.initModifierProperties = function(){};
|
27208 | ShapeModifier.prototype.addShapeToModifier = function(){};
|
27209 | ShapeModifier.prototype.addShape = function(data){
|
27210 | if(!this.closed){
|
27211 | var shapeData = {shape:data.sh, data: data, localShapeCollection:shapeCollection_pool.newShapeCollection()};
|
27212 | this.shapes.push(shapeData);
|
27213 | this.addShapeToModifier(shapeData);
|
27214 | if(this._isAnimated) {
|
27215 | data.setAsAnimated();
|
27216 | }
|
27217 | }
|
27218 | };
|
27219 | ShapeModifier.prototype.init = function(elem,data){
|
27220 | this.shapes = [];
|
27221 | this.elem = elem;
|
27222 | this.initDynamicPropertyContainer(elem);
|
27223 | this.initModifierProperties(elem,data);
|
27224 | this.frameId = initialDefaultFrame;
|
27225 | this.closed = false;
|
27226 | this.k = false;
|
27227 | if(this.dynamicProperties.length){
|
27228 | this.k = true;
|
27229 | }else{
|
27230 | this.getValue(true);
|
27231 | }
|
27232 | };
|
27233 | ShapeModifier.prototype.processKeys = function(){
|
27234 | if(this.elem.globalData.frameId === this.frameId){
|
27235 | return;
|
27236 | }
|
27237 | this.frameId = this.elem.globalData.frameId;
|
27238 | this.iterateDynamicProperties();
|
27239 | };
|
27240 |
|
27241 | extendPrototype([DynamicPropertyContainer], ShapeModifier);
|
27242 | function TrimModifier(){
|
27243 | }
|
27244 | extendPrototype([ShapeModifier], TrimModifier);
|
27245 | TrimModifier.prototype.initModifierProperties = function(elem, data) {
|
27246 | this.s = PropertyFactory.getProp(elem, data.s, 0, 0.01, this);
|
27247 | this.e = PropertyFactory.getProp(elem, data.e, 0, 0.01, this);
|
27248 | this.o = PropertyFactory.getProp(elem, data.o, 0, 0, this);
|
27249 | this.sValue = 0;
|
27250 | this.eValue = 0;
|
27251 | this.getValue = this.processKeys;
|
27252 | this.m = data.m;
|
27253 | this._isAnimated = !!this.s.effectsSequence.length || !!this.e.effectsSequence.length || !!this.o.effectsSequence.length;
|
27254 | };
|
27255 |
|
27256 | TrimModifier.prototype.addShapeToModifier = function(shapeData){
|
27257 | shapeData.pathsData = [];
|
27258 | };
|
27259 |
|
27260 | TrimModifier.prototype.calculateShapeEdges = function(s, e, shapeLength, addedLength, totalModifierLength) {
|
27261 | var segments = [];
|
27262 | if (e <= 1) {
|
27263 | segments.push({
|
27264 | s: s,
|
27265 | e: e
|
27266 | });
|
27267 | } else if (s >= 1) {
|
27268 | segments.push({
|
27269 | s: s - 1,
|
27270 | e: e - 1
|
27271 | });
|
27272 | } else {
|
27273 | segments.push({
|
27274 | s: s,
|
27275 | e: 1
|
27276 | });
|
27277 | segments.push({
|
27278 | s: 0,
|
27279 | e: e - 1
|
27280 | });
|
27281 | }
|
27282 | var shapeSegments = [];
|
27283 | var i, len = segments.length, segmentOb;
|
27284 | for (i = 0; i < len; i += 1) {
|
27285 | segmentOb = segments[i];
|
27286 | if (segmentOb.e * totalModifierLength < addedLength || segmentOb.s * totalModifierLength > addedLength + shapeLength) ; else {
|
27287 | var shapeS, shapeE;
|
27288 | if (segmentOb.s * totalModifierLength <= addedLength) {
|
27289 | shapeS = 0;
|
27290 | } else {
|
27291 | shapeS = (segmentOb.s * totalModifierLength - addedLength) / shapeLength;
|
27292 | }
|
27293 | if(segmentOb.e * totalModifierLength >= addedLength + shapeLength) {
|
27294 | shapeE = 1;
|
27295 | } else {
|
27296 | shapeE = ((segmentOb.e * totalModifierLength - addedLength) / shapeLength);
|
27297 | }
|
27298 | shapeSegments.push([shapeS, shapeE]);
|
27299 | }
|
27300 | }
|
27301 | if (!shapeSegments.length) {
|
27302 | shapeSegments.push([0, 0]);
|
27303 | }
|
27304 | return shapeSegments;
|
27305 | };
|
27306 |
|
27307 | TrimModifier.prototype.releasePathsData = function(pathsData) {
|
27308 | var i, len = pathsData.length;
|
27309 | for (i = 0; i < len; i += 1) {
|
27310 | segments_length_pool.release(pathsData[i]);
|
27311 | }
|
27312 | pathsData.length = 0;
|
27313 | return pathsData;
|
27314 | };
|
27315 |
|
27316 | TrimModifier.prototype.processShapes = function(_isFirstFrame) {
|
27317 | var s, e;
|
27318 | if (this._mdf || _isFirstFrame) {
|
27319 | var o = (this.o.v % 360) / 360;
|
27320 | if (o < 0) {
|
27321 | o += 1;
|
27322 | }
|
27323 | s = (this.s.v > 1 ? 1 : this.s.v < 0 ? 0 : this.s.v) + o;
|
27324 | e = (this.e.v > 1 ? 1 : this.e.v < 0 ? 0 : this.e.v) + o;
|
27325 | if (s > e) {
|
27326 | var _s = s;
|
27327 | s = e;
|
27328 | e = _s;
|
27329 | }
|
27330 | s = Math.round(s * 10000) * 0.0001;
|
27331 | e = Math.round(e * 10000) * 0.0001;
|
27332 | this.sValue = s;
|
27333 | this.eValue = e;
|
27334 | } else {
|
27335 | s = this.sValue;
|
27336 | e = this.eValue;
|
27337 | }
|
27338 | var shapePaths;
|
27339 | var i, len = this.shapes.length, j, jLen;
|
27340 | var pathsData, pathData, totalShapeLength, totalModifierLength = 0;
|
27341 |
|
27342 | if (e === s) {
|
27343 | for (i = 0; i < len; i += 1) {
|
27344 | this.shapes[i].localShapeCollection.releaseShapes();
|
27345 | this.shapes[i].shape._mdf = true;
|
27346 | this.shapes[i].shape.paths = this.shapes[i].localShapeCollection;
|
27347 | }
|
27348 | } else if (!((e === 1 && s === 0) || (e===0 && s === 1))){
|
27349 | var segments = [], shapeData, localShapeCollection;
|
27350 | for (i = 0; i < len; i += 1) {
|
27351 | shapeData = this.shapes[i];
|
27352 | // if shape hasn't changed and trim properties haven't changed, cached previous path can be used
|
27353 | if (!shapeData.shape._mdf && !this._mdf && !_isFirstFrame && this.m !== 2) {
|
27354 | shapeData.shape.paths = shapeData.localShapeCollection;
|
27355 | } else {
|
27356 | shapePaths = shapeData.shape.paths;
|
27357 | jLen = shapePaths._length;
|
27358 | totalShapeLength = 0;
|
27359 | if (!shapeData.shape._mdf && shapeData.pathsData.length) {
|
27360 | totalShapeLength = shapeData.totalShapeLength;
|
27361 | } else {
|
27362 | pathsData = this.releasePathsData(shapeData.pathsData);
|
27363 | for (j = 0; j < jLen; j += 1) {
|
27364 | pathData = bez.getSegmentsLength(shapePaths.shapes[j]);
|
27365 | pathsData.push(pathData);
|
27366 | totalShapeLength += pathData.totalLength;
|
27367 | }
|
27368 | shapeData.totalShapeLength = totalShapeLength;
|
27369 | shapeData.pathsData = pathsData;
|
27370 | }
|
27371 |
|
27372 | totalModifierLength += totalShapeLength;
|
27373 | shapeData.shape._mdf = true;
|
27374 | }
|
27375 | }
|
27376 | var shapeS = s, shapeE = e, addedLength = 0, edges;
|
27377 | for (i = len - 1; i >= 0; i -= 1) {
|
27378 | shapeData = this.shapes[i];
|
27379 | if (shapeData.shape._mdf) {
|
27380 | localShapeCollection = shapeData.localShapeCollection;
|
27381 | localShapeCollection.releaseShapes();
|
27382 | //if m === 2 means paths are trimmed individually so edges need to be found for this specific shape relative to whoel group
|
27383 | if (this.m === 2 && len > 1) {
|
27384 | edges = this.calculateShapeEdges(s, e, shapeData.totalShapeLength, addedLength, totalModifierLength);
|
27385 | addedLength += shapeData.totalShapeLength;
|
27386 | } else {
|
27387 | edges = [[shapeS, shapeE]];
|
27388 | }
|
27389 | jLen = edges.length;
|
27390 | for (j = 0; j < jLen; j += 1) {
|
27391 | shapeS = edges[j][0];
|
27392 | shapeE = edges[j][1];
|
27393 | segments.length = 0;
|
27394 | if (shapeE <= 1) {
|
27395 | segments.push({
|
27396 | s:shapeData.totalShapeLength * shapeS,
|
27397 | e:shapeData.totalShapeLength * shapeE
|
27398 | });
|
27399 | } else if (shapeS >= 1) {
|
27400 | segments.push({
|
27401 | s:shapeData.totalShapeLength * (shapeS - 1),
|
27402 | e:shapeData.totalShapeLength * (shapeE - 1)
|
27403 | });
|
27404 | } else {
|
27405 | segments.push({
|
27406 | s:shapeData.totalShapeLength * shapeS,
|
27407 | e:shapeData.totalShapeLength
|
27408 | });
|
27409 | segments.push({
|
27410 | s:0,
|
27411 | e:shapeData.totalShapeLength * (shapeE - 1)
|
27412 | });
|
27413 | }
|
27414 | var newShapesData = this.addShapes(shapeData,segments[0]);
|
27415 | if (segments[0].s !== segments[0].e) {
|
27416 | if (segments.length > 1) {
|
27417 | var lastShapeInCollection = shapeData.shape.paths.shapes[shapeData.shape.paths._length - 1];
|
27418 | if (lastShapeInCollection.c) {
|
27419 | var lastShape = newShapesData.pop();
|
27420 | this.addPaths(newShapesData, localShapeCollection);
|
27421 | newShapesData = this.addShapes(shapeData, segments[1], lastShape);
|
27422 | } else {
|
27423 | this.addPaths(newShapesData, localShapeCollection);
|
27424 | newShapesData = this.addShapes(shapeData, segments[1]);
|
27425 | }
|
27426 | }
|
27427 | this.addPaths(newShapesData, localShapeCollection);
|
27428 | }
|
27429 |
|
27430 | }
|
27431 | shapeData.shape.paths = localShapeCollection;
|
27432 | }
|
27433 | }
|
27434 | } else if (this._mdf) {
|
27435 | for (i = 0; i < len; i += 1) {
|
27436 | //Releasign Trim Cached paths data when no trim applied in case shapes are modified inbetween.
|
27437 | //Don't remove this even if it's losing cached info.
|
27438 | this.shapes[i].pathsData.length = 0;
|
27439 | this.shapes[i].shape._mdf = true;
|
27440 | }
|
27441 | }
|
27442 | };
|
27443 |
|
27444 | TrimModifier.prototype.addPaths = function(newPaths, localShapeCollection) {
|
27445 | var i, len = newPaths.length;
|
27446 | for (i = 0; i < len; i += 1) {
|
27447 | localShapeCollection.addShape(newPaths[i]);
|
27448 | }
|
27449 | };
|
27450 |
|
27451 | TrimModifier.prototype.addSegment = function(pt1, pt2, pt3, pt4, shapePath, pos, newShape) {
|
27452 | shapePath.setXYAt(pt2[0], pt2[1], 'o', pos);
|
27453 | shapePath.setXYAt(pt3[0], pt3[1], 'i', pos + 1);
|
27454 | if(newShape){
|
27455 | shapePath.setXYAt(pt1[0], pt1[1], 'v', pos);
|
27456 | }
|
27457 | shapePath.setXYAt(pt4[0], pt4[1], 'v', pos + 1);
|
27458 | };
|
27459 |
|
27460 | TrimModifier.prototype.addSegmentFromArray = function(points, shapePath, pos, newShape) {
|
27461 | shapePath.setXYAt(points[1], points[5], 'o', pos);
|
27462 | shapePath.setXYAt(points[2], points[6], 'i', pos + 1);
|
27463 | if(newShape){
|
27464 | shapePath.setXYAt(points[0], points[4], 'v', pos);
|
27465 | }
|
27466 | shapePath.setXYAt(points[3], points[7], 'v', pos + 1);
|
27467 | };
|
27468 |
|
27469 | TrimModifier.prototype.addShapes = function(shapeData, shapeSegment, shapePath) {
|
27470 | var pathsData = shapeData.pathsData;
|
27471 | var shapePaths = shapeData.shape.paths.shapes;
|
27472 | var i, len = shapeData.shape.paths._length, j, jLen;
|
27473 | var addedLength = 0;
|
27474 | var currentLengthData,segmentCount;
|
27475 | var lengths;
|
27476 | var segment;
|
27477 | var shapes = [];
|
27478 | var initPos;
|
27479 | var newShape = true;
|
27480 | if (!shapePath) {
|
27481 | shapePath = shape_pool.newElement();
|
27482 | segmentCount = 0;
|
27483 | initPos = 0;
|
27484 | } else {
|
27485 | segmentCount = shapePath._length;
|
27486 | initPos = shapePath._length;
|
27487 | }
|
27488 | shapes.push(shapePath);
|
27489 | for (i = 0; i < len; i += 1) {
|
27490 | lengths = pathsData[i].lengths;
|
27491 | shapePath.c = shapePaths[i].c;
|
27492 | jLen = shapePaths[i].c ? lengths.length : lengths.length + 1;
|
27493 | for (j = 1; j < jLen; j +=1) {
|
27494 | currentLengthData = lengths[j-1];
|
27495 | if (addedLength + currentLengthData.addedLength < shapeSegment.s) {
|
27496 | addedLength += currentLengthData.addedLength;
|
27497 | shapePath.c = false;
|
27498 | } else if(addedLength > shapeSegment.e) {
|
27499 | shapePath.c = false;
|
27500 | break;
|
27501 | } else {
|
27502 | if (shapeSegment.s <= addedLength && shapeSegment.e >= addedLength + currentLengthData.addedLength) {
|
27503 | this.addSegment(shapePaths[i].v[j - 1], shapePaths[i].o[j - 1], shapePaths[i].i[j], shapePaths[i].v[j], shapePath, segmentCount, newShape);
|
27504 | newShape = false;
|
27505 | } else {
|
27506 | segment = bez.getNewSegment(shapePaths[i].v[j - 1], shapePaths[i].v[j], shapePaths[i].o[j - 1], shapePaths[i].i[j], (shapeSegment.s - addedLength)/currentLengthData.addedLength,(shapeSegment.e - addedLength)/currentLengthData.addedLength, lengths[j-1]);
|
27507 | this.addSegmentFromArray(segment, shapePath, segmentCount, newShape);
|
27508 | // this.addSegment(segment.pt1, segment.pt3, segment.pt4, segment.pt2, shapePath, segmentCount, newShape);
|
27509 | newShape = false;
|
27510 | shapePath.c = false;
|
27511 | }
|
27512 | addedLength += currentLengthData.addedLength;
|
27513 | segmentCount += 1;
|
27514 | }
|
27515 | }
|
27516 | if (shapePaths[i].c && lengths.length) {
|
27517 | currentLengthData = lengths[j - 1];
|
27518 | if (addedLength <= shapeSegment.e) {
|
27519 | var segmentLength = lengths[j - 1].addedLength;
|
27520 | if (shapeSegment.s <= addedLength && shapeSegment.e >= addedLength + segmentLength) {
|
27521 | this.addSegment(shapePaths[i].v[j - 1], shapePaths[i].o[j - 1], shapePaths[i].i[0], shapePaths[i].v[0], shapePath, segmentCount, newShape);
|
27522 | newShape = false;
|
27523 | } else {
|
27524 | segment = bez.getNewSegment(shapePaths[i].v[j - 1], shapePaths[i].v[0], shapePaths[i].o[j - 1], shapePaths[i].i[0], (shapeSegment.s - addedLength) / segmentLength, (shapeSegment.e - addedLength) / segmentLength, lengths[j - 1]);
|
27525 | this.addSegmentFromArray(segment, shapePath, segmentCount, newShape);
|
27526 | // this.addSegment(segment.pt1, segment.pt3, segment.pt4, segment.pt2, shapePath, segmentCount, newShape);
|
27527 | newShape = false;
|
27528 | shapePath.c = false;
|
27529 | }
|
27530 | } else {
|
27531 | shapePath.c = false;
|
27532 | }
|
27533 | addedLength += currentLengthData.addedLength;
|
27534 | segmentCount += 1;
|
27535 | }
|
27536 | if (shapePath._length) {
|
27537 | shapePath.setXYAt(shapePath.v[initPos][0], shapePath.v[initPos][1], 'i', initPos);
|
27538 | shapePath.setXYAt(shapePath.v[shapePath._length - 1][0], shapePath.v[shapePath._length - 1][1],'o', shapePath._length - 1);
|
27539 | }
|
27540 | if (addedLength > shapeSegment.e) {
|
27541 | break;
|
27542 | }
|
27543 | if (i < len - 1) {
|
27544 | shapePath = shape_pool.newElement();
|
27545 | newShape = true;
|
27546 | shapes.push(shapePath);
|
27547 | segmentCount = 0;
|
27548 | }
|
27549 | }
|
27550 | return shapes;
|
27551 | };
|
27552 |
|
27553 |
|
27554 | ShapeModifiers.registerModifier('tm', TrimModifier);
|
27555 | function RoundCornersModifier(){}
|
27556 | extendPrototype([ShapeModifier],RoundCornersModifier);
|
27557 | RoundCornersModifier.prototype.initModifierProperties = function(elem,data){
|
27558 | this.getValue = this.processKeys;
|
27559 | this.rd = PropertyFactory.getProp(elem,data.r,0,null,this);
|
27560 | this._isAnimated = !!this.rd.effectsSequence.length;
|
27561 | };
|
27562 |
|
27563 | RoundCornersModifier.prototype.processPath = function(path, round){
|
27564 | var cloned_path = shape_pool.newElement();
|
27565 | cloned_path.c = path.c;
|
27566 | var i, len = path._length;
|
27567 | var currentV,currentI,currentO,closerV, distance,newPosPerc,index = 0;
|
27568 | var vX,vY,oX,oY,iX,iY;
|
27569 | for(i=0;i<len;i+=1){
|
27570 | currentV = path.v[i];
|
27571 | currentO = path.o[i];
|
27572 | currentI = path.i[i];
|
27573 | if(currentV[0]===currentO[0] && currentV[1]===currentO[1] && currentV[0]===currentI[0] && currentV[1]===currentI[1]){
|
27574 | if((i===0 || i === len - 1) && !path.c){
|
27575 | cloned_path.setTripleAt(currentV[0],currentV[1],currentO[0],currentO[1],currentI[0],currentI[1],index);
|
27576 | /*cloned_path.v[index] = currentV;
|
27577 | cloned_path.o[index] = currentO;
|
27578 | cloned_path.i[index] = currentI;*/
|
27579 | index += 1;
|
27580 | } else {
|
27581 | if(i===0){
|
27582 | closerV = path.v[len-1];
|
27583 | } else {
|
27584 | closerV = path.v[i-1];
|
27585 | }
|
27586 | distance = Math.sqrt(Math.pow(currentV[0]-closerV[0],2)+Math.pow(currentV[1]-closerV[1],2));
|
27587 | newPosPerc = distance ? Math.min(distance/2,round)/distance : 0;
|
27588 | vX = iX = currentV[0]+(closerV[0]-currentV[0])*newPosPerc;
|
27589 | vY = iY = currentV[1]-(currentV[1]-closerV[1])*newPosPerc;
|
27590 | oX = vX-(vX-currentV[0])*roundCorner;
|
27591 | oY = vY-(vY-currentV[1])*roundCorner;
|
27592 | cloned_path.setTripleAt(vX,vY,oX,oY,iX,iY,index);
|
27593 | index += 1;
|
27594 |
|
27595 | if(i === len - 1){
|
27596 | closerV = path.v[0];
|
27597 | } else {
|
27598 | closerV = path.v[i+1];
|
27599 | }
|
27600 | distance = Math.sqrt(Math.pow(currentV[0]-closerV[0],2)+Math.pow(currentV[1]-closerV[1],2));
|
27601 | newPosPerc = distance ? Math.min(distance/2,round)/distance : 0;
|
27602 | vX = oX = currentV[0]+(closerV[0]-currentV[0])*newPosPerc;
|
27603 | vY = oY = currentV[1]+(closerV[1]-currentV[1])*newPosPerc;
|
27604 | iX = vX-(vX-currentV[0])*roundCorner;
|
27605 | iY = vY-(vY-currentV[1])*roundCorner;
|
27606 | cloned_path.setTripleAt(vX,vY,oX,oY,iX,iY,index);
|
27607 | index += 1;
|
27608 | }
|
27609 | } else {
|
27610 | cloned_path.setTripleAt(path.v[i][0],path.v[i][1],path.o[i][0],path.o[i][1],path.i[i][0],path.i[i][1],index);
|
27611 | index += 1;
|
27612 | }
|
27613 | }
|
27614 | return cloned_path;
|
27615 | };
|
27616 |
|
27617 | RoundCornersModifier.prototype.processShapes = function(_isFirstFrame){
|
27618 | var shapePaths;
|
27619 | var i, len = this.shapes.length;
|
27620 | var j, jLen;
|
27621 | var rd = this.rd.v;
|
27622 |
|
27623 | if(rd !== 0){
|
27624 | var shapeData, newPaths, localShapeCollection;
|
27625 | for(i=0;i<len;i+=1){
|
27626 | shapeData = this.shapes[i];
|
27627 | newPaths = shapeData.shape.paths;
|
27628 | localShapeCollection = shapeData.localShapeCollection;
|
27629 | if(!(!shapeData.shape._mdf && !this._mdf && !_isFirstFrame)){
|
27630 | localShapeCollection.releaseShapes();
|
27631 | shapeData.shape._mdf = true;
|
27632 | shapePaths = shapeData.shape.paths.shapes;
|
27633 | jLen = shapeData.shape.paths._length;
|
27634 | for(j=0;j<jLen;j+=1){
|
27635 | localShapeCollection.addShape(this.processPath(shapePaths[j],rd));
|
27636 | }
|
27637 | }
|
27638 | shapeData.shape.paths = shapeData.localShapeCollection;
|
27639 | }
|
27640 |
|
27641 | }
|
27642 | if(!this.dynamicProperties.length){
|
27643 | this._mdf = false;
|
27644 | }
|
27645 | };
|
27646 |
|
27647 | ShapeModifiers.registerModifier('rd',RoundCornersModifier);
|
27648 | function RepeaterModifier(){}
|
27649 | extendPrototype([ShapeModifier], RepeaterModifier);
|
27650 |
|
27651 | RepeaterModifier.prototype.initModifierProperties = function(elem,data){
|
27652 | this.getValue = this.processKeys;
|
27653 | this.c = PropertyFactory.getProp(elem,data.c,0,null,this);
|
27654 | this.o = PropertyFactory.getProp(elem,data.o,0,null,this);
|
27655 | this.tr = TransformPropertyFactory.getTransformProperty(elem,data.tr,this);
|
27656 | this.so = PropertyFactory.getProp(elem,data.tr.so,0,0.01,this);
|
27657 | this.eo = PropertyFactory.getProp(elem,data.tr.eo,0,0.01,this);
|
27658 | this.data = data;
|
27659 | if(!this.dynamicProperties.length){
|
27660 | this.getValue(true);
|
27661 | }
|
27662 | this._isAnimated = !!this.dynamicProperties.length;
|
27663 | this.pMatrix = new Matrix();
|
27664 | this.rMatrix = new Matrix();
|
27665 | this.sMatrix = new Matrix();
|
27666 | this.tMatrix = new Matrix();
|
27667 | this.matrix = new Matrix();
|
27668 | };
|
27669 |
|
27670 | RepeaterModifier.prototype.applyTransforms = function(pMatrix, rMatrix, sMatrix, transform, perc, inv){
|
27671 | var dir = inv ? -1 : 1;
|
27672 | var scaleX = transform.s.v[0] + (1 - transform.s.v[0]) * (1 - perc);
|
27673 | var scaleY = transform.s.v[1] + (1 - transform.s.v[1]) * (1 - perc);
|
27674 | pMatrix.translate(transform.p.v[0] * dir * perc, transform.p.v[1] * dir * perc, transform.p.v[2]);
|
27675 | rMatrix.translate(-transform.a.v[0], -transform.a.v[1], transform.a.v[2]);
|
27676 | rMatrix.rotate(-transform.r.v * dir * perc);
|
27677 | rMatrix.translate(transform.a.v[0], transform.a.v[1], transform.a.v[2]);
|
27678 | sMatrix.translate(-transform.a.v[0], -transform.a.v[1], transform.a.v[2]);
|
27679 | sMatrix.scale(inv ? 1/scaleX : scaleX, inv ? 1/scaleY : scaleY);
|
27680 | sMatrix.translate(transform.a.v[0], transform.a.v[1], transform.a.v[2]);
|
27681 | };
|
27682 |
|
27683 | RepeaterModifier.prototype.init = function(elem, arr, pos, elemsData) {
|
27684 | this.elem = elem;
|
27685 | this.arr = arr;
|
27686 | this.pos = pos;
|
27687 | this.elemsData = elemsData;
|
27688 | this._currentCopies = 0;
|
27689 | this._elements = [];
|
27690 | this._groups = [];
|
27691 | this.frameId = -1;
|
27692 | this.initDynamicPropertyContainer(elem);
|
27693 | this.initModifierProperties(elem,arr[pos]);
|
27694 | while(pos>0){
|
27695 | pos -= 1;
|
27696 | //this._elements.unshift(arr.splice(pos,1)[0]);
|
27697 | this._elements.unshift(arr[pos]);
|
27698 | }
|
27699 | if(this.dynamicProperties.length){
|
27700 | this.k = true;
|
27701 | }else{
|
27702 | this.getValue(true);
|
27703 | }
|
27704 | };
|
27705 |
|
27706 | RepeaterModifier.prototype.resetElements = function(elements){
|
27707 | var i, len = elements.length;
|
27708 | for(i = 0; i < len; i += 1) {
|
27709 | elements[i]._processed = false;
|
27710 | if(elements[i].ty === 'gr'){
|
27711 | this.resetElements(elements[i].it);
|
27712 | }
|
27713 | }
|
27714 | };
|
27715 |
|
27716 | RepeaterModifier.prototype.cloneElements = function(elements){
|
27717 | var len = elements.length;
|
27718 | var newElements = JSON.parse(JSON.stringify(elements));
|
27719 | this.resetElements(newElements);
|
27720 | return newElements;
|
27721 | };
|
27722 |
|
27723 | RepeaterModifier.prototype.changeGroupRender = function(elements, renderFlag) {
|
27724 | var i, len = elements.length;
|
27725 | for(i = 0; i < len; i += 1) {
|
27726 | elements[i]._render = renderFlag;
|
27727 | if(elements[i].ty === 'gr') {
|
27728 | this.changeGroupRender(elements[i].it, renderFlag);
|
27729 | }
|
27730 | }
|
27731 | };
|
27732 |
|
27733 | RepeaterModifier.prototype.processShapes = function(_isFirstFrame) {
|
27734 | var items, itemsTransform, i, dir, cont;
|
27735 | if(this._mdf || _isFirstFrame){
|
27736 | var copies = Math.ceil(this.c.v);
|
27737 | if(this._groups.length < copies){
|
27738 | while(this._groups.length < copies){
|
27739 | var group = {
|
27740 | it:this.cloneElements(this._elements),
|
27741 | ty:'gr'
|
27742 | };
|
27743 | group.it.push({"a":{"a":0,"ix":1,"k":[0,0]},"nm":"Transform","o":{"a":0,"ix":7,"k":100},"p":{"a":0,"ix":2,"k":[0,0]},"r":{"a":1,"ix":6,"k":[{s:0,e:0,t:0},{s:0,e:0,t:1}]},"s":{"a":0,"ix":3,"k":[100,100]},"sa":{"a":0,"ix":5,"k":0},"sk":{"a":0,"ix":4,"k":0},"ty":"tr"});
|
27744 |
|
27745 | this.arr.splice(0,0,group);
|
27746 | this._groups.splice(0,0,group);
|
27747 | this._currentCopies += 1;
|
27748 | }
|
27749 | this.elem.reloadShapes();
|
27750 | }
|
27751 | cont = 0;
|
27752 | var renderFlag;
|
27753 | for(i = 0; i <= this._groups.length - 1; i += 1){
|
27754 | renderFlag = cont < copies;
|
27755 | this._groups[i]._render = renderFlag;
|
27756 | this.changeGroupRender(this._groups[i].it, renderFlag);
|
27757 | cont += 1;
|
27758 | }
|
27759 |
|
27760 | this._currentCopies = copies;
|
27761 | ////
|
27762 |
|
27763 | var offset = this.o.v;
|
27764 | var offsetModulo = offset%1;
|
27765 | var roundOffset = offset > 0 ? Math.floor(offset) : Math.ceil(offset);
|
27766 | var tMat = this.tr.v.props;
|
27767 | var pProps = this.pMatrix.props;
|
27768 | var rProps = this.rMatrix.props;
|
27769 | var sProps = this.sMatrix.props;
|
27770 | this.pMatrix.reset();
|
27771 | this.rMatrix.reset();
|
27772 | this.sMatrix.reset();
|
27773 | this.tMatrix.reset();
|
27774 | this.matrix.reset();
|
27775 | var iteration = 0;
|
27776 |
|
27777 | if(offset > 0) {
|
27778 | while(iteration<roundOffset){
|
27779 | this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, 1, false);
|
27780 | iteration += 1;
|
27781 | }
|
27782 | if(offsetModulo){
|
27783 | this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, offsetModulo, false);
|
27784 | iteration += offsetModulo;
|
27785 | }
|
27786 | } else if(offset < 0) {
|
27787 | while(iteration>roundOffset){
|
27788 | this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, 1, true);
|
27789 | iteration -= 1;
|
27790 | }
|
27791 | if(offsetModulo){
|
27792 | this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, - offsetModulo, true);
|
27793 | iteration -= offsetModulo;
|
27794 | }
|
27795 | }
|
27796 | i = this.data.m === 1 ? 0 : this._currentCopies - 1;
|
27797 | dir = this.data.m === 1 ? 1 : -1;
|
27798 | cont = this._currentCopies;
|
27799 | var j, jLen;
|
27800 | while(cont){
|
27801 | items = this.elemsData[i].it;
|
27802 | itemsTransform = items[items.length - 1].transform.mProps.v.props;
|
27803 | jLen = itemsTransform.length;
|
27804 | items[items.length - 1].transform.mProps._mdf = true;
|
27805 | items[items.length - 1].transform.op._mdf = true;
|
27806 | items[items.length - 1].transform.op.v = this.so.v + (this.eo.v - this.so.v) * (i / (this._currentCopies - 1));
|
27807 | if(iteration !== 0){
|
27808 | if((i !== 0 && dir === 1) || (i !== this._currentCopies - 1 && dir === -1)){
|
27809 | this.applyTransforms(this.pMatrix, this.rMatrix, this.sMatrix, this.tr, 1, false);
|
27810 | }
|
27811 | this.matrix.transform(rProps[0],rProps[1],rProps[2],rProps[3],rProps[4],rProps[5],rProps[6],rProps[7],rProps[8],rProps[9],rProps[10],rProps[11],rProps[12],rProps[13],rProps[14],rProps[15]);
|
27812 | this.matrix.transform(sProps[0],sProps[1],sProps[2],sProps[3],sProps[4],sProps[5],sProps[6],sProps[7],sProps[8],sProps[9],sProps[10],sProps[11],sProps[12],sProps[13],sProps[14],sProps[15]);
|
27813 | this.matrix.transform(pProps[0],pProps[1],pProps[2],pProps[3],pProps[4],pProps[5],pProps[6],pProps[7],pProps[8],pProps[9],pProps[10],pProps[11],pProps[12],pProps[13],pProps[14],pProps[15]);
|
27814 |
|
27815 | for(j=0;j<jLen;j+=1) {
|
27816 | itemsTransform[j] = this.matrix.props[j];
|
27817 | }
|
27818 | this.matrix.reset();
|
27819 | } else {
|
27820 | this.matrix.reset();
|
27821 | for(j=0;j<jLen;j+=1) {
|
27822 | itemsTransform[j] = this.matrix.props[j];
|
27823 | }
|
27824 | }
|
27825 | iteration += 1;
|
27826 | cont -= 1;
|
27827 | i += dir;
|
27828 | }
|
27829 | } else {
|
27830 | cont = this._currentCopies;
|
27831 | i = 0;
|
27832 | dir = 1;
|
27833 | while(cont){
|
27834 | items = this.elemsData[i].it;
|
27835 | itemsTransform = items[items.length - 1].transform.mProps.v.props;
|
27836 | items[items.length - 1].transform.mProps._mdf = false;
|
27837 | items[items.length - 1].transform.op._mdf = false;
|
27838 | cont -= 1;
|
27839 | i += dir;
|
27840 | }
|
27841 | }
|
27842 | };
|
27843 |
|
27844 | RepeaterModifier.prototype.addShape = function(){};
|
27845 |
|
27846 | ShapeModifiers.registerModifier('rp',RepeaterModifier);
|
27847 | function ShapeCollection(){
|
27848 | this._length = 0;
|
27849 | this._maxLength = 4;
|
27850 | this.shapes = createSizedArray(this._maxLength);
|
27851 | }
|
27852 |
|
27853 | ShapeCollection.prototype.addShape = function(shapeData){
|
27854 | if(this._length === this._maxLength){
|
27855 | this.shapes = this.shapes.concat(createSizedArray(this._maxLength));
|
27856 | this._maxLength *= 2;
|
27857 | }
|
27858 | this.shapes[this._length] = shapeData;
|
27859 | this._length += 1;
|
27860 | };
|
27861 |
|
27862 | ShapeCollection.prototype.releaseShapes = function(){
|
27863 | var i;
|
27864 | for(i = 0; i < this._length; i += 1) {
|
27865 | shape_pool.release(this.shapes[i]);
|
27866 | }
|
27867 | this._length = 0;
|
27868 | };
|
27869 | function DashProperty(elem, data, renderer, container) {
|
27870 | this.elem = elem;
|
27871 | this.frameId = -1;
|
27872 | this.dataProps = createSizedArray(data.length);
|
27873 | this.renderer = renderer;
|
27874 | this.k = false;
|
27875 | this.dashStr = '';
|
27876 | this.dashArray = createTypedArray('float32', data.length ? data.length - 1 : 0);
|
27877 | this.dashoffset = createTypedArray('float32', 1);
|
27878 | this.initDynamicPropertyContainer(container);
|
27879 | var i, len = data.length || 0, prop;
|
27880 | for(i = 0; i < len; i += 1) {
|
27881 | prop = PropertyFactory.getProp(elem,data[i].v,0, 0, this);
|
27882 | this.k = prop.k || this.k;
|
27883 | this.dataProps[i] = {n:data[i].n,p:prop};
|
27884 | }
|
27885 | if(!this.k){
|
27886 | this.getValue(true);
|
27887 | }
|
27888 | this._isAnimated = this.k;
|
27889 | }
|
27890 |
|
27891 | DashProperty.prototype.getValue = function(forceRender) {
|
27892 | if(this.elem.globalData.frameId === this.frameId && !forceRender){
|
27893 | return;
|
27894 | }
|
27895 | this.frameId = this.elem.globalData.frameId;
|
27896 | this.iterateDynamicProperties();
|
27897 | this._mdf = this._mdf || forceRender;
|
27898 | if (this._mdf) {
|
27899 | var i = 0, len = this.dataProps.length;
|
27900 | if(this.renderer === 'svg') {
|
27901 | this.dashStr = '';
|
27902 | }
|
27903 | for(i=0;i<len;i+=1){
|
27904 | if(this.dataProps[i].n != 'o'){
|
27905 | if(this.renderer === 'svg') {
|
27906 | this.dashStr += ' ' + this.dataProps[i].p.v;
|
27907 | }else{
|
27908 | this.dashArray[i] = this.dataProps[i].p.v;
|
27909 | }
|
27910 | }else{
|
27911 | this.dashoffset[0] = this.dataProps[i].p.v;
|
27912 | }
|
27913 | }
|
27914 | }
|
27915 | };
|
27916 | extendPrototype([DynamicPropertyContainer], DashProperty);
|
27917 | function GradientProperty(elem,data,container){
|
27918 | this.data = data;
|
27919 | this.c = createTypedArray('uint8c', data.p*4);
|
27920 | var cLength = data.k.k[0].s ? (data.k.k[0].s.length - data.p*4) : data.k.k.length - data.p*4;
|
27921 | this.o = createTypedArray('float32', cLength);
|
27922 | this._cmdf = false;
|
27923 | this._omdf = false;
|
27924 | this._collapsable = this.checkCollapsable();
|
27925 | this._hasOpacity = cLength;
|
27926 | this.initDynamicPropertyContainer(container);
|
27927 | this.prop = PropertyFactory.getProp(elem,data.k,1,null,this);
|
27928 | this.k = this.prop.k;
|
27929 | this.getValue(true);
|
27930 | }
|
27931 |
|
27932 | GradientProperty.prototype.comparePoints = function(values, points) {
|
27933 | var i = 0, len = this.o.length/2, diff;
|
27934 | while(i < len) {
|
27935 | diff = Math.abs(values[i*4] - values[points*4 + i*2]);
|
27936 | if(diff > 0.01){
|
27937 | return false;
|
27938 | }
|
27939 | i += 1;
|
27940 | }
|
27941 | return true;
|
27942 | };
|
27943 |
|
27944 | GradientProperty.prototype.checkCollapsable = function() {
|
27945 | if (this.o.length/2 !== this.c.length/4) {
|
27946 | return false;
|
27947 | }
|
27948 | if (this.data.k.k[0].s) {
|
27949 | var i = 0, len = this.data.k.k.length;
|
27950 | while (i < len) {
|
27951 | if (!this.comparePoints(this.data.k.k[i].s, this.data.p)) {
|
27952 | return false;
|
27953 | }
|
27954 | i += 1;
|
27955 | }
|
27956 | } else if(!this.comparePoints(this.data.k.k, this.data.p)) {
|
27957 | return false;
|
27958 | }
|
27959 | return true;
|
27960 | };
|
27961 |
|
27962 | GradientProperty.prototype.getValue = function(forceRender){
|
27963 | this.prop.getValue();
|
27964 | this._mdf = false;
|
27965 | this._cmdf = false;
|
27966 | this._omdf = false;
|
27967 | if(this.prop._mdf || forceRender){
|
27968 | var i, len = this.data.p*4;
|
27969 | var mult, val;
|
27970 | for(i=0;i<len;i+=1){
|
27971 | mult = i%4 === 0 ? 100 : 255;
|
27972 | val = Math.round(this.prop.v[i]*mult);
|
27973 | if(this.c[i] !== val){
|
27974 | this.c[i] = val;
|
27975 | this._cmdf = !forceRender;
|
27976 | }
|
27977 | }
|
27978 | if(this.o.length){
|
27979 | len = this.prop.v.length;
|
27980 | for(i=this.data.p*4;i<len;i+=1){
|
27981 | mult = i%2 === 0 ? 100 : 1;
|
27982 | val = i%2 === 0 ? Math.round(this.prop.v[i]*100):this.prop.v[i];
|
27983 | if(this.o[i-this.data.p*4] !== val){
|
27984 | this.o[i-this.data.p*4] = val;
|
27985 | this._omdf = !forceRender;
|
27986 | }
|
27987 | }
|
27988 | }
|
27989 | this._mdf = !forceRender;
|
27990 | }
|
27991 | };
|
27992 |
|
27993 | extendPrototype([DynamicPropertyContainer], GradientProperty);
|
27994 | var buildShapeString = function(pathNodes, length, closed, mat) {
|
27995 | if(length === 0) {
|
27996 | return '';
|
27997 | }
|
27998 | var _o = pathNodes.o;
|
27999 | var _i = pathNodes.i;
|
28000 | var _v = pathNodes.v;
|
28001 | var i, shapeString = " M" + mat.applyToPointStringified(_v[0][0], _v[0][1]);
|
28002 | for(i = 1; i < length; i += 1) {
|
28003 | shapeString += " C" + mat.applyToPointStringified(_o[i - 1][0], _o[i - 1][1]) + " " + mat.applyToPointStringified(_i[i][0], _i[i][1]) + " " + mat.applyToPointStringified(_v[i][0], _v[i][1]);
|
28004 | }
|
28005 | if (closed && length) {
|
28006 | shapeString += " C" + mat.applyToPointStringified(_o[i - 1][0], _o[i - 1][1]) + " " + mat.applyToPointStringified(_i[0][0], _i[0][1]) + " " + mat.applyToPointStringified(_v[0][0], _v[0][1]);
|
28007 | shapeString += 'z';
|
28008 | }
|
28009 | return shapeString;
|
28010 | };
|
28011 | var ImagePreloader = (function(){
|
28012 |
|
28013 | var proxyImage = (function(){
|
28014 | var canvas = createTag('canvas');
|
28015 | canvas.width = 1;
|
28016 | canvas.height = 1;
|
28017 | var ctx = canvas.getContext('2d');
|
28018 | ctx.fillStyle = '#FF0000';
|
28019 | ctx.fillRect(0, 0, 1, 1);
|
28020 | return canvas;
|
28021 | }());
|
28022 |
|
28023 | function imageLoaded(){
|
28024 | this.loadedAssets += 1;
|
28025 | if(this.loadedAssets === this.totalImages){
|
28026 | if(this.imagesLoadedCb) {
|
28027 | this.imagesLoadedCb(null);
|
28028 | }
|
28029 | }
|
28030 | }
|
28031 |
|
28032 | function getAssetsPath(assetData, assetsPath, original_path) {
|
28033 | var path = '';
|
28034 | if (assetData.e) {
|
28035 | path = assetData.p;
|
28036 | } else if(assetsPath) {
|
28037 | var imagePath = assetData.p;
|
28038 | if (imagePath.indexOf('images/') !== -1) {
|
28039 | imagePath = imagePath.split('/')[1];
|
28040 | }
|
28041 | path = assetsPath + imagePath;
|
28042 | } else {
|
28043 | path = original_path;
|
28044 | path += assetData.u ? assetData.u : '';
|
28045 | path += assetData.p;
|
28046 | }
|
28047 | return path;
|
28048 | }
|
28049 |
|
28050 | function createImageData(assetData) {
|
28051 | var path = getAssetsPath(assetData, this.assetsPath, this.path);
|
28052 | var img = createTag('img');
|
28053 | img.crossOrigin = 'anonymous';
|
28054 | img.addEventListener('load', this._imageLoaded.bind(this), false);
|
28055 | img.addEventListener('error', function() {
|
28056 | ob.img = proxyImage;
|
28057 | this._imageLoaded();
|
28058 | }.bind(this), false);
|
28059 | img.src = path;
|
28060 | var ob = {
|
28061 | img: img,
|
28062 | assetData: assetData
|
28063 | };
|
28064 | return ob;
|
28065 | }
|
28066 |
|
28067 | function loadAssets(assets, cb){
|
28068 | this.imagesLoadedCb = cb;
|
28069 | var i, len = assets.length;
|
28070 | for (i = 0; i < len; i += 1) {
|
28071 | if(!assets[i].layers){
|
28072 | this.totalImages += 1;
|
28073 | this.images.push(this._createImageData(assets[i]));
|
28074 | }
|
28075 | }
|
28076 | }
|
28077 |
|
28078 | function setPath(path){
|
28079 | this.path = path || '';
|
28080 | }
|
28081 |
|
28082 | function setAssetsPath(path){
|
28083 | this.assetsPath = path || '';
|
28084 | }
|
28085 |
|
28086 | function getImage(assetData) {
|
28087 | var i = 0, len = this.images.length;
|
28088 | while (i < len) {
|
28089 | if (this.images[i].assetData === assetData) {
|
28090 | return this.images[i].img;
|
28091 | }
|
28092 | i += 1;
|
28093 | }
|
28094 | }
|
28095 |
|
28096 | function destroy() {
|
28097 | this.imagesLoadedCb = null;
|
28098 | this.images.length = 0;
|
28099 | }
|
28100 |
|
28101 | function loaded() {
|
28102 | return this.totalImages === this.loadedAssets;
|
28103 | }
|
28104 |
|
28105 | return function ImagePreloader(){
|
28106 | this.loadAssets = loadAssets;
|
28107 | this.setAssetsPath = setAssetsPath;
|
28108 | this.setPath = setPath;
|
28109 | this.loaded = loaded;
|
28110 | this.destroy = destroy;
|
28111 | this.getImage = getImage;
|
28112 | this._createImageData = createImageData;
|
28113 | this._imageLoaded = imageLoaded;
|
28114 | this.assetsPath = '';
|
28115 | this.path = '';
|
28116 | this.totalImages = 0;
|
28117 | this.loadedAssets = 0;
|
28118 | this.imagesLoadedCb = null;
|
28119 | this.images = [];
|
28120 | };
|
28121 | }());
|
28122 | var featureSupport = (function(){
|
28123 | var ob = {
|
28124 | maskType: true
|
28125 | };
|
28126 | if (/MSIE 10/i.test(navigator.userAgent) || /MSIE 9/i.test(navigator.userAgent) || /rv:11.0/i.test(navigator.userAgent) || /Edge\/\d./i.test(navigator.userAgent)) {
|
28127 | ob.maskType = false;
|
28128 | }
|
28129 | return ob;
|
28130 | }());
|
28131 | var filtersFactory = (function(){
|
28132 | var ob = {};
|
28133 | ob.createFilter = createFilter;
|
28134 | ob.createAlphaToLuminanceFilter = createAlphaToLuminanceFilter;
|
28135 |
|
28136 | function createFilter(filId){
|
28137 | var fil = createNS('filter');
|
28138 | fil.setAttribute('id',filId);
|
28139 | fil.setAttribute('filterUnits','objectBoundingBox');
|
28140 | fil.setAttribute('x','0%');
|
28141 | fil.setAttribute('y','0%');
|
28142 | fil.setAttribute('width','100%');
|
28143 | fil.setAttribute('height','100%');
|
28144 | return fil;
|
28145 | }
|
28146 |
|
28147 | function createAlphaToLuminanceFilter(){
|
28148 | var feColorMatrix = createNS('feColorMatrix');
|
28149 | feColorMatrix.setAttribute('type','matrix');
|
28150 | feColorMatrix.setAttribute('color-interpolation-filters','sRGB');
|
28151 | feColorMatrix.setAttribute('values','0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 1');
|
28152 | return feColorMatrix;
|
28153 | }
|
28154 |
|
28155 | return ob;
|
28156 | }());
|
28157 | var assetLoader = (function(){
|
28158 |
|
28159 | function formatResponse(xhr) {
|
28160 | if(xhr.response && typeof xhr.response === 'object') {
|
28161 | return xhr.response;
|
28162 | } else if(xhr.response && typeof xhr.response === 'string') {
|
28163 | return JSON.parse(xhr.response);
|
28164 | } else if(xhr.responseText) {
|
28165 | return JSON.parse(xhr.responseText);
|
28166 | }
|
28167 | }
|
28168 |
|
28169 | function loadAsset(path, callback, errorCallback) {
|
28170 | var response;
|
28171 | var xhr = new XMLHttpRequest();
|
28172 | xhr.open('GET', path, true);
|
28173 | // set responseType after calling open or IE will break.
|
28174 | xhr.responseType = "json";
|
28175 | xhr.send();
|
28176 | xhr.onreadystatechange = function () {
|
28177 | if (xhr.readyState == 4) {
|
28178 | if(xhr.status == 200){
|
28179 | response = formatResponse(xhr);
|
28180 | callback(response);
|
28181 | }else{
|
28182 | try{
|
28183 | response = formatResponse(xhr);
|
28184 | callback(response);
|
28185 | }catch(err){
|
28186 | if(errorCallback) {
|
28187 | errorCallback(err);
|
28188 | }
|
28189 | }
|
28190 | }
|
28191 | }
|
28192 | };
|
28193 | }
|
28194 | return {
|
28195 | load: loadAsset
|
28196 | }
|
28197 | }());
|
28198 |
|
28199 | function TextAnimatorProperty(textData, renderType, elem){
|
28200 | this._isFirstFrame = true;
|
28201 | this._hasMaskedPath = false;
|
28202 | this._frameId = -1;
|
28203 | this._textData = textData;
|
28204 | this._renderType = renderType;
|
28205 | this._elem = elem;
|
28206 | this._animatorsData = createSizedArray(this._textData.a.length);
|
28207 | this._pathData = {};
|
28208 | this._moreOptions = {
|
28209 | alignment: {}
|
28210 | };
|
28211 | this.renderedLetters = [];
|
28212 | this.lettersChangedFlag = false;
|
28213 | this.initDynamicPropertyContainer(elem);
|
28214 |
|
28215 | }
|
28216 |
|
28217 | TextAnimatorProperty.prototype.searchProperties = function(){
|
28218 | var i, len = this._textData.a.length, animatorProps;
|
28219 | var getProp = PropertyFactory.getProp;
|
28220 | for(i=0;i<len;i+=1){
|
28221 | animatorProps = this._textData.a[i];
|
28222 | this._animatorsData[i] = new TextAnimatorDataProperty(this._elem, animatorProps, this);
|
28223 | }
|
28224 | if(this._textData.p && 'm' in this._textData.p){
|
28225 | this._pathData = {
|
28226 | f: getProp(this._elem,this._textData.p.f,0,0,this),
|
28227 | l: getProp(this._elem,this._textData.p.l,0,0,this),
|
28228 | r: this._textData.p.r,
|
28229 | m: this._elem.maskManager.getMaskProperty(this._textData.p.m)
|
28230 | };
|
28231 | this._hasMaskedPath = true;
|
28232 | } else {
|
28233 | this._hasMaskedPath = false;
|
28234 | }
|
28235 | this._moreOptions.alignment = getProp(this._elem,this._textData.m.a,1,0,this);
|
28236 | };
|
28237 |
|
28238 | TextAnimatorProperty.prototype.getMeasures = function(documentData, lettersChangedFlag){
|
28239 | this.lettersChangedFlag = lettersChangedFlag;
|
28240 | if(!this._mdf && !this._isFirstFrame && !lettersChangedFlag && (!this._hasMaskedPath || !this._pathData.m._mdf)) {
|
28241 | return;
|
28242 | }
|
28243 | this._isFirstFrame = false;
|
28244 | var alignment = this._moreOptions.alignment.v;
|
28245 | var animators = this._animatorsData;
|
28246 | var textData = this._textData;
|
28247 | var matrixHelper = this.mHelper;
|
28248 | var renderType = this._renderType;
|
28249 | var renderedLettersCount = this.renderedLetters.length;
|
28250 | var data = this.data;
|
28251 | var xPos,yPos;
|
28252 | var i, len;
|
28253 | var letters = documentData.l, pathInfo, currentLength, currentPoint, segmentLength, flag, pointInd, segmentInd, prevPoint, points, segments, partialLength, totalLength, perc, tanAngle, mask;
|
28254 | if(this._hasMaskedPath) {
|
28255 | mask = this._pathData.m;
|
28256 | if(!this._pathData.n || this._pathData._mdf){
|
28257 | var paths = mask.v;
|
28258 | if(this._pathData.r){
|
28259 | paths = paths.reverse();
|
28260 | }
|
28261 | // TODO: release bezier data cached from previous pathInfo: this._pathData.pi
|
28262 | pathInfo = {
|
28263 | tLength: 0,
|
28264 | segments: []
|
28265 | };
|
28266 | len = paths._length - 1;
|
28267 | var bezierData;
|
28268 | totalLength = 0;
|
28269 | for (i = 0; i < len; i += 1) {
|
28270 | bezierData = bez.buildBezierData(paths.v[i]
|
28271 | , paths.v[i + 1]
|
28272 | , [paths.o[i][0] - paths.v[i][0], paths.o[i][1] - paths.v[i][1]]
|
28273 | , [paths.i[i + 1][0] - paths.v[i + 1][0], paths.i[i + 1][1] - paths.v[i + 1][1]]);
|
28274 | pathInfo.tLength += bezierData.segmentLength;
|
28275 | pathInfo.segments.push(bezierData);
|
28276 | totalLength += bezierData.segmentLength;
|
28277 | }
|
28278 | i = len;
|
28279 | if (mask.v.c) {
|
28280 | bezierData = bez.buildBezierData(paths.v[i]
|
28281 | , paths.v[0]
|
28282 | , [paths.o[i][0] - paths.v[i][0], paths.o[i][1] - paths.v[i][1]]
|
28283 | , [paths.i[0][0] - paths.v[0][0], paths.i[0][1] - paths.v[0][1]]);
|
28284 | pathInfo.tLength += bezierData.segmentLength;
|
28285 | pathInfo.segments.push(bezierData);
|
28286 | totalLength += bezierData.segmentLength;
|
28287 | }
|
28288 | this._pathData.pi = pathInfo;
|
28289 | }
|
28290 | pathInfo = this._pathData.pi;
|
28291 |
|
28292 | currentLength = this._pathData.f.v;
|
28293 | segmentInd = 0;
|
28294 | pointInd = 1;
|
28295 | segmentLength = 0;
|
28296 | flag = true;
|
28297 | segments = pathInfo.segments;
|
28298 | if (currentLength < 0 && mask.v.c) {
|
28299 | if (pathInfo.tLength < Math.abs(currentLength)) {
|
28300 | currentLength = -Math.abs(currentLength) % pathInfo.tLength;
|
28301 | }
|
28302 | segmentInd = segments.length - 1;
|
28303 | points = segments[segmentInd].points;
|
28304 | pointInd = points.length - 1;
|
28305 | while (currentLength < 0) {
|
28306 | currentLength += points[pointInd].partialLength;
|
28307 | pointInd -= 1;
|
28308 | if (pointInd < 0) {
|
28309 | segmentInd -= 1;
|
28310 | points = segments[segmentInd].points;
|
28311 | pointInd = points.length - 1;
|
28312 | }
|
28313 | }
|
28314 |
|
28315 | }
|
28316 | points = segments[segmentInd].points;
|
28317 | prevPoint = points[pointInd - 1];
|
28318 | currentPoint = points[pointInd];
|
28319 | partialLength = currentPoint.partialLength;
|
28320 | }
|
28321 |
|
28322 |
|
28323 | len = letters.length;
|
28324 | xPos = 0;
|
28325 | yPos = 0;
|
28326 | var yOff = documentData.finalSize * 1.2 * 0.714;
|
28327 | var firstLine = true;
|
28328 | var animatorProps, animatorSelector;
|
28329 | var j, jLen;
|
28330 | var letterValue;
|
28331 |
|
28332 | jLen = animators.length;
|
28333 |
|
28334 | var mult, ind = -1, offf, xPathPos, yPathPos;
|
28335 | var initPathPos = currentLength,initSegmentInd = segmentInd, initPointInd = pointInd, currentLine = -1;
|
28336 | var elemOpacity;
|
28337 | var sc,sw,fc,k;
|
28338 | var lineLength = 0;
|
28339 | var letterSw, letterSc, letterFc, letterM = '', letterP = this.defaultPropsArray, letterO;
|
28340 |
|
28341 | //
|
28342 | if(documentData.j === 2 || documentData.j === 1) {
|
28343 | var animatorJustifyOffset = 0;
|
28344 | var animatorFirstCharOffset = 0;
|
28345 | var justifyOffsetMult = documentData.j === 2 ? -0.5 : -1;
|
28346 | var lastIndex = 0;
|
28347 | var isNewLine = true;
|
28348 |
|
28349 | for (i = 0; i < len; i += 1) {
|
28350 | if (letters[i].n) {
|
28351 | if(animatorJustifyOffset) {
|
28352 | animatorJustifyOffset += animatorFirstCharOffset;
|
28353 | }
|
28354 | while (lastIndex < i) {
|
28355 | letters[lastIndex].animatorJustifyOffset = animatorJustifyOffset;
|
28356 | lastIndex += 1;
|
28357 | }
|
28358 | animatorJustifyOffset = 0;
|
28359 | isNewLine = true;
|
28360 | } else {
|
28361 | for (j = 0; j < jLen; j += 1) {
|
28362 | animatorProps = animators[j].a;
|
28363 | if (animatorProps.t.propType) {
|
28364 | if (isNewLine && documentData.j === 2) {
|
28365 | animatorFirstCharOffset += animatorProps.t.v * justifyOffsetMult;
|
28366 | }
|
28367 | animatorSelector = animators[j].s;
|
28368 | mult = animatorSelector.getMult(letters[i].anIndexes[j], textData.a[j].s.totalChars);
|
28369 | if (mult.length) {
|
28370 | animatorJustifyOffset += animatorProps.t.v*mult[0] * justifyOffsetMult;
|
28371 | } else {
|
28372 | animatorJustifyOffset += animatorProps.t.v*mult * justifyOffsetMult;
|
28373 | }
|
28374 | }
|
28375 | }
|
28376 | isNewLine = false;
|
28377 | }
|
28378 | }
|
28379 | if(animatorJustifyOffset) {
|
28380 | animatorJustifyOffset += animatorFirstCharOffset;
|
28381 | }
|
28382 | while(lastIndex < i) {
|
28383 | letters[lastIndex].animatorJustifyOffset = animatorJustifyOffset;
|
28384 | lastIndex += 1;
|
28385 | }
|
28386 | }
|
28387 | //
|
28388 |
|
28389 | for( i = 0; i < len; i += 1) {
|
28390 |
|
28391 | matrixHelper.reset();
|
28392 | elemOpacity = 1;
|
28393 | if(letters[i].n) {
|
28394 | xPos = 0;
|
28395 | yPos += documentData.yOffset;
|
28396 | yPos += firstLine ? 1 : 0;
|
28397 | currentLength = initPathPos ;
|
28398 | firstLine = false;
|
28399 | lineLength = 0;
|
28400 | if(this._hasMaskedPath) {
|
28401 | segmentInd = initSegmentInd;
|
28402 | pointInd = initPointInd;
|
28403 | points = segments[segmentInd].points;
|
28404 | prevPoint = points[pointInd - 1];
|
28405 | currentPoint = points[pointInd];
|
28406 | partialLength = currentPoint.partialLength;
|
28407 | segmentLength = 0;
|
28408 | }
|
28409 | letterO = letterSw = letterFc = letterM = '';
|
28410 | letterP = this.defaultPropsArray;
|
28411 | }else{
|
28412 | if(this._hasMaskedPath) {
|
28413 | if(currentLine !== letters[i].line){
|
28414 | switch(documentData.j){
|
28415 | case 1:
|
28416 | currentLength += totalLength - documentData.lineWidths[letters[i].line];
|
28417 | break;
|
28418 | case 2:
|
28419 | currentLength += (totalLength - documentData.lineWidths[letters[i].line])/2;
|
28420 | break;
|
28421 | }
|
28422 | currentLine = letters[i].line;
|
28423 | }
|
28424 | if (ind !== letters[i].ind) {
|
28425 | if (letters[ind]) {
|
28426 | currentLength += letters[ind].extra;
|
28427 | }
|
28428 | currentLength += letters[i].an / 2;
|
28429 | ind = letters[i].ind;
|
28430 | }
|
28431 | currentLength += alignment[0] * letters[i].an / 200;
|
28432 | var animatorOffset = 0;
|
28433 | for (j = 0; j < jLen; j += 1) {
|
28434 | animatorProps = animators[j].a;
|
28435 | if (animatorProps.p.propType) {
|
28436 | animatorSelector = animators[j].s;
|
28437 | mult = animatorSelector.getMult(letters[i].anIndexes[j],textData.a[j].s.totalChars);
|
28438 | if(mult.length){
|
28439 | animatorOffset += animatorProps.p.v[0] * mult[0];
|
28440 | } else{
|
28441 | animatorOffset += animatorProps.p.v[0] * mult;
|
28442 | }
|
28443 |
|
28444 | }
|
28445 | if (animatorProps.a.propType) {
|
28446 | animatorSelector = animators[j].s;
|
28447 | mult = animatorSelector.getMult(letters[i].anIndexes[j],textData.a[j].s.totalChars);
|
28448 | if(mult.length){
|
28449 | animatorOffset += animatorProps.a.v[0] * mult[0];
|
28450 | } else{
|
28451 | animatorOffset += animatorProps.a.v[0] * mult;
|
28452 | }
|
28453 |
|
28454 | }
|
28455 | }
|
28456 | flag = true;
|
28457 | while (flag) {
|
28458 | if (segmentLength + partialLength >= currentLength + animatorOffset || !points) {
|
28459 | perc = (currentLength + animatorOffset - segmentLength) / currentPoint.partialLength;
|
28460 | xPathPos = prevPoint.point[0] + (currentPoint.point[0] - prevPoint.point[0]) * perc;
|
28461 | yPathPos = prevPoint.point[1] + (currentPoint.point[1] - prevPoint.point[1]) * perc;
|
28462 | matrixHelper.translate(-alignment[0]*letters[i].an/200, -(alignment[1] * yOff / 100));
|
28463 | flag = false;
|
28464 | } else if (points) {
|
28465 | segmentLength += currentPoint.partialLength;
|
28466 | pointInd += 1;
|
28467 | if (pointInd >= points.length) {
|
28468 | pointInd = 0;
|
28469 | segmentInd += 1;
|
28470 | if (!segments[segmentInd]) {
|
28471 | if (mask.v.c) {
|
28472 | pointInd = 0;
|
28473 | segmentInd = 0;
|
28474 | points = segments[segmentInd].points;
|
28475 | } else {
|
28476 | segmentLength -= currentPoint.partialLength;
|
28477 | points = null;
|
28478 | }
|
28479 | } else {
|
28480 | points = segments[segmentInd].points;
|
28481 | }
|
28482 | }
|
28483 | if (points) {
|
28484 | prevPoint = currentPoint;
|
28485 | currentPoint = points[pointInd];
|
28486 | partialLength = currentPoint.partialLength;
|
28487 | }
|
28488 | }
|
28489 | }
|
28490 | offf = letters[i].an / 2 - letters[i].add;
|
28491 | matrixHelper.translate(-offf, 0, 0);
|
28492 | } else {
|
28493 | offf = letters[i].an/2 - letters[i].add;
|
28494 | matrixHelper.translate(-offf,0,0);
|
28495 |
|
28496 | // Grouping alignment
|
28497 | matrixHelper.translate(-alignment[0]*letters[i].an/200, -alignment[1]*yOff/100, 0);
|
28498 | }
|
28499 |
|
28500 | lineLength += letters[i].l/2;
|
28501 | for(j=0;j<jLen;j+=1){
|
28502 | animatorProps = animators[j].a;
|
28503 | if (animatorProps.t.propType) {
|
28504 | animatorSelector = animators[j].s;
|
28505 | mult = animatorSelector.getMult(letters[i].anIndexes[j],textData.a[j].s.totalChars);
|
28506 | //This condition is to prevent applying tracking to first character in each line. Might be better to use a boolean "isNewLine"
|
28507 | if(xPos !== 0 || documentData.j !== 0) {
|
28508 | if(this._hasMaskedPath) {
|
28509 | if(mult.length) {
|
28510 | currentLength += animatorProps.t.v*mult[0];
|
28511 | } else {
|
28512 | currentLength += animatorProps.t.v*mult;
|
28513 | }
|
28514 | }else{
|
28515 | if(mult.length) {
|
28516 | xPos += animatorProps.t.v*mult[0];
|
28517 | } else {
|
28518 | xPos += animatorProps.t.v*mult;
|
28519 | }
|
28520 | }
|
28521 | }
|
28522 | }
|
28523 | }
|
28524 | lineLength += letters[i].l/2;
|
28525 | if(documentData.strokeWidthAnim) {
|
28526 | sw = documentData.sw || 0;
|
28527 | }
|
28528 | if(documentData.strokeColorAnim) {
|
28529 | if(documentData.sc){
|
28530 | sc = [documentData.sc[0], documentData.sc[1], documentData.sc[2]];
|
28531 | }else{
|
28532 | sc = [0,0,0];
|
28533 | }
|
28534 | }
|
28535 | if(documentData.fillColorAnim && documentData.fc) {
|
28536 | fc = [documentData.fc[0], documentData.fc[1], documentData.fc[2]];
|
28537 | }
|
28538 | for(j=0;j<jLen;j+=1){
|
28539 | animatorProps = animators[j].a;
|
28540 | if (animatorProps.a.propType) {
|
28541 | animatorSelector = animators[j].s;
|
28542 | mult = animatorSelector.getMult(letters[i].anIndexes[j],textData.a[j].s.totalChars);
|
28543 |
|
28544 | if(mult.length){
|
28545 | matrixHelper.translate(-animatorProps.a.v[0]*mult[0], -animatorProps.a.v[1]*mult[1], animatorProps.a.v[2]*mult[2]);
|
28546 | } else {
|
28547 | matrixHelper.translate(-animatorProps.a.v[0]*mult, -animatorProps.a.v[1]*mult, animatorProps.a.v[2]*mult);
|
28548 | }
|
28549 | }
|
28550 | }
|
28551 | for(j=0;j<jLen;j+=1){
|
28552 | animatorProps = animators[j].a;
|
28553 | if (animatorProps.s.propType) {
|
28554 | animatorSelector = animators[j].s;
|
28555 | mult = animatorSelector.getMult(letters[i].anIndexes[j],textData.a[j].s.totalChars);
|
28556 | if(mult.length){
|
28557 | matrixHelper.scale(1+((animatorProps.s.v[0]-1)*mult[0]),1+((animatorProps.s.v[1]-1)*mult[1]),1);
|
28558 | } else {
|
28559 | matrixHelper.scale(1+((animatorProps.s.v[0]-1)*mult),1+((animatorProps.s.v[1]-1)*mult),1);
|
28560 | }
|
28561 | }
|
28562 | }
|
28563 | for(j=0;j<jLen;j+=1) {
|
28564 | animatorProps = animators[j].a;
|
28565 | animatorSelector = animators[j].s;
|
28566 | mult = animatorSelector.getMult(letters[i].anIndexes[j],textData.a[j].s.totalChars);
|
28567 | if (animatorProps.sk.propType) {
|
28568 | if(mult.length) {
|
28569 | matrixHelper.skewFromAxis(-animatorProps.sk.v * mult[0], animatorProps.sa.v * mult[1]);
|
28570 | } else {
|
28571 | matrixHelper.skewFromAxis(-animatorProps.sk.v * mult, animatorProps.sa.v * mult);
|
28572 | }
|
28573 | }
|
28574 | if (animatorProps.r.propType) {
|
28575 | if(mult.length) {
|
28576 | matrixHelper.rotateZ(-animatorProps.r.v * mult[2]);
|
28577 | } else {
|
28578 | matrixHelper.rotateZ(-animatorProps.r.v * mult);
|
28579 | }
|
28580 | }
|
28581 | if (animatorProps.ry.propType) {
|
28582 |
|
28583 | if(mult.length) {
|
28584 | matrixHelper.rotateY(animatorProps.ry.v*mult[1]);
|
28585 | }else{
|
28586 | matrixHelper.rotateY(animatorProps.ry.v*mult);
|
28587 | }
|
28588 | }
|
28589 | if (animatorProps.rx.propType) {
|
28590 | if(mult.length) {
|
28591 | matrixHelper.rotateX(animatorProps.rx.v*mult[0]);
|
28592 | } else {
|
28593 | matrixHelper.rotateX(animatorProps.rx.v*mult);
|
28594 | }
|
28595 | }
|
28596 | if (animatorProps.o.propType) {
|
28597 | if(mult.length) {
|
28598 | elemOpacity += ((animatorProps.o.v)*mult[0] - elemOpacity)*mult[0];
|
28599 | } else {
|
28600 | elemOpacity += ((animatorProps.o.v)*mult - elemOpacity)*mult;
|
28601 | }
|
28602 | }
|
28603 | if (documentData.strokeWidthAnim && animatorProps.sw.propType) {
|
28604 | if(mult.length) {
|
28605 | sw += animatorProps.sw.v*mult[0];
|
28606 | } else {
|
28607 | sw += animatorProps.sw.v*mult;
|
28608 | }
|
28609 | }
|
28610 | if (documentData.strokeColorAnim && animatorProps.sc.propType) {
|
28611 | for(k=0;k<3;k+=1){
|
28612 | if(mult.length) {
|
28613 | sc[k] = sc[k] + (animatorProps.sc.v[k] - sc[k])*mult[0];
|
28614 | } else {
|
28615 | sc[k] = sc[k] + (animatorProps.sc.v[k] - sc[k])*mult;
|
28616 | }
|
28617 | }
|
28618 | }
|
28619 | if (documentData.fillColorAnim && documentData.fc) {
|
28620 | if(animatorProps.fc.propType){
|
28621 | for(k=0;k<3;k+=1){
|
28622 | if(mult.length) {
|
28623 | fc[k] = fc[k] + (animatorProps.fc.v[k] - fc[k])*mult[0];
|
28624 | } else {
|
28625 | fc[k] = fc[k] + (animatorProps.fc.v[k] - fc[k])*mult;
|
28626 | }
|
28627 | }
|
28628 | }
|
28629 | if(animatorProps.fh.propType){
|
28630 | if(mult.length) {
|
28631 | fc = addHueToRGB(fc,animatorProps.fh.v*mult[0]);
|
28632 | } else {
|
28633 | fc = addHueToRGB(fc,animatorProps.fh.v*mult);
|
28634 | }
|
28635 | }
|
28636 | if(animatorProps.fs.propType){
|
28637 | if(mult.length) {
|
28638 | fc = addSaturationToRGB(fc,animatorProps.fs.v*mult[0]);
|
28639 | } else {
|
28640 | fc = addSaturationToRGB(fc,animatorProps.fs.v*mult);
|
28641 | }
|
28642 | }
|
28643 | if(animatorProps.fb.propType){
|
28644 | if(mult.length) {
|
28645 | fc = addBrightnessToRGB(fc,animatorProps.fb.v*mult[0]);
|
28646 | } else {
|
28647 | fc = addBrightnessToRGB(fc,animatorProps.fb.v*mult);
|
28648 | }
|
28649 | }
|
28650 | }
|
28651 | }
|
28652 |
|
28653 | for(j=0;j<jLen;j+=1){
|
28654 | animatorProps = animators[j].a;
|
28655 |
|
28656 | if (animatorProps.p.propType) {
|
28657 | animatorSelector = animators[j].s;
|
28658 | mult = animatorSelector.getMult(letters[i].anIndexes[j],textData.a[j].s.totalChars);
|
28659 | if(this._hasMaskedPath) {
|
28660 | if(mult.length) {
|
28661 | matrixHelper.translate(0, animatorProps.p.v[1] * mult[0], -animatorProps.p.v[2] * mult[1]);
|
28662 | } else {
|
28663 | matrixHelper.translate(0, animatorProps.p.v[1] * mult, -animatorProps.p.v[2] * mult);
|
28664 | }
|
28665 | }else{
|
28666 | if(mult.length) {
|
28667 | matrixHelper.translate(animatorProps.p.v[0] * mult[0], animatorProps.p.v[1] * mult[1], -animatorProps.p.v[2] * mult[2]);
|
28668 | } else {
|
28669 | matrixHelper.translate(animatorProps.p.v[0] * mult, animatorProps.p.v[1] * mult, -animatorProps.p.v[2] * mult);
|
28670 |
|
28671 | }
|
28672 | }
|
28673 | }
|
28674 | }
|
28675 | if(documentData.strokeWidthAnim){
|
28676 | letterSw = sw < 0 ? 0 : sw;
|
28677 | }
|
28678 | if(documentData.strokeColorAnim){
|
28679 | letterSc = 'rgb('+Math.round(sc[0]*255)+','+Math.round(sc[1]*255)+','+Math.round(sc[2]*255)+')';
|
28680 | }
|
28681 | if(documentData.fillColorAnim && documentData.fc){
|
28682 | letterFc = 'rgb('+Math.round(fc[0]*255)+','+Math.round(fc[1]*255)+','+Math.round(fc[2]*255)+')';
|
28683 | }
|
28684 |
|
28685 | if(this._hasMaskedPath) {
|
28686 | matrixHelper.translate(0,-documentData.ls);
|
28687 |
|
28688 | matrixHelper.translate(0, alignment[1]*yOff/100 + yPos,0);
|
28689 | if (textData.p.p) {
|
28690 | tanAngle = (currentPoint.point[1] - prevPoint.point[1]) / (currentPoint.point[0] - prevPoint.point[0]);
|
28691 | var rot = Math.atan(tanAngle) * 180 / Math.PI;
|
28692 | if (currentPoint.point[0] < prevPoint.point[0]) {
|
28693 | rot += 180;
|
28694 | }
|
28695 | matrixHelper.rotate(-rot * Math.PI / 180);
|
28696 | }
|
28697 | matrixHelper.translate(xPathPos, yPathPos, 0);
|
28698 | currentLength -= alignment[0]*letters[i].an/200;
|
28699 | if(letters[i+1] && ind !== letters[i+1].ind){
|
28700 | currentLength += letters[i].an / 2;
|
28701 | currentLength += documentData.tr/1000*documentData.finalSize;
|
28702 | }
|
28703 | }else{
|
28704 |
|
28705 | matrixHelper.translate(xPos,yPos,0);
|
28706 |
|
28707 | if(documentData.ps){
|
28708 | //matrixHelper.translate(documentData.ps[0],documentData.ps[1],0);
|
28709 | matrixHelper.translate(documentData.ps[0],documentData.ps[1] + documentData.ascent,0);
|
28710 | }
|
28711 | switch(documentData.j){
|
28712 | case 1:
|
28713 | matrixHelper.translate(letters[i].animatorJustifyOffset + documentData.justifyOffset + (documentData.boxWidth - documentData.lineWidths[letters[i].line]),0,0);
|
28714 | break;
|
28715 | case 2:
|
28716 | matrixHelper.translate(letters[i].animatorJustifyOffset + documentData.justifyOffset + (documentData.boxWidth - documentData.lineWidths[letters[i].line])/2,0,0);
|
28717 | break;
|
28718 | }
|
28719 | matrixHelper.translate(0,-documentData.ls);
|
28720 | matrixHelper.translate(offf,0,0);
|
28721 | matrixHelper.translate(alignment[0]*letters[i].an/200,alignment[1]*yOff/100,0);
|
28722 | xPos += letters[i].l + documentData.tr/1000*documentData.finalSize;
|
28723 | }
|
28724 | if(renderType === 'html'){
|
28725 | letterM = matrixHelper.toCSS();
|
28726 | }else if(renderType === 'svg'){
|
28727 | letterM = matrixHelper.to2dCSS();
|
28728 | }else{
|
28729 | letterP = [matrixHelper.props[0],matrixHelper.props[1],matrixHelper.props[2],matrixHelper.props[3],matrixHelper.props[4],matrixHelper.props[5],matrixHelper.props[6],matrixHelper.props[7],matrixHelper.props[8],matrixHelper.props[9],matrixHelper.props[10],matrixHelper.props[11],matrixHelper.props[12],matrixHelper.props[13],matrixHelper.props[14],matrixHelper.props[15]];
|
28730 | }
|
28731 | letterO = elemOpacity;
|
28732 | }
|
28733 |
|
28734 | if(renderedLettersCount <= i) {
|
28735 | letterValue = new LetterProps(letterO,letterSw,letterSc,letterFc,letterM,letterP);
|
28736 | this.renderedLetters.push(letterValue);
|
28737 | renderedLettersCount += 1;
|
28738 | this.lettersChangedFlag = true;
|
28739 | } else {
|
28740 | letterValue = this.renderedLetters[i];
|
28741 | this.lettersChangedFlag = letterValue.update(letterO, letterSw, letterSc, letterFc, letterM, letterP) || this.lettersChangedFlag;
|
28742 | }
|
28743 | }
|
28744 | };
|
28745 |
|
28746 | TextAnimatorProperty.prototype.getValue = function(){
|
28747 | if(this._elem.globalData.frameId === this._frameId){
|
28748 | return;
|
28749 | }
|
28750 | this._frameId = this._elem.globalData.frameId;
|
28751 | this.iterateDynamicProperties();
|
28752 | };
|
28753 |
|
28754 | TextAnimatorProperty.prototype.mHelper = new Matrix();
|
28755 | TextAnimatorProperty.prototype.defaultPropsArray = [];
|
28756 | extendPrototype([DynamicPropertyContainer], TextAnimatorProperty);
|
28757 | function TextAnimatorDataProperty(elem, animatorProps, container) {
|
28758 | var defaultData = {propType:false};
|
28759 | var getProp = PropertyFactory.getProp;
|
28760 | var textAnimator_animatables = animatorProps.a;
|
28761 | this.a = {
|
28762 | r: textAnimator_animatables.r ? getProp(elem, textAnimator_animatables.r, 0, degToRads, container) : defaultData,
|
28763 | rx: textAnimator_animatables.rx ? getProp(elem, textAnimator_animatables.rx, 0, degToRads, container) : defaultData,
|
28764 | ry: textAnimator_animatables.ry ? getProp(elem, textAnimator_animatables.ry, 0, degToRads, container) : defaultData,
|
28765 | sk: textAnimator_animatables.sk ? getProp(elem, textAnimator_animatables.sk, 0, degToRads, container) : defaultData,
|
28766 | sa: textAnimator_animatables.sa ? getProp(elem, textAnimator_animatables.sa, 0, degToRads, container) : defaultData,
|
28767 | s: textAnimator_animatables.s ? getProp(elem, textAnimator_animatables.s, 1, 0.01, container) : defaultData,
|
28768 | a: textAnimator_animatables.a ? getProp(elem, textAnimator_animatables.a, 1, 0, container) : defaultData,
|
28769 | o: textAnimator_animatables.o ? getProp(elem, textAnimator_animatables.o, 0, 0.01, container) : defaultData,
|
28770 | p: textAnimator_animatables.p ? getProp(elem,textAnimator_animatables.p, 1, 0, container) : defaultData,
|
28771 | sw: textAnimator_animatables.sw ? getProp(elem, textAnimator_animatables.sw, 0, 0, container) : defaultData,
|
28772 | sc: textAnimator_animatables.sc ? getProp(elem, textAnimator_animatables.sc, 1, 0, container) : defaultData,
|
28773 | fc: textAnimator_animatables.fc ? getProp(elem, textAnimator_animatables.fc, 1, 0, container) : defaultData,
|
28774 | fh: textAnimator_animatables.fh ? getProp(elem, textAnimator_animatables.fh, 0, 0, container) : defaultData,
|
28775 | fs: textAnimator_animatables.fs ? getProp(elem, textAnimator_animatables.fs, 0, 0.01, container) : defaultData,
|
28776 | fb: textAnimator_animatables.fb ? getProp(elem, textAnimator_animatables.fb, 0, 0.01, container) : defaultData,
|
28777 | t: textAnimator_animatables.t ? getProp(elem, textAnimator_animatables.t, 0, 0, container) : defaultData
|
28778 | };
|
28779 |
|
28780 | this.s = TextSelectorProp.getTextSelectorProp(elem,animatorProps.s, container);
|
28781 | this.s.t = animatorProps.s.t;
|
28782 | }
|
28783 | function LetterProps(o, sw, sc, fc, m, p){
|
28784 | this.o = o;
|
28785 | this.sw = sw;
|
28786 | this.sc = sc;
|
28787 | this.fc = fc;
|
28788 | this.m = m;
|
28789 | this.p = p;
|
28790 | this._mdf = {
|
28791 | o: true,
|
28792 | sw: !!sw,
|
28793 | sc: !!sc,
|
28794 | fc: !!fc,
|
28795 | m: true,
|
28796 | p: true
|
28797 | };
|
28798 | }
|
28799 |
|
28800 | LetterProps.prototype.update = function(o, sw, sc, fc, m, p) {
|
28801 | this._mdf.o = false;
|
28802 | this._mdf.sw = false;
|
28803 | this._mdf.sc = false;
|
28804 | this._mdf.fc = false;
|
28805 | this._mdf.m = false;
|
28806 | this._mdf.p = false;
|
28807 | var updated = false;
|
28808 |
|
28809 | if(this.o !== o) {
|
28810 | this.o = o;
|
28811 | this._mdf.o = true;
|
28812 | updated = true;
|
28813 | }
|
28814 | if(this.sw !== sw) {
|
28815 | this.sw = sw;
|
28816 | this._mdf.sw = true;
|
28817 | updated = true;
|
28818 | }
|
28819 | if(this.sc !== sc) {
|
28820 | this.sc = sc;
|
28821 | this._mdf.sc = true;
|
28822 | updated = true;
|
28823 | }
|
28824 | if(this.fc !== fc) {
|
28825 | this.fc = fc;
|
28826 | this._mdf.fc = true;
|
28827 | updated = true;
|
28828 | }
|
28829 | if(this.m !== m) {
|
28830 | this.m = m;
|
28831 | this._mdf.m = true;
|
28832 | updated = true;
|
28833 | }
|
28834 | if(p.length && (this.p[0] !== p[0] || this.p[1] !== p[1] || this.p[4] !== p[4] || this.p[5] !== p[5] || this.p[12] !== p[12] || this.p[13] !== p[13])) {
|
28835 | this.p = p;
|
28836 | this._mdf.p = true;
|
28837 | updated = true;
|
28838 | }
|
28839 | return updated;
|
28840 | };
|
28841 | function TextProperty(elem, data){
|
28842 | this._frameId = initialDefaultFrame;
|
28843 | this.pv = '';
|
28844 | this.v = '';
|
28845 | this.kf = false;
|
28846 | this._isFirstFrame = true;
|
28847 | this._mdf = false;
|
28848 | this.data = data;
|
28849 | this.elem = elem;
|
28850 | this.comp = this.elem.comp;
|
28851 | this.keysIndex = 0;
|
28852 | this.canResize = false;
|
28853 | this.minimumFontSize = 1;
|
28854 | this.effectsSequence = [];
|
28855 | this.currentData = {
|
28856 | ascent: 0,
|
28857 | boxWidth: this.defaultBoxWidth,
|
28858 | f: '',
|
28859 | fStyle: '',
|
28860 | fWeight: '',
|
28861 | fc: '',
|
28862 | j: '',
|
28863 | justifyOffset: '',
|
28864 | l: [],
|
28865 | lh: 0,
|
28866 | lineWidths: [],
|
28867 | ls: '',
|
28868 | of: '',
|
28869 | s: '',
|
28870 | sc: '',
|
28871 | sw: 0,
|
28872 | t: 0,
|
28873 | tr: 0,
|
28874 | sz:0,
|
28875 | ps:null,
|
28876 | fillColorAnim: false,
|
28877 | strokeColorAnim: false,
|
28878 | strokeWidthAnim: false,
|
28879 | yOffset: 0,
|
28880 | finalSize:0,
|
28881 | finalText:[],
|
28882 | finalLineHeight: 0,
|
28883 | __complete: false
|
28884 |
|
28885 | };
|
28886 | this.copyData(this.currentData, this.data.d.k[0].s);
|
28887 |
|
28888 | if(!this.searchProperty()) {
|
28889 | this.completeTextData(this.currentData);
|
28890 | }
|
28891 | }
|
28892 |
|
28893 | TextProperty.prototype.defaultBoxWidth = [0,0];
|
28894 |
|
28895 | TextProperty.prototype.copyData = function(obj, data) {
|
28896 | for(var s in data) {
|
28897 | if(data.hasOwnProperty(s)) {
|
28898 | obj[s] = data[s];
|
28899 | }
|
28900 | }
|
28901 | return obj;
|
28902 | };
|
28903 |
|
28904 | TextProperty.prototype.setCurrentData = function(data){
|
28905 | if(!data.__complete) {
|
28906 | this.completeTextData(data);
|
28907 | }
|
28908 | this.currentData = data;
|
28909 | this.currentData.boxWidth = this.currentData.boxWidth || this.defaultBoxWidth;
|
28910 | this._mdf = true;
|
28911 | };
|
28912 |
|
28913 | TextProperty.prototype.searchProperty = function() {
|
28914 | return this.searchKeyframes();
|
28915 | };
|
28916 |
|
28917 | TextProperty.prototype.searchKeyframes = function() {
|
28918 | this.kf = this.data.d.k.length > 1;
|
28919 | if(this.kf) {
|
28920 | this.addEffect(this.getKeyframeValue.bind(this));
|
28921 | }
|
28922 | return this.kf;
|
28923 | };
|
28924 |
|
28925 | TextProperty.prototype.addEffect = function(effectFunction) {
|
28926 | this.effectsSequence.push(effectFunction);
|
28927 | this.elem.addDynamicProperty(this);
|
28928 | };
|
28929 |
|
28930 | TextProperty.prototype.getValue = function(_finalValue) {
|
28931 | if((this.elem.globalData.frameId === this.frameId || !this.effectsSequence.length) && !_finalValue) {
|
28932 | return;
|
28933 | }
|
28934 | this.currentData.t = this.data.d.k[this.keysIndex].s.t;
|
28935 | var currentValue = this.currentData;
|
28936 | var currentIndex = this.keysIndex;
|
28937 | if(this.lock) {
|
28938 | this.setCurrentData(this.currentData);
|
28939 | return;
|
28940 | }
|
28941 | this.lock = true;
|
28942 | this._mdf = false;
|
28943 | var i, len = this.effectsSequence.length;
|
28944 | var finalValue = _finalValue || this.data.d.k[this.keysIndex].s;
|
28945 | for(i = 0; i < len; i += 1) {
|
28946 | //Checking if index changed to prevent creating a new object every time the expression updates.
|
28947 | if(currentIndex !== this.keysIndex) {
|
28948 | finalValue = this.effectsSequence[i](finalValue, finalValue.t);
|
28949 | } else {
|
28950 | finalValue = this.effectsSequence[i](this.currentData, finalValue.t);
|
28951 | }
|
28952 | }
|
28953 | if(currentValue !== finalValue) {
|
28954 | this.setCurrentData(finalValue);
|
28955 | }
|
28956 | this.pv = this.v = this.currentData;
|
28957 | this.lock = false;
|
28958 | this.frameId = this.elem.globalData.frameId;
|
28959 | };
|
28960 |
|
28961 | TextProperty.prototype.getKeyframeValue = function() {
|
28962 | var textKeys = this.data.d.k, textDocumentData;
|
28963 | var frameNum = this.elem.comp.renderedFrame;
|
28964 | var i = 0, len = textKeys.length;
|
28965 | while(i <= len - 1) {
|
28966 | textDocumentData = textKeys[i].s;
|
28967 | if(i === len - 1 || textKeys[i+1].t > frameNum){
|
28968 | break;
|
28969 | }
|
28970 | i += 1;
|
28971 | }
|
28972 | if(this.keysIndex !== i) {
|
28973 | this.keysIndex = i;
|
28974 | }
|
28975 | return this.data.d.k[this.keysIndex].s;
|
28976 | };
|
28977 |
|
28978 | TextProperty.prototype.buildFinalText = function(text) {
|
28979 | var combinedCharacters = FontManager.getCombinedCharacterCodes();
|
28980 | var charactersArray = [];
|
28981 | var i = 0, len = text.length;
|
28982 | while (i < len) {
|
28983 | if (combinedCharacters.indexOf(text.charCodeAt(i)) !== -1) {
|
28984 | charactersArray[charactersArray.length - 1] += text.charAt(i);
|
28985 | } else {
|
28986 | charactersArray.push(text.charAt(i));
|
28987 | }
|
28988 | i += 1;
|
28989 | }
|
28990 | return charactersArray;
|
28991 | };
|
28992 |
|
28993 | TextProperty.prototype.completeTextData = function(documentData) {
|
28994 | documentData.__complete = true;
|
28995 | var fontManager = this.elem.globalData.fontManager;
|
28996 | var data = this.data;
|
28997 | var letters = [];
|
28998 | var i, len;
|
28999 | var newLineFlag, index = 0, val;
|
29000 | var anchorGrouping = data.m.g;
|
29001 | var currentSize = 0, currentPos = 0, currentLine = 0, lineWidths = [];
|
29002 | var lineWidth = 0;
|
29003 | var maxLineWidth = 0;
|
29004 | var j, jLen;
|
29005 | var fontData = fontManager.getFontByName(documentData.f);
|
29006 | var charData, cLength = 0;
|
29007 | var styles = fontData.fStyle ? fontData.fStyle.split(' ') : [];
|
29008 |
|
29009 | var fWeight = 'normal', fStyle = 'normal';
|
29010 | len = styles.length;
|
29011 | var styleName;
|
29012 | for(i=0;i<len;i+=1){
|
29013 | styleName = styles[i].toLowerCase();
|
29014 | switch(styleName) {
|
29015 | case 'italic':
|
29016 | fStyle = 'italic';
|
29017 | break;
|
29018 | case 'bold':
|
29019 | fWeight = '700';
|
29020 | break;
|
29021 | case 'black':
|
29022 | fWeight = '900';
|
29023 | break;
|
29024 | case 'medium':
|
29025 | fWeight = '500';
|
29026 | break;
|
29027 | case 'regular':
|
29028 | case 'normal':
|
29029 | fWeight = '400';
|
29030 | break;
|
29031 | case 'light':
|
29032 | case 'thin':
|
29033 | fWeight = '200';
|
29034 | break;
|
29035 | }
|
29036 | }
|
29037 | documentData.fWeight = fontData.fWeight || fWeight;
|
29038 | documentData.fStyle = fStyle;
|
29039 | len = documentData.t.length;
|
29040 | documentData.finalSize = documentData.s;
|
29041 | documentData.finalText = this.buildFinalText(documentData.t);
|
29042 | documentData.finalLineHeight = documentData.lh;
|
29043 | var trackingOffset = documentData.tr/1000*documentData.finalSize;
|
29044 | var charCode;
|
29045 | if(documentData.sz){
|
29046 | var flag = true;
|
29047 | var boxWidth = documentData.sz[0];
|
29048 | var boxHeight = documentData.sz[1];
|
29049 | var currentHeight, finalText;
|
29050 | while(flag) {
|
29051 | finalText = this.buildFinalText(documentData.t);
|
29052 | currentHeight = 0;
|
29053 | lineWidth = 0;
|
29054 | len = finalText.length;
|
29055 | trackingOffset = documentData.tr/1000*documentData.finalSize;
|
29056 | var lastSpaceIndex = -1;
|
29057 | for(i=0;i<len;i+=1){
|
29058 | charCode = finalText[i].charCodeAt(0);
|
29059 | newLineFlag = false;
|
29060 | if(finalText[i] === ' '){
|
29061 | lastSpaceIndex = i;
|
29062 | }else if(charCode === 13 || charCode === 3){
|
29063 | lineWidth = 0;
|
29064 | newLineFlag = true;
|
29065 | currentHeight += documentData.finalLineHeight || documentData.finalSize*1.2;
|
29066 | }
|
29067 | if(fontManager.chars){
|
29068 | charData = fontManager.getCharData(finalText[i], fontData.fStyle, fontData.fFamily);
|
29069 | cLength = newLineFlag ? 0 : charData.w*documentData.finalSize/100;
|
29070 | }else{
|
29071 | //tCanvasHelper.font = documentData.s + 'px '+ fontData.fFamily;
|
29072 | cLength = fontManager.measureText(finalText[i], documentData.f, documentData.finalSize);
|
29073 | }
|
29074 | if(lineWidth + cLength > boxWidth && finalText[i] !== ' '){
|
29075 | if(lastSpaceIndex === -1){
|
29076 | len += 1;
|
29077 | } else {
|
29078 | i = lastSpaceIndex;
|
29079 | }
|
29080 | currentHeight += documentData.finalLineHeight || documentData.finalSize*1.2;
|
29081 | finalText.splice(i, lastSpaceIndex === i ? 1 : 0,"\r");
|
29082 | //finalText = finalText.substr(0,i) + "\r" + finalText.substr(i === lastSpaceIndex ? i + 1 : i);
|
29083 | lastSpaceIndex = -1;
|
29084 | lineWidth = 0;
|
29085 | }else {
|
29086 | lineWidth += cLength;
|
29087 | lineWidth += trackingOffset;
|
29088 | }
|
29089 | }
|
29090 | currentHeight += fontData.ascent*documentData.finalSize/100;
|
29091 | if(this.canResize && documentData.finalSize > this.minimumFontSize && boxHeight < currentHeight) {
|
29092 | documentData.finalSize -= 1;
|
29093 | documentData.finalLineHeight = documentData.finalSize * documentData.lh / documentData.s;
|
29094 | } else {
|
29095 | documentData.finalText = finalText;
|
29096 | len = documentData.finalText.length;
|
29097 | flag = false;
|
29098 | }
|
29099 | }
|
29100 |
|
29101 | }
|
29102 | lineWidth = - trackingOffset;
|
29103 | cLength = 0;
|
29104 | var uncollapsedSpaces = 0;
|
29105 | var currentChar;
|
29106 | for (i = 0;i < len ;i += 1) {
|
29107 | newLineFlag = false;
|
29108 | currentChar = documentData.finalText[i];
|
29109 | charCode = currentChar.charCodeAt(0);
|
29110 | if (currentChar === ' '){
|
29111 | val = '\u00A0';
|
29112 | } else if (charCode === 13 || charCode === 3) {
|
29113 | uncollapsedSpaces = 0;
|
29114 | lineWidths.push(lineWidth);
|
29115 | maxLineWidth = lineWidth > maxLineWidth ? lineWidth : maxLineWidth;
|
29116 | lineWidth = - 2 * trackingOffset;
|
29117 | val = '';
|
29118 | newLineFlag = true;
|
29119 | currentLine += 1;
|
29120 | }else{
|
29121 | val = documentData.finalText[i];
|
29122 | }
|
29123 | if(fontManager.chars){
|
29124 | charData = fontManager.getCharData(currentChar, fontData.fStyle, fontManager.getFontByName(documentData.f).fFamily);
|
29125 | cLength = newLineFlag ? 0 : charData.w*documentData.finalSize/100;
|
29126 | }else{
|
29127 | //var charWidth = fontManager.measureText(val, documentData.f, documentData.finalSize);
|
29128 | //tCanvasHelper.font = documentData.finalSize + 'px '+ fontManager.getFontByName(documentData.f).fFamily;
|
29129 | cLength = fontManager.measureText(val, documentData.f, documentData.finalSize);
|
29130 | }
|
29131 |
|
29132 | //
|
29133 | if(currentChar === ' '){
|
29134 | uncollapsedSpaces += cLength + trackingOffset;
|
29135 | } else {
|
29136 | lineWidth += cLength + trackingOffset + uncollapsedSpaces;
|
29137 | uncollapsedSpaces = 0;
|
29138 | }
|
29139 | letters.push({l:cLength,an:cLength,add:currentSize,n:newLineFlag, anIndexes:[], val: val, line: currentLine, animatorJustifyOffset: 0});
|
29140 | if(anchorGrouping == 2){
|
29141 | currentSize += cLength;
|
29142 | if(val === '' || val === '\u00A0' || i === len - 1){
|
29143 | if(val === '' || val === '\u00A0'){
|
29144 | currentSize -= cLength;
|
29145 | }
|
29146 | while(currentPos<=i){
|
29147 | letters[currentPos].an = currentSize;
|
29148 | letters[currentPos].ind = index;
|
29149 | letters[currentPos].extra = cLength;
|
29150 | currentPos += 1;
|
29151 | }
|
29152 | index += 1;
|
29153 | currentSize = 0;
|
29154 | }
|
29155 | }else if(anchorGrouping == 3){
|
29156 | currentSize += cLength;
|
29157 | if(val === '' || i === len - 1){
|
29158 | if(val === ''){
|
29159 | currentSize -= cLength;
|
29160 | }
|
29161 | while(currentPos<=i){
|
29162 | letters[currentPos].an = currentSize;
|
29163 | letters[currentPos].ind = index;
|
29164 | letters[currentPos].extra = cLength;
|
29165 | currentPos += 1;
|
29166 | }
|
29167 | currentSize = 0;
|
29168 | index += 1;
|
29169 | }
|
29170 | }else{
|
29171 | letters[index].ind = index;
|
29172 | letters[index].extra = 0;
|
29173 | index += 1;
|
29174 | }
|
29175 | }
|
29176 | documentData.l = letters;
|
29177 | maxLineWidth = lineWidth > maxLineWidth ? lineWidth : maxLineWidth;
|
29178 | lineWidths.push(lineWidth);
|
29179 | if(documentData.sz){
|
29180 | documentData.boxWidth = documentData.sz[0];
|
29181 | documentData.justifyOffset = 0;
|
29182 | }else{
|
29183 | documentData.boxWidth = maxLineWidth;
|
29184 | switch(documentData.j){
|
29185 | case 1:
|
29186 | documentData.justifyOffset = - documentData.boxWidth;
|
29187 | break;
|
29188 | case 2:
|
29189 | documentData.justifyOffset = - documentData.boxWidth/2;
|
29190 | break;
|
29191 | default:
|
29192 | documentData.justifyOffset = 0;
|
29193 | }
|
29194 | }
|
29195 | documentData.lineWidths = lineWidths;
|
29196 |
|
29197 | var animators = data.a, animatorData, letterData;
|
29198 | jLen = animators.length;
|
29199 | var based, ind, indexes = [];
|
29200 | for(j=0;j<jLen;j+=1){
|
29201 | animatorData = animators[j];
|
29202 | if(animatorData.a.sc){
|
29203 | documentData.strokeColorAnim = true;
|
29204 | }
|
29205 | if(animatorData.a.sw){
|
29206 | documentData.strokeWidthAnim = true;
|
29207 | }
|
29208 | if(animatorData.a.fc || animatorData.a.fh || animatorData.a.fs || animatorData.a.fb){
|
29209 | documentData.fillColorAnim = true;
|
29210 | }
|
29211 | ind = 0;
|
29212 | based = animatorData.s.b;
|
29213 | for(i=0;i<len;i+=1){
|
29214 | letterData = letters[i];
|
29215 | letterData.anIndexes[j] = ind;
|
29216 | if((based == 1 && letterData.val !== '') || (based == 2 && letterData.val !== '' && letterData.val !== '\u00A0') || (based == 3 && (letterData.n || letterData.val == '\u00A0' || i == len - 1)) || (based == 4 && (letterData.n || i == len - 1))){
|
29217 | if(animatorData.s.rn === 1){
|
29218 | indexes.push(ind);
|
29219 | }
|
29220 | ind += 1;
|
29221 | }
|
29222 | }
|
29223 | data.a[j].s.totalChars = ind;
|
29224 | var currentInd = -1, newInd;
|
29225 | if(animatorData.s.rn === 1){
|
29226 | for(i = 0; i < len; i += 1){
|
29227 | letterData = letters[i];
|
29228 | if(currentInd != letterData.anIndexes[j]){
|
29229 | currentInd = letterData.anIndexes[j];
|
29230 | newInd = indexes.splice(Math.floor(Math.random()*indexes.length),1)[0];
|
29231 | }
|
29232 | letterData.anIndexes[j] = newInd;
|
29233 | }
|
29234 | }
|
29235 | }
|
29236 | documentData.yOffset = documentData.finalLineHeight || documentData.finalSize*1.2;
|
29237 | documentData.ls = documentData.ls || 0;
|
29238 | documentData.ascent = fontData.ascent*documentData.finalSize/100;
|
29239 | };
|
29240 |
|
29241 | TextProperty.prototype.updateDocumentData = function(newData, index) {
|
29242 | index = index === undefined ? this.keysIndex : index;
|
29243 | var dData = this.copyData({}, this.data.d.k[index].s);
|
29244 | dData = this.copyData(dData, newData);
|
29245 | this.data.d.k[index].s = dData;
|
29246 | this.recalculate(index);
|
29247 | this.elem.addDynamicProperty(this);
|
29248 | };
|
29249 |
|
29250 | TextProperty.prototype.recalculate = function(index) {
|
29251 | var dData = this.data.d.k[index].s;
|
29252 | dData.__complete = false;
|
29253 | this.keysIndex = 0;
|
29254 | this._isFirstFrame = true;
|
29255 | this.getValue(dData);
|
29256 | };
|
29257 |
|
29258 | TextProperty.prototype.canResizeFont = function(_canResize) {
|
29259 | this.canResize = _canResize;
|
29260 | this.recalculate(this.keysIndex);
|
29261 | this.elem.addDynamicProperty(this);
|
29262 | };
|
29263 |
|
29264 | TextProperty.prototype.setMinimumFontSize = function(_fontValue) {
|
29265 | this.minimumFontSize = Math.floor(_fontValue) || 1;
|
29266 | this.recalculate(this.keysIndex);
|
29267 | this.elem.addDynamicProperty(this);
|
29268 | };
|
29269 |
|
29270 | var TextSelectorProp = (function(){
|
29271 | var max = Math.max;
|
29272 | var min = Math.min;
|
29273 | var floor = Math.floor;
|
29274 |
|
29275 | function TextSelectorProp(elem,data){
|
29276 | this._currentTextLength = -1;
|
29277 | this.k = false;
|
29278 | this.data = data;
|
29279 | this.elem = elem;
|
29280 | this.comp = elem.comp;
|
29281 | this.finalS = 0;
|
29282 | this.finalE = 0;
|
29283 | this.initDynamicPropertyContainer(elem);
|
29284 | this.s = PropertyFactory.getProp(elem,data.s || {k:0},0,0,this);
|
29285 | if('e' in data){
|
29286 | this.e = PropertyFactory.getProp(elem,data.e,0,0,this);
|
29287 | }else{
|
29288 | this.e = {v:100};
|
29289 | }
|
29290 | this.o = PropertyFactory.getProp(elem,data.o || {k:0},0,0,this);
|
29291 | this.xe = PropertyFactory.getProp(elem,data.xe || {k:0},0,0,this);
|
29292 | this.ne = PropertyFactory.getProp(elem,data.ne || {k:0},0,0,this);
|
29293 | this.a = PropertyFactory.getProp(elem,data.a,0,0.01,this);
|
29294 | if(!this.dynamicProperties.length){
|
29295 | this.getValue();
|
29296 | }
|
29297 | }
|
29298 |
|
29299 | TextSelectorProp.prototype = {
|
29300 | getMult: function(ind) {
|
29301 | if(this._currentTextLength !== this.elem.textProperty.currentData.l.length) {
|
29302 | this.getValue();
|
29303 | }
|
29304 | //var easer = bez.getEasingCurve(this.ne.v/100,0,1-this.xe.v/100,1);
|
29305 | var easer = BezierFactory.getBezierEasing(this.ne.v/100,0,1-this.xe.v/100,1).get;
|
29306 | var mult = 0;
|
29307 | var s = this.finalS;
|
29308 | var e = this.finalE;
|
29309 | var type = this.data.sh;
|
29310 | if(type == 2){
|
29311 | if(e === s){
|
29312 | mult = ind >= e ? 1 : 0;
|
29313 | }else{
|
29314 | mult = max(0,min(0.5/(e-s) + (ind-s)/(e-s),1));
|
29315 | }
|
29316 | mult = easer(mult);
|
29317 | }else if(type == 3){
|
29318 | if(e === s){
|
29319 | mult = ind >= e ? 0 : 1;
|
29320 | }else{
|
29321 | mult = 1 - max(0,min(0.5/(e-s) + (ind-s)/(e-s),1));
|
29322 | }
|
29323 |
|
29324 | mult = easer(mult);
|
29325 | }else if(type == 4){
|
29326 | if(e === s){
|
29327 | mult = 0;
|
29328 | }else{
|
29329 | mult = max(0,min(0.5/(e-s) + (ind-s)/(e-s),1));
|
29330 | if(mult<0.5){
|
29331 | mult *= 2;
|
29332 | }else{
|
29333 | mult = 1 - 2*(mult-0.5);
|
29334 | }
|
29335 | }
|
29336 | mult = easer(mult);
|
29337 | }else if(type == 5){
|
29338 | if(e === s){
|
29339 | mult = 0;
|
29340 | }else{
|
29341 | var tot = e - s;
|
29342 | /*ind += 0.5;
|
29343 | mult = -4/(tot*tot)*(ind*ind)+(4/tot)*ind;*/
|
29344 | ind = min(max(0,ind+0.5-s),e-s);
|
29345 | var x = -tot/2+ind;
|
29346 | var a = tot/2;
|
29347 | mult = Math.sqrt(1 - (x*x)/(a*a));
|
29348 | }
|
29349 | mult = easer(mult);
|
29350 | }else if(type == 6){
|
29351 | if(e === s){
|
29352 | mult = 0;
|
29353 | }else{
|
29354 | ind = min(max(0,ind+0.5-s),e-s);
|
29355 | mult = (1+(Math.cos((Math.PI+Math.PI*2*(ind)/(e-s)))))/2;
|
29356 | /*
|
29357 | ind = Math.min(Math.max(s,ind),e-1);
|
29358 | mult = (1+(Math.cos((Math.PI+Math.PI*2*(ind-s)/(e-1-s)))))/2;
|
29359 | mult = Math.max(mult,(1/(e-1-s))/(e-1-s));*/
|
29360 | }
|
29361 | mult = easer(mult);
|
29362 | }else {
|
29363 | if(ind >= floor(s)){
|
29364 | if(ind-s < 0){
|
29365 | mult = 1 - (s - ind);
|
29366 | }else{
|
29367 | mult = max(0,min(e-ind,1));
|
29368 | }
|
29369 | }
|
29370 | mult = easer(mult);
|
29371 | }
|
29372 | return mult*this.a.v;
|
29373 | },
|
29374 | getValue: function(newCharsFlag) {
|
29375 | this.iterateDynamicProperties();
|
29376 | this._mdf = newCharsFlag || this._mdf;
|
29377 | this._currentTextLength = this.elem.textProperty.currentData.l.length || 0;
|
29378 | if(newCharsFlag && this.data.r === 2) {
|
29379 | this.e.v = this._currentTextLength;
|
29380 | }
|
29381 | var divisor = this.data.r === 2 ? 1 : 100 / this.data.totalChars;
|
29382 | var o = this.o.v/divisor;
|
29383 | var s = this.s.v/divisor + o;
|
29384 | var e = (this.e.v/divisor) + o;
|
29385 | if(s>e){
|
29386 | var _s = s;
|
29387 | s = e;
|
29388 | e = _s;
|
29389 | }
|
29390 | this.finalS = s;
|
29391 | this.finalE = e;
|
29392 | }
|
29393 | };
|
29394 | extendPrototype([DynamicPropertyContainer], TextSelectorProp);
|
29395 |
|
29396 | function getTextSelectorProp(elem, data,arr) {
|
29397 | return new TextSelectorProp(elem, data, arr);
|
29398 | }
|
29399 |
|
29400 | return {
|
29401 | getTextSelectorProp: getTextSelectorProp
|
29402 | };
|
29403 | }());
|
29404 |
|
29405 |
|
29406 | var pool_factory = (function() {
|
29407 | return function(initialLength, _create, _release, _clone) {
|
29408 |
|
29409 | var _length = 0;
|
29410 | var _maxLength = initialLength;
|
29411 | var pool = createSizedArray(_maxLength);
|
29412 |
|
29413 | var ob = {
|
29414 | newElement: newElement,
|
29415 | release: release
|
29416 | };
|
29417 |
|
29418 | function newElement(){
|
29419 | var element;
|
29420 | if(_length){
|
29421 | _length -= 1;
|
29422 | element = pool[_length];
|
29423 | } else {
|
29424 | element = _create();
|
29425 | }
|
29426 | return element;
|
29427 | }
|
29428 |
|
29429 | function release(element) {
|
29430 | if(_length === _maxLength) {
|
29431 | pool = pooling.double(pool);
|
29432 | _maxLength = _maxLength*2;
|
29433 | }
|
29434 | if (_release) {
|
29435 | _release(element);
|
29436 | }
|
29437 | pool[_length] = element;
|
29438 | _length += 1;
|
29439 | }
|
29440 |
|
29441 | return ob;
|
29442 | };
|
29443 | }());
|
29444 |
|
29445 | var pooling = (function(){
|
29446 |
|
29447 | function double(arr){
|
29448 | return arr.concat(createSizedArray(arr.length));
|
29449 | }
|
29450 |
|
29451 | return {
|
29452 | double: double
|
29453 | };
|
29454 | }());
|
29455 | var point_pool = (function(){
|
29456 |
|
29457 | function create() {
|
29458 | return createTypedArray('float32', 2);
|
29459 | }
|
29460 | return pool_factory(8, create);
|
29461 | }());
|
29462 | var shape_pool = (function(){
|
29463 |
|
29464 | function create() {
|
29465 | return new ShapePath();
|
29466 | }
|
29467 |
|
29468 | function release(shapePath) {
|
29469 | var len = shapePath._length, i;
|
29470 | for(i = 0; i < len; i += 1) {
|
29471 | point_pool.release(shapePath.v[i]);
|
29472 | point_pool.release(shapePath.i[i]);
|
29473 | point_pool.release(shapePath.o[i]);
|
29474 | shapePath.v[i] = null;
|
29475 | shapePath.i[i] = null;
|
29476 | shapePath.o[i] = null;
|
29477 | }
|
29478 | shapePath._length = 0;
|
29479 | shapePath.c = false;
|
29480 | }
|
29481 |
|
29482 | function clone(shape) {
|
29483 | var cloned = factory.newElement();
|
29484 | var i, len = shape._length === undefined ? shape.v.length : shape._length;
|
29485 | cloned.setLength(len);
|
29486 | cloned.c = shape.c;
|
29487 |
|
29488 | for(i = 0; i < len; i += 1) {
|
29489 | cloned.setTripleAt(shape.v[i][0],shape.v[i][1],shape.o[i][0],shape.o[i][1],shape.i[i][0],shape.i[i][1], i);
|
29490 | }
|
29491 | return cloned;
|
29492 | }
|
29493 |
|
29494 | var factory = pool_factory(4, create, release);
|
29495 | factory.clone = clone;
|
29496 |
|
29497 | return factory;
|
29498 | }());
|
29499 | var shapeCollection_pool = (function(){
|
29500 | var ob = {
|
29501 | newShapeCollection: newShapeCollection,
|
29502 | release: release
|
29503 | };
|
29504 |
|
29505 | var _length = 0;
|
29506 | var _maxLength = 4;
|
29507 | var pool = createSizedArray(_maxLength);
|
29508 |
|
29509 | function newShapeCollection(){
|
29510 | var shapeCollection;
|
29511 | if(_length){
|
29512 | _length -= 1;
|
29513 | shapeCollection = pool[_length];
|
29514 | } else {
|
29515 | shapeCollection = new ShapeCollection();
|
29516 | }
|
29517 | return shapeCollection;
|
29518 | }
|
29519 |
|
29520 | function release(shapeCollection) {
|
29521 | var i, len = shapeCollection._length;
|
29522 | for(i = 0; i < len; i += 1) {
|
29523 | shape_pool.release(shapeCollection.shapes[i]);
|
29524 | }
|
29525 | shapeCollection._length = 0;
|
29526 |
|
29527 | if(_length === _maxLength) {
|
29528 | pool = pooling.double(pool);
|
29529 | _maxLength = _maxLength*2;
|
29530 | }
|
29531 | pool[_length] = shapeCollection;
|
29532 | _length += 1;
|
29533 | }
|
29534 |
|
29535 | return ob;
|
29536 | }());
|
29537 | var segments_length_pool = (function(){
|
29538 |
|
29539 | function create() {
|
29540 | return {
|
29541 | lengths: [],
|
29542 | totalLength: 0
|
29543 | };
|
29544 | }
|
29545 |
|
29546 | function release(element) {
|
29547 | var i, len = element.lengths.length;
|
29548 | for(i=0;i<len;i+=1) {
|
29549 | bezier_length_pool.release(element.lengths[i]);
|
29550 | }
|
29551 | element.lengths.length = 0;
|
29552 | }
|
29553 |
|
29554 | return pool_factory(8, create, release);
|
29555 | }());
|
29556 | var bezier_length_pool = (function(){
|
29557 |
|
29558 | function create() {
|
29559 | return {
|
29560 | addedLength: 0,
|
29561 | percents: createTypedArray('float32', defaultCurveSegments),
|
29562 | lengths: createTypedArray('float32', defaultCurveSegments),
|
29563 | };
|
29564 | }
|
29565 | return pool_factory(8, create);
|
29566 | }());
|
29567 | function BaseRenderer(){}
|
29568 | BaseRenderer.prototype.checkLayers = function(num){
|
29569 | var i, len = this.layers.length, data;
|
29570 | this.completeLayers = true;
|
29571 | for (i = len - 1; i >= 0; i--) {
|
29572 | if (!this.elements[i]) {
|
29573 | data = this.layers[i];
|
29574 | if(data.ip - data.st <= (num - this.layers[i].st) && data.op - data.st > (num - this.layers[i].st))
|
29575 | {
|
29576 | this.buildItem(i);
|
29577 | }
|
29578 | }
|
29579 | this.completeLayers = this.elements[i] ? this.completeLayers:false;
|
29580 | }
|
29581 | this.checkPendingElements();
|
29582 | };
|
29583 |
|
29584 | BaseRenderer.prototype.createItem = function(layer){
|
29585 | switch(layer.ty){
|
29586 | case 2:
|
29587 | return this.createImage(layer);
|
29588 | case 0:
|
29589 | return this.createComp(layer);
|
29590 | case 1:
|
29591 | return this.createSolid(layer);
|
29592 | case 3:
|
29593 | return this.createNull(layer);
|
29594 | case 4:
|
29595 | return this.createShape(layer);
|
29596 | case 5:
|
29597 | return this.createText(layer);
|
29598 | case 13:
|
29599 | return this.createCamera(layer);
|
29600 | }
|
29601 | return this.createNull(layer);
|
29602 | };
|
29603 |
|
29604 | BaseRenderer.prototype.createCamera = function(){
|
29605 | throw new Error('You\'re using a 3d camera. Try the html renderer.');
|
29606 | };
|
29607 |
|
29608 | BaseRenderer.prototype.buildAllItems = function(){
|
29609 | var i, len = this.layers.length;
|
29610 | for(i=0;i<len;i+=1){
|
29611 | this.buildItem(i);
|
29612 | }
|
29613 | this.checkPendingElements();
|
29614 | };
|
29615 |
|
29616 | BaseRenderer.prototype.includeLayers = function(newLayers){
|
29617 | this.completeLayers = false;
|
29618 | var i, len = newLayers.length;
|
29619 | var j, jLen = this.layers.length;
|
29620 | for(i=0;i<len;i+=1){
|
29621 | j = 0;
|
29622 | while(j<jLen){
|
29623 | if(this.layers[j].id == newLayers[i].id){
|
29624 | this.layers[j] = newLayers[i];
|
29625 | break;
|
29626 | }
|
29627 | j += 1;
|
29628 | }
|
29629 | }
|
29630 | };
|
29631 |
|
29632 | BaseRenderer.prototype.setProjectInterface = function(pInterface){
|
29633 | this.globalData.projectInterface = pInterface;
|
29634 | };
|
29635 |
|
29636 | BaseRenderer.prototype.initItems = function(){
|
29637 | if(!this.globalData.progressiveLoad){
|
29638 | this.buildAllItems();
|
29639 | }
|
29640 | };
|
29641 | BaseRenderer.prototype.buildElementParenting = function(element, parentName, hierarchy) {
|
29642 | var elements = this.elements;
|
29643 | var layers = this.layers;
|
29644 | var i=0, len = layers.length;
|
29645 | while (i < len) {
|
29646 | if (layers[i].ind == parentName) {
|
29647 | if (!elements[i] || elements[i] === true) {
|
29648 | this.buildItem(i);
|
29649 | this.addPendingElement(element);
|
29650 | } else {
|
29651 | hierarchy.push(elements[i]);
|
29652 | elements[i].setAsParent();
|
29653 | if(layers[i].parent !== undefined) {
|
29654 | this.buildElementParenting(element, layers[i].parent, hierarchy);
|
29655 | } else {
|
29656 | element.setHierarchy(hierarchy);
|
29657 | }
|
29658 | }
|
29659 | }
|
29660 | i += 1;
|
29661 | }
|
29662 | };
|
29663 |
|
29664 | BaseRenderer.prototype.addPendingElement = function(element){
|
29665 | this.pendingElements.push(element);
|
29666 | };
|
29667 |
|
29668 | BaseRenderer.prototype.searchExtraCompositions = function(assets){
|
29669 | var i, len = assets.length;
|
29670 | for(i=0;i<len;i+=1){
|
29671 | if(assets[i].xt){
|
29672 | var comp = this.createComp(assets[i]);
|
29673 | comp.initExpressions();
|
29674 | this.globalData.projectInterface.registerComposition(comp);
|
29675 | }
|
29676 | }
|
29677 | };
|
29678 |
|
29679 | BaseRenderer.prototype.setupGlobalData = function(animData, fontsContainer) {
|
29680 | this.globalData.fontManager = new FontManager();
|
29681 | this.globalData.fontManager.addChars(animData.chars);
|
29682 | this.globalData.fontManager.addFonts(animData.fonts, fontsContainer);
|
29683 | this.globalData.getAssetData = this.animationItem.getAssetData.bind(this.animationItem);
|
29684 | this.globalData.getAssetsPath = this.animationItem.getAssetsPath.bind(this.animationItem);
|
29685 | this.globalData.imageLoader = this.animationItem.imagePreloader;
|
29686 | this.globalData.frameId = 0;
|
29687 | this.globalData.frameRate = animData.fr;
|
29688 | this.globalData.nm = animData.nm;
|
29689 | this.globalData.compSize = {
|
29690 | w: animData.w,
|
29691 | h: animData.h
|
29692 | };
|
29693 | };
|
29694 | function SVGRenderer(animationItem, config){
|
29695 | this.animationItem = animationItem;
|
29696 | this.layers = null;
|
29697 | this.renderedFrame = -1;
|
29698 | this.svgElement = createNS('svg');
|
29699 | var ariaLabel = '';
|
29700 | if (config && config.title) {
|
29701 | var titleElement = createNS('title');
|
29702 | var titleId = createElementID();
|
29703 | titleElement.setAttribute('id', titleId);
|
29704 | titleElement.textContent = config.title;
|
29705 | this.svgElement.appendChild(titleElement);
|
29706 | ariaLabel += titleId;
|
29707 | }
|
29708 | if (config && config.description) {
|
29709 | var descElement = createNS('desc');
|
29710 | var descId = createElementID();
|
29711 | descElement.setAttribute('id', descId);
|
29712 | descElement.textContent = config.description;
|
29713 | this.svgElement.appendChild(descElement);
|
29714 | ariaLabel += ' ' + descId;
|
29715 | }
|
29716 | if (ariaLabel) {
|
29717 | this.svgElement.setAttribute('aria-labelledby', ariaLabel);
|
29718 | }
|
29719 | var defs = createNS( 'defs');
|
29720 | this.svgElement.appendChild(defs);
|
29721 | var maskElement = createNS('g');
|
29722 | this.svgElement.appendChild(maskElement);
|
29723 | this.layerElement = maskElement;
|
29724 | this.renderConfig = {
|
29725 | preserveAspectRatio: (config && config.preserveAspectRatio) || 'xMidYMid meet',
|
29726 | imagePreserveAspectRatio: (config && config.imagePreserveAspectRatio) || 'xMidYMid slice',
|
29727 | progressiveLoad: (config && config.progressiveLoad) || false,
|
29728 | hideOnTransparent: (config && config.hideOnTransparent === false) ? false : true,
|
29729 | viewBoxOnly: (config && config.viewBoxOnly) || false,
|
29730 | viewBoxSize: (config && config.viewBoxSize) || false,
|
29731 | className: (config && config.className) || ''
|
29732 | };
|
29733 |
|
29734 | this.globalData = {
|
29735 | _mdf: false,
|
29736 | frameNum: -1,
|
29737 | defs: defs,
|
29738 | renderConfig: this.renderConfig
|
29739 | };
|
29740 | this.elements = [];
|
29741 | this.pendingElements = [];
|
29742 | this.destroyed = false;
|
29743 | this.rendererType = 'svg';
|
29744 |
|
29745 | }
|
29746 |
|
29747 | extendPrototype([BaseRenderer],SVGRenderer);
|
29748 |
|
29749 | SVGRenderer.prototype.createNull = function (data) {
|
29750 | return new NullElement(data,this.globalData,this);
|
29751 | };
|
29752 |
|
29753 | SVGRenderer.prototype.createShape = function (data) {
|
29754 | return new SVGShapeElement(data,this.globalData,this);
|
29755 | };
|
29756 |
|
29757 | SVGRenderer.prototype.createText = function (data) {
|
29758 | return new SVGTextElement(data,this.globalData,this);
|
29759 |
|
29760 | };
|
29761 |
|
29762 | SVGRenderer.prototype.createImage = function (data) {
|
29763 | return new IImageElement(data,this.globalData,this);
|
29764 | };
|
29765 |
|
29766 | SVGRenderer.prototype.createComp = function (data) {
|
29767 | return new SVGCompElement(data,this.globalData,this);
|
29768 |
|
29769 | };
|
29770 |
|
29771 | SVGRenderer.prototype.createSolid = function (data) {
|
29772 | return new ISolidElement(data,this.globalData,this);
|
29773 | };
|
29774 |
|
29775 | SVGRenderer.prototype.configAnimation = function(animData){
|
29776 | this.svgElement.setAttribute('xmlns','http://www.w3.org/2000/svg');
|
29777 | if(this.renderConfig.viewBoxSize) {
|
29778 | this.svgElement.setAttribute('viewBox',this.renderConfig.viewBoxSize);
|
29779 | } else {
|
29780 | this.svgElement.setAttribute('viewBox','0 0 '+animData.w+' '+animData.h);
|
29781 | }
|
29782 |
|
29783 | if(!this.renderConfig.viewBoxOnly) {
|
29784 | this.svgElement.setAttribute('width',animData.w);
|
29785 | this.svgElement.setAttribute('height',animData.h);
|
29786 | this.svgElement.style.width = '100%';
|
29787 | this.svgElement.style.height = '100%';
|
29788 | this.svgElement.style.transform = 'translate3d(0,0,0)';
|
29789 | }
|
29790 | if(this.renderConfig.className) {
|
29791 | this.svgElement.setAttribute('class', this.renderConfig.className);
|
29792 | }
|
29793 | this.svgElement.setAttribute('preserveAspectRatio',this.renderConfig.preserveAspectRatio);
|
29794 | //this.layerElement.style.transform = 'translate3d(0,0,0)';
|
29795 | //this.layerElement.style.transformOrigin = this.layerElement.style.mozTransformOrigin = this.layerElement.style.webkitTransformOrigin = this.layerElement.style['-webkit-transform'] = "0px 0px 0px";
|
29796 | this.animationItem.wrapper.appendChild(this.svgElement);
|
29797 | //Mask animation
|
29798 | var defs = this.globalData.defs;
|
29799 |
|
29800 | this.setupGlobalData(animData, defs);
|
29801 | this.globalData.progressiveLoad = this.renderConfig.progressiveLoad;
|
29802 | this.data = animData;
|
29803 |
|
29804 | var maskElement = createNS( 'clipPath');
|
29805 | var rect = createNS('rect');
|
29806 | rect.setAttribute('width',animData.w);
|
29807 | rect.setAttribute('height',animData.h);
|
29808 | rect.setAttribute('x',0);
|
29809 | rect.setAttribute('y',0);
|
29810 | var maskId = createElementID();
|
29811 | maskElement.setAttribute('id', maskId);
|
29812 | maskElement.appendChild(rect);
|
29813 | this.layerElement.setAttribute("clip-path", "url(" + locationHref + "#"+maskId+")");
|
29814 |
|
29815 | defs.appendChild(maskElement);
|
29816 | this.layers = animData.layers;
|
29817 | this.elements = createSizedArray(animData.layers.length);
|
29818 | };
|
29819 |
|
29820 |
|
29821 | SVGRenderer.prototype.destroy = function () {
|
29822 | this.animationItem.wrapper.innerHTML = '';
|
29823 | this.layerElement = null;
|
29824 | this.globalData.defs = null;
|
29825 | var i, len = this.layers ? this.layers.length : 0;
|
29826 | for (i = 0; i < len; i++) {
|
29827 | if(this.elements[i]){
|
29828 | this.elements[i].destroy();
|
29829 | }
|
29830 | }
|
29831 | this.elements.length = 0;
|
29832 | this.destroyed = true;
|
29833 | this.animationItem = null;
|
29834 | };
|
29835 |
|
29836 | SVGRenderer.prototype.updateContainerSize = function () {
|
29837 | };
|
29838 |
|
29839 | SVGRenderer.prototype.buildItem = function(pos){
|
29840 | var elements = this.elements;
|
29841 | if(elements[pos] || this.layers[pos].ty == 99){
|
29842 | return;
|
29843 | }
|
29844 | elements[pos] = true;
|
29845 | var element = this.createItem(this.layers[pos]);
|
29846 |
|
29847 | elements[pos] = element;
|
29848 | if(expressionsPlugin){
|
29849 | if(this.layers[pos].ty === 0){
|
29850 | this.globalData.projectInterface.registerComposition(element);
|
29851 | }
|
29852 | element.initExpressions();
|
29853 | }
|
29854 | this.appendElementInPos(element,pos);
|
29855 | if(this.layers[pos].tt){
|
29856 | if(!this.elements[pos - 1] || this.elements[pos - 1] === true){
|
29857 | this.buildItem(pos - 1);
|
29858 | this.addPendingElement(element);
|
29859 | } else {
|
29860 | element.setMatte(elements[pos - 1].layerId);
|
29861 | }
|
29862 | }
|
29863 | };
|
29864 |
|
29865 | SVGRenderer.prototype.checkPendingElements = function(){
|
29866 | while(this.pendingElements.length){
|
29867 | var element = this.pendingElements.pop();
|
29868 | element.checkParenting();
|
29869 | if(element.data.tt){
|
29870 | var i = 0, len = this.elements.length;
|
29871 | while(i<len){
|
29872 | if(this.elements[i] === element){
|
29873 | element.setMatte(this.elements[i - 1].layerId);
|
29874 | break;
|
29875 | }
|
29876 | i += 1;
|
29877 | }
|
29878 | }
|
29879 | }
|
29880 | };
|
29881 |
|
29882 | SVGRenderer.prototype.renderFrame = function(num){
|
29883 | if(this.renderedFrame === num || this.destroyed){
|
29884 | return;
|
29885 | }
|
29886 | if(num === null){
|
29887 | num = this.renderedFrame;
|
29888 | }else{
|
29889 | this.renderedFrame = num;
|
29890 | }
|
29891 | // console.log('-------');
|
29892 | // console.log('FRAME ',num);
|
29893 | this.globalData.frameNum = num;
|
29894 | this.globalData.frameId += 1;
|
29895 | this.globalData.projectInterface.currentFrame = num;
|
29896 | this.globalData._mdf = false;
|
29897 | var i, len = this.layers.length;
|
29898 | if(!this.completeLayers){
|
29899 | this.checkLayers(num);
|
29900 | }
|
29901 | for (i = len - 1; i >= 0; i--) {
|
29902 | if(this.completeLayers || this.elements[i]){
|
29903 | this.elements[i].prepareFrame(num - this.layers[i].st);
|
29904 | }
|
29905 | }
|
29906 | if(this.globalData._mdf) {
|
29907 | for (i = 0; i < len; i += 1) {
|
29908 | if(this.completeLayers || this.elements[i]){
|
29909 | this.elements[i].renderFrame();
|
29910 | }
|
29911 | }
|
29912 | }
|
29913 | };
|
29914 |
|
29915 | SVGRenderer.prototype.appendElementInPos = function(element, pos){
|
29916 | var newElement = element.getBaseElement();
|
29917 | if(!newElement){
|
29918 | return;
|
29919 | }
|
29920 | var i = 0;
|
29921 | var nextElement;
|
29922 | while(i<pos){
|
29923 | if(this.elements[i] && this.elements[i]!== true && this.elements[i].getBaseElement()){
|
29924 | nextElement = this.elements[i].getBaseElement();
|
29925 | }
|
29926 | i += 1;
|
29927 | }
|
29928 | if(nextElement){
|
29929 | this.layerElement.insertBefore(newElement, nextElement);
|
29930 | } else {
|
29931 | this.layerElement.appendChild(newElement);
|
29932 | }
|
29933 | };
|
29934 |
|
29935 | SVGRenderer.prototype.hide = function(){
|
29936 | this.layerElement.style.display = 'none';
|
29937 | };
|
29938 |
|
29939 | SVGRenderer.prototype.show = function(){
|
29940 | this.layerElement.style.display = 'block';
|
29941 | };
|
29942 |
|
29943 | function CanvasRenderer(animationItem, config){
|
29944 | this.animationItem = animationItem;
|
29945 | this.renderConfig = {
|
29946 | clearCanvas: (config && config.clearCanvas !== undefined) ? config.clearCanvas : true,
|
29947 | context: (config && config.context) || null,
|
29948 | progressiveLoad: (config && config.progressiveLoad) || false,
|
29949 | preserveAspectRatio: (config && config.preserveAspectRatio) || 'xMidYMid meet',
|
29950 | imagePreserveAspectRatio: (config && config.imagePreserveAspectRatio) || 'xMidYMid slice',
|
29951 | className: (config && config.className) || ''
|
29952 | };
|
29953 | this.renderConfig.dpr = (config && config.dpr) || 1;
|
29954 | if (this.animationItem.wrapper) {
|
29955 | this.renderConfig.dpr = (config && config.dpr) || window.devicePixelRatio || 1;
|
29956 | }
|
29957 | this.renderedFrame = -1;
|
29958 | this.globalData = {
|
29959 | frameNum: -1,
|
29960 | _mdf: false,
|
29961 | renderConfig: this.renderConfig,
|
29962 | currentGlobalAlpha: -1
|
29963 | };
|
29964 | this.contextData = new CVContextData();
|
29965 | this.elements = [];
|
29966 | this.pendingElements = [];
|
29967 | this.transformMat = new Matrix();
|
29968 | this.completeLayers = false;
|
29969 | this.rendererType = 'canvas';
|
29970 | }
|
29971 | extendPrototype([BaseRenderer],CanvasRenderer);
|
29972 |
|
29973 | CanvasRenderer.prototype.createShape = function (data) {
|
29974 | return new CVShapeElement(data, this.globalData, this);
|
29975 | };
|
29976 |
|
29977 | CanvasRenderer.prototype.createText = function (data) {
|
29978 | return new CVTextElement(data, this.globalData, this);
|
29979 | };
|
29980 |
|
29981 | CanvasRenderer.prototype.createImage = function (data) {
|
29982 | return new CVImageElement(data, this.globalData, this);
|
29983 | };
|
29984 |
|
29985 | CanvasRenderer.prototype.createComp = function (data) {
|
29986 | return new CVCompElement(data, this.globalData, this);
|
29987 | };
|
29988 |
|
29989 | CanvasRenderer.prototype.createSolid = function (data) {
|
29990 | return new CVSolidElement(data, this.globalData, this);
|
29991 | };
|
29992 |
|
29993 | CanvasRenderer.prototype.createNull = SVGRenderer.prototype.createNull;
|
29994 |
|
29995 | CanvasRenderer.prototype.ctxTransform = function(props){
|
29996 | if(props[0] === 1 && props[1] === 0 && props[4] === 0 && props[5] === 1 && props[12] === 0 && props[13] === 0){
|
29997 | return;
|
29998 | }
|
29999 | if(!this.renderConfig.clearCanvas){
|
30000 | this.canvasContext.transform(props[0],props[1],props[4],props[5],props[12],props[13]);
|
30001 | return;
|
30002 | }
|
30003 | this.transformMat.cloneFromProps(props);
|
30004 | var cProps = this.contextData.cTr.props;
|
30005 | this.transformMat.transform(cProps[0],cProps[1],cProps[2],cProps[3],cProps[4],cProps[5],cProps[6],cProps[7],cProps[8],cProps[9],cProps[10],cProps[11],cProps[12],cProps[13],cProps[14],cProps[15]);
|
30006 | //this.contextData.cTr.transform(props[0],props[1],props[2],props[3],props[4],props[5],props[6],props[7],props[8],props[9],props[10],props[11],props[12],props[13],props[14],props[15]);
|
30007 | this.contextData.cTr.cloneFromProps(this.transformMat.props);
|
30008 | var trProps = this.contextData.cTr.props;
|
30009 | this.canvasContext.setTransform(trProps[0],trProps[1],trProps[4],trProps[5],trProps[12],trProps[13]);
|
30010 | };
|
30011 |
|
30012 | CanvasRenderer.prototype.ctxOpacity = function(op){
|
30013 | /*if(op === 1){
|
30014 | return;
|
30015 | }*/
|
30016 | if(!this.renderConfig.clearCanvas){
|
30017 | this.canvasContext.globalAlpha *= op < 0 ? 0 : op;
|
30018 | this.globalData.currentGlobalAlpha = this.contextData.cO;
|
30019 | return;
|
30020 | }
|
30021 | this.contextData.cO *= op < 0 ? 0 : op;
|
30022 | if(this.globalData.currentGlobalAlpha !== this.contextData.cO) {
|
30023 | this.canvasContext.globalAlpha = this.contextData.cO;
|
30024 | this.globalData.currentGlobalAlpha = this.contextData.cO;
|
30025 | }
|
30026 | };
|
30027 |
|
30028 | CanvasRenderer.prototype.reset = function(){
|
30029 | if(!this.renderConfig.clearCanvas){
|
30030 | this.canvasContext.restore();
|
30031 | return;
|
30032 | }
|
30033 | this.contextData.reset();
|
30034 | };
|
30035 |
|
30036 | CanvasRenderer.prototype.save = function(actionFlag){
|
30037 | if(!this.renderConfig.clearCanvas){
|
30038 | this.canvasContext.save();
|
30039 | return;
|
30040 | }
|
30041 | if(actionFlag){
|
30042 | this.canvasContext.save();
|
30043 | }
|
30044 | var props = this.contextData.cTr.props;
|
30045 | if(this.contextData._length <= this.contextData.cArrPos) {
|
30046 | this.contextData.duplicate();
|
30047 | }
|
30048 | var i, arr = this.contextData.saved[this.contextData.cArrPos];
|
30049 | for (i = 0; i < 16; i += 1) {
|
30050 | arr[i] = props[i];
|
30051 | }
|
30052 | this.contextData.savedOp[this.contextData.cArrPos] = this.contextData.cO;
|
30053 | this.contextData.cArrPos += 1;
|
30054 | };
|
30055 |
|
30056 | CanvasRenderer.prototype.restore = function(actionFlag){
|
30057 | if(!this.renderConfig.clearCanvas){
|
30058 | this.canvasContext.restore();
|
30059 | return;
|
30060 | }
|
30061 | if(actionFlag){
|
30062 | this.canvasContext.restore();
|
30063 | this.globalData.blendMode = 'source-over';
|
30064 | }
|
30065 | this.contextData.cArrPos -= 1;
|
30066 | var popped = this.contextData.saved[this.contextData.cArrPos];
|
30067 | var i,arr = this.contextData.cTr.props;
|
30068 | for(i=0;i<16;i+=1){
|
30069 | arr[i] = popped[i];
|
30070 | }
|
30071 | this.canvasContext.setTransform(popped[0],popped[1],popped[4],popped[5],popped[12],popped[13]);
|
30072 | popped = this.contextData.savedOp[this.contextData.cArrPos];
|
30073 | this.contextData.cO = popped;
|
30074 | if(this.globalData.currentGlobalAlpha !== popped) {
|
30075 | this.canvasContext.globalAlpha = popped;
|
30076 | this.globalData.currentGlobalAlpha = popped;
|
30077 | }
|
30078 | };
|
30079 |
|
30080 | CanvasRenderer.prototype.configAnimation = function(animData){
|
30081 | if(this.animationItem.wrapper){
|
30082 | this.animationItem.container = createTag('canvas');
|
30083 | this.animationItem.container.style.width = '100%';
|
30084 | this.animationItem.container.style.height = '100%';
|
30085 | //this.animationItem.container.style.transform = 'translate3d(0,0,0)';
|
30086 | //this.animationItem.container.style.webkitTransform = 'translate3d(0,0,0)';
|
30087 | this.animationItem.container.style.transformOrigin = this.animationItem.container.style.mozTransformOrigin = this.animationItem.container.style.webkitTransformOrigin = this.animationItem.container.style['-webkit-transform'] = "0px 0px 0px";
|
30088 | this.animationItem.wrapper.appendChild(this.animationItem.container);
|
30089 | this.canvasContext = this.animationItem.container.getContext('2d');
|
30090 | if(this.renderConfig.className) {
|
30091 | this.animationItem.container.setAttribute('class', this.renderConfig.className);
|
30092 | }
|
30093 | }else{
|
30094 | this.canvasContext = this.renderConfig.context;
|
30095 | }
|
30096 | this.data = animData;
|
30097 | this.layers = animData.layers;
|
30098 | this.transformCanvas = {
|
30099 | w: animData.w,
|
30100 | h:animData.h,
|
30101 | sx:0,
|
30102 | sy:0,
|
30103 | tx:0,
|
30104 | ty:0
|
30105 | };
|
30106 | this.setupGlobalData(animData, document.body);
|
30107 | this.globalData.canvasContext = this.canvasContext;
|
30108 | this.globalData.renderer = this;
|
30109 | this.globalData.isDashed = false;
|
30110 | this.globalData.progressiveLoad = this.renderConfig.progressiveLoad;
|
30111 | this.globalData.transformCanvas = this.transformCanvas;
|
30112 | this.elements = createSizedArray(animData.layers.length);
|
30113 |
|
30114 | this.updateContainerSize();
|
30115 | };
|
30116 |
|
30117 | CanvasRenderer.prototype.updateContainerSize = function () {
|
30118 | this.reset();
|
30119 | var elementWidth,elementHeight;
|
30120 | if(this.animationItem.wrapper && this.animationItem.container){
|
30121 | elementWidth = this.animationItem.wrapper.offsetWidth;
|
30122 | elementHeight = this.animationItem.wrapper.offsetHeight;
|
30123 | this.animationItem.container.setAttribute('width',elementWidth * this.renderConfig.dpr );
|
30124 | this.animationItem.container.setAttribute('height',elementHeight * this.renderConfig.dpr);
|
30125 | }else{
|
30126 | elementWidth = this.canvasContext.canvas.width * this.renderConfig.dpr;
|
30127 | elementHeight = this.canvasContext.canvas.height * this.renderConfig.dpr;
|
30128 | }
|
30129 | var elementRel,animationRel;
|
30130 | if(this.renderConfig.preserveAspectRatio.indexOf('meet') !== -1 || this.renderConfig.preserveAspectRatio.indexOf('slice') !== -1){
|
30131 | var par = this.renderConfig.preserveAspectRatio.split(' ');
|
30132 | var fillType = par[1] || 'meet';
|
30133 | var pos = par[0] || 'xMidYMid';
|
30134 | var xPos = pos.substr(0,4);
|
30135 | var yPos = pos.substr(4);
|
30136 | elementRel = elementWidth/elementHeight;
|
30137 | animationRel = this.transformCanvas.w/this.transformCanvas.h;
|
30138 | if(animationRel>elementRel && fillType === 'meet' || animationRel<elementRel && fillType === 'slice'){
|
30139 | this.transformCanvas.sx = elementWidth/(this.transformCanvas.w/this.renderConfig.dpr);
|
30140 | this.transformCanvas.sy = elementWidth/(this.transformCanvas.w/this.renderConfig.dpr);
|
30141 | }else{
|
30142 | this.transformCanvas.sx = elementHeight/(this.transformCanvas.h / this.renderConfig.dpr);
|
30143 | this.transformCanvas.sy = elementHeight/(this.transformCanvas.h / this.renderConfig.dpr);
|
30144 | }
|
30145 |
|
30146 | if(xPos === 'xMid' && ((animationRel<elementRel && fillType==='meet') || (animationRel>elementRel && fillType === 'slice'))){
|
30147 | this.transformCanvas.tx = (elementWidth-this.transformCanvas.w*(elementHeight/this.transformCanvas.h))/2*this.renderConfig.dpr;
|
30148 | } else if(xPos === 'xMax' && ((animationRel<elementRel && fillType==='meet') || (animationRel>elementRel && fillType === 'slice'))){
|
30149 | this.transformCanvas.tx = (elementWidth-this.transformCanvas.w*(elementHeight/this.transformCanvas.h))*this.renderConfig.dpr;
|
30150 | } else {
|
30151 | this.transformCanvas.tx = 0;
|
30152 | }
|
30153 | if(yPos === 'YMid' && ((animationRel>elementRel && fillType==='meet') || (animationRel<elementRel && fillType === 'slice'))){
|
30154 | this.transformCanvas.ty = ((elementHeight-this.transformCanvas.h*(elementWidth/this.transformCanvas.w))/2)*this.renderConfig.dpr;
|
30155 | } else if(yPos === 'YMax' && ((animationRel>elementRel && fillType==='meet') || (animationRel<elementRel && fillType === 'slice'))){
|
30156 | this.transformCanvas.ty = ((elementHeight-this.transformCanvas.h*(elementWidth/this.transformCanvas.w)))*this.renderConfig.dpr;
|
30157 | } else {
|
30158 | this.transformCanvas.ty = 0;
|
30159 | }
|
30160 |
|
30161 | }else if(this.renderConfig.preserveAspectRatio == 'none'){
|
30162 | this.transformCanvas.sx = elementWidth/(this.transformCanvas.w/this.renderConfig.dpr);
|
30163 | this.transformCanvas.sy = elementHeight/(this.transformCanvas.h/this.renderConfig.dpr);
|
30164 | this.transformCanvas.tx = 0;
|
30165 | this.transformCanvas.ty = 0;
|
30166 | }else{
|
30167 | this.transformCanvas.sx = this.renderConfig.dpr;
|
30168 | this.transformCanvas.sy = this.renderConfig.dpr;
|
30169 | this.transformCanvas.tx = 0;
|
30170 | this.transformCanvas.ty = 0;
|
30171 | }
|
30172 | this.transformCanvas.props = [this.transformCanvas.sx,0,0,0,0,this.transformCanvas.sy,0,0,0,0,1,0,this.transformCanvas.tx,this.transformCanvas.ty,0,1];
|
30173 | /*var i, len = this.elements.length;
|
30174 | for(i=0;i<len;i+=1){
|
30175 | if(this.elements[i] && this.elements[i].data.ty === 0){
|
30176 | this.elements[i].resize(this.globalData.transformCanvas);
|
30177 | }
|
30178 | }*/
|
30179 | this.ctxTransform(this.transformCanvas.props);
|
30180 | this.canvasContext.beginPath();
|
30181 | this.canvasContext.rect(0,0,this.transformCanvas.w,this.transformCanvas.h);
|
30182 | this.canvasContext.closePath();
|
30183 | this.canvasContext.clip();
|
30184 |
|
30185 | this.renderFrame(this.renderedFrame, true);
|
30186 | };
|
30187 |
|
30188 | CanvasRenderer.prototype.destroy = function () {
|
30189 | if(this.renderConfig.clearCanvas) {
|
30190 | this.animationItem.wrapper.innerHTML = '';
|
30191 | }
|
30192 | var i, len = this.layers ? this.layers.length : 0;
|
30193 | for (i = len - 1; i >= 0; i-=1) {
|
30194 | if(this.elements[i]) {
|
30195 | this.elements[i].destroy();
|
30196 | }
|
30197 | }
|
30198 | this.elements.length = 0;
|
30199 | this.globalData.canvasContext = null;
|
30200 | this.animationItem.container = null;
|
30201 | this.destroyed = true;
|
30202 | };
|
30203 |
|
30204 | CanvasRenderer.prototype.renderFrame = function(num, forceRender){
|
30205 | if((this.renderedFrame === num && this.renderConfig.clearCanvas === true && !forceRender) || this.destroyed || num === -1){
|
30206 | return;
|
30207 | }
|
30208 | this.renderedFrame = num;
|
30209 | this.globalData.frameNum = num - this.animationItem._isFirstFrame;
|
30210 | this.globalData.frameId += 1;
|
30211 | this.globalData._mdf = !this.renderConfig.clearCanvas || forceRender;
|
30212 | this.globalData.projectInterface.currentFrame = num;
|
30213 |
|
30214 | // console.log('--------');
|
30215 | // console.log('NEW: ',num);
|
30216 | var i, len = this.layers.length;
|
30217 | if(!this.completeLayers){
|
30218 | this.checkLayers(num);
|
30219 | }
|
30220 |
|
30221 | for (i = 0; i < len; i++) {
|
30222 | if(this.completeLayers || this.elements[i]){
|
30223 | this.elements[i].prepareFrame(num - this.layers[i].st);
|
30224 | }
|
30225 | }
|
30226 | if(this.globalData._mdf) {
|
30227 | if(this.renderConfig.clearCanvas === true){
|
30228 | this.canvasContext.clearRect(0, 0, this.transformCanvas.w, this.transformCanvas.h);
|
30229 | }else{
|
30230 | this.save();
|
30231 | }
|
30232 | for (i = len - 1; i >= 0; i-=1) {
|
30233 | if(this.completeLayers || this.elements[i]){
|
30234 | this.elements[i].renderFrame();
|
30235 | }
|
30236 | }
|
30237 | if(this.renderConfig.clearCanvas !== true){
|
30238 | this.restore();
|
30239 | }
|
30240 | }
|
30241 | };
|
30242 |
|
30243 | CanvasRenderer.prototype.buildItem = function(pos){
|
30244 | var elements = this.elements;
|
30245 | if(elements[pos] || this.layers[pos].ty == 99){
|
30246 | return;
|
30247 | }
|
30248 | var element = this.createItem(this.layers[pos], this,this.globalData);
|
30249 | elements[pos] = element;
|
30250 | element.initExpressions();
|
30251 | /*if(this.layers[pos].ty === 0){
|
30252 | element.resize(this.globalData.transformCanvas);
|
30253 | }*/
|
30254 | };
|
30255 |
|
30256 | CanvasRenderer.prototype.checkPendingElements = function(){
|
30257 | while(this.pendingElements.length){
|
30258 | var element = this.pendingElements.pop();
|
30259 | element.checkParenting();
|
30260 | }
|
30261 | };
|
30262 |
|
30263 | CanvasRenderer.prototype.hide = function(){
|
30264 | this.animationItem.container.style.display = 'none';
|
30265 | };
|
30266 |
|
30267 | CanvasRenderer.prototype.show = function(){
|
30268 | this.animationItem.container.style.display = 'block';
|
30269 | };
|
30270 |
|
30271 | function HybridRenderer(animationItem, config){
|
30272 | this.animationItem = animationItem;
|
30273 | this.layers = null;
|
30274 | this.renderedFrame = -1;
|
30275 | this.renderConfig = {
|
30276 | className: (config && config.className) || '',
|
30277 | imagePreserveAspectRatio: (config && config.imagePreserveAspectRatio) || 'xMidYMid slice',
|
30278 | hideOnTransparent: (config && config.hideOnTransparent === false) ? false : true
|
30279 | };
|
30280 | this.globalData = {
|
30281 | _mdf: false,
|
30282 | frameNum: -1,
|
30283 | renderConfig: this.renderConfig
|
30284 | };
|
30285 | this.pendingElements = [];
|
30286 | this.elements = [];
|
30287 | this.threeDElements = [];
|
30288 | this.destroyed = false;
|
30289 | this.camera = null;
|
30290 | this.supports3d = true;
|
30291 | this.rendererType = 'html';
|
30292 |
|
30293 | }
|
30294 |
|
30295 | extendPrototype([BaseRenderer],HybridRenderer);
|
30296 |
|
30297 | HybridRenderer.prototype.buildItem = SVGRenderer.prototype.buildItem;
|
30298 |
|
30299 | HybridRenderer.prototype.checkPendingElements = function(){
|
30300 | while(this.pendingElements.length){
|
30301 | var element = this.pendingElements.pop();
|
30302 | element.checkParenting();
|
30303 | }
|
30304 | };
|
30305 |
|
30306 | HybridRenderer.prototype.appendElementInPos = function(element, pos){
|
30307 | var newDOMElement = element.getBaseElement();
|
30308 | if(!newDOMElement){
|
30309 | return;
|
30310 | }
|
30311 | var layer = this.layers[pos];
|
30312 | if(!layer.ddd || !this.supports3d){
|
30313 | if(this.threeDElements) {
|
30314 | this.addTo3dContainer(newDOMElement,pos);
|
30315 | } else {
|
30316 | var i = 0;
|
30317 | var nextDOMElement, nextLayer, tmpDOMElement;
|
30318 | while(i<pos){
|
30319 | if(this.elements[i] && this.elements[i]!== true && this.elements[i].getBaseElement){
|
30320 | nextLayer = this.elements[i];
|
30321 | tmpDOMElement = this.layers[i].ddd ? this.getThreeDContainerByPos(i) : nextLayer.getBaseElement();
|
30322 | nextDOMElement = tmpDOMElement || nextDOMElement;
|
30323 | }
|
30324 | i += 1;
|
30325 | }
|
30326 | if(nextDOMElement){
|
30327 | if(!layer.ddd || !this.supports3d){
|
30328 | this.layerElement.insertBefore(newDOMElement, nextDOMElement);
|
30329 | }
|
30330 | } else {
|
30331 | if(!layer.ddd || !this.supports3d){
|
30332 | this.layerElement.appendChild(newDOMElement);
|
30333 | }
|
30334 | }
|
30335 | }
|
30336 |
|
30337 | } else {
|
30338 | this.addTo3dContainer(newDOMElement,pos);
|
30339 | }
|
30340 | };
|
30341 |
|
30342 | HybridRenderer.prototype.createShape = function (data) {
|
30343 | if(!this.supports3d){
|
30344 | return new SVGShapeElement(data, this.globalData, this);
|
30345 | }
|
30346 | return new HShapeElement(data, this.globalData, this);
|
30347 | };
|
30348 |
|
30349 | HybridRenderer.prototype.createText = function (data) {
|
30350 | if(!this.supports3d){
|
30351 | return new SVGTextElement(data, this.globalData, this);
|
30352 | }
|
30353 | return new HTextElement(data, this.globalData, this);
|
30354 | };
|
30355 |
|
30356 | HybridRenderer.prototype.createCamera = function (data) {
|
30357 | this.camera = new HCameraElement(data, this.globalData, this);
|
30358 | return this.camera;
|
30359 | };
|
30360 |
|
30361 | HybridRenderer.prototype.createImage = function (data) {
|
30362 | if(!this.supports3d){
|
30363 | return new IImageElement(data, this.globalData, this);
|
30364 | }
|
30365 | return new HImageElement(data, this.globalData, this);
|
30366 | };
|
30367 |
|
30368 | HybridRenderer.prototype.createComp = function (data) {
|
30369 | if(!this.supports3d){
|
30370 | return new SVGCompElement(data, this.globalData, this);
|
30371 | }
|
30372 | return new HCompElement(data, this.globalData, this);
|
30373 |
|
30374 | };
|
30375 |
|
30376 | HybridRenderer.prototype.createSolid = function (data) {
|
30377 | if(!this.supports3d){
|
30378 | return new ISolidElement(data, this.globalData, this);
|
30379 | }
|
30380 | return new HSolidElement(data, this.globalData, this);
|
30381 | };
|
30382 |
|
30383 | HybridRenderer.prototype.createNull = SVGRenderer.prototype.createNull;
|
30384 |
|
30385 | HybridRenderer.prototype.getThreeDContainerByPos = function(pos){
|
30386 | var i = 0, len = this.threeDElements.length;
|
30387 | while(i<len) {
|
30388 | if(this.threeDElements[i].startPos <= pos && this.threeDElements[i].endPos >= pos) {
|
30389 | return this.threeDElements[i].perspectiveElem;
|
30390 | }
|
30391 | i += 1;
|
30392 | }
|
30393 | };
|
30394 |
|
30395 | HybridRenderer.prototype.createThreeDContainer = function(pos, type){
|
30396 | var perspectiveElem = createTag('div');
|
30397 | styleDiv(perspectiveElem);
|
30398 | var container = createTag('div');
|
30399 | styleDiv(container);
|
30400 | if(type === '3d') {
|
30401 | perspectiveElem.style.width = this.globalData.compSize.w+'px';
|
30402 | perspectiveElem.style.height = this.globalData.compSize.h+'px';
|
30403 | perspectiveElem.style.transformOrigin = perspectiveElem.style.mozTransformOrigin = perspectiveElem.style.webkitTransformOrigin = "50% 50%";
|
30404 | container.style.transform = container.style.webkitTransform = 'matrix3d(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)';
|
30405 | }
|
30406 |
|
30407 | perspectiveElem.appendChild(container);
|
30408 | //this.resizerElem.appendChild(perspectiveElem);
|
30409 | var threeDContainerData = {
|
30410 | container:container,
|
30411 | perspectiveElem:perspectiveElem,
|
30412 | startPos: pos,
|
30413 | endPos: pos,
|
30414 | type: type
|
30415 | };
|
30416 | this.threeDElements.push(threeDContainerData);
|
30417 | return threeDContainerData;
|
30418 | };
|
30419 |
|
30420 | HybridRenderer.prototype.build3dContainers = function(){
|
30421 | var i, len = this.layers.length;
|
30422 | var lastThreeDContainerData;
|
30423 | var currentContainer = '';
|
30424 | for(i=0;i<len;i+=1){
|
30425 | if(this.layers[i].ddd && this.layers[i].ty !== 3){
|
30426 | if(currentContainer !== '3d'){
|
30427 | currentContainer = '3d';
|
30428 | lastThreeDContainerData = this.createThreeDContainer(i,'3d');
|
30429 | }
|
30430 | lastThreeDContainerData.endPos = Math.max(lastThreeDContainerData.endPos,i);
|
30431 | } else {
|
30432 | if(currentContainer !== '2d'){
|
30433 | currentContainer = '2d';
|
30434 | lastThreeDContainerData = this.createThreeDContainer(i,'2d');
|
30435 | }
|
30436 | lastThreeDContainerData.endPos = Math.max(lastThreeDContainerData.endPos,i);
|
30437 | }
|
30438 | }
|
30439 | len = this.threeDElements.length;
|
30440 | for(i = len - 1; i >= 0; i --) {
|
30441 | this.resizerElem.appendChild(this.threeDElements[i].perspectiveElem);
|
30442 | }
|
30443 | };
|
30444 |
|
30445 | HybridRenderer.prototype.addTo3dContainer = function(elem,pos){
|
30446 | var i = 0, len = this.threeDElements.length;
|
30447 | while(i<len){
|
30448 | if(pos <= this.threeDElements[i].endPos){
|
30449 | var j = this.threeDElements[i].startPos;
|
30450 | var nextElement;
|
30451 | while(j<pos){
|
30452 | if(this.elements[j] && this.elements[j].getBaseElement){
|
30453 | nextElement = this.elements[j].getBaseElement();
|
30454 | }
|
30455 | j += 1;
|
30456 | }
|
30457 | if(nextElement){
|
30458 | this.threeDElements[i].container.insertBefore(elem, nextElement);
|
30459 | } else {
|
30460 | this.threeDElements[i].container.appendChild(elem);
|
30461 | }
|
30462 | break;
|
30463 | }
|
30464 | i += 1;
|
30465 | }
|
30466 | };
|
30467 |
|
30468 | HybridRenderer.prototype.configAnimation = function(animData){
|
30469 | var resizerElem = createTag('div');
|
30470 | var wrapper = this.animationItem.wrapper;
|
30471 | resizerElem.style.width = animData.w+'px';
|
30472 | resizerElem.style.height = animData.h+'px';
|
30473 | this.resizerElem = resizerElem;
|
30474 | styleDiv(resizerElem);
|
30475 | resizerElem.style.transformStyle = resizerElem.style.webkitTransformStyle = resizerElem.style.mozTransformStyle = "flat";
|
30476 | if(this.renderConfig.className) {
|
30477 | resizerElem.setAttribute('class', this.renderConfig.className);
|
30478 | }
|
30479 | wrapper.appendChild(resizerElem);
|
30480 |
|
30481 | resizerElem.style.overflow = 'hidden';
|
30482 | var svg = createNS('svg');
|
30483 | svg.setAttribute('width','1');
|
30484 | svg.setAttribute('height','1');
|
30485 | styleDiv(svg);
|
30486 | this.resizerElem.appendChild(svg);
|
30487 | var defs = createNS('defs');
|
30488 | svg.appendChild(defs);
|
30489 | this.data = animData;
|
30490 | //Mask animation
|
30491 | this.setupGlobalData(animData, svg);
|
30492 | this.globalData.defs = defs;
|
30493 | this.layers = animData.layers;
|
30494 | this.layerElement = this.resizerElem;
|
30495 | this.build3dContainers();
|
30496 | this.updateContainerSize();
|
30497 | };
|
30498 |
|
30499 | HybridRenderer.prototype.destroy = function () {
|
30500 | this.animationItem.wrapper.innerHTML = '';
|
30501 | this.animationItem.container = null;
|
30502 | this.globalData.defs = null;
|
30503 | var i, len = this.layers ? this.layers.length : 0;
|
30504 | for (i = 0; i < len; i++) {
|
30505 | this.elements[i].destroy();
|
30506 | }
|
30507 | this.elements.length = 0;
|
30508 | this.destroyed = true;
|
30509 | this.animationItem = null;
|
30510 | };
|
30511 |
|
30512 | HybridRenderer.prototype.updateContainerSize = function () {
|
30513 | var elementWidth = this.animationItem.wrapper.offsetWidth;
|
30514 | var elementHeight = this.animationItem.wrapper.offsetHeight;
|
30515 | var elementRel = elementWidth/elementHeight;
|
30516 | var animationRel = this.globalData.compSize.w/this.globalData.compSize.h;
|
30517 | var sx,sy,tx,ty;
|
30518 | if(animationRel>elementRel){
|
30519 | sx = elementWidth/(this.globalData.compSize.w);
|
30520 | sy = elementWidth/(this.globalData.compSize.w);
|
30521 | tx = 0;
|
30522 | ty = ((elementHeight-this.globalData.compSize.h*(elementWidth/this.globalData.compSize.w))/2);
|
30523 | }else{
|
30524 | sx = elementHeight/(this.globalData.compSize.h);
|
30525 | sy = elementHeight/(this.globalData.compSize.h);
|
30526 | tx = (elementWidth-this.globalData.compSize.w*(elementHeight/this.globalData.compSize.h))/2;
|
30527 | ty = 0;
|
30528 | }
|
30529 | this.resizerElem.style.transform = this.resizerElem.style.webkitTransform = 'matrix3d(' + sx + ',0,0,0,0,'+sy+',0,0,0,0,1,0,'+tx+','+ty+',0,1)';
|
30530 | };
|
30531 |
|
30532 | HybridRenderer.prototype.renderFrame = SVGRenderer.prototype.renderFrame;
|
30533 |
|
30534 | HybridRenderer.prototype.hide = function(){
|
30535 | this.resizerElem.style.display = 'none';
|
30536 | };
|
30537 |
|
30538 | HybridRenderer.prototype.show = function(){
|
30539 | this.resizerElem.style.display = 'block';
|
30540 | };
|
30541 |
|
30542 | HybridRenderer.prototype.initItems = function(){
|
30543 | this.buildAllItems();
|
30544 | if(this.camera){
|
30545 | this.camera.setup();
|
30546 | } else {
|
30547 | var cWidth = this.globalData.compSize.w;
|
30548 | var cHeight = this.globalData.compSize.h;
|
30549 | var i, len = this.threeDElements.length;
|
30550 | for(i=0;i<len;i+=1){
|
30551 | this.threeDElements[i].perspectiveElem.style.perspective = this.threeDElements[i].perspectiveElem.style.webkitPerspective = Math.sqrt(Math.pow(cWidth,2) + Math.pow(cHeight,2)) + 'px';
|
30552 | }
|
30553 | }
|
30554 | };
|
30555 |
|
30556 | HybridRenderer.prototype.searchExtraCompositions = function(assets){
|
30557 | var i, len = assets.length;
|
30558 | var floatingContainer = createTag('div');
|
30559 | for(i=0;i<len;i+=1){
|
30560 | if(assets[i].xt){
|
30561 | var comp = this.createComp(assets[i],floatingContainer,this.globalData.comp,null);
|
30562 | comp.initExpressions();
|
30563 | this.globalData.projectInterface.registerComposition(comp);
|
30564 | }
|
30565 | }
|
30566 | };
|
30567 |
|
30568 | function MaskElement(data,element,globalData) {
|
30569 | this.data = data;
|
30570 | this.element = element;
|
30571 | this.globalData = globalData;
|
30572 | this.storedData = [];
|
30573 | this.masksProperties = this.data.masksProperties || [];
|
30574 | this.maskElement = null;
|
30575 | var defs = this.globalData.defs;
|
30576 | var i, len = this.masksProperties ? this.masksProperties.length : 0;
|
30577 | this.viewData = createSizedArray(len);
|
30578 | this.solidPath = '';
|
30579 |
|
30580 |
|
30581 | var path, properties = this.masksProperties;
|
30582 | var count = 0;
|
30583 | var currentMasks = [];
|
30584 | var j, jLen;
|
30585 | var layerId = createElementID();
|
30586 | var rect, expansor, feMorph,x;
|
30587 | var maskType = 'clipPath', maskRef = 'clip-path';
|
30588 | for (i = 0; i < len; i++) {
|
30589 |
|
30590 | if((properties[i].mode !== 'a' && properties[i].mode !== 'n')|| properties[i].inv || properties[i].o.k !== 100){
|
30591 | maskType = 'mask';
|
30592 | maskRef = 'mask';
|
30593 | }
|
30594 |
|
30595 | if((properties[i].mode == 's' || properties[i].mode == 'i') && count === 0){
|
30596 | rect = createNS( 'rect');
|
30597 | rect.setAttribute('fill', '#ffffff');
|
30598 | rect.setAttribute('width', this.element.comp.data.w || 0);
|
30599 | rect.setAttribute('height', this.element.comp.data.h || 0);
|
30600 | currentMasks.push(rect);
|
30601 | } else {
|
30602 | rect = null;
|
30603 | }
|
30604 |
|
30605 | path = createNS( 'path');
|
30606 | if(properties[i].mode == 'n') {
|
30607 | // TODO move this to a factory or to a constructor
|
30608 | this.viewData[i] = {
|
30609 | op: PropertyFactory.getProp(this.element,properties[i].o,0,0.01,this.element),
|
30610 | prop: ShapePropertyFactory.getShapeProp(this.element,properties[i],3),
|
30611 | elem: path,
|
30612 | lastPath: ''
|
30613 | };
|
30614 | defs.appendChild(path);
|
30615 | continue;
|
30616 | }
|
30617 | count += 1;
|
30618 |
|
30619 | path.setAttribute('fill', properties[i].mode === 's' ? '#000000':'#ffffff');
|
30620 | path.setAttribute('clip-rule','nonzero');
|
30621 | var filterID;
|
30622 |
|
30623 | if (properties[i].x.k !== 0) {
|
30624 | maskType = 'mask';
|
30625 | maskRef = 'mask';
|
30626 | x = PropertyFactory.getProp(this.element,properties[i].x,0,null,this.element);
|
30627 | filterID = createElementID();
|
30628 | expansor = createNS('filter');
|
30629 | expansor.setAttribute('id',filterID);
|
30630 | feMorph = createNS('feMorphology');
|
30631 | feMorph.setAttribute('operator','dilate');
|
30632 | feMorph.setAttribute('in','SourceGraphic');
|
30633 | feMorph.setAttribute('radius','0');
|
30634 | expansor.appendChild(feMorph);
|
30635 | defs.appendChild(expansor);
|
30636 | path.setAttribute('stroke', properties[i].mode === 's' ? '#000000':'#ffffff');
|
30637 | } else {
|
30638 | feMorph = null;
|
30639 | x = null;
|
30640 | }
|
30641 |
|
30642 | // TODO move this to a factory or to a constructor
|
30643 | this.storedData[i] = {
|
30644 | elem: path,
|
30645 | x: x,
|
30646 | expan: feMorph,
|
30647 | lastPath: '',
|
30648 | lastOperator:'',
|
30649 | filterId:filterID,
|
30650 | lastRadius:0
|
30651 | };
|
30652 | if(properties[i].mode == 'i'){
|
30653 | jLen = currentMasks.length;
|
30654 | var g = createNS('g');
|
30655 | for(j=0;j<jLen;j+=1){
|
30656 | g.appendChild(currentMasks[j]);
|
30657 | }
|
30658 | var mask = createNS('mask');
|
30659 | mask.setAttribute('mask-type','alpha');
|
30660 | mask.setAttribute('id',layerId+'_'+count);
|
30661 | mask.appendChild(path);
|
30662 | defs.appendChild(mask);
|
30663 | g.setAttribute('mask','url(' + locationHref + '#'+layerId+'_'+count+')');
|
30664 |
|
30665 | currentMasks.length = 0;
|
30666 | currentMasks.push(g);
|
30667 | }else{
|
30668 | currentMasks.push(path);
|
30669 | }
|
30670 | if(properties[i].inv && !this.solidPath){
|
30671 | this.solidPath = this.createLayerSolidPath();
|
30672 | }
|
30673 | // TODO move this to a factory or to a constructor
|
30674 | this.viewData[i] = {
|
30675 | elem: path,
|
30676 | lastPath: '',
|
30677 | op: PropertyFactory.getProp(this.element,properties[i].o,0,0.01,this.element),
|
30678 | prop:ShapePropertyFactory.getShapeProp(this.element,properties[i],3),
|
30679 | invRect: rect
|
30680 | };
|
30681 | if(!this.viewData[i].prop.k){
|
30682 | this.drawPath(properties[i],this.viewData[i].prop.v,this.viewData[i]);
|
30683 | }
|
30684 | }
|
30685 |
|
30686 | this.maskElement = createNS( maskType);
|
30687 |
|
30688 | len = currentMasks.length;
|
30689 | for(i=0;i<len;i+=1){
|
30690 | this.maskElement.appendChild(currentMasks[i]);
|
30691 | }
|
30692 |
|
30693 | if(count > 0){
|
30694 | this.maskElement.setAttribute('id', layerId);
|
30695 | this.element.maskedElement.setAttribute(maskRef, "url(" + locationHref + "#" + layerId + ")");
|
30696 | defs.appendChild(this.maskElement);
|
30697 | }
|
30698 | if (this.viewData.length) {
|
30699 | this.element.addRenderableComponent(this);
|
30700 | }
|
30701 |
|
30702 | }
|
30703 |
|
30704 | MaskElement.prototype.getMaskProperty = function(pos){
|
30705 | return this.viewData[pos].prop;
|
30706 | };
|
30707 |
|
30708 | MaskElement.prototype.renderFrame = function (isFirstFrame) {
|
30709 | var finalMat = this.element.finalTransform.mat;
|
30710 | var i, len = this.masksProperties.length;
|
30711 | for (i = 0; i < len; i++) {
|
30712 | if(this.viewData[i].prop._mdf || isFirstFrame){
|
30713 | this.drawPath(this.masksProperties[i],this.viewData[i].prop.v,this.viewData[i]);
|
30714 | }
|
30715 | if(this.viewData[i].op._mdf || isFirstFrame){
|
30716 | this.viewData[i].elem.setAttribute('fill-opacity',this.viewData[i].op.v);
|
30717 | }
|
30718 | if(this.masksProperties[i].mode !== 'n'){
|
30719 | if(this.viewData[i].invRect && (this.element.finalTransform.mProp._mdf || isFirstFrame)){
|
30720 | this.viewData[i].invRect.setAttribute('x', -finalMat.props[12]);
|
30721 | this.viewData[i].invRect.setAttribute('y', -finalMat.props[13]);
|
30722 | }
|
30723 | if(this.storedData[i].x && (this.storedData[i].x._mdf || isFirstFrame)){
|
30724 | var feMorph = this.storedData[i].expan;
|
30725 | if(this.storedData[i].x.v < 0){
|
30726 | if(this.storedData[i].lastOperator !== 'erode'){
|
30727 | this.storedData[i].lastOperator = 'erode';
|
30728 | this.storedData[i].elem.setAttribute('filter','url(' + locationHref + '#'+this.storedData[i].filterId+')');
|
30729 | }
|
30730 | feMorph.setAttribute('radius',-this.storedData[i].x.v);
|
30731 | }else{
|
30732 | if(this.storedData[i].lastOperator !== 'dilate'){
|
30733 | this.storedData[i].lastOperator = 'dilate';
|
30734 | this.storedData[i].elem.setAttribute('filter',null);
|
30735 | }
|
30736 | this.storedData[i].elem.setAttribute('stroke-width', this.storedData[i].x.v*2);
|
30737 |
|
30738 | }
|
30739 | }
|
30740 | }
|
30741 | }
|
30742 | };
|
30743 |
|
30744 | MaskElement.prototype.getMaskelement = function () {
|
30745 | return this.maskElement;
|
30746 | };
|
30747 |
|
30748 | MaskElement.prototype.createLayerSolidPath = function(){
|
30749 | var path = 'M0,0 ';
|
30750 | path += ' h' + this.globalData.compSize.w ;
|
30751 | path += ' v' + this.globalData.compSize.h ;
|
30752 | path += ' h-' + this.globalData.compSize.w ;
|
30753 | path += ' v-' + this.globalData.compSize.h + ' ';
|
30754 | return path;
|
30755 | };
|
30756 |
|
30757 | MaskElement.prototype.drawPath = function(pathData,pathNodes,viewData){
|
30758 | var pathString = " M"+pathNodes.v[0][0]+','+pathNodes.v[0][1];
|
30759 | var i, len;
|
30760 | len = pathNodes._length;
|
30761 | for(i=1;i<len;i+=1){
|
30762 | //pathString += " C"+pathNodes.o[i-1][0]+','+pathNodes.o[i-1][1] + " "+pathNodes.i[i][0]+','+pathNodes.i[i][1] + " "+pathNodes.v[i][0]+','+pathNodes.v[i][1];
|
30763 | pathString += " C"+pathNodes.o[i-1][0]+','+pathNodes.o[i-1][1] + " "+pathNodes.i[i][0]+','+pathNodes.i[i][1] + " "+pathNodes.v[i][0]+','+pathNodes.v[i][1];
|
30764 | }
|
30765 | //pathString += " C"+pathNodes.o[i-1][0]+','+pathNodes.o[i-1][1] + " "+pathNodes.i[0][0]+','+pathNodes.i[0][1] + " "+pathNodes.v[0][0]+','+pathNodes.v[0][1];
|
30766 | if(pathNodes.c && len > 1){
|
30767 | pathString += " C"+pathNodes.o[i-1][0]+','+pathNodes.o[i-1][1] + " "+pathNodes.i[0][0]+','+pathNodes.i[0][1] + " "+pathNodes.v[0][0]+','+pathNodes.v[0][1];
|
30768 | }
|
30769 | //pathNodes.__renderedString = pathString;
|
30770 |
|
30771 | if(viewData.lastPath !== pathString){
|
30772 | var pathShapeValue = '';
|
30773 | if(viewData.elem){
|
30774 | if(pathNodes.c){
|
30775 | pathShapeValue = pathData.inv ? this.solidPath + pathString : pathString;
|
30776 | }
|
30777 | viewData.elem.setAttribute('d',pathShapeValue);
|
30778 | }
|
30779 | viewData.lastPath = pathString;
|
30780 | }
|
30781 | };
|
30782 |
|
30783 | MaskElement.prototype.destroy = function(){
|
30784 | this.element = null;
|
30785 | this.globalData = null;
|
30786 | this.maskElement = null;
|
30787 | this.data = null;
|
30788 | this.masksProperties = null;
|
30789 | };
|
30790 |
|
30791 | /**
|
30792 | * @file
|
30793 | * Handles AE's layer parenting property.
|
30794 | *
|
30795 | */
|
30796 |
|
30797 | function HierarchyElement(){}
|
30798 |
|
30799 | HierarchyElement.prototype = {
|
30800 | /**
|
30801 | * @function
|
30802 | * Initializes hierarchy properties
|
30803 | *
|
30804 | */
|
30805 | initHierarchy: function() {
|
30806 | //element's parent list
|
30807 | this.hierarchy = [];
|
30808 | //if element is parent of another layer _isParent will be true
|
30809 | this._isParent = false;
|
30810 | this.checkParenting();
|
30811 | },
|
30812 | /**
|
30813 | * @function
|
30814 | * Sets layer's hierarchy.
|
30815 | * @param {array} hierarch
|
30816 | * layer's parent list
|
30817 | *
|
30818 | */
|
30819 | setHierarchy: function(hierarchy){
|
30820 | this.hierarchy = hierarchy;
|
30821 | },
|
30822 | /**
|
30823 | * @function
|
30824 | * Sets layer as parent.
|
30825 | *
|
30826 | */
|
30827 | setAsParent: function() {
|
30828 | this._isParent = true;
|
30829 | },
|
30830 | /**
|
30831 | * @function
|
30832 | * Searches layer's parenting chain
|
30833 | *
|
30834 | */
|
30835 | checkParenting: function(){
|
30836 | if (this.data.parent !== undefined){
|
30837 | this.comp.buildElementParenting(this, this.data.parent, []);
|
30838 | }
|
30839 | }
|
30840 | };
|
30841 | /**
|
30842 | * @file
|
30843 | * Handles element's layer frame update.
|
30844 | * Checks layer in point and out point
|
30845 | *
|
30846 | */
|
30847 |
|
30848 | function FrameElement(){}
|
30849 |
|
30850 | FrameElement.prototype = {
|
30851 | /**
|
30852 | * @function
|
30853 | * Initializes frame related properties.
|
30854 | *
|
30855 | */
|
30856 | initFrame: function(){
|
30857 | //set to true when inpoint is rendered
|
30858 | this._isFirstFrame = false;
|
30859 | //list of animated properties
|
30860 | this.dynamicProperties = [];
|
30861 | // If layer has been modified in current tick this will be true
|
30862 | this._mdf = false;
|
30863 | },
|
30864 | /**
|
30865 | * @function
|
30866 | * Calculates all dynamic values
|
30867 | *
|
30868 | * @param {number} num
|
30869 | * current frame number in Layer's time
|
30870 | * @param {boolean} isVisible
|
30871 | * if layers is currently in range
|
30872 | *
|
30873 | */
|
30874 | prepareProperties: function(num, isVisible) {
|
30875 | var i, len = this.dynamicProperties.length;
|
30876 | for (i = 0;i < len; i += 1) {
|
30877 | if (isVisible || (this._isParent && this.dynamicProperties[i].propType === 'transform')) {
|
30878 | this.dynamicProperties[i].getValue();
|
30879 | if (this.dynamicProperties[i]._mdf) {
|
30880 | this.globalData._mdf = true;
|
30881 | this._mdf = true;
|
30882 | }
|
30883 | }
|
30884 | }
|
30885 | },
|
30886 | addDynamicProperty: function(prop) {
|
30887 | if(this.dynamicProperties.indexOf(prop) === -1) {
|
30888 | this.dynamicProperties.push(prop);
|
30889 | }
|
30890 | }
|
30891 | };
|
30892 | function TransformElement(){}
|
30893 |
|
30894 | TransformElement.prototype = {
|
30895 | initTransform: function() {
|
30896 | this.finalTransform = {
|
30897 | mProp: this.data.ks ? TransformPropertyFactory.getTransformProperty(this, this.data.ks, this) : {o:0},
|
30898 | _matMdf: false,
|
30899 | _opMdf: false,
|
30900 | mat: new Matrix()
|
30901 | };
|
30902 | if (this.data.ao) {
|
30903 | this.finalTransform.mProp.autoOriented = true;
|
30904 | }
|
30905 |
|
30906 | //TODO: check TYPE 11: Guided elements
|
30907 | if (this.data.ty !== 11) ;
|
30908 | },
|
30909 | renderTransform: function() {
|
30910 |
|
30911 | this.finalTransform._opMdf = this.finalTransform.mProp.o._mdf || this._isFirstFrame;
|
30912 | this.finalTransform._matMdf = this.finalTransform.mProp._mdf || this._isFirstFrame;
|
30913 |
|
30914 | if (this.hierarchy) {
|
30915 | var mat;
|
30916 | var finalMat = this.finalTransform.mat;
|
30917 | var i = 0, len = this.hierarchy.length;
|
30918 | //Checking if any of the transformation matrices in the hierarchy chain has changed.
|
30919 | if (!this.finalTransform._matMdf) {
|
30920 | while (i < len) {
|
30921 | if (this.hierarchy[i].finalTransform.mProp._mdf) {
|
30922 | this.finalTransform._matMdf = true;
|
30923 | break;
|
30924 | }
|
30925 | i += 1;
|
30926 | }
|
30927 | }
|
30928 |
|
30929 | if (this.finalTransform._matMdf) {
|
30930 | mat = this.finalTransform.mProp.v.props;
|
30931 | finalMat.cloneFromProps(mat);
|
30932 | for (i = 0; i < len; i += 1) {
|
30933 | mat = this.hierarchy[i].finalTransform.mProp.v.props;
|
30934 | finalMat.transform(mat[0], mat[1], mat[2], mat[3], mat[4], mat[5], mat[6], mat[7], mat[8], mat[9], mat[10], mat[11], mat[12], mat[13], mat[14], mat[15]);
|
30935 | }
|
30936 | }
|
30937 | }
|
30938 | },
|
30939 | globalToLocal: function(pt) {
|
30940 | var transforms = [];
|
30941 | transforms.push(this.finalTransform);
|
30942 | var flag = true;
|
30943 | var comp = this.comp;
|
30944 | while (flag) {
|
30945 | if (comp.finalTransform) {
|
30946 | if (comp.data.hasMask) {
|
30947 | transforms.splice(0, 0, comp.finalTransform);
|
30948 | }
|
30949 | comp = comp.comp;
|
30950 | } else {
|
30951 | flag = false;
|
30952 | }
|
30953 | }
|
30954 | var i, len = transforms.length,ptNew;
|
30955 | for (i = 0; i < len; i += 1) {
|
30956 | ptNew = transforms[i].mat.applyToPointArray(0, 0, 0);
|
30957 | //ptNew = transforms[i].mat.applyToPointArray(pt[0],pt[1],pt[2]);
|
30958 | pt = [pt[0] - ptNew[0], pt[1] - ptNew[1], 0];
|
30959 | }
|
30960 | return pt;
|
30961 | },
|
30962 | mHelper: new Matrix()
|
30963 | };
|
30964 | function RenderableElement(){
|
30965 |
|
30966 | }
|
30967 |
|
30968 | RenderableElement.prototype = {
|
30969 | initRenderable: function() {
|
30970 | //layer's visibility related to inpoint and outpoint. Rename isVisible to isInRange
|
30971 | this.isInRange = false;
|
30972 | //layer's display state
|
30973 | this.hidden = false;
|
30974 | // If layer's transparency equals 0, it can be hidden
|
30975 | this.isTransparent = false;
|
30976 | //list of animated components
|
30977 | this.renderableComponents = [];
|
30978 | },
|
30979 | addRenderableComponent: function(component) {
|
30980 | if(this.renderableComponents.indexOf(component) === -1) {
|
30981 | this.renderableComponents.push(component);
|
30982 | }
|
30983 | },
|
30984 | removeRenderableComponent: function(component) {
|
30985 | if(this.renderableComponents.indexOf(component) !== -1) {
|
30986 | this.renderableComponents.splice(this.renderableComponents.indexOf(component), 1);
|
30987 | }
|
30988 | },
|
30989 | prepareRenderableFrame: function(num) {
|
30990 | this.checkLayerLimits(num);
|
30991 | },
|
30992 | checkTransparency: function(){
|
30993 | if(this.finalTransform.mProp.o.v <= 0) {
|
30994 | if(!this.isTransparent && this.globalData.renderConfig.hideOnTransparent){
|
30995 | this.isTransparent = true;
|
30996 | this.hide();
|
30997 | }
|
30998 | } else if(this.isTransparent) {
|
30999 | this.isTransparent = false;
|
31000 | this.show();
|
31001 | }
|
31002 | },
|
31003 | /**
|
31004 | * @function
|
31005 | * Initializes frame related properties.
|
31006 | *
|
31007 | * @param {number} num
|
31008 | * current frame number in Layer's time
|
31009 | *
|
31010 | */
|
31011 | checkLayerLimits: function(num) {
|
31012 | if(this.data.ip - this.data.st <= num && this.data.op - this.data.st > num)
|
31013 | {
|
31014 | if(this.isInRange !== true){
|
31015 | this.globalData._mdf = true;
|
31016 | this._mdf = true;
|
31017 | this.isInRange = true;
|
31018 | this.show();
|
31019 | }
|
31020 | } else {
|
31021 | if(this.isInRange !== false){
|
31022 | this.globalData._mdf = true;
|
31023 | this.isInRange = false;
|
31024 | this.hide();
|
31025 | }
|
31026 | }
|
31027 | },
|
31028 | renderRenderable: function() {
|
31029 | var i, len = this.renderableComponents.length;
|
31030 | for(i = 0; i < len; i += 1) {
|
31031 | this.renderableComponents[i].renderFrame(this._isFirstFrame);
|
31032 | }
|
31033 | /*this.maskManager.renderFrame(this.finalTransform.mat);
|
31034 | this.renderableEffectsManager.renderFrame(this._isFirstFrame);*/
|
31035 | },
|
31036 | sourceRectAtTime: function(){
|
31037 | return {
|
31038 | top:0,
|
31039 | left:0,
|
31040 | width:100,
|
31041 | height:100
|
31042 | };
|
31043 | },
|
31044 | getLayerSize: function(){
|
31045 | if(this.data.ty === 5){
|
31046 | return {w:this.data.textData.width,h:this.data.textData.height};
|
31047 | }else{
|
31048 | return {w:this.data.width,h:this.data.height};
|
31049 | }
|
31050 | }
|
31051 | };
|
31052 | function RenderableDOMElement() {}
|
31053 |
|
31054 | (function(){
|
31055 | var _prototype = {
|
31056 | initElement: function(data,globalData,comp) {
|
31057 | this.initFrame();
|
31058 | this.initBaseData(data, globalData, comp);
|
31059 | this.initTransform(data, globalData, comp);
|
31060 | this.initHierarchy();
|
31061 | this.initRenderable();
|
31062 | this.initRendererElement();
|
31063 | this.createContainerElements();
|
31064 | this.createRenderableComponents();
|
31065 | this.createContent();
|
31066 | this.hide();
|
31067 | },
|
31068 | hide: function(){
|
31069 | if (!this.hidden && (!this.isInRange || this.isTransparent)) {
|
31070 | var elem = this.baseElement || this.layerElement;
|
31071 | elem.style.display = 'none';
|
31072 | this.hidden = true;
|
31073 | }
|
31074 | },
|
31075 | show: function(){
|
31076 | if (this.isInRange && !this.isTransparent){
|
31077 | if (!this.data.hd) {
|
31078 | var elem = this.baseElement || this.layerElement;
|
31079 | elem.style.display = 'block';
|
31080 | }
|
31081 | this.hidden = false;
|
31082 | this._isFirstFrame = true;
|
31083 | }
|
31084 | },
|
31085 | renderFrame: function() {
|
31086 | //If it is exported as hidden (data.hd === true) no need to render
|
31087 | //If it is not visible no need to render
|
31088 | if (this.data.hd || this.hidden) {
|
31089 | return;
|
31090 | }
|
31091 | this.renderTransform();
|
31092 | this.renderRenderable();
|
31093 | this.renderElement();
|
31094 | this.renderInnerContent();
|
31095 | if (this._isFirstFrame) {
|
31096 | this._isFirstFrame = false;
|
31097 | }
|
31098 | },
|
31099 | renderInnerContent: function() {},
|
31100 | prepareFrame: function(num) {
|
31101 | this._mdf = false;
|
31102 | this.prepareRenderableFrame(num);
|
31103 | this.prepareProperties(num, this.isInRange);
|
31104 | this.checkTransparency();
|
31105 | },
|
31106 | destroy: function(){
|
31107 | this.innerElem = null;
|
31108 | this.destroyBaseElement();
|
31109 | }
|
31110 | };
|
31111 | extendPrototype([RenderableElement, createProxyFunction(_prototype)], RenderableDOMElement);
|
31112 | }());
|
31113 | function ProcessedElement(element, position) {
|
31114 | this.elem = element;
|
31115 | this.pos = position;
|
31116 | }
|
31117 | function SVGStyleData(data, level) {
|
31118 | this.data = data;
|
31119 | this.type = data.ty;
|
31120 | this.d = '';
|
31121 | this.lvl = level;
|
31122 | this._mdf = false;
|
31123 | this.closed = data.hd === true;
|
31124 | this.pElem = createNS('path');
|
31125 | this.msElem = null;
|
31126 | }
|
31127 |
|
31128 | SVGStyleData.prototype.reset = function() {
|
31129 | this.d = '';
|
31130 | this._mdf = false;
|
31131 | };
|
31132 | function SVGShapeData(transformers, level, shape) {
|
31133 | this.caches = [];
|
31134 | this.styles = [];
|
31135 | this.transformers = transformers;
|
31136 | this.lStr = '';
|
31137 | this.sh = shape;
|
31138 | this.lvl = level;
|
31139 | //TODO find if there are some cases where _isAnimated can be false.
|
31140 | // For now, since shapes add up with other shapes. They have to be calculated every time.
|
31141 | // One way of finding out is checking if all styles associated to this shape depend only of this shape
|
31142 | this._isAnimated = !!shape.k;
|
31143 | // TODO: commenting this for now since all shapes are animated
|
31144 | var i = 0, len = transformers.length;
|
31145 | while(i < len) {
|
31146 | if(transformers[i].mProps.dynamicProperties.length) {
|
31147 | this._isAnimated = true;
|
31148 | break;
|
31149 | }
|
31150 | i += 1;
|
31151 | }
|
31152 | }
|
31153 |
|
31154 | SVGShapeData.prototype.setAsAnimated = function() {
|
31155 | this._isAnimated = true;
|
31156 | };
|
31157 | function SVGTransformData(mProps, op, container) {
|
31158 | this.transform = {
|
31159 | mProps: mProps,
|
31160 | op: op,
|
31161 | container: container
|
31162 | };
|
31163 | this.elements = [];
|
31164 | this._isAnimated = this.transform.mProps.dynamicProperties.length || this.transform.op.effectsSequence.length;
|
31165 | }
|
31166 | function SVGStrokeStyleData(elem, data, styleOb){
|
31167 | this.initDynamicPropertyContainer(elem);
|
31168 | this.getValue = this.iterateDynamicProperties;
|
31169 | this.o = PropertyFactory.getProp(elem,data.o,0,0.01,this);
|
31170 | this.w = PropertyFactory.getProp(elem,data.w,0,null,this);
|
31171 | this.d = new DashProperty(elem,data.d||{},'svg',this);
|
31172 | this.c = PropertyFactory.getProp(elem,data.c,1,255,this);
|
31173 | this.style = styleOb;
|
31174 | this._isAnimated = !!this._isAnimated;
|
31175 | }
|
31176 |
|
31177 | extendPrototype([DynamicPropertyContainer], SVGStrokeStyleData);
|
31178 | function SVGFillStyleData(elem, data, styleOb){
|
31179 | this.initDynamicPropertyContainer(elem);
|
31180 | this.getValue = this.iterateDynamicProperties;
|
31181 | this.o = PropertyFactory.getProp(elem,data.o,0,0.01,this);
|
31182 | this.c = PropertyFactory.getProp(elem,data.c,1,255,this);
|
31183 | this.style = styleOb;
|
31184 | }
|
31185 |
|
31186 | extendPrototype([DynamicPropertyContainer], SVGFillStyleData);
|
31187 | function SVGGradientFillStyleData(elem, data, styleOb){
|
31188 | this.initDynamicPropertyContainer(elem);
|
31189 | this.getValue = this.iterateDynamicProperties;
|
31190 | this.initGradientData(elem, data, styleOb);
|
31191 | }
|
31192 |
|
31193 | SVGGradientFillStyleData.prototype.initGradientData = function(elem, data, styleOb){
|
31194 | this.o = PropertyFactory.getProp(elem,data.o,0,0.01,this);
|
31195 | this.s = PropertyFactory.getProp(elem,data.s,1,null,this);
|
31196 | this.e = PropertyFactory.getProp(elem,data.e,1,null,this);
|
31197 | this.h = PropertyFactory.getProp(elem,data.h||{k:0},0,0.01,this);
|
31198 | this.a = PropertyFactory.getProp(elem,data.a||{k:0},0,degToRads,this);
|
31199 | this.g = new GradientProperty(elem,data.g,this);
|
31200 | this.style = styleOb;
|
31201 | this.stops = [];
|
31202 | this.setGradientData(styleOb.pElem, data);
|
31203 | this.setGradientOpacity(data, styleOb);
|
31204 | this._isAnimated = !!this._isAnimated;
|
31205 |
|
31206 | };
|
31207 |
|
31208 | SVGGradientFillStyleData.prototype.setGradientData = function(pathElement,data){
|
31209 |
|
31210 | var gradientId = createElementID();
|
31211 | var gfill = createNS(data.t === 1 ? 'linearGradient' : 'radialGradient');
|
31212 | gfill.setAttribute('id',gradientId);
|
31213 | gfill.setAttribute('spreadMethod','pad');
|
31214 | gfill.setAttribute('gradientUnits','userSpaceOnUse');
|
31215 | var stops = [];
|
31216 | var stop, j, jLen;
|
31217 | jLen = data.g.p*4;
|
31218 | for(j=0;j<jLen;j+=4){
|
31219 | stop = createNS('stop');
|
31220 | gfill.appendChild(stop);
|
31221 | stops.push(stop);
|
31222 | }
|
31223 | pathElement.setAttribute( data.ty === 'gf' ? 'fill':'stroke','url(' + locationHref + '#'+gradientId+')');
|
31224 |
|
31225 | this.gf = gfill;
|
31226 | this.cst = stops;
|
31227 | };
|
31228 |
|
31229 | SVGGradientFillStyleData.prototype.setGradientOpacity = function(data, styleOb){
|
31230 | if(this.g._hasOpacity && !this.g._collapsable){
|
31231 | var stop, j, jLen;
|
31232 | var mask = createNS("mask");
|
31233 | var maskElement = createNS( 'path');
|
31234 | mask.appendChild(maskElement);
|
31235 | var opacityId = createElementID();
|
31236 | var maskId = createElementID();
|
31237 | mask.setAttribute('id',maskId);
|
31238 | var opFill = createNS(data.t === 1 ? 'linearGradient' : 'radialGradient');
|
31239 | opFill.setAttribute('id',opacityId);
|
31240 | opFill.setAttribute('spreadMethod','pad');
|
31241 | opFill.setAttribute('gradientUnits','userSpaceOnUse');
|
31242 | jLen = data.g.k.k[0].s ? data.g.k.k[0].s.length : data.g.k.k.length;
|
31243 | var stops = this.stops;
|
31244 | for(j=data.g.p*4;j<jLen;j+=2){
|
31245 | stop = createNS('stop');
|
31246 | stop.setAttribute('stop-color','rgb(255,255,255)');
|
31247 | opFill.appendChild(stop);
|
31248 | stops.push(stop);
|
31249 | }
|
31250 | maskElement.setAttribute( data.ty === 'gf' ? 'fill':'stroke','url(' + locationHref + '#'+opacityId+')');
|
31251 | this.of = opFill;
|
31252 | this.ms = mask;
|
31253 | this.ost = stops;
|
31254 | this.maskId = maskId;
|
31255 | styleOb.msElem = maskElement;
|
31256 | }
|
31257 | };
|
31258 |
|
31259 | extendPrototype([DynamicPropertyContainer], SVGGradientFillStyleData);
|
31260 | function SVGGradientStrokeStyleData(elem, data, styleOb){
|
31261 | this.initDynamicPropertyContainer(elem);
|
31262 | this.getValue = this.iterateDynamicProperties;
|
31263 | this.w = PropertyFactory.getProp(elem,data.w,0,null,this);
|
31264 | this.d = new DashProperty(elem,data.d||{},'svg',this);
|
31265 | this.initGradientData(elem, data, styleOb);
|
31266 | this._isAnimated = !!this._isAnimated;
|
31267 | }
|
31268 |
|
31269 | extendPrototype([SVGGradientFillStyleData, DynamicPropertyContainer], SVGGradientStrokeStyleData);
|
31270 | function ShapeGroupData() {
|
31271 | this.it = [];
|
31272 | this.prevViewData = [];
|
31273 | this.gr = createNS('g');
|
31274 | }
|
31275 | var SVGElementsRenderer = (function() {
|
31276 | var _identityMatrix = new Matrix();
|
31277 | var _matrixHelper = new Matrix();
|
31278 |
|
31279 | var ob = {
|
31280 | createRenderFunction: createRenderFunction
|
31281 | };
|
31282 |
|
31283 | function createRenderFunction(data) {
|
31284 | var ty = data.ty;
|
31285 | switch(data.ty) {
|
31286 | case 'fl':
|
31287 | return renderFill;
|
31288 | case 'gf':
|
31289 | return renderGradient;
|
31290 | case 'gs':
|
31291 | return renderGradientStroke;
|
31292 | case 'st':
|
31293 | return renderStroke;
|
31294 | case 'sh':
|
31295 | case 'el':
|
31296 | case 'rc':
|
31297 | case 'sr':
|
31298 | return renderPath;
|
31299 | case 'tr':
|
31300 | return renderContentTransform;
|
31301 | }
|
31302 | }
|
31303 |
|
31304 | function renderContentTransform(styleData, itemData, isFirstFrame) {
|
31305 | if(isFirstFrame || itemData.transform.op._mdf){
|
31306 | itemData.transform.container.setAttribute('opacity',itemData.transform.op.v);
|
31307 | }
|
31308 | if(isFirstFrame || itemData.transform.mProps._mdf){
|
31309 | itemData.transform.container.setAttribute('transform',itemData.transform.mProps.v.to2dCSS());
|
31310 | }
|
31311 | }
|
31312 |
|
31313 | function renderPath(styleData, itemData, isFirstFrame) {
|
31314 | var j, jLen,pathStringTransformed,redraw,pathNodes,l, lLen = itemData.styles.length;
|
31315 | var lvl = itemData.lvl;
|
31316 | var paths, mat, props, iterations, k;
|
31317 | for(l=0;l<lLen;l+=1){
|
31318 | redraw = itemData.sh._mdf || isFirstFrame;
|
31319 | if(itemData.styles[l].lvl < lvl){
|
31320 | mat = _matrixHelper.reset();
|
31321 | iterations = lvl - itemData.styles[l].lvl;
|
31322 | k = itemData.transformers.length-1;
|
31323 | while(!redraw && iterations > 0) {
|
31324 | redraw = itemData.transformers[k].mProps._mdf || redraw;
|
31325 | iterations --;
|
31326 | k --;
|
31327 | }
|
31328 | if(redraw) {
|
31329 | iterations = lvl - itemData.styles[l].lvl;
|
31330 | k = itemData.transformers.length-1;
|
31331 | while(iterations > 0) {
|
31332 | props = itemData.transformers[k].mProps.v.props;
|
31333 | mat.transform(props[0],props[1],props[2],props[3],props[4],props[5],props[6],props[7],props[8],props[9],props[10],props[11],props[12],props[13],props[14],props[15]);
|
31334 | iterations --;
|
31335 | k --;
|
31336 | }
|
31337 | }
|
31338 | } else {
|
31339 | mat = _identityMatrix;
|
31340 | }
|
31341 | paths = itemData.sh.paths;
|
31342 | jLen = paths._length;
|
31343 | if(redraw){
|
31344 | pathStringTransformed = '';
|
31345 | for(j=0;j<jLen;j+=1){
|
31346 | pathNodes = paths.shapes[j];
|
31347 | if(pathNodes && pathNodes._length){
|
31348 | pathStringTransformed += buildShapeString(pathNodes, pathNodes._length, pathNodes.c, mat);
|
31349 | }
|
31350 | }
|
31351 | itemData.caches[l] = pathStringTransformed;
|
31352 | } else {
|
31353 | pathStringTransformed = itemData.caches[l];
|
31354 | }
|
31355 | itemData.styles[l].d += styleData.hd === true ? '' : pathStringTransformed;
|
31356 | itemData.styles[l]._mdf = redraw || itemData.styles[l]._mdf;
|
31357 | }
|
31358 | }
|
31359 |
|
31360 | function renderFill (styleData,itemData, isFirstFrame){
|
31361 | var styleElem = itemData.style;
|
31362 |
|
31363 | if(itemData.c._mdf || isFirstFrame){
|
31364 | styleElem.pElem.setAttribute('fill','rgb('+bm_floor(itemData.c.v[0])+','+bm_floor(itemData.c.v[1])+','+bm_floor(itemData.c.v[2])+')');
|
31365 | }
|
31366 | if(itemData.o._mdf || isFirstFrame){
|
31367 | styleElem.pElem.setAttribute('fill-opacity',itemData.o.v);
|
31368 | }
|
31369 | }
|
31370 | function renderGradientStroke (styleData, itemData, isFirstFrame) {
|
31371 | renderGradient(styleData, itemData, isFirstFrame);
|
31372 | renderStroke(styleData, itemData, isFirstFrame);
|
31373 | }
|
31374 |
|
31375 | function renderGradient(styleData, itemData, isFirstFrame) {
|
31376 | var gfill = itemData.gf;
|
31377 | var hasOpacity = itemData.g._hasOpacity;
|
31378 | var pt1 = itemData.s.v, pt2 = itemData.e.v;
|
31379 |
|
31380 | if (itemData.o._mdf || isFirstFrame) {
|
31381 | var attr = styleData.ty === 'gf' ? 'fill-opacity' : 'stroke-opacity';
|
31382 | itemData.style.pElem.setAttribute(attr, itemData.o.v);
|
31383 | }
|
31384 | if (itemData.s._mdf || isFirstFrame) {
|
31385 | var attr1 = styleData.t === 1 ? 'x1' : 'cx';
|
31386 | var attr2 = attr1 === 'x1' ? 'y1' : 'cy';
|
31387 | gfill.setAttribute(attr1, pt1[0]);
|
31388 | gfill.setAttribute(attr2, pt1[1]);
|
31389 | if (hasOpacity && !itemData.g._collapsable) {
|
31390 | itemData.of.setAttribute(attr1, pt1[0]);
|
31391 | itemData.of.setAttribute(attr2, pt1[1]);
|
31392 | }
|
31393 | }
|
31394 | var stops, i, len, stop;
|
31395 | if (itemData.g._cmdf || isFirstFrame) {
|
31396 | stops = itemData.cst;
|
31397 | var cValues = itemData.g.c;
|
31398 | len = stops.length;
|
31399 | for (i = 0; i < len; i += 1){
|
31400 | stop = stops[i];
|
31401 | stop.setAttribute('offset', cValues[i * 4] + '%');
|
31402 | stop.setAttribute('stop-color','rgb('+ cValues[i * 4 + 1] + ',' + cValues[i * 4 + 2] + ','+cValues[i * 4 + 3] + ')');
|
31403 | }
|
31404 | }
|
31405 | if (hasOpacity && (itemData.g._omdf || isFirstFrame)) {
|
31406 | var oValues = itemData.g.o;
|
31407 | if(itemData.g._collapsable) {
|
31408 | stops = itemData.cst;
|
31409 | } else {
|
31410 | stops = itemData.ost;
|
31411 | }
|
31412 | len = stops.length;
|
31413 | for (i = 0; i < len; i += 1) {
|
31414 | stop = stops[i];
|
31415 | if(!itemData.g._collapsable) {
|
31416 | stop.setAttribute('offset', oValues[i * 2] + '%');
|
31417 | }
|
31418 | stop.setAttribute('stop-opacity', oValues[i * 2 + 1]);
|
31419 | }
|
31420 | }
|
31421 | if (styleData.t === 1) {
|
31422 | if (itemData.e._mdf || isFirstFrame) {
|
31423 | gfill.setAttribute('x2', pt2[0]);
|
31424 | gfill.setAttribute('y2', pt2[1]);
|
31425 | if (hasOpacity && !itemData.g._collapsable) {
|
31426 | itemData.of.setAttribute('x2', pt2[0]);
|
31427 | itemData.of.setAttribute('y2', pt2[1]);
|
31428 | }
|
31429 | }
|
31430 | } else {
|
31431 | var rad;
|
31432 | if (itemData.s._mdf || itemData.e._mdf || isFirstFrame) {
|
31433 | rad = Math.sqrt(Math.pow(pt1[0] - pt2[0], 2) + Math.pow(pt1[1] - pt2[1], 2));
|
31434 | gfill.setAttribute('r', rad);
|
31435 | if(hasOpacity && !itemData.g._collapsable){
|
31436 | itemData.of.setAttribute('r', rad);
|
31437 | }
|
31438 | }
|
31439 | if (itemData.e._mdf || itemData.h._mdf || itemData.a._mdf || isFirstFrame) {
|
31440 | if (!rad) {
|
31441 | rad = Math.sqrt(Math.pow(pt1[0] - pt2[0], 2) + Math.pow(pt1[1] - pt2[1], 2));
|
31442 | }
|
31443 | var ang = Math.atan2(pt2[1] - pt1[1], pt2[0] - pt1[0]);
|
31444 |
|
31445 | var percent = itemData.h.v >= 1 ? 0.99 : itemData.h.v <= -1 ? -0.99: itemData.h.v;
|
31446 | var dist = rad * percent;
|
31447 | var x = Math.cos(ang + itemData.a.v) * dist + pt1[0];
|
31448 | var y = Math.sin(ang + itemData.a.v) * dist + pt1[1];
|
31449 | gfill.setAttribute('fx', x);
|
31450 | gfill.setAttribute('fy', y);
|
31451 | if (hasOpacity && !itemData.g._collapsable) {
|
31452 | itemData.of.setAttribute('fx', x);
|
31453 | itemData.of.setAttribute('fy', y);
|
31454 | }
|
31455 | }
|
31456 | //gfill.setAttribute('fy','200');
|
31457 | }
|
31458 | }
|
31459 | function renderStroke(styleData, itemData, isFirstFrame) {
|
31460 | var styleElem = itemData.style;
|
31461 | var d = itemData.d;
|
31462 | if (d && (d._mdf || isFirstFrame) && d.dashStr) {
|
31463 | styleElem.pElem.setAttribute('stroke-dasharray', d.dashStr);
|
31464 | styleElem.pElem.setAttribute('stroke-dashoffset', d.dashoffset[0]);
|
31465 | }
|
31466 | if(itemData.c && (itemData.c._mdf || isFirstFrame)){
|
31467 | styleElem.pElem.setAttribute('stroke','rgb(' + bm_floor(itemData.c.v[0]) + ',' + bm_floor(itemData.c.v[1]) + ',' + bm_floor(itemData.c.v[2]) + ')');
|
31468 | }
|
31469 | if(itemData.o._mdf || isFirstFrame){
|
31470 | styleElem.pElem.setAttribute('stroke-opacity', itemData.o.v);
|
31471 | }
|
31472 | if(itemData.w._mdf || isFirstFrame){
|
31473 | styleElem.pElem.setAttribute('stroke-width', itemData.w.v);
|
31474 | if(styleElem.msElem){
|
31475 | styleElem.msElem.setAttribute('stroke-width', itemData.w.v);
|
31476 | }
|
31477 | }
|
31478 | }
|
31479 | return ob;
|
31480 | }());
|
31481 | function ShapeTransformManager() {
|
31482 | this.sequences = {};
|
31483 | this.sequenceList = [];
|
31484 | this.transform_key_count = 0;
|
31485 | }
|
31486 |
|
31487 | ShapeTransformManager.prototype = {
|
31488 | addTransformSequence: function(transforms) {
|
31489 | var i, len = transforms.length;
|
31490 | var key = '_';
|
31491 | for(i = 0; i < len; i += 1) {
|
31492 | key += transforms[i].transform.key + '_';
|
31493 | }
|
31494 | var sequence = this.sequences[key];
|
31495 | if(!sequence) {
|
31496 | sequence = {
|
31497 | transforms: [].concat(transforms),
|
31498 | finalTransform: new Matrix(),
|
31499 | _mdf: false
|
31500 | };
|
31501 | this.sequences[key] = sequence;
|
31502 | this.sequenceList.push(sequence);
|
31503 | }
|
31504 | return sequence;
|
31505 | },
|
31506 | processSequence: function(sequence, isFirstFrame) {
|
31507 | var i = 0, len = sequence.transforms.length, _mdf = isFirstFrame;
|
31508 | while (i < len && !isFirstFrame) {
|
31509 | if (sequence.transforms[i].transform.mProps._mdf) {
|
31510 | _mdf = true;
|
31511 | break;
|
31512 | }
|
31513 | i += 1;
|
31514 | }
|
31515 | if (_mdf) {
|
31516 | var props;
|
31517 | sequence.finalTransform.reset();
|
31518 | for (i = len - 1; i >= 0; i -= 1) {
|
31519 | props = sequence.transforms[i].transform.mProps.v.props;
|
31520 | sequence.finalTransform.transform(props[0],props[1],props[2],props[3],props[4],props[5],props[6],props[7],props[8],props[9],props[10],props[11],props[12],props[13],props[14],props[15]);
|
31521 | }
|
31522 | }
|
31523 | sequence._mdf = _mdf;
|
31524 |
|
31525 | },
|
31526 | processSequences: function(isFirstFrame) {
|
31527 | var i, len = this.sequenceList.length;
|
31528 | for (i = 0; i < len; i += 1) {
|
31529 | this.processSequence(this.sequenceList[i], isFirstFrame);
|
31530 | }
|
31531 |
|
31532 | },
|
31533 | getNewKey: function() {
|
31534 | return '_' + this.transform_key_count++;
|
31535 | }
|
31536 | };
|
31537 | function CVShapeData(element, data, styles, transformsManager) {
|
31538 | this.styledShapes = [];
|
31539 | this.tr = [0,0,0,0,0,0];
|
31540 | var ty = 4;
|
31541 | if(data.ty == 'rc'){
|
31542 | ty = 5;
|
31543 | }else if(data.ty == 'el'){
|
31544 | ty = 6;
|
31545 | }else if(data.ty == 'sr'){
|
31546 | ty = 7;
|
31547 | }
|
31548 | this.sh = ShapePropertyFactory.getShapeProp(element,data,ty,element);
|
31549 | var i , len = styles.length,styledShape;
|
31550 | for (i = 0; i < len; i += 1) {
|
31551 | if (!styles[i].closed) {
|
31552 | styledShape = {
|
31553 | transforms: transformsManager.addTransformSequence(styles[i].transforms),
|
31554 | trNodes: []
|
31555 | };
|
31556 | this.styledShapes.push(styledShape);
|
31557 | styles[i].elements.push(styledShape);
|
31558 | }
|
31559 | }
|
31560 | }
|
31561 |
|
31562 | CVShapeData.prototype.setAsAnimated = SVGShapeData.prototype.setAsAnimated;
|
31563 | function BaseElement(){
|
31564 | }
|
31565 |
|
31566 | BaseElement.prototype = {
|
31567 | checkMasks: function(){
|
31568 | if(!this.data.hasMask){
|
31569 | return false;
|
31570 | }
|
31571 | var i = 0, len = this.data.masksProperties.length;
|
31572 | while(i<len) {
|
31573 | if((this.data.masksProperties[i].mode !== 'n' && this.data.masksProperties[i].cl !== false)) {
|
31574 | return true;
|
31575 | }
|
31576 | i += 1;
|
31577 | }
|
31578 | return false;
|
31579 | },
|
31580 | initExpressions: function(){
|
31581 | this.layerInterface = LayerExpressionInterface(this);
|
31582 | if(this.data.hasMask && this.maskManager) {
|
31583 | this.layerInterface.registerMaskInterface(this.maskManager);
|
31584 | }
|
31585 | var effectsInterface = EffectsExpressionInterface.createEffectsInterface(this,this.layerInterface);
|
31586 | this.layerInterface.registerEffectsInterface(effectsInterface);
|
31587 |
|
31588 | if(this.data.ty === 0 || this.data.xt){
|
31589 | this.compInterface = CompExpressionInterface(this);
|
31590 | } else if(this.data.ty === 4){
|
31591 | this.layerInterface.shapeInterface = ShapeExpressionInterface(this.shapesData,this.itemsData,this.layerInterface);
|
31592 | this.layerInterface.content = this.layerInterface.shapeInterface;
|
31593 | } else if(this.data.ty === 5){
|
31594 | this.layerInterface.textInterface = TextExpressionInterface(this);
|
31595 | this.layerInterface.text = this.layerInterface.textInterface;
|
31596 | }
|
31597 | },
|
31598 | setBlendMode: function(){
|
31599 | var blendModeValue = getBlendMode(this.data.bm);
|
31600 | var elem = this.baseElement || this.layerElement;
|
31601 |
|
31602 | elem.style['mix-blend-mode'] = blendModeValue;
|
31603 | },
|
31604 | initBaseData: function(data, globalData, comp){
|
31605 | this.globalData = globalData;
|
31606 | this.comp = comp;
|
31607 | this.data = data;
|
31608 | this.layerId = createElementID();
|
31609 |
|
31610 | //Stretch factor for old animations missing this property.
|
31611 | if(!this.data.sr){
|
31612 | this.data.sr = 1;
|
31613 | }
|
31614 | // effects manager
|
31615 | this.effectsManager = new EffectsManager(this.data,this,this.dynamicProperties);
|
31616 |
|
31617 | },
|
31618 | getType: function(){
|
31619 | return this.type;
|
31620 | }
|
31621 | ,sourceRectAtTime: function(){}
|
31622 | };
|
31623 | function NullElement(data,globalData,comp){
|
31624 | this.initFrame();
|
31625 | this.initBaseData(data, globalData, comp);
|
31626 | this.initFrame();
|
31627 | this.initTransform(data, globalData, comp);
|
31628 | this.initHierarchy();
|
31629 | }
|
31630 |
|
31631 | NullElement.prototype.prepareFrame = function(num) {
|
31632 | this.prepareProperties(num, true);
|
31633 | };
|
31634 |
|
31635 | NullElement.prototype.renderFrame = function() {
|
31636 | };
|
31637 |
|
31638 | NullElement.prototype.getBaseElement = function() {
|
31639 | return null;
|
31640 | };
|
31641 |
|
31642 | NullElement.prototype.destroy = function() {
|
31643 | };
|
31644 |
|
31645 | NullElement.prototype.sourceRectAtTime = function() {
|
31646 | };
|
31647 |
|
31648 | NullElement.prototype.hide = function() {
|
31649 | };
|
31650 |
|
31651 | extendPrototype([BaseElement,TransformElement,HierarchyElement,FrameElement], NullElement);
|
31652 |
|
31653 | function SVGBaseElement(){
|
31654 | }
|
31655 |
|
31656 | SVGBaseElement.prototype = {
|
31657 | initRendererElement: function() {
|
31658 | this.layerElement = createNS('g');
|
31659 | },
|
31660 | createContainerElements: function(){
|
31661 | this.matteElement = createNS('g');
|
31662 | this.transformedElement = this.layerElement;
|
31663 | this.maskedElement = this.layerElement;
|
31664 | this._sizeChanged = false;
|
31665 | var layerElementParent = null;
|
31666 | //If this layer acts as a mask for the following layer
|
31667 | var filId, fil, gg;
|
31668 | if (this.data.td) {
|
31669 | if (this.data.td == 3 || this.data.td == 1) {
|
31670 | var masker = createNS('mask');
|
31671 | masker.setAttribute('id', this.layerId);
|
31672 | masker.setAttribute('mask-type', this.data.td == 3 ? 'luminance' : 'alpha');
|
31673 | masker.appendChild(this.layerElement);
|
31674 | layerElementParent = masker;
|
31675 | this.globalData.defs.appendChild(masker);
|
31676 | // This is only for IE and Edge when mask if of type alpha
|
31677 | if (!featureSupport.maskType && this.data.td == 1) {
|
31678 | masker.setAttribute('mask-type', 'luminance');
|
31679 | filId = createElementID();
|
31680 | fil = filtersFactory.createFilter(filId);
|
31681 | this.globalData.defs.appendChild(fil);
|
31682 | fil.appendChild(filtersFactory.createAlphaToLuminanceFilter());
|
31683 | gg = createNS('g');
|
31684 | gg.appendChild(this.layerElement);
|
31685 | layerElementParent = gg;
|
31686 | masker.appendChild(gg);
|
31687 | gg.setAttribute('filter','url(' + locationHref + '#' + filId + ')');
|
31688 | }
|
31689 | } else if(this.data.td == 2) {
|
31690 | var maskGroup = createNS('mask');
|
31691 | maskGroup.setAttribute('id', this.layerId);
|
31692 | maskGroup.setAttribute('mask-type','alpha');
|
31693 | var maskGrouper = createNS('g');
|
31694 | maskGroup.appendChild(maskGrouper);
|
31695 | filId = createElementID();
|
31696 | fil = filtersFactory.createFilter(filId);
|
31697 | ////
|
31698 |
|
31699 | // This solution doesn't work on Android when meta tag with viewport attribute is set
|
31700 | /*var feColorMatrix = createNS('feColorMatrix');
|
31701 | feColorMatrix.setAttribute('type', 'matrix');
|
31702 | feColorMatrix.setAttribute('color-interpolation-filters', 'sRGB');
|
31703 | feColorMatrix.setAttribute('values','1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 -1 1');
|
31704 | fil.appendChild(feColorMatrix);*/
|
31705 | ////
|
31706 | var feCTr = createNS('feComponentTransfer');
|
31707 | feCTr.setAttribute('in','SourceGraphic');
|
31708 | fil.appendChild(feCTr);
|
31709 | var feFunc = createNS('feFuncA');
|
31710 | feFunc.setAttribute('type','table');
|
31711 | feFunc.setAttribute('tableValues','1.0 0.0');
|
31712 | feCTr.appendChild(feFunc);
|
31713 | ////
|
31714 | this.globalData.defs.appendChild(fil);
|
31715 | var alphaRect = createNS('rect');
|
31716 | alphaRect.setAttribute('width', this.comp.data.w);
|
31717 | alphaRect.setAttribute('height', this.comp.data.h);
|
31718 | alphaRect.setAttribute('x','0');
|
31719 | alphaRect.setAttribute('y','0');
|
31720 | alphaRect.setAttribute('fill','#ffffff');
|
31721 | alphaRect.setAttribute('opacity','0');
|
31722 | maskGrouper.setAttribute('filter', 'url(' + locationHref + '#'+filId+')');
|
31723 | maskGrouper.appendChild(alphaRect);
|
31724 | maskGrouper.appendChild(this.layerElement);
|
31725 | layerElementParent = maskGrouper;
|
31726 | if (!featureSupport.maskType) {
|
31727 | maskGroup.setAttribute('mask-type', 'luminance');
|
31728 | fil.appendChild(filtersFactory.createAlphaToLuminanceFilter());
|
31729 | gg = createNS('g');
|
31730 | maskGrouper.appendChild(alphaRect);
|
31731 | gg.appendChild(this.layerElement);
|
31732 | layerElementParent = gg;
|
31733 | maskGrouper.appendChild(gg);
|
31734 | }
|
31735 | this.globalData.defs.appendChild(maskGroup);
|
31736 | }
|
31737 | } else if (this.data.tt) {
|
31738 | this.matteElement.appendChild(this.layerElement);
|
31739 | layerElementParent = this.matteElement;
|
31740 | this.baseElement = this.matteElement;
|
31741 | } else {
|
31742 | this.baseElement = this.layerElement;
|
31743 | }
|
31744 | if (this.data.ln) {
|
31745 | this.layerElement.setAttribute('id', this.data.ln);
|
31746 | }
|
31747 | if (this.data.cl) {
|
31748 | this.layerElement.setAttribute('class', this.data.cl);
|
31749 | }
|
31750 | //Clipping compositions to hide content that exceeds boundaries. If collapsed transformations is on, component should not be clipped
|
31751 | if (this.data.ty === 0 && !this.data.hd) {
|
31752 | var cp = createNS( 'clipPath');
|
31753 | var pt = createNS('path');
|
31754 | pt.setAttribute('d','M0,0 L' + this.data.w + ',0' + ' L' + this.data.w + ',' + this.data.h + ' L0,' + this.data.h + 'z');
|
31755 | var clipId = createElementID();
|
31756 | cp.setAttribute('id',clipId);
|
31757 | cp.appendChild(pt);
|
31758 | this.globalData.defs.appendChild(cp);
|
31759 |
|
31760 | if (this.checkMasks()) {
|
31761 | var cpGroup = createNS('g');
|
31762 | cpGroup.setAttribute('clip-path','url(' + locationHref + '#'+clipId + ')');
|
31763 | cpGroup.appendChild(this.layerElement);
|
31764 | this.transformedElement = cpGroup;
|
31765 | if (layerElementParent) {
|
31766 | layerElementParent.appendChild(this.transformedElement);
|
31767 | } else {
|
31768 | this.baseElement = this.transformedElement;
|
31769 | }
|
31770 | } else {
|
31771 | this.layerElement.setAttribute('clip-path','url(' + locationHref + '#'+clipId+')');
|
31772 | }
|
31773 |
|
31774 | }
|
31775 | if (this.data.bm !== 0) {
|
31776 | this.setBlendMode();
|
31777 | }
|
31778 |
|
31779 | },
|
31780 | renderElement: function() {
|
31781 | if (this.finalTransform._matMdf) {
|
31782 | this.transformedElement.setAttribute('transform', this.finalTransform.mat.to2dCSS());
|
31783 | }
|
31784 | if (this.finalTransform._opMdf) {
|
31785 | this.transformedElement.setAttribute('opacity', this.finalTransform.mProp.o.v);
|
31786 | }
|
31787 | },
|
31788 | destroyBaseElement: function() {
|
31789 | this.layerElement = null;
|
31790 | this.matteElement = null;
|
31791 | this.maskManager.destroy();
|
31792 | },
|
31793 | getBaseElement: function() {
|
31794 | if (this.data.hd) {
|
31795 | return null;
|
31796 | }
|
31797 | return this.baseElement;
|
31798 | },
|
31799 | createRenderableComponents: function() {
|
31800 | this.maskManager = new MaskElement(this.data, this, this.globalData);
|
31801 | this.renderableEffectsManager = new SVGEffects(this);
|
31802 | },
|
31803 | setMatte: function(id) {
|
31804 | if (!this.matteElement) {
|
31805 | return;
|
31806 | }
|
31807 | this.matteElement.setAttribute("mask", "url(" + locationHref + "#" + id + ")");
|
31808 | }
|
31809 | };
|
31810 | function IShapeElement(){
|
31811 | }
|
31812 |
|
31813 | IShapeElement.prototype = {
|
31814 | addShapeToModifiers: function(data) {
|
31815 | var i, len = this.shapeModifiers.length;
|
31816 | for(i=0;i<len;i+=1){
|
31817 | this.shapeModifiers[i].addShape(data);
|
31818 | }
|
31819 | },
|
31820 | isShapeInAnimatedModifiers: function(data) {
|
31821 | var i = 0, len = this.shapeModifiers.length;
|
31822 | while(i < len) {
|
31823 | if(this.shapeModifiers[i].isAnimatedWithShape(data)) {
|
31824 | return true;
|
31825 | }
|
31826 | }
|
31827 | return false;
|
31828 | },
|
31829 | renderModifiers: function() {
|
31830 | if(!this.shapeModifiers.length){
|
31831 | return;
|
31832 | }
|
31833 | var i, len = this.shapes.length;
|
31834 | for(i=0;i<len;i+=1){
|
31835 | this.shapes[i].sh.reset();
|
31836 | }
|
31837 |
|
31838 | len = this.shapeModifiers.length;
|
31839 | for(i=len-1;i>=0;i-=1){
|
31840 | this.shapeModifiers[i].processShapes(this._isFirstFrame);
|
31841 | }
|
31842 | },
|
31843 | lcEnum: {
|
31844 | '1': 'butt',
|
31845 | '2': 'round',
|
31846 | '3': 'square'
|
31847 | },
|
31848 | ljEnum: {
|
31849 | '1': 'miter',
|
31850 | '2': 'round',
|
31851 | '3': 'bevel'
|
31852 | },
|
31853 | searchProcessedElement: function(elem){
|
31854 | var elements = this.processedElements;
|
31855 | var i = 0, len = elements.length;
|
31856 | while (i < len) {
|
31857 | if (elements[i].elem === elem) {
|
31858 | return elements[i].pos;
|
31859 | }
|
31860 | i += 1;
|
31861 | }
|
31862 | return 0;
|
31863 | },
|
31864 | addProcessedElement: function(elem, pos){
|
31865 | var elements = this.processedElements;
|
31866 | var i = elements.length;
|
31867 | while(i) {
|
31868 | i -= 1;
|
31869 | if (elements[i].elem === elem) {
|
31870 | elements[i].pos = pos;
|
31871 | return;
|
31872 | }
|
31873 | }
|
31874 | elements.push(new ProcessedElement(elem, pos));
|
31875 | },
|
31876 | prepareFrame: function(num) {
|
31877 | this.prepareRenderableFrame(num);
|
31878 | this.prepareProperties(num, this.isInRange);
|
31879 | }
|
31880 | };
|
31881 | function ITextElement(){
|
31882 | }
|
31883 |
|
31884 | ITextElement.prototype.initElement = function(data,globalData,comp){
|
31885 | this.lettersChangedFlag = true;
|
31886 | this.initFrame();
|
31887 | this.initBaseData(data, globalData, comp);
|
31888 | this.textProperty = new TextProperty(this, data.t, this.dynamicProperties);
|
31889 | this.textAnimator = new TextAnimatorProperty(data.t, this.renderType, this);
|
31890 | this.initTransform(data, globalData, comp);
|
31891 | this.initHierarchy();
|
31892 | this.initRenderable();
|
31893 | this.initRendererElement();
|
31894 | this.createContainerElements();
|
31895 | this.createRenderableComponents();
|
31896 | this.createContent();
|
31897 | this.hide();
|
31898 | this.textAnimator.searchProperties(this.dynamicProperties);
|
31899 | };
|
31900 |
|
31901 | ITextElement.prototype.prepareFrame = function(num) {
|
31902 | this._mdf = false;
|
31903 | this.prepareRenderableFrame(num);
|
31904 | this.prepareProperties(num, this.isInRange);
|
31905 | if(this.textProperty._mdf || this.textProperty._isFirstFrame) {
|
31906 | this.buildNewText();
|
31907 | this.textProperty._isFirstFrame = false;
|
31908 | this.textProperty._mdf = false;
|
31909 | }
|
31910 | };
|
31911 |
|
31912 | ITextElement.prototype.createPathShape = function(matrixHelper, shapes) {
|
31913 | var j,jLen = shapes.length;
|
31914 | var pathNodes;
|
31915 | var shapeStr = '';
|
31916 | for(j=0;j<jLen;j+=1){
|
31917 | pathNodes = shapes[j].ks.k;
|
31918 | shapeStr += buildShapeString(pathNodes, pathNodes.i.length, true, matrixHelper);
|
31919 | }
|
31920 | return shapeStr;
|
31921 | };
|
31922 |
|
31923 | ITextElement.prototype.updateDocumentData = function(newData, index) {
|
31924 | this.textProperty.updateDocumentData(newData, index);
|
31925 | };
|
31926 |
|
31927 | ITextElement.prototype.canResizeFont = function(_canResize) {
|
31928 | this.textProperty.canResizeFont(_canResize);
|
31929 | };
|
31930 |
|
31931 | ITextElement.prototype.setMinimumFontSize = function(_fontSize) {
|
31932 | this.textProperty.setMinimumFontSize(_fontSize);
|
31933 | };
|
31934 |
|
31935 | ITextElement.prototype.applyTextPropertiesToMatrix = function(documentData, matrixHelper, lineNumber, xPos, yPos) {
|
31936 | if(documentData.ps){
|
31937 | matrixHelper.translate(documentData.ps[0],documentData.ps[1] + documentData.ascent,0);
|
31938 | }
|
31939 | matrixHelper.translate(0,-documentData.ls,0);
|
31940 | switch(documentData.j){
|
31941 | case 1:
|
31942 | matrixHelper.translate(documentData.justifyOffset + (documentData.boxWidth - documentData.lineWidths[lineNumber]),0,0);
|
31943 | break;
|
31944 | case 2:
|
31945 | matrixHelper.translate(documentData.justifyOffset + (documentData.boxWidth - documentData.lineWidths[lineNumber] )/2,0,0);
|
31946 | break;
|
31947 | }
|
31948 | matrixHelper.translate(xPos, yPos, 0);
|
31949 | };
|
31950 |
|
31951 |
|
31952 | ITextElement.prototype.buildColor = function(colorData) {
|
31953 | return 'rgb(' + Math.round(colorData[0]*255) + ',' + Math.round(colorData[1]*255) + ',' + Math.round(colorData[2]*255) + ')';
|
31954 | };
|
31955 |
|
31956 | ITextElement.prototype.emptyProp = new LetterProps();
|
31957 |
|
31958 | ITextElement.prototype.destroy = function(){
|
31959 |
|
31960 | };
|
31961 | function ICompElement(){}
|
31962 |
|
31963 | extendPrototype([BaseElement, TransformElement, HierarchyElement, FrameElement, RenderableDOMElement], ICompElement);
|
31964 |
|
31965 | ICompElement.prototype.initElement = function(data,globalData,comp) {
|
31966 | this.initFrame();
|
31967 | this.initBaseData(data, globalData, comp);
|
31968 | this.initTransform(data, globalData, comp);
|
31969 | this.initRenderable();
|
31970 | this.initHierarchy();
|
31971 | this.initRendererElement();
|
31972 | this.createContainerElements();
|
31973 | this.createRenderableComponents();
|
31974 | if(this.data.xt || !globalData.progressiveLoad){
|
31975 | this.buildAllItems();
|
31976 | }
|
31977 | this.hide();
|
31978 | };
|
31979 |
|
31980 | /*ICompElement.prototype.hide = function(){
|
31981 | if(!this.hidden){
|
31982 | this.hideElement();
|
31983 | var i,len = this.elements.length;
|
31984 | for( i = 0; i < len; i+=1 ){
|
31985 | if(this.elements[i]){
|
31986 | this.elements[i].hide();
|
31987 | }
|
31988 | }
|
31989 | }
|
31990 | };*/
|
31991 |
|
31992 | ICompElement.prototype.prepareFrame = function(num){
|
31993 | this._mdf = false;
|
31994 | this.prepareRenderableFrame(num);
|
31995 | this.prepareProperties(num, this.isInRange);
|
31996 | if(!this.isInRange && !this.data.xt){
|
31997 | return;
|
31998 | }
|
31999 |
|
32000 | if (!this.tm._placeholder) {
|
32001 | var timeRemapped = this.tm.v;
|
32002 | if(timeRemapped === this.data.op){
|
32003 | timeRemapped = this.data.op - 1;
|
32004 | }
|
32005 | this.renderedFrame = timeRemapped;
|
32006 | } else {
|
32007 | this.renderedFrame = num/this.data.sr;
|
32008 | }
|
32009 | var i,len = this.elements.length;
|
32010 | if(!this.completeLayers){
|
32011 | this.checkLayers(this.renderedFrame);
|
32012 | }
|
32013 | //This iteration needs to be backwards because of how expressions connect between each other
|
32014 | for( i = len - 1; i >= 0; i -= 1 ){
|
32015 | if(this.completeLayers || this.elements[i]){
|
32016 | this.elements[i].prepareFrame(this.renderedFrame - this.layers[i].st);
|
32017 | if(this.elements[i]._mdf) {
|
32018 | this._mdf = true;
|
32019 | }
|
32020 | }
|
32021 | }
|
32022 | };
|
32023 |
|
32024 | ICompElement.prototype.renderInnerContent = function() {
|
32025 | var i,len = this.layers.length;
|
32026 | for( i = 0; i < len; i += 1 ){
|
32027 | if(this.completeLayers || this.elements[i]){
|
32028 | this.elements[i].renderFrame();
|
32029 | }
|
32030 | }
|
32031 | };
|
32032 |
|
32033 | ICompElement.prototype.setElements = function(elems){
|
32034 | this.elements = elems;
|
32035 | };
|
32036 |
|
32037 | ICompElement.prototype.getElements = function(){
|
32038 | return this.elements;
|
32039 | };
|
32040 |
|
32041 | ICompElement.prototype.destroyElements = function(){
|
32042 | var i,len = this.layers.length;
|
32043 | for( i = 0; i < len; i+=1 ){
|
32044 | if(this.elements[i]){
|
32045 | this.elements[i].destroy();
|
32046 | }
|
32047 | }
|
32048 | };
|
32049 |
|
32050 | ICompElement.prototype.destroy = function(){
|
32051 | this.destroyElements();
|
32052 | this.destroyBaseElement();
|
32053 | };
|
32054 |
|
32055 | function IImageElement(data,globalData,comp){
|
32056 | this.assetData = globalData.getAssetData(data.refId);
|
32057 | this.initElement(data,globalData,comp);
|
32058 | this.sourceRect = {top:0,left:0,width:this.assetData.w,height:this.assetData.h};
|
32059 | }
|
32060 |
|
32061 | extendPrototype([BaseElement,TransformElement,SVGBaseElement,HierarchyElement,FrameElement,RenderableDOMElement], IImageElement);
|
32062 |
|
32063 | IImageElement.prototype.createContent = function(){
|
32064 |
|
32065 | var assetPath = this.globalData.getAssetsPath(this.assetData);
|
32066 |
|
32067 | this.innerElem = createNS('image');
|
32068 | this.innerElem.setAttribute('width',this.assetData.w+"px");
|
32069 | this.innerElem.setAttribute('height',this.assetData.h+"px");
|
32070 | this.innerElem.setAttribute('preserveAspectRatio',this.assetData.pr || this.globalData.renderConfig.imagePreserveAspectRatio);
|
32071 | this.innerElem.setAttributeNS('http://www.w3.org/1999/xlink','href',assetPath);
|
32072 |
|
32073 | this.layerElement.appendChild(this.innerElem);
|
32074 | };
|
32075 |
|
32076 | IImageElement.prototype.sourceRectAtTime = function() {
|
32077 | return this.sourceRect;
|
32078 | };
|
32079 | function ISolidElement(data,globalData,comp){
|
32080 | this.initElement(data,globalData,comp);
|
32081 | }
|
32082 | extendPrototype([IImageElement], ISolidElement);
|
32083 |
|
32084 | ISolidElement.prototype.createContent = function(){
|
32085 |
|
32086 | var rect = createNS('rect');
|
32087 | ////rect.style.width = this.data.sw;
|
32088 | ////rect.style.height = this.data.sh;
|
32089 | ////rect.style.fill = this.data.sc;
|
32090 | rect.setAttribute('width',this.data.sw);
|
32091 | rect.setAttribute('height',this.data.sh);
|
32092 | rect.setAttribute('fill',this.data.sc);
|
32093 | this.layerElement.appendChild(rect);
|
32094 | };
|
32095 | function SVGCompElement(data,globalData,comp){
|
32096 | this.layers = data.layers;
|
32097 | this.supports3d = true;
|
32098 | this.completeLayers = false;
|
32099 | this.pendingElements = [];
|
32100 | this.elements = this.layers ? createSizedArray(this.layers.length) : [];
|
32101 | //this.layerElement = createNS('g');
|
32102 | this.initElement(data,globalData,comp);
|
32103 | this.tm = data.tm ? PropertyFactory.getProp(this,data.tm,0,globalData.frameRate,this) : {_placeholder:true};
|
32104 | }
|
32105 |
|
32106 | extendPrototype([SVGRenderer, ICompElement, SVGBaseElement], SVGCompElement);
|
32107 | function SVGTextElement(data,globalData,comp){
|
32108 | this.textSpans = [];
|
32109 | this.renderType = 'svg';
|
32110 | this.initElement(data,globalData,comp);
|
32111 | }
|
32112 |
|
32113 | extendPrototype([BaseElement,TransformElement,SVGBaseElement,HierarchyElement,FrameElement,RenderableDOMElement,ITextElement], SVGTextElement);
|
32114 |
|
32115 | SVGTextElement.prototype.createContent = function(){
|
32116 |
|
32117 | if (this.data.singleShape && !this.globalData.fontManager.chars) {
|
32118 | this.textContainer = createNS('text');
|
32119 | }
|
32120 | };
|
32121 |
|
32122 | SVGTextElement.prototype.buildTextContents = function(textArray) {
|
32123 | var i = 0, len = textArray.length;
|
32124 | var textContents = [], currentTextContent = '';
|
32125 | while (i < len) {
|
32126 | if(textArray[i] === String.fromCharCode(13) || textArray[i] === String.fromCharCode(3)) {
|
32127 | textContents.push(currentTextContent);
|
32128 | currentTextContent = '';
|
32129 | } else {
|
32130 | currentTextContent += textArray[i];
|
32131 | }
|
32132 | i += 1;
|
32133 | }
|
32134 | textContents.push(currentTextContent);
|
32135 | return textContents;
|
32136 | };
|
32137 |
|
32138 | SVGTextElement.prototype.buildNewText = function(){
|
32139 | var i, len;
|
32140 |
|
32141 | var documentData = this.textProperty.currentData;
|
32142 | this.renderedLetters = createSizedArray(documentData ? documentData.l.length : 0);
|
32143 | if(documentData.fc) {
|
32144 | this.layerElement.setAttribute('fill', this.buildColor(documentData.fc));
|
32145 | }else{
|
32146 | this.layerElement.setAttribute('fill', 'rgba(0,0,0,0)');
|
32147 | }
|
32148 | if(documentData.sc){
|
32149 | this.layerElement.setAttribute('stroke', this.buildColor(documentData.sc));
|
32150 | this.layerElement.setAttribute('stroke-width', documentData.sw);
|
32151 | }
|
32152 | this.layerElement.setAttribute('font-size', documentData.finalSize);
|
32153 | var fontData = this.globalData.fontManager.getFontByName(documentData.f);
|
32154 | if(fontData.fClass){
|
32155 | this.layerElement.setAttribute('class',fontData.fClass);
|
32156 | } else {
|
32157 | this.layerElement.setAttribute('font-family', fontData.fFamily);
|
32158 | var fWeight = documentData.fWeight, fStyle = documentData.fStyle;
|
32159 | this.layerElement.setAttribute('font-style', fStyle);
|
32160 | this.layerElement.setAttribute('font-weight', fWeight);
|
32161 | }
|
32162 | this.layerElement.setAttribute('arial-label', documentData.t);
|
32163 |
|
32164 | var letters = documentData.l || [];
|
32165 | var usesGlyphs = !!this.globalData.fontManager.chars;
|
32166 | len = letters.length;
|
32167 |
|
32168 | var tSpan;
|
32169 | var matrixHelper = this.mHelper;
|
32170 | var shapes, shapeStr = '', singleShape = this.data.singleShape;
|
32171 | var xPos = 0, yPos = 0, firstLine = true;
|
32172 | var trackingOffset = documentData.tr/1000*documentData.finalSize;
|
32173 | if(singleShape && !usesGlyphs && !documentData.sz) {
|
32174 | var tElement = this.textContainer;
|
32175 | var justify = 'start';
|
32176 | switch(documentData.j) {
|
32177 | case 1:
|
32178 | justify = 'end';
|
32179 | break;
|
32180 | case 2:
|
32181 | justify = 'middle';
|
32182 | break;
|
32183 | }
|
32184 | tElement.setAttribute('text-anchor',justify);
|
32185 | tElement.setAttribute('letter-spacing',trackingOffset);
|
32186 | var textContent = this.buildTextContents(documentData.finalText);
|
32187 | len = textContent.length;
|
32188 | yPos = documentData.ps ? documentData.ps[1] + documentData.ascent : 0;
|
32189 | for ( i = 0; i < len; i += 1) {
|
32190 | tSpan = this.textSpans[i] || createNS('tspan');
|
32191 | tSpan.textContent = textContent[i];
|
32192 | tSpan.setAttribute('x', 0);
|
32193 | tSpan.setAttribute('y', yPos);
|
32194 | tSpan.style.display = 'inherit';
|
32195 | tElement.appendChild(tSpan);
|
32196 | this.textSpans[i] = tSpan;
|
32197 | yPos += documentData.finalLineHeight;
|
32198 | }
|
32199 |
|
32200 | this.layerElement.appendChild(tElement);
|
32201 | } else {
|
32202 | var cachedSpansLength = this.textSpans.length;
|
32203 | var shapeData, charData;
|
32204 | for (i = 0; i < len; i += 1) {
|
32205 | if(!usesGlyphs || !singleShape || i === 0){
|
32206 | tSpan = cachedSpansLength > i ? this.textSpans[i] : createNS(usesGlyphs?'path':'text');
|
32207 | if (cachedSpansLength <= i) {
|
32208 | tSpan.setAttribute('stroke-linecap', 'butt');
|
32209 | tSpan.setAttribute('stroke-linejoin','round');
|
32210 | tSpan.setAttribute('stroke-miterlimit','4');
|
32211 | this.textSpans[i] = tSpan;
|
32212 | this.layerElement.appendChild(tSpan);
|
32213 | }
|
32214 | tSpan.style.display = 'inherit';
|
32215 | }
|
32216 |
|
32217 | matrixHelper.reset();
|
32218 | matrixHelper.scale(documentData.finalSize / 100, documentData.finalSize / 100);
|
32219 | if (singleShape) {
|
32220 | if(letters[i].n) {
|
32221 | xPos = -trackingOffset;
|
32222 | yPos += documentData.yOffset;
|
32223 | yPos += firstLine ? 1 : 0;
|
32224 | firstLine = false;
|
32225 | }
|
32226 | this.applyTextPropertiesToMatrix(documentData, matrixHelper, letters[i].line, xPos, yPos);
|
32227 | xPos += letters[i].l || 0;
|
32228 | //xPos += letters[i].val === ' ' ? 0 : trackingOffset;
|
32229 | xPos += trackingOffset;
|
32230 | }
|
32231 | if(usesGlyphs) {
|
32232 | charData = this.globalData.fontManager.getCharData(documentData.finalText[i], fontData.fStyle, this.globalData.fontManager.getFontByName(documentData.f).fFamily);
|
32233 | shapeData = charData && charData.data || {};
|
32234 | shapes = shapeData.shapes ? shapeData.shapes[0].it : [];
|
32235 | if(!singleShape){
|
32236 | tSpan.setAttribute('d',this.createPathShape(matrixHelper,shapes));
|
32237 | } else {
|
32238 | shapeStr += this.createPathShape(matrixHelper,shapes);
|
32239 | }
|
32240 | } else {
|
32241 | if(singleShape) {
|
32242 | tSpan.setAttribute("transform", "translate(" + matrixHelper.props[12] + "," + matrixHelper.props[13] + ")");
|
32243 | }
|
32244 | tSpan.textContent = letters[i].val;
|
32245 | tSpan.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space","preserve");
|
32246 | }
|
32247 | //
|
32248 | }
|
32249 | if (singleShape && tSpan) {
|
32250 | tSpan.setAttribute('d',shapeStr);
|
32251 | }
|
32252 | }
|
32253 | while (i < this.textSpans.length){
|
32254 | this.textSpans[i].style.display = 'none';
|
32255 | i += 1;
|
32256 | }
|
32257 |
|
32258 | this._sizeChanged = true;
|
32259 | };
|
32260 |
|
32261 | SVGTextElement.prototype.sourceRectAtTime = function(time){
|
32262 | this.prepareFrame(this.comp.renderedFrame - this.data.st);
|
32263 | this.renderInnerContent();
|
32264 | if(this._sizeChanged){
|
32265 | this._sizeChanged = false;
|
32266 | var textBox = this.layerElement.getBBox();
|
32267 | this.bbox = {
|
32268 | top: textBox.y,
|
32269 | left: textBox.x,
|
32270 | width: textBox.width,
|
32271 | height: textBox.height
|
32272 | };
|
32273 | }
|
32274 | return this.bbox;
|
32275 | };
|
32276 |
|
32277 | SVGTextElement.prototype.renderInnerContent = function(){
|
32278 |
|
32279 | if(!this.data.singleShape){
|
32280 | this.textAnimator.getMeasures(this.textProperty.currentData, this.lettersChangedFlag);
|
32281 | if(this.lettersChangedFlag || this.textAnimator.lettersChangedFlag){
|
32282 | this._sizeChanged = true;
|
32283 | var i,len;
|
32284 | var renderedLetters = this.textAnimator.renderedLetters;
|
32285 |
|
32286 | var letters = this.textProperty.currentData.l;
|
32287 |
|
32288 | len = letters.length;
|
32289 | var renderedLetter, textSpan;
|
32290 | for(i=0;i<len;i+=1){
|
32291 | if(letters[i].n){
|
32292 | continue;
|
32293 | }
|
32294 | renderedLetter = renderedLetters[i];
|
32295 | textSpan = this.textSpans[i];
|
32296 | if(renderedLetter._mdf.m) {
|
32297 | textSpan.setAttribute('transform',renderedLetter.m);
|
32298 | }
|
32299 | if(renderedLetter._mdf.o) {
|
32300 | textSpan.setAttribute('opacity',renderedLetter.o);
|
32301 | }
|
32302 | if(renderedLetter._mdf.sw){
|
32303 | textSpan.setAttribute('stroke-width',renderedLetter.sw);
|
32304 | }
|
32305 | if(renderedLetter._mdf.sc){
|
32306 | textSpan.setAttribute('stroke',renderedLetter.sc);
|
32307 | }
|
32308 | if(renderedLetter._mdf.fc){
|
32309 | textSpan.setAttribute('fill',renderedLetter.fc);
|
32310 | }
|
32311 | }
|
32312 | }
|
32313 | }
|
32314 | };
|
32315 | function SVGShapeElement(data,globalData,comp){
|
32316 | //List of drawable elements
|
32317 | this.shapes = [];
|
32318 | // Full shape data
|
32319 | this.shapesData = data.shapes;
|
32320 | //List of styles that will be applied to shapes
|
32321 | this.stylesList = [];
|
32322 | //List of modifiers that will be applied to shapes
|
32323 | this.shapeModifiers = [];
|
32324 | //List of items in shape tree
|
32325 | this.itemsData = [];
|
32326 | //List of items in previous shape tree
|
32327 | this.processedElements = [];
|
32328 | // List of animated components
|
32329 | this.animatedContents = [];
|
32330 | this.initElement(data,globalData,comp);
|
32331 | //Moving any property that doesn't get too much access after initialization because of v8 way of handling more than 10 properties.
|
32332 | // List of elements that have been created
|
32333 | this.prevViewData = [];
|
32334 | //Moving any property that doesn't get too much access after initialization because of v8 way of handling more than 10 properties.
|
32335 | }
|
32336 |
|
32337 | extendPrototype([BaseElement,TransformElement,SVGBaseElement,IShapeElement,HierarchyElement,FrameElement,RenderableDOMElement], SVGShapeElement);
|
32338 |
|
32339 | SVGShapeElement.prototype.initSecondaryElement = function() {
|
32340 | };
|
32341 |
|
32342 | SVGShapeElement.prototype.identityMatrix = new Matrix();
|
32343 |
|
32344 | SVGShapeElement.prototype.buildExpressionInterface = function(){};
|
32345 |
|
32346 | SVGShapeElement.prototype.createContent = function(){
|
32347 | this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,this.layerElement, 0, [], true);
|
32348 | this.filterUniqueShapes();
|
32349 | };
|
32350 |
|
32351 | /*
|
32352 | This method searches for multiple shapes that affect a single element and one of them is animated
|
32353 | */
|
32354 | SVGShapeElement.prototype.filterUniqueShapes = function(){
|
32355 | var i, len = this.shapes.length, shape;
|
32356 | var j, jLen = this.stylesList.length;
|
32357 | var style;
|
32358 | var tempShapes = [];
|
32359 | var areAnimated = false;
|
32360 | for(j = 0; j < jLen; j += 1) {
|
32361 | style = this.stylesList[j];
|
32362 | areAnimated = false;
|
32363 | tempShapes.length = 0;
|
32364 | for(i = 0; i < len; i += 1) {
|
32365 | shape = this.shapes[i];
|
32366 | if(shape.styles.indexOf(style) !== -1) {
|
32367 | tempShapes.push(shape);
|
32368 | areAnimated = shape._isAnimated || areAnimated;
|
32369 | }
|
32370 | }
|
32371 | if(tempShapes.length > 1 && areAnimated) {
|
32372 | this.setShapesAsAnimated(tempShapes);
|
32373 | }
|
32374 | }
|
32375 | };
|
32376 |
|
32377 | SVGShapeElement.prototype.setShapesAsAnimated = function(shapes){
|
32378 | var i, len = shapes.length;
|
32379 | for(i = 0; i < len; i += 1) {
|
32380 | shapes[i].setAsAnimated();
|
32381 | }
|
32382 | };
|
32383 |
|
32384 | SVGShapeElement.prototype.createStyleElement = function(data, level){
|
32385 | //TODO: prevent drawing of hidden styles
|
32386 | var elementData;
|
32387 | var styleOb = new SVGStyleData(data, level);
|
32388 |
|
32389 | var pathElement = styleOb.pElem;
|
32390 | if(data.ty === 'st') {
|
32391 | elementData = new SVGStrokeStyleData(this, data, styleOb);
|
32392 | } else if(data.ty === 'fl') {
|
32393 | elementData = new SVGFillStyleData(this, data, styleOb);
|
32394 | } else if(data.ty === 'gf' || data.ty === 'gs') {
|
32395 | var gradientConstructor = data.ty === 'gf' ? SVGGradientFillStyleData : SVGGradientStrokeStyleData;
|
32396 | elementData = new gradientConstructor(this, data, styleOb);
|
32397 | this.globalData.defs.appendChild(elementData.gf);
|
32398 | if (elementData.maskId) {
|
32399 | this.globalData.defs.appendChild(elementData.ms);
|
32400 | this.globalData.defs.appendChild(elementData.of);
|
32401 | pathElement.setAttribute('mask','url(' + locationHref + '#' + elementData.maskId + ')');
|
32402 | }
|
32403 | }
|
32404 |
|
32405 | if(data.ty === 'st' || data.ty === 'gs') {
|
32406 | pathElement.setAttribute('stroke-linecap', this.lcEnum[data.lc] || 'round');
|
32407 | pathElement.setAttribute('stroke-linejoin',this.ljEnum[data.lj] || 'round');
|
32408 | pathElement.setAttribute('fill-opacity','0');
|
32409 | if(data.lj === 1) {
|
32410 | pathElement.setAttribute('stroke-miterlimit',data.ml);
|
32411 | }
|
32412 | }
|
32413 |
|
32414 | if(data.r === 2) {
|
32415 | pathElement.setAttribute('fill-rule', 'evenodd');
|
32416 | }
|
32417 |
|
32418 | if(data.ln){
|
32419 | pathElement.setAttribute('id',data.ln);
|
32420 | }
|
32421 | if(data.cl){
|
32422 | pathElement.setAttribute('class',data.cl);
|
32423 | }
|
32424 | if(data.bm){
|
32425 | pathElement.style['mix-blend-mode'] = getBlendMode(data.bm);
|
32426 | }
|
32427 | this.stylesList.push(styleOb);
|
32428 | this.addToAnimatedContents(data, elementData);
|
32429 | return elementData;
|
32430 | };
|
32431 |
|
32432 | SVGShapeElement.prototype.createGroupElement = function(data) {
|
32433 | var elementData = new ShapeGroupData();
|
32434 | if(data.ln){
|
32435 | elementData.gr.setAttribute('id',data.ln);
|
32436 | }
|
32437 | if(data.cl){
|
32438 | elementData.gr.setAttribute('class',data.cl);
|
32439 | }
|
32440 | if(data.bm){
|
32441 | elementData.gr.style['mix-blend-mode'] = getBlendMode(data.bm);
|
32442 | }
|
32443 | return elementData;
|
32444 | };
|
32445 |
|
32446 | SVGShapeElement.prototype.createTransformElement = function(data, container) {
|
32447 | var transformProperty = TransformPropertyFactory.getTransformProperty(this,data,this);
|
32448 | var elementData = new SVGTransformData(transformProperty, transformProperty.o, container);
|
32449 | this.addToAnimatedContents(data, elementData);
|
32450 | return elementData;
|
32451 | };
|
32452 |
|
32453 | SVGShapeElement.prototype.createShapeElement = function(data, ownTransformers, level) {
|
32454 | var ty = 4;
|
32455 | if(data.ty === 'rc'){
|
32456 | ty = 5;
|
32457 | }else if(data.ty === 'el'){
|
32458 | ty = 6;
|
32459 | }else if(data.ty === 'sr'){
|
32460 | ty = 7;
|
32461 | }
|
32462 | var shapeProperty = ShapePropertyFactory.getShapeProp(this,data,ty,this);
|
32463 | var elementData = new SVGShapeData(ownTransformers, level, shapeProperty);
|
32464 | this.shapes.push(elementData);
|
32465 | this.addShapeToModifiers(elementData);
|
32466 | this.addToAnimatedContents(data, elementData);
|
32467 | return elementData;
|
32468 | };
|
32469 |
|
32470 | SVGShapeElement.prototype.addToAnimatedContents = function(data, element) {
|
32471 | var i = 0, len = this.animatedContents.length;
|
32472 | while(i < len) {
|
32473 | if(this.animatedContents[i].element === element) {
|
32474 | return;
|
32475 | }
|
32476 | i += 1;
|
32477 | }
|
32478 | this.animatedContents.push({
|
32479 | fn: SVGElementsRenderer.createRenderFunction(data),
|
32480 | element: element,
|
32481 | data: data
|
32482 | });
|
32483 | };
|
32484 |
|
32485 | SVGShapeElement.prototype.setElementStyles = function(elementData){
|
32486 | var arr = elementData.styles;
|
32487 | var j, jLen = this.stylesList.length;
|
32488 | for (j = 0; j < jLen; j += 1) {
|
32489 | if (!this.stylesList[j].closed) {
|
32490 | arr.push(this.stylesList[j]);
|
32491 | }
|
32492 | }
|
32493 | };
|
32494 |
|
32495 | SVGShapeElement.prototype.reloadShapes = function(){
|
32496 | this._isFirstFrame = true;
|
32497 | var i, len = this.itemsData.length;
|
32498 | for( i = 0; i < len; i += 1) {
|
32499 | this.prevViewData[i] = this.itemsData[i];
|
32500 | }
|
32501 | this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,this.layerElement, 0, [], true);
|
32502 | this.filterUniqueShapes();
|
32503 | len = this.dynamicProperties.length;
|
32504 | for(i = 0; i < len; i += 1) {
|
32505 | this.dynamicProperties[i].getValue();
|
32506 | }
|
32507 | this.renderModifiers();
|
32508 | };
|
32509 |
|
32510 | SVGShapeElement.prototype.searchShapes = function(arr,itemsData,prevViewData,container, level, transformers, render){
|
32511 | var ownTransformers = [].concat(transformers);
|
32512 | var i, len = arr.length - 1;
|
32513 | var j, jLen;
|
32514 | var ownStyles = [], ownModifiers = [], currentTransform, modifier, processedPos;
|
32515 | for(i=len;i>=0;i-=1){
|
32516 | processedPos = this.searchProcessedElement(arr[i]);
|
32517 | if(!processedPos){
|
32518 | arr[i]._render = render;
|
32519 | } else {
|
32520 | itemsData[i] = prevViewData[processedPos - 1];
|
32521 | }
|
32522 | if(arr[i].ty == 'fl' || arr[i].ty == 'st' || arr[i].ty == 'gf' || arr[i].ty == 'gs'){
|
32523 | if(!processedPos){
|
32524 | itemsData[i] = this.createStyleElement(arr[i], level);
|
32525 | } else {
|
32526 | itemsData[i].style.closed = false;
|
32527 | }
|
32528 | if(arr[i]._render){
|
32529 | container.appendChild(itemsData[i].style.pElem);
|
32530 | }
|
32531 | ownStyles.push(itemsData[i].style);
|
32532 | }else if(arr[i].ty == 'gr'){
|
32533 | if(!processedPos){
|
32534 | itemsData[i] = this.createGroupElement(arr[i]);
|
32535 | } else {
|
32536 | jLen = itemsData[i].it.length;
|
32537 | for(j=0;j<jLen;j+=1){
|
32538 | itemsData[i].prevViewData[j] = itemsData[i].it[j];
|
32539 | }
|
32540 | }
|
32541 | this.searchShapes(arr[i].it,itemsData[i].it,itemsData[i].prevViewData,itemsData[i].gr, level + 1, ownTransformers, render);
|
32542 | if(arr[i]._render){
|
32543 | container.appendChild(itemsData[i].gr);
|
32544 | }
|
32545 | }else if(arr[i].ty == 'tr'){
|
32546 | if(!processedPos){
|
32547 | itemsData[i] = this.createTransformElement(arr[i], container);
|
32548 | }
|
32549 | currentTransform = itemsData[i].transform;
|
32550 | ownTransformers.push(currentTransform);
|
32551 | }else if(arr[i].ty == 'sh' || arr[i].ty == 'rc' || arr[i].ty == 'el' || arr[i].ty == 'sr'){
|
32552 | if(!processedPos){
|
32553 | itemsData[i] = this.createShapeElement(arr[i], ownTransformers, level);
|
32554 | }
|
32555 | this.setElementStyles(itemsData[i]);
|
32556 |
|
32557 | }else if(arr[i].ty == 'tm' || arr[i].ty == 'rd' || arr[i].ty == 'ms'){
|
32558 | if(!processedPos){
|
32559 | modifier = ShapeModifiers.getModifier(arr[i].ty);
|
32560 | modifier.init(this,arr[i]);
|
32561 | itemsData[i] = modifier;
|
32562 | this.shapeModifiers.push(modifier);
|
32563 | } else {
|
32564 | modifier = itemsData[i];
|
32565 | modifier.closed = false;
|
32566 | }
|
32567 | ownModifiers.push(modifier);
|
32568 | }else if(arr[i].ty == 'rp'){
|
32569 | if(!processedPos){
|
32570 | modifier = ShapeModifiers.getModifier(arr[i].ty);
|
32571 | itemsData[i] = modifier;
|
32572 | modifier.init(this,arr,i,itemsData);
|
32573 | this.shapeModifiers.push(modifier);
|
32574 | render = false;
|
32575 | }else{
|
32576 | modifier = itemsData[i];
|
32577 | modifier.closed = true;
|
32578 | }
|
32579 | ownModifiers.push(modifier);
|
32580 | }
|
32581 | this.addProcessedElement(arr[i], i + 1);
|
32582 | }
|
32583 | len = ownStyles.length;
|
32584 | for(i=0;i<len;i+=1){
|
32585 | ownStyles[i].closed = true;
|
32586 | }
|
32587 | len = ownModifiers.length;
|
32588 | for(i=0;i<len;i+=1){
|
32589 | ownModifiers[i].closed = true;
|
32590 | }
|
32591 | };
|
32592 |
|
32593 | SVGShapeElement.prototype.renderInnerContent = function() {
|
32594 | this.renderModifiers();
|
32595 | var i, len = this.stylesList.length;
|
32596 | for(i=0;i<len;i+=1){
|
32597 | this.stylesList[i].reset();
|
32598 | }
|
32599 | this.renderShape();
|
32600 |
|
32601 | for (i = 0; i < len; i += 1) {
|
32602 | if (this.stylesList[i]._mdf || this._isFirstFrame) {
|
32603 | if(this.stylesList[i].msElem){
|
32604 | this.stylesList[i].msElem.setAttribute('d', this.stylesList[i].d);
|
32605 | //Adding M0 0 fixes same mask bug on all browsers
|
32606 | this.stylesList[i].d = 'M0 0' + this.stylesList[i].d;
|
32607 | }
|
32608 | this.stylesList[i].pElem.setAttribute('d', this.stylesList[i].d || 'M0 0');
|
32609 | }
|
32610 | }
|
32611 | };
|
32612 |
|
32613 | SVGShapeElement.prototype.renderShape = function() {
|
32614 | var i, len = this.animatedContents.length;
|
32615 | var animatedContent;
|
32616 | for(i = 0; i < len; i += 1) {
|
32617 | animatedContent = this.animatedContents[i];
|
32618 | if((this._isFirstFrame || animatedContent.element._isAnimated) && animatedContent.data !== true) {
|
32619 | animatedContent.fn(animatedContent.data, animatedContent.element, this._isFirstFrame);
|
32620 | }
|
32621 | }
|
32622 | };
|
32623 |
|
32624 | SVGShapeElement.prototype.destroy = function(){
|
32625 | this.destroyBaseElement();
|
32626 | this.shapesData = null;
|
32627 | this.itemsData = null;
|
32628 | };
|
32629 |
|
32630 | function SVGTintFilter(filter, filterManager){
|
32631 | this.filterManager = filterManager;
|
32632 | var feColorMatrix = createNS('feColorMatrix');
|
32633 | feColorMatrix.setAttribute('type','matrix');
|
32634 | feColorMatrix.setAttribute('color-interpolation-filters','linearRGB');
|
32635 | feColorMatrix.setAttribute('values','0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0');
|
32636 | feColorMatrix.setAttribute('result','f1');
|
32637 | filter.appendChild(feColorMatrix);
|
32638 | feColorMatrix = createNS('feColorMatrix');
|
32639 | feColorMatrix.setAttribute('type','matrix');
|
32640 | feColorMatrix.setAttribute('color-interpolation-filters','sRGB');
|
32641 | feColorMatrix.setAttribute('values','1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0');
|
32642 | feColorMatrix.setAttribute('result','f2');
|
32643 | filter.appendChild(feColorMatrix);
|
32644 | this.matrixFilter = feColorMatrix;
|
32645 | if(filterManager.effectElements[2].p.v !== 100 || filterManager.effectElements[2].p.k){
|
32646 | var feMerge = createNS('feMerge');
|
32647 | filter.appendChild(feMerge);
|
32648 | var feMergeNode;
|
32649 | feMergeNode = createNS('feMergeNode');
|
32650 | feMergeNode.setAttribute('in','SourceGraphic');
|
32651 | feMerge.appendChild(feMergeNode);
|
32652 | feMergeNode = createNS('feMergeNode');
|
32653 | feMergeNode.setAttribute('in','f2');
|
32654 | feMerge.appendChild(feMergeNode);
|
32655 | }
|
32656 | }
|
32657 |
|
32658 | SVGTintFilter.prototype.renderFrame = function(forceRender){
|
32659 | if(forceRender || this.filterManager._mdf){
|
32660 | var colorBlack = this.filterManager.effectElements[0].p.v;
|
32661 | var colorWhite = this.filterManager.effectElements[1].p.v;
|
32662 | var opacity = this.filterManager.effectElements[2].p.v/100;
|
32663 | this.matrixFilter.setAttribute('values',(colorWhite[0]- colorBlack[0])+' 0 0 0 '+ colorBlack[0] +' '+ (colorWhite[1]- colorBlack[1]) +' 0 0 0 '+ colorBlack[1] +' '+ (colorWhite[2]- colorBlack[2]) +' 0 0 0 '+ colorBlack[2] +' 0 0 0 ' + opacity + ' 0');
|
32664 | }
|
32665 | };
|
32666 | function SVGFillFilter(filter, filterManager){
|
32667 | this.filterManager = filterManager;
|
32668 | var feColorMatrix = createNS('feColorMatrix');
|
32669 | feColorMatrix.setAttribute('type','matrix');
|
32670 | feColorMatrix.setAttribute('color-interpolation-filters','sRGB');
|
32671 | feColorMatrix.setAttribute('values','1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0');
|
32672 | filter.appendChild(feColorMatrix);
|
32673 | this.matrixFilter = feColorMatrix;
|
32674 | }
|
32675 | SVGFillFilter.prototype.renderFrame = function(forceRender){
|
32676 | if(forceRender || this.filterManager._mdf){
|
32677 | var color = this.filterManager.effectElements[2].p.v;
|
32678 | var opacity = this.filterManager.effectElements[6].p.v;
|
32679 | this.matrixFilter.setAttribute('values','0 0 0 0 '+color[0]+' 0 0 0 0 '+color[1]+' 0 0 0 0 '+color[2]+' 0 0 0 '+opacity+' 0');
|
32680 | }
|
32681 | };
|
32682 | function SVGStrokeEffect(elem, filterManager){
|
32683 | this.initialized = false;
|
32684 | this.filterManager = filterManager;
|
32685 | this.elem = elem;
|
32686 | this.paths = [];
|
32687 | }
|
32688 |
|
32689 | SVGStrokeEffect.prototype.initialize = function(){
|
32690 |
|
32691 | var elemChildren = this.elem.layerElement.children || this.elem.layerElement.childNodes;
|
32692 | var path,groupPath, i, len;
|
32693 | if(this.filterManager.effectElements[1].p.v === 1){
|
32694 | len = this.elem.maskManager.masksProperties.length;
|
32695 | i = 0;
|
32696 | } else {
|
32697 | i = this.filterManager.effectElements[0].p.v - 1;
|
32698 | len = i + 1;
|
32699 | }
|
32700 | groupPath = createNS('g');
|
32701 | groupPath.setAttribute('fill','none');
|
32702 | groupPath.setAttribute('stroke-linecap','round');
|
32703 | groupPath.setAttribute('stroke-dashoffset',1);
|
32704 | for(i;i<len;i+=1){
|
32705 | path = createNS('path');
|
32706 | groupPath.appendChild(path);
|
32707 | this.paths.push({p:path,m:i});
|
32708 | }
|
32709 | if(this.filterManager.effectElements[10].p.v === 3){
|
32710 | var mask = createNS('mask');
|
32711 | var id = createElementID();
|
32712 | mask.setAttribute('id',id);
|
32713 | mask.setAttribute('mask-type','alpha');
|
32714 | mask.appendChild(groupPath);
|
32715 | this.elem.globalData.defs.appendChild(mask);
|
32716 | var g = createNS('g');
|
32717 | g.setAttribute('mask','url(' + locationHref + '#'+id+')');
|
32718 | while (elemChildren[0]) {
|
32719 | g.appendChild(elemChildren[0]);
|
32720 | }
|
32721 | this.elem.layerElement.appendChild(g);
|
32722 | this.masker = mask;
|
32723 | groupPath.setAttribute('stroke','#fff');
|
32724 | } else if(this.filterManager.effectElements[10].p.v === 1 || this.filterManager.effectElements[10].p.v === 2){
|
32725 | if(this.filterManager.effectElements[10].p.v === 2){
|
32726 | elemChildren = this.elem.layerElement.children || this.elem.layerElement.childNodes;
|
32727 | while(elemChildren.length){
|
32728 | this.elem.layerElement.removeChild(elemChildren[0]);
|
32729 | }
|
32730 | }
|
32731 | this.elem.layerElement.appendChild(groupPath);
|
32732 | this.elem.layerElement.removeAttribute('mask');
|
32733 | groupPath.setAttribute('stroke','#fff');
|
32734 | }
|
32735 | this.initialized = true;
|
32736 | this.pathMasker = groupPath;
|
32737 | };
|
32738 |
|
32739 | SVGStrokeEffect.prototype.renderFrame = function(forceRender){
|
32740 | if(!this.initialized){
|
32741 | this.initialize();
|
32742 | }
|
32743 | var i, len = this.paths.length;
|
32744 | var mask, path;
|
32745 | for(i=0;i<len;i+=1){
|
32746 | if(this.paths[i].m === -1) {
|
32747 | continue;
|
32748 | }
|
32749 | mask = this.elem.maskManager.viewData[this.paths[i].m];
|
32750 | path = this.paths[i].p;
|
32751 | if(forceRender || this.filterManager._mdf || mask.prop._mdf){
|
32752 | path.setAttribute('d',mask.lastPath);
|
32753 | }
|
32754 | if(forceRender || this.filterManager.effectElements[9].p._mdf || this.filterManager.effectElements[4].p._mdf || this.filterManager.effectElements[7].p._mdf || this.filterManager.effectElements[8].p._mdf || mask.prop._mdf){
|
32755 | var dasharrayValue;
|
32756 | if(this.filterManager.effectElements[7].p.v !== 0 || this.filterManager.effectElements[8].p.v !== 100){
|
32757 | var s = Math.min(this.filterManager.effectElements[7].p.v,this.filterManager.effectElements[8].p.v)/100;
|
32758 | var e = Math.max(this.filterManager.effectElements[7].p.v,this.filterManager.effectElements[8].p.v)/100;
|
32759 | var l = path.getTotalLength();
|
32760 | dasharrayValue = '0 0 0 ' + l*s + ' ';
|
32761 | var lineLength = l*(e-s);
|
32762 | var segment = 1+this.filterManager.effectElements[4].p.v*2*this.filterManager.effectElements[9].p.v/100;
|
32763 | var units = Math.floor(lineLength/segment);
|
32764 | var j;
|
32765 | for(j=0;j<units;j+=1){
|
32766 | dasharrayValue += '1 ' + this.filterManager.effectElements[4].p.v*2*this.filterManager.effectElements[9].p.v/100 + ' ';
|
32767 | }
|
32768 | dasharrayValue += '0 ' + l*10 + ' 0 0';
|
32769 | } else {
|
32770 | dasharrayValue = '1 ' + this.filterManager.effectElements[4].p.v*2*this.filterManager.effectElements[9].p.v/100;
|
32771 | }
|
32772 | path.setAttribute('stroke-dasharray',dasharrayValue);
|
32773 | }
|
32774 | }
|
32775 | if(forceRender || this.filterManager.effectElements[4].p._mdf){
|
32776 | this.pathMasker.setAttribute('stroke-width',this.filterManager.effectElements[4].p.v*2);
|
32777 | }
|
32778 |
|
32779 | if(forceRender || this.filterManager.effectElements[6].p._mdf){
|
32780 | this.pathMasker.setAttribute('opacity',this.filterManager.effectElements[6].p.v);
|
32781 | }
|
32782 | if(this.filterManager.effectElements[10].p.v === 1 || this.filterManager.effectElements[10].p.v === 2){
|
32783 | if(forceRender || this.filterManager.effectElements[3].p._mdf){
|
32784 | var color = this.filterManager.effectElements[3].p.v;
|
32785 | this.pathMasker.setAttribute('stroke','rgb('+bm_floor(color[0]*255)+','+bm_floor(color[1]*255)+','+bm_floor(color[2]*255)+')');
|
32786 | }
|
32787 | }
|
32788 | };
|
32789 | function SVGTritoneFilter(filter, filterManager){
|
32790 | this.filterManager = filterManager;
|
32791 | var feColorMatrix = createNS('feColorMatrix');
|
32792 | feColorMatrix.setAttribute('type','matrix');
|
32793 | feColorMatrix.setAttribute('color-interpolation-filters','linearRGB');
|
32794 | feColorMatrix.setAttribute('values','0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0');
|
32795 | feColorMatrix.setAttribute('result','f1');
|
32796 | filter.appendChild(feColorMatrix);
|
32797 | var feComponentTransfer = createNS('feComponentTransfer');
|
32798 | feComponentTransfer.setAttribute('color-interpolation-filters','sRGB');
|
32799 | filter.appendChild(feComponentTransfer);
|
32800 | this.matrixFilter = feComponentTransfer;
|
32801 | var feFuncR = createNS('feFuncR');
|
32802 | feFuncR.setAttribute('type','table');
|
32803 | feComponentTransfer.appendChild(feFuncR);
|
32804 | this.feFuncR = feFuncR;
|
32805 | var feFuncG = createNS('feFuncG');
|
32806 | feFuncG.setAttribute('type','table');
|
32807 | feComponentTransfer.appendChild(feFuncG);
|
32808 | this.feFuncG = feFuncG;
|
32809 | var feFuncB = createNS('feFuncB');
|
32810 | feFuncB.setAttribute('type','table');
|
32811 | feComponentTransfer.appendChild(feFuncB);
|
32812 | this.feFuncB = feFuncB;
|
32813 | }
|
32814 |
|
32815 | SVGTritoneFilter.prototype.renderFrame = function(forceRender){
|
32816 | if(forceRender || this.filterManager._mdf){
|
32817 | var color1 = this.filterManager.effectElements[0].p.v;
|
32818 | var color2 = this.filterManager.effectElements[1].p.v;
|
32819 | var color3 = this.filterManager.effectElements[2].p.v;
|
32820 | var tableR = color3[0] + ' ' + color2[0] + ' ' + color1[0];
|
32821 | var tableG = color3[1] + ' ' + color2[1] + ' ' + color1[1];
|
32822 | var tableB = color3[2] + ' ' + color2[2] + ' ' + color1[2];
|
32823 | this.feFuncR.setAttribute('tableValues', tableR);
|
32824 | this.feFuncG.setAttribute('tableValues', tableG);
|
32825 | this.feFuncB.setAttribute('tableValues', tableB);
|
32826 | //var opacity = this.filterManager.effectElements[2].p.v/100;
|
32827 | //this.matrixFilter.setAttribute('values',(colorWhite[0]- colorBlack[0])+' 0 0 0 '+ colorBlack[0] +' '+ (colorWhite[1]- colorBlack[1]) +' 0 0 0 '+ colorBlack[1] +' '+ (colorWhite[2]- colorBlack[2]) +' 0 0 0 '+ colorBlack[2] +' 0 0 0 ' + opacity + ' 0');
|
32828 | }
|
32829 | };
|
32830 | function SVGProLevelsFilter(filter, filterManager){
|
32831 | this.filterManager = filterManager;
|
32832 | var effectElements = this.filterManager.effectElements;
|
32833 | var feComponentTransfer = createNS('feComponentTransfer');
|
32834 |
|
32835 | if(effectElements[10].p.k || effectElements[10].p.v !== 0 || effectElements[11].p.k || effectElements[11].p.v !== 1 || effectElements[12].p.k || effectElements[12].p.v !== 1 || effectElements[13].p.k || effectElements[13].p.v !== 0 || effectElements[14].p.k || effectElements[14].p.v !== 1){
|
32836 | this.feFuncR = this.createFeFunc('feFuncR', feComponentTransfer);
|
32837 | }
|
32838 | if(effectElements[17].p.k || effectElements[17].p.v !== 0 || effectElements[18].p.k || effectElements[18].p.v !== 1 || effectElements[19].p.k || effectElements[19].p.v !== 1 || effectElements[20].p.k || effectElements[20].p.v !== 0 || effectElements[21].p.k || effectElements[21].p.v !== 1){
|
32839 | this.feFuncG = this.createFeFunc('feFuncG', feComponentTransfer);
|
32840 | }
|
32841 | if(effectElements[24].p.k || effectElements[24].p.v !== 0 || effectElements[25].p.k || effectElements[25].p.v !== 1 || effectElements[26].p.k || effectElements[26].p.v !== 1 || effectElements[27].p.k || effectElements[27].p.v !== 0 || effectElements[28].p.k || effectElements[28].p.v !== 1){
|
32842 | this.feFuncB = this.createFeFunc('feFuncB', feComponentTransfer);
|
32843 | }
|
32844 | if(effectElements[31].p.k || effectElements[31].p.v !== 0 || effectElements[32].p.k || effectElements[32].p.v !== 1 || effectElements[33].p.k || effectElements[33].p.v !== 1 || effectElements[34].p.k || effectElements[34].p.v !== 0 || effectElements[35].p.k || effectElements[35].p.v !== 1){
|
32845 | this.feFuncA = this.createFeFunc('feFuncA', feComponentTransfer);
|
32846 | }
|
32847 |
|
32848 | if(this.feFuncR || this.feFuncG || this.feFuncB || this.feFuncA){
|
32849 | feComponentTransfer.setAttribute('color-interpolation-filters','sRGB');
|
32850 | filter.appendChild(feComponentTransfer);
|
32851 | feComponentTransfer = createNS('feComponentTransfer');
|
32852 | }
|
32853 |
|
32854 | if(effectElements[3].p.k || effectElements[3].p.v !== 0 || effectElements[4].p.k || effectElements[4].p.v !== 1 || effectElements[5].p.k || effectElements[5].p.v !== 1 || effectElements[6].p.k || effectElements[6].p.v !== 0 || effectElements[7].p.k || effectElements[7].p.v !== 1){
|
32855 |
|
32856 | feComponentTransfer.setAttribute('color-interpolation-filters','sRGB');
|
32857 | filter.appendChild(feComponentTransfer);
|
32858 | this.feFuncRComposed = this.createFeFunc('feFuncR', feComponentTransfer);
|
32859 | this.feFuncGComposed = this.createFeFunc('feFuncG', feComponentTransfer);
|
32860 | this.feFuncBComposed = this.createFeFunc('feFuncB', feComponentTransfer);
|
32861 | }
|
32862 | }
|
32863 |
|
32864 | SVGProLevelsFilter.prototype.createFeFunc = function(type, feComponentTransfer) {
|
32865 | var feFunc = createNS(type);
|
32866 | feFunc.setAttribute('type','table');
|
32867 | feComponentTransfer.appendChild(feFunc);
|
32868 | return feFunc;
|
32869 | };
|
32870 |
|
32871 | SVGProLevelsFilter.prototype.getTableValue = function(inputBlack, inputWhite, gamma, outputBlack, outputWhite) {
|
32872 | var cnt = 0;
|
32873 | var segments = 256;
|
32874 | var perc;
|
32875 | var min = Math.min(inputBlack, inputWhite);
|
32876 | var max = Math.max(inputBlack, inputWhite);
|
32877 | var table = Array.call(null,{length:segments});
|
32878 | var colorValue;
|
32879 | var pos = 0;
|
32880 | var outputDelta = outputWhite - outputBlack;
|
32881 | var inputDelta = inputWhite - inputBlack;
|
32882 | while(cnt <= 256) {
|
32883 | perc = cnt/256;
|
32884 | if(perc <= min){
|
32885 | colorValue = inputDelta < 0 ? outputWhite : outputBlack;
|
32886 | } else if(perc >= max){
|
32887 | colorValue = inputDelta < 0 ? outputBlack : outputWhite;
|
32888 | } else {
|
32889 | colorValue = (outputBlack + outputDelta * Math.pow((perc - inputBlack) / inputDelta, 1 / gamma));
|
32890 | }
|
32891 | table[pos++] = colorValue;
|
32892 | cnt += 256/(segments-1);
|
32893 | }
|
32894 | return table.join(' ');
|
32895 | };
|
32896 |
|
32897 | SVGProLevelsFilter.prototype.renderFrame = function(forceRender){
|
32898 | if(forceRender || this.filterManager._mdf){
|
32899 | var val;
|
32900 | var effectElements = this.filterManager.effectElements;
|
32901 | if(this.feFuncRComposed && (forceRender || effectElements[3].p._mdf || effectElements[4].p._mdf || effectElements[5].p._mdf || effectElements[6].p._mdf || effectElements[7].p._mdf)){
|
32902 | val = this.getTableValue(effectElements[3].p.v,effectElements[4].p.v,effectElements[5].p.v,effectElements[6].p.v,effectElements[7].p.v);
|
32903 | this.feFuncRComposed.setAttribute('tableValues',val);
|
32904 | this.feFuncGComposed.setAttribute('tableValues',val);
|
32905 | this.feFuncBComposed.setAttribute('tableValues',val);
|
32906 | }
|
32907 |
|
32908 |
|
32909 | if(this.feFuncR && (forceRender || effectElements[10].p._mdf || effectElements[11].p._mdf || effectElements[12].p._mdf || effectElements[13].p._mdf || effectElements[14].p._mdf)){
|
32910 | val = this.getTableValue(effectElements[10].p.v,effectElements[11].p.v,effectElements[12].p.v,effectElements[13].p.v,effectElements[14].p.v);
|
32911 | this.feFuncR.setAttribute('tableValues',val);
|
32912 | }
|
32913 |
|
32914 | if(this.feFuncG && (forceRender || effectElements[17].p._mdf || effectElements[18].p._mdf || effectElements[19].p._mdf || effectElements[20].p._mdf || effectElements[21].p._mdf)){
|
32915 | val = this.getTableValue(effectElements[17].p.v,effectElements[18].p.v,effectElements[19].p.v,effectElements[20].p.v,effectElements[21].p.v);
|
32916 | this.feFuncG.setAttribute('tableValues',val);
|
32917 | }
|
32918 |
|
32919 | if(this.feFuncB && (forceRender || effectElements[24].p._mdf || effectElements[25].p._mdf || effectElements[26].p._mdf || effectElements[27].p._mdf || effectElements[28].p._mdf)){
|
32920 | val = this.getTableValue(effectElements[24].p.v,effectElements[25].p.v,effectElements[26].p.v,effectElements[27].p.v,effectElements[28].p.v);
|
32921 | this.feFuncB.setAttribute('tableValues',val);
|
32922 | }
|
32923 |
|
32924 | if(this.feFuncA && (forceRender || effectElements[31].p._mdf || effectElements[32].p._mdf || effectElements[33].p._mdf || effectElements[34].p._mdf || effectElements[35].p._mdf)){
|
32925 | val = this.getTableValue(effectElements[31].p.v,effectElements[32].p.v,effectElements[33].p.v,effectElements[34].p.v,effectElements[35].p.v);
|
32926 | this.feFuncA.setAttribute('tableValues',val);
|
32927 | }
|
32928 |
|
32929 | }
|
32930 | };
|
32931 | function SVGDropShadowEffect(filter, filterManager){
|
32932 | filter.setAttribute('x','-100%');
|
32933 | filter.setAttribute('y','-100%');
|
32934 | filter.setAttribute('width','400%');
|
32935 | filter.setAttribute('height','400%');
|
32936 | this.filterManager = filterManager;
|
32937 |
|
32938 | var feGaussianBlur = createNS('feGaussianBlur');
|
32939 | feGaussianBlur.setAttribute('in','SourceAlpha');
|
32940 | feGaussianBlur.setAttribute('result','drop_shadow_1');
|
32941 | feGaussianBlur.setAttribute('stdDeviation','0');
|
32942 | this.feGaussianBlur = feGaussianBlur;
|
32943 | filter.appendChild(feGaussianBlur);
|
32944 |
|
32945 | var feOffset = createNS('feOffset');
|
32946 | feOffset.setAttribute('dx','25');
|
32947 | feOffset.setAttribute('dy','0');
|
32948 | feOffset.setAttribute('in','drop_shadow_1');
|
32949 | feOffset.setAttribute('result','drop_shadow_2');
|
32950 | this.feOffset = feOffset;
|
32951 | filter.appendChild(feOffset);
|
32952 | var feFlood = createNS('feFlood');
|
32953 | feFlood.setAttribute('flood-color','#00ff00');
|
32954 | feFlood.setAttribute('flood-opacity','1');
|
32955 | feFlood.setAttribute('result','drop_shadow_3');
|
32956 | this.feFlood = feFlood;
|
32957 | filter.appendChild(feFlood);
|
32958 |
|
32959 | var feComposite = createNS('feComposite');
|
32960 | feComposite.setAttribute('in','drop_shadow_3');
|
32961 | feComposite.setAttribute('in2','drop_shadow_2');
|
32962 | feComposite.setAttribute('operator','in');
|
32963 | feComposite.setAttribute('result','drop_shadow_4');
|
32964 | filter.appendChild(feComposite);
|
32965 |
|
32966 |
|
32967 | var feMerge = createNS('feMerge');
|
32968 | filter.appendChild(feMerge);
|
32969 | var feMergeNode;
|
32970 | feMergeNode = createNS('feMergeNode');
|
32971 | feMerge.appendChild(feMergeNode);
|
32972 | feMergeNode = createNS('feMergeNode');
|
32973 | feMergeNode.setAttribute('in','SourceGraphic');
|
32974 | this.feMergeNode = feMergeNode;
|
32975 | this.feMerge = feMerge;
|
32976 | this.originalNodeAdded = false;
|
32977 | feMerge.appendChild(feMergeNode);
|
32978 | }
|
32979 |
|
32980 | SVGDropShadowEffect.prototype.renderFrame = function(forceRender){
|
32981 | if(forceRender || this.filterManager._mdf){
|
32982 | if(forceRender || this.filterManager.effectElements[4].p._mdf){
|
32983 | this.feGaussianBlur.setAttribute('stdDeviation', this.filterManager.effectElements[4].p.v / 4);
|
32984 | }
|
32985 | if(forceRender || this.filterManager.effectElements[0].p._mdf){
|
32986 | var col = this.filterManager.effectElements[0].p.v;
|
32987 | this.feFlood.setAttribute('flood-color',rgbToHex(Math.round(col[0]*255),Math.round(col[1]*255),Math.round(col[2]*255)));
|
32988 | }
|
32989 | if(forceRender || this.filterManager.effectElements[1].p._mdf){
|
32990 | this.feFlood.setAttribute('flood-opacity',this.filterManager.effectElements[1].p.v/255);
|
32991 | }
|
32992 | if(forceRender || this.filterManager.effectElements[2].p._mdf || this.filterManager.effectElements[3].p._mdf){
|
32993 | var distance = this.filterManager.effectElements[3].p.v;
|
32994 | var angle = (this.filterManager.effectElements[2].p.v - 90) * degToRads;
|
32995 | var x = distance * Math.cos(angle);
|
32996 | var y = distance * Math.sin(angle);
|
32997 | this.feOffset.setAttribute('dx', x);
|
32998 | this.feOffset.setAttribute('dy', y);
|
32999 | }
|
33000 | /*if(forceRender || this.filterManager.effectElements[5].p._mdf){
|
33001 | if(this.filterManager.effectElements[5].p.v === 1 && this.originalNodeAdded) {
|
33002 | this.feMerge.removeChild(this.feMergeNode);
|
33003 | this.originalNodeAdded = false;
|
33004 | } else if(this.filterManager.effectElements[5].p.v === 0 && !this.originalNodeAdded) {
|
33005 | this.feMerge.appendChild(this.feMergeNode);
|
33006 | this.originalNodeAdded = true;
|
33007 | }
|
33008 | }*/
|
33009 | }
|
33010 | };
|
33011 | var _svgMatteSymbols = [];
|
33012 |
|
33013 | function SVGMatte3Effect(filterElem, filterManager, elem){
|
33014 | this.initialized = false;
|
33015 | this.filterManager = filterManager;
|
33016 | this.filterElem = filterElem;
|
33017 | this.elem = elem;
|
33018 | elem.matteElement = createNS('g');
|
33019 | elem.matteElement.appendChild(elem.layerElement);
|
33020 | elem.matteElement.appendChild(elem.transformedElement);
|
33021 | elem.baseElement = elem.matteElement;
|
33022 | }
|
33023 |
|
33024 | SVGMatte3Effect.prototype.findSymbol = function(mask) {
|
33025 | var i = 0, len = _svgMatteSymbols.length;
|
33026 | while(i < len) {
|
33027 | if(_svgMatteSymbols[i] === mask) {
|
33028 | return _svgMatteSymbols[i];
|
33029 | }
|
33030 | i += 1;
|
33031 | }
|
33032 | return null;
|
33033 | };
|
33034 |
|
33035 | SVGMatte3Effect.prototype.replaceInParent = function(mask, symbolId) {
|
33036 | var parentNode = mask.layerElement.parentNode;
|
33037 | if(!parentNode) {
|
33038 | return;
|
33039 | }
|
33040 | var children = parentNode.children;
|
33041 | var i = 0, len = children.length;
|
33042 | while (i < len) {
|
33043 | if (children[i] === mask.layerElement) {
|
33044 | break;
|
33045 | }
|
33046 | i += 1;
|
33047 | }
|
33048 | var nextChild;
|
33049 | if (i <= len - 2) {
|
33050 | nextChild = children[i + 1];
|
33051 | }
|
33052 | var useElem = createNS('use');
|
33053 | useElem.setAttribute('href', '#' + symbolId);
|
33054 | if(nextChild) {
|
33055 | parentNode.insertBefore(useElem, nextChild);
|
33056 | } else {
|
33057 | parentNode.appendChild(useElem);
|
33058 | }
|
33059 | };
|
33060 |
|
33061 | SVGMatte3Effect.prototype.setElementAsMask = function(elem, mask) {
|
33062 | if(!this.findSymbol(mask)) {
|
33063 | var symbolId = createElementID();
|
33064 | var masker = createNS('mask');
|
33065 | masker.setAttribute('id', mask.layerId);
|
33066 | masker.setAttribute('mask-type', 'alpha');
|
33067 | _svgMatteSymbols.push(mask);
|
33068 | var defs = elem.globalData.defs;
|
33069 | defs.appendChild(masker);
|
33070 | var symbol = createNS('symbol');
|
33071 | symbol.setAttribute('id', symbolId);
|
33072 | this.replaceInParent(mask, symbolId);
|
33073 | symbol.appendChild(mask.layerElement);
|
33074 | defs.appendChild(symbol);
|
33075 | var useElem = createNS('use');
|
33076 | useElem.setAttribute('href', '#' + symbolId);
|
33077 | masker.appendChild(useElem);
|
33078 | mask.data.hd = false;
|
33079 | mask.show();
|
33080 | }
|
33081 | elem.setMatte(mask.layerId);
|
33082 | };
|
33083 |
|
33084 | SVGMatte3Effect.prototype.initialize = function() {
|
33085 | var ind = this.filterManager.effectElements[0].p.v;
|
33086 | var elements = this.elem.comp.elements;
|
33087 | var i = 0, len = elements.length;
|
33088 | while (i < len) {
|
33089 | if (elements[i] && elements[i].data.ind === ind) {
|
33090 | this.setElementAsMask(this.elem, elements[i]);
|
33091 | }
|
33092 | i += 1;
|
33093 | }
|
33094 | this.initialized = true;
|
33095 | };
|
33096 |
|
33097 | SVGMatte3Effect.prototype.renderFrame = function() {
|
33098 | if(!this.initialized) {
|
33099 | this.initialize();
|
33100 | }
|
33101 | };
|
33102 | function SVGEffects(elem){
|
33103 | var i, len = elem.data.ef ? elem.data.ef.length : 0;
|
33104 | var filId = createElementID();
|
33105 | var fil = filtersFactory.createFilter(filId);
|
33106 | var count = 0;
|
33107 | this.filters = [];
|
33108 | var filterManager;
|
33109 | for(i=0;i<len;i+=1){
|
33110 | filterManager = null;
|
33111 | if(elem.data.ef[i].ty === 20){
|
33112 | count += 1;
|
33113 | filterManager = new SVGTintFilter(fil, elem.effectsManager.effectElements[i]);
|
33114 | }else if(elem.data.ef[i].ty === 21){
|
33115 | count += 1;
|
33116 | filterManager = new SVGFillFilter(fil, elem.effectsManager.effectElements[i]);
|
33117 | }else if(elem.data.ef[i].ty === 22){
|
33118 | filterManager = new SVGStrokeEffect(elem, elem.effectsManager.effectElements[i]);
|
33119 | }else if(elem.data.ef[i].ty === 23){
|
33120 | count += 1;
|
33121 | filterManager = new SVGTritoneFilter(fil, elem.effectsManager.effectElements[i]);
|
33122 | }else if(elem.data.ef[i].ty === 24){
|
33123 | count += 1;
|
33124 | filterManager = new SVGProLevelsFilter(fil, elem.effectsManager.effectElements[i]);
|
33125 | }else if(elem.data.ef[i].ty === 25){
|
33126 | count += 1;
|
33127 | filterManager = new SVGDropShadowEffect(fil, elem.effectsManager.effectElements[i]);
|
33128 | }else if(elem.data.ef[i].ty === 28){
|
33129 | //count += 1;
|
33130 | filterManager = new SVGMatte3Effect(fil, elem.effectsManager.effectElements[i], elem);
|
33131 | }
|
33132 | if(filterManager) {
|
33133 | this.filters.push(filterManager);
|
33134 | }
|
33135 | }
|
33136 | if(count){
|
33137 | elem.globalData.defs.appendChild(fil);
|
33138 | elem.layerElement.setAttribute('filter','url(' + locationHref + '#'+filId+')');
|
33139 | }
|
33140 | if (this.filters.length) {
|
33141 | elem.addRenderableComponent(this);
|
33142 | }
|
33143 | }
|
33144 |
|
33145 | SVGEffects.prototype.renderFrame = function(_isFirstFrame){
|
33146 | var i, len = this.filters.length;
|
33147 | for(i=0;i<len;i+=1){
|
33148 | this.filters[i].renderFrame(_isFirstFrame);
|
33149 | }
|
33150 | };
|
33151 | function CVContextData() {
|
33152 | this.saved = [];
|
33153 | this.cArrPos = 0;
|
33154 | this.cTr = new Matrix();
|
33155 | this.cO = 1;
|
33156 | var i, len = 15;
|
33157 | this.savedOp = createTypedArray('float32', len);
|
33158 | for(i=0;i<len;i+=1){
|
33159 | this.saved[i] = createTypedArray('float32', 16);
|
33160 | }
|
33161 | this._length = len;
|
33162 | }
|
33163 |
|
33164 | CVContextData.prototype.duplicate = function() {
|
33165 | var newLength = this._length * 2;
|
33166 | var currentSavedOp = this.savedOp;
|
33167 | this.savedOp = createTypedArray('float32', newLength);
|
33168 | this.savedOp.set(currentSavedOp);
|
33169 | var i = 0;
|
33170 | for(i = this._length; i < newLength; i += 1) {
|
33171 | this.saved[i] = createTypedArray('float32', 16);
|
33172 | }
|
33173 | this._length = newLength;
|
33174 | };
|
33175 |
|
33176 | CVContextData.prototype.reset = function() {
|
33177 | this.cArrPos = 0;
|
33178 | this.cTr.reset();
|
33179 | this.cO = 1;
|
33180 | };
|
33181 | function CVBaseElement(){
|
33182 | }
|
33183 |
|
33184 | CVBaseElement.prototype = {
|
33185 | createElements: function(){},
|
33186 | initRendererElement: function(){},
|
33187 | createContainerElements: function(){
|
33188 | this.canvasContext = this.globalData.canvasContext;
|
33189 | this.renderableEffectsManager = new CVEffects(this);
|
33190 | },
|
33191 | createContent: function(){},
|
33192 | setBlendMode: function(){
|
33193 | var globalData = this.globalData;
|
33194 | if(globalData.blendMode !== this.data.bm) {
|
33195 | globalData.blendMode = this.data.bm;
|
33196 | var blendModeValue = getBlendMode(this.data.bm);
|
33197 | globalData.canvasContext.globalCompositeOperation = blendModeValue;
|
33198 | }
|
33199 | },
|
33200 | createRenderableComponents: function(){
|
33201 | this.maskManager = new CVMaskElement(this.data, this);
|
33202 | },
|
33203 | hideElement: function(){
|
33204 | if (!this.hidden && (!this.isInRange || this.isTransparent)) {
|
33205 | this.hidden = true;
|
33206 | }
|
33207 | },
|
33208 | showElement: function(){
|
33209 | if (this.isInRange && !this.isTransparent){
|
33210 | this.hidden = false;
|
33211 | this._isFirstFrame = true;
|
33212 | this.maskManager._isFirstFrame = true;
|
33213 | }
|
33214 | },
|
33215 | renderFrame: function() {
|
33216 | if (this.hidden || this.data.hd) {
|
33217 | return;
|
33218 | }
|
33219 | this.renderTransform();
|
33220 | this.renderRenderable();
|
33221 | this.setBlendMode();
|
33222 | this.globalData.renderer.save();
|
33223 | this.globalData.renderer.ctxTransform(this.finalTransform.mat.props);
|
33224 | this.globalData.renderer.ctxOpacity(this.finalTransform.mProp.o.v);
|
33225 | this.renderInnerContent();
|
33226 | this.globalData.renderer.restore();
|
33227 | if(this.maskManager.hasMasks) {
|
33228 | this.globalData.renderer.restore(true);
|
33229 | }
|
33230 | if (this._isFirstFrame) {
|
33231 | this._isFirstFrame = false;
|
33232 | }
|
33233 | },
|
33234 | destroy: function(){
|
33235 | this.canvasContext = null;
|
33236 | this.data = null;
|
33237 | this.globalData = null;
|
33238 | this.maskManager.destroy();
|
33239 | },
|
33240 | mHelper: new Matrix()
|
33241 | };
|
33242 | CVBaseElement.prototype.hide = CVBaseElement.prototype.hideElement;
|
33243 | CVBaseElement.prototype.show = CVBaseElement.prototype.showElement;
|
33244 |
|
33245 | function CVImageElement(data, globalData, comp){
|
33246 | this.failed = false;
|
33247 | this.assetData = globalData.getAssetData(data.refId);
|
33248 | this.img = globalData.imageLoader.getImage(this.assetData);
|
33249 | this.initElement(data,globalData,comp);
|
33250 | }
|
33251 | extendPrototype([BaseElement, TransformElement, CVBaseElement, HierarchyElement, FrameElement, RenderableElement], CVImageElement);
|
33252 |
|
33253 | CVImageElement.prototype.initElement = SVGShapeElement.prototype.initElement;
|
33254 | CVImageElement.prototype.prepareFrame = IImageElement.prototype.prepareFrame;
|
33255 |
|
33256 | CVImageElement.prototype.createContent = function(){
|
33257 |
|
33258 | if (this.img.width && (this.assetData.w !== this.img.width || this.assetData.h !== this.img.height)) {
|
33259 | var canvas = createTag('canvas');
|
33260 | canvas.width = this.assetData.w;
|
33261 | canvas.height = this.assetData.h;
|
33262 | var ctx = canvas.getContext('2d');
|
33263 |
|
33264 | var imgW = this.img.width;
|
33265 | var imgH = this.img.height;
|
33266 | var imgRel = imgW / imgH;
|
33267 | var canvasRel = this.assetData.w/this.assetData.h;
|
33268 | var widthCrop, heightCrop;
|
33269 | var par = this.assetData.pr || this.globalData.renderConfig.imagePreserveAspectRatio;
|
33270 | if((imgRel > canvasRel && par === 'xMidYMid slice') || (imgRel < canvasRel && par !== 'xMidYMid slice')) {
|
33271 | heightCrop = imgH;
|
33272 | widthCrop = heightCrop*canvasRel;
|
33273 | } else {
|
33274 | widthCrop = imgW;
|
33275 | heightCrop = widthCrop/canvasRel;
|
33276 | }
|
33277 | ctx.drawImage(this.img,(imgW-widthCrop)/2,(imgH-heightCrop)/2,widthCrop,heightCrop,0,0,this.assetData.w,this.assetData.h);
|
33278 | this.img = canvas;
|
33279 | }
|
33280 |
|
33281 | };
|
33282 |
|
33283 | CVImageElement.prototype.renderInnerContent = function(parentMatrix){
|
33284 | if (this.failed) {
|
33285 | return;
|
33286 | }
|
33287 | this.canvasContext.drawImage(this.img, 0, 0);
|
33288 | };
|
33289 |
|
33290 | CVImageElement.prototype.destroy = function(){
|
33291 | this.img = null;
|
33292 | };
|
33293 | function CVCompElement(data, globalData, comp) {
|
33294 | this.completeLayers = false;
|
33295 | this.layers = data.layers;
|
33296 | this.pendingElements = [];
|
33297 | this.elements = createSizedArray(this.layers.length);
|
33298 | this.initElement(data, globalData, comp);
|
33299 | this.tm = data.tm ? PropertyFactory.getProp(this,data.tm,0,globalData.frameRate, this) : {_placeholder:true};
|
33300 | }
|
33301 |
|
33302 | extendPrototype([CanvasRenderer, ICompElement, CVBaseElement], CVCompElement);
|
33303 |
|
33304 | CVCompElement.prototype.renderInnerContent = function() {
|
33305 | var i,len = this.layers.length;
|
33306 | for( i = len - 1; i >= 0; i -= 1 ){
|
33307 | if(this.completeLayers || this.elements[i]){
|
33308 | this.elements[i].renderFrame();
|
33309 | }
|
33310 | }
|
33311 | };
|
33312 |
|
33313 | CVCompElement.prototype.destroy = function(){
|
33314 | var i,len = this.layers.length;
|
33315 | for( i = len - 1; i >= 0; i -= 1 ){
|
33316 | if(this.elements[i]) {
|
33317 | this.elements[i].destroy();
|
33318 | }
|
33319 | }
|
33320 | this.layers = null;
|
33321 | this.elements = null;
|
33322 | };
|
33323 |
|
33324 | function CVMaskElement(data,element){
|
33325 | this.data = data;
|
33326 | this.element = element;
|
33327 | this.masksProperties = this.data.masksProperties || [];
|
33328 | this.viewData = createSizedArray(this.masksProperties.length);
|
33329 | var i, len = this.masksProperties.length, hasMasks = false;
|
33330 | for (i = 0; i < len; i++) {
|
33331 | if(this.masksProperties[i].mode !== 'n'){
|
33332 | hasMasks = true;
|
33333 | }
|
33334 | this.viewData[i] = ShapePropertyFactory.getShapeProp(this.element,this.masksProperties[i],3);
|
33335 | }
|
33336 | this.hasMasks = hasMasks;
|
33337 | if(hasMasks) {
|
33338 | this.element.addRenderableComponent(this);
|
33339 | }
|
33340 | }
|
33341 |
|
33342 | CVMaskElement.prototype.renderFrame = function () {
|
33343 | if(!this.hasMasks){
|
33344 | return;
|
33345 | }
|
33346 | var transform = this.element.finalTransform.mat;
|
33347 | var ctx = this.element.canvasContext;
|
33348 | var i, len = this.masksProperties.length;
|
33349 | var pt,pts,data;
|
33350 | ctx.beginPath();
|
33351 | for (i = 0; i < len; i++) {
|
33352 | if(this.masksProperties[i].mode !== 'n'){
|
33353 | if (this.masksProperties[i].inv) {
|
33354 | ctx.moveTo(0, 0);
|
33355 | ctx.lineTo(this.element.globalData.compSize.w, 0);
|
33356 | ctx.lineTo(this.element.globalData.compSize.w, this.element.globalData.compSize.h);
|
33357 | ctx.lineTo(0, this.element.globalData.compSize.h);
|
33358 | ctx.lineTo(0, 0);
|
33359 | }
|
33360 | data = this.viewData[i].v;
|
33361 | pt = transform.applyToPointArray(data.v[0][0],data.v[0][1],0);
|
33362 | ctx.moveTo(pt[0], pt[1]);
|
33363 | var j, jLen = data._length;
|
33364 | for (j = 1; j < jLen; j++) {
|
33365 | pts = transform.applyToTriplePoints(data.o[j - 1], data.i[j], data.v[j]);
|
33366 | ctx.bezierCurveTo(pts[0], pts[1], pts[2], pts[3], pts[4], pts[5]);
|
33367 | }
|
33368 | pts = transform.applyToTriplePoints(data.o[j - 1], data.i[0], data.v[0]);
|
33369 | ctx.bezierCurveTo(pts[0], pts[1], pts[2], pts[3], pts[4], pts[5]);
|
33370 | }
|
33371 | }
|
33372 | this.element.globalData.renderer.save(true);
|
33373 | ctx.clip();
|
33374 | };
|
33375 |
|
33376 | CVMaskElement.prototype.getMaskProperty = MaskElement.prototype.getMaskProperty;
|
33377 |
|
33378 | CVMaskElement.prototype.destroy = function(){
|
33379 | this.element = null;
|
33380 | };
|
33381 | function CVShapeElement(data, globalData, comp) {
|
33382 | this.shapes = [];
|
33383 | this.shapesData = data.shapes;
|
33384 | this.stylesList = [];
|
33385 | this.itemsData = [];
|
33386 | this.prevViewData = [];
|
33387 | this.shapeModifiers = [];
|
33388 | this.processedElements = [];
|
33389 | this.transformsManager = new ShapeTransformManager();
|
33390 | this.initElement(data, globalData, comp);
|
33391 | }
|
33392 |
|
33393 | extendPrototype([BaseElement,TransformElement,CVBaseElement,IShapeElement,HierarchyElement,FrameElement,RenderableElement], CVShapeElement);
|
33394 |
|
33395 | CVShapeElement.prototype.initElement = RenderableDOMElement.prototype.initElement;
|
33396 |
|
33397 | CVShapeElement.prototype.transformHelper = {opacity:1,_opMdf:false};
|
33398 |
|
33399 | CVShapeElement.prototype.dashResetter = [];
|
33400 |
|
33401 | CVShapeElement.prototype.createContent = function(){
|
33402 | this.searchShapes(this.shapesData,this.itemsData,this.prevViewData, true, []);
|
33403 | };
|
33404 |
|
33405 | CVShapeElement.prototype.createStyleElement = function(data, transforms) {
|
33406 | var styleElem = {
|
33407 | data: data,
|
33408 | type: data.ty,
|
33409 | preTransforms: this.transformsManager.addTransformSequence(transforms),
|
33410 | transforms: [],
|
33411 | elements: [],
|
33412 | closed: data.hd === true
|
33413 | };
|
33414 | var elementData = {};
|
33415 | if(data.ty == 'fl' || data.ty == 'st'){
|
33416 | elementData.c = PropertyFactory.getProp(this,data.c,1,255,this);
|
33417 | if(!elementData.c.k){
|
33418 | styleElem.co = 'rgb('+bm_floor(elementData.c.v[0])+','+bm_floor(elementData.c.v[1])+','+bm_floor(elementData.c.v[2])+')';
|
33419 | }
|
33420 | } else if (data.ty === 'gf' || data.ty === 'gs') {
|
33421 | elementData.s = PropertyFactory.getProp(this,data.s,1,null,this);
|
33422 | elementData.e = PropertyFactory.getProp(this,data.e,1,null,this);
|
33423 | elementData.h = PropertyFactory.getProp(this,data.h||{k:0},0,0.01,this);
|
33424 | elementData.a = PropertyFactory.getProp(this,data.a||{k:0},0,degToRads,this);
|
33425 | elementData.g = new GradientProperty(this,data.g,this);
|
33426 | }
|
33427 | elementData.o = PropertyFactory.getProp(this,data.o,0,0.01,this);
|
33428 | if(data.ty == 'st' || data.ty == 'gs') {
|
33429 | styleElem.lc = this.lcEnum[data.lc] || 'round';
|
33430 | styleElem.lj = this.ljEnum[data.lj] || 'round';
|
33431 | if(data.lj == 1) {
|
33432 | styleElem.ml = data.ml;
|
33433 | }
|
33434 | elementData.w = PropertyFactory.getProp(this,data.w,0,null,this);
|
33435 | if(!elementData.w.k){
|
33436 | styleElem.wi = elementData.w.v;
|
33437 | }
|
33438 | if(data.d){
|
33439 | var d = new DashProperty(this,data.d,'canvas', this);
|
33440 | elementData.d = d;
|
33441 | if(!elementData.d.k){
|
33442 | styleElem.da = elementData.d.dashArray;
|
33443 | styleElem.do = elementData.d.dashoffset[0];
|
33444 | }
|
33445 | }
|
33446 | } else {
|
33447 | styleElem.r = data.r === 2 ? 'evenodd' : 'nonzero';
|
33448 | }
|
33449 | this.stylesList.push(styleElem);
|
33450 | elementData.style = styleElem;
|
33451 | return elementData;
|
33452 | };
|
33453 |
|
33454 | CVShapeElement.prototype.createGroupElement = function(data) {
|
33455 | var elementData = {
|
33456 | it: [],
|
33457 | prevViewData: []
|
33458 | };
|
33459 | return elementData;
|
33460 | };
|
33461 |
|
33462 | CVShapeElement.prototype.createTransformElement = function(data) {
|
33463 | var elementData = {
|
33464 | transform : {
|
33465 | opacity: 1,
|
33466 | _opMdf:false,
|
33467 | key: this.transformsManager.getNewKey(),
|
33468 | op: PropertyFactory.getProp(this,data.o,0,0.01,this),
|
33469 | mProps: TransformPropertyFactory.getTransformProperty(this,data,this)
|
33470 | }
|
33471 | };
|
33472 | return elementData;
|
33473 | };
|
33474 |
|
33475 | CVShapeElement.prototype.createShapeElement = function(data) {
|
33476 | var elementData = new CVShapeData(this, data, this.stylesList, this.transformsManager);
|
33477 |
|
33478 | this.shapes.push(elementData);
|
33479 | this.addShapeToModifiers(elementData);
|
33480 | return elementData;
|
33481 | };
|
33482 |
|
33483 | CVShapeElement.prototype.reloadShapes = function() {
|
33484 | this._isFirstFrame = true;
|
33485 | var i, len = this.itemsData.length;
|
33486 | for (i = 0; i < len; i += 1) {
|
33487 | this.prevViewData[i] = this.itemsData[i];
|
33488 | }
|
33489 | this.searchShapes(this.shapesData,this.itemsData,this.prevViewData, true, []);
|
33490 | len = this.dynamicProperties.length;
|
33491 | for (i = 0; i < len; i += 1) {
|
33492 | this.dynamicProperties[i].getValue();
|
33493 | }
|
33494 | this.renderModifiers();
|
33495 | this.transformsManager.processSequences(this._isFirstFrame);
|
33496 | };
|
33497 |
|
33498 | CVShapeElement.prototype.addTransformToStyleList = function(transform) {
|
33499 | var i, len = this.stylesList.length;
|
33500 | for (i = 0; i < len; i += 1) {
|
33501 | if(!this.stylesList[i].closed) {
|
33502 | this.stylesList[i].transforms.push(transform);
|
33503 | }
|
33504 | }
|
33505 | };
|
33506 |
|
33507 | CVShapeElement.prototype.removeTransformFromStyleList = function() {
|
33508 | var i, len = this.stylesList.length;
|
33509 | for (i = 0; i < len; i += 1) {
|
33510 | if(!this.stylesList[i].closed) {
|
33511 | this.stylesList[i].transforms.pop();
|
33512 | }
|
33513 | }
|
33514 | };
|
33515 |
|
33516 | CVShapeElement.prototype.closeStyles = function(styles) {
|
33517 | var i, len = styles.length;
|
33518 | for (i = 0; i < len; i += 1) {
|
33519 | styles[i].closed = true;
|
33520 | }
|
33521 | };
|
33522 |
|
33523 | CVShapeElement.prototype.searchShapes = function(arr,itemsData, prevViewData, shouldRender, transforms){
|
33524 | var i, len = arr.length - 1;
|
33525 | var j, jLen;
|
33526 | var ownStyles = [], ownModifiers = [], processedPos, modifier, currentTransform;
|
33527 | var ownTransforms = [].concat(transforms);
|
33528 | for(i=len;i>=0;i-=1){
|
33529 | processedPos = this.searchProcessedElement(arr[i]);
|
33530 | if(!processedPos){
|
33531 | arr[i]._shouldRender = shouldRender;
|
33532 | } else {
|
33533 | itemsData[i] = prevViewData[processedPos - 1];
|
33534 | }
|
33535 | if(arr[i].ty == 'fl' || arr[i].ty == 'st'|| arr[i].ty == 'gf'|| arr[i].ty == 'gs'){
|
33536 | if(!processedPos){
|
33537 | itemsData[i] = this.createStyleElement(arr[i], ownTransforms);
|
33538 | } else {
|
33539 | itemsData[i].style.closed = false;
|
33540 | }
|
33541 |
|
33542 | ownStyles.push(itemsData[i].style);
|
33543 | }else if(arr[i].ty == 'gr'){
|
33544 | if(!processedPos){
|
33545 | itemsData[i] = this.createGroupElement(arr[i]);
|
33546 | } else {
|
33547 | jLen = itemsData[i].it.length;
|
33548 | for(j=0;j<jLen;j+=1){
|
33549 | itemsData[i].prevViewData[j] = itemsData[i].it[j];
|
33550 | }
|
33551 | }
|
33552 | this.searchShapes(arr[i].it,itemsData[i].it,itemsData[i].prevViewData, shouldRender, ownTransforms);
|
33553 | }else if(arr[i].ty == 'tr'){
|
33554 | if(!processedPos){
|
33555 | currentTransform = this.createTransformElement(arr[i]);
|
33556 | itemsData[i] = currentTransform;
|
33557 | }
|
33558 | ownTransforms.push(itemsData[i]);
|
33559 | this.addTransformToStyleList(itemsData[i]);
|
33560 | }else if(arr[i].ty == 'sh' || arr[i].ty == 'rc' || arr[i].ty == 'el' || arr[i].ty == 'sr'){
|
33561 | if(!processedPos){
|
33562 | itemsData[i] = this.createShapeElement(arr[i]);
|
33563 | }
|
33564 |
|
33565 | }else if(arr[i].ty == 'tm' || arr[i].ty == 'rd'){
|
33566 | if(!processedPos){
|
33567 | modifier = ShapeModifiers.getModifier(arr[i].ty);
|
33568 | modifier.init(this,arr[i]);
|
33569 | itemsData[i] = modifier;
|
33570 | this.shapeModifiers.push(modifier);
|
33571 | } else {
|
33572 | modifier = itemsData[i];
|
33573 | modifier.closed = false;
|
33574 | }
|
33575 | ownModifiers.push(modifier);
|
33576 | } else if(arr[i].ty == 'rp'){
|
33577 | if(!processedPos){
|
33578 | modifier = ShapeModifiers.getModifier(arr[i].ty);
|
33579 | itemsData[i] = modifier;
|
33580 | modifier.init(this,arr,i,itemsData);
|
33581 | this.shapeModifiers.push(modifier);
|
33582 | shouldRender = false;
|
33583 | }else{
|
33584 | modifier = itemsData[i];
|
33585 | modifier.closed = true;
|
33586 | }
|
33587 | ownModifiers.push(modifier);
|
33588 | }
|
33589 | this.addProcessedElement(arr[i], i + 1);
|
33590 | }
|
33591 | this.removeTransformFromStyleList();
|
33592 | this.closeStyles(ownStyles);
|
33593 | len = ownModifiers.length;
|
33594 | for(i=0;i<len;i+=1){
|
33595 | ownModifiers[i].closed = true;
|
33596 | }
|
33597 | };
|
33598 |
|
33599 | CVShapeElement.prototype.renderInnerContent = function() {
|
33600 | this.transformHelper.opacity = 1;
|
33601 | this.transformHelper._opMdf = false;
|
33602 | this.renderModifiers();
|
33603 | this.transformsManager.processSequences(this._isFirstFrame);
|
33604 | this.renderShape(this.transformHelper,this.shapesData,this.itemsData,true);
|
33605 | };
|
33606 |
|
33607 | CVShapeElement.prototype.renderShapeTransform = function(parentTransform, groupTransform) {
|
33608 | if(parentTransform._opMdf || groupTransform.op._mdf || this._isFirstFrame) {
|
33609 | groupTransform.opacity = parentTransform.opacity;
|
33610 | groupTransform.opacity *= groupTransform.op.v;
|
33611 | groupTransform._opMdf = true;
|
33612 | }
|
33613 | };
|
33614 |
|
33615 | CVShapeElement.prototype.drawLayer = function() {
|
33616 | var i, len = this.stylesList.length;
|
33617 | var j, jLen, k, kLen,elems,nodes, renderer = this.globalData.renderer, ctx = this.globalData.canvasContext, type, currentStyle;
|
33618 | for(i=0;i<len;i+=1){
|
33619 | currentStyle = this.stylesList[i];
|
33620 | type = currentStyle.type;
|
33621 |
|
33622 | //Skipping style when
|
33623 | //Stroke width equals 0
|
33624 | //style should not be rendered (extra unused repeaters)
|
33625 | //current opacity equals 0
|
33626 | //global opacity equals 0
|
33627 | if(((type === 'st' || type === 'gs') && currentStyle.wi === 0) || !currentStyle.data._shouldRender || currentStyle.coOp === 0 || this.globalData.currentGlobalAlpha === 0){
|
33628 | continue;
|
33629 | }
|
33630 | renderer.save();
|
33631 | elems = currentStyle.elements;
|
33632 | if(type === 'st' || type === 'gs'){
|
33633 | ctx.strokeStyle = type === 'st' ? currentStyle.co : currentStyle.grd;
|
33634 | ctx.lineWidth = currentStyle.wi;
|
33635 | ctx.lineCap = currentStyle.lc;
|
33636 | ctx.lineJoin = currentStyle.lj;
|
33637 | ctx.miterLimit = currentStyle.ml || 0;
|
33638 | } else {
|
33639 | ctx.fillStyle = type === 'fl' ? currentStyle.co : currentStyle.grd;
|
33640 | }
|
33641 | renderer.ctxOpacity(currentStyle.coOp);
|
33642 | if(type !== 'st' && type !== 'gs'){
|
33643 | ctx.beginPath();
|
33644 | }
|
33645 | renderer.ctxTransform(currentStyle.preTransforms.finalTransform.props);
|
33646 | jLen = elems.length;
|
33647 | for(j=0;j<jLen;j+=1){
|
33648 | if(type === 'st' || type === 'gs'){
|
33649 | ctx.beginPath();
|
33650 | if(currentStyle.da){
|
33651 | ctx.setLineDash(currentStyle.da);
|
33652 | ctx.lineDashOffset = currentStyle.do;
|
33653 | }
|
33654 | }
|
33655 | nodes = elems[j].trNodes;
|
33656 | kLen = nodes.length;
|
33657 |
|
33658 | for(k=0;k<kLen;k+=1){
|
33659 | if(nodes[k].t == 'm'){
|
33660 | ctx.moveTo(nodes[k].p[0],nodes[k].p[1]);
|
33661 | }else if(nodes[k].t == 'c'){
|
33662 | ctx.bezierCurveTo(nodes[k].pts[0],nodes[k].pts[1],nodes[k].pts[2],nodes[k].pts[3],nodes[k].pts[4],nodes[k].pts[5]);
|
33663 | }else{
|
33664 | ctx.closePath();
|
33665 | }
|
33666 | }
|
33667 | if(type === 'st' || type === 'gs'){
|
33668 | ctx.stroke();
|
33669 | if(currentStyle.da){
|
33670 | ctx.setLineDash(this.dashResetter);
|
33671 | }
|
33672 | }
|
33673 | }
|
33674 | if(type !== 'st' && type !== 'gs'){
|
33675 | ctx.fill(currentStyle.r);
|
33676 | }
|
33677 | renderer.restore();
|
33678 | }
|
33679 | };
|
33680 |
|
33681 | CVShapeElement.prototype.renderShape = function(parentTransform,items,data,isMain){
|
33682 | var i, len = items.length - 1;
|
33683 | var groupTransform;
|
33684 | groupTransform = parentTransform;
|
33685 | for(i=len;i>=0;i-=1){
|
33686 | if(items[i].ty == 'tr'){
|
33687 | groupTransform = data[i].transform;
|
33688 | this.renderShapeTransform(parentTransform, groupTransform);
|
33689 | }else if(items[i].ty == 'sh' || items[i].ty == 'el' || items[i].ty == 'rc' || items[i].ty == 'sr'){
|
33690 | this.renderPath(items[i],data[i]);
|
33691 | }else if(items[i].ty == 'fl'){
|
33692 | this.renderFill(items[i],data[i],groupTransform);
|
33693 | }else if(items[i].ty == 'st'){
|
33694 | this.renderStroke(items[i],data[i],groupTransform);
|
33695 | }else if(items[i].ty == 'gf' || items[i].ty == 'gs'){
|
33696 | this.renderGradientFill(items[i],data[i],groupTransform);
|
33697 | }else if(items[i].ty == 'gr'){
|
33698 | this.renderShape(groupTransform,items[i].it,data[i].it);
|
33699 | }else if(items[i].ty == 'tm');
|
33700 | }
|
33701 | if(isMain){
|
33702 | this.drawLayer();
|
33703 | }
|
33704 |
|
33705 | };
|
33706 |
|
33707 | CVShapeElement.prototype.renderStyledShape = function(styledShape, shape){
|
33708 | if(this._isFirstFrame || shape._mdf || styledShape.transforms._mdf) {
|
33709 | var shapeNodes = styledShape.trNodes;
|
33710 | var paths = shape.paths;
|
33711 | var i, len, j, jLen = paths._length;
|
33712 | shapeNodes.length = 0;
|
33713 | var groupTransformMat = styledShape.transforms.finalTransform;
|
33714 | for (j = 0; j < jLen; j += 1) {
|
33715 | var pathNodes = paths.shapes[j];
|
33716 | if(pathNodes && pathNodes.v){
|
33717 | len = pathNodes._length;
|
33718 | for (i = 1; i < len; i += 1) {
|
33719 | if (i === 1) {
|
33720 | shapeNodes.push({
|
33721 | t: 'm',
|
33722 | p: groupTransformMat.applyToPointArray(pathNodes.v[0][0], pathNodes.v[0][1], 0)
|
33723 | });
|
33724 | }
|
33725 | shapeNodes.push({
|
33726 | t: 'c',
|
33727 | pts: groupTransformMat.applyToTriplePoints(pathNodes.o[i - 1], pathNodes.i[i], pathNodes.v[i])
|
33728 | });
|
33729 | }
|
33730 | if (len === 1) {
|
33731 | shapeNodes.push({
|
33732 | t: 'm',
|
33733 | p: groupTransformMat.applyToPointArray(pathNodes.v[0][0], pathNodes.v[0][1], 0)
|
33734 | });
|
33735 | }
|
33736 | if (pathNodes.c && len) {
|
33737 | shapeNodes.push({
|
33738 | t: 'c',
|
33739 | pts: groupTransformMat.applyToTriplePoints(pathNodes.o[i - 1], pathNodes.i[0], pathNodes.v[0])
|
33740 | });
|
33741 | shapeNodes.push({
|
33742 | t: 'z'
|
33743 | });
|
33744 | }
|
33745 | }
|
33746 | }
|
33747 | styledShape.trNodes = shapeNodes;
|
33748 | }
|
33749 | };
|
33750 |
|
33751 | CVShapeElement.prototype.renderPath = function(pathData,itemData){
|
33752 | if(pathData.hd !== true && pathData._shouldRender) {
|
33753 | var i, len = itemData.styledShapes.length;
|
33754 | for (i = 0; i < len; i += 1) {
|
33755 | this.renderStyledShape(itemData.styledShapes[i], itemData.sh);
|
33756 | }
|
33757 | }
|
33758 | };
|
33759 |
|
33760 | CVShapeElement.prototype.renderFill = function(styleData,itemData, groupTransform){
|
33761 | var styleElem = itemData.style;
|
33762 |
|
33763 | if (itemData.c._mdf || this._isFirstFrame) {
|
33764 | styleElem.co = 'rgb('
|
33765 | + bm_floor(itemData.c.v[0]) + ','
|
33766 | + bm_floor(itemData.c.v[1]) + ','
|
33767 | + bm_floor(itemData.c.v[2]) + ')';
|
33768 | }
|
33769 | if (itemData.o._mdf || groupTransform._opMdf || this._isFirstFrame) {
|
33770 | styleElem.coOp = itemData.o.v * groupTransform.opacity;
|
33771 | }
|
33772 | };
|
33773 |
|
33774 | CVShapeElement.prototype.renderGradientFill = function(styleData,itemData, groupTransform){
|
33775 | var styleElem = itemData.style;
|
33776 | if(!styleElem.grd || itemData.g._mdf || itemData.s._mdf || itemData.e._mdf || (styleData.t !== 1 && (itemData.h._mdf || itemData.a._mdf))) {
|
33777 | var ctx = this.globalData.canvasContext;
|
33778 | var grd;
|
33779 | var pt1 = itemData.s.v, pt2 = itemData.e.v;
|
33780 | if (styleData.t === 1) {
|
33781 | grd = ctx.createLinearGradient(pt1[0], pt1[1], pt2[0], pt2[1]);
|
33782 | } else {
|
33783 | var rad = Math.sqrt(Math.pow(pt1[0] - pt2[0], 2) + Math.pow(pt1[1] - pt2[1], 2));
|
33784 | var ang = Math.atan2(pt2[1] - pt1[1], pt2[0] - pt1[0]);
|
33785 |
|
33786 | var percent = itemData.h.v >= 1 ? 0.99 : itemData.h.v <= -1 ? -0.99: itemData.h.v;
|
33787 | var dist = rad * percent;
|
33788 | var x = Math.cos(ang + itemData.a.v) * dist + pt1[0];
|
33789 | var y = Math.sin(ang + itemData.a.v) * dist + pt1[1];
|
33790 | var grd = ctx.createRadialGradient(x, y, 0, pt1[0], pt1[1], rad);
|
33791 | }
|
33792 |
|
33793 | var i, len = styleData.g.p;
|
33794 | var cValues = itemData.g.c;
|
33795 | var opacity = 1;
|
33796 |
|
33797 | for (i = 0; i < len; i += 1){
|
33798 | if(itemData.g._hasOpacity && itemData.g._collapsable) {
|
33799 | opacity = itemData.g.o[i*2 + 1];
|
33800 | }
|
33801 | grd.addColorStop(cValues[i * 4] / 100,'rgba('+ cValues[i * 4 + 1] + ',' + cValues[i * 4 + 2] + ','+cValues[i * 4 + 3] + ',' + opacity + ')');
|
33802 | }
|
33803 | styleElem.grd = grd;
|
33804 | }
|
33805 | styleElem.coOp = itemData.o.v*groupTransform.opacity;
|
33806 |
|
33807 | };
|
33808 |
|
33809 | CVShapeElement.prototype.renderStroke = function(styleData,itemData, groupTransform){
|
33810 | var styleElem = itemData.style;
|
33811 | var d = itemData.d;
|
33812 | if(d && (d._mdf || this._isFirstFrame)){
|
33813 | styleElem.da = d.dashArray;
|
33814 | styleElem.do = d.dashoffset[0];
|
33815 | }
|
33816 | if(itemData.c._mdf || this._isFirstFrame){
|
33817 | styleElem.co = 'rgb('+bm_floor(itemData.c.v[0])+','+bm_floor(itemData.c.v[1])+','+bm_floor(itemData.c.v[2])+')';
|
33818 | }
|
33819 | if(itemData.o._mdf || groupTransform._opMdf || this._isFirstFrame){
|
33820 | styleElem.coOp = itemData.o.v*groupTransform.opacity;
|
33821 | }
|
33822 | if(itemData.w._mdf || this._isFirstFrame){
|
33823 | styleElem.wi = itemData.w.v;
|
33824 | }
|
33825 | };
|
33826 |
|
33827 |
|
33828 | CVShapeElement.prototype.destroy = function(){
|
33829 | this.shapesData = null;
|
33830 | this.globalData = null;
|
33831 | this.canvasContext = null;
|
33832 | this.stylesList.length = 0;
|
33833 | this.itemsData.length = 0;
|
33834 | };
|
33835 |
|
33836 |
|
33837 | function CVSolidElement(data, globalData, comp) {
|
33838 | this.initElement(data,globalData,comp);
|
33839 | }
|
33840 | extendPrototype([BaseElement, TransformElement, CVBaseElement, HierarchyElement, FrameElement, RenderableElement], CVSolidElement);
|
33841 |
|
33842 | CVSolidElement.prototype.initElement = SVGShapeElement.prototype.initElement;
|
33843 | CVSolidElement.prototype.prepareFrame = IImageElement.prototype.prepareFrame;
|
33844 |
|
33845 | CVSolidElement.prototype.renderInnerContent = function() {
|
33846 | var ctx = this.canvasContext;
|
33847 | ctx.fillStyle = this.data.sc;
|
33848 | ctx.fillRect(0, 0, this.data.sw, this.data.sh);
|
33849 | //
|
33850 | };
|
33851 | function CVTextElement(data, globalData, comp){
|
33852 | this.textSpans = [];
|
33853 | this.yOffset = 0;
|
33854 | this.fillColorAnim = false;
|
33855 | this.strokeColorAnim = false;
|
33856 | this.strokeWidthAnim = false;
|
33857 | this.stroke = false;
|
33858 | this.fill = false;
|
33859 | this.justifyOffset = 0;
|
33860 | this.currentRender = null;
|
33861 | this.renderType = 'canvas';
|
33862 | this.values = {
|
33863 | fill: 'rgba(0,0,0,0)',
|
33864 | stroke: 'rgba(0,0,0,0)',
|
33865 | sWidth: 0,
|
33866 | fValue: ''
|
33867 | };
|
33868 | this.initElement(data,globalData,comp);
|
33869 | }
|
33870 | extendPrototype([BaseElement,TransformElement,CVBaseElement,HierarchyElement,FrameElement,RenderableElement,ITextElement], CVTextElement);
|
33871 |
|
33872 | CVTextElement.prototype.tHelper = createTag('canvas').getContext('2d');
|
33873 |
|
33874 | CVTextElement.prototype.buildNewText = function(){
|
33875 | var documentData = this.textProperty.currentData;
|
33876 | this.renderedLetters = createSizedArray(documentData.l ? documentData.l.length : 0);
|
33877 |
|
33878 | var hasFill = false;
|
33879 | if(documentData.fc) {
|
33880 | hasFill = true;
|
33881 | this.values.fill = this.buildColor(documentData.fc);
|
33882 | }else{
|
33883 | this.values.fill = 'rgba(0,0,0,0)';
|
33884 | }
|
33885 | this.fill = hasFill;
|
33886 | var hasStroke = false;
|
33887 | if(documentData.sc){
|
33888 | hasStroke = true;
|
33889 | this.values.stroke = this.buildColor(documentData.sc);
|
33890 | this.values.sWidth = documentData.sw;
|
33891 | }
|
33892 | var fontData = this.globalData.fontManager.getFontByName(documentData.f);
|
33893 | var i, len;
|
33894 | var letters = documentData.l;
|
33895 | var matrixHelper = this.mHelper;
|
33896 | this.stroke = hasStroke;
|
33897 | this.values.fValue = documentData.finalSize + 'px '+ this.globalData.fontManager.getFontByName(documentData.f).fFamily;
|
33898 | len = documentData.finalText.length;
|
33899 | //this.tHelper.font = this.values.fValue;
|
33900 | var charData, shapeData, k, kLen, shapes, j, jLen, pathNodes, commands, pathArr, singleShape = this.data.singleShape;
|
33901 | var trackingOffset = documentData.tr/1000*documentData.finalSize;
|
33902 | var xPos = 0, yPos = 0, firstLine = true;
|
33903 | var cnt = 0;
|
33904 | for (i = 0; i < len; i += 1) {
|
33905 | charData = this.globalData.fontManager.getCharData(documentData.finalText[i], fontData.fStyle, this.globalData.fontManager.getFontByName(documentData.f).fFamily);
|
33906 | shapeData = charData && charData.data || {};
|
33907 | matrixHelper.reset();
|
33908 | if(singleShape && letters[i].n) {
|
33909 | xPos = -trackingOffset;
|
33910 | yPos += documentData.yOffset;
|
33911 | yPos += firstLine ? 1 : 0;
|
33912 | firstLine = false;
|
33913 | }
|
33914 |
|
33915 | shapes = shapeData.shapes ? shapeData.shapes[0].it : [];
|
33916 | jLen = shapes.length;
|
33917 | matrixHelper.scale(documentData.finalSize/100,documentData.finalSize/100);
|
33918 | if(singleShape){
|
33919 | this.applyTextPropertiesToMatrix(documentData, matrixHelper, letters[i].line, xPos, yPos);
|
33920 | }
|
33921 | commands = createSizedArray(jLen);
|
33922 | for(j=0;j<jLen;j+=1){
|
33923 | kLen = shapes[j].ks.k.i.length;
|
33924 | pathNodes = shapes[j].ks.k;
|
33925 | pathArr = [];
|
33926 | for(k=1;k<kLen;k+=1){
|
33927 | if(k==1){
|
33928 | pathArr.push(matrixHelper.applyToX(pathNodes.v[0][0],pathNodes.v[0][1],0),matrixHelper.applyToY(pathNodes.v[0][0],pathNodes.v[0][1],0));
|
33929 | }
|
33930 | pathArr.push(matrixHelper.applyToX(pathNodes.o[k-1][0],pathNodes.o[k-1][1],0),matrixHelper.applyToY(pathNodes.o[k-1][0],pathNodes.o[k-1][1],0),matrixHelper.applyToX(pathNodes.i[k][0],pathNodes.i[k][1],0),matrixHelper.applyToY(pathNodes.i[k][0],pathNodes.i[k][1],0),matrixHelper.applyToX(pathNodes.v[k][0],pathNodes.v[k][1],0),matrixHelper.applyToY(pathNodes.v[k][0],pathNodes.v[k][1],0));
|
33931 | }
|
33932 | pathArr.push(matrixHelper.applyToX(pathNodes.o[k-1][0],pathNodes.o[k-1][1],0),matrixHelper.applyToY(pathNodes.o[k-1][0],pathNodes.o[k-1][1],0),matrixHelper.applyToX(pathNodes.i[0][0],pathNodes.i[0][1],0),matrixHelper.applyToY(pathNodes.i[0][0],pathNodes.i[0][1],0),matrixHelper.applyToX(pathNodes.v[0][0],pathNodes.v[0][1],0),matrixHelper.applyToY(pathNodes.v[0][0],pathNodes.v[0][1],0));
|
33933 | commands[j] = pathArr;
|
33934 | }
|
33935 | if(singleShape){
|
33936 | xPos += letters[i].l;
|
33937 | xPos += trackingOffset;
|
33938 | }
|
33939 | if(this.textSpans[cnt]){
|
33940 | this.textSpans[cnt].elem = commands;
|
33941 | } else {
|
33942 | this.textSpans[cnt] = {elem: commands};
|
33943 | }
|
33944 | cnt +=1;
|
33945 | }
|
33946 | };
|
33947 |
|
33948 | CVTextElement.prototype.renderInnerContent = function(){
|
33949 | var ctx = this.canvasContext;
|
33950 | var finalMat = this.finalTransform.mat.props;
|
33951 | ctx.font = this.values.fValue;
|
33952 | ctx.lineCap = 'butt';
|
33953 | ctx.lineJoin = 'miter';
|
33954 | ctx.miterLimit = 4;
|
33955 |
|
33956 | if(!this.data.singleShape){
|
33957 | this.textAnimator.getMeasures(this.textProperty.currentData, this.lettersChangedFlag);
|
33958 | }
|
33959 |
|
33960 | var i,len, j, jLen, k, kLen;
|
33961 | var renderedLetters = this.textAnimator.renderedLetters;
|
33962 |
|
33963 | var letters = this.textProperty.currentData.l;
|
33964 |
|
33965 | len = letters.length;
|
33966 | var renderedLetter;
|
33967 | var lastFill = null, lastStroke = null, lastStrokeW = null, commands, pathArr;
|
33968 | for(i=0;i<len;i+=1){
|
33969 | if(letters[i].n){
|
33970 | continue;
|
33971 | }
|
33972 | renderedLetter = renderedLetters[i];
|
33973 | if(renderedLetter){
|
33974 | this.globalData.renderer.save();
|
33975 | this.globalData.renderer.ctxTransform(renderedLetter.p);
|
33976 | this.globalData.renderer.ctxOpacity(renderedLetter.o);
|
33977 | }
|
33978 | if(this.fill){
|
33979 | if(renderedLetter && renderedLetter.fc){
|
33980 | if(lastFill !== renderedLetter.fc){
|
33981 | lastFill = renderedLetter.fc;
|
33982 | ctx.fillStyle = renderedLetter.fc;
|
33983 | }
|
33984 | }else if(lastFill !== this.values.fill){
|
33985 | lastFill = this.values.fill;
|
33986 | ctx.fillStyle = this.values.fill;
|
33987 | }
|
33988 | commands = this.textSpans[i].elem;
|
33989 | jLen = commands.length;
|
33990 | this.globalData.canvasContext.beginPath();
|
33991 | for(j=0;j<jLen;j+=1) {
|
33992 | pathArr = commands[j];
|
33993 | kLen = pathArr.length;
|
33994 | this.globalData.canvasContext.moveTo(pathArr[0], pathArr[1]);
|
33995 | for (k = 2; k < kLen; k += 6) {
|
33996 | this.globalData.canvasContext.bezierCurveTo(pathArr[k], pathArr[k + 1], pathArr[k + 2], pathArr[k + 3], pathArr[k + 4], pathArr[k + 5]);
|
33997 | }
|
33998 | }
|
33999 | this.globalData.canvasContext.closePath();
|
34000 | this.globalData.canvasContext.fill();
|
34001 | ///ctx.fillText(this.textSpans[i].val,0,0);
|
34002 | }
|
34003 | if(this.stroke){
|
34004 | if(renderedLetter && renderedLetter.sw){
|
34005 | if(lastStrokeW !== renderedLetter.sw){
|
34006 | lastStrokeW = renderedLetter.sw;
|
34007 | ctx.lineWidth = renderedLetter.sw;
|
34008 | }
|
34009 | }else if(lastStrokeW !== this.values.sWidth){
|
34010 | lastStrokeW = this.values.sWidth;
|
34011 | ctx.lineWidth = this.values.sWidth;
|
34012 | }
|
34013 | if(renderedLetter && renderedLetter.sc){
|
34014 | if(lastStroke !== renderedLetter.sc){
|
34015 | lastStroke = renderedLetter.sc;
|
34016 | ctx.strokeStyle = renderedLetter.sc;
|
34017 | }
|
34018 | }else if(lastStroke !== this.values.stroke){
|
34019 | lastStroke = this.values.stroke;
|
34020 | ctx.strokeStyle = this.values.stroke;
|
34021 | }
|
34022 | commands = this.textSpans[i].elem;
|
34023 | jLen = commands.length;
|
34024 | this.globalData.canvasContext.beginPath();
|
34025 | for(j=0;j<jLen;j+=1) {
|
34026 | pathArr = commands[j];
|
34027 | kLen = pathArr.length;
|
34028 | this.globalData.canvasContext.moveTo(pathArr[0], pathArr[1]);
|
34029 | for (k = 2; k < kLen; k += 6) {
|
34030 | this.globalData.canvasContext.bezierCurveTo(pathArr[k], pathArr[k + 1], pathArr[k + 2], pathArr[k + 3], pathArr[k + 4], pathArr[k + 5]);
|
34031 | }
|
34032 | }
|
34033 | this.globalData.canvasContext.closePath();
|
34034 | this.globalData.canvasContext.stroke();
|
34035 | ///ctx.strokeText(letters[i].val,0,0);
|
34036 | }
|
34037 | if(renderedLetter) {
|
34038 | this.globalData.renderer.restore();
|
34039 | }
|
34040 | }
|
34041 | };
|
34042 | function CVEffects() {
|
34043 |
|
34044 | }
|
34045 | CVEffects.prototype.renderFrame = function(){};
|
34046 | function HBaseElement(data,globalData,comp){}
|
34047 | HBaseElement.prototype = {
|
34048 | checkBlendMode: function(){},
|
34049 | initRendererElement: function(){
|
34050 | this.baseElement = createTag(this.data.tg || 'div');
|
34051 | if(this.data.hasMask) {
|
34052 | this.svgElement = createNS('svg');
|
34053 | this.layerElement = createNS('g');
|
34054 | this.maskedElement = this.layerElement;
|
34055 | this.svgElement.appendChild(this.layerElement);
|
34056 | this.baseElement.appendChild(this.svgElement);
|
34057 | } else {
|
34058 | this.layerElement = this.baseElement;
|
34059 | }
|
34060 | styleDiv(this.baseElement);
|
34061 | },
|
34062 | createContainerElements: function(){
|
34063 | this.renderableEffectsManager = new CVEffects(this);
|
34064 | this.transformedElement = this.baseElement;
|
34065 | this.maskedElement = this.layerElement;
|
34066 | if (this.data.ln) {
|
34067 | this.layerElement.setAttribute('id',this.data.ln);
|
34068 | }
|
34069 | if (this.data.cl) {
|
34070 | this.layerElement.setAttribute('class', this.data.cl);
|
34071 | }
|
34072 | if (this.data.bm !== 0) {
|
34073 | this.setBlendMode();
|
34074 | }
|
34075 | },
|
34076 | renderElement: function() {
|
34077 | if(this.finalTransform._matMdf){
|
34078 | this.transformedElement.style.transform = this.transformedElement.style.webkitTransform = this.finalTransform.mat.toCSS();
|
34079 | }
|
34080 | if(this.finalTransform._opMdf){
|
34081 | this.transformedElement.style.opacity = this.finalTransform.mProp.o.v;
|
34082 | }
|
34083 | },
|
34084 | renderFrame: function() {
|
34085 | //If it is exported as hidden (data.hd === true) no need to render
|
34086 | //If it is not visible no need to render
|
34087 | if (this.data.hd || this.hidden) {
|
34088 | return;
|
34089 | }
|
34090 | this.renderTransform();
|
34091 | this.renderRenderable();
|
34092 | this.renderElement();
|
34093 | this.renderInnerContent();
|
34094 | if (this._isFirstFrame) {
|
34095 | this._isFirstFrame = false;
|
34096 | }
|
34097 | },
|
34098 | destroy: function(){
|
34099 | this.layerElement = null;
|
34100 | this.transformedElement = null;
|
34101 | if(this.matteElement) {
|
34102 | this.matteElement = null;
|
34103 | }
|
34104 | if(this.maskManager) {
|
34105 | this.maskManager.destroy();
|
34106 | this.maskManager = null;
|
34107 | }
|
34108 | },
|
34109 | createRenderableComponents: function(){
|
34110 | this.maskManager = new MaskElement(this.data, this, this.globalData);
|
34111 | },
|
34112 | addEffects: function(){
|
34113 | },
|
34114 | setMatte: function(){}
|
34115 | };
|
34116 | HBaseElement.prototype.getBaseElement = SVGBaseElement.prototype.getBaseElement;
|
34117 | HBaseElement.prototype.destroyBaseElement = HBaseElement.prototype.destroy;
|
34118 | HBaseElement.prototype.buildElementParenting = HybridRenderer.prototype.buildElementParenting;
|
34119 | function HSolidElement(data,globalData,comp){
|
34120 | this.initElement(data,globalData,comp);
|
34121 | }
|
34122 | extendPrototype([BaseElement,TransformElement,HBaseElement,HierarchyElement,FrameElement,RenderableDOMElement], HSolidElement);
|
34123 |
|
34124 | HSolidElement.prototype.createContent = function(){
|
34125 | var rect;
|
34126 | if(this.data.hasMask){
|
34127 | rect = createNS('rect');
|
34128 | rect.setAttribute('width',this.data.sw);
|
34129 | rect.setAttribute('height',this.data.sh);
|
34130 | rect.setAttribute('fill',this.data.sc);
|
34131 | this.svgElement.setAttribute('width',this.data.sw);
|
34132 | this.svgElement.setAttribute('height',this.data.sh);
|
34133 | } else {
|
34134 | rect = createTag('div');
|
34135 | rect.style.width = this.data.sw + 'px';
|
34136 | rect.style.height = this.data.sh + 'px';
|
34137 | rect.style.backgroundColor = this.data.sc;
|
34138 | }
|
34139 | this.layerElement.appendChild(rect);
|
34140 | };
|
34141 |
|
34142 | function HCompElement(data,globalData,comp){
|
34143 | this.layers = data.layers;
|
34144 | this.supports3d = !data.hasMask;
|
34145 | this.completeLayers = false;
|
34146 | this.pendingElements = [];
|
34147 | this.elements = this.layers ? createSizedArray(this.layers.length) : [];
|
34148 | this.initElement(data,globalData,comp);
|
34149 | this.tm = data.tm ? PropertyFactory.getProp(this,data.tm,0,globalData.frameRate,this) : {_placeholder:true};
|
34150 | }
|
34151 |
|
34152 | extendPrototype([HybridRenderer, ICompElement, HBaseElement], HCompElement);
|
34153 | HCompElement.prototype._createBaseContainerElements = HCompElement.prototype.createContainerElements;
|
34154 |
|
34155 | HCompElement.prototype.createContainerElements = function(){
|
34156 | this._createBaseContainerElements();
|
34157 | //divElement.style.clip = 'rect(0px, '+this.data.w+'px, '+this.data.h+'px, 0px)';
|
34158 | if(this.data.hasMask){
|
34159 | this.svgElement.setAttribute('width',this.data.w);
|
34160 | this.svgElement.setAttribute('height',this.data.h);
|
34161 | this.transformedElement = this.baseElement;
|
34162 | } else {
|
34163 | this.transformedElement = this.layerElement;
|
34164 | }
|
34165 | };
|
34166 |
|
34167 | HCompElement.prototype.addTo3dContainer = function(elem,pos) {
|
34168 | var j = 0;
|
34169 | var nextElement;
|
34170 | while(j<pos){
|
34171 | if(this.elements[j] && this.elements[j].getBaseElement){
|
34172 | nextElement = this.elements[j].getBaseElement();
|
34173 | }
|
34174 | j += 1;
|
34175 | }
|
34176 | if(nextElement){
|
34177 | this.layerElement.insertBefore(elem, nextElement);
|
34178 | } else {
|
34179 | this.layerElement.appendChild(elem);
|
34180 | }
|
34181 | };
|
34182 |
|
34183 | function HShapeElement(data,globalData,comp){
|
34184 | //List of drawable elements
|
34185 | this.shapes = [];
|
34186 | // Full shape data
|
34187 | this.shapesData = data.shapes;
|
34188 | //List of styles that will be applied to shapes
|
34189 | this.stylesList = [];
|
34190 | //List of modifiers that will be applied to shapes
|
34191 | this.shapeModifiers = [];
|
34192 | //List of items in shape tree
|
34193 | this.itemsData = [];
|
34194 | //List of items in previous shape tree
|
34195 | this.processedElements = [];
|
34196 | // List of animated components
|
34197 | this.animatedContents = [];
|
34198 | this.shapesContainer = createNS('g');
|
34199 | this.initElement(data,globalData,comp);
|
34200 | //Moving any property that doesn't get too much access after initialization because of v8 way of handling more than 10 properties.
|
34201 | // List of elements that have been created
|
34202 | this.prevViewData = [];
|
34203 | this.currentBBox = {
|
34204 | x:999999,
|
34205 | y: -999999,
|
34206 | h: 0,
|
34207 | w: 0
|
34208 | };
|
34209 | }
|
34210 | extendPrototype([BaseElement,TransformElement,HSolidElement,SVGShapeElement,HBaseElement,HierarchyElement,FrameElement,RenderableElement], HShapeElement);
|
34211 | HShapeElement.prototype._renderShapeFrame = HShapeElement.prototype.renderInnerContent;
|
34212 |
|
34213 | HShapeElement.prototype.createContent = function(){
|
34214 | var cont;
|
34215 | this.baseElement.style.fontSize = 0;
|
34216 | if (this.data.hasMask) {
|
34217 | this.layerElement.appendChild(this.shapesContainer);
|
34218 | cont = this.svgElement;
|
34219 | } else {
|
34220 | cont = createNS('svg');
|
34221 | var size = this.comp.data ? this.comp.data : this.globalData.compSize;
|
34222 | cont.setAttribute('width',size.w);
|
34223 | cont.setAttribute('height',size.h);
|
34224 | cont.appendChild(this.shapesContainer);
|
34225 | this.layerElement.appendChild(cont);
|
34226 | }
|
34227 |
|
34228 | this.searchShapes(this.shapesData,this.itemsData,this.prevViewData,this.shapesContainer,0, [], true);
|
34229 | this.filterUniqueShapes();
|
34230 | this.shapeCont = cont;
|
34231 | };
|
34232 |
|
34233 | HShapeElement.prototype.getTransformedPoint = function(transformers, point) {
|
34234 | var i, len = transformers.length;
|
34235 | for(i = 0; i < len; i += 1) {
|
34236 | point = transformers[i].mProps.v.applyToPointArray(point[0], point[1], 0);
|
34237 | }
|
34238 | return point;
|
34239 | };
|
34240 |
|
34241 | HShapeElement.prototype.calculateShapeBoundingBox = function(item, boundingBox) {
|
34242 | var shape = item.sh.v;
|
34243 | var transformers = item.transformers;
|
34244 | var i, len = shape._length, vPoint, oPoint, nextIPoint, nextVPoint;
|
34245 | if (len <= 1) {
|
34246 | return;
|
34247 | }
|
34248 | for (i = 0; i < len - 1; i += 1) {
|
34249 | vPoint = this.getTransformedPoint(transformers, shape.v[i]);
|
34250 | oPoint = this.getTransformedPoint(transformers, shape.o[i]);
|
34251 | nextIPoint = this.getTransformedPoint(transformers, shape.i[i + 1]);
|
34252 | nextVPoint = this.getTransformedPoint(transformers, shape.v[i + 1]);
|
34253 | this.checkBounds(vPoint, oPoint, nextIPoint, nextVPoint, boundingBox);
|
34254 | }
|
34255 | if(shape.c) {
|
34256 | vPoint = this.getTransformedPoint(transformers, shape.v[i]);
|
34257 | oPoint = this.getTransformedPoint(transformers, shape.o[i]);
|
34258 | nextIPoint = this.getTransformedPoint(transformers, shape.i[0]);
|
34259 | nextVPoint = this.getTransformedPoint(transformers, shape.v[0]);
|
34260 | this.checkBounds(vPoint, oPoint, nextIPoint, nextVPoint, boundingBox);
|
34261 | }
|
34262 | };
|
34263 |
|
34264 | HShapeElement.prototype.checkBounds = function(vPoint, oPoint, nextIPoint, nextVPoint, boundingBox) {
|
34265 | this.getBoundsOfCurve(vPoint, oPoint, nextIPoint, nextVPoint);
|
34266 | var bounds = this.shapeBoundingBox;
|
34267 | boundingBox.x = bm_min(bounds.left, boundingBox.x);
|
34268 | boundingBox.xMax = bm_max(bounds.right, boundingBox.xMax);
|
34269 | boundingBox.y = bm_min(bounds.top, boundingBox.y);
|
34270 | boundingBox.yMax = bm_max(bounds.bottom, boundingBox.yMax);
|
34271 | };
|
34272 |
|
34273 | HShapeElement.prototype.shapeBoundingBox = {
|
34274 | left:0,
|
34275 | right:0,
|
34276 | top:0,
|
34277 | bottom:0,
|
34278 | };
|
34279 |
|
34280 | HShapeElement.prototype.tempBoundingBox = {
|
34281 | x:0,
|
34282 | xMax:0,
|
34283 | y:0,
|
34284 | yMax:0,
|
34285 | width:0,
|
34286 | height:0
|
34287 | };
|
34288 |
|
34289 | HShapeElement.prototype.getBoundsOfCurve = function(p0, p1, p2, p3) {
|
34290 |
|
34291 | var bounds = [[p0[0],p3[0]], [p0[1],p3[1]]];
|
34292 |
|
34293 | for (var a, b, c, t, b2ac, t1, t2, i = 0; i < 2; ++i) {
|
34294 |
|
34295 | b = 6 * p0[i] - 12 * p1[i] + 6 * p2[i];
|
34296 | a = -3 * p0[i] + 9 * p1[i] - 9 * p2[i] + 3 * p3[i];
|
34297 | c = 3 * p1[i] - 3 * p0[i];
|
34298 |
|
34299 | b = b | 0;
|
34300 | a = a | 0;
|
34301 | c = c | 0;
|
34302 |
|
34303 | if (a === 0) {
|
34304 |
|
34305 | if (b === 0) {
|
34306 | continue;
|
34307 | }
|
34308 |
|
34309 | t = -c / b;
|
34310 |
|
34311 | if (0 < t && t < 1) {
|
34312 | bounds[i].push(this.calculateF(t,p0,p1,p2,p3,i));
|
34313 | }
|
34314 | continue;
|
34315 | }
|
34316 |
|
34317 | b2ac = b * b - 4 * c * a;
|
34318 |
|
34319 | if (b2ac < 0) {
|
34320 | continue;
|
34321 | }
|
34322 |
|
34323 | t1 = (-b + bm_sqrt(b2ac))/(2 * a);
|
34324 | if (0 < t1 && t1 < 1) bounds[i].push(this.calculateF(t1,p0,p1,p2,p3,i));
|
34325 |
|
34326 | t2 = (-b - bm_sqrt(b2ac))/(2 * a);
|
34327 | if (0 < t2 && t2 < 1) bounds[i].push(this.calculateF(t2,p0,p1,p2,p3,i));
|
34328 |
|
34329 | }
|
34330 |
|
34331 | this.shapeBoundingBox.left = bm_min.apply(null, bounds[0]);
|
34332 | this.shapeBoundingBox.top = bm_min.apply(null, bounds[1]);
|
34333 | this.shapeBoundingBox.right = bm_max.apply(null, bounds[0]);
|
34334 | this.shapeBoundingBox.bottom = bm_max.apply(null, bounds[1]);
|
34335 | };
|
34336 |
|
34337 | HShapeElement.prototype.calculateF = function(t, p0, p1, p2, p3, i) {
|
34338 | return bm_pow(1-t, 3) * p0[i]
|
34339 | + 3 * bm_pow(1-t, 2) * t * p1[i]
|
34340 | + 3 * (1-t) * bm_pow(t, 2) * p2[i]
|
34341 | + bm_pow(t, 3) * p3[i];
|
34342 | };
|
34343 |
|
34344 | HShapeElement.prototype.calculateBoundingBox = function(itemsData, boundingBox) {
|
34345 | var i, len = itemsData.length;
|
34346 | for(i = 0; i < len; i += 1) {
|
34347 | if(itemsData[i] && itemsData[i].sh) {
|
34348 | this.calculateShapeBoundingBox(itemsData[i], boundingBox);
|
34349 | } else if(itemsData[i] && itemsData[i].it) {
|
34350 | this.calculateBoundingBox(itemsData[i].it, boundingBox);
|
34351 | }
|
34352 | }
|
34353 | };
|
34354 |
|
34355 | HShapeElement.prototype.currentBoxContains = function(box) {
|
34356 | return this.currentBBox.x <= box.x
|
34357 | && this.currentBBox.y <= box.y
|
34358 | && this.currentBBox.width + this.currentBBox.x >= box.x + box.width
|
34359 | && this.currentBBox.height + this.currentBBox.y >= box.y + box.height
|
34360 | };
|
34361 |
|
34362 | HShapeElement.prototype.renderInnerContent = function() {
|
34363 | this._renderShapeFrame();
|
34364 |
|
34365 | if(!this.hidden && (this._isFirstFrame || this._mdf)) {
|
34366 | var tempBoundingBox = this.tempBoundingBox;
|
34367 | var max = 999999;
|
34368 | tempBoundingBox.x = max;
|
34369 | tempBoundingBox.xMax = -max;
|
34370 | tempBoundingBox.y = max;
|
34371 | tempBoundingBox.yMax = -max;
|
34372 | this.calculateBoundingBox(this.itemsData, tempBoundingBox);
|
34373 | tempBoundingBox.width = tempBoundingBox.xMax < tempBoundingBox.x ? 0 : tempBoundingBox.xMax - tempBoundingBox.x;
|
34374 | tempBoundingBox.height = tempBoundingBox.yMax < tempBoundingBox.y ? 0 : tempBoundingBox.yMax - tempBoundingBox.y;
|
34375 | //var tempBoundingBox = this.shapeCont.getBBox();
|
34376 | if(this.currentBoxContains(tempBoundingBox)) {
|
34377 | return;
|
34378 | }
|
34379 | var changed = false;
|
34380 | if(this.currentBBox.w !== tempBoundingBox.width){
|
34381 | this.currentBBox.w = tempBoundingBox.width;
|
34382 | this.shapeCont.setAttribute('width',tempBoundingBox.width);
|
34383 | changed = true;
|
34384 | }
|
34385 | if(this.currentBBox.h !== tempBoundingBox.height){
|
34386 | this.currentBBox.h = tempBoundingBox.height;
|
34387 | this.shapeCont.setAttribute('height',tempBoundingBox.height);
|
34388 | changed = true;
|
34389 | }
|
34390 | if(changed || this.currentBBox.x !== tempBoundingBox.x || this.currentBBox.y !== tempBoundingBox.y){
|
34391 | this.currentBBox.w = tempBoundingBox.width;
|
34392 | this.currentBBox.h = tempBoundingBox.height;
|
34393 | this.currentBBox.x = tempBoundingBox.x;
|
34394 | this.currentBBox.y = tempBoundingBox.y;
|
34395 |
|
34396 | this.shapeCont.setAttribute('viewBox',this.currentBBox.x+' '+this.currentBBox.y+' '+this.currentBBox.w+' '+this.currentBBox.h);
|
34397 | this.shapeCont.style.transform = this.shapeCont.style.webkitTransform = 'translate(' + this.currentBBox.x + 'px,' + this.currentBBox.y + 'px)';
|
34398 | }
|
34399 | }
|
34400 |
|
34401 | };
|
34402 | function HTextElement(data,globalData,comp){
|
34403 | this.textSpans = [];
|
34404 | this.textPaths = [];
|
34405 | this.currentBBox = {
|
34406 | x:999999,
|
34407 | y: -999999,
|
34408 | h: 0,
|
34409 | w: 0
|
34410 | };
|
34411 | this.renderType = 'svg';
|
34412 | this.isMasked = false;
|
34413 | this.initElement(data,globalData,comp);
|
34414 |
|
34415 | }
|
34416 | extendPrototype([BaseElement,TransformElement,HBaseElement,HierarchyElement,FrameElement,RenderableDOMElement,ITextElement], HTextElement);
|
34417 |
|
34418 | HTextElement.prototype.createContent = function(){
|
34419 | this.isMasked = this.checkMasks();
|
34420 | if(this.isMasked){
|
34421 | this.renderType = 'svg';
|
34422 | this.compW = this.comp.data.w;
|
34423 | this.compH = this.comp.data.h;
|
34424 | this.svgElement.setAttribute('width',this.compW);
|
34425 | this.svgElement.setAttribute('height',this.compH);
|
34426 | var g = createNS('g');
|
34427 | this.maskedElement.appendChild(g);
|
34428 | this.innerElem = g;
|
34429 | } else {
|
34430 | this.renderType = 'html';
|
34431 | this.innerElem = this.layerElement;
|
34432 | }
|
34433 |
|
34434 | this.checkParenting();
|
34435 |
|
34436 | };
|
34437 |
|
34438 | HTextElement.prototype.buildNewText = function(){
|
34439 | var documentData = this.textProperty.currentData;
|
34440 | this.renderedLetters = createSizedArray(documentData.l ? documentData.l.length : 0);
|
34441 | var innerElemStyle = this.innerElem.style;
|
34442 | innerElemStyle.color = innerElemStyle.fill = documentData.fc ? this.buildColor(documentData.fc) : 'rgba(0,0,0,0)';
|
34443 | if(documentData.sc){
|
34444 | innerElemStyle.stroke = this.buildColor(documentData.sc);
|
34445 | innerElemStyle.strokeWidth = documentData.sw+'px';
|
34446 | }
|
34447 | var fontData = this.globalData.fontManager.getFontByName(documentData.f);
|
34448 | if(!this.globalData.fontManager.chars){
|
34449 | innerElemStyle.fontSize = documentData.finalSize+'px';
|
34450 | innerElemStyle.lineHeight = documentData.finalSize+'px';
|
34451 | if(fontData.fClass){
|
34452 | this.innerElem.className = fontData.fClass;
|
34453 | } else {
|
34454 | innerElemStyle.fontFamily = fontData.fFamily;
|
34455 | var fWeight = documentData.fWeight, fStyle = documentData.fStyle;
|
34456 | innerElemStyle.fontStyle = fStyle;
|
34457 | innerElemStyle.fontWeight = fWeight;
|
34458 | }
|
34459 | }
|
34460 | var i, len;
|
34461 |
|
34462 | var letters = documentData.l;
|
34463 | len = letters.length;
|
34464 | var tSpan,tParent,tCont;
|
34465 | var matrixHelper = this.mHelper;
|
34466 | var shapes, shapeStr = '';
|
34467 | var cnt = 0;
|
34468 | for (i = 0;i < len ;i += 1) {
|
34469 | if(this.globalData.fontManager.chars){
|
34470 | if(!this.textPaths[cnt]){
|
34471 | tSpan = createNS('path');
|
34472 | tSpan.setAttribute('stroke-linecap', 'butt');
|
34473 | tSpan.setAttribute('stroke-linejoin','round');
|
34474 | tSpan.setAttribute('stroke-miterlimit','4');
|
34475 | } else {
|
34476 | tSpan = this.textPaths[cnt];
|
34477 | }
|
34478 | if(!this.isMasked){
|
34479 | if(this.textSpans[cnt]){
|
34480 | tParent = this.textSpans[cnt];
|
34481 | tCont = tParent.children[0];
|
34482 | } else {
|
34483 |
|
34484 | tParent = createTag('div');
|
34485 | tCont = createNS('svg');
|
34486 | tCont.appendChild(tSpan);
|
34487 | styleDiv(tParent);
|
34488 | }
|
34489 | }
|
34490 | }else{
|
34491 | if(!this.isMasked){
|
34492 | if(this.textSpans[cnt]){
|
34493 | tParent = this.textSpans[cnt];
|
34494 | tSpan = this.textPaths[cnt];
|
34495 | } else {
|
34496 | tParent = createTag('span');
|
34497 | styleDiv(tParent);
|
34498 | tSpan = createTag('span');
|
34499 | styleDiv(tSpan);
|
34500 | tParent.appendChild(tSpan);
|
34501 | }
|
34502 | } else {
|
34503 | tSpan = this.textPaths[cnt] ? this.textPaths[cnt] : createNS('text');
|
34504 | }
|
34505 | }
|
34506 | //tSpan.setAttribute('visibility', 'hidden');
|
34507 | if(this.globalData.fontManager.chars){
|
34508 | var charData = this.globalData.fontManager.getCharData(documentData.finalText[i], fontData.fStyle, this.globalData.fontManager.getFontByName(documentData.f).fFamily);
|
34509 | var shapeData;
|
34510 | if(charData){
|
34511 | shapeData = charData.data;
|
34512 | } else {
|
34513 | shapeData = null;
|
34514 | }
|
34515 | matrixHelper.reset();
|
34516 | if(shapeData && shapeData.shapes){
|
34517 | shapes = shapeData.shapes[0].it;
|
34518 | matrixHelper.scale(documentData.finalSize/100,documentData.finalSize/100);
|
34519 | shapeStr = this.createPathShape(matrixHelper,shapes);
|
34520 | tSpan.setAttribute('d',shapeStr);
|
34521 | }
|
34522 | if(!this.isMasked){
|
34523 | this.innerElem.appendChild(tParent);
|
34524 | if(shapeData && shapeData.shapes){
|
34525 |
|
34526 | //document.body.appendChild is needed to get exact measure of shape
|
34527 | document.body.appendChild(tCont);
|
34528 | var boundingBox = tCont.getBBox();
|
34529 | tCont.setAttribute('width',boundingBox.width + 2);
|
34530 | tCont.setAttribute('height',boundingBox.height + 2);
|
34531 | tCont.setAttribute('viewBox',(boundingBox.x-1)+' '+ (boundingBox.y-1)+' '+ (boundingBox.width+2)+' '+ (boundingBox.height+2));
|
34532 | tCont.style.transform = tCont.style.webkitTransform = 'translate(' + (boundingBox.x-1) + 'px,' + (boundingBox.y-1) + 'px)';
|
34533 |
|
34534 | letters[i].yOffset = boundingBox.y-1;
|
34535 |
|
34536 | } else{
|
34537 | tCont.setAttribute('width',1);
|
34538 | tCont.setAttribute('height',1);
|
34539 | }
|
34540 | tParent.appendChild(tCont);
|
34541 | }else{
|
34542 | this.innerElem.appendChild(tSpan);
|
34543 | }
|
34544 | }else{
|
34545 | tSpan.textContent = letters[i].val;
|
34546 | tSpan.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space","preserve");
|
34547 | if(!this.isMasked){
|
34548 | this.innerElem.appendChild(tParent);
|
34549 | //
|
34550 | tSpan.style.transform = tSpan.style.webkitTransform = 'translate3d(0,'+ -documentData.finalSize/1.2+'px,0)';
|
34551 | } else {
|
34552 | this.innerElem.appendChild(tSpan);
|
34553 | }
|
34554 | }
|
34555 | //
|
34556 | if(!this.isMasked){
|
34557 | this.textSpans[cnt] = tParent;
|
34558 | }else{
|
34559 | this.textSpans[cnt] = tSpan;
|
34560 | }
|
34561 | this.textSpans[cnt].style.display = 'block';
|
34562 | this.textPaths[cnt] = tSpan;
|
34563 | cnt += 1;
|
34564 | }
|
34565 | while(cnt < this.textSpans.length){
|
34566 | this.textSpans[cnt].style.display = 'none';
|
34567 | cnt += 1;
|
34568 | }
|
34569 | };
|
34570 |
|
34571 | HTextElement.prototype.renderInnerContent = function() {
|
34572 |
|
34573 | if(this.data.singleShape){
|
34574 | if(!this._isFirstFrame && !this.lettersChangedFlag){
|
34575 | return;
|
34576 | } else {
|
34577 | // Todo Benchmark if using this is better than getBBox
|
34578 | if(this.isMasked && this.finalTransform._matMdf){
|
34579 | this.svgElement.setAttribute('viewBox',-this.finalTransform.mProp.p.v[0]+' '+ -this.finalTransform.mProp.p.v[1]+' '+this.compW+' '+this.compH);
|
34580 | this.svgElement.style.transform = this.svgElement.style.webkitTransform = 'translate(' + -this.finalTransform.mProp.p.v[0] + 'px,' + -this.finalTransform.mProp.p.v[1] + 'px)';
|
34581 | }
|
34582 | }
|
34583 | }
|
34584 |
|
34585 | this.textAnimator.getMeasures(this.textProperty.currentData, this.lettersChangedFlag);
|
34586 | if(!this.lettersChangedFlag && !this.textAnimator.lettersChangedFlag){
|
34587 | return;
|
34588 | }
|
34589 | var i,len, count = 0;
|
34590 | var renderedLetters = this.textAnimator.renderedLetters;
|
34591 |
|
34592 | var letters = this.textProperty.currentData.l;
|
34593 |
|
34594 | len = letters.length;
|
34595 | var renderedLetter, textSpan, textPath;
|
34596 | for(i=0;i<len;i+=1){
|
34597 | if(letters[i].n){
|
34598 | count += 1;
|
34599 | continue;
|
34600 | }
|
34601 | textSpan = this.textSpans[i];
|
34602 | textPath = this.textPaths[i];
|
34603 | renderedLetter = renderedLetters[count];
|
34604 | count += 1;
|
34605 | if(renderedLetter._mdf.m) {
|
34606 | if(!this.isMasked){
|
34607 | textSpan.style.transform = textSpan.style.webkitTransform = renderedLetter.m;
|
34608 | }else{
|
34609 | textSpan.setAttribute('transform',renderedLetter.m);
|
34610 | }
|
34611 | }
|
34612 | ////textSpan.setAttribute('opacity',renderedLetter.o);
|
34613 | textSpan.style.opacity = renderedLetter.o;
|
34614 | if(renderedLetter.sw && renderedLetter._mdf.sw){
|
34615 | textPath.setAttribute('stroke-width',renderedLetter.sw);
|
34616 | }
|
34617 | if(renderedLetter.sc && renderedLetter._mdf.sc){
|
34618 | textPath.setAttribute('stroke',renderedLetter.sc);
|
34619 | }
|
34620 | if(renderedLetter.fc && renderedLetter._mdf.fc){
|
34621 | textPath.setAttribute('fill',renderedLetter.fc);
|
34622 | textPath.style.color = renderedLetter.fc;
|
34623 | }
|
34624 | }
|
34625 |
|
34626 | if(this.innerElem.getBBox && !this.hidden && (this._isFirstFrame || this._mdf)){
|
34627 | var boundingBox = this.innerElem.getBBox();
|
34628 |
|
34629 | if(this.currentBBox.w !== boundingBox.width){
|
34630 | this.currentBBox.w = boundingBox.width;
|
34631 | this.svgElement.setAttribute('width',boundingBox.width);
|
34632 | }
|
34633 | if(this.currentBBox.h !== boundingBox.height){
|
34634 | this.currentBBox.h = boundingBox.height;
|
34635 | this.svgElement.setAttribute('height',boundingBox.height);
|
34636 | }
|
34637 |
|
34638 | var margin = 1;
|
34639 | if(this.currentBBox.w !== (boundingBox.width + margin*2) || this.currentBBox.h !== (boundingBox.height + margin*2) || this.currentBBox.x !== (boundingBox.x - margin) || this.currentBBox.y !== (boundingBox.y - margin)){
|
34640 | this.currentBBox.w = boundingBox.width + margin*2;
|
34641 | this.currentBBox.h = boundingBox.height + margin*2;
|
34642 | this.currentBBox.x = boundingBox.x - margin;
|
34643 | this.currentBBox.y = boundingBox.y - margin;
|
34644 |
|
34645 | this.svgElement.setAttribute('viewBox',this.currentBBox.x+' '+this.currentBBox.y+' '+this.currentBBox.w+' '+this.currentBBox.h);
|
34646 | this.svgElement.style.transform = this.svgElement.style.webkitTransform = 'translate(' + this.currentBBox.x + 'px,' + this.currentBBox.y + 'px)';
|
34647 | }
|
34648 | }
|
34649 | };
|
34650 | function HImageElement(data,globalData,comp){
|
34651 | this.assetData = globalData.getAssetData(data.refId);
|
34652 | this.initElement(data,globalData,comp);
|
34653 | }
|
34654 |
|
34655 | extendPrototype([BaseElement,TransformElement,HBaseElement,HSolidElement,HierarchyElement,FrameElement,RenderableElement], HImageElement);
|
34656 |
|
34657 |
|
34658 | HImageElement.prototype.createContent = function(){
|
34659 | var assetPath = this.globalData.getAssetsPath(this.assetData);
|
34660 | var img = new Image();
|
34661 |
|
34662 | if(this.data.hasMask){
|
34663 | this.imageElem = createNS('image');
|
34664 | this.imageElem.setAttribute('width',this.assetData.w+"px");
|
34665 | this.imageElem.setAttribute('height',this.assetData.h+"px");
|
34666 | this.imageElem.setAttributeNS('http://www.w3.org/1999/xlink','href',assetPath);
|
34667 | this.layerElement.appendChild(this.imageElem);
|
34668 | this.baseElement.setAttribute('width',this.assetData.w);
|
34669 | this.baseElement.setAttribute('height',this.assetData.h);
|
34670 | } else {
|
34671 | this.layerElement.appendChild(img);
|
34672 | }
|
34673 | img.src = assetPath;
|
34674 | if(this.data.ln){
|
34675 | this.baseElement.setAttribute('id',this.data.ln);
|
34676 | }
|
34677 | };
|
34678 | function HCameraElement(data,globalData,comp){
|
34679 | this.initFrame();
|
34680 | this.initBaseData(data,globalData,comp);
|
34681 | this.initHierarchy();
|
34682 | var getProp = PropertyFactory.getProp;
|
34683 | this.pe = getProp(this,data.pe,0,0,this);
|
34684 | if(data.ks.p.s){
|
34685 | this.px = getProp(this,data.ks.p.x,1,0,this);
|
34686 | this.py = getProp(this,data.ks.p.y,1,0,this);
|
34687 | this.pz = getProp(this,data.ks.p.z,1,0,this);
|
34688 | }else{
|
34689 | this.p = getProp(this,data.ks.p,1,0,this);
|
34690 | }
|
34691 | if(data.ks.a){
|
34692 | this.a = getProp(this,data.ks.a,1,0,this);
|
34693 | }
|
34694 | if(data.ks.or.k.length && data.ks.or.k[0].to){
|
34695 | var i,len = data.ks.or.k.length;
|
34696 | for(i=0;i<len;i+=1){
|
34697 | data.ks.or.k[i].to = null;
|
34698 | data.ks.or.k[i].ti = null;
|
34699 | }
|
34700 | }
|
34701 | this.or = getProp(this,data.ks.or,1,degToRads,this);
|
34702 | this.or.sh = true;
|
34703 | this.rx = getProp(this,data.ks.rx,0,degToRads,this);
|
34704 | this.ry = getProp(this,data.ks.ry,0,degToRads,this);
|
34705 | this.rz = getProp(this,data.ks.rz,0,degToRads,this);
|
34706 | this.mat = new Matrix();
|
34707 | this._prevMat = new Matrix();
|
34708 | this._isFirstFrame = true;
|
34709 |
|
34710 | // TODO: find a better way to make the HCamera element to be compatible with the LayerInterface and TransformInterface.
|
34711 | this.finalTransform = {
|
34712 | mProp: this
|
34713 | };
|
34714 | }
|
34715 | extendPrototype([BaseElement, FrameElement, HierarchyElement], HCameraElement);
|
34716 |
|
34717 | HCameraElement.prototype.setup = function() {
|
34718 | var i, len = this.comp.threeDElements.length, comp;
|
34719 | for(i=0;i<len;i+=1){
|
34720 | //[perspectiveElem,container]
|
34721 | comp = this.comp.threeDElements[i];
|
34722 | if(comp.type === '3d') {
|
34723 | comp.perspectiveElem.style.perspective = comp.perspectiveElem.style.webkitPerspective = this.pe.v+'px';
|
34724 | comp.container.style.transformOrigin = comp.container.style.mozTransformOrigin = comp.container.style.webkitTransformOrigin = "0px 0px 0px";
|
34725 | comp.perspectiveElem.style.transform = comp.perspectiveElem.style.webkitTransform = 'matrix3d(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)';
|
34726 | }
|
34727 | }
|
34728 | };
|
34729 |
|
34730 | HCameraElement.prototype.createElements = function(){
|
34731 | };
|
34732 |
|
34733 | HCameraElement.prototype.hide = function(){
|
34734 | };
|
34735 |
|
34736 | HCameraElement.prototype.renderFrame = function(){
|
34737 | var _mdf = this._isFirstFrame;
|
34738 | var i, len;
|
34739 | if(this.hierarchy){
|
34740 | len = this.hierarchy.length;
|
34741 | for(i=0;i<len;i+=1){
|
34742 | _mdf = this.hierarchy[i].finalTransform.mProp._mdf || _mdf;
|
34743 | }
|
34744 | }
|
34745 | if(_mdf || this.pe._mdf || (this.p && this.p._mdf) || (this.px && (this.px._mdf || this.py._mdf || this.pz._mdf)) || this.rx._mdf || this.ry._mdf || this.rz._mdf || this.or._mdf || (this.a && this.a._mdf)) {
|
34746 | this.mat.reset();
|
34747 |
|
34748 | if(this.hierarchy){
|
34749 | len = this.hierarchy.length - 1;
|
34750 | for (i = len; i >= 0; i -= 1) {
|
34751 | /*mat = this.hierarchy[i].finalTransform.mProp.v.props;
|
34752 | console.log(mat)
|
34753 | this.mat.transform(-mat[0],-mat[1],-mat[2],-mat[3],-mat[4],-mat[5],-mat[6],-mat[7],-mat[8],-mat[9],-mat[10],-mat[11],-mat[12],-mat[13],-mat[14],mat[15]);
|
34754 | console.log(this.mat.props)*/
|
34755 | var mTransf = this.hierarchy[i].finalTransform.mProp;
|
34756 | this.mat.translate(-mTransf.p.v[0],-mTransf.p.v[1],mTransf.p.v[2]);
|
34757 | this.mat.rotateX(-mTransf.or.v[0]).rotateY(-mTransf.or.v[1]).rotateZ(mTransf.or.v[2]);
|
34758 | this.mat.rotateX(-mTransf.rx.v).rotateY(-mTransf.ry.v).rotateZ(mTransf.rz.v);
|
34759 | this.mat.scale(1/mTransf.s.v[0],1/mTransf.s.v[1],1/mTransf.s.v[2]);
|
34760 | this.mat.translate(mTransf.a.v[0],mTransf.a.v[1],mTransf.a.v[2]);
|
34761 | }
|
34762 | }
|
34763 |
|
34764 | if(this.p){
|
34765 | this.mat.translate(-this.p.v[0],-this.p.v[1],this.p.v[2]);
|
34766 | }else{
|
34767 | this.mat.translate(-this.px.v,-this.py.v,this.pz.v);
|
34768 | }
|
34769 | if(this.a){
|
34770 | var diffVector = [this.p.v[0]-this.a.v[0],this.p.v[1]-this.a.v[1],this.p.v[2]-this.a.v[2]];
|
34771 | var mag = Math.sqrt(Math.pow(diffVector[0],2)+Math.pow(diffVector[1],2)+Math.pow(diffVector[2],2));
|
34772 | //var lookDir = getNormalizedPoint(getDiffVector(this.a.v,this.p.v));
|
34773 | var lookDir = [diffVector[0]/mag,diffVector[1]/mag,diffVector[2]/mag];
|
34774 | var lookLengthOnXZ = Math.sqrt( lookDir[2]*lookDir[2] + lookDir[0]*lookDir[0] );
|
34775 | var m_rotationX = (Math.atan2( lookDir[1], lookLengthOnXZ ));
|
34776 | var m_rotationY = (Math.atan2( lookDir[0], -lookDir[2]));
|
34777 | this.mat.rotateY(m_rotationY).rotateX(-m_rotationX);
|
34778 |
|
34779 | }
|
34780 | this.mat.rotateX(-this.rx.v).rotateY(-this.ry.v).rotateZ(this.rz.v);
|
34781 | this.mat.rotateX(-this.or.v[0]).rotateY(-this.or.v[1]).rotateZ(this.or.v[2]);
|
34782 | this.mat.translate(this.globalData.compSize.w/2,this.globalData.compSize.h/2,0);
|
34783 | this.mat.translate(0,0,this.pe.v);
|
34784 |
|
34785 |
|
34786 |
|
34787 |
|
34788 | var hasMatrixChanged = !this._prevMat.equals(this.mat);
|
34789 | if((hasMatrixChanged || this.pe._mdf) && this.comp.threeDElements) {
|
34790 | len = this.comp.threeDElements.length;
|
34791 | var comp;
|
34792 | for(i=0;i<len;i+=1){
|
34793 | comp = this.comp.threeDElements[i];
|
34794 | if(comp.type === '3d') {
|
34795 | if(hasMatrixChanged) {
|
34796 | comp.container.style.transform = comp.container.style.webkitTransform = this.mat.toCSS();
|
34797 | }
|
34798 | if(this.pe._mdf) {
|
34799 | comp.perspectiveElem.style.perspective = comp.perspectiveElem.style.webkitPerspective = this.pe.v+'px';
|
34800 | }
|
34801 | }
|
34802 | }
|
34803 | this.mat.clone(this._prevMat);
|
34804 | }
|
34805 | }
|
34806 | this._isFirstFrame = false;
|
34807 | };
|
34808 |
|
34809 | HCameraElement.prototype.prepareFrame = function(num) {
|
34810 | this.prepareProperties(num, true);
|
34811 | };
|
34812 |
|
34813 | HCameraElement.prototype.destroy = function(){
|
34814 | };
|
34815 | HCameraElement.prototype.getBaseElement = function(){return null;};
|
34816 | var animationManager = (function(){
|
34817 | var moduleOb = {};
|
34818 | var registeredAnimations = [];
|
34819 | var initTime = 0;
|
34820 | var len = 0;
|
34821 | var playingAnimationsNum = 0;
|
34822 | var _stopped = true;
|
34823 | var _isFrozen = false;
|
34824 |
|
34825 | function removeElement(ev){
|
34826 | var i = 0;
|
34827 | var animItem = ev.target;
|
34828 | while(i<len) {
|
34829 | if (registeredAnimations[i].animation === animItem) {
|
34830 | registeredAnimations.splice(i, 1);
|
34831 | i -= 1;
|
34832 | len -= 1;
|
34833 | if(!animItem.isPaused){
|
34834 | subtractPlayingCount();
|
34835 | }
|
34836 | }
|
34837 | i += 1;
|
34838 | }
|
34839 | }
|
34840 |
|
34841 | function registerAnimation(element, animationData){
|
34842 | if(!element){
|
34843 | return null;
|
34844 | }
|
34845 | var i=0;
|
34846 | while(i<len){
|
34847 | if(registeredAnimations[i].elem == element && registeredAnimations[i].elem !== null ){
|
34848 | return registeredAnimations[i].animation;
|
34849 | }
|
34850 | i+=1;
|
34851 | }
|
34852 | var animItem = new AnimationItem();
|
34853 | setupAnimation(animItem, element);
|
34854 | animItem.setData(element, animationData);
|
34855 | return animItem;
|
34856 | }
|
34857 |
|
34858 | function getRegisteredAnimations() {
|
34859 | var i, len = registeredAnimations.length;
|
34860 | var animations = [];
|
34861 | for(i = 0; i < len; i += 1) {
|
34862 | animations.push(registeredAnimations[i].animation);
|
34863 | }
|
34864 | return animations;
|
34865 | }
|
34866 |
|
34867 | function addPlayingCount(){
|
34868 | playingAnimationsNum += 1;
|
34869 | activate();
|
34870 | }
|
34871 |
|
34872 | function subtractPlayingCount(){
|
34873 | playingAnimationsNum -= 1;
|
34874 | }
|
34875 |
|
34876 | function setupAnimation(animItem, element){
|
34877 | animItem.addEventListener('destroy',removeElement);
|
34878 | animItem.addEventListener('_active',addPlayingCount);
|
34879 | animItem.addEventListener('_idle',subtractPlayingCount);
|
34880 | registeredAnimations.push({elem: element,animation:animItem});
|
34881 | len += 1;
|
34882 | }
|
34883 |
|
34884 | function loadAnimation(params){
|
34885 | var animItem = new AnimationItem();
|
34886 | setupAnimation(animItem, null);
|
34887 | animItem.setParams(params);
|
34888 | return animItem;
|
34889 | }
|
34890 |
|
34891 |
|
34892 | function setSpeed(val,animation){
|
34893 | var i;
|
34894 | for(i=0;i<len;i+=1){
|
34895 | registeredAnimations[i].animation.setSpeed(val, animation);
|
34896 | }
|
34897 | }
|
34898 |
|
34899 | function setDirection(val, animation){
|
34900 | var i;
|
34901 | for(i=0;i<len;i+=1){
|
34902 | registeredAnimations[i].animation.setDirection(val, animation);
|
34903 | }
|
34904 | }
|
34905 |
|
34906 | function play(animation){
|
34907 | var i;
|
34908 | for(i=0;i<len;i+=1){
|
34909 | registeredAnimations[i].animation.play(animation);
|
34910 | }
|
34911 | }
|
34912 | function resume(nowTime) {
|
34913 | var elapsedTime = nowTime - initTime;
|
34914 | var i;
|
34915 | for(i=0;i<len;i+=1){
|
34916 | registeredAnimations[i].animation.advanceTime(elapsedTime);
|
34917 | }
|
34918 | initTime = nowTime;
|
34919 | if(playingAnimationsNum && !_isFrozen) {
|
34920 | window.requestAnimationFrame(resume);
|
34921 | } else {
|
34922 | _stopped = true;
|
34923 | }
|
34924 | }
|
34925 |
|
34926 | function first(nowTime){
|
34927 | initTime = nowTime;
|
34928 | window.requestAnimationFrame(resume);
|
34929 | }
|
34930 |
|
34931 | function pause(animation) {
|
34932 | var i;
|
34933 | for(i=0;i<len;i+=1){
|
34934 | registeredAnimations[i].animation.pause(animation);
|
34935 | }
|
34936 | }
|
34937 |
|
34938 | function goToAndStop(value,isFrame,animation) {
|
34939 | var i;
|
34940 | for(i=0;i<len;i+=1){
|
34941 | registeredAnimations[i].animation.goToAndStop(value,isFrame,animation);
|
34942 | }
|
34943 | }
|
34944 |
|
34945 | function stop(animation) {
|
34946 | var i;
|
34947 | for(i=0;i<len;i+=1){
|
34948 | registeredAnimations[i].animation.stop(animation);
|
34949 | }
|
34950 | }
|
34951 |
|
34952 | function togglePause(animation) {
|
34953 | var i;
|
34954 | for(i=0;i<len;i+=1){
|
34955 | registeredAnimations[i].animation.togglePause(animation);
|
34956 | }
|
34957 | }
|
34958 |
|
34959 | function destroy(animation) {
|
34960 | var i;
|
34961 | for(i=(len-1);i>=0;i-=1){
|
34962 | registeredAnimations[i].animation.destroy(animation);
|
34963 | }
|
34964 | }
|
34965 |
|
34966 | function searchAnimations(animationData, standalone, renderer){
|
34967 | var animElements = [].concat([].slice.call(document.getElementsByClassName('lottie')),
|
34968 | [].slice.call(document.getElementsByClassName('bodymovin')));
|
34969 | var i, len = animElements.length;
|
34970 | for(i=0;i<len;i+=1){
|
34971 | if(renderer){
|
34972 | animElements[i].setAttribute('data-bm-type',renderer);
|
34973 | }
|
34974 | registerAnimation(animElements[i], animationData);
|
34975 | }
|
34976 | if(standalone && len === 0){
|
34977 | if(!renderer){
|
34978 | renderer = 'svg';
|
34979 | }
|
34980 | var body = document.getElementsByTagName('body')[0];
|
34981 | body.innerHTML = '';
|
34982 | var div = createTag('div');
|
34983 | div.style.width = '100%';
|
34984 | div.style.height = '100%';
|
34985 | div.setAttribute('data-bm-type',renderer);
|
34986 | body.appendChild(div);
|
34987 | registerAnimation(div, animationData);
|
34988 | }
|
34989 | }
|
34990 |
|
34991 | function resize(){
|
34992 | var i;
|
34993 | for(i=0;i<len;i+=1){
|
34994 | registeredAnimations[i].animation.resize();
|
34995 | }
|
34996 | }
|
34997 |
|
34998 | function activate(){
|
34999 | if(!_isFrozen && playingAnimationsNum){
|
35000 | if(_stopped) {
|
35001 | window.requestAnimationFrame(first);
|
35002 | _stopped = false;
|
35003 | }
|
35004 | }
|
35005 | }
|
35006 |
|
35007 | function freeze() {
|
35008 | _isFrozen = true;
|
35009 | }
|
35010 |
|
35011 | function unfreeze() {
|
35012 | _isFrozen = false;
|
35013 | activate();
|
35014 | }
|
35015 |
|
35016 | moduleOb.registerAnimation = registerAnimation;
|
35017 | moduleOb.loadAnimation = loadAnimation;
|
35018 | moduleOb.setSpeed = setSpeed;
|
35019 | moduleOb.setDirection = setDirection;
|
35020 | moduleOb.play = play;
|
35021 | moduleOb.pause = pause;
|
35022 | moduleOb.stop = stop;
|
35023 | moduleOb.togglePause = togglePause;
|
35024 | moduleOb.searchAnimations = searchAnimations;
|
35025 | moduleOb.resize = resize;
|
35026 | //moduleOb.start = start;
|
35027 | moduleOb.goToAndStop = goToAndStop;
|
35028 | moduleOb.destroy = destroy;
|
35029 | moduleOb.freeze = freeze;
|
35030 | moduleOb.unfreeze = unfreeze;
|
35031 | moduleOb.getRegisteredAnimations = getRegisteredAnimations;
|
35032 | return moduleOb;
|
35033 | }());
|
35034 |
|
35035 | var AnimationItem = function () {
|
35036 | this._cbs = [];
|
35037 | this.name = '';
|
35038 | this.path = '';
|
35039 | this.isLoaded = false;
|
35040 | this.currentFrame = 0;
|
35041 | this.currentRawFrame = 0;
|
35042 | this.totalFrames = 0;
|
35043 | this.frameRate = 0;
|
35044 | this.frameMult = 0;
|
35045 | this.playSpeed = 1;
|
35046 | this.playDirection = 1;
|
35047 | this.playCount = 0;
|
35048 | this.animationData = {};
|
35049 | this.assets = [];
|
35050 | this.isPaused = true;
|
35051 | this.autoplay = false;
|
35052 | this.loop = true;
|
35053 | this.renderer = null;
|
35054 | this.animationID = createElementID();
|
35055 | this.assetsPath = '';
|
35056 | this.timeCompleted = 0;
|
35057 | this.segmentPos = 0;
|
35058 | this.subframeEnabled = subframeEnabled;
|
35059 | this.segments = [];
|
35060 | this._idle = true;
|
35061 | this._completedLoop = false;
|
35062 | this.projectInterface = ProjectInterface();
|
35063 | this.imagePreloader = new ImagePreloader();
|
35064 | };
|
35065 |
|
35066 | extendPrototype([BaseEvent], AnimationItem);
|
35067 |
|
35068 | AnimationItem.prototype.setParams = function(params) {
|
35069 | if(params.context){
|
35070 | this.context = params.context;
|
35071 | }
|
35072 | if(params.wrapper || params.container){
|
35073 | this.wrapper = params.wrapper || params.container;
|
35074 | }
|
35075 | var animType = params.animType ? params.animType : params.renderer ? params.renderer : 'svg';
|
35076 | switch(animType){
|
35077 | case 'canvas':
|
35078 | this.renderer = new CanvasRenderer(this, params.rendererSettings);
|
35079 | break;
|
35080 | case 'svg':
|
35081 | this.renderer = new SVGRenderer(this, params.rendererSettings);
|
35082 | break;
|
35083 | default:
|
35084 | this.renderer = new HybridRenderer(this, params.rendererSettings);
|
35085 | break;
|
35086 | }
|
35087 | this.renderer.setProjectInterface(this.projectInterface);
|
35088 | this.animType = animType;
|
35089 |
|
35090 | if(params.loop === '' || params.loop === null);else if(params.loop === false){
|
35091 | this.loop = false;
|
35092 | }else if(params.loop === true){
|
35093 | this.loop = true;
|
35094 | }else{
|
35095 | this.loop = parseInt(params.loop);
|
35096 | }
|
35097 | this.autoplay = 'autoplay' in params ? params.autoplay : true;
|
35098 | this.name = params.name ? params.name : '';
|
35099 | this.autoloadSegments = params.hasOwnProperty('autoloadSegments') ? params.autoloadSegments : true;
|
35100 | this.assetsPath = params.assetsPath;
|
35101 | if(params.animationData){
|
35102 | this.configAnimation(params.animationData);
|
35103 | }else if(params.path){
|
35104 | if(params.path.substr(-4) != 'json'){
|
35105 | if (params.path.substr(-1, 1) != '/') {
|
35106 | params.path += '/';
|
35107 | }
|
35108 | params.path += 'data.json';
|
35109 | }
|
35110 |
|
35111 | if(params.path.lastIndexOf('\\') != -1){
|
35112 | this.path = params.path.substr(0,params.path.lastIndexOf('\\')+1);
|
35113 | }else{
|
35114 | this.path = params.path.substr(0,params.path.lastIndexOf('/')+1);
|
35115 | }
|
35116 | this.fileName = params.path.substr(params.path.lastIndexOf('/')+1);
|
35117 | this.fileName = this.fileName.substr(0,this.fileName.lastIndexOf('.json'));
|
35118 |
|
35119 | assetLoader.load(params.path, this.configAnimation.bind(this), function() {
|
35120 | this.trigger('data_failed');
|
35121 | }.bind(this));
|
35122 | }
|
35123 | };
|
35124 |
|
35125 | AnimationItem.prototype.setData = function (wrapper, animationData) {
|
35126 | var params = {
|
35127 | wrapper: wrapper,
|
35128 | animationData: animationData ? (typeof animationData === "object") ? animationData : JSON.parse(animationData) : null
|
35129 | };
|
35130 | var wrapperAttributes = wrapper.attributes;
|
35131 |
|
35132 | params.path = wrapperAttributes.getNamedItem('data-animation-path') ? wrapperAttributes.getNamedItem('data-animation-path').value : wrapperAttributes.getNamedItem('data-bm-path') ? wrapperAttributes.getNamedItem('data-bm-path').value : wrapperAttributes.getNamedItem('bm-path') ? wrapperAttributes.getNamedItem('bm-path').value : '';
|
35133 | params.animType = wrapperAttributes.getNamedItem('data-anim-type') ? wrapperAttributes.getNamedItem('data-anim-type').value : wrapperAttributes.getNamedItem('data-bm-type') ? wrapperAttributes.getNamedItem('data-bm-type').value : wrapperAttributes.getNamedItem('bm-type') ? wrapperAttributes.getNamedItem('bm-type').value : wrapperAttributes.getNamedItem('data-bm-renderer') ? wrapperAttributes.getNamedItem('data-bm-renderer').value : wrapperAttributes.getNamedItem('bm-renderer') ? wrapperAttributes.getNamedItem('bm-renderer').value : 'canvas';
|
35134 |
|
35135 | var loop = wrapperAttributes.getNamedItem('data-anim-loop') ? wrapperAttributes.getNamedItem('data-anim-loop').value : wrapperAttributes.getNamedItem('data-bm-loop') ? wrapperAttributes.getNamedItem('data-bm-loop').value : wrapperAttributes.getNamedItem('bm-loop') ? wrapperAttributes.getNamedItem('bm-loop').value : '';
|
35136 | if(loop === '');else if(loop === 'false'){
|
35137 | params.loop = false;
|
35138 | }else if(loop === 'true'){
|
35139 | params.loop = true;
|
35140 | }else{
|
35141 | params.loop = parseInt(loop);
|
35142 | }
|
35143 | var autoplay = wrapperAttributes.getNamedItem('data-anim-autoplay') ? wrapperAttributes.getNamedItem('data-anim-autoplay').value : wrapperAttributes.getNamedItem('data-bm-autoplay') ? wrapperAttributes.getNamedItem('data-bm-autoplay').value : wrapperAttributes.getNamedItem('bm-autoplay') ? wrapperAttributes.getNamedItem('bm-autoplay').value : true;
|
35144 | params.autoplay = autoplay !== "false";
|
35145 |
|
35146 | params.name = wrapperAttributes.getNamedItem('data-name') ? wrapperAttributes.getNamedItem('data-name').value : wrapperAttributes.getNamedItem('data-bm-name') ? wrapperAttributes.getNamedItem('data-bm-name').value : wrapperAttributes.getNamedItem('bm-name') ? wrapperAttributes.getNamedItem('bm-name').value : '';
|
35147 | var prerender = wrapperAttributes.getNamedItem('data-anim-prerender') ? wrapperAttributes.getNamedItem('data-anim-prerender').value : wrapperAttributes.getNamedItem('data-bm-prerender') ? wrapperAttributes.getNamedItem('data-bm-prerender').value : wrapperAttributes.getNamedItem('bm-prerender') ? wrapperAttributes.getNamedItem('bm-prerender').value : '';
|
35148 |
|
35149 | if(prerender === 'false'){
|
35150 | params.prerender = false;
|
35151 | }
|
35152 | this.setParams(params);
|
35153 | };
|
35154 |
|
35155 | AnimationItem.prototype.includeLayers = function(data) {
|
35156 | if(data.op > this.animationData.op){
|
35157 | this.animationData.op = data.op;
|
35158 | this.totalFrames = Math.floor(data.op - this.animationData.ip);
|
35159 | }
|
35160 | var layers = this.animationData.layers;
|
35161 | var i, len = layers.length;
|
35162 | var newLayers = data.layers;
|
35163 | var j, jLen = newLayers.length;
|
35164 | for(j=0;j<jLen;j+=1){
|
35165 | i = 0;
|
35166 | while(i<len){
|
35167 | if(layers[i].id == newLayers[j].id){
|
35168 | layers[i] = newLayers[j];
|
35169 | break;
|
35170 | }
|
35171 | i += 1;
|
35172 | }
|
35173 | }
|
35174 | if(data.chars || data.fonts){
|
35175 | this.renderer.globalData.fontManager.addChars(data.chars);
|
35176 | this.renderer.globalData.fontManager.addFonts(data.fonts, this.renderer.globalData.defs);
|
35177 | }
|
35178 | if(data.assets){
|
35179 | len = data.assets.length;
|
35180 | for(i = 0; i < len; i += 1){
|
35181 | this.animationData.assets.push(data.assets[i]);
|
35182 | }
|
35183 | }
|
35184 | this.animationData.__complete = false;
|
35185 | dataManager.completeData(this.animationData,this.renderer.globalData.fontManager);
|
35186 | this.renderer.includeLayers(data.layers);
|
35187 | if(expressionsPlugin){
|
35188 | expressionsPlugin.initExpressions(this);
|
35189 | }
|
35190 | this.loadNextSegment();
|
35191 | };
|
35192 |
|
35193 | AnimationItem.prototype.loadNextSegment = function() {
|
35194 | var segments = this.animationData.segments;
|
35195 | if(!segments || segments.length === 0 || !this.autoloadSegments){
|
35196 | this.trigger('data_ready');
|
35197 | this.timeCompleted = this.totalFrames;
|
35198 | return;
|
35199 | }
|
35200 | var segment = segments.shift();
|
35201 | this.timeCompleted = segment.time * this.frameRate;
|
35202 | var segmentPath = this.path+this.fileName+'_' + this.segmentPos + '.json';
|
35203 | this.segmentPos += 1;
|
35204 | assetLoader.load(segmentPath, this.includeLayers.bind(this), function() {
|
35205 | this.trigger('data_failed');
|
35206 | }.bind(this));
|
35207 | };
|
35208 |
|
35209 | AnimationItem.prototype.loadSegments = function() {
|
35210 | var segments = this.animationData.segments;
|
35211 | if(!segments) {
|
35212 | this.timeCompleted = this.totalFrames;
|
35213 | }
|
35214 | this.loadNextSegment();
|
35215 | };
|
35216 |
|
35217 | AnimationItem.prototype.imagesLoaded = function() {
|
35218 | this.trigger('loaded_images');
|
35219 | this.checkLoaded();
|
35220 | };
|
35221 |
|
35222 | AnimationItem.prototype.preloadImages = function() {
|
35223 | this.imagePreloader.setAssetsPath(this.assetsPath);
|
35224 | this.imagePreloader.setPath(this.path);
|
35225 | this.imagePreloader.loadAssets(this.animationData.assets, this.imagesLoaded.bind(this));
|
35226 | };
|
35227 |
|
35228 | AnimationItem.prototype.configAnimation = function (animData) {
|
35229 | if(!this.renderer){
|
35230 | return;
|
35231 | }
|
35232 | this.animationData = animData;
|
35233 | this.totalFrames = Math.floor(this.animationData.op - this.animationData.ip);
|
35234 | this.renderer.configAnimation(animData);
|
35235 | if(!animData.assets){
|
35236 | animData.assets = [];
|
35237 | }
|
35238 | this.renderer.searchExtraCompositions(animData.assets);
|
35239 |
|
35240 | this.assets = this.animationData.assets;
|
35241 | this.frameRate = this.animationData.fr;
|
35242 | this.firstFrame = Math.round(this.animationData.ip);
|
35243 | this.frameMult = this.animationData.fr / 1000;
|
35244 | this.trigger('config_ready');
|
35245 | this.preloadImages();
|
35246 | this.loadSegments();
|
35247 | this.updaFrameModifier();
|
35248 | this.waitForFontsLoaded();
|
35249 | };
|
35250 |
|
35251 | AnimationItem.prototype.waitForFontsLoaded = function(){
|
35252 | if(!this.renderer) {
|
35253 | return;
|
35254 | }
|
35255 | if(this.renderer.globalData.fontManager.loaded()){
|
35256 | this.checkLoaded();
|
35257 | }else{
|
35258 | setTimeout(this.waitForFontsLoaded.bind(this),20);
|
35259 | }
|
35260 | };
|
35261 |
|
35262 | AnimationItem.prototype.checkLoaded = function () {
|
35263 | if (!this.isLoaded && this.renderer.globalData.fontManager.loaded() && (this.imagePreloader.loaded() || this.renderer.rendererType !== 'canvas')) {
|
35264 | this.isLoaded = true;
|
35265 | dataManager.completeData(this.animationData, this.renderer.globalData.fontManager);
|
35266 | if(expressionsPlugin){
|
35267 | expressionsPlugin.initExpressions(this);
|
35268 | }
|
35269 | this.renderer.initItems();
|
35270 | setTimeout(function() {
|
35271 | this.trigger('DOMLoaded');
|
35272 | }.bind(this), 0);
|
35273 | this.gotoFrame();
|
35274 | if(this.autoplay){
|
35275 | this.play();
|
35276 | }
|
35277 | }
|
35278 | };
|
35279 |
|
35280 | AnimationItem.prototype.resize = function () {
|
35281 | this.renderer.updateContainerSize();
|
35282 | };
|
35283 |
|
35284 | AnimationItem.prototype.setSubframe = function(flag){
|
35285 | this.subframeEnabled = flag ? true : false;
|
35286 | };
|
35287 |
|
35288 | AnimationItem.prototype.gotoFrame = function () {
|
35289 | this.currentFrame = this.subframeEnabled ? this.currentRawFrame : ~~this.currentRawFrame;
|
35290 |
|
35291 | if(this.timeCompleted !== this.totalFrames && this.currentFrame > this.timeCompleted){
|
35292 | this.currentFrame = this.timeCompleted;
|
35293 | }
|
35294 | this.trigger('enterFrame');
|
35295 | this.renderFrame();
|
35296 | };
|
35297 |
|
35298 | AnimationItem.prototype.renderFrame = function () {
|
35299 | if(this.isLoaded === false){
|
35300 | return;
|
35301 | }
|
35302 | this.renderer.renderFrame(this.currentFrame + this.firstFrame);
|
35303 | };
|
35304 |
|
35305 | AnimationItem.prototype.play = function (name) {
|
35306 | if(name && this.name != name){
|
35307 | return;
|
35308 | }
|
35309 | if(this.isPaused === true){
|
35310 | this.isPaused = false;
|
35311 | if(this._idle){
|
35312 | this._idle = false;
|
35313 | this.trigger('_active');
|
35314 | }
|
35315 | }
|
35316 | };
|
35317 |
|
35318 | AnimationItem.prototype.pause = function (name) {
|
35319 | if(name && this.name != name){
|
35320 | return;
|
35321 | }
|
35322 | if(this.isPaused === false){
|
35323 | this.isPaused = true;
|
35324 | this._idle = true;
|
35325 | this.trigger('_idle');
|
35326 | }
|
35327 | };
|
35328 |
|
35329 | AnimationItem.prototype.togglePause = function (name) {
|
35330 | if(name && this.name != name){
|
35331 | return;
|
35332 | }
|
35333 | if(this.isPaused === true){
|
35334 | this.play();
|
35335 | }else{
|
35336 | this.pause();
|
35337 | }
|
35338 | };
|
35339 |
|
35340 | AnimationItem.prototype.stop = function (name) {
|
35341 | if(name && this.name != name){
|
35342 | return;
|
35343 | }
|
35344 | this.pause();
|
35345 | this.playCount = 0;
|
35346 | this._completedLoop = false;
|
35347 | this.setCurrentRawFrameValue(0);
|
35348 | };
|
35349 |
|
35350 | AnimationItem.prototype.goToAndStop = function (value, isFrame, name) {
|
35351 | if(name && this.name != name){
|
35352 | return;
|
35353 | }
|
35354 | if(isFrame){
|
35355 | this.setCurrentRawFrameValue(value);
|
35356 | }else{
|
35357 | this.setCurrentRawFrameValue(value * this.frameModifier);
|
35358 | }
|
35359 | this.pause();
|
35360 | };
|
35361 |
|
35362 | AnimationItem.prototype.goToAndPlay = function (value, isFrame, name) {
|
35363 | this.goToAndStop(value, isFrame, name);
|
35364 | this.play();
|
35365 | };
|
35366 |
|
35367 | AnimationItem.prototype.advanceTime = function (value) {
|
35368 | if (this.isPaused === true || this.isLoaded === false) {
|
35369 | return;
|
35370 | }
|
35371 | var nextValue = this.currentRawFrame + value * this.frameModifier;
|
35372 | var _isComplete = false;
|
35373 | // Checking if nextValue > totalFrames - 1 for addressing non looping and looping animations.
|
35374 | // If animation won't loop, it should stop at totalFrames - 1. If it will loop it should complete the last frame and then loop.
|
35375 | if (nextValue >= this.totalFrames - 1 && this.frameModifier > 0) {
|
35376 | if (!this.loop || this.playCount === this.loop) {
|
35377 | if (!this.checkSegments(nextValue > this.totalFrames ? nextValue % this.totalFrames : 0)) {
|
35378 | _isComplete = true;
|
35379 | nextValue = this.totalFrames - 1;
|
35380 | }
|
35381 | } else if (nextValue >= this.totalFrames) {
|
35382 | this.playCount += 1;
|
35383 | if (!this.checkSegments(nextValue % this.totalFrames)) {
|
35384 | this.setCurrentRawFrameValue(nextValue % this.totalFrames);
|
35385 | this._completedLoop = true;
|
35386 | this.trigger('loopComplete');
|
35387 | }
|
35388 | } else {
|
35389 | this.setCurrentRawFrameValue(nextValue);
|
35390 | }
|
35391 | } else if(nextValue < 0) {
|
35392 | if (!this.checkSegments(nextValue % this.totalFrames)) {
|
35393 | if (this.loop && !(this.playCount-- <= 0 && this.loop !== true)) {
|
35394 | this.setCurrentRawFrameValue(this.totalFrames + (nextValue % this.totalFrames));
|
35395 | if(!this._completedLoop) {
|
35396 | this._completedLoop = true;
|
35397 | } else {
|
35398 | this.trigger('loopComplete');
|
35399 | }
|
35400 | } else {
|
35401 | _isComplete = true;
|
35402 | nextValue = 0;
|
35403 | }
|
35404 | }
|
35405 | } else {
|
35406 | this.setCurrentRawFrameValue(nextValue);
|
35407 | }
|
35408 | if (_isComplete) {
|
35409 | this.setCurrentRawFrameValue(nextValue);
|
35410 | this.pause();
|
35411 | this.trigger('complete');
|
35412 | }
|
35413 | };
|
35414 |
|
35415 | AnimationItem.prototype.adjustSegment = function(arr, offset){
|
35416 | this.playCount = 0;
|
35417 | if(arr[1] < arr[0]){
|
35418 | if(this.frameModifier > 0){
|
35419 | if(this.playSpeed < 0){
|
35420 | this.setSpeed(-this.playSpeed);
|
35421 | } else {
|
35422 | this.setDirection(-1);
|
35423 | }
|
35424 | }
|
35425 | this.timeCompleted = this.totalFrames = arr[0] - arr[1];
|
35426 | this.firstFrame = arr[1];
|
35427 | this.setCurrentRawFrameValue(this.totalFrames - 0.001 - offset);
|
35428 | } else if(arr[1] > arr[0]){
|
35429 | if(this.frameModifier < 0){
|
35430 | if(this.playSpeed < 0){
|
35431 | this.setSpeed(-this.playSpeed);
|
35432 | } else {
|
35433 | this.setDirection(1);
|
35434 | }
|
35435 | }
|
35436 | this.timeCompleted = this.totalFrames = arr[1] - arr[0];
|
35437 | this.firstFrame = arr[0];
|
35438 | this.setCurrentRawFrameValue(0.001 + offset);
|
35439 | }
|
35440 | this.trigger('segmentStart');
|
35441 | };
|
35442 | AnimationItem.prototype.setSegment = function (init,end) {
|
35443 | var pendingFrame = -1;
|
35444 | if(this.isPaused) {
|
35445 | if (this.currentRawFrame + this.firstFrame < init) {
|
35446 | pendingFrame = init;
|
35447 | } else if (this.currentRawFrame + this.firstFrame > end) {
|
35448 | pendingFrame = end - init;
|
35449 | }
|
35450 | }
|
35451 |
|
35452 | this.firstFrame = init;
|
35453 | this.timeCompleted = this.totalFrames = end - init;
|
35454 | if(pendingFrame !== -1) {
|
35455 | this.goToAndStop(pendingFrame,true);
|
35456 | }
|
35457 | };
|
35458 |
|
35459 | AnimationItem.prototype.playSegments = function (arr, forceFlag) {
|
35460 | if (forceFlag) {
|
35461 | this.segments.length = 0;
|
35462 | }
|
35463 | if (typeof arr[0] === 'object') {
|
35464 | var i, len = arr.length;
|
35465 | for (i = 0; i < len; i += 1) {
|
35466 | this.segments.push(arr[i]);
|
35467 | }
|
35468 | } else {
|
35469 | this.segments.push(arr);
|
35470 | }
|
35471 | if (this.segments.length && forceFlag) {
|
35472 | this.adjustSegment(this.segments.shift(), 0);
|
35473 | }
|
35474 | if (this.isPaused) {
|
35475 | this.play();
|
35476 | }
|
35477 | };
|
35478 |
|
35479 | AnimationItem.prototype.resetSegments = function (forceFlag) {
|
35480 | this.segments.length = 0;
|
35481 | this.segments.push([this.animationData.ip,this.animationData.op]);
|
35482 | //this.segments.push([this.animationData.ip*this.frameRate,Math.floor(this.animationData.op - this.animationData.ip+this.animationData.ip*this.frameRate)]);
|
35483 | if (forceFlag) {
|
35484 | this.checkSegments(0);
|
35485 | }
|
35486 | };
|
35487 | AnimationItem.prototype.checkSegments = function(offset) {
|
35488 | if (this.segments.length) {
|
35489 | this.adjustSegment(this.segments.shift(), offset);
|
35490 | return true;
|
35491 | }
|
35492 | return false;
|
35493 | };
|
35494 |
|
35495 | AnimationItem.prototype.destroy = function (name) {
|
35496 | if ((name && this.name != name) || !this.renderer) {
|
35497 | return;
|
35498 | }
|
35499 | this.renderer.destroy();
|
35500 | this.imagePreloader.destroy();
|
35501 | this.trigger('destroy');
|
35502 | this._cbs = null;
|
35503 | this.onEnterFrame = this.onLoopComplete = this.onComplete = this.onSegmentStart = this.onDestroy = null;
|
35504 | this.renderer = null;
|
35505 | };
|
35506 |
|
35507 | AnimationItem.prototype.setCurrentRawFrameValue = function(value){
|
35508 | this.currentRawFrame = value;
|
35509 | this.gotoFrame();
|
35510 | };
|
35511 |
|
35512 | AnimationItem.prototype.setSpeed = function (val) {
|
35513 | this.playSpeed = val;
|
35514 | this.updaFrameModifier();
|
35515 | };
|
35516 |
|
35517 | AnimationItem.prototype.setDirection = function (val) {
|
35518 | this.playDirection = val < 0 ? -1 : 1;
|
35519 | this.updaFrameModifier();
|
35520 | };
|
35521 |
|
35522 | AnimationItem.prototype.updaFrameModifier = function () {
|
35523 | this.frameModifier = this.frameMult * this.playSpeed * this.playDirection;
|
35524 | };
|
35525 |
|
35526 | AnimationItem.prototype.getPath = function () {
|
35527 | return this.path;
|
35528 | };
|
35529 |
|
35530 | AnimationItem.prototype.getAssetsPath = function (assetData) {
|
35531 | var path = '';
|
35532 | if(assetData.e) {
|
35533 | path = assetData.p;
|
35534 | } else if(this.assetsPath){
|
35535 | var imagePath = assetData.p;
|
35536 | if(imagePath.indexOf('images/') !== -1){
|
35537 | imagePath = imagePath.split('/')[1];
|
35538 | }
|
35539 | path = this.assetsPath + imagePath;
|
35540 | } else {
|
35541 | path = this.path;
|
35542 | path += assetData.u ? assetData.u : '';
|
35543 | path += assetData.p;
|
35544 | }
|
35545 | return path;
|
35546 | };
|
35547 |
|
35548 | AnimationItem.prototype.getAssetData = function (id) {
|
35549 | var i = 0, len = this.assets.length;
|
35550 | while (i < len) {
|
35551 | if(id == this.assets[i].id){
|
35552 | return this.assets[i];
|
35553 | }
|
35554 | i += 1;
|
35555 | }
|
35556 | };
|
35557 |
|
35558 | AnimationItem.prototype.hide = function () {
|
35559 | this.renderer.hide();
|
35560 | };
|
35561 |
|
35562 | AnimationItem.prototype.show = function () {
|
35563 | this.renderer.show();
|
35564 | };
|
35565 |
|
35566 | AnimationItem.prototype.getDuration = function (isFrame) {
|
35567 | return isFrame ? this.totalFrames : this.totalFrames / this.frameRate;
|
35568 | };
|
35569 |
|
35570 | AnimationItem.prototype.trigger = function(name){
|
35571 | if(this._cbs && this._cbs[name]){
|
35572 | switch(name){
|
35573 | case 'enterFrame':
|
35574 | this.triggerEvent(name,new BMEnterFrameEvent(name,this.currentFrame,this.totalFrames,this.frameModifier));
|
35575 | break;
|
35576 | case 'loopComplete':
|
35577 | this.triggerEvent(name,new BMCompleteLoopEvent(name,this.loop,this.playCount,this.frameMult));
|
35578 | break;
|
35579 | case 'complete':
|
35580 | this.triggerEvent(name,new BMCompleteEvent(name,this.frameMult));
|
35581 | break;
|
35582 | case 'segmentStart':
|
35583 | this.triggerEvent(name,new BMSegmentStartEvent(name,this.firstFrame,this.totalFrames));
|
35584 | break;
|
35585 | case 'destroy':
|
35586 | this.triggerEvent(name,new BMDestroyEvent(name,this));
|
35587 | break;
|
35588 | default:
|
35589 | this.triggerEvent(name);
|
35590 | }
|
35591 | }
|
35592 | if(name === 'enterFrame' && this.onEnterFrame){
|
35593 | this.onEnterFrame.call(this,new BMEnterFrameEvent(name,this.currentFrame,this.totalFrames,this.frameMult));
|
35594 | }
|
35595 | if(name === 'loopComplete' && this.onLoopComplete){
|
35596 | this.onLoopComplete.call(this,new BMCompleteLoopEvent(name,this.loop,this.playCount,this.frameMult));
|
35597 | }
|
35598 | if(name === 'complete' && this.onComplete){
|
35599 | this.onComplete.call(this,new BMCompleteEvent(name,this.frameMult));
|
35600 | }
|
35601 | if(name === 'segmentStart' && this.onSegmentStart){
|
35602 | this.onSegmentStart.call(this,new BMSegmentStartEvent(name,this.firstFrame,this.totalFrames));
|
35603 | }
|
35604 | if(name === 'destroy' && this.onDestroy){
|
35605 | this.onDestroy.call(this,new BMDestroyEvent(name,this));
|
35606 | }
|
35607 | };
|
35608 |
|
35609 | var Expressions = (function(){
|
35610 | var ob = {};
|
35611 | ob.initExpressions = initExpressions;
|
35612 |
|
35613 |
|
35614 | function initExpressions(animation){
|
35615 |
|
35616 | var stackCount = 0;
|
35617 | var registers = [];
|
35618 |
|
35619 | function pushExpression() {
|
35620 | stackCount += 1;
|
35621 | }
|
35622 |
|
35623 | function popExpression() {
|
35624 | stackCount -= 1;
|
35625 | if (stackCount === 0) {
|
35626 | releaseInstances();
|
35627 | }
|
35628 | }
|
35629 |
|
35630 | function registerExpressionProperty(expression) {
|
35631 | if (registers.indexOf(expression) === -1) {
|
35632 | registers.push(expression);
|
35633 | }
|
35634 | }
|
35635 |
|
35636 | function releaseInstances() {
|
35637 | var i, len = registers.length;
|
35638 | for (i = 0; i < len; i += 1) {
|
35639 | registers[i].release();
|
35640 | }
|
35641 | registers.length = 0;
|
35642 | }
|
35643 |
|
35644 | animation.renderer.compInterface = CompExpressionInterface(animation.renderer);
|
35645 | animation.renderer.globalData.projectInterface.registerComposition(animation.renderer);
|
35646 | animation.renderer.globalData.pushExpression = pushExpression;
|
35647 | animation.renderer.globalData.popExpression = popExpression;
|
35648 | animation.renderer.globalData.registerExpressionProperty = registerExpressionProperty;
|
35649 | }
|
35650 | return ob;
|
35651 | }());
|
35652 |
|
35653 | expressionsPlugin = Expressions;
|
35654 |
|
35655 | var ExpressionManager = (function(){
|
35656 | var ob = {};
|
35657 | var Math = BMMath;
|
35658 |
|
35659 | var easeInBez = BezierFactory.getBezierEasing(0.333,0,.833,.833, 'easeIn').get;
|
35660 | var easeOutBez = BezierFactory.getBezierEasing(0.167,0.167,.667,1, 'easeOut').get;
|
35661 | var easeInOutBez = BezierFactory.getBezierEasing(.33,0,.667,1, 'easeInOut').get;
|
35662 |
|
35663 | function initiateExpression(elem,data,property){
|
35664 | var val = data.x;
|
35665 | var needsVelocity = /velocity(?![\w\d])/.test(val);
|
35666 | var _needsRandom = val.indexOf('random') !== -1;
|
35667 | var elemType = elem.data.ty;
|
35668 | var transform,content,effect;
|
35669 | var thisProperty = property;
|
35670 | thisProperty.valueAtTime = thisProperty.getValueAtTime;
|
35671 | Object.defineProperty(thisProperty, 'value', {
|
35672 | get: function() {
|
35673 | return thisProperty.v
|
35674 | }
|
35675 | });
|
35676 | elem.comp.frameDuration = 1/elem.comp.globalData.frameRate;
|
35677 | elem.comp.displayStartTime = 0;
|
35678 | var inPoint = elem.data.ip/elem.comp.globalData.frameRate;
|
35679 | var outPoint = elem.data.op/elem.comp.globalData.frameRate;
|
35680 | var width = elem.data.sw ? elem.data.sw : 0;
|
35681 | var height = elem.data.sh ? elem.data.sh : 0;
|
35682 | var name = elem.data.nm;
|
35683 | var loopIn, loopOut, smooth;
|
35684 | var toWorld,fromWorld,fromComp,toComp,anchorPoint, thisLayer,thisComp,mask,valueAtTime,velocityAtTime;
|
35685 | var __expression_functions = [];
|
35686 | if(data.xf) {
|
35687 | var i, len = data.xf.length;
|
35688 | for(i = 0; i < len; i += 1) {
|
35689 | __expression_functions[i] = eval('(function(){ return ' + data.xf[i] + '}())');
|
35690 | }
|
35691 | }
|
35692 |
|
35693 | var scoped_bm_rt;
|
35694 | var expression_function = eval('[function _expression_function(){' + val+';scoped_bm_rt=$bm_rt}' + ']')[0];
|
35695 | var numKeys = property.kf ? data.k.length : 0;
|
35696 |
|
35697 | var active = !this.data || this.data.hd !== true;
|
35698 |
|
35699 | var wiggle = function wiggle(freq,amp){
|
35700 | var i,j, len = this.pv.length ? this.pv.length : 1;
|
35701 | var addedAmps = createTypedArray('float32', len);
|
35702 | freq = 5;
|
35703 | var iterations = Math.floor(time*freq);
|
35704 | i = 0;
|
35705 | j = 0;
|
35706 | while(i<iterations){
|
35707 | //var rnd = BMMath.random();
|
35708 | for(j=0;j<len;j+=1){
|
35709 | addedAmps[j] += -amp + amp*2*BMMath.random();
|
35710 | //addedAmps[j] += -amp + amp*2*rnd;
|
35711 | }
|
35712 | i += 1;
|
35713 | }
|
35714 | //var rnd2 = BMMath.random();
|
35715 | var periods = time*freq;
|
35716 | var perc = periods - Math.floor(periods);
|
35717 | var arr = createTypedArray('float32', len);
|
35718 | if(len>1){
|
35719 | for(j=0;j<len;j+=1){
|
35720 | arr[j] = this.pv[j] + addedAmps[j] + (-amp + amp*2*BMMath.random())*perc;
|
35721 | //arr[j] = this.pv[j] + addedAmps[j] + (-amp + amp*2*rnd)*perc;
|
35722 | //arr[i] = this.pv[i] + addedAmp + amp1*perc + amp2*(1-perc);
|
35723 | }
|
35724 | return arr;
|
35725 | } else {
|
35726 | return this.pv + addedAmps[0] + (-amp + amp*2*BMMath.random())*perc;
|
35727 | }
|
35728 | }.bind(this);
|
35729 |
|
35730 | if(thisProperty.loopIn) {
|
35731 | loopIn = thisProperty.loopIn.bind(thisProperty);
|
35732 | }
|
35733 |
|
35734 | if(thisProperty.loopOut) {
|
35735 | loopOut = thisProperty.loopOut.bind(thisProperty);
|
35736 | }
|
35737 |
|
35738 | if(thisProperty.smooth) {
|
35739 | smooth = thisProperty.smooth.bind(thisProperty);
|
35740 | }
|
35741 |
|
35742 | if(this.getValueAtTime) {
|
35743 | valueAtTime = this.getValueAtTime.bind(this);
|
35744 | }
|
35745 |
|
35746 | if(this.getVelocityAtTime) {
|
35747 | velocityAtTime = this.getVelocityAtTime.bind(this);
|
35748 | }
|
35749 |
|
35750 | var comp = elem.comp.globalData.projectInterface.bind(elem.comp.globalData.projectInterface);
|
35751 |
|
35752 | function seedRandom(seed){
|
35753 | BMMath.seedrandom(randSeed + seed);
|
35754 | }
|
35755 |
|
35756 | var time, velocity, value, text, textIndex, textTotal, selectorValue;
|
35757 | var index = elem.data.ind;
|
35758 | var hasParent = !!(elem.hierarchy && elem.hierarchy.length);
|
35759 | var parent;
|
35760 | var randSeed = Math.floor(Math.random()*1000000);
|
35761 | var globalData = elem.globalData;
|
35762 | function executeExpression(_value) {
|
35763 | // globalData.pushExpression();
|
35764 | value = _value;
|
35765 | if (_needsRandom) {
|
35766 | seedRandom(randSeed);
|
35767 | }
|
35768 | if (this.frameExpressionId === elem.globalData.frameId && this.propType !== 'textSelector') {
|
35769 | return value;
|
35770 | }
|
35771 | if(this.propType === 'textSelector'){
|
35772 | textIndex = this.textIndex;
|
35773 | textTotal = this.textTotal;
|
35774 | selectorValue = this.selectorValue;
|
35775 | }
|
35776 | if (!thisLayer) {
|
35777 | text = elem.layerInterface.text;
|
35778 | thisLayer = elem.layerInterface;
|
35779 | thisComp = elem.comp.compInterface;
|
35780 | toWorld = thisLayer.toWorld.bind(thisLayer);
|
35781 | fromWorld = thisLayer.fromWorld.bind(thisLayer);
|
35782 | fromComp = thisLayer.fromComp.bind(thisLayer);
|
35783 | toComp = thisLayer.toComp.bind(thisLayer);
|
35784 | mask = thisLayer.mask ? thisLayer.mask.bind(thisLayer) : null;
|
35785 | }
|
35786 | if (!transform) {
|
35787 | transform = elem.layerInterface("ADBE Transform Group");
|
35788 | if(transform) {
|
35789 | anchorPoint = transform.anchorPoint;
|
35790 | /*position = transform.position;
|
35791 | rotation = transform.rotation;
|
35792 | scale = transform.scale;*/
|
35793 | }
|
35794 | }
|
35795 |
|
35796 | if (elemType === 4 && !content) {
|
35797 | content = thisLayer("ADBE Root Vectors Group");
|
35798 | }
|
35799 | if (!effect) {
|
35800 | effect = thisLayer(4);
|
35801 | }
|
35802 | hasParent = !!(elem.hierarchy && elem.hierarchy.length);
|
35803 | if (hasParent && !parent) {
|
35804 | parent = elem.hierarchy[0].layerInterface;
|
35805 | }
|
35806 | time = this.comp.renderedFrame/this.comp.globalData.frameRate;
|
35807 | if (needsVelocity) {
|
35808 | velocity = velocityAtTime(time);
|
35809 | }
|
35810 | expression_function();
|
35811 | this.frameExpressionId = elem.globalData.frameId;
|
35812 |
|
35813 |
|
35814 | //TODO: Check if it's possible to return on ShapeInterface the .v value
|
35815 | if (scoped_bm_rt.propType === "shape") {
|
35816 | scoped_bm_rt = scoped_bm_rt.v;
|
35817 | }
|
35818 | // globalData.popExpression();
|
35819 | return scoped_bm_rt;
|
35820 | }
|
35821 | return executeExpression;
|
35822 | }
|
35823 |
|
35824 | ob.initiateExpression = initiateExpression;
|
35825 | return ob;
|
35826 | }());
|
35827 | var expressionHelpers = (function(){
|
35828 |
|
35829 | function searchExpressions(elem,data,prop){
|
35830 | if(data.x){
|
35831 | prop.k = true;
|
35832 | prop.x = true;
|
35833 | prop.initiateExpression = ExpressionManager.initiateExpression;
|
35834 | prop.effectsSequence.push(prop.initiateExpression(elem,data,prop).bind(prop));
|
35835 | }
|
35836 | }
|
35837 |
|
35838 | function getValueAtTime(frameNum) {
|
35839 | frameNum *= this.elem.globalData.frameRate;
|
35840 | frameNum -= this.offsetTime;
|
35841 | if(frameNum !== this._cachingAtTime.lastFrame) {
|
35842 | this._cachingAtTime.lastIndex = this._cachingAtTime.lastFrame < frameNum ? this._cachingAtTime.lastIndex : 0;
|
35843 | this._cachingAtTime.value = this.interpolateValue(frameNum, this._cachingAtTime);
|
35844 | this._cachingAtTime.lastFrame = frameNum;
|
35845 | }
|
35846 | return this._cachingAtTime.value;
|
35847 |
|
35848 | }
|
35849 |
|
35850 | function getSpeedAtTime(frameNum) {
|
35851 | var delta = -0.01;
|
35852 | var v1 = this.getValueAtTime(frameNum);
|
35853 | var v2 = this.getValueAtTime(frameNum + delta);
|
35854 | var speed = 0;
|
35855 | if(v1.length){
|
35856 | var i;
|
35857 | for(i=0;i<v1.length;i+=1){
|
35858 | speed += Math.pow(v2[i] - v1[i], 2);
|
35859 | }
|
35860 | speed = Math.sqrt(speed) * 100;
|
35861 | } else {
|
35862 | speed = 0;
|
35863 | }
|
35864 | return speed;
|
35865 | }
|
35866 |
|
35867 | function getVelocityAtTime(frameNum) {
|
35868 | if(this.vel !== undefined){
|
35869 | return this.vel;
|
35870 | }
|
35871 | var delta = -0.001;
|
35872 | //frameNum += this.elem.data.st;
|
35873 | var v1 = this.getValueAtTime(frameNum);
|
35874 | var v2 = this.getValueAtTime(frameNum + delta);
|
35875 | var velocity;
|
35876 | if(v1.length){
|
35877 | velocity = createTypedArray('float32', v1.length);
|
35878 | var i;
|
35879 | for(i=0;i<v1.length;i+=1){
|
35880 | //removing frameRate
|
35881 | //if needed, don't add it here
|
35882 | //velocity[i] = this.elem.globalData.frameRate*((v2[i] - v1[i])/delta);
|
35883 | velocity[i] = (v2[i] - v1[i])/delta;
|
35884 | }
|
35885 | } else {
|
35886 | velocity = (v2 - v1)/delta;
|
35887 | }
|
35888 | return velocity;
|
35889 | }
|
35890 |
|
35891 | function getStaticValueAtTime() {
|
35892 | return this.pv;
|
35893 | }
|
35894 |
|
35895 | function setGroupProperty(propertyGroup){
|
35896 | this.propertyGroup = propertyGroup;
|
35897 | }
|
35898 |
|
35899 | return {
|
35900 | searchExpressions: searchExpressions,
|
35901 | getSpeedAtTime: getSpeedAtTime,
|
35902 | getVelocityAtTime: getVelocityAtTime,
|
35903 | getValueAtTime: getValueAtTime,
|
35904 | getStaticValueAtTime: getStaticValueAtTime,
|
35905 | setGroupProperty: setGroupProperty,
|
35906 | }
|
35907 | }());
|
35908 | (function addPropertyDecorator() {
|
35909 |
|
35910 | function loopOut(type,duration,durationFlag){
|
35911 | if(!this.k || !this.keyframes){
|
35912 | return this.pv;
|
35913 | }
|
35914 | type = type ? type.toLowerCase() : '';
|
35915 | var currentFrame = this.comp.renderedFrame;
|
35916 | var keyframes = this.keyframes;
|
35917 | var lastKeyFrame = keyframes[keyframes.length - 1].t;
|
35918 | if(currentFrame<=lastKeyFrame){
|
35919 | return this.pv;
|
35920 | }else{
|
35921 | var cycleDuration, firstKeyFrame;
|
35922 | if(!durationFlag){
|
35923 | if(!duration || duration > keyframes.length - 1){
|
35924 | duration = keyframes.length - 1;
|
35925 | }
|
35926 | firstKeyFrame = keyframes[keyframes.length - 1 - duration].t;
|
35927 | cycleDuration = lastKeyFrame - firstKeyFrame;
|
35928 | } else {
|
35929 | if(!duration){
|
35930 | cycleDuration = Math.max(0,lastKeyFrame - this.elem.data.ip);
|
35931 | } else {
|
35932 | cycleDuration = Math.abs(lastKeyFrame - elem.comp.globalData.frameRate*duration);
|
35933 | }
|
35934 | firstKeyFrame = lastKeyFrame - cycleDuration;
|
35935 | }
|
35936 | var i, len, ret;
|
35937 | if(type === 'pingpong') {
|
35938 | var iterations = Math.floor((currentFrame - firstKeyFrame)/cycleDuration);
|
35939 | if(iterations % 2 !== 0){
|
35940 | return this.getValueAtTime(((cycleDuration - (currentFrame - firstKeyFrame) % cycleDuration + firstKeyFrame)) / this.comp.globalData.frameRate, 0);
|
35941 | }
|
35942 | } else if(type === 'offset'){
|
35943 | var initV = this.getValueAtTime(firstKeyFrame / this.comp.globalData.frameRate, 0);
|
35944 | var endV = this.getValueAtTime(lastKeyFrame / this.comp.globalData.frameRate, 0);
|
35945 | var current = this.getValueAtTime(((currentFrame - firstKeyFrame) % cycleDuration + firstKeyFrame) / this.comp.globalData.frameRate, 0);
|
35946 | var repeats = Math.floor((currentFrame - firstKeyFrame)/cycleDuration);
|
35947 | if(this.pv.length){
|
35948 | ret = new Array(initV.length);
|
35949 | len = ret.length;
|
35950 | for(i=0;i<len;i+=1){
|
35951 | ret[i] = (endV[i]-initV[i])*repeats + current[i];
|
35952 | }
|
35953 | return ret;
|
35954 | }
|
35955 | return (endV-initV)*repeats + current;
|
35956 | } else if(type === 'continue'){
|
35957 | var lastValue = this.getValueAtTime(lastKeyFrame / this.comp.globalData.frameRate, 0);
|
35958 | var nextLastValue = this.getValueAtTime((lastKeyFrame - 0.001) / this.comp.globalData.frameRate, 0);
|
35959 | if(this.pv.length){
|
35960 | ret = new Array(lastValue.length);
|
35961 | len = ret.length;
|
35962 | for(i=0;i<len;i+=1){
|
35963 | ret[i] = lastValue[i] + (lastValue[i]-nextLastValue[i])*((currentFrame - lastKeyFrame)/ this.comp.globalData.frameRate)/0.0005;
|
35964 | }
|
35965 | return ret;
|
35966 | }
|
35967 | return lastValue + (lastValue-nextLastValue)*(((currentFrame - lastKeyFrame))/0.001);
|
35968 | }
|
35969 | return this.getValueAtTime((((currentFrame - firstKeyFrame) % cycleDuration + firstKeyFrame)) / this.comp.globalData.frameRate, 0);
|
35970 | }
|
35971 | }
|
35972 |
|
35973 | function loopIn(type,duration, durationFlag) {
|
35974 | if(!this.k){
|
35975 | return this.pv;
|
35976 | }
|
35977 | type = type ? type.toLowerCase() : '';
|
35978 | var currentFrame = this.comp.renderedFrame;
|
35979 | var keyframes = this.keyframes;
|
35980 | var firstKeyFrame = keyframes[0].t;
|
35981 | if(currentFrame>=firstKeyFrame){
|
35982 | return this.pv;
|
35983 | }else{
|
35984 | var cycleDuration, lastKeyFrame;
|
35985 | if(!durationFlag){
|
35986 | if(!duration || duration > keyframes.length - 1){
|
35987 | duration = keyframes.length - 1;
|
35988 | }
|
35989 | lastKeyFrame = keyframes[duration].t;
|
35990 | cycleDuration = lastKeyFrame - firstKeyFrame;
|
35991 | } else {
|
35992 | if(!duration){
|
35993 | cycleDuration = Math.max(0,this.elem.data.op - firstKeyFrame);
|
35994 | } else {
|
35995 | cycleDuration = Math.abs(elem.comp.globalData.frameRate*duration);
|
35996 | }
|
35997 | lastKeyFrame = firstKeyFrame + cycleDuration;
|
35998 | }
|
35999 | var i, len, ret;
|
36000 | if(type === 'pingpong') {
|
36001 | var iterations = Math.floor((firstKeyFrame - currentFrame)/cycleDuration);
|
36002 | if(iterations % 2 === 0){
|
36003 | return this.getValueAtTime((((firstKeyFrame - currentFrame)%cycleDuration + firstKeyFrame)) / this.comp.globalData.frameRate, 0);
|
36004 | }
|
36005 | } else if(type === 'offset'){
|
36006 | var initV = this.getValueAtTime(firstKeyFrame / this.comp.globalData.frameRate, 0);
|
36007 | var endV = this.getValueAtTime(lastKeyFrame / this.comp.globalData.frameRate, 0);
|
36008 | var current = this.getValueAtTime((cycleDuration - (firstKeyFrame - currentFrame)%cycleDuration + firstKeyFrame) / this.comp.globalData.frameRate, 0);
|
36009 | var repeats = Math.floor((firstKeyFrame - currentFrame)/cycleDuration)+1;
|
36010 | if(this.pv.length){
|
36011 | ret = new Array(initV.length);
|
36012 | len = ret.length;
|
36013 | for(i=0;i<len;i+=1){
|
36014 | ret[i] = current[i]-(endV[i]-initV[i])*repeats;
|
36015 | }
|
36016 | return ret;
|
36017 | }
|
36018 | return current-(endV-initV)*repeats;
|
36019 | } else if(type === 'continue'){
|
36020 | var firstValue = this.getValueAtTime(firstKeyFrame / this.comp.globalData.frameRate, 0);
|
36021 | var nextFirstValue = this.getValueAtTime((firstKeyFrame + 0.001) / this.comp.globalData.frameRate, 0);
|
36022 | if(this.pv.length){
|
36023 | ret = new Array(firstValue.length);
|
36024 | len = ret.length;
|
36025 | for(i=0;i<len;i+=1){
|
36026 | ret[i] = firstValue[i] + (firstValue[i]-nextFirstValue[i])*(firstKeyFrame - currentFrame)/0.001;
|
36027 | }
|
36028 | return ret;
|
36029 | }
|
36030 | return firstValue + (firstValue-nextFirstValue)*(firstKeyFrame - currentFrame)/0.001;
|
36031 | }
|
36032 | return this.getValueAtTime(((cycleDuration - (firstKeyFrame - currentFrame) % cycleDuration + firstKeyFrame)) / this.comp.globalData.frameRate, 0);
|
36033 | }
|
36034 | }
|
36035 |
|
36036 | function smooth(width, samples) {
|
36037 | if (!this.k){
|
36038 | return this.pv;
|
36039 | }
|
36040 | width = (width || 0.4) * 0.5;
|
36041 | samples = Math.floor(samples || 5);
|
36042 | if (samples <= 1) {
|
36043 | return this.pv;
|
36044 | }
|
36045 | var currentTime = this.comp.renderedFrame / this.comp.globalData.frameRate;
|
36046 | var initFrame = currentTime - width;
|
36047 | var endFrame = currentTime + width;
|
36048 | var sampleFrequency = samples > 1 ? (endFrame - initFrame) / (samples - 1) : 1;
|
36049 | var i = 0, j = 0;
|
36050 | var value;
|
36051 | if (this.pv.length) {
|
36052 | value = createTypedArray('float32', this.pv.length);
|
36053 | } else {
|
36054 | value = 0;
|
36055 | }
|
36056 | var sampleValue;
|
36057 | while (i < samples) {
|
36058 | sampleValue = this.getValueAtTime(initFrame + i * sampleFrequency);
|
36059 | if(this.pv.length) {
|
36060 | for (j = 0; j < this.pv.length; j += 1) {
|
36061 | value[j] += sampleValue[j];
|
36062 | }
|
36063 | } else {
|
36064 | value += sampleValue;
|
36065 | }
|
36066 | i += 1;
|
36067 | }
|
36068 | if(this.pv.length) {
|
36069 | for (j = 0; j < this.pv.length; j += 1) {
|
36070 | value[j] /= samples;
|
36071 | }
|
36072 | } else {
|
36073 | value /= samples;
|
36074 | }
|
36075 | return value;
|
36076 | }
|
36077 |
|
36078 | function getTransformValueAtTime(time) {
|
36079 | console.warn('Transform at time not supported');
|
36080 | }
|
36081 |
|
36082 | function getTransformStaticValueAtTime(time) {
|
36083 |
|
36084 | }
|
36085 |
|
36086 | var getTransformProperty = TransformPropertyFactory.getTransformProperty;
|
36087 | TransformPropertyFactory.getTransformProperty = function(elem, data, container) {
|
36088 | var prop = getTransformProperty(elem, data, container);
|
36089 | if(prop.dynamicProperties.length) {
|
36090 | prop.getValueAtTime = getTransformValueAtTime.bind(prop);
|
36091 | } else {
|
36092 | prop.getValueAtTime = getTransformStaticValueAtTime.bind(prop);
|
36093 | }
|
36094 | prop.setGroupProperty = expressionHelpers.setGroupProperty;
|
36095 | return prop;
|
36096 | };
|
36097 |
|
36098 | var propertyGetProp = PropertyFactory.getProp;
|
36099 | PropertyFactory.getProp = function(elem,data,type, mult, container){
|
36100 | var prop = propertyGetProp(elem,data,type, mult, container);
|
36101 | //prop.getVelocityAtTime = getVelocityAtTime;
|
36102 | //prop.loopOut = loopOut;
|
36103 | //prop.loopIn = loopIn;
|
36104 | if(prop.kf){
|
36105 | prop.getValueAtTime = expressionHelpers.getValueAtTime.bind(prop);
|
36106 | } else {
|
36107 | prop.getValueAtTime = expressionHelpers.getStaticValueAtTime.bind(prop);
|
36108 | }
|
36109 | prop.setGroupProperty = expressionHelpers.setGroupProperty;
|
36110 | prop.loopOut = loopOut;
|
36111 | prop.loopIn = loopIn;
|
36112 | prop.smooth = smooth;
|
36113 | prop.getVelocityAtTime = expressionHelpers.getVelocityAtTime.bind(prop);
|
36114 | prop.getSpeedAtTime = expressionHelpers.getSpeedAtTime.bind(prop);
|
36115 | prop.numKeys = data.a === 1 ? data.k.length : 0;
|
36116 | prop.propertyIndex = data.ix;
|
36117 | var value = 0;
|
36118 | if(type !== 0) {
|
36119 | value = createTypedArray('float32', data.a === 1 ? data.k[0].s.length : data.k.length);
|
36120 | }
|
36121 | prop._cachingAtTime = {
|
36122 | lastFrame: initialDefaultFrame,
|
36123 | lastIndex: 0,
|
36124 | value: value
|
36125 | };
|
36126 | expressionHelpers.searchExpressions(elem,data,prop);
|
36127 | if(prop.k){
|
36128 | container.addDynamicProperty(prop);
|
36129 | }
|
36130 |
|
36131 | return prop;
|
36132 | };
|
36133 |
|
36134 | function getShapeValueAtTime(frameNum) {
|
36135 | //For now this caching object is created only when needed instead of creating it when the shape is initialized.
|
36136 | if (!this._cachingAtTime) {
|
36137 | this._cachingAtTime = {
|
36138 | shapeValue: shape_pool.clone(this.pv),
|
36139 | lastIndex: 0,
|
36140 | lastTime: initialDefaultFrame
|
36141 | };
|
36142 | }
|
36143 |
|
36144 | frameNum *= this.elem.globalData.frameRate;
|
36145 | frameNum -= this.offsetTime;
|
36146 | if(frameNum !== this._cachingAtTime.lastTime) {
|
36147 | this._cachingAtTime.lastIndex = this._cachingAtTime.lastTime < frameNum ? this._caching.lastIndex : 0;
|
36148 | this._cachingAtTime.lastTime = frameNum;
|
36149 | this.interpolateShape(frameNum, this._cachingAtTime.shapeValue, this._cachingAtTime);
|
36150 | }
|
36151 | return this._cachingAtTime.shapeValue;
|
36152 | }
|
36153 |
|
36154 | var ShapePropertyConstructorFunction = ShapePropertyFactory.getConstructorFunction();
|
36155 | var KeyframedShapePropertyConstructorFunction = ShapePropertyFactory.getKeyframedConstructorFunction();
|
36156 |
|
36157 | function ShapeExpressions(){}
|
36158 | ShapeExpressions.prototype = {
|
36159 | vertices: function(prop, time){
|
36160 | if (this.k) {
|
36161 | this.getValue();
|
36162 | }
|
36163 | var shapePath = this.v;
|
36164 | if(time !== undefined) {
|
36165 | shapePath = this.getValueAtTime(time, 0);
|
36166 | }
|
36167 | var i, len = shapePath._length;
|
36168 | var vertices = shapePath[prop];
|
36169 | var points = shapePath.v;
|
36170 | var arr = createSizedArray(len);
|
36171 | for(i = 0; i < len; i += 1) {
|
36172 | if(prop === 'i' || prop === 'o') {
|
36173 | arr[i] = [vertices[i][0] - points[i][0], vertices[i][1] - points[i][1]];
|
36174 | } else {
|
36175 | arr[i] = [vertices[i][0], vertices[i][1]];
|
36176 | }
|
36177 |
|
36178 | }
|
36179 | return arr;
|
36180 | },
|
36181 | points: function(time){
|
36182 | return this.vertices('v', time);
|
36183 | },
|
36184 | inTangents: function(time){
|
36185 | return this.vertices('i', time);
|
36186 | },
|
36187 | outTangents: function(time){
|
36188 | return this.vertices('o', time);
|
36189 | },
|
36190 | isClosed: function(){
|
36191 | return this.v.c;
|
36192 | },
|
36193 | pointOnPath: function(perc, time){
|
36194 | var shapePath = this.v;
|
36195 | if(time !== undefined) {
|
36196 | shapePath = this.getValueAtTime(time, 0);
|
36197 | }
|
36198 | if(!this._segmentsLength) {
|
36199 | this._segmentsLength = bez.getSegmentsLength(shapePath);
|
36200 | }
|
36201 |
|
36202 | var segmentsLength = this._segmentsLength;
|
36203 | var lengths = segmentsLength.lengths;
|
36204 | var lengthPos = segmentsLength.totalLength * perc;
|
36205 | var i = 0, len = lengths.length;
|
36206 | var accumulatedLength = 0, pt;
|
36207 | while(i < len) {
|
36208 | if(accumulatedLength + lengths[i].addedLength > lengthPos) {
|
36209 | var initIndex = i;
|
36210 | var endIndex = (shapePath.c && i === len - 1) ? 0 : i + 1;
|
36211 | var segmentPerc = (lengthPos - accumulatedLength)/lengths[i].addedLength;
|
36212 | pt = bez.getPointInSegment(shapePath.v[initIndex], shapePath.v[endIndex], shapePath.o[initIndex], shapePath.i[endIndex], segmentPerc, lengths[i]);
|
36213 | break;
|
36214 | } else {
|
36215 | accumulatedLength += lengths[i].addedLength;
|
36216 | }
|
36217 | i += 1;
|
36218 | }
|
36219 | if(!pt){
|
36220 | pt = shapePath.c ? [shapePath.v[0][0],shapePath.v[0][1]]:[shapePath.v[shapePath._length-1][0],shapePath.v[shapePath._length-1][1]];
|
36221 | }
|
36222 | return pt;
|
36223 | },
|
36224 | vectorOnPath: function(perc, time, vectorType){
|
36225 | //perc doesn't use triple equality because it can be a Number object as well as a primitive.
|
36226 | perc = perc == 1 ? this.v.c ? 0 : 0.999 : perc;
|
36227 | var pt1 = this.pointOnPath(perc, time);
|
36228 | var pt2 = this.pointOnPath(perc + 0.001, time);
|
36229 | var xLength = pt2[0] - pt1[0];
|
36230 | var yLength = pt2[1] - pt1[1];
|
36231 | var magnitude = Math.sqrt(Math.pow(xLength,2) + Math.pow(yLength,2));
|
36232 | var unitVector = vectorType === 'tangent' ? [xLength/magnitude, yLength/magnitude] : [-yLength/magnitude, xLength/magnitude];
|
36233 | return unitVector;
|
36234 | },
|
36235 | tangentOnPath: function(perc, time){
|
36236 | return this.vectorOnPath(perc, time, 'tangent');
|
36237 | },
|
36238 | normalOnPath: function(perc, time){
|
36239 | return this.vectorOnPath(perc, time, 'normal');
|
36240 | },
|
36241 | setGroupProperty: expressionHelpers.setGroupProperty,
|
36242 | getValueAtTime: expressionHelpers.getStaticValueAtTime
|
36243 | };
|
36244 | extendPrototype([ShapeExpressions], ShapePropertyConstructorFunction);
|
36245 | extendPrototype([ShapeExpressions], KeyframedShapePropertyConstructorFunction);
|
36246 | KeyframedShapePropertyConstructorFunction.prototype.getValueAtTime = getShapeValueAtTime;
|
36247 | KeyframedShapePropertyConstructorFunction.prototype.initiateExpression = ExpressionManager.initiateExpression;
|
36248 |
|
36249 | var propertyGetShapeProp = ShapePropertyFactory.getShapeProp;
|
36250 | ShapePropertyFactory.getShapeProp = function(elem,data,type, arr, trims){
|
36251 | var prop = propertyGetShapeProp(elem,data,type, arr, trims);
|
36252 | prop.propertyIndex = data.ix;
|
36253 | prop.lock = false;
|
36254 | if(type === 3){
|
36255 | expressionHelpers.searchExpressions(elem,data.pt,prop);
|
36256 | } else if(type === 4){
|
36257 | expressionHelpers.searchExpressions(elem,data.ks,prop);
|
36258 | }
|
36259 | if(prop.k){
|
36260 | elem.addDynamicProperty(prop);
|
36261 | }
|
36262 | return prop;
|
36263 | };
|
36264 | }());
|
36265 | (function addDecorator() {
|
36266 |
|
36267 | function searchExpressions(){
|
36268 | if(this.data.d.x){
|
36269 | this.calculateExpression = ExpressionManager.initiateExpression.bind(this)(this.elem,this.data.d,this);
|
36270 | this.addEffect(this.getExpressionValue.bind(this));
|
36271 | return true;
|
36272 | }
|
36273 | }
|
36274 |
|
36275 | TextProperty.prototype.getExpressionValue = function(currentValue, text) {
|
36276 | var newValue = this.calculateExpression(text);
|
36277 | if(currentValue.t !== newValue) {
|
36278 | var newData = {};
|
36279 | this.copyData(newData, currentValue);
|
36280 | newData.t = newValue.toString();
|
36281 | newData.__complete = false;
|
36282 | return newData;
|
36283 | }
|
36284 | return currentValue;
|
36285 | };
|
36286 |
|
36287 | TextProperty.prototype.searchProperty = function(){
|
36288 |
|
36289 | var isKeyframed = this.searchKeyframes();
|
36290 | var hasExpressions = this.searchExpressions();
|
36291 | this.kf = isKeyframed || hasExpressions;
|
36292 | return this.kf;
|
36293 | };
|
36294 |
|
36295 | TextProperty.prototype.searchExpressions = searchExpressions;
|
36296 |
|
36297 | }());
|
36298 | var ShapeExpressionInterface = (function(){
|
36299 |
|
36300 | function iterateElements(shapes,view, propertyGroup){
|
36301 | var arr = [];
|
36302 | var i, len = shapes ? shapes.length : 0;
|
36303 | for(i=0;i<len;i+=1){
|
36304 | if(shapes[i].ty == 'gr'){
|
36305 | arr.push(groupInterfaceFactory(shapes[i],view[i],propertyGroup));
|
36306 | }else if(shapes[i].ty == 'fl'){
|
36307 | arr.push(fillInterfaceFactory(shapes[i],view[i],propertyGroup));
|
36308 | }else if(shapes[i].ty == 'st'){
|
36309 | arr.push(strokeInterfaceFactory(shapes[i],view[i],propertyGroup));
|
36310 | }else if(shapes[i].ty == 'tm'){
|
36311 | arr.push(trimInterfaceFactory(shapes[i],view[i],propertyGroup));
|
36312 | }else if(shapes[i].ty == 'tr');else if(shapes[i].ty == 'el'){
|
36313 | arr.push(ellipseInterfaceFactory(shapes[i],view[i],propertyGroup));
|
36314 | }else if(shapes[i].ty == 'sr'){
|
36315 | arr.push(starInterfaceFactory(shapes[i],view[i],propertyGroup));
|
36316 | } else if(shapes[i].ty == 'sh'){
|
36317 | arr.push(pathInterfaceFactory(shapes[i],view[i],propertyGroup));
|
36318 | } else if(shapes[i].ty == 'rc'){
|
36319 | arr.push(rectInterfaceFactory(shapes[i],view[i],propertyGroup));
|
36320 | } else if(shapes[i].ty == 'rd'){
|
36321 | arr.push(roundedInterfaceFactory(shapes[i],view[i],propertyGroup));
|
36322 | } else if(shapes[i].ty == 'rp'){
|
36323 | arr.push(repeaterInterfaceFactory(shapes[i],view[i],propertyGroup));
|
36324 | }
|
36325 | }
|
36326 | return arr;
|
36327 | }
|
36328 |
|
36329 | function contentsInterfaceFactory(shape,view, propertyGroup){
|
36330 | var interfaces;
|
36331 | var interfaceFunction = function _interfaceFunction(value){
|
36332 | var i = 0, len = interfaces.length;
|
36333 | while(i<len){
|
36334 | if(interfaces[i]._name === value || interfaces[i].mn === value || interfaces[i].propertyIndex === value || interfaces[i].ix === value || interfaces[i].ind === value){
|
36335 | return interfaces[i];
|
36336 | }
|
36337 | i+=1;
|
36338 | }
|
36339 | if(typeof value === 'number'){
|
36340 | return interfaces[value-1];
|
36341 | }
|
36342 | };
|
36343 | interfaceFunction.propertyGroup = function(val){
|
36344 | if(val === 1){
|
36345 | return interfaceFunction;
|
36346 | } else{
|
36347 | return propertyGroup(val-1);
|
36348 | }
|
36349 | };
|
36350 | interfaces = iterateElements(shape.it, view.it, interfaceFunction.propertyGroup);
|
36351 | interfaceFunction.numProperties = interfaces.length;
|
36352 | interfaceFunction.propertyIndex = shape.cix;
|
36353 | interfaceFunction._name = shape.nm;
|
36354 |
|
36355 | return interfaceFunction;
|
36356 | }
|
36357 |
|
36358 | function groupInterfaceFactory(shape,view, propertyGroup){
|
36359 | var interfaceFunction = function _interfaceFunction(value){
|
36360 | switch(value){
|
36361 | case 'ADBE Vectors Group':
|
36362 | case 'Contents':
|
36363 | case 2:
|
36364 | return interfaceFunction.content;
|
36365 | //Not necessary for now. Keeping them here in case a new case appears
|
36366 | //case 'ADBE Vector Transform Group':
|
36367 | //case 3:
|
36368 | default:
|
36369 | return interfaceFunction.transform;
|
36370 | }
|
36371 | };
|
36372 | interfaceFunction.propertyGroup = function(val){
|
36373 | if(val === 1){
|
36374 | return interfaceFunction;
|
36375 | } else{
|
36376 | return propertyGroup(val-1);
|
36377 | }
|
36378 | };
|
36379 | var content = contentsInterfaceFactory(shape,view,interfaceFunction.propertyGroup);
|
36380 | var transformInterface = transformInterfaceFactory(shape.it[shape.it.length - 1],view.it[view.it.length - 1],interfaceFunction.propertyGroup);
|
36381 | interfaceFunction.content = content;
|
36382 | interfaceFunction.transform = transformInterface;
|
36383 | Object.defineProperty(interfaceFunction, '_name', {
|
36384 | get: function(){
|
36385 | return shape.nm;
|
36386 | }
|
36387 | });
|
36388 | //interfaceFunction.content = interfaceFunction;
|
36389 | interfaceFunction.numProperties = shape.np;
|
36390 | interfaceFunction.propertyIndex = shape.ix;
|
36391 | interfaceFunction.nm = shape.nm;
|
36392 | interfaceFunction.mn = shape.mn;
|
36393 | return interfaceFunction;
|
36394 | }
|
36395 |
|
36396 | function fillInterfaceFactory(shape,view,propertyGroup){
|
36397 | function interfaceFunction(val){
|
36398 | if(val === 'Color' || val === 'color'){
|
36399 | return interfaceFunction.color;
|
36400 | } else if(val === 'Opacity' || val === 'opacity'){
|
36401 | return interfaceFunction.opacity;
|
36402 | }
|
36403 | }
|
36404 | Object.defineProperties(interfaceFunction, {
|
36405 | 'color': {
|
36406 | get: ExpressionPropertyInterface(view.c)
|
36407 | },
|
36408 | 'opacity': {
|
36409 | get: ExpressionPropertyInterface(view.o)
|
36410 | },
|
36411 | '_name': { value: shape.nm },
|
36412 | 'mn': { value: shape.mn }
|
36413 | });
|
36414 |
|
36415 | view.c.setGroupProperty(propertyGroup);
|
36416 | view.o.setGroupProperty(propertyGroup);
|
36417 | return interfaceFunction;
|
36418 | }
|
36419 |
|
36420 | function strokeInterfaceFactory(shape,view,propertyGroup){
|
36421 | function _propertyGroup(val){
|
36422 | if(val === 1){
|
36423 | return ob;
|
36424 | } else{
|
36425 | return propertyGroup(val-1);
|
36426 | }
|
36427 | }
|
36428 | function _dashPropertyGroup(val){
|
36429 | if(val === 1){
|
36430 | return dashOb;
|
36431 | } else{
|
36432 | return _propertyGroup(val-1);
|
36433 | }
|
36434 | }
|
36435 | function addPropertyToDashOb(i) {
|
36436 | Object.defineProperty(dashOb, shape.d[i].nm, {
|
36437 | get: ExpressionPropertyInterface(view.d.dataProps[i].p)
|
36438 | });
|
36439 | }
|
36440 | var i, len = shape.d ? shape.d.length : 0;
|
36441 | var dashOb = {};
|
36442 | for (i = 0; i < len; i += 1) {
|
36443 | addPropertyToDashOb(i);
|
36444 | view.d.dataProps[i].p.setGroupProperty(_dashPropertyGroup);
|
36445 | }
|
36446 |
|
36447 | function interfaceFunction(val){
|
36448 | if(val === 'Color' || val === 'color'){
|
36449 | return interfaceFunction.color;
|
36450 | } else if(val === 'Opacity' || val === 'opacity'){
|
36451 | return interfaceFunction.opacity;
|
36452 | } else if(val === 'Stroke Width' || val === 'stroke width'){
|
36453 | return interfaceFunction.strokeWidth;
|
36454 | }
|
36455 | }
|
36456 | Object.defineProperties(interfaceFunction, {
|
36457 | 'color': {
|
36458 | get: ExpressionPropertyInterface(view.c)
|
36459 | },
|
36460 | 'opacity': {
|
36461 | get: ExpressionPropertyInterface(view.o)
|
36462 | },
|
36463 | 'strokeWidth': {
|
36464 | get: ExpressionPropertyInterface(view.w)
|
36465 | },
|
36466 | 'dash': {
|
36467 | get: function() {
|
36468 | return dashOb;
|
36469 | }
|
36470 | },
|
36471 | '_name': { value: shape.nm },
|
36472 | 'mn': { value: shape.mn }
|
36473 | });
|
36474 |
|
36475 | view.c.setGroupProperty(_propertyGroup);
|
36476 | view.o.setGroupProperty(_propertyGroup);
|
36477 | view.w.setGroupProperty(_propertyGroup);
|
36478 | return interfaceFunction;
|
36479 | }
|
36480 |
|
36481 | function trimInterfaceFactory(shape,view,propertyGroup){
|
36482 | function _propertyGroup(val){
|
36483 | if(val == 1){
|
36484 | return interfaceFunction;
|
36485 | } else {
|
36486 | return propertyGroup(--val);
|
36487 | }
|
36488 | }
|
36489 | interfaceFunction.propertyIndex = shape.ix;
|
36490 |
|
36491 | view.s.setGroupProperty(_propertyGroup);
|
36492 | view.e.setGroupProperty(_propertyGroup);
|
36493 | view.o.setGroupProperty(_propertyGroup);
|
36494 |
|
36495 | function interfaceFunction(val){
|
36496 | if(val === shape.e.ix || val === 'End' || val === 'end'){
|
36497 | return interfaceFunction.end;
|
36498 | }
|
36499 | if(val === shape.s.ix){
|
36500 | return interfaceFunction.start;
|
36501 | }
|
36502 | if(val === shape.o.ix){
|
36503 | return interfaceFunction.offset;
|
36504 | }
|
36505 | }
|
36506 | interfaceFunction.propertyIndex = shape.ix;
|
36507 | interfaceFunction.propertyGroup = propertyGroup;
|
36508 |
|
36509 | Object.defineProperties(interfaceFunction, {
|
36510 | 'start': {
|
36511 | get: ExpressionPropertyInterface(view.s)
|
36512 | },
|
36513 | 'end': {
|
36514 | get: ExpressionPropertyInterface(view.e)
|
36515 | },
|
36516 | 'offset': {
|
36517 | get: ExpressionPropertyInterface(view.o)
|
36518 | },
|
36519 | '_name': { value: shape.nm }
|
36520 | });
|
36521 | interfaceFunction.mn = shape.mn;
|
36522 | return interfaceFunction;
|
36523 | }
|
36524 |
|
36525 | function transformInterfaceFactory(shape,view,propertyGroup){
|
36526 | function _propertyGroup(val){
|
36527 | if(val == 1){
|
36528 | return interfaceFunction;
|
36529 | } else {
|
36530 | return propertyGroup(--val);
|
36531 | }
|
36532 | }
|
36533 | view.transform.mProps.o.setGroupProperty(_propertyGroup);
|
36534 | view.transform.mProps.p.setGroupProperty(_propertyGroup);
|
36535 | view.transform.mProps.a.setGroupProperty(_propertyGroup);
|
36536 | view.transform.mProps.s.setGroupProperty(_propertyGroup);
|
36537 | view.transform.mProps.r.setGroupProperty(_propertyGroup);
|
36538 | if(view.transform.mProps.sk){
|
36539 | view.transform.mProps.sk.setGroupProperty(_propertyGroup);
|
36540 | view.transform.mProps.sa.setGroupProperty(_propertyGroup);
|
36541 | }
|
36542 | view.transform.op.setGroupProperty(_propertyGroup);
|
36543 |
|
36544 | function interfaceFunction(value){
|
36545 | if(shape.a.ix === value || value === 'Anchor Point'){
|
36546 | return interfaceFunction.anchorPoint;
|
36547 | }
|
36548 | if(shape.o.ix === value || value === 'Opacity'){
|
36549 | return interfaceFunction.opacity;
|
36550 | }
|
36551 | if(shape.p.ix === value || value === 'Position'){
|
36552 | return interfaceFunction.position;
|
36553 | }
|
36554 | if(shape.r.ix === value || value === 'Rotation' || value === 'ADBE Vector Rotation'){
|
36555 | return interfaceFunction.rotation;
|
36556 | }
|
36557 | if(shape.s.ix === value || value === 'Scale'){
|
36558 | return interfaceFunction.scale;
|
36559 | }
|
36560 | if(shape.sk && shape.sk.ix === value || value === 'Skew'){
|
36561 | return interfaceFunction.skew;
|
36562 | }
|
36563 | if(shape.sa && shape.sa.ix === value || value === 'Skew Axis'){
|
36564 | return interfaceFunction.skewAxis;
|
36565 | }
|
36566 |
|
36567 | }
|
36568 | Object.defineProperties(interfaceFunction, {
|
36569 | 'opacity': {
|
36570 | get: ExpressionPropertyInterface(view.transform.mProps.o)
|
36571 | },
|
36572 | 'position': {
|
36573 | get: ExpressionPropertyInterface(view.transform.mProps.p)
|
36574 | },
|
36575 | 'anchorPoint': {
|
36576 | get: ExpressionPropertyInterface(view.transform.mProps.a)
|
36577 | },
|
36578 | 'scale': {
|
36579 | get: ExpressionPropertyInterface(view.transform.mProps.s)
|
36580 | },
|
36581 | 'rotation': {
|
36582 | get: ExpressionPropertyInterface(view.transform.mProps.r)
|
36583 | },
|
36584 | 'skew': {
|
36585 | get: ExpressionPropertyInterface(view.transform.mProps.sk)
|
36586 | },
|
36587 | 'skewAxis': {
|
36588 | get: ExpressionPropertyInterface(view.transform.mProps.sa)
|
36589 | },
|
36590 | '_name': { value: shape.nm }
|
36591 | });
|
36592 | interfaceFunction.ty = 'tr';
|
36593 | interfaceFunction.mn = shape.mn;
|
36594 | interfaceFunction.propertyGroup = propertyGroup;
|
36595 | return interfaceFunction;
|
36596 | }
|
36597 |
|
36598 | function ellipseInterfaceFactory(shape,view,propertyGroup){
|
36599 | function _propertyGroup(val){
|
36600 | if(val == 1){
|
36601 | return interfaceFunction;
|
36602 | } else {
|
36603 | return propertyGroup(--val);
|
36604 | }
|
36605 | }
|
36606 | interfaceFunction.propertyIndex = shape.ix;
|
36607 | var prop = view.sh.ty === 'tm' ? view.sh.prop : view.sh;
|
36608 | prop.s.setGroupProperty(_propertyGroup);
|
36609 | prop.p.setGroupProperty(_propertyGroup);
|
36610 | function interfaceFunction(value){
|
36611 | if(shape.p.ix === value){
|
36612 | return interfaceFunction.position;
|
36613 | }
|
36614 | if(shape.s.ix === value){
|
36615 | return interfaceFunction.size;
|
36616 | }
|
36617 | }
|
36618 |
|
36619 | Object.defineProperties(interfaceFunction, {
|
36620 | 'size': {
|
36621 | get: ExpressionPropertyInterface(prop.s)
|
36622 | },
|
36623 | 'position': {
|
36624 | get: ExpressionPropertyInterface(prop.p)
|
36625 | },
|
36626 | '_name': { value: shape.nm }
|
36627 | });
|
36628 | interfaceFunction.mn = shape.mn;
|
36629 | return interfaceFunction;
|
36630 | }
|
36631 |
|
36632 | function starInterfaceFactory(shape,view,propertyGroup){
|
36633 | function _propertyGroup(val){
|
36634 | if(val == 1){
|
36635 | return interfaceFunction;
|
36636 | } else {
|
36637 | return propertyGroup(--val);
|
36638 | }
|
36639 | }
|
36640 | var prop = view.sh.ty === 'tm' ? view.sh.prop : view.sh;
|
36641 | interfaceFunction.propertyIndex = shape.ix;
|
36642 | prop.or.setGroupProperty(_propertyGroup);
|
36643 | prop.os.setGroupProperty(_propertyGroup);
|
36644 | prop.pt.setGroupProperty(_propertyGroup);
|
36645 | prop.p.setGroupProperty(_propertyGroup);
|
36646 | prop.r.setGroupProperty(_propertyGroup);
|
36647 | if(shape.ir){
|
36648 | prop.ir.setGroupProperty(_propertyGroup);
|
36649 | prop.is.setGroupProperty(_propertyGroup);
|
36650 | }
|
36651 |
|
36652 | function interfaceFunction(value){
|
36653 | if(shape.p.ix === value){
|
36654 | return interfaceFunction.position;
|
36655 | }
|
36656 | if(shape.r.ix === value){
|
36657 | return interfaceFunction.rotation;
|
36658 | }
|
36659 | if(shape.pt.ix === value){
|
36660 | return interfaceFunction.points;
|
36661 | }
|
36662 | if(shape.or.ix === value || 'ADBE Vector Star Outer Radius' === value){
|
36663 | return interfaceFunction.outerRadius;
|
36664 | }
|
36665 | if(shape.os.ix === value){
|
36666 | return interfaceFunction.outerRoundness;
|
36667 | }
|
36668 | if(shape.ir && (shape.ir.ix === value || 'ADBE Vector Star Inner Radius' === value)){
|
36669 | return interfaceFunction.innerRadius;
|
36670 | }
|
36671 | if(shape.is && shape.is.ix === value){
|
36672 | return interfaceFunction.innerRoundness;
|
36673 | }
|
36674 |
|
36675 | }
|
36676 |
|
36677 | Object.defineProperties(interfaceFunction, {
|
36678 | 'position': {
|
36679 | get: ExpressionPropertyInterface(prop.p)
|
36680 | },
|
36681 | 'rotation': {
|
36682 | get: ExpressionPropertyInterface(prop.r)
|
36683 | },
|
36684 | 'points': {
|
36685 | get: ExpressionPropertyInterface(prop.pt)
|
36686 | },
|
36687 | 'outerRadius': {
|
36688 | get: ExpressionPropertyInterface(prop.or)
|
36689 | },
|
36690 | 'outerRoundness': {
|
36691 | get: ExpressionPropertyInterface(prop.os)
|
36692 | },
|
36693 | 'innerRadius': {
|
36694 | get: ExpressionPropertyInterface(prop.ir)
|
36695 | },
|
36696 | 'innerRoundness': {
|
36697 | get: ExpressionPropertyInterface(prop.is)
|
36698 | },
|
36699 | '_name': { value: shape.nm }
|
36700 | });
|
36701 | interfaceFunction.mn = shape.mn;
|
36702 | return interfaceFunction;
|
36703 | }
|
36704 |
|
36705 | function rectInterfaceFactory(shape,view,propertyGroup){
|
36706 | function _propertyGroup(val){
|
36707 | if(val == 1){
|
36708 | return interfaceFunction;
|
36709 | } else {
|
36710 | return propertyGroup(--val);
|
36711 | }
|
36712 | }
|
36713 | var prop = view.sh.ty === 'tm' ? view.sh.prop : view.sh;
|
36714 | interfaceFunction.propertyIndex = shape.ix;
|
36715 | prop.p.setGroupProperty(_propertyGroup);
|
36716 | prop.s.setGroupProperty(_propertyGroup);
|
36717 | prop.r.setGroupProperty(_propertyGroup);
|
36718 |
|
36719 | function interfaceFunction(value){
|
36720 | if(shape.p.ix === value){
|
36721 | return interfaceFunction.position;
|
36722 | }
|
36723 | if(shape.r.ix === value){
|
36724 | return interfaceFunction.roundness;
|
36725 | }
|
36726 | if(shape.s.ix === value || value === 'Size' || value === 'ADBE Vector Rect Size'){
|
36727 | return interfaceFunction.size;
|
36728 | }
|
36729 |
|
36730 | }
|
36731 | Object.defineProperties(interfaceFunction, {
|
36732 | 'position': {
|
36733 | get: ExpressionPropertyInterface(prop.p)
|
36734 | },
|
36735 | 'roundness': {
|
36736 | get: ExpressionPropertyInterface(prop.r)
|
36737 | },
|
36738 | 'size': {
|
36739 | get: ExpressionPropertyInterface(prop.s)
|
36740 | },
|
36741 | '_name': { value: shape.nm }
|
36742 | });
|
36743 | interfaceFunction.mn = shape.mn;
|
36744 | return interfaceFunction;
|
36745 | }
|
36746 |
|
36747 | function roundedInterfaceFactory(shape,view,propertyGroup){
|
36748 | function _propertyGroup(val){
|
36749 | if(val == 1){
|
36750 | return interfaceFunction;
|
36751 | } else {
|
36752 | return propertyGroup(--val);
|
36753 | }
|
36754 | }
|
36755 | var prop = view;
|
36756 | interfaceFunction.propertyIndex = shape.ix;
|
36757 | prop.rd.setGroupProperty(_propertyGroup);
|
36758 |
|
36759 | function interfaceFunction(value){
|
36760 | if(shape.r.ix === value || 'Round Corners 1' === value){
|
36761 | return interfaceFunction.radius;
|
36762 | }
|
36763 |
|
36764 | }
|
36765 | Object.defineProperties(interfaceFunction, {
|
36766 | 'radius': {
|
36767 | get: ExpressionPropertyInterface(prop.rd)
|
36768 | },
|
36769 | '_name': { value: shape.nm }
|
36770 | });
|
36771 | interfaceFunction.mn = shape.mn;
|
36772 | return interfaceFunction;
|
36773 | }
|
36774 |
|
36775 | function repeaterInterfaceFactory(shape,view,propertyGroup){
|
36776 | function _propertyGroup(val){
|
36777 | if(val == 1){
|
36778 | return interfaceFunction;
|
36779 | } else {
|
36780 | return propertyGroup(--val);
|
36781 | }
|
36782 | }
|
36783 | var prop = view;
|
36784 | interfaceFunction.propertyIndex = shape.ix;
|
36785 | prop.c.setGroupProperty(_propertyGroup);
|
36786 | prop.o.setGroupProperty(_propertyGroup);
|
36787 |
|
36788 | function interfaceFunction(value){
|
36789 | if(shape.c.ix === value || 'Copies' === value){
|
36790 | return interfaceFunction.copies;
|
36791 | } else if(shape.o.ix === value || 'Offset' === value){
|
36792 | return interfaceFunction.offset;
|
36793 | }
|
36794 |
|
36795 | }
|
36796 | Object.defineProperties(interfaceFunction, {
|
36797 | 'copies': {
|
36798 | get: ExpressionPropertyInterface(prop.c)
|
36799 | },
|
36800 | 'offset': {
|
36801 | get: ExpressionPropertyInterface(prop.o)
|
36802 | },
|
36803 | '_name': { value: shape.nm }
|
36804 | });
|
36805 | interfaceFunction.mn = shape.mn;
|
36806 | return interfaceFunction;
|
36807 | }
|
36808 |
|
36809 | function pathInterfaceFactory(shape,view,propertyGroup){
|
36810 | var prop = view.sh;
|
36811 | function _propertyGroup(val){
|
36812 | if(val == 1){
|
36813 | return interfaceFunction;
|
36814 | } else {
|
36815 | return propertyGroup(--val);
|
36816 | }
|
36817 | }
|
36818 | prop.setGroupProperty(_propertyGroup);
|
36819 |
|
36820 | function interfaceFunction(val){
|
36821 | if(val === 'Shape' || val === 'shape' || val === 'Path' || val === 'path' || val === 'ADBE Vector Shape' || val === 2){
|
36822 | return interfaceFunction.path;
|
36823 | }
|
36824 | }
|
36825 | Object.defineProperties(interfaceFunction, {
|
36826 | 'path': {
|
36827 | get: function(){
|
36828 | if(prop.k){
|
36829 | prop.getValue();
|
36830 | }
|
36831 | return prop;
|
36832 | }
|
36833 | },
|
36834 | 'shape': {
|
36835 | get: function(){
|
36836 | if(prop.k){
|
36837 | prop.getValue();
|
36838 | }
|
36839 | return prop;
|
36840 | }
|
36841 | },
|
36842 | '_name': { value: shape.nm },
|
36843 | 'ix': { value: shape.ix },
|
36844 | 'mn': { value: shape.mn }
|
36845 | });
|
36846 | return interfaceFunction;
|
36847 | }
|
36848 |
|
36849 | return function(shapes,view,propertyGroup) {
|
36850 | var interfaces;
|
36851 | function _interfaceFunction(value){
|
36852 | if(typeof value === 'number'){
|
36853 | return interfaces[value-1];
|
36854 | } else {
|
36855 | var i = 0, len = interfaces.length;
|
36856 | while(i<len){
|
36857 | if(interfaces[i]._name === value){
|
36858 | return interfaces[i];
|
36859 | }
|
36860 | i+=1;
|
36861 | }
|
36862 | }
|
36863 | }
|
36864 | _interfaceFunction.propertyGroup = propertyGroup;
|
36865 | interfaces = iterateElements(shapes, view, _interfaceFunction);
|
36866 | _interfaceFunction.numProperties = interfaces.length;
|
36867 | return _interfaceFunction;
|
36868 | };
|
36869 | }());
|
36870 |
|
36871 | var TextExpressionInterface = (function(){
|
36872 | return function(elem){
|
36873 | var _prevValue, _sourceText;
|
36874 | function _thisLayerFunction(){
|
36875 | }
|
36876 | Object.defineProperty(_thisLayerFunction, "sourceText", {
|
36877 | get: function(){
|
36878 | elem.textProperty.getValue();
|
36879 | var stringValue = elem.textProperty.currentData.t;
|
36880 | if(stringValue !== _prevValue) {
|
36881 | elem.textProperty.currentData.t = _prevValue;
|
36882 | _sourceText = new String(stringValue);
|
36883 | //If stringValue is an empty string, eval returns undefined, so it has to be returned as a String primitive
|
36884 | _sourceText.value = stringValue ? stringValue : new String(stringValue);
|
36885 | }
|
36886 | return _sourceText;
|
36887 | }
|
36888 | });
|
36889 | return _thisLayerFunction;
|
36890 | };
|
36891 | }());
|
36892 | var LayerExpressionInterface = (function (){
|
36893 | function toWorld(arr, time){
|
36894 | var toWorldMat = new Matrix();
|
36895 | toWorldMat.reset();
|
36896 | var transformMat;
|
36897 | if(time) {
|
36898 | //Todo implement value at time on transform properties
|
36899 | //transformMat = this._elem.finalTransform.mProp.getValueAtTime(time);
|
36900 | transformMat = this._elem.finalTransform.mProp;
|
36901 | } else {
|
36902 | transformMat = this._elem.finalTransform.mProp;
|
36903 | }
|
36904 | transformMat.applyToMatrix(toWorldMat);
|
36905 | if(this._elem.hierarchy && this._elem.hierarchy.length){
|
36906 | var i, len = this._elem.hierarchy.length;
|
36907 | for(i=0;i<len;i+=1){
|
36908 | this._elem.hierarchy[i].finalTransform.mProp.applyToMatrix(toWorldMat);
|
36909 | }
|
36910 | return toWorldMat.applyToPointArray(arr[0],arr[1],arr[2]||0);
|
36911 | }
|
36912 | return toWorldMat.applyToPointArray(arr[0],arr[1],arr[2]||0);
|
36913 | }
|
36914 | function fromWorld(arr, time){
|
36915 | var toWorldMat = new Matrix();
|
36916 | toWorldMat.reset();
|
36917 | var transformMat;
|
36918 | if(time) {
|
36919 | //Todo implement value at time on transform properties
|
36920 | //transformMat = this._elem.finalTransform.mProp.getValueAtTime(time);
|
36921 | transformMat = this._elem.finalTransform.mProp;
|
36922 | } else {
|
36923 | transformMat = this._elem.finalTransform.mProp;
|
36924 | }
|
36925 | transformMat.applyToMatrix(toWorldMat);
|
36926 | if(this._elem.hierarchy && this._elem.hierarchy.length){
|
36927 | var i, len = this._elem.hierarchy.length;
|
36928 | for(i=0;i<len;i+=1){
|
36929 | this._elem.hierarchy[i].finalTransform.mProp.applyToMatrix(toWorldMat);
|
36930 | }
|
36931 | return toWorldMat.inversePoint(arr);
|
36932 | }
|
36933 | return toWorldMat.inversePoint(arr);
|
36934 | }
|
36935 | function fromComp(arr){
|
36936 | var toWorldMat = new Matrix();
|
36937 | toWorldMat.reset();
|
36938 | this._elem.finalTransform.mProp.applyToMatrix(toWorldMat);
|
36939 | if(this._elem.hierarchy && this._elem.hierarchy.length){
|
36940 | var i, len = this._elem.hierarchy.length;
|
36941 | for(i=0;i<len;i+=1){
|
36942 | this._elem.hierarchy[i].finalTransform.mProp.applyToMatrix(toWorldMat);
|
36943 | }
|
36944 | return toWorldMat.inversePoint(arr);
|
36945 | }
|
36946 | return toWorldMat.inversePoint(arr);
|
36947 | }
|
36948 |
|
36949 | function sampleImage() {
|
36950 | return [1,1,1,1];
|
36951 | }
|
36952 |
|
36953 |
|
36954 | return function(elem){
|
36955 |
|
36956 | var transformInterface;
|
36957 |
|
36958 | function _registerMaskInterface(maskManager){
|
36959 | _thisLayerFunction.mask = new MaskManagerInterface(maskManager, elem);
|
36960 | }
|
36961 | function _registerEffectsInterface(effects){
|
36962 | _thisLayerFunction.effect = effects;
|
36963 | }
|
36964 |
|
36965 | function _thisLayerFunction(name){
|
36966 | switch(name){
|
36967 | case "ADBE Root Vectors Group":
|
36968 | case "Contents":
|
36969 | case 2:
|
36970 | return _thisLayerFunction.shapeInterface;
|
36971 | case 1:
|
36972 | case 6:
|
36973 | case "Transform":
|
36974 | case "transform":
|
36975 | case "ADBE Transform Group":
|
36976 | return transformInterface;
|
36977 | case 4:
|
36978 | case "ADBE Effect Parade":
|
36979 | case "effects":
|
36980 | case "Effects":
|
36981 | return _thisLayerFunction.effect;
|
36982 | }
|
36983 | }
|
36984 | _thisLayerFunction.toWorld = toWorld;
|
36985 | _thisLayerFunction.fromWorld = fromWorld;
|
36986 | _thisLayerFunction.toComp = toWorld;
|
36987 | _thisLayerFunction.fromComp = fromComp;
|
36988 | _thisLayerFunction.sampleImage = sampleImage;
|
36989 | _thisLayerFunction.sourceRectAtTime = elem.sourceRectAtTime.bind(elem);
|
36990 | _thisLayerFunction._elem = elem;
|
36991 | transformInterface = TransformExpressionInterface(elem.finalTransform.mProp);
|
36992 | var anchorPointDescriptor = getDescriptor(transformInterface, 'anchorPoint');
|
36993 | Object.defineProperties(_thisLayerFunction,{
|
36994 | hasParent: {
|
36995 | get: function(){
|
36996 | return elem.hierarchy.length;
|
36997 | }
|
36998 | },
|
36999 | parent: {
|
37000 | get: function(){
|
37001 | return elem.hierarchy[0].layerInterface;
|
37002 | }
|
37003 | },
|
37004 | rotation: getDescriptor(transformInterface, 'rotation'),
|
37005 | scale: getDescriptor(transformInterface, 'scale'),
|
37006 | position: getDescriptor(transformInterface, 'position'),
|
37007 | opacity: getDescriptor(transformInterface, 'opacity'),
|
37008 | anchorPoint: anchorPointDescriptor,
|
37009 | anchor_point: anchorPointDescriptor,
|
37010 | transform: {
|
37011 | get: function () {
|
37012 | return transformInterface;
|
37013 | }
|
37014 | },
|
37015 | active: {
|
37016 | get: function(){
|
37017 | return elem.isInRange;
|
37018 | }
|
37019 | }
|
37020 | });
|
37021 |
|
37022 | _thisLayerFunction.startTime = elem.data.st;
|
37023 | _thisLayerFunction.index = elem.data.ind;
|
37024 | _thisLayerFunction.source = elem.data.refId;
|
37025 | _thisLayerFunction.height = elem.data.ty === 0 ? elem.data.h : 100;
|
37026 | _thisLayerFunction.width = elem.data.ty === 0 ? elem.data.w : 100;
|
37027 | _thisLayerFunction.inPoint = elem.data.ip/elem.comp.globalData.frameRate;
|
37028 | _thisLayerFunction.outPoint = elem.data.op/elem.comp.globalData.frameRate;
|
37029 | _thisLayerFunction._name = elem.data.nm;
|
37030 |
|
37031 | _thisLayerFunction.registerMaskInterface = _registerMaskInterface;
|
37032 | _thisLayerFunction.registerEffectsInterface = _registerEffectsInterface;
|
37033 | return _thisLayerFunction;
|
37034 | };
|
37035 | }());
|
37036 |
|
37037 | var CompExpressionInterface = (function (){
|
37038 | return function(comp){
|
37039 | function _thisLayerFunction(name){
|
37040 | var i=0, len = comp.layers.length;
|
37041 | while(i<len){
|
37042 | if(comp.layers[i].nm === name || comp.layers[i].ind === name){
|
37043 | return comp.elements[i].layerInterface;
|
37044 | }
|
37045 | i += 1;
|
37046 | }
|
37047 | return null;
|
37048 | //return {active:false};
|
37049 | }
|
37050 | Object.defineProperty(_thisLayerFunction, "_name", { value:comp.data.nm });
|
37051 | _thisLayerFunction.layer = _thisLayerFunction;
|
37052 | _thisLayerFunction.pixelAspect = 1;
|
37053 | _thisLayerFunction.height = comp.data.h || comp.globalData.compSize.h;
|
37054 | _thisLayerFunction.width = comp.data.w || comp.globalData.compSize.w;
|
37055 | _thisLayerFunction.pixelAspect = 1;
|
37056 | _thisLayerFunction.frameDuration = 1/comp.globalData.frameRate;
|
37057 | _thisLayerFunction.displayStartTime = 0;
|
37058 | _thisLayerFunction.numLayers = comp.layers.length;
|
37059 | return _thisLayerFunction;
|
37060 | };
|
37061 | }());
|
37062 | var TransformExpressionInterface = (function (){
|
37063 | return function(transform){
|
37064 | function _thisFunction(name){
|
37065 | switch(name){
|
37066 | case "scale":
|
37067 | case "Scale":
|
37068 | case "ADBE Scale":
|
37069 | case 6:
|
37070 | return _thisFunction.scale;
|
37071 | case "rotation":
|
37072 | case "Rotation":
|
37073 | case "ADBE Rotation":
|
37074 | case "ADBE Rotate Z":
|
37075 | case 10:
|
37076 | return _thisFunction.rotation;
|
37077 | case "ADBE Rotate X":
|
37078 | return _thisFunction.xRotation;
|
37079 | case "ADBE Rotate Y":
|
37080 | return _thisFunction.yRotation;
|
37081 | case "position":
|
37082 | case "Position":
|
37083 | case "ADBE Position":
|
37084 | case 2:
|
37085 | return _thisFunction.position;
|
37086 | case 'ADBE Position_0':
|
37087 | return _thisFunction.xPosition;
|
37088 | case 'ADBE Position_1':
|
37089 | return _thisFunction.yPosition;
|
37090 | case 'ADBE Position_2':
|
37091 | return _thisFunction.zPosition;
|
37092 | case "anchorPoint":
|
37093 | case "AnchorPoint":
|
37094 | case "Anchor Point":
|
37095 | case "ADBE AnchorPoint":
|
37096 | case 1:
|
37097 | return _thisFunction.anchorPoint;
|
37098 | case "opacity":
|
37099 | case "Opacity":
|
37100 | case 11:
|
37101 | return _thisFunction.opacity;
|
37102 | }
|
37103 | }
|
37104 |
|
37105 | Object.defineProperty(_thisFunction, "rotation", {
|
37106 | get: ExpressionPropertyInterface(transform.r || transform.rz)
|
37107 | });
|
37108 |
|
37109 | Object.defineProperty(_thisFunction, "zRotation", {
|
37110 | get: ExpressionPropertyInterface(transform.rz || transform.r)
|
37111 | });
|
37112 |
|
37113 | Object.defineProperty(_thisFunction, "xRotation", {
|
37114 | get: ExpressionPropertyInterface(transform.rx)
|
37115 | });
|
37116 |
|
37117 | Object.defineProperty(_thisFunction, "yRotation", {
|
37118 | get: ExpressionPropertyInterface(transform.ry)
|
37119 | });
|
37120 | Object.defineProperty(_thisFunction, "scale", {
|
37121 | get: ExpressionPropertyInterface(transform.s)
|
37122 | });
|
37123 |
|
37124 | if(transform.p) {
|
37125 | var _transformFactory = ExpressionPropertyInterface(transform.p);
|
37126 | }
|
37127 | Object.defineProperty(_thisFunction, "position", {
|
37128 | get: function () {
|
37129 | if(transform.p) {
|
37130 | return _transformFactory();
|
37131 | } else {
|
37132 | return [transform.px.v, transform.py.v, transform.pz ? transform.pz.v : 0];
|
37133 | }
|
37134 | }
|
37135 | });
|
37136 |
|
37137 | Object.defineProperty(_thisFunction, "xPosition", {
|
37138 | get: ExpressionPropertyInterface(transform.px)
|
37139 | });
|
37140 |
|
37141 | Object.defineProperty(_thisFunction, "yPosition", {
|
37142 | get: ExpressionPropertyInterface(transform.py)
|
37143 | });
|
37144 |
|
37145 | Object.defineProperty(_thisFunction, "zPosition", {
|
37146 | get: ExpressionPropertyInterface(transform.pz)
|
37147 | });
|
37148 |
|
37149 | Object.defineProperty(_thisFunction, "anchorPoint", {
|
37150 | get: ExpressionPropertyInterface(transform.a)
|
37151 | });
|
37152 |
|
37153 | Object.defineProperty(_thisFunction, "opacity", {
|
37154 | get: ExpressionPropertyInterface(transform.o)
|
37155 | });
|
37156 |
|
37157 | Object.defineProperty(_thisFunction, "skew", {
|
37158 | get: ExpressionPropertyInterface(transform.sk)
|
37159 | });
|
37160 |
|
37161 | Object.defineProperty(_thisFunction, "skewAxis", {
|
37162 | get: ExpressionPropertyInterface(transform.sa)
|
37163 | });
|
37164 |
|
37165 | Object.defineProperty(_thisFunction, "orientation", {
|
37166 | get: ExpressionPropertyInterface(transform.or)
|
37167 | });
|
37168 |
|
37169 | return _thisFunction;
|
37170 | };
|
37171 | }());
|
37172 | var ProjectInterface = (function (){
|
37173 |
|
37174 | function registerComposition(comp){
|
37175 | this.compositions.push(comp);
|
37176 | }
|
37177 |
|
37178 | return function(){
|
37179 | function _thisProjectFunction(name){
|
37180 | var i = 0, len = this.compositions.length;
|
37181 | while(i<len){
|
37182 | if(this.compositions[i].data && this.compositions[i].data.nm === name){
|
37183 | if(this.compositions[i].prepareFrame && this.compositions[i].data.xt) {
|
37184 | this.compositions[i].prepareFrame(this.currentFrame);
|
37185 | }
|
37186 | return this.compositions[i].compInterface;
|
37187 | }
|
37188 | i+=1;
|
37189 | }
|
37190 | }
|
37191 |
|
37192 | _thisProjectFunction.compositions = [];
|
37193 | _thisProjectFunction.currentFrame = 0;
|
37194 |
|
37195 | _thisProjectFunction.registerComposition = registerComposition;
|
37196 |
|
37197 |
|
37198 |
|
37199 | return _thisProjectFunction;
|
37200 | };
|
37201 | }());
|
37202 | var EffectsExpressionInterface = (function (){
|
37203 | var ob = {
|
37204 | createEffectsInterface: createEffectsInterface
|
37205 | };
|
37206 |
|
37207 | function createEffectsInterface(elem, propertyGroup){
|
37208 | if(elem.effectsManager){
|
37209 |
|
37210 | var effectElements = [];
|
37211 | var effectsData = elem.data.ef;
|
37212 | var i, len = elem.effectsManager.effectElements.length;
|
37213 | for(i=0;i<len;i+=1){
|
37214 | effectElements.push(createGroupInterface(effectsData[i],elem.effectsManager.effectElements[i],propertyGroup,elem));
|
37215 | }
|
37216 |
|
37217 | return function(name){
|
37218 | var effects = elem.data.ef || [], i = 0, len = effects.length;
|
37219 | while(i<len) {
|
37220 | if(name === effects[i].nm || name === effects[i].mn || name === effects[i].ix){
|
37221 | return effectElements[i];
|
37222 | }
|
37223 | i += 1;
|
37224 | }
|
37225 | };
|
37226 | }
|
37227 | }
|
37228 |
|
37229 | function createGroupInterface(data,elements, propertyGroup, elem){
|
37230 | var effectElements = [];
|
37231 | var i, len = data.ef.length;
|
37232 | for(i=0;i<len;i+=1){
|
37233 | if(data.ef[i].ty === 5){
|
37234 | effectElements.push(createGroupInterface(data.ef[i],elements.effectElements[i],elements.effectElements[i].propertyGroup, elem));
|
37235 | } else {
|
37236 | effectElements.push(createValueInterface(elements.effectElements[i],data.ef[i].ty, elem, _propertyGroup));
|
37237 | }
|
37238 | }
|
37239 |
|
37240 | function _propertyGroup(val) {
|
37241 | if(val === 1){
|
37242 | return groupInterface;
|
37243 | } else{
|
37244 | return propertyGroup(val-1);
|
37245 | }
|
37246 | }
|
37247 |
|
37248 | var groupInterface = function(name){
|
37249 | var effects = data.ef, i = 0, len = effects.length;
|
37250 | while(i<len) {
|
37251 | if(name === effects[i].nm || name === effects[i].mn || name === effects[i].ix){
|
37252 | if(effects[i].ty === 5){
|
37253 | return effectElements[i];
|
37254 | } else {
|
37255 | return effectElements[i]();
|
37256 | }
|
37257 | }
|
37258 | i += 1;
|
37259 | }
|
37260 | return effectElements[0]();
|
37261 | };
|
37262 |
|
37263 | groupInterface.propertyGroup = _propertyGroup;
|
37264 |
|
37265 | if(data.mn === 'ADBE Color Control'){
|
37266 | Object.defineProperty(groupInterface, 'color', {
|
37267 | get: function(){
|
37268 | return effectElements[0]();
|
37269 | }
|
37270 | });
|
37271 | }
|
37272 | Object.defineProperty(groupInterface, 'numProperties', {
|
37273 | get: function(){
|
37274 | return data.np;
|
37275 | }
|
37276 | });
|
37277 | groupInterface.active = groupInterface.enabled = data.en !== 0;
|
37278 | return groupInterface;
|
37279 | }
|
37280 |
|
37281 | function createValueInterface(element, type, elem, propertyGroup){
|
37282 | var expressionProperty = ExpressionPropertyInterface(element.p);
|
37283 | function interfaceFunction(){
|
37284 | if(type === 10){
|
37285 | return elem.comp.compInterface(element.p.v);
|
37286 | }
|
37287 | return expressionProperty();
|
37288 | }
|
37289 |
|
37290 | if(element.p.setGroupProperty) {
|
37291 | element.p.setGroupProperty(propertyGroup);
|
37292 | }
|
37293 |
|
37294 | return interfaceFunction;
|
37295 | }
|
37296 |
|
37297 | return ob;
|
37298 |
|
37299 | }());
|
37300 | var MaskManagerInterface = (function(){
|
37301 |
|
37302 | function MaskInterface(mask, data){
|
37303 | this._mask = mask;
|
37304 | this._data = data;
|
37305 | }
|
37306 | Object.defineProperty(MaskInterface.prototype, 'maskPath', {
|
37307 | get: function(){
|
37308 | if(this._mask.prop.k){
|
37309 | this._mask.prop.getValue();
|
37310 | }
|
37311 | return this._mask.prop;
|
37312 | }
|
37313 | });
|
37314 |
|
37315 | var MaskManager = function(maskManager, elem){
|
37316 | var _masksInterfaces = createSizedArray(maskManager.viewData.length);
|
37317 | var i, len = maskManager.viewData.length;
|
37318 | for(i = 0; i < len; i += 1) {
|
37319 | _masksInterfaces[i] = new MaskInterface(maskManager.viewData[i], maskManager.masksProperties[i]);
|
37320 | }
|
37321 |
|
37322 | var maskFunction = function(name){
|
37323 | i = 0;
|
37324 | while(i<len){
|
37325 | if(maskManager.masksProperties[i].nm === name){
|
37326 | return _masksInterfaces[i];
|
37327 | }
|
37328 | i += 1;
|
37329 | }
|
37330 | };
|
37331 | return maskFunction;
|
37332 | };
|
37333 | return MaskManager;
|
37334 | }());
|
37335 |
|
37336 | var ExpressionPropertyInterface = (function() {
|
37337 |
|
37338 | var defaultUnidimensionalValue = {pv:0, v:0, mult: 1};
|
37339 | var defaultMultidimensionalValue = {pv:[0,0,0], v:[0,0,0], mult: 1};
|
37340 |
|
37341 | function completeProperty(expressionValue, property, type) {
|
37342 | Object.defineProperty(expressionValue, 'velocity', {
|
37343 | get: function(){
|
37344 | return property.getVelocityAtTime(property.comp.currentFrame);
|
37345 | }
|
37346 | });
|
37347 | expressionValue.numKeys = property.keyframes ? property.keyframes.length : 0;
|
37348 | expressionValue.key = function(pos) {
|
37349 | if (!expressionValue.numKeys) {
|
37350 | return 0;
|
37351 | } else {
|
37352 | var value = '';
|
37353 | if ('s' in property.keyframes[pos-1]) {
|
37354 | value = property.keyframes[pos-1].s;
|
37355 | } else if ('e' in property.keyframes[pos-2]) {
|
37356 | value = property.keyframes[pos-2].e;
|
37357 | } else {
|
37358 | value = property.keyframes[pos-2].s;
|
37359 | }
|
37360 | var valueProp = type === 'unidimensional' ? new Number(value) : Object.assign({}, value);
|
37361 | valueProp.time = property.keyframes[pos-1].t / property.elem.comp.globalData.frameRate;
|
37362 | return valueProp;
|
37363 | }
|
37364 | };
|
37365 | expressionValue.valueAtTime = property.getValueAtTime;
|
37366 | expressionValue.speedAtTime = property.getSpeedAtTime;
|
37367 | expressionValue.velocityAtTime = property.getVelocityAtTime;
|
37368 | expressionValue.propertyGroup = property.propertyGroup;
|
37369 | }
|
37370 |
|
37371 | function UnidimensionalPropertyInterface(property) {
|
37372 | if(!property || !('pv' in property)) {
|
37373 | property = defaultUnidimensionalValue;
|
37374 | }
|
37375 | var mult = 1 / property.mult;
|
37376 | var val = property.pv * mult;
|
37377 | var expressionValue = new Number(val);
|
37378 | expressionValue.value = val;
|
37379 | completeProperty(expressionValue, property, 'unidimensional');
|
37380 |
|
37381 | return function() {
|
37382 | if (property.k) {
|
37383 | property.getValue();
|
37384 | }
|
37385 | val = property.v * mult;
|
37386 | if(expressionValue.value !== val) {
|
37387 | expressionValue = new Number(val);
|
37388 | expressionValue.value = val;
|
37389 | completeProperty(expressionValue, property, 'unidimensional');
|
37390 | }
|
37391 | return expressionValue;
|
37392 | }
|
37393 | }
|
37394 |
|
37395 | function MultidimensionalPropertyInterface(property) {
|
37396 | if(!property || !('pv' in property)) {
|
37397 | property = defaultMultidimensionalValue;
|
37398 | }
|
37399 | var mult = 1 / property.mult;
|
37400 | var len = property.pv.length;
|
37401 | var expressionValue = createTypedArray('float32', len);
|
37402 | var arrValue = createTypedArray('float32', len);
|
37403 | expressionValue.value = arrValue;
|
37404 | completeProperty(expressionValue, property, 'multidimensional');
|
37405 |
|
37406 | return function() {
|
37407 | if (property.k) {
|
37408 | property.getValue();
|
37409 | }
|
37410 | for (var i = 0; i < len; i += 1) {
|
37411 | expressionValue[i] = arrValue[i] = property.v[i] * mult;
|
37412 | }
|
37413 | return expressionValue;
|
37414 | }
|
37415 | }
|
37416 |
|
37417 | //TODO: try to avoid using this getter
|
37418 | function defaultGetter() {
|
37419 | return defaultUnidimensionalValue;
|
37420 | }
|
37421 |
|
37422 | return function(property) {
|
37423 | if(!property) {
|
37424 | return defaultGetter;
|
37425 | } else if (property.propType === 'unidimensional') {
|
37426 | return UnidimensionalPropertyInterface(property);
|
37427 | } else {
|
37428 | return MultidimensionalPropertyInterface(property);
|
37429 | }
|
37430 | }
|
37431 | }());
|
37432 |
|
37433 | (function(){
|
37434 |
|
37435 | var TextExpressionSelectorProp = (function(){
|
37436 |
|
37437 | function getValueProxy(index,total){
|
37438 | this.textIndex = index+1;
|
37439 | this.textTotal = total;
|
37440 | this.v = this.getValue() * this.mult;
|
37441 | return this.v;
|
37442 | }
|
37443 |
|
37444 | return function TextExpressionSelectorProp(elem,data){
|
37445 | this.pv = 1;
|
37446 | this.comp = elem.comp;
|
37447 | this.elem = elem;
|
37448 | this.mult = 0.01;
|
37449 | this.propType = 'textSelector';
|
37450 | this.textTotal = data.totalChars;
|
37451 | this.selectorValue = 100;
|
37452 | this.lastValue = [1,1,1];
|
37453 | this.k = true;
|
37454 | this.x = true;
|
37455 | this.getValue = ExpressionManager.initiateExpression.bind(this)(elem,data,this);
|
37456 | this.getMult = getValueProxy;
|
37457 | this.getVelocityAtTime = expressionHelpers.getVelocityAtTime;
|
37458 | if(this.kf){
|
37459 | this.getValueAtTime = expressionHelpers.getValueAtTime.bind(this);
|
37460 | } else {
|
37461 | this.getValueAtTime = expressionHelpers.getStaticValueAtTime.bind(this);
|
37462 | }
|
37463 | this.setGroupProperty = expressionHelpers.setGroupProperty;
|
37464 | };
|
37465 | }());
|
37466 |
|
37467 | var propertyGetTextProp = TextSelectorProp.getTextSelectorProp;
|
37468 | TextSelectorProp.getTextSelectorProp = function(elem, data,arr){
|
37469 | if(data.t === 1){
|
37470 | return new TextExpressionSelectorProp(elem, data,arr);
|
37471 | } else {
|
37472 | return propertyGetTextProp(elem,data,arr);
|
37473 | }
|
37474 | };
|
37475 | }());
|
37476 | function SliderEffect(data,elem, container){
|
37477 | this.p = PropertyFactory.getProp(elem,data.v,0,0,container);
|
37478 | }
|
37479 | function AngleEffect(data,elem, container){
|
37480 | this.p = PropertyFactory.getProp(elem,data.v,0,0,container);
|
37481 | }
|
37482 | function ColorEffect(data,elem, container){
|
37483 | this.p = PropertyFactory.getProp(elem,data.v,1,0,container);
|
37484 | }
|
37485 | function PointEffect(data,elem, container){
|
37486 | this.p = PropertyFactory.getProp(elem,data.v,1,0,container);
|
37487 | }
|
37488 | function LayerIndexEffect(data,elem, container){
|
37489 | this.p = PropertyFactory.getProp(elem,data.v,0,0,container);
|
37490 | }
|
37491 | function MaskIndexEffect(data,elem, container){
|
37492 | this.p = PropertyFactory.getProp(elem,data.v,0,0,container);
|
37493 | }
|
37494 | function CheckboxEffect(data,elem, container){
|
37495 | this.p = PropertyFactory.getProp(elem,data.v,0,0,container);
|
37496 | }
|
37497 | function NoValueEffect(){
|
37498 | this.p = {};
|
37499 | }
|
37500 | function EffectsManager(){}
|
37501 | function EffectsManager(data,element){
|
37502 | var effects = data.ef || [];
|
37503 | this.effectElements = [];
|
37504 | var i,len = effects.length;
|
37505 | var effectItem;
|
37506 | for(i=0;i<len;i++) {
|
37507 | effectItem = new GroupEffect(effects[i],element);
|
37508 | this.effectElements.push(effectItem);
|
37509 | }
|
37510 | }
|
37511 |
|
37512 | function GroupEffect(data,element){
|
37513 | this.init(data,element);
|
37514 | }
|
37515 |
|
37516 | extendPrototype([DynamicPropertyContainer], GroupEffect);
|
37517 |
|
37518 | GroupEffect.prototype.getValue = GroupEffect.prototype.iterateDynamicProperties;
|
37519 |
|
37520 | GroupEffect.prototype.init = function(data,element){
|
37521 | this.data = data;
|
37522 | this.effectElements = [];
|
37523 | this.initDynamicPropertyContainer(element);
|
37524 | var i, len = this.data.ef.length;
|
37525 | var eff, effects = this.data.ef;
|
37526 | for(i=0;i<len;i+=1){
|
37527 | eff = null;
|
37528 | switch(effects[i].ty){
|
37529 | case 0:
|
37530 | eff = new SliderEffect(effects[i],element,this);
|
37531 | break;
|
37532 | case 1:
|
37533 | eff = new AngleEffect(effects[i],element,this);
|
37534 | break;
|
37535 | case 2:
|
37536 | eff = new ColorEffect(effects[i],element,this);
|
37537 | break;
|
37538 | case 3:
|
37539 | eff = new PointEffect(effects[i],element,this);
|
37540 | break;
|
37541 | case 4:
|
37542 | case 7:
|
37543 | eff = new CheckboxEffect(effects[i],element,this);
|
37544 | break;
|
37545 | case 10:
|
37546 | eff = new LayerIndexEffect(effects[i],element,this);
|
37547 | break;
|
37548 | case 11:
|
37549 | eff = new MaskIndexEffect(effects[i],element,this);
|
37550 | break;
|
37551 | case 5:
|
37552 | eff = new EffectsManager(effects[i],element,this);
|
37553 | break;
|
37554 | //case 6:
|
37555 | default:
|
37556 | eff = new NoValueEffect(effects[i],element,this);
|
37557 | break;
|
37558 | }
|
37559 | if(eff) {
|
37560 | this.effectElements.push(eff);
|
37561 | }
|
37562 | }
|
37563 | };
|
37564 |
|
37565 | var lottiejs = {};
|
37566 |
|
37567 | function setLocationHref (href) {
|
37568 | locationHref = href;
|
37569 | }
|
37570 |
|
37571 | function searchAnimations() {
|
37572 | {
|
37573 | animationManager.searchAnimations();
|
37574 | }
|
37575 | }
|
37576 |
|
37577 | function setSubframeRendering(flag) {
|
37578 | subframeEnabled = flag;
|
37579 | }
|
37580 |
|
37581 | function loadAnimation(params) {
|
37582 | return animationManager.loadAnimation(params);
|
37583 | }
|
37584 |
|
37585 | function setQuality(value) {
|
37586 | if (typeof value === 'string') {
|
37587 | switch (value) {
|
37588 | case 'high':
|
37589 | defaultCurveSegments = 200;
|
37590 | break;
|
37591 | case 'medium':
|
37592 | defaultCurveSegments = 50;
|
37593 | break;
|
37594 | case 'low':
|
37595 | defaultCurveSegments = 10;
|
37596 | break;
|
37597 | }
|
37598 | } else if (!isNaN(value) && value > 1) {
|
37599 | defaultCurveSegments = value;
|
37600 | }
|
37601 | }
|
37602 |
|
37603 | function inBrowser() {
|
37604 | return typeof navigator !== 'undefined';
|
37605 | }
|
37606 |
|
37607 | function installPlugin(type, plugin) {
|
37608 | if (type === 'expressions') {
|
37609 | expressionsPlugin = plugin;
|
37610 | }
|
37611 | }
|
37612 |
|
37613 | function getFactory(name) {
|
37614 | switch (name) {
|
37615 | case "propertyFactory":
|
37616 | return PropertyFactory;
|
37617 | case "shapePropertyFactory":
|
37618 | return ShapePropertyFactory;
|
37619 | case "matrix":
|
37620 | return Matrix;
|
37621 | }
|
37622 | }
|
37623 |
|
37624 | lottiejs.play = animationManager.play;
|
37625 | lottiejs.pause = animationManager.pause;
|
37626 | lottiejs.setLocationHref = setLocationHref;
|
37627 | lottiejs.togglePause = animationManager.togglePause;
|
37628 | lottiejs.setSpeed = animationManager.setSpeed;
|
37629 | lottiejs.setDirection = animationManager.setDirection;
|
37630 | lottiejs.stop = animationManager.stop;
|
37631 | lottiejs.searchAnimations = searchAnimations;
|
37632 | lottiejs.registerAnimation = animationManager.registerAnimation;
|
37633 | lottiejs.loadAnimation = loadAnimation;
|
37634 | lottiejs.setSubframeRendering = setSubframeRendering;
|
37635 | lottiejs.resize = animationManager.resize;
|
37636 | //lottiejs.start = start;
|
37637 | lottiejs.goToAndStop = animationManager.goToAndStop;
|
37638 | lottiejs.destroy = animationManager.destroy;
|
37639 | lottiejs.setQuality = setQuality;
|
37640 | lottiejs.inBrowser = inBrowser;
|
37641 | lottiejs.installPlugin = installPlugin;
|
37642 | lottiejs.freeze = animationManager.freeze;
|
37643 | lottiejs.unfreeze = animationManager.unfreeze;
|
37644 | lottiejs.getRegisteredAnimations = animationManager.getRegisteredAnimations;
|
37645 | lottiejs.__getFactory = getFactory;
|
37646 | lottiejs.version = '5.5.1';
|
37647 |
|
37648 | function checkReady() {
|
37649 | if (document.readyState === "complete") {
|
37650 | clearInterval(readyStateCheckInterval);
|
37651 | searchAnimations();
|
37652 | }
|
37653 | }
|
37654 |
|
37655 | function getQueryVariable(variable) {
|
37656 | var vars = queryString.split('&');
|
37657 | for (var i = 0; i < vars.length; i++) {
|
37658 | var pair = vars[i].split('=');
|
37659 | if (decodeURIComponent(pair[0]) == variable) {
|
37660 | return decodeURIComponent(pair[1]);
|
37661 | }
|
37662 | }
|
37663 | }
|
37664 | var renderer = '';
|
37665 | {
|
37666 | var scripts = document.getElementsByTagName('script');
|
37667 | var index = scripts.length - 1;
|
37668 | var myScript = scripts[index] || {
|
37669 | src: ''
|
37670 | };
|
37671 | var queryString = myScript.src.replace(/^[^\?]+\??/, '');
|
37672 | renderer = getQueryVariable('renderer');
|
37673 | }
|
37674 | var readyStateCheckInterval = setInterval(checkReady, 100);
|
37675 | return lottiejs;
|
37676 | }));
|
37677 | });
|
37678 |
|
37679 | var v = "5.3.4";
|
37680 | var fr = 60;
|
37681 | var ip = 0;
|
37682 | var op = 240;
|
37683 | var w = 500;
|
37684 | var h = 500;
|
37685 | var nm = "Composição 1";
|
37686 | var ddd = 1;
|
37687 | var assets = [
|
37688 | {
|
37689 | id: "image_0",
|
37690 | w: 24,
|
37691 | h: 39,
|
37692 | u: "",
|
37693 | p: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAnCAYAAAAVW4iAAAABqElEQVRIS9WWPU7DQBCF37MDtKFBgoZwEjoERWD5CwRxCN+AHIHcwGkQSCk4QnID0iNZhH8q3IUoeNAGCWGySYy9LjIHmG/f5/HuEDmVu3GrQJ7Tev/NoORGnz7Idd3bHkAFxUIv8gQ4+31oKwB3K1CAnANY/WskG0DroPgAhjpMlQ6gdfS1DsZ0WAEMdRBGHdkAWocDHxyvIx1A6xjAE4lPR9LxnvgN3HKgIEysI3kCFZTcAX2ZMB3pEqig6ETwINOn498At9xVMuZnSdrMrEjriLSO77vDdtHZvhPbTWN3kbPTnXWAyjuBus9Z0W7ugId8E3Bv5gH7jzkryhXAkDzIJwHBRlRgjTx8sq2oI0IPzeXWcPGyCAhFUENzRb+AP0VWsicg0Ij6Hx6u195HFi9WnjMoko449HD5rcP44PAoFSAUSA1XcR1WACQaUa9n1GEGHL8kVdQennqCDvObPB0QAqI96yX330VUJyaoY2GhBn9xZDqSkojqq0GRtEHHw8XSTdJGY6cIJzFACFA3TqXD/A1+AKxjfi6TDjPg9K0FvS5a0GECfAGHQaT2XgdD9QAAAABJRU5ErkJggg==",
|
37694 | e: 1
|
37695 | },
|
37696 | {
|
37697 | id: "image_1",
|
37698 | w: 49,
|
37699 | h: 29,
|
37700 | u: "",
|
37701 | p: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADEAAAAdCAYAAAAD8oRRAAACwUlEQVRYR8WYX44SQRDGv+oZcN/kBkJi1uCL6wGMk40xJK6RG8gN7BvY3mC4wXoDjMlmkzWGiRfwDV1MZvcG8obMnzI9K0RgYP7QA/NEQnd1/SbfV1U9hAqf2rNRD4DSRxBYzr49HlRxHFUR1HZGDsVQIDxfis/wLIHedNi+MXmuUYgjZ9QMY3aJ6M3WJIn7Af4oDJ/+NgFjBsLxGzamEqD3BZKaaIkFw/Z5gT2pS3eGqJ3+kMyJ7u+XTMYDswqH7WHJ/SgNYTk/u4LgMvCg7OH/7yPgY8B1iWGrsMQKQ9Sc6xMWsQvQsmlNkAATAG749VFS0fI+uSG0aSMSiglv8wYvu46AWxZxL/yST2LZENq09kyCSe6g+5I8/MmOYplVkrdC1E6ve0xw95/8CjPxhzCsu5v8kgphvxg7YHZBeFLyFRrfRuBbEKng6nitJC9BHHVGzTC09aIqTGsKzCNiGVwdf58HvINw/EatFrgMqty0pkgA6oeBpbTEyH45VocxrRGcCTGpBIJxiMpjBAJE6N/JqeM3LUQKXH0PMJM6AIYnOE68sWRsuzN2OCYFqqQbm8p/AmIZXT5cVKnUEmt1fvUAOnx/WG0XhH54TygMluerzc2u6zfsaSwZKDJem3rbK3HYE8KSwUVrUVZXhseMcxO/JI1v+0WnmvQnunJGl62td47s2elfcnbHd5hYBzMyemcxEzhVOmn7ckPMN4tXviTmXS5BWfl7ArRROkYgkiDaLzMoBt5lZVTgf32XkNHFdumYg5hH0n4ROF/7qlEgc72UGP2wjrWqkzdMYTmlBbZe+13ESUku5hfdsPTHgg1VZ68QC7+c+bpRSnDGRwNC8qUj+lxcOubllBax6zdEJFwwb5iIuR/b5aWzH4h5ST7TJZn0cJncTQjsRRFL7CidvUIsDuv6J8nvQXq3zav7bev+Ai2g8mv/19MmAAAAAElFTkSuQmCC",
|
37702 | e: 1
|
37703 | },
|
37704 | {
|
37705 | id: "image_2",
|
37706 | w: 25,
|
37707 | h: 114,
|
37708 | u: "",
|
37709 | p: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAByCAYAAACm2nr6AAAC0ElEQVRoQ92aWVYTQRSGb4UmBkKwFSecCGqCURTECScIDu/uQHZg78B2B1mCrEA9iiBjx3kWnKcH2QF545x0+noqgBol3Z2h/oeu99SX77tdb1eQwhOLjQ4TkSlUMFpa7qQFhUwiGpT31xWi62PxQoFNYr7y95+vC0TXb+qOHTaY6NpaZWqGFLszZYhofbn0VUNWusvLe7zmWjGk2N12bqwO1QtQ0eBld9sOy8/xqp+LKx58a+tdg1nIT7Jsdzewa65Y7N5louJQOyr9954mUX20N8QiQ7z8mGo9JSbFoToks5Q8prpAio+JIgYzGdV2d51JTB+Tj8nkGru7Qlr0ca41h9fvBQayAWGy8T4gFwTShjBpmwDk2gSBTAJMNgMgUQhky5T6XFEIZCvCZNs0IBcE0o4waZ8B5NoOgcwCTHYAIM0QyE5Lfa5mCGQXwmR3FpALAul4ADCBQOIIk/hDQK5OAKQJAtnzSH2uJghkL8Jk32NALggk8QRgAoEkESbJp4BcXQBIBALZ/0x9rggEkkKYHHgOyAWBHHwBMIFAuhEm3S8BuQ4FBbLu8Cv1uTCQntcAk97AQI68AeSCQPoQJn1vAbmOBgUSPjanPhcGcnweYHIiMJCT7wC5IJB+hEn/e0CuU0GBNJ7+oD4XBnLmI8DkbGAg5z4BckEgAwiTgc+qc42IxkFFEKZsQ4iGl6zUTxWQeRZk2FbKWl01EVr6S71y5QSxkbdScver5NQDkiPijE2RDFmdi2vu3GlDX6s2EUQjDeyYsrvrmo92vhoIZ4UTMvJWcs5rxae4DlcJRBAtOIKMwnTXLT+X/xn8hW9+cuUECzM/k5BbaxUfoXlBBF+37XDZofohCu1iORO+rWmOsTTuPlSfkO//5srKzVh7KvH7Mfm5yP3rurQMkUMlYjM/mfzvMdUB8mORBGfsiYRc6FNyBKVnNbKGbCW3r1z6C7QGPOO8hs2vAAAAAElFTkSuQmCC",
|
37710 | e: 1
|
37711 | },
|
37712 | {
|
37713 | id: "image_3",
|
37714 | w: 100,
|
37715 | h: 71,
|
37716 | u: "",
|
37717 | p: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABHCAYAAADx2uLMAAAIVklEQVR4Xu2czW7cVBTH/8cep9m1LEqpVJpECKSuKPvSjCqQIgQ0QiBVbDpvUL9BnTdw3yCRCqoEQglFEEQXGcEDkEU/1CJNhyJFYsXsosbjg66/Pf6647EzmYxnNZN4/HF/Pvd//uceD2nXHr8EKcbR71c20bymPgKkXXvMIBIn0mUmw/rjyt7Uz2qOT4C0a08YDo/gtaWqZBzuXXk5x+MytUsn7cMnHDu6C2dAIPO1cmhi74P/pnZ2c3jgOJAgUrw3hD4IxtFeoy/HdW+kAInMX/5bRpcVGNZeoy91gwmBJKMjfmxH+GlLhd3oS41URoCkRIc4OBEiQjOAwqZlL5rYW2n0pWI4LhCJ6Igpv7M9DYhJP9p7r/EvFUKJAAmEPDFVJWE4QNztCPtQbN161OhLFVxIu+6nvelA2DWN4cuNjpHPzp92WkNbb/zLZFg8IKWjI07K0X3esKyFRl9KcskBQuCR4HADIxte5BwGpEA/+q3Rl3G5kHb9qSsRicGPZVaR/6cBoZTvA2DaB0G3Hr3b1MckyWQAGYkOiSwsqTMRygp2WoqlH+429bEiLi6QKqMjDx5hw3rdavQlh0oKkCqiI8NgCvKEgU1k2L++YxbdLfP4f9JWPQ3xrz7uyj1tyB3gZAqcI/yBp2H0SeWOtdvoS8xVxICkwpDOrArhxbK2SOFyqKgd7K406y8it4oCkTaBDqM0w5gPL6X8EtwcpOCedUYxsD3f9bEQSJ3RIb/vARMM+5f51RcPyEQmUMqj5EVHPMtzhL9PTB1rd2Xu/IsLRP4Odh1knoMfNZmT7bs7ZJorfSFt9Rmniq1ciaTa6MjQJQLdsxYwF/pCWvsZF5TXkwXErOpvlQYziLRgp6I+Zlo/rRin2Z9Qq/0s5DFpiSQGxJ3aMrUjBV5u+SXcvg8F+vDhyvZpBJMCpAYTGNOVMYqT+dNmd2izjp9X/jxNYEIgpaIjH14QHbXum7Zs1dZPi38RGvKSgaXYWkeiHD+SWUkM8JhpbrnyS6gzAxBM+8elmdcXZ2hbN54aYNIBOpu1NpKc37OjY/KsTTLyRoVfQZ9s0ocPL8+svoRX3u6d0+i1ycDtmM+ouESSYgInjY7E9wncHSotHduXZk5fRnMdaO3nV1mxTYBW6zWBWfUwyeiQmDZB2LIxFP5lZgqXCSD+7db66GmbWNlk0FJYAQxq9O6bcdLcFAcvmeYG1YGSujQAsWnDNmdB+DOB+IOl3XihM7EQy7NFTQ6VGcwMeHJZW2Zpp09gY7h9+UQ39hUCccC0e+da6pEBwp30rpPaTOD40VGgeUToEsOwtt8+kYVLOSBeuCyuPV22rNYmCKvx6aaCDpW05jsnUtxTnDA6UhIH3rJZM7B98UTpy1hAQn150SbCpuNfvOpvDSWSyqMjRfMGAJu2bZ0YfSkFJNCXj593mBSRKrv+ZdQXZAh/pqeRKk5KlnaKziUeeX0GDPxwaer6MhGQQF8WLJ1Bd2W66DNhjJu1SRUnJVNo/9jOg0ls4Pvp6cvkQPwRXustqzwU/uVmPFoioRM9moSPKJnmFkdqqi6FJ0dEW3aLDDw4fn2pDog37q21F22bFZMI748Kf+nokIBXet85UxsBG7b1+lj1pXIg/sCoa391ABLNcGcTjl9igCuLjhTzmszacqe2AYN0fHfxWPSlNiAOmPXeudahrTPR3dJ3cC68Mdf3x8oIE/veZ5V0PLhYq3+pF0hUX1y3HylceoeepPwy2nAhCS/uacbM2hg7Hpha/MvxAAn0pdd2shincBlNk/33dZlATyiiS8qS8OLnGRF+BRv24WHl+nKsQAJ9+aTXgcj7SRjLeBYmrR1jLQuE089E0ZFcUhaNfWIaq0xfpgIk0BcLOjN0t3BZY3QUpLm5azRFBtOdNvcZXIm+TA9IVF9UxQDx7TqjQ3rfqbpUrDPe/nfggimtL9MH4uvLp702gwwGVsda3y+6g+uPjpHCpxhSuoczmoHNN8b+YYUTAyTQl8966+z4F29hrI4SSUFlOUvIs6a2DF0Sv3hh4Ju3xnow6cQB8QdD+bxvQOgLRQqXRX3FGfAqEfIgEvMywtSprQ9F6eD+eSn/cmKB+MKv2Iq4w247n2V/xMDdOL9zMjbA5QymtOMX503owhp2ivTlZAPxw2W9d1W1VZOjC2OSPqKS6Ji8/BJm94x7WMjWl9kA4l2Ouv73OrPQF5Zq7JNbNKszOlL27V7LACAD35xP6MtMAQn0Zb0v3H5GY19tJjD2bEzpyAtjRexP/GJfTF9mEkigL2iJ+tid3HYkyamtkswqY2qLMUj7ENGX2QUS6suySi2xvh809k1mAiNqX6V2FFLBPjStPftAfGO5/qptKyRqSkulpxNnNPJdeel9ZwKhPpgNfPumUw87NUCC6/3iH51E4XK0sS/DR1QyVSVGMlPMo1icjkq0Fsyooz99QMQlr/fOKapmMOhOfMD9T+UyqwqjYwvDYeqa/ekEEujLwTKponEcN4s7+qULiIW/WJE57wjxFulujms/3UB8MF++ahMpJlg0XowZHZMWJ51zEOmtreP+hcLnVuYDiA/mq4MOgb3GC++PEkIutiyerlJ1w9WJ+xekn+yaLyC+viws6Mxe40UUSLVp7hY0TR+3BD9/QPxouXWwTEM2QcWNfanRkWUCJYuIWVnw/AIJwbTJdtb3Ix39ZcovyTJIsRdMbtEACcF0xHMjwlgWlu7j0TEAoPvGrgyE6HcaINHREP5lcVE0jjuNF8VCjg0sxI1dA2TSEUj7/q2DZUAxAPYa+xIeZQe2PVEzQ6MhZcDdOmiDKNLYx12obOB+fe2kzZQlA+rrf0VjH6rSibxD/g+NG3LFW5dl+AAAAABJRU5ErkJggg==",
|
37718 | e: 1
|
37719 | },
|
37720 | {
|
37721 | id: "image_4",
|
37722 | w: 99,
|
37723 | h: 71,
|
37724 | u: "",
|
37725 | p: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGMAAABHCAYAAAATBvm1AAAIb0lEQVR4Xu1d0WrbVhj+/2PHFiRpdLFBLzbiiw0KW9eErZCOljqMDXrVvUH0BtMbVH0D5w3WJ+jKaAsrI/XKFmjYnLaD7KIX8RissF3YtCPGtXTGOZLsI/lIlmRZkWPpKol0bHG+c77v//7/l4JQHKc+A0v1Iw2QGHjqd7LAN1CuH9UB0ACE6wAIBRinsBiU+lHNBDCA4g51EUAGR3FkNwP1llqxKjoFogPCGv9iRKDOHRRgZATF0rUjDYAySlof7gFn9inaPxRgzBiM8tUXdQRiAOL14VfxWRd4ydkdBRgzAkPZOqqZJWoA0J3hknd2gP27M/XC7ijASBsMpgv9sqMLdM2zAxyNGHGSV7ULMFIEY2nruYaIBkVcD6OkoHMFGCmAoWy9qFMAgwJcd9nHFWUZJbEIyrM7fBKSwi0t3kcoW62aBSUDKDi6INIOgughvHQlivcIiWJnJFlDGy21UiE6AOiAaPuFoSaPJnq4OyTnhrtDOFeAEROMpcstDZEYAMwvuCD4aEeY1TG6EmfcR1cFGBHBUD5r1SkQgwJ1dMHrEyZ5CGkE5YJRaEY0FJSNVs0qAcuo7nhXuW8GJ3gImWDbfxvtqmJnBGGy0VIVYnnzSAAQh3bE/EaUcQUYEjCUjZZGkblnWB+Gpr48UhTaESOoKGJegCGAoWwccF0A7hfkXoBdnsRDRBlXgAEAXBcs00BEIY80jDmdNJI3dRFMO3IP4ca+Yd5jocFQN1pqzxroFHBUX/BlU0d05BXsSGIe03ssLBjKxacaIDL3vB5FXP3aIaWdEA8RRcwXDgzl44M6L/IAjueRIjrlsfxTzHFidU8EeWHAUC7s16BUYuI80gWBkiLRznC2JCkPSY0ibhBw5sHgutDv64igUwprYxPkhqw+AxanDpEWzZ1pMJQL+7YuADp+QXC8McVVltiblq783uNMgqFc2K8D9wtCHkmIVOPSR9SyaZSUR1AzghjERUvU5PwqpgvEAoMiyyOF+ISQc0nHhUdX0bzHmdgZam1P7VdYPxLqALgmr7aFJfYSeIiJYh7wfSH0OPdgKB/+zOvOzC+M5ZFyIMqeZih/isVb92jPLRjKB0/sfqRh3Vle4ImSoJMl/TIc1wWERv+Xi/PX+KzU9mukZLLi/46/EWyq1EVS2pk4Tlwk3voFANzpK6YOjzc7YnyRc2kG4LpAWD8S0wXmF3ycHEJJvJc1hCKy9h4I2LRoSX978NGhOPFzQVPLtZ80yv2CP4+UQJRjpi5Spqs2AOr9p598J1v9uQZjpfakToE6/Uj2rY6vcr+Rk9OCdHdk5z26gNjoP73EFlTgkUswlNpejVi8WXhHLq7ZeoipvAchd/pvLR0ObV2YGzC4LlhOPxLXBd8qd2yqdHekWYeYKMoR6BGgaZVAf3uw6dGFuQBj+f09jVL2SJWQR5ojURYWTpsi6v1fN6W6kGswVt7bq1sADQC8JKOk8V5VMX2dlK4EdvZHZb5ephhNBV1E2uj99mmoLuQSDOX8Xq1MoEERbialnaTjeCAQQIH2gpDTY9A4ininz0LuCLqQKzCYLgz6rB8Jb3lXXcgqzxFdeRYAYBMJ0XqHm8eTxDnK+UyjqeXzP2pAoAF0lMxzATnVVR7fe7SRUK13ePlxlEmOek0mYKycf1SnSBpAwdGFqF4gqYdIOs73/O94Y3IXCBgnzy83ok5wnOtmCgbXBcvkuuDNIwVTUtKYftbjEGG3Wl4yOlPqQuaaoap76qDC+5FujSKkCLE5BjjsCB5ihjTXBNPUen9cSUUXMgVj9d0fNArItvFavNSFELKGCPZ4tDOzcW0gltb7/UqqupAJGCvvPKqDRRtAmC7YE2SDkdQLZD3OZmwEYPUF4+Roaya6MFMwVPVhbcDEmeBNGSXF2x0jKktKO0nH8XsnuFutVmeqCzMBg+sC6bPagqALQdW2GazydL1HkyJkogupg7GqPmT1Ba4L0ijJl2jz0JUkCXeKCcE2JchAyEwXUgNjRX1YBwoNQDGPlDSmP9VxXfaep5OXn2euC1ODwXTBtBgIbh4pPu3kRswBdqtm3+gcb0+sL8QxbGlcG2r6VPWuavH3Izl+Ycp6QlJxTWccNqlJtN7x7P1CUmACwVhdva+Bndp2XlLlfIXwsqoxrvekn9NIeaTiIdq0BFrv5bVc6EIsmlpZ+Z71IzEuldcXZB5CKspyKsuOrkiXvc/j5PhqrnQhEhhcFwYWu3HbL4iHP7/v/J6qh0i6qySpEkTcXYJBLnUhFAyuCwOmC45fkF0d4KKzW+XRqnuI0DTR0nrH2zPPIyXVhVAwVlfvH/M+1UnHWNOYJOURRlez9B6UtEnZ1N4cb+deFybujMGgwvo8v5mER5Bgx6arpDQ3Pq5LCTVO/tyeG12Ioxnf8kbioCNlupqG5gBhd6kMc6cLkcBwLxqLpiaJedbeA7FpmqD1Xs2nLsQCw72Y+wyW+uD5J+EY2x3eF+Wm4z2k5c82llB789d860IiMNigwEhrWjEfWpBIdQ9eX/jv7y/OhC4kBsMdyD2ISQ2g1O595ZOZhsMefY4sCEDE22WFNPKYR5oY7CS4IFZDgqMnoU8LTSPKblMBAtwbkJJ+FnVh6p3h/wAnb+W8p8/7xsqxcmss74HPsET1N6++nGu/kGBT2GSTdOBQT1B8kiicdrwPtntorsveYPD6n69YaL2wR2IwRnpyVzXNKhNXz7tdI9MV0tvlQaXR6eSvvpD1qpgaDPeGl5fvb5Aysq5B/l9SRnQV0ERM4V6ZWnqnc2Mu80izACo1MEb+5MHX7FFa9pyF+086fJHXM2C68O+NhdSF1AU8yqo4d+6Bzh6KpKMnU7sIVH/dubHQunAqYLimcWBVDSDYKYNS6MKEVfw/MM9906el5gwAAAAASUVORK5CYII=",
|
37726 | e: 1
|
37727 | },
|
37728 | {
|
37729 | id: "image_5",
|
37730 | w: 25,
|
37731 | h: 99,
|
37732 | u: "",
|
37733 | p: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAABjCAYAAABuUKvEAAACn0lEQVRoQ93aSXLaUBAG4G5BhkUkwGCDReZ5TohtEmce7diYRW6QI3AE5QbKDcQNqHLZIbOVeXJVfANTFVIsJdsrV9BLmSEVTBSEpdeLpy3iffX3r7drlOW5ZQDQVldzBnB6UN41x1pnmwwcbW0tvxC09TfSPBuxGAqhZllTGwkDebqR1rEI8EgKr+uW9cDyK7kirYNtQCj47asX0g6xxMApbLUvr0gbM0Nh6WG/ffWLNDAG8DgcXte89oWy/OcT7rdfG5FpKyszeq8/oqzMt+9Jr3fdfq8A2/g4pktuL6DiH2ldLzARWcGyct83Y6hEfCfpPJNBUZI6LzMq0YCRJmkDMF2C5mVGJfbEbyf/67LCGGi8kWZfygDXJC0kToBE4mWenTSTRBIUyCAFMvSUYFwkSJIiSYoAiaae8e8kOkyBqBRImgR5TtDJbgIktkcYZO8L/p3E9lEg+4VBDrzk38nAQWGQQ68IxnWYAjkiChI/+pp/J/FjwiDHKZKcWCDo5KQoSOIUQZLEaZN/JzTIGYokZymQc2/4dzJIgpynSJIhQd4SdHKBAhmhQEbf8R/XEAkyRpEkS4K8J+jkIgVyiQBJjpMgH/h3krxMgVwRBrn6kaCTawRI6rowyI1P/DtJ3RQGufWZ/7iGb1Mgd4RB7n4h6OSeMMgE1yQmk1BDdfJr0J3YgKzkQF2rlccbaymo3g8MqQCAsX1nWF8uZTrWUAJAcAnB0avlrOuaEKpTW03CihJD40d5rOdaEKrT3/rpxEYAo+6E9Fo543kNyCtSYYj6jm2SsXneXrY3UM25J0GGJgsx/efsqOsmhyckPfMPBKEIdUevzme7Nje8HNq17ZHOL7Y7sRFB/yVJRq3kfd5eUEznFxubatXZEW6bar8B4RdHqI6Phb0AAAAASUVORK5CYII=",
|
37734 | e: 1
|
37735 | },
|
37736 | {
|
37737 | id: "image_6",
|
37738 | w: 99,
|
37739 | h: 68,
|
37740 | u: "",
|
37741 | p: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGMAAABECAYAAACVkosbAAAIyElEQVR4Xu1cQW8bRRj9vnFCc0uOVVOoUxJoBSjJL6iPUdWqFggkKqRYiANIoK4QQhWXbgEJBBy2gkMPCDkCLkVI5R+QE1JLZdqKplJSed2Ke32DJN5Bs7szO7s76521147trC+pms2sPW/e9973ZrwIA3odrTbKU+DUANEAgKdI0Hjy6+rNAd1uIobFvD/FfLWxAkANBFh3x3bvgP5P2KQlMP75ZfWvvO87CePlBsb8+TuMBTVAOCPmno+O/j/4D4SN0j4Y9s3Vp5MwiXl9hr7AKFcbc3sdpwYEWCk6wZc/n/sIK/ivOVvahFDr8Y1VM68PM+7j9AQG04PSvmMAAmPCrFeOgtXPK1P0/+WyxS+nBFpIqfHkRqEnmcA4fu52BSgalOCFYGLDupAOhAecuDH/B8FNp+Mcaj3RAmP+LNMDypiwLImxVHZ6Y4VAJCzyG6UZx7Drh09PEsFgerC7u28wUUamB+EJi9b/AKME0eYTjxExTxi3jQTMxz8vW+OuA1nefwyMo2t/lAlOm4CBNfVwCDuiYFV7/68p2pHr1OMG96MtQkjN/umV37N8qHG9VoBxfO12hSKYFNC1plwTAg0QvcKgypMYN8oeRNjEqU7Nrq/a4zrROu8b59du1SggY8IJlfvxVrwKCNHRDYgV3BhIBoHANUL2zUnVEzy2dpv5fCbOs9FJHwVWRMshILQJRdP+8eWJ0xN3vl2x/m/PAiRShMF1oAsr+K9SRFtpZRUalKxN4ffg366FBGp2fXL0JCTg82dvrQCULIr0zLBZoWMSwjGLWAmbCKRm10+PvZ4ore2x839WkYIFgL6lVdRvTVZoWlnf4UoMiIeMXbUJkV4FZ98aZz3p2vQdP3fHpOjmTrPdrWyS9cWMVjYKelLMklg62whg2D+8VNdxL6N2TWoH7oaBDrUA6Hqv+VNCp51oZRWiLXrDkMkIDJ1odHwpugvoGPb346UnqWDw1ePuUzBQEM4MpsFTl8Is/U74fbms+g1KaNjXx0NPtMHgoByrNqoEXFCUfQlfwvGJUfcrak3JXJ5S4hh6FXZ3R15PMoPBQTn+6h0TgET0hHfuilS2Xyub2Hyq4hilhrXZFrB9/fTI6knPYPD+pINgURLeYtVhRe9WNl7OFOVJxDly1O+z8C5lIn/99MjlXX2BIfTk9caKZ4WZnqgCxbj7EWDI7yCy+tO1SZsV4HJVytwAYINSMEdJT3IBg4Py7GuNKiVoBZF7Wirbt5XVss5eqqxcJG0k1HKmZizbWjjw/fhcweCgPPdGg6W/yrwreWI0RDvZykZPoYRYoGBFdEugRQk17W8PVk8GAobQkxliAYX1eCSfXsp04hg9rVA1nnFnx+7nRvWUmjvfHYyeDAwMoScXGyvEIW5/0hcrQvXeq/8BYIpyKOa7+z5MuI/xbkIRNihxTNsabn8ycDCEnrx5r4puf4J+f8JtsHqVJm/z9iXaynKW4OzagGA58MzQ9GRoYAg9uXjX9I98xvIudSrbt5VV7teHGOFRVmGHGatoi+Vdj6wXB340dehguHpSa8w5eyVWutblrGnAVjYLK3xgQizcJBSMbeuFgR1NPRAwOEvKF/9eoSXHohA9Epq8oaUn2olWNuKyYmeBNfb3YaPTmTYGYYUPFAyhJ2/dqxKCft6lKhdBGUlnD5vP7KKdlCwn3K+NCNbON0u5Hk0dCTAEU2r3TUqJAUj9I6NB1iWXdVXEHsQe+lY27fiRhoa1mP49+moxFz0ZKTC4ngBMs02tS/IED9LKZmRFqJT59noTqWNsf92fnowcGAFLtsoUnXrQn8hWOClm6X54QtVTRPKq6CZV187eLYhS/4MIG3szJcM2e4tWRhYMAco79ytACYu9pf14ta7ohJTiA6cEmuna5G8ThMNHBibrT8ydL57PfJRo5MEQoLz9wABCmWDOqmq9WrSTGsr+TUKUFR7rQuO2oOTUdj5f0o7qxwYMoSfTRxggl6LlRZsVPEOJr2iOuzenAYWi0XvwlYakMeTSBbhZcrD28MuF1KNEYwWGYMm7W2VwKCtd/lfWBm5lY128Tr8Tjlnotb0pYnbTk7EEQwKlAg7UkfD9+LS8q3t50rCyLmViQCScRVaUzjZFNHc+W1DqyViDIUB574GB1D28HftKW7qDCljVh2jHcq1uGoYILYdAbcdcCOnJRIDh6onRmCP/HjEpwUvqA9xDEW0p2k8IHn1PwX4QApsIUHtoenoyMWDIeoJTWAcq5V1xpxPrH4bFiuAbXHK6QK/uArDt6sl8ld/fqiBg3duPHxFWhFxWLKRkR1Mn+3Xyg4cGeF8GUuZdgjT5WVmFFQ73OwELw4tk4sHw9KQ5R5w9E4BK/Yn30dPLkzeR2a1smrOLNKSTqBndeF42tsolwDoF4u7HZ7ayQmXVGZhOdJ/EiokUcJ2iu2hsVxxw6hjaj1c3jrxh5+CF6BTutHsuT/w9H4oylQTQyQ+3DQSWd6G0Hx8uL32XJ2nJd2PFoWWGDA7TkxJ2TCBU2j/xxGSYrCjAkFBx9WRqSuRdwxJteWEc6jKlKl+LH21XKPL+RC5ZvW9opZWnQjNSlH7x40cGMD3pM+9KdGyK+xfM6AKKqydHOiYCxvZPvElOj+51WVFoho4PBoBTl5vlffdoKhXP2dLZWcwCRAGGJhj8ssXL2xUoEQspLMfyLrmd5ymH6EMi2VjCfYsylREQdvnSJ032MDS2QRTpT1R7I3pAFMzoAQj+J2WzOffMvmNQwCuqE/NBjxJ56kOXexbM6AMQ9qenzGbZ6VCLAl5Q71XoJ4AFGH2CIfTEbFbQAXZeeLkXVhRlKicg5GGWzCZ7piN7CE54/0TjXgUzNCYp6yWunrgPVMMrWf62ACPLbGW81tUTJOwhOF5/kvIqwEiboRx+f8psVhxEZoWXuw1XgJHDZOsOsfRps4bUBcXTk8irAEN3JnO6ztUT94FqcT0pwMhpkrMOo9KTAoyss5jz9bKeFGDkPLm9Dsf05H+6Q8nQwzMmWgAAAABJRU5ErkJggg==",
|
37742 | e: 1
|
37743 | },
|
37744 | {
|
37745 | id: "image_7",
|
37746 | w: 49,
|
37747 | h: 53,
|
37748 | u: "",
|
37749 | p: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADEAAAA1CAYAAADoDQMKAAAE2ElEQVRoQ9WZXWscVRjH/2c2aRbSmlGo1BuzxQtfbkwFwdKLbEBEvDEXXigWut8g8w2cfoPJN9hCEe9ML1oFhTYUqVc2wQuFIklA0dqbXRTcbGaeR87svO+8nJmdbSYDIbnYl/N7zv/5P/9zInCGnwsX7m0CbImzyLC8fHdNE7AArMv1nykIXf9ad5wlC8w3osU/MxAvnL9rMmAAWEmqp/EQvu7BWM2SfmMhdP2bjmNT39d9Xu82DkLq3qYlUxBvqZpOoyCWX/rWEAQJsAImgNUwGgFx/tJ3XWGjz8yrIIYEEPK3/FF4ThWifel+pyW4D+Z1uWBBNFk4y789CC4GORUIvXNfPyHNZOItd7FSOi5EZOFRqILdeO4Q7dd+6GnEFohW3KoTQchqewCZUDkgzw2i/cajrnBggentmHRkxQMIb0diUJ7EThOivfaoI8aaxcQfT6rsVd+XTtAD3mLToPz3ZYDMbyfWHutt2AYcfOFLJVU6spmjjZx0J79Xcix3LhDtdx73mFkGNVf3geskqpzZyDGohMRSdqNWiPZ7P3eJqA/iVWXppEnM64lU+BTLrQWi3f2l44ypL5hcvw+qn3SdNOmouFPBAJwNonugL+I/Ew62wiGV3qCZ0lF1p5wBWBli8f0nBhOZIF4JFxiJC2muM6s7ZQzA0hALHz7psiP6Al7OScSFcPJOu46rcRWJRbNT1J1iAzGMI+oQHx2stSCHlZdzPL8PeiAysFSlM/26yQyZsty0vpGv855iiM0DXUPLAvGNeL6JSycaF4LXqQy2su7khcTA/YouCrRP/pAhzRCe3yeTZkw6sQb1ZoOKdKq4U2IApu/EZ083BZGsvpvvJ9km4jq51QtfG81EmdJJwCtP9Qh8HOL6sy7A0nHWgy/NiwHJRpMfnJeJZpXO9PTfZwfGBOLTPztotUwA4X1O1iHF12QyaSpIpw538oo0FA6MfwYfyIsECFx/aoLF9H1OMPr95JmdgULJRaZ1UHX/sJMTs6PfVeBOgujmwnjBGgw2BqE7ff539vkvy6PTJKbSNwWxO8+aNfAd24Yx+mvjcPryLA/Cr1DaIaWgejVKZ19zHOPf3zceZF+e5UHId+UdUsr2TZrEkmeJ0HWGzDBGv11zdZ9/eVYEIcWmGgMS7lTOmqPBkbaXjo/NwWGo+9kg5LvzDin+blR1p/hNxy4cpzf69eqU7meH8GUVHXgqh/tk32RP9SMB6o323s3UfT0QsQUlbulUp/q0Ow0FsXn80xX5D5PKj0BRT0Q/ulTsDi/F0oIjE7ZPjm0Te1cCv69KUQ4ibwCq9M1kJ3ZbttYb/fhmKd3XIyf/U/IOKTnuJIiPhEPG+OFbO1UrXn1OJN8pLTcnPqdIZwgmy/7+dZnN5vKUk1N0N5TcCbeckTDw4PLMuq9XTu7cSBmAkewkiHc1YuPk3uW9uZQ+8aHVdmJqAAaWeySYDWfn1dp1X/9OxJrcjQtDwWyRPbawM1/ppMFU3wlvN0C4BZCJr16pzTLLSrA6hMAuIEzcvlgpKpRdaM1yEkdgNvHly4URuc6F1gch+CYWzlnovzhXyywLrygncQeObZym7mfZiX0IYTRB91UghmAYTdJ9OQjGNs4tmk3TvRqEtEzb6TVV9wUQzw4h0Gu67vMg/gcsd5WVtPOCsgAAAABJRU5ErkJggg==",
|
37750 | e: 1
|
37751 | }
|
37752 | ];
|
37753 | var layers = [
|
37754 | {
|
37755 | ddd: 1,
|
37756 | ind: 1,
|
37757 | ty: 2,
|
37758 | nm: "qube-icon-08.ai",
|
37759 | cl: "ai",
|
37760 | parent: 2,
|
37761 | refId: "image_0",
|
37762 | sr: 1,
|
37763 | ks: {
|
37764 | o: {
|
37765 | a: 1,
|
37766 | k: [
|
37767 | {
|
37768 | i: {
|
37769 | x: [
|
37770 | 0.833
|
37771 | ],
|
37772 | y: [
|
37773 | 0.833
|
37774 | ]
|
37775 | },
|
37776 | o: {
|
37777 | x: [
|
37778 | 0.167
|
37779 | ],
|
37780 | y: [
|
37781 | 0.167
|
37782 | ]
|
37783 | },
|
37784 | n: [
|
37785 | "0p833_0p833_0p167_0p167"
|
37786 | ],
|
37787 | t: 105,
|
37788 | s: [
|
37789 | 0
|
37790 | ],
|
37791 | e: [
|
37792 | 100
|
37793 | ]
|
37794 | },
|
37795 | {
|
37796 | i: {
|
37797 | x: [
|
37798 | 0.833
|
37799 | ],
|
37800 | y: [
|
37801 | 0.833
|
37802 | ]
|
37803 | },
|
37804 | o: {
|
37805 | x: [
|
37806 | 0.167
|
37807 | ],
|
37808 | y: [
|
37809 | 0.167
|
37810 | ]
|
37811 | },
|
37812 | n: [
|
37813 | "0p833_0p833_0p167_0p167"
|
37814 | ],
|
37815 | t: 119,
|
37816 | s: [
|
37817 | 100
|
37818 | ],
|
37819 | e: [
|
37820 | 100
|
37821 | ]
|
37822 | },
|
37823 | {
|
37824 | i: {
|
37825 | x: [
|
37826 | 0.833
|
37827 | ],
|
37828 | y: [
|
37829 | 0.833
|
37830 | ]
|
37831 | },
|
37832 | o: {
|
37833 | x: [
|
37834 | 0.167
|
37835 | ],
|
37836 | y: [
|
37837 | 0.167
|
37838 | ]
|
37839 | },
|
37840 | n: [
|
37841 | "0p833_0p833_0p167_0p167"
|
37842 | ],
|
37843 | t: 120,
|
37844 | s: [
|
37845 | 100
|
37846 | ],
|
37847 | e: [
|
37848 | 0
|
37849 | ]
|
37850 | },
|
37851 | {
|
37852 | t: 135
|
37853 | }
|
37854 | ],
|
37855 | ix: 11
|
37856 | },
|
37857 | rx: {
|
37858 | a: 1,
|
37859 | k: [
|
37860 | {
|
37861 | i: {
|
37862 | x: [
|
37863 | 0.833
|
37864 | ],
|
37865 | y: [
|
37866 | 0.833
|
37867 | ]
|
37868 | },
|
37869 | o: {
|
37870 | x: [
|
37871 | 0.167
|
37872 | ],
|
37873 | y: [
|
37874 | 0.167
|
37875 | ]
|
37876 | },
|
37877 | n: [
|
37878 | "0p833_0p833_0p167_0p167"
|
37879 | ],
|
37880 | t: 105,
|
37881 | s: [
|
37882 | 161
|
37883 | ],
|
37884 | e: [
|
37885 | 0
|
37886 | ]
|
37887 | },
|
37888 | {
|
37889 | i: {
|
37890 | x: [
|
37891 | 0.833
|
37892 | ],
|
37893 | y: [
|
37894 | 0.833
|
37895 | ]
|
37896 | },
|
37897 | o: {
|
37898 | x: [
|
37899 | 0.167
|
37900 | ],
|
37901 | y: [
|
37902 | 0.167
|
37903 | ]
|
37904 | },
|
37905 | n: [
|
37906 | "0p833_0p833_0p167_0p167"
|
37907 | ],
|
37908 | t: 119,
|
37909 | s: [
|
37910 | 0
|
37911 | ],
|
37912 | e: [
|
37913 | 0
|
37914 | ]
|
37915 | },
|
37916 | {
|
37917 | i: {
|
37918 | x: [
|
37919 | 0.833
|
37920 | ],
|
37921 | y: [
|
37922 | 0.833
|
37923 | ]
|
37924 | },
|
37925 | o: {
|
37926 | x: [
|
37927 | 0.167
|
37928 | ],
|
37929 | y: [
|
37930 | 0.167
|
37931 | ]
|
37932 | },
|
37933 | n: [
|
37934 | "0p833_0p833_0p167_0p167"
|
37935 | ],
|
37936 | t: 120,
|
37937 | s: [
|
37938 | 0
|
37939 | ],
|
37940 | e: [
|
37941 | 161
|
37942 | ]
|
37943 | },
|
37944 | {
|
37945 | t: 135
|
37946 | }
|
37947 | ],
|
37948 | ix: 8
|
37949 | },
|
37950 | ry: {
|
37951 | a: 1,
|
37952 | k: [
|
37953 | {
|
37954 | i: {
|
37955 | x: [
|
37956 | 0.833
|
37957 | ],
|
37958 | y: [
|
37959 | 0.833
|
37960 | ]
|
37961 | },
|
37962 | o: {
|
37963 | x: [
|
37964 | 0.167
|
37965 | ],
|
37966 | y: [
|
37967 | 0.167
|
37968 | ]
|
37969 | },
|
37970 | n: [
|
37971 | "0p833_0p833_0p167_0p167"
|
37972 | ],
|
37973 | t: 105,
|
37974 | s: [
|
37975 | -30
|
37976 | ],
|
37977 | e: [
|
37978 | 0
|
37979 | ]
|
37980 | },
|
37981 | {
|
37982 | i: {
|
37983 | x: [
|
37984 | 0.833
|
37985 | ],
|
37986 | y: [
|
37987 | 0.833
|
37988 | ]
|
37989 | },
|
37990 | o: {
|
37991 | x: [
|
37992 | 0.167
|
37993 | ],
|
37994 | y: [
|
37995 | 0.167
|
37996 | ]
|
37997 | },
|
37998 | n: [
|
37999 | "0p833_0p833_0p167_0p167"
|
38000 | ],
|
38001 | t: 119,
|
38002 | s: [
|
38003 | 0
|
38004 | ],
|
38005 | e: [
|
38006 | 0
|
38007 | ]
|
38008 | },
|
38009 | {
|
38010 | i: {
|
38011 | x: [
|
38012 | 0.833
|
38013 | ],
|
38014 | y: [
|
38015 | 0.833
|
38016 | ]
|
38017 | },
|
38018 | o: {
|
38019 | x: [
|
38020 | 0.167
|
38021 | ],
|
38022 | y: [
|
38023 | 0.167
|
38024 | ]
|
38025 | },
|
38026 | n: [
|
38027 | "0p833_0p833_0p167_0p167"
|
38028 | ],
|
38029 | t: 120,
|
38030 | s: [
|
38031 | 0
|
38032 | ],
|
38033 | e: [
|
38034 | -30
|
38035 | ]
|
38036 | },
|
38037 | {
|
38038 | t: 135
|
38039 | }
|
38040 | ],
|
38041 | ix: 9
|
38042 | },
|
38043 | rz: {
|
38044 | a: 1,
|
38045 | k: [
|
38046 | {
|
38047 | i: {
|
38048 | x: [
|
38049 | 0.833
|
38050 | ],
|
38051 | y: [
|
38052 | 0.833
|
38053 | ]
|
38054 | },
|
38055 | o: {
|
38056 | x: [
|
38057 | 0.167
|
38058 | ],
|
38059 | y: [
|
38060 | 0.167
|
38061 | ]
|
38062 | },
|
38063 | n: [
|
38064 | "0p833_0p833_0p167_0p167"
|
38065 | ],
|
38066 | t: 105,
|
38067 | s: [
|
38068 | 55
|
38069 | ],
|
38070 | e: [
|
38071 | 0
|
38072 | ]
|
38073 | },
|
38074 | {
|
38075 | i: {
|
38076 | x: [
|
38077 | 0.833
|
38078 | ],
|
38079 | y: [
|
38080 | 0.833
|
38081 | ]
|
38082 | },
|
38083 | o: {
|
38084 | x: [
|
38085 | 0.167
|
38086 | ],
|
38087 | y: [
|
38088 | 0.167
|
38089 | ]
|
38090 | },
|
38091 | n: [
|
38092 | "0p833_0p833_0p167_0p167"
|
38093 | ],
|
38094 | t: 119,
|
38095 | s: [
|
38096 | 0
|
38097 | ],
|
38098 | e: [
|
38099 | 0
|
38100 | ]
|
38101 | },
|
38102 | {
|
38103 | i: {
|
38104 | x: [
|
38105 | 0.833
|
38106 | ],
|
38107 | y: [
|
38108 | 0.833
|
38109 | ]
|
38110 | },
|
38111 | o: {
|
38112 | x: [
|
38113 | 0.167
|
38114 | ],
|
38115 | y: [
|
38116 | 0.167
|
38117 | ]
|
38118 | },
|
38119 | n: [
|
38120 | "0p833_0p833_0p167_0p167"
|
38121 | ],
|
38122 | t: 120,
|
38123 | s: [
|
38124 | 0
|
38125 | ],
|
38126 | e: [
|
38127 | 55
|
38128 | ]
|
38129 | },
|
38130 | {
|
38131 | t: 135
|
38132 | }
|
38133 | ],
|
38134 | ix: 10
|
38135 | },
|
38136 | or: {
|
38137 | a: 0,
|
38138 | k: [
|
38139 | 0,
|
38140 | 0,
|
38141 | 0
|
38142 | ],
|
38143 | ix: 7
|
38144 | },
|
38145 | p: {
|
38146 | a: 0,
|
38147 | k: [
|
38148 | 25.583,
|
38149 | 28.396,
|
38150 | 2.282
|
38151 | ],
|
38152 | ix: 2
|
38153 | },
|
38154 | a: {
|
38155 | a: 0,
|
38156 | k: [
|
38157 | 0,
|
38158 | 13.937,
|
38159 | 0
|
38160 | ],
|
38161 | ix: 1
|
38162 | },
|
38163 | s: {
|
38164 | a: 0,
|
38165 | k: [
|
38166 | 100,
|
38167 | 100,
|
38168 | 100
|
38169 | ],
|
38170 | ix: 6
|
38171 | }
|
38172 | },
|
38173 | ao: 0,
|
38174 | ip: 105,
|
38175 | op: 135,
|
38176 | st: 55,
|
38177 | bm: 0
|
38178 | },
|
38179 | {
|
38180 | ddd: 1,
|
38181 | ind: 2,
|
38182 | ty: 2,
|
38183 | nm: "qube-icon-07.ai",
|
38184 | cl: "ai",
|
38185 | parent: 3,
|
38186 | refId: "image_1",
|
38187 | sr: 1,
|
38188 | ks: {
|
38189 | o: {
|
38190 | a: 1,
|
38191 | k: [
|
38192 | {
|
38193 | i: {
|
38194 | x: [
|
38195 | 0.833
|
38196 | ],
|
38197 | y: [
|
38198 | 0.833
|
38199 | ]
|
38200 | },
|
38201 | o: {
|
38202 | x: [
|
38203 | 0.167
|
38204 | ],
|
38205 | y: [
|
38206 | 0.167
|
38207 | ]
|
38208 | },
|
38209 | n: [
|
38210 | "0p833_0p833_0p167_0p167"
|
38211 | ],
|
38212 | t: 89.999,
|
38213 | s: [
|
38214 | 0
|
38215 | ],
|
38216 | e: [
|
38217 | 100
|
38218 | ]
|
38219 | },
|
38220 | {
|
38221 | i: {
|
38222 | x: [
|
38223 | 0.833
|
38224 | ],
|
38225 | y: [
|
38226 | 0.833
|
38227 | ]
|
38228 | },
|
38229 | o: {
|
38230 | x: [
|
38231 | 0.167
|
38232 | ],
|
38233 | y: [
|
38234 | 0.167
|
38235 | ]
|
38236 | },
|
38237 | n: [
|
38238 | "0p833_0p833_0p167_0p167"
|
38239 | ],
|
38240 | t: 104.999,
|
38241 | s: [
|
38242 | 100
|
38243 | ],
|
38244 | e: [
|
38245 | 100
|
38246 | ]
|
38247 | },
|
38248 | {
|
38249 | i: {
|
38250 | x: [
|
38251 | 0.833
|
38252 | ],
|
38253 | y: [
|
38254 | 0.833
|
38255 | ]
|
38256 | },
|
38257 | o: {
|
38258 | x: [
|
38259 | 0.167
|
38260 | ],
|
38261 | y: [
|
38262 | 0.167
|
38263 | ]
|
38264 | },
|
38265 | n: [
|
38266 | "0p833_0p833_0p167_0p167"
|
38267 | ],
|
38268 | t: 134.999,
|
38269 | s: [
|
38270 | 100
|
38271 | ],
|
38272 | e: [
|
38273 | 0
|
38274 | ]
|
38275 | },
|
38276 | {
|
38277 | t: 149.99921875
|
38278 | }
|
38279 | ],
|
38280 | ix: 11
|
38281 | },
|
38282 | rx: {
|
38283 | a: 1,
|
38284 | k: [
|
38285 | {
|
38286 | i: {
|
38287 | x: [
|
38288 | 0.833
|
38289 | ],
|
38290 | y: [
|
38291 | 0.833
|
38292 | ]
|
38293 | },
|
38294 | o: {
|
38295 | x: [
|
38296 | 0.167
|
38297 | ],
|
38298 | y: [
|
38299 | 0.167
|
38300 | ]
|
38301 | },
|
38302 | n: [
|
38303 | "0p833_0p833_0p167_0p167"
|
38304 | ],
|
38305 | t: 89.999,
|
38306 | s: [
|
38307 | 174
|
38308 | ],
|
38309 | e: [
|
38310 | 0
|
38311 | ]
|
38312 | },
|
38313 | {
|
38314 | i: {
|
38315 | x: [
|
38316 | 0.833
|
38317 | ],
|
38318 | y: [
|
38319 | 0.833
|
38320 | ]
|
38321 | },
|
38322 | o: {
|
38323 | x: [
|
38324 | 0.167
|
38325 | ],
|
38326 | y: [
|
38327 | 0.167
|
38328 | ]
|
38329 | },
|
38330 | n: [
|
38331 | "0p833_0p833_0p167_0p167"
|
38332 | ],
|
38333 | t: 104.999,
|
38334 | s: [
|
38335 | 0
|
38336 | ],
|
38337 | e: [
|
38338 | 0
|
38339 | ]
|
38340 | },
|
38341 | {
|
38342 | i: {
|
38343 | x: [
|
38344 | 0.833
|
38345 | ],
|
38346 | y: [
|
38347 | 0.833
|
38348 | ]
|
38349 | },
|
38350 | o: {
|
38351 | x: [
|
38352 | 0.167
|
38353 | ],
|
38354 | y: [
|
38355 | 0.167
|
38356 | ]
|
38357 | },
|
38358 | n: [
|
38359 | "0p833_0p833_0p167_0p167"
|
38360 | ],
|
38361 | t: 134.999,
|
38362 | s: [
|
38363 | 0
|
38364 | ],
|
38365 | e: [
|
38366 | 174
|
38367 | ]
|
38368 | },
|
38369 | {
|
38370 | t: 149.99921875
|
38371 | }
|
38372 | ],
|
38373 | ix: 8
|
38374 | },
|
38375 | ry: {
|
38376 | a: 0,
|
38377 | k: 0,
|
38378 | ix: 9
|
38379 | },
|
38380 | rz: {
|
38381 | a: 1,
|
38382 | k: [
|
38383 | {
|
38384 | i: {
|
38385 | x: [
|
38386 | 0.833
|
38387 | ],
|
38388 | y: [
|
38389 | 0.833
|
38390 | ]
|
38391 | },
|
38392 | o: {
|
38393 | x: [
|
38394 | 0.167
|
38395 | ],
|
38396 | y: [
|
38397 | 0.167
|
38398 | ]
|
38399 | },
|
38400 | n: [
|
38401 | "0p833_0p833_0p167_0p167"
|
38402 | ],
|
38403 | t: 89.999,
|
38404 | s: [
|
38405 | 62
|
38406 | ],
|
38407 | e: [
|
38408 | 0
|
38409 | ]
|
38410 | },
|
38411 | {
|
38412 | i: {
|
38413 | x: [
|
38414 | 0.833
|
38415 | ],
|
38416 | y: [
|
38417 | 0.833
|
38418 | ]
|
38419 | },
|
38420 | o: {
|
38421 | x: [
|
38422 | 0.167
|
38423 | ],
|
38424 | y: [
|
38425 | 0.167
|
38426 | ]
|
38427 | },
|
38428 | n: [
|
38429 | "0p833_0p833_0p167_0p167"
|
38430 | ],
|
38431 | t: 104.999,
|
38432 | s: [
|
38433 | 0
|
38434 | ],
|
38435 | e: [
|
38436 | 0
|
38437 | ]
|
38438 | },
|
38439 | {
|
38440 | i: {
|
38441 | x: [
|
38442 | 0.833
|
38443 | ],
|
38444 | y: [
|
38445 | 0.833
|
38446 | ]
|
38447 | },
|
38448 | o: {
|
38449 | x: [
|
38450 | 0.167
|
38451 | ],
|
38452 | y: [
|
38453 | 0.167
|
38454 | ]
|
38455 | },
|
38456 | n: [
|
38457 | "0p833_0p833_0p167_0p167"
|
38458 | ],
|
38459 | t: 134.999,
|
38460 | s: [
|
38461 | 0
|
38462 | ],
|
38463 | e: [
|
38464 | 62
|
38465 | ]
|
38466 | },
|
38467 | {
|
38468 | t: 149.99921875
|
38469 | }
|
38470 | ],
|
38471 | ix: 10
|
38472 | },
|
38473 | or: {
|
38474 | a: 0,
|
38475 | k: [
|
38476 | 0,
|
38477 | 0,
|
38478 | 0
|
38479 | ],
|
38480 | ix: 7
|
38481 | },
|
38482 | p: {
|
38483 | a: 0,
|
38484 | k: [
|
38485 | 12.625,
|
38486 | 106.25,
|
38487 | 0
|
38488 | ],
|
38489 | ix: 2
|
38490 | },
|
38491 | a: {
|
38492 | a: 0,
|
38493 | k: [
|
38494 | 12.75,
|
38495 | 6.938,
|
38496 | 0
|
38497 | ],
|
38498 | ix: 1
|
38499 | },
|
38500 | s: {
|
38501 | a: 0,
|
38502 | k: [
|
38503 | 100,
|
38504 | 100,
|
38505 | 100
|
38506 | ],
|
38507 | ix: 6
|
38508 | }
|
38509 | },
|
38510 | ao: 0,
|
38511 | ip: 90,
|
38512 | op: 150,
|
38513 | st: 100.8,
|
38514 | bm: 0
|
38515 | },
|
38516 | {
|
38517 | ddd: 1,
|
38518 | ind: 3,
|
38519 | ty: 2,
|
38520 | nm: "qube-icon-06.ai",
|
38521 | cl: "ai",
|
38522 | parent: 4,
|
38523 | refId: "image_2",
|
38524 | sr: 1,
|
38525 | ks: {
|
38526 | o: {
|
38527 | a: 1,
|
38528 | k: [
|
38529 | {
|
38530 | i: {
|
38531 | x: [
|
38532 | 0.833
|
38533 | ],
|
38534 | y: [
|
38535 | 0.833
|
38536 | ]
|
38537 | },
|
38538 | o: {
|
38539 | x: [
|
38540 | 0.167
|
38541 | ],
|
38542 | y: [
|
38543 | 0.167
|
38544 | ]
|
38545 | },
|
38546 | n: [
|
38547 | "0p833_0p833_0p167_0p167"
|
38548 | ],
|
38549 | t: 75,
|
38550 | s: [
|
38551 | 0
|
38552 | ],
|
38553 | e: [
|
38554 | 100
|
38555 | ]
|
38556 | },
|
38557 | {
|
38558 | i: {
|
38559 | x: [
|
38560 | 0.833
|
38561 | ],
|
38562 | y: [
|
38563 | 0.833
|
38564 | ]
|
38565 | },
|
38566 | o: {
|
38567 | x: [
|
38568 | 0.167
|
38569 | ],
|
38570 | y: [
|
38571 | 0.167
|
38572 | ]
|
38573 | },
|
38574 | n: [
|
38575 | "0p833_0p833_0p167_0p167"
|
38576 | ],
|
38577 | t: 90,
|
38578 | s: [
|
38579 | 100
|
38580 | ],
|
38581 | e: [
|
38582 | 100
|
38583 | ]
|
38584 | },
|
38585 | {
|
38586 | i: {
|
38587 | x: [
|
38588 | 0.833
|
38589 | ],
|
38590 | y: [
|
38591 | 0.833
|
38592 | ]
|
38593 | },
|
38594 | o: {
|
38595 | x: [
|
38596 | 0.167
|
38597 | ],
|
38598 | y: [
|
38599 | 0.167
|
38600 | ]
|
38601 | },
|
38602 | n: [
|
38603 | "0p833_0p833_0p167_0p167"
|
38604 | ],
|
38605 | t: 150,
|
38606 | s: [
|
38607 | 100
|
38608 | ],
|
38609 | e: [
|
38610 | 0
|
38611 | ]
|
38612 | },
|
38613 | {
|
38614 | t: 166
|
38615 | }
|
38616 | ],
|
38617 | ix: 11
|
38618 | },
|
38619 | rx: {
|
38620 | a: 1,
|
38621 | k: [
|
38622 | {
|
38623 | i: {
|
38624 | x: [
|
38625 | 0.833
|
38626 | ],
|
38627 | y: [
|
38628 | 0.833
|
38629 | ]
|
38630 | },
|
38631 | o: {
|
38632 | x: [
|
38633 | 0.167
|
38634 | ],
|
38635 | y: [
|
38636 | 0.167
|
38637 | ]
|
38638 | },
|
38639 | n: [
|
38640 | "0p833_0p833_0p167_0p167"
|
38641 | ],
|
38642 | t: 75,
|
38643 | s: [
|
38644 | -170
|
38645 | ],
|
38646 | e: [
|
38647 | 0
|
38648 | ]
|
38649 | },
|
38650 | {
|
38651 | i: {
|
38652 | x: [
|
38653 | 0.833
|
38654 | ],
|
38655 | y: [
|
38656 | 0.833
|
38657 | ]
|
38658 | },
|
38659 | o: {
|
38660 | x: [
|
38661 | 0.167
|
38662 | ],
|
38663 | y: [
|
38664 | 0.167
|
38665 | ]
|
38666 | },
|
38667 | n: [
|
38668 | "0p833_0p833_0p167_0p167"
|
38669 | ],
|
38670 | t: 90,
|
38671 | s: [
|
38672 | 0
|
38673 | ],
|
38674 | e: [
|
38675 | 0
|
38676 | ]
|
38677 | },
|
38678 | {
|
38679 | i: {
|
38680 | x: [
|
38681 | 0.833
|
38682 | ],
|
38683 | y: [
|
38684 | 0.833
|
38685 | ]
|
38686 | },
|
38687 | o: {
|
38688 | x: [
|
38689 | 0.167
|
38690 | ],
|
38691 | y: [
|
38692 | 0.167
|
38693 | ]
|
38694 | },
|
38695 | n: [
|
38696 | "0p833_0p833_0p167_0p167"
|
38697 | ],
|
38698 | t: 150,
|
38699 | s: [
|
38700 | 0
|
38701 | ],
|
38702 | e: [
|
38703 | -170
|
38704 | ]
|
38705 | },
|
38706 | {
|
38707 | t: 166
|
38708 | }
|
38709 | ],
|
38710 | ix: 8
|
38711 | },
|
38712 | ry: {
|
38713 | a: 0,
|
38714 | k: 0,
|
38715 | ix: 9
|
38716 | },
|
38717 | rz: {
|
38718 | a: 1,
|
38719 | k: [
|
38720 | {
|
38721 | i: {
|
38722 | x: [
|
38723 | 0.833
|
38724 | ],
|
38725 | y: [
|
38726 | 0.833
|
38727 | ]
|
38728 | },
|
38729 | o: {
|
38730 | x: [
|
38731 | 0.167
|
38732 | ],
|
38733 | y: [
|
38734 | 0.167
|
38735 | ]
|
38736 | },
|
38737 | n: [
|
38738 | "0p833_0p833_0p167_0p167"
|
38739 | ],
|
38740 | t: 75,
|
38741 | s: [
|
38742 | 59
|
38743 | ],
|
38744 | e: [
|
38745 | 0
|
38746 | ]
|
38747 | },
|
38748 | {
|
38749 | i: {
|
38750 | x: [
|
38751 | 0.833
|
38752 | ],
|
38753 | y: [
|
38754 | 0.833
|
38755 | ]
|
38756 | },
|
38757 | o: {
|
38758 | x: [
|
38759 | 0.167
|
38760 | ],
|
38761 | y: [
|
38762 | 0.167
|
38763 | ]
|
38764 | },
|
38765 | n: [
|
38766 | "0p833_0p833_0p167_0p167"
|
38767 | ],
|
38768 | t: 90,
|
38769 | s: [
|
38770 | 0
|
38771 | ],
|
38772 | e: [
|
38773 | 0
|
38774 | ]
|
38775 | },
|
38776 | {
|
38777 | i: {
|
38778 | x: [
|
38779 | 0.833
|
38780 | ],
|
38781 | y: [
|
38782 | 0.833
|
38783 | ]
|
38784 | },
|
38785 | o: {
|
38786 | x: [
|
38787 | 0.167
|
38788 | ],
|
38789 | y: [
|
38790 | 0.167
|
38791 | ]
|
38792 | },
|
38793 | n: [
|
38794 | "0p833_0p833_0p167_0p167"
|
38795 | ],
|
38796 | t: 150,
|
38797 | s: [
|
38798 | 0
|
38799 | ],
|
38800 | e: [
|
38801 | 59
|
38802 | ]
|
38803 | },
|
38804 | {
|
38805 | t: 166
|
38806 | }
|
38807 | ],
|
38808 | ix: 10
|
38809 | },
|
38810 | or: {
|
38811 | a: 0,
|
38812 | k: [
|
38813 | 0,
|
38814 | 0,
|
38815 | 0
|
38816 | ],
|
38817 | ix: 7
|
38818 | },
|
38819 | p: {
|
38820 | a: 0,
|
38821 | k: [
|
38822 | 86,
|
38823 | 64.156,
|
38824 | 0
|
38825 | ],
|
38826 | ix: 2
|
38827 | },
|
38828 | a: {
|
38829 | a: 0,
|
38830 | k: [
|
38831 | 11.75,
|
38832 | 7.5,
|
38833 | 0
|
38834 | ],
|
38835 | ix: 1
|
38836 | },
|
38837 | s: {
|
38838 | a: 0,
|
38839 | k: [
|
38840 | 100,
|
38841 | 100,
|
38842 | 100
|
38843 | ],
|
38844 | ix: 6
|
38845 | }
|
38846 | },
|
38847 | ao: 0,
|
38848 | ip: 75,
|
38849 | op: 165.6,
|
38850 | st: 84,
|
38851 | bm: 0
|
38852 | },
|
38853 | {
|
38854 | ddd: 1,
|
38855 | ind: 4,
|
38856 | ty: 2,
|
38857 | nm: "qube-icon-05.ai",
|
38858 | cl: "ai",
|
38859 | parent: 5,
|
38860 | refId: "image_3",
|
38861 | sr: 1,
|
38862 | ks: {
|
38863 | o: {
|
38864 | a: 1,
|
38865 | k: [
|
38866 | {
|
38867 | i: {
|
38868 | x: [
|
38869 | 0.833
|
38870 | ],
|
38871 | y: [
|
38872 | 0.833
|
38873 | ]
|
38874 | },
|
38875 | o: {
|
38876 | x: [
|
38877 | 0.167
|
38878 | ],
|
38879 | y: [
|
38880 | 0.167
|
38881 | ]
|
38882 | },
|
38883 | n: [
|
38884 | "0p833_0p833_0p167_0p167"
|
38885 | ],
|
38886 | t: 60.001,
|
38887 | s: [
|
38888 | 0
|
38889 | ],
|
38890 | e: [
|
38891 | 100
|
38892 | ]
|
38893 | },
|
38894 | {
|
38895 | i: {
|
38896 | x: [
|
38897 | 0.833
|
38898 | ],
|
38899 | y: [
|
38900 | 0.833
|
38901 | ]
|
38902 | },
|
38903 | o: {
|
38904 | x: [
|
38905 | 0.167
|
38906 | ],
|
38907 | y: [
|
38908 | 0.167
|
38909 | ]
|
38910 | },
|
38911 | n: [
|
38912 | "0p833_0p833_0p167_0p167"
|
38913 | ],
|
38914 | t: 75.001,
|
38915 | s: [
|
38916 | 100
|
38917 | ],
|
38918 | e: [
|
38919 | 100
|
38920 | ]
|
38921 | },
|
38922 | {
|
38923 | i: {
|
38924 | x: [
|
38925 | 0.833
|
38926 | ],
|
38927 | y: [
|
38928 | 0.833
|
38929 | ]
|
38930 | },
|
38931 | o: {
|
38932 | x: [
|
38933 | 0.167
|
38934 | ],
|
38935 | y: [
|
38936 | 0.167
|
38937 | ]
|
38938 | },
|
38939 | n: [
|
38940 | "0p833_0p833_0p167_0p167"
|
38941 | ],
|
38942 | t: 166.001,
|
38943 | s: [
|
38944 | 100
|
38945 | ],
|
38946 | e: [
|
38947 | 0
|
38948 | ]
|
38949 | },
|
38950 | {
|
38951 | t: 180.00078125
|
38952 | }
|
38953 | ],
|
38954 | ix: 11
|
38955 | },
|
38956 | rx: {
|
38957 | a: 0,
|
38958 | k: 0,
|
38959 | ix: 8
|
38960 | },
|
38961 | ry: {
|
38962 | a: 1,
|
38963 | k: [
|
38964 | {
|
38965 | i: {
|
38966 | x: [
|
38967 | 0.833
|
38968 | ],
|
38969 | y: [
|
38970 | 0.833
|
38971 | ]
|
38972 | },
|
38973 | o: {
|
38974 | x: [
|
38975 | 0.167
|
38976 | ],
|
38977 | y: [
|
38978 | 0.167
|
38979 | ]
|
38980 | },
|
38981 | n: [
|
38982 | "0p833_0p833_0p167_0p167"
|
38983 | ],
|
38984 | t: 60.001,
|
38985 | s: [
|
38986 | 178
|
38987 | ],
|
38988 | e: [
|
38989 | 0
|
38990 | ]
|
38991 | },
|
38992 | {
|
38993 | i: {
|
38994 | x: [
|
38995 | 0.833
|
38996 | ],
|
38997 | y: [
|
38998 | 0.833
|
38999 | ]
|
39000 | },
|
39001 | o: {
|
39002 | x: [
|
39003 | 0.167
|
39004 | ],
|
39005 | y: [
|
39006 | 0.167
|
39007 | ]
|
39008 | },
|
39009 | n: [
|
39010 | "0p833_0p833_0p167_0p167"
|
39011 | ],
|
39012 | t: 75.001,
|
39013 | s: [
|
39014 | 0
|
39015 | ],
|
39016 | e: [
|
39017 | 0
|
39018 | ]
|
39019 | },
|
39020 | {
|
39021 | i: {
|
39022 | x: [
|
39023 | 0.833
|
39024 | ],
|
39025 | y: [
|
39026 | 0.833
|
39027 | ]
|
39028 | },
|
39029 | o: {
|
39030 | x: [
|
39031 | 0.167
|
39032 | ],
|
39033 | y: [
|
39034 | 0.167
|
39035 | ]
|
39036 | },
|
39037 | n: [
|
39038 | "0p833_0p833_0p167_0p167"
|
39039 | ],
|
39040 | t: 166.001,
|
39041 | s: [
|
39042 | 0
|
39043 | ],
|
39044 | e: [
|
39045 | 178
|
39046 | ]
|
39047 | },
|
39048 | {
|
39049 | t: 180.00078125
|
39050 | }
|
39051 | ],
|
39052 | ix: 9
|
39053 | },
|
39054 | rz: {
|
39055 | a: 0,
|
39056 | k: 0,
|
39057 | ix: 10
|
39058 | },
|
39059 | or: {
|
39060 | a: 0,
|
39061 | k: [
|
39062 | 0,
|
39063 | 0,
|
39064 | 0
|
39065 | ],
|
39066 | ix: 7
|
39067 | },
|
39068 | p: {
|
39069 | a: 0,
|
39070 | k: [
|
39071 | 99,
|
39072 | 15,
|
39073 | 0
|
39074 | ],
|
39075 | ix: 2
|
39076 | },
|
39077 | a: {
|
39078 | a: 0,
|
39079 | k: [
|
39080 | 0,
|
39081 | 15.25,
|
39082 | 0
|
39083 | ],
|
39084 | ix: 1
|
39085 | },
|
39086 | s: {
|
39087 | a: 0,
|
39088 | k: [
|
39089 | 100,
|
39090 | 100,
|
39091 | 100
|
39092 | ],
|
39093 | ix: 6
|
39094 | }
|
39095 | },
|
39096 | ao: 0,
|
39097 | ip: 60,
|
39098 | op: 180,
|
39099 | st: 67.2,
|
39100 | bm: 0
|
39101 | },
|
39102 | {
|
39103 | ddd: 1,
|
39104 | ind: 5,
|
39105 | ty: 2,
|
39106 | nm: "qube-icon-04.ai",
|
39107 | cl: "ai",
|
39108 | parent: 6,
|
39109 | refId: "image_4",
|
39110 | sr: 1,
|
39111 | ks: {
|
39112 | o: {
|
39113 | a: 1,
|
39114 | k: [
|
39115 | {
|
39116 | i: {
|
39117 | x: [
|
39118 | 0.833
|
39119 | ],
|
39120 | y: [
|
39121 | 0.833
|
39122 | ]
|
39123 | },
|
39124 | o: {
|
39125 | x: [
|
39126 | 0.167
|
39127 | ],
|
39128 | y: [
|
39129 | 0.167
|
39130 | ]
|
39131 | },
|
39132 | n: [
|
39133 | "0p833_0p833_0p167_0p167"
|
39134 | ],
|
39135 | t: 46,
|
39136 | s: [
|
39137 | 0
|
39138 | ],
|
39139 | e: [
|
39140 | 100
|
39141 | ]
|
39142 | },
|
39143 | {
|
39144 | i: {
|
39145 | x: [
|
39146 | 0.833
|
39147 | ],
|
39148 | y: [
|
39149 | 0.833
|
39150 | ]
|
39151 | },
|
39152 | o: {
|
39153 | x: [
|
39154 | 0.167
|
39155 | ],
|
39156 | y: [
|
39157 | 0.167
|
39158 | ]
|
39159 | },
|
39160 | n: [
|
39161 | "0p833_0p833_0p167_0p167"
|
39162 | ],
|
39163 | t: 60,
|
39164 | s: [
|
39165 | 100
|
39166 | ],
|
39167 | e: [
|
39168 | 100
|
39169 | ]
|
39170 | },
|
39171 | {
|
39172 | i: {
|
39173 | x: [
|
39174 | 0.833
|
39175 | ],
|
39176 | y: [
|
39177 | 0.833
|
39178 | ]
|
39179 | },
|
39180 | o: {
|
39181 | x: [
|
39182 | 0.167
|
39183 | ],
|
39184 | y: [
|
39185 | 0.167
|
39186 | ]
|
39187 | },
|
39188 | n: [
|
39189 | "0p833_0p833_0p167_0p167"
|
39190 | ],
|
39191 | t: 180,
|
39192 | s: [
|
39193 | 100
|
39194 | ],
|
39195 | e: [
|
39196 | 0
|
39197 | ]
|
39198 | },
|
39199 | {
|
39200 | t: 194.999609375
|
39201 | }
|
39202 | ],
|
39203 | ix: 11
|
39204 | },
|
39205 | rx: {
|
39206 | a: 1,
|
39207 | k: [
|
39208 | {
|
39209 | i: {
|
39210 | x: [
|
39211 | 0.833
|
39212 | ],
|
39213 | y: [
|
39214 | 0.833
|
39215 | ]
|
39216 | },
|
39217 | o: {
|
39218 | x: [
|
39219 | 0.167
|
39220 | ],
|
39221 | y: [
|
39222 | 0.167
|
39223 | ]
|
39224 | },
|
39225 | n: [
|
39226 | "0p833_0p833_0p167_0p167"
|
39227 | ],
|
39228 | t: 46,
|
39229 | s: [
|
39230 | 189
|
39231 | ],
|
39232 | e: [
|
39233 | 0
|
39234 | ]
|
39235 | },
|
39236 | {
|
39237 | i: {
|
39238 | x: [
|
39239 | 0.833
|
39240 | ],
|
39241 | y: [
|
39242 | 0.833
|
39243 | ]
|
39244 | },
|
39245 | o: {
|
39246 | x: [
|
39247 | 0.167
|
39248 | ],
|
39249 | y: [
|
39250 | 0.167
|
39251 | ]
|
39252 | },
|
39253 | n: [
|
39254 | "0p833_0p833_0p167_0p167"
|
39255 | ],
|
39256 | t: 60,
|
39257 | s: [
|
39258 | 0
|
39259 | ],
|
39260 | e: [
|
39261 | 0
|
39262 | ]
|
39263 | },
|
39264 | {
|
39265 | i: {
|
39266 | x: [
|
39267 | 0.833
|
39268 | ],
|
39269 | y: [
|
39270 | 0.833
|
39271 | ]
|
39272 | },
|
39273 | o: {
|
39274 | x: [
|
39275 | 0.167
|
39276 | ],
|
39277 | y: [
|
39278 | 0.167
|
39279 | ]
|
39280 | },
|
39281 | n: [
|
39282 | "0p833_0p833_0p167_0p167"
|
39283 | ],
|
39284 | t: 180,
|
39285 | s: [
|
39286 | 0
|
39287 | ],
|
39288 | e: [
|
39289 | 189
|
39290 | ]
|
39291 | },
|
39292 | {
|
39293 | t: 194.999609375
|
39294 | }
|
39295 | ],
|
39296 | ix: 8
|
39297 | },
|
39298 | ry: {
|
39299 | a: 0,
|
39300 | k: 0,
|
39301 | ix: 9
|
39302 | },
|
39303 | rz: {
|
39304 | a: 1,
|
39305 | k: [
|
39306 | {
|
39307 | i: {
|
39308 | x: [
|
39309 | 0.833
|
39310 | ],
|
39311 | y: [
|
39312 | 0.833
|
39313 | ]
|
39314 | },
|
39315 | o: {
|
39316 | x: [
|
39317 | 0.167
|
39318 | ],
|
39319 | y: [
|
39320 | 0.167
|
39321 | ]
|
39322 | },
|
39323 | n: [
|
39324 | "0p833_0p833_0p167_0p167"
|
39325 | ],
|
39326 | t: 46,
|
39327 | s: [
|
39328 | -61
|
39329 | ],
|
39330 | e: [
|
39331 | 0
|
39332 | ]
|
39333 | },
|
39334 | {
|
39335 | i: {
|
39336 | x: [
|
39337 | 0.833
|
39338 | ],
|
39339 | y: [
|
39340 | 0.833
|
39341 | ]
|
39342 | },
|
39343 | o: {
|
39344 | x: [
|
39345 | 0.167
|
39346 | ],
|
39347 | y: [
|
39348 | 0.167
|
39349 | ]
|
39350 | },
|
39351 | n: [
|
39352 | "0p833_0p833_0p167_0p167"
|
39353 | ],
|
39354 | t: 60,
|
39355 | s: [
|
39356 | 0
|
39357 | ],
|
39358 | e: [
|
39359 | 0
|
39360 | ]
|
39361 | },
|
39362 | {
|
39363 | i: {
|
39364 | x: [
|
39365 | 0.833
|
39366 | ],
|
39367 | y: [
|
39368 | 0.833
|
39369 | ]
|
39370 | },
|
39371 | o: {
|
39372 | x: [
|
39373 | 0.167
|
39374 | ],
|
39375 | y: [
|
39376 | 0.167
|
39377 | ]
|
39378 | },
|
39379 | n: [
|
39380 | "0p833_0p833_0p167_0p167"
|
39381 | ],
|
39382 | t: 180,
|
39383 | s: [
|
39384 | 0
|
39385 | ],
|
39386 | e: [
|
39387 | -61
|
39388 | ]
|
39389 | },
|
39390 | {
|
39391 | t: 194.999609375
|
39392 | }
|
39393 | ],
|
39394 | ix: 10
|
39395 | },
|
39396 | or: {
|
39397 | a: 0,
|
39398 | k: [
|
39399 | 0,
|
39400 | 0,
|
39401 | 0
|
39402 | ],
|
39403 | ix: 7
|
39404 | },
|
39405 | p: {
|
39406 | a: 0,
|
39407 | k: [
|
39408 | 12.125,
|
39409 | 7.938,
|
39410 | 0
|
39411 | ],
|
39412 | ix: 2
|
39413 | },
|
39414 | a: {
|
39415 | a: 0,
|
39416 | k: [
|
39417 | 12.5,
|
39418 | 64.5,
|
39419 | 0
|
39420 | ],
|
39421 | ix: 1
|
39422 | },
|
39423 | s: {
|
39424 | a: 0,
|
39425 | k: [
|
39426 | 100,
|
39427 | 100,
|
39428 | 100
|
39429 | ],
|
39430 | ix: 6
|
39431 | }
|
39432 | },
|
39433 | ao: 0,
|
39434 | ip: 46,
|
39435 | op: 195,
|
39436 | st: 50.4,
|
39437 | bm: 0
|
39438 | },
|
39439 | {
|
39440 | ddd: 1,
|
39441 | ind: 6,
|
39442 | ty: 2,
|
39443 | nm: "qube-icon-03.ai",
|
39444 | cl: "ai",
|
39445 | parent: 7,
|
39446 | refId: "image_5",
|
39447 | sr: 1,
|
39448 | ks: {
|
39449 | o: {
|
39450 | a: 1,
|
39451 | k: [
|
39452 | {
|
39453 | i: {
|
39454 | x: [
|
39455 | 0.833
|
39456 | ],
|
39457 | y: [
|
39458 | 0.833
|
39459 | ]
|
39460 | },
|
39461 | o: {
|
39462 | x: [
|
39463 | 0.167
|
39464 | ],
|
39465 | y: [
|
39466 | 0.167
|
39467 | ]
|
39468 | },
|
39469 | n: [
|
39470 | "0p833_0p833_0p167_0p167"
|
39471 | ],
|
39472 | t: 30,
|
39473 | s: [
|
39474 | 0
|
39475 | ],
|
39476 | e: [
|
39477 | 100
|
39478 | ]
|
39479 | },
|
39480 | {
|
39481 | i: {
|
39482 | x: [
|
39483 | 0.833
|
39484 | ],
|
39485 | y: [
|
39486 | 0.833
|
39487 | ]
|
39488 | },
|
39489 | o: {
|
39490 | x: [
|
39491 | 0.167
|
39492 | ],
|
39493 | y: [
|
39494 | 0.167
|
39495 | ]
|
39496 | },
|
39497 | n: [
|
39498 | "0p833_0p833_0p167_0p167"
|
39499 | ],
|
39500 | t: 46,
|
39501 | s: [
|
39502 | 100
|
39503 | ],
|
39504 | e: [
|
39505 | 100
|
39506 | ]
|
39507 | },
|
39508 | {
|
39509 | i: {
|
39510 | x: [
|
39511 | 0.833
|
39512 | ],
|
39513 | y: [
|
39514 | 0.833
|
39515 | ]
|
39516 | },
|
39517 | o: {
|
39518 | x: [
|
39519 | 0.167
|
39520 | ],
|
39521 | y: [
|
39522 | 0.167
|
39523 | ]
|
39524 | },
|
39525 | n: [
|
39526 | "0p833_0p833_0p167_0p167"
|
39527 | ],
|
39528 | t: 195,
|
39529 | s: [
|
39530 | 100
|
39531 | ],
|
39532 | e: [
|
39533 | 0
|
39534 | ]
|
39535 | },
|
39536 | {
|
39537 | t: 211.000390625
|
39538 | }
|
39539 | ],
|
39540 | ix: 11
|
39541 | },
|
39542 | rx: {
|
39543 | a: 1,
|
39544 | k: [
|
39545 | {
|
39546 | i: {
|
39547 | x: [
|
39548 | 0.833
|
39549 | ],
|
39550 | y: [
|
39551 | 0.833
|
39552 | ]
|
39553 | },
|
39554 | o: {
|
39555 | x: [
|
39556 | 0.167
|
39557 | ],
|
39558 | y: [
|
39559 | 0.167
|
39560 | ]
|
39561 | },
|
39562 | n: [
|
39563 | "0p833_0p833_0p167_0p167"
|
39564 | ],
|
39565 | t: 30,
|
39566 | s: [
|
39567 | 178
|
39568 | ],
|
39569 | e: [
|
39570 | 0
|
39571 | ]
|
39572 | },
|
39573 | {
|
39574 | i: {
|
39575 | x: [
|
39576 | 0.833
|
39577 | ],
|
39578 | y: [
|
39579 | 0.833
|
39580 | ]
|
39581 | },
|
39582 | o: {
|
39583 | x: [
|
39584 | 0.167
|
39585 | ],
|
39586 | y: [
|
39587 | 0.167
|
39588 | ]
|
39589 | },
|
39590 | n: [
|
39591 | "0p833_0p833_0p167_0p167"
|
39592 | ],
|
39593 | t: 46,
|
39594 | s: [
|
39595 | 0
|
39596 | ],
|
39597 | e: [
|
39598 | 0
|
39599 | ]
|
39600 | },
|
39601 | {
|
39602 | i: {
|
39603 | x: [
|
39604 | 0.833
|
39605 | ],
|
39606 | y: [
|
39607 | 0.833
|
39608 | ]
|
39609 | },
|
39610 | o: {
|
39611 | x: [
|
39612 | 0.167
|
39613 | ],
|
39614 | y: [
|
39615 | 0.167
|
39616 | ]
|
39617 | },
|
39618 | n: [
|
39619 | "0p833_0p833_0p167_0p167"
|
39620 | ],
|
39621 | t: 195,
|
39622 | s: [
|
39623 | 0
|
39624 | ],
|
39625 | e: [
|
39626 | 178
|
39627 | ]
|
39628 | },
|
39629 | {
|
39630 | t: 211.000390625
|
39631 | }
|
39632 | ],
|
39633 | ix: 8
|
39634 | },
|
39635 | ry: {
|
39636 | a: 0,
|
39637 | k: 0,
|
39638 | ix: 9
|
39639 | },
|
39640 | rz: {
|
39641 | a: 1,
|
39642 | k: [
|
39643 | {
|
39644 | i: {
|
39645 | x: [
|
39646 | 0.833
|
39647 | ],
|
39648 | y: [
|
39649 | 0.833
|
39650 | ]
|
39651 | },
|
39652 | o: {
|
39653 | x: [
|
39654 | 0.167
|
39655 | ],
|
39656 | y: [
|
39657 | 0.167
|
39658 | ]
|
39659 | },
|
39660 | n: [
|
39661 | "0p833_0p833_0p167_0p167"
|
39662 | ],
|
39663 | t: 30,
|
39664 | s: [
|
39665 | 59
|
39666 | ],
|
39667 | e: [
|
39668 | 0
|
39669 | ]
|
39670 | },
|
39671 | {
|
39672 | i: {
|
39673 | x: [
|
39674 | 0.833
|
39675 | ],
|
39676 | y: [
|
39677 | 0.833
|
39678 | ]
|
39679 | },
|
39680 | o: {
|
39681 | x: [
|
39682 | 0.167
|
39683 | ],
|
39684 | y: [
|
39685 | 0.167
|
39686 | ]
|
39687 | },
|
39688 | n: [
|
39689 | "0p833_0p833_0p167_0p167"
|
39690 | ],
|
39691 | t: 46,
|
39692 | s: [
|
39693 | 0
|
39694 | ],
|
39695 | e: [
|
39696 | 0
|
39697 | ]
|
39698 | },
|
39699 | {
|
39700 | i: {
|
39701 | x: [
|
39702 | 0.833
|
39703 | ],
|
39704 | y: [
|
39705 | 0.833
|
39706 | ]
|
39707 | },
|
39708 | o: {
|
39709 | x: [
|
39710 | 0.167
|
39711 | ],
|
39712 | y: [
|
39713 | 0.167
|
39714 | ]
|
39715 | },
|
39716 | n: [
|
39717 | "0p833_0p833_0p167_0p167"
|
39718 | ],
|
39719 | t: 195,
|
39720 | s: [
|
39721 | 0
|
39722 | ],
|
39723 | e: [
|
39724 | 59
|
39725 | ]
|
39726 | },
|
39727 | {
|
39728 | t: 211.000390625
|
39729 | }
|
39730 | ],
|
39731 | ix: 10
|
39732 | },
|
39733 | or: {
|
39734 | a: 0,
|
39735 | k: [
|
39736 | 0,
|
39737 | 0,
|
39738 | 0
|
39739 | ],
|
39740 | ix: 7
|
39741 | },
|
39742 | p: {
|
39743 | a: 0,
|
39744 | k: [
|
39745 | 13,
|
39746 | 5.25,
|
39747 | 0
|
39748 | ],
|
39749 | ix: 2
|
39750 | },
|
39751 | a: {
|
39752 | a: 0,
|
39753 | k: [
|
39754 | 12.5,
|
39755 | 93.25,
|
39756 | 0
|
39757 | ],
|
39758 | ix: 1
|
39759 | },
|
39760 | s: {
|
39761 | a: 0,
|
39762 | k: [
|
39763 | 100,
|
39764 | 100,
|
39765 | 100
|
39766 | ],
|
39767 | ix: 6
|
39768 | }
|
39769 | },
|
39770 | ao: 0,
|
39771 | ip: 30,
|
39772 | op: 211,
|
39773 | st: 33.6,
|
39774 | bm: 0
|
39775 | },
|
39776 | {
|
39777 | ddd: 1,
|
39778 | ind: 7,
|
39779 | ty: 2,
|
39780 | nm: "qube-icon-02.ai",
|
39781 | cl: "ai",
|
39782 | parent: 8,
|
39783 | refId: "image_6",
|
39784 | sr: 1,
|
39785 | ks: {
|
39786 | o: {
|
39787 | a: 1,
|
39788 | k: [
|
39789 | {
|
39790 | i: {
|
39791 | x: [
|
39792 | 0.833
|
39793 | ],
|
39794 | y: [
|
39795 | 0.833
|
39796 | ]
|
39797 | },
|
39798 | o: {
|
39799 | x: [
|
39800 | 0.167
|
39801 | ],
|
39802 | y: [
|
39803 | 0.167
|
39804 | ]
|
39805 | },
|
39806 | n: [
|
39807 | "0p833_0p833_0p167_0p167"
|
39808 | ],
|
39809 | t: 14.999,
|
39810 | s: [
|
39811 | 0
|
39812 | ],
|
39813 | e: [
|
39814 | 100
|
39815 | ]
|
39816 | },
|
39817 | {
|
39818 | i: {
|
39819 | x: [
|
39820 | 0.833
|
39821 | ],
|
39822 | y: [
|
39823 | 0.833
|
39824 | ]
|
39825 | },
|
39826 | o: {
|
39827 | x: [
|
39828 | 0.167
|
39829 | ],
|
39830 | y: [
|
39831 | 0.167
|
39832 | ]
|
39833 | },
|
39834 | n: [
|
39835 | "0p833_0p833_0p167_0p167"
|
39836 | ],
|
39837 | t: 29.999,
|
39838 | s: [
|
39839 | 100
|
39840 | ],
|
39841 | e: [
|
39842 | 100
|
39843 | ]
|
39844 | },
|
39845 | {
|
39846 | i: {
|
39847 | x: [
|
39848 | 0.833
|
39849 | ],
|
39850 | y: [
|
39851 | 0.833
|
39852 | ]
|
39853 | },
|
39854 | o: {
|
39855 | x: [
|
39856 | 0.167
|
39857 | ],
|
39858 | y: [
|
39859 | 0.167
|
39860 | ]
|
39861 | },
|
39862 | n: [
|
39863 | "0p833_0p833_0p167_0p167"
|
39864 | ],
|
39865 | t: 210.999,
|
39866 | s: [
|
39867 | 100
|
39868 | ],
|
39869 | e: [
|
39870 | 0
|
39871 | ]
|
39872 | },
|
39873 | {
|
39874 | t: 225.99921875
|
39875 | }
|
39876 | ],
|
39877 | ix: 11
|
39878 | },
|
39879 | rx: {
|
39880 | a: 0,
|
39881 | k: 0,
|
39882 | ix: 8
|
39883 | },
|
39884 | ry: {
|
39885 | a: 1,
|
39886 | k: [
|
39887 | {
|
39888 | i: {
|
39889 | x: [
|
39890 | 0.833
|
39891 | ],
|
39892 | y: [
|
39893 | 0.833
|
39894 | ]
|
39895 | },
|
39896 | o: {
|
39897 | x: [
|
39898 | 0.167
|
39899 | ],
|
39900 | y: [
|
39901 | 0.167
|
39902 | ]
|
39903 | },
|
39904 | n: [
|
39905 | "0p833_0p833_0p167_0p167"
|
39906 | ],
|
39907 | t: 14.999,
|
39908 | s: [
|
39909 | -181
|
39910 | ],
|
39911 | e: [
|
39912 | 0
|
39913 | ]
|
39914 | },
|
39915 | {
|
39916 | i: {
|
39917 | x: [
|
39918 | 0.833
|
39919 | ],
|
39920 | y: [
|
39921 | 0.833
|
39922 | ]
|
39923 | },
|
39924 | o: {
|
39925 | x: [
|
39926 | 0.167
|
39927 | ],
|
39928 | y: [
|
39929 | 0.167
|
39930 | ]
|
39931 | },
|
39932 | n: [
|
39933 | "0p833_0p833_0p167_0p167"
|
39934 | ],
|
39935 | t: 29.999,
|
39936 | s: [
|
39937 | 0
|
39938 | ],
|
39939 | e: [
|
39940 | 0
|
39941 | ]
|
39942 | },
|
39943 | {
|
39944 | i: {
|
39945 | x: [
|
39946 | 0.833
|
39947 | ],
|
39948 | y: [
|
39949 | 0.833
|
39950 | ]
|
39951 | },
|
39952 | o: {
|
39953 | x: [
|
39954 | 0.167
|
39955 | ],
|
39956 | y: [
|
39957 | 0.167
|
39958 | ]
|
39959 | },
|
39960 | n: [
|
39961 | "0p833_0p833_0p167_0p167"
|
39962 | ],
|
39963 | t: 210.999,
|
39964 | s: [
|
39965 | 0
|
39966 | ],
|
39967 | e: [
|
39968 | -181
|
39969 | ]
|
39970 | },
|
39971 | {
|
39972 | t: 225.99921875
|
39973 | }
|
39974 | ],
|
39975 | ix: 9
|
39976 | },
|
39977 | rz: {
|
39978 | a: 0,
|
39979 | k: 0,
|
39980 | ix: 10
|
39981 | },
|
39982 | or: {
|
39983 | a: 0,
|
39984 | k: [
|
39985 | 0,
|
39986 | 0,
|
39987 | 0
|
39988 | ],
|
39989 | ix: 7
|
39990 | },
|
39991 | p: {
|
39992 | a: 0,
|
39993 | k: [
|
39994 | 0.25,
|
39995 | 53.25,
|
39996 | 0
|
39997 | ],
|
39998 | ix: 2
|
39999 | },
|
40000 | a: {
|
40001 | a: 0,
|
40002 | k: [
|
40003 | 99,
|
40004 | 68,
|
40005 | 0
|
40006 | ],
|
40007 | ix: 1
|
40008 | },
|
40009 | s: {
|
40010 | a: 0,
|
40011 | k: [
|
40012 | 100,
|
40013 | 100,
|
40014 | 100
|
40015 | ],
|
40016 | ix: 6
|
40017 | }
|
40018 | },
|
40019 | ao: 0,
|
40020 | ip: 15,
|
40021 | op: 226,
|
40022 | st: 4.8,
|
40023 | bm: 0
|
40024 | },
|
40025 | {
|
40026 | ddd: 1,
|
40027 | ind: 8,
|
40028 | ty: 2,
|
40029 | nm: "qube-icon-01.ai",
|
40030 | cl: "ai",
|
40031 | refId: "image_7",
|
40032 | sr: 1,
|
40033 | ks: {
|
40034 | o: {
|
40035 | a: 0,
|
40036 | k: 100,
|
40037 | ix: 11
|
40038 | },
|
40039 | rx: {
|
40040 | a: 1,
|
40041 | k: [
|
40042 | {
|
40043 | i: {
|
40044 | x: [
|
40045 | 0.833
|
40046 | ],
|
40047 | y: [
|
40048 | 0.833
|
40049 | ]
|
40050 | },
|
40051 | o: {
|
40052 | x: [
|
40053 | 0.167
|
40054 | ],
|
40055 | y: [
|
40056 | 0.167
|
40057 | ]
|
40058 | },
|
40059 | n: [
|
40060 | "0p833_0p833_0p167_0p167"
|
40061 | ],
|
40062 | t: 0,
|
40063 | s: [
|
40064 | 85
|
40065 | ],
|
40066 | e: [
|
40067 | 0
|
40068 | ]
|
40069 | },
|
40070 | {
|
40071 | i: {
|
40072 | x: [
|
40073 | 0.833
|
40074 | ],
|
40075 | y: [
|
40076 | 0.833
|
40077 | ]
|
40078 | },
|
40079 | o: {
|
40080 | x: [
|
40081 | 0.167
|
40082 | ],
|
40083 | y: [
|
40084 | 0.167
|
40085 | ]
|
40086 | },
|
40087 | n: [
|
40088 | "0p833_0p833_0p167_0p167"
|
40089 | ],
|
40090 | t: 15,
|
40091 | s: [
|
40092 | 0
|
40093 | ],
|
40094 | e: [
|
40095 | 0
|
40096 | ]
|
40097 | },
|
40098 | {
|
40099 | i: {
|
40100 | x: [
|
40101 | 0.833
|
40102 | ],
|
40103 | y: [
|
40104 | 0.833
|
40105 | ]
|
40106 | },
|
40107 | o: {
|
40108 | x: [
|
40109 | 0.167
|
40110 | ],
|
40111 | y: [
|
40112 | 0.167
|
40113 | ]
|
40114 | },
|
40115 | n: [
|
40116 | "0p833_0p833_0p167_0p167"
|
40117 | ],
|
40118 | t: 226,
|
40119 | s: [
|
40120 | 0
|
40121 | ],
|
40122 | e: [
|
40123 | 85
|
40124 | ]
|
40125 | },
|
40126 | {
|
40127 | t: 239
|
40128 | }
|
40129 | ],
|
40130 | ix: 8,
|
40131 | x: "var $bm_rt;\n$bm_rt = transform.xRotation;"
|
40132 | },
|
40133 | ry: {
|
40134 | a: 0,
|
40135 | k: 0,
|
40136 | ix: 9
|
40137 | },
|
40138 | rz: {
|
40139 | a: 0,
|
40140 | k: 0,
|
40141 | ix: 10
|
40142 | },
|
40143 | or: {
|
40144 | a: 0,
|
40145 | k: [
|
40146 | 0,
|
40147 | 0,
|
40148 | 0
|
40149 | ],
|
40150 | ix: 7
|
40151 | },
|
40152 | p: {
|
40153 | a: 0,
|
40154 | k: [
|
40155 | 296.75,
|
40156 | 309.25,
|
40157 | 0
|
40158 | ],
|
40159 | ix: 2
|
40160 | },
|
40161 | a: {
|
40162 | a: 0,
|
40163 | k: [
|
40164 | 49,
|
40165 | -0.062,
|
40166 | 0
|
40167 | ],
|
40168 | ix: 1
|
40169 | },
|
40170 | s: {
|
40171 | a: 0,
|
40172 | k: [
|
40173 | 100,
|
40174 | 100,
|
40175 | 100
|
40176 | ],
|
40177 | ix: 6
|
40178 | }
|
40179 | },
|
40180 | ao: 0,
|
40181 | ip: 0,
|
40182 | op: 240,
|
40183 | st: 0,
|
40184 | bm: 0
|
40185 | }
|
40186 | ];
|
40187 | var markers = [
|
40188 | ];
|
40189 | var blueAnimation = {
|
40190 | v: v,
|
40191 | fr: fr,
|
40192 | ip: ip,
|
40193 | op: op,
|
40194 | w: w,
|
40195 | h: h,
|
40196 | nm: nm,
|
40197 | ddd: ddd,
|
40198 | assets: assets,
|
40199 | layers: layers,
|
40200 | markers: markers
|
40201 | };
|
40202 |
|
40203 | var v$1 = "5.3.4";
|
40204 | var fr$1 = 60;
|
40205 | var ip$1 = 0;
|
40206 | var op$1 = 240;
|
40207 | var w$1 = 500;
|
40208 | var h$1 = 500;
|
40209 | var nm$1 = "Composição 1";
|
40210 | var ddd$1 = 1;
|
40211 | var assets$1 = [
|
40212 | {
|
40213 | id: "image_0",
|
40214 | w: 24,
|
40215 | h: 39,
|
40216 | u: "",
|
40217 | p: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAnCAYAAAAVW4iAAAABnklEQVRIS7WW63GCQBSFz+Gxo//SQdJJWqAUOgglaAfaiXYQ+3BmA4KgPDazTMxEXc0q7P29cz/ux1m4hKPabrcRwBnH7i+lfGvbdgHyXfceDSClfOm6Lgb48fehRwFspYyo1AzA66WRQQCtQyksAPQ6TPUUoNcBxATOdIwCkFL26TDpGATQOgDe1fEUQOsAEIPn6bCN9913IGUWkeZ0DAJoHSQX/Lksts3+VaR1eJ53dVlGAWRZFinAOh22UGodvh88nA5rQLbbKdvDz5zjzjkgzx1P4BqQ54XbCfLCMaAo9m4nKPaOAXvngLJ0q6h0C0hZlpWjCbgEuoRVNTpgo5SKp9Ppql+8quow1gQpoJLJZKI/+b/F6jAcQGAphIhJfl0tXodhgI1eF086jL/Mw/H4jKJUAclEiDMdRsDxccAyDEOjjhuA2naCNYkkDMM+HbbFuv4XkOrYCSH0f/vhYl03dyZQ8yAIElM6bElsGiNgrdMhhPi0bXTr3CUg1XtoEPRrzCjFtm1Piuae5w3SYUxR0zQr3/d17AbrMAG+AZ94z7Y9sCJ6AAAAAElFTkSuQmCC",
|
40218 | e: 1
|
40219 | },
|
40220 | {
|
40221 | id: "image_1",
|
40222 | w: 49,
|
40223 | h: 29,
|
40224 | u: "",
|
40225 | p: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADEAAAAdCAYAAAAD8oRRAAACnklEQVRYR82Y33HaQBDGv5UYwksG34CHMS/BFYQOQgehg9BBVILoQCW4hNBBqMTRjAfZyJoL5CUx1m3mhLExf2Q4nUj0rLvdn+7bb/dEKPGZTCZ9gIJlCPba7fa3MsJRGZve3Ey7jqt08p829h8TeHBxcfHDZlyrENfX8uxd7SEA+EtekgwePvyuBZeX4qcNGGsQURT5IPIA1A9MLGQir91qFZZYYYjJ3V2fGFo6Hw5MfuM1HoOLScwYYjqddpXSuqdN3RuxMGNYq1UDIY6X2NEQUsqzP4uFD8ZXo2xzF1FIUF7rSIkdBXF7G3tE7B+heyNOZoyZ04Nd7CCIKI57DnAFZkPdG7EAzMNq9W2J5UJEUdQht3JF235vmJXBMkIIRV6r1dzrYjshtO4XaeqDuQTdG4Asl4zTx8edEtuCiOPEA8rXvTEKeFipVF652DNEHMc9wNHd9qN5gJOtDIngNZtLiVEkZaeSprpZfT5ZCvYCjR9dd0D394kexk7rOvYg9E5hJqckSTwGSvd/u7ljxkBw3mj4zzWhHUkp5QP0PznSTm4ijIjIE0JkI/2WO0kpOynzv+0N+48sVESDcyG+r7+yt9lJKftcaDq1Kp6ZzqXREFryW8+bY0eSSF/bWdnzUg7ySMdfSccIQi/K6gUICMi9sVn99kvXGYgN6RhDrBZKKbtPF38rd4g90DOAdUfeKZ3CEGswfVD2F8NufyEaQalc6ViDeIGZ2aqXkFkdJB3rEE/10nEcx2ezeskalqjXD5ZOKRAvp/Krp299RFv/mvbV+0ip9GjplAqx2nw+nw+YsxFmX72EStFAiPevGlYRZ3uzT5hsri3ZcRxPjwZr/WXGzEG9oHROchLrQfQI47pupvc0Tf28hmXysVZr/gIhsf6oK5m1DgAAAABJRU5ErkJggg==",
|
40226 | e: 1
|
40227 | },
|
40228 | {
|
40229 | id: "image_2",
|
40230 | w: 25,
|
40231 | h: 114,
|
40232 | u: "",
|
40233 | p: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAByCAYAAACm2nr6AAAC90lEQVRoQ92aS1ITURRA7+3ClDOlCpJqtUqzAt2BLsEdyA7sHdjsIEuAHThH6hES8v8Hwp+kIeRvlcwYmFzrUYKGgg6dzr2DZN7vvHNud0YXgfG3qdQKEdrIwdhQ6pNBhk1AH/X5M4Uopd4NCWwA/PL/5WcCUUq9/D0CCxG/PVTGN+Rv9wgAvHgs/dQQ3R0J9eHvJ83VM0R3H5GxdjvUSQBPg9fdhyOwAfHrUw72PPiNTWUjouXW3Q3smuuHUp8Rbrq/9Xr7iSZKqQ8jMPThNx+T39+YiR4qgWEDwtjHNBOIHuoIDP0xTd3ddSZKba8Q6r8Cf93dIdEY+c0x6XlUEpCt7Ti/iQgkGhMwicZ2+HNti0DiCX6TmAhkJylgIgGJJwRM4okUf66dpAgkzW+SSEpAUhl+k6QIJC1gkkpn+XOlMiKQHL9JOiMByeb5TTK5eYFkcwX+XNm8ACSXL/Kb5AoCkHyhxG+SL84LpFAs8+cqlAQgxVKF36RYFoCUylV+k1JFAFKu7PKbiEAqVQGTSnWPP1dlVwBSFYHs1fhz7cpA9vlN9moikAN+k9r+vED2Dw75c8lADo/4TQ5EIEfH/CaHcwM5Oj7hzyUCOT455TcRgZycnvGbzA/k9KzOn0sEclZv8JuIQOoNh99EBNJwzvlNRCCOhIlzfsGfSwRyftHkNxGBXDQv+U1EIE0Jk+Zliz/XZUsE0uY3abVYIQ4irGCr3eEwuSKgyGvT1KsqgO2ZQ3D9+jpghcOLv25XTbDdmZlJdGgY1ptgsHR/jwXbna7fXA4hWK9Coe+PrsN1ulNDrgggYoZCN91d13w63Z5nEwRYDwSeWYuL/7q7QroeIEQQ1Ruaprm8Nen2Y0tk3d4TTBAdJLKDweCal8Pv3q5er++W64oIIoHAQuSpaR66BPb6j0CI1ofDoW2aZmOa24/l6vcH902iAGQvL3vr7jr4/uAOol9JK7i0NFV3V8hg8JOIYHVhwfDV3RVSr9efh8Pha7/d3Z7/AxVi2rslfVoKAAAAAElFTkSuQmCC",
|
40234 | e: 1
|
40235 | },
|
40236 | {
|
40237 | id: "image_3",
|
40238 | w: 100,
|
40239 | h: 71,
|
40240 | u: "",
|
40241 | p: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABHCAYAAADx2uLMAAAHBklEQVR4Xu2bbW7aWBSGz3shViKlTVEUqZGaD1Yw/TH/ww6mOyg7qHdQZwfuDpIdTHYw7GCygClhUilSP8SgVEqFwHd07ocxBAIBG9vYKFKQIYrt5577nvecY3xu39yApFev1y+ofKV+B/C5fSPNWbQMmL9SP6sCn0AUCAEgAl1SEHDE3BT4vqR26Y+B6FPpEcinIPDr9fp/qZ1dAf/xLCA6WggdAekdHx+X+rKmxTEHCCkwkqhVAXlHR0elviQMZiEgfA4cL0S4HA4rXr1+WOpLQmCeB0RtY9QDSX8wGJT6kgCUZYDoaIHoSQrc4zdvSn2JEcwKQMwmRnQtpXCPjg5LfYkBTBxAWPlZ+K+qAu7hYakvq3CJDYjaxVhjJJ33+79KfVmSSvxAdEbWA4ijpdSXZ4JJCojaxkjSNSAZTKkvC4JJFojaxpgLriCDUl8WgLIWILyJcU4mQefbjuPXarWyPjYDzlqBGAPTIwnv9esDf4EFU7ivpAFEcxHoBETNw4ODUl8iyy49INruM5zWcDholv5FU8kCEJUnC+BTpVLxiq4vmQGiYgXcGIN3sL9fWH3JGhAdtoSOlEHzoID6klUgugEj0apU0KzVaoXpv2QaiHYv/JKfhBCF0Jd8AFHygp6U5O/v17xNNid5AmLyQuqAyK3Van9uIpg8AtHuBdQiKRnM35sEJs9AFAcBXAZBwGA2oj7GQDiDOQkbTGa56bks03SyUyf2mP7ApKiR91OPhY7cjK4YqR45dXXcrHqb9o6O6T835cnIe6P31r+AyN/b28u9vqjL+qfd9kBwAezZ8M8ZEAusw42xly9f5lZfbF5J7Xb7FQnhk6T3Y5ExLyqi0ZJehExGUEsIuLu7u7nTlxCIjYx2u/2WAB8QZznasqZvaVJeDodbXq22kxtj+QjICMxtA4IuAKMvs3QjmxFidEedXI/MYF8ehH8mEAum0/niEqQHor2pQp59IBZOh4i83d3dTA9ezAXC95v1pVqtepLwwSQ9Wcuypm5ZYR6osjTb4JctKSveixc7mWyMLQRktI3dnVaqwwsQnWUs7V0ciG2Lkbzk+tjOTrb05VlALJjb29sGQXDon4Qrb5ZnmfAboaOI14c8H4huivWCgHwe7MuKviwFxIL598uXpiDhE0j5l9C7jOnKWozhUkAiWxrXxzhaUteXlYCE+uI4LggfcwzEPv/SIpIMJjV9WRmIjZa7u7vTQEqfCH+Mb2O5iBALREkjdH0sFX2JDUioL3d3jQqDgfhttHNNr19F9WTFWtaqW9YYEF1QU2d07jiOD2BthcvYgUQipimJHT/rS26B8OX0ALiO46xFXxIDovWl+2p7+5dLEB9NUhUmncYY2F+rVnuTihC9vnS0XDOYra2tRPUlUSBRfeGcXxIXLhMpv68DiF5MoKvBYOAm5V/WAiQCpgFUPICN5bjYZ1RDohFigdjLOa9Wq7Hry1qB2Cv5+vVrUwIeSWssV25QrTNCzGWoaOkRkVutVmPTl1SA8BV1u91X/f7A5YYSG8v8RYgCYiQG19xGjkNfUgMS1Ree6QXEezuGZeGEc1nzW7hpRYgFYn9fsfADWLr/kjoQC+bbt28NnuslorO8ArHlIyn1YN8y/iUzQCyY79+/vyMC18dO8hYh0XoeN8YAYijPGhzPHJAwYn788ATBJdUYmzt1koktawKI1RhujDUBLORfMgvECn8QBD4B7x9FixVUTSvLQOwaaxkwT+pLpoHYK+l2u295rpf1ZeEZLtslDIFFZ8ksRO2FzM+4z9Du/AkfMpZl2W+GLQhjIsPjkTefuJU8S19yASQC5p0k8kE4mZuRZRcIXw77l6n6kisgETAeQevLzIws20DspTzSl1wCsfpCnFpK+pATDZm2fT3Sl9wCiUTLKYALO9gX1ZhIi3Y0dWLrzdMiSBcPJ3QjrPZO1LKW1pBZYK6J6PfcAxmBuW8IIS9C/5KPLYtPX82L8aIyKcZTkZS/z3q9ngsIT9fHJrKocPY41SzL3lQWds4cxyrGGxMh0aXDhUse7COiD2NpbXaAXJqoeORJNhJIVF+4Z0GYGLyY8B5r9CFsDnl7munaNxqIBXN/f99QNSVAD16sHwjrBFeB5z63UgggFszPnz+b6lELgqmPJe7UlU5AV7EXehUKiPUvjuO4BOjBi4RKJ1LiUggVFc8aISocELtMHx4eTqUZ7ItZQ1oAuLq7VJOqsEAiYBqShZYLl6sZw04QBM1V27iFBxIB0yQCT8SoJ5LNLNaEa484+RG8WAcdSiARqe12pRrs4744AcZYzi6dEMnYR4FKIFNyH9YX7omTGuybCuRqMKi6OzvL6cRT6VYJ5Im78/DwwP7FgxBnJiNrcZ98VZ0ogSzkAGZ/qd/vv+VPHcdJ/Ln3/wFt/B5n/eJbVAAAAABJRU5ErkJggg==",
|
40242 | e: 1
|
40243 | },
|
40244 | {
|
40245 | id: "image_4",
|
40246 | w: 99,
|
40247 | h: 71,
|
40248 | u: "",
|
40249 | p: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGMAAABHCAYAAAATBvm1AAAGiUlEQVR4Xu2c327TSBTGvzNuol6s1L5BUsG2W0TVtVAlIgRJn4B9g/oN1m9AeAP3DeB+L5brXdYk3coSFfJChSJRpGzeYCNxASXxrMb/mqRJmxbbmaHjC2RBOzbz8znfOd+MTdDHwmfgY7drMVCTFn4nN/gGTrrdBnEICHUigoaxgIeh2+1Wh5w3CbSXXF7DKBhEt9tdHQwCmxjZAFYEAA2jYAjich8+frQI1ARQSSBoGAWDODk5aXABgaiexIGGUTCETqdTZUapSYRIF0YEWsMoCIbQhdPTgQ2CDaKVVBU0jIIIxJfpfPhgEScRDZXJaNCRURCLTqfTIDKaINRHJ33WuU5TOYARugDGmuDYSyuj0eZtxrmGkSEM3++ulpc/2wRmE2El0udYHTSMDGf6kqHedzoWIh+pApDIRLE8aBiFUTjudBqMowlQXZhI0dRrGIUBEBcSuiB8JID2EgAaRqEIAN/3V5eWyjZjZHNg5awyisJCR0ZBQN69f28JaxugSurlpcKsYRSC4fj4uMHBwn5h8snXkVEIApGShI80jH2k6U++hpEzDKELYEs2I2aDeOwjaRg5T/v54f1370IfCYRKuOA5IsrTBFpHRg6IfP+4ARYuedbjVkF0CxpGDnM9c0jf96tgRugjRXOfdMzxuY6M/HEIXQgiD8kmUOgjaRj5z/u5K7zx/dhHospUAKNgdGTkQ+jI9xuMi36Bh7pwpgkTqUnDyAeAGFXowjDsnLGXANAw8pvvqSMLXRgEQbi+IPYjpSkpDYSkWtKRkSua12/ejPcLE6lHocjoKbu90zs6ahjRkmd9piaoERl9cDi3bq2pt/HZ8/zQRwLRXrrKljZt53sHmSODET0XJffa2tp/cUDnmkUyG1zowufTgc2IxJ6klbFVNtVggFqBQfb62to/oxOkRJryXr+OdYEq4Q3HfygYGT0Ct2/fvv37tKdUahiedzThI8Umhnow+hzkbPx4S5TdMw8pYXieVwXCTWETPpKCMDiel0pGqgvKwHBdf7W8fHqBj6QODA60GLi9vr4+pgtKwDj0PAtg0X6kaa5qqBUKwAD1CGRvbEzXBalhHHheg0AOAdupsa0mjD4HdzY3Ni7UBSlhuJ5XLQXcAbHH8UOfWHrTLW6ZI4PwfLlcnksXpILhuu7qUrlsA+xJVBTF+zCSCmnUzjh3LluaQovArc3NzX+zaKgKrabah57FOHd40rSpC6PHIgivsoCQjFEIDPfgoGEQcwDaHmva1IPRFy9J3rnzk5MlhEJguK5XZaXAAcfjKBtNpBmlYGD/65cvTdM0Qx8pjyOXyBC6IPYjEdGTsxdD1ITBCC3GKDNdKFTA3XbbIoiUNP4SiYKR0QNn1tZWtrpQCAzXPWiA4ICwnUx8lIWmV0tnKUu6aqrPiZrbd+/kogu5wnBdt8qZIZq2x+lG+TOVVgoGA/YHg6+56kIuMIQuRPuR6Mlo03b+XIXIYK1gyCzTzKZfuK64X0vAX7ptC+BO9HLh+GQrBqPHGSxzayvTfqEQGH+4boM4OUS0fXE0xK2zvJrRF6akuX23cF345jQldGHIRYXEYx/psmiQGAanfWCwMF24NgyhC4MAqS6kneJEhaSEZjC0KAgs0zQz8ZGum4quBeOl61qcU9ovjA4yWa5KDiP0kUzTlEIXrgQj0QWE6wvTD0Vg9EG8ec80pdKFuWBM6sKFvyR7mgL2DQYpdeHCeZ2lCyrCYKAWE6WqxLpw4bz++dcrIWjR95HmPCRMUz1wsnZ25NeFSyNjGEBsl/x1ThbnLI4FCnifCM2de/eU0YW5NSPg7BlH9IKJ7GmKiPZLBlNOF+aCkfyQ/NUUhT5SrSZvv3DZwzyzSp31DxL2GaGPVNvZkb5fyByGGFCSDrwvXp6/f3/nu9CFK6WpaT8c9SDhV2bCb7QWVk1x/vTzctnZzXHd+bpPcR6/dyULXehJ9BYpordIxxaRwr8J7zGDlb4XxAO7VqtJ6yMtHEZyA9F6BppEPPxOX4al7VuGEMJ3qwvfnKZmpK5kpS/+4v03RUafiNsParVneTxxqox5pTQ1CwqH4RAT3/y+epriwNPB6bKzu5vffqQbAyP5j7ru4c9ggah46vNoBgEvDEY3ThdySVOzBnXb7V/EFn/xfb9plReB3oLDfvjwZupCoTDSSGn/bVMo8tGXbIjQBzH70YObrQsLgRE3jT8YpZKFgD4Nh6e/7e7uflIlfy/iPv8HJr7qxcBYO7oAAAAASUVORK5CYII=",
|
40250 | e: 1
|
40251 | },
|
40252 | {
|
40253 | id: "image_5",
|
40254 | w: 25,
|
40255 | h: 100,
|
40256 | u: "",
|
40257 | p: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAABkCAYAAABzVZt8AAAE9klEQVRoQ7WaS27cRhCGu0axMdfQwgIIZONlEMAAYeQSWeUIOgJzg8kNpE3W8t6WhvN+vzXaem4Q7QzDZgdV3Ww2H81nUwvDj5n6+P/1VzebJnx+7H8F4N5H171jLf3A58c+x9rAwA8g8P5w3b5tloJEhfn9FTDPdd2vtmAZEFGac/73Lx3Wc133v6YwI0QWfgXgt037VQQJRew58Nu6/SoLIRiGowPBX1X7VQmiesP5P1cdCkepftWCAJCuV8bA++h+6BUFozJEAoR9AnYBzm5d98ODCVYJkgFQdQGYz4KrW9f9fZeElYYUACgWQh6/Zz/feK77mxrmUpCyAO1zOF+94McPGuZCSA1A2CvUdmGcebmQJgAxV+IXI8QWgEY4XOr1RFgFoJgkxDYgZVcbgJhdbQGo92hXqwBM15cn3OPFtOqw5J9NFxLGlGzRc6vVgy9PvriRiD6RAjYBUG2EtApAyGMflcjFLaGosYJw4h/7A7LLZg/irQFUIiDGq9Z6VabJKYCwa2CMcAysfduUoiwATfyTj0rSEbYFoGg/+cN8uxooCGeHILZSlBzIMLPQH6CSDLssKAgjC/3BKG2XTQCmCyFWm6wNnbLLH6ISaZdlBcIuxsAfjuVJK9r5q86BaricarVIyUIEqTvJ4doeFZXLfcIRGKCSkGjYD0yTXKggtGswQrvMG05TANUejCYxu1KLpSEMRRbp7sBwNFF2tQGgdA3Hk0oTX0WBUjMcT0tPfC0ATgZCykx8XQDZNZqgkvyJbwKgPo8ms9yJbwzACCPENPE2AGTXGJVkTLwtANk1nqJd8Ym3CsDa4+k8bZdpNc2bfnlldLn671HJZDqP22UZQMzJbB7Z1QKASk5mC2FXWwDsyXS2EPfCkL3hGJOX04NYT9AugrQIoOufzpeaXSI+ucNZQUFYDWbzpbSrHQBVJYhp4lN/L3Um5iDZA+1yxS3RbIFK7Fuk7rmw9myxyl8ga/RAB5Cq+WJVYFdNiyIPGcyXqxy7mgOEkuXaYJclAPZksVxn2GUPQOlarNYJuywD0K7FaqPZZR9AFZerjbSrHQA1frnehP8TlNrRCidZi6macrUxRudQgmRtmbYABF+tt3G71D5utk/tPInVQLtFlI9RpL7VZhvZ1QKAIowQ05WlVtOSPZB7uViB0a71ZqftJ/Ys0u6MJKRgpa3aAx1AW/t6K5SYEtYYQHZtd8YI2wCQgM12nxlhWwDyaLPbpyJsE0D9QYhe1DoA7druDirCbQDILoLQ0Kgcy/sAMUmmpSIV0/B+Wv5D+D089MJ2fzBOvA0ApWu3P2ZOvC1ABCm5mlaxKDqNAIPdQSgJJ96qAvEUQkDaBBBkfzjJdEWbibwA+QBR7crxg1JGinSLorABg/3xJM8n0Z6c3A+EZu0kVgWAXz0cT4lHUVJRdFKuD+Dsgu/EwOH4rD2KsgbwO4zf3dzc0As3BLHXA/6Jdzo959272As2cDwJJeEaknncLugBMHYfBD89x3EyX6iREH2dKt3kVwas1337tnd9fZ37QgYcT2ctwqUAF8bB63bfPBQVV5E+Pp+zn0ikLOI+4507xxHNrPIDp+dz+omEDuDwCSDoOY5T+20pAckcNLgHFhibWU3J+SWyC194Ad77/q3be/8+v5mVIM/nF7TrwoB53791H2wWV40/vbz8+avj/Fvlyqp+9n+OccITzqkqWgAAAABJRU5ErkJggg==",
|
40258 | e: 1
|
40259 | },
|
40260 | {
|
40261 | id: "image_6",
|
40262 | w: 99,
|
40263 | h: 68,
|
40264 | u: "",
|
40265 | p: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGMAAABECAYAAACVkosbAAAHwElEQVR4Xu2cf47TVhDHZ543aUCgTYQWCgU2USn9sxygErkBe4P1DfANSG+QvcHuDcoNmhMs/QNF2lKlAdTVFqQQQGQ3cTzV2H72c347sRPHibVaWYnzbL+PZ75vZp4fQkxbo9HIX3ZNQyAYQPAJNDR+fvTo95hOl4pmMeq7qNfrRSG0CiEeeo0jgrtfA7KMx48fv4r6vGloLzIY9fpfZRSWAYDPwO98COxzjyGfEk8yGhqlUulTGjoxqntYGEa9fqYjgg4IT+2LmgJCnhAR2wRU/enHHytR3cy6tzMXjNNGI5+77B0AUgUR971OmB2E2m9NEGg8KpU2Xk9CwTg9beRzua4BLMoAu2i7HHebDwTINgigpiGw69pYPZkJBosygaggwqHf99GBcLyb58BOEKyN1JOJMOr1epkIDUB8FjSCuEB4UNpAUC2V9jdKT0bCeF2v6wioA7AoozMA8rxR7CCUc4kmIRmlhw83Qk+8nj09Pc1nc7kDIGR35IryKkE4l8b/CbFGAo3S/fup1hO0IWRzrijjrm8FyQChmiUCnfT7/dTqCb6u118BwS9Bd5REEDJghDYCVR88eJA6PbF9gasRVR6urlYjfNcUtAgPhJNWccy3ya7r4b17qdETRTMa+Wyuy4m9F6sR61AgPD0BwBqAZdxPgZ4MjaY4pgAhKgjoxRQhUhyBjIQaFI7bV2MM5an3O9sVsYnfoW3PJ1dXl2utJ2PjDDvxh1QBgU9HZF+dTlei7kA0Hgji1IAuuB8VCGfMZf9vE0L1h7t311JPpkbgZ2dnOhEylP3AwckDIbWEodh6cu/OnbXSk6kw+InjQlHXNA0EtHNSCbQIFYRrKHaEUtOEMG7fvr0W8clMMKQQMJRen6oIZOtJQlzTGBDyY1tQjr7LZCqFQiHR9ZNQMCSUs7PGEyGo6tUwVqcR00G4UTwg6wlWvt/b4yF8Ire5YMg7efOmwTWNqlrTiHvUpIh1GBCuwNvBbBMA9L29vT+SRmQhGPJm/m40eNIBF5p2R8YoiuUsMnxdFIQsxLsV+Zq5o+l3C4V/kgIlEhhS5C0Ajk+ej9OSBIGwubpQjjRNJEJPIoOhiHwREI8B0K6JSzAJBSGNrY0gKrduFVaqJ5HDUKCUUdOqnIRMOAhpIQymKRD1QqGwEj2JDYaE8vbtW50A3SSkDAFmyEM5BMekRZTvho5zkwOOH/KEWzbkzeCa/F0NARjKUvUkdhhST4TYMZCTkDPmmlYIwgco8Agsa2l6shQYvus6L2pa35nYoNRyVTfmfLwyi/BB+JbTJoJKobAbu54sFYaE8u7duzIgVljkEw5C+jk732VZQi8UbsamJyuBIaG8f/9eBxScYd1PoEWoIBxrdf5q/X4/Fj1ZKQypJ9ls1kAUBvHEOGc8rAh37GI9yjWNA6FCOTJNM1I9WTkMaSXn5+dF9s2ATlHLlw4XTDyjpnlBSChtBKjcuHEjEj1JDAzfdf33RNMsNwmZaBC+9QI2iSz95s3F9CRxMCSUfy8uDpCg6szhGnRbbipj/jhiUYtQQUgtASKsaRrq165dmys+SSwMz31dXHC+y0C7qBVJQBcLCEXguf2jq6ur0HqSeBh8Z61WK9/r9SoE8NyOoBNmEQMg5NyANhFVrl+/PrOerAUMVeS1nZ1jngOspjVmTHEswyIG3tSyH5wmELHrmhqfrBUMCeXDhw9lADwGhP2Eg/DVDuElWZYxSU/WEoaE8vHjRx04CYk8E9KrT6i1iqBLG+ne3IG05/284M6LKQIJmpHHDbw+5weIalwiL/u3bDbL1dGhevxaw5B6YlqWIQCdmZB+0SiBIDzQbQAwstksu1xvW3sY8k5arVaRiKr227b+o+zUKhJhEUGLc5MMfzKUTCZj60lqYChQygTA+S5H5JMLwr1ke5LES03TePiezq3VaulOZjgo8l74uDSNGGkRKgh/P50onLvi+ARAcFGLXwZykpBjxVW1oknHhRHrECD806cZiQ2lKASn6vHQ91xxj5rCgUilZkx6rFpfvz7RLItF/ukglGiHr+FBbBwMCerz588HAJyEFPu+wK/GNclr4ilNqRXwWRzvly9fuH7iJCEnBWqBjhp2b34nzmkRajFtlgtP6zEs8plMhqE8Hxb4+MRatQhvP62dHPa+Op1Osd+nYxQcn8jRpuo64rMI52wb7qZGAet0OmUiOgZU39RaAohNGdqGtRI+/tu3bwY604nsotZIFzagM+qyHvaT7pvY+CU/lOM2WsCnQWq1KJ/LXTKUF0MFpIhBbOzQdhqEwe9ZT1CIKgI4ScgYQGxhhKTCeiKExvUTZ2b9wIpD87gm9RK2biokED682+3y8k/BJQHn0IjBU29hzAGDf0JEedM0+VVsXrF0ttWIhiwpePItjDlhyJ91OlTMZPqcqj8cdFvB1+mCKxWNOu0WxoIw5M97vV6Zh8KIwdfnvIBuhp6e4ZCIrnZDmjFN80AIwXOlRq5mN6kbtjBiekj6fX4pyC5sea9jTzvVFsa0HlrgexZ5TtU7ejJ928KY3kcLH0FERQCwZ0Ju3dTC3RlNA0RUdqH4S5YrTW8tI5p+DtUKEXF8wsPhgJ5sYYTqxugOdvWEofhrQkbX/LaleXrA1RMW+Wdby5inB2P4DRH9+j8BENYhBOw6xQAAAABJRU5ErkJggg==",
|
40266 | e: 1
|
40267 | },
|
40268 | {
|
40269 | id: "image_7",
|
40270 | w: 49,
|
40271 | h: 53,
|
40272 | u: "",
|
40273 | p: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADEAAAA1CAYAAADoDQMKAAAEzUlEQVRoQ9WYS24bRxCGq2lAgKAAFBdCYG9EIvBCm8RceCEEsKQTxDcwb+C5QcY3GN2AvkG8zQMTJUG0ZGQttDHACF5oERg0AcG2xOn6g+ZMz6PnSXIoUtwMuCCnvq6//qpqQff486vrPicIR9xHhp9d98kDNBwQDlT89wrCdd1tCXKIxIv44d8biF9+c20hhEVETVM9aw+hdU9Eu3nSX1sI13XbjEZf676odtcOQumeqWEDeFnVdNYK4o+//raY2WbmJsAEVMNYC4g/T08PBVOfgV1mFTxIQTBXo1gpxOnpoE0Nrw/wgQpYB64gIphykJVADAaDbTmVDb1kderMlHgGWaiajTuHGLx924OEw+CmPn0wiFUNTJ8xqBCmOBt3BnF+fn4IEg4zvtMBT2WjA9XZMLKgpbVSi724uGgzhAPwD/4px09dn35RFvwCVzB33uyGw+H27a1ngfBjsmi1/rNhdMC6TuJulcexFDm9Gw57xHB8v/edRmvd/x4BmJJKfI/VhIbJykatEMP37w9Jch8xvw8LVVvogpLKklUtEFdXV21Pyj5AB/rEUk/tOnPAlDXAhSBGo9H255uJTSwTfh9vVLlQM0hKW29eA5wb4r8PHyyWbAPcTL0kqIEQIKuhhXViFHhQM2EDrGC5M0OMRqNDBvpg7E79Xr80owiLspAYMcJGV2C5qT4SWW5liOvr6yces0OMg6i7Zvh7aoTIcqfIZjWMPhCzjyS7enymiqbcUgil+42NDQfAi6TTZPl87CWGpEyrTc5M2f9VJintVIUQNzc3NgMWGM306cdSv1RJFXdz1QAzITzPe86sbhV4N+y2ieIsGR1S81CUoXid6DEkT1LmgKi7uWm5CQgAh0SkVsOY30dzfqTbaJ6pUh+m5Sa7d9EYUjqmn0lIawoBoK2CJ6LpfY5Kkb8eFo8MCYB5JDV/AxwTw3r27Pv+9PIMgAo+dZ+Ttk5jcSmbRitKynyP6VKmpKTkV97tF+fo6OijnqMURO6MG+k3vjrGYDRIbB7KnUJDny+y3KjvpHYOiTfgibW/v/9v6vKsCMJf2MumUL8+MhedKg2wXFJnkGQ9fdr9PXefKIJQP8reBYp3gnDNnFNSU7cCxpCwut1vp7ov3OzKIKJs5Eiq1Hpnb4AAH3uTid3tdkPdLwQRuFd4hRKvk0hCxZIyB8T8MZ1PBKG3t7eX0n0NEL7lzt74qg2IkvmSVfCPH+fqfmGIKBvzS8q8WwqyMQbB/qbTccp0XxNEVgM0oApcKr1z4JjZszudTiXd1wKRykbmopMzU8W7ucTJ5IHodR4+nEn3tUH4lpul82QD1DcWyd2ALlmy9ejR1z8tIp3M244yizV/lG6A+QNiMEKMwezs7Oyo8WYpn8KxI++N4TxjdHPzhk+CXzeIrFartbDua5WTro2SAfFEesJqtb76ZylHb/zpXJlIN8BQUpcAW1tbW7XrvvZM+BAJyx1LwPny6ZOzbOnUUtjxPwkk9XoyubU3Nzdrs8xZJTi3nIjoRG2DQoi5RoVZA61bTpdB8KUjcp2B1gnxiogcIcRSLXNW+KpyeqP2cCHEynS/SCbOguBXrvt5IMZB8Guj+1khjoPCXSvdV4VQltlbV92XQahiVcGvte6LIP4H6HIYxljTu58AAAAASUVORK5CYII=",
|
40274 | e: 1
|
40275 | }
|
40276 | ];
|
40277 | var layers$1 = [
|
40278 | {
|
40279 | ddd: 1,
|
40280 | ind: 1,
|
40281 | ty: 2,
|
40282 | nm: "qube-icon-08.ai",
|
40283 | cl: "ai",
|
40284 | parent: 2,
|
40285 | refId: "image_0",
|
40286 | sr: 1,
|
40287 | ks: {
|
40288 | o: {
|
40289 | a: 1,
|
40290 | k: [
|
40291 | {
|
40292 | i: {
|
40293 | x: [
|
40294 | 0.833
|
40295 | ],
|
40296 | y: [
|
40297 | 0.833
|
40298 | ]
|
40299 | },
|
40300 | o: {
|
40301 | x: [
|
40302 | 0.167
|
40303 | ],
|
40304 | y: [
|
40305 | 0.167
|
40306 | ]
|
40307 | },
|
40308 | n: [
|
40309 | "0p833_0p833_0p167_0p167"
|
40310 | ],
|
40311 | t: 105,
|
40312 | s: [
|
40313 | 0
|
40314 | ],
|
40315 | e: [
|
40316 | 100
|
40317 | ]
|
40318 | },
|
40319 | {
|
40320 | i: {
|
40321 | x: [
|
40322 | 0.833
|
40323 | ],
|
40324 | y: [
|
40325 | 0.833
|
40326 | ]
|
40327 | },
|
40328 | o: {
|
40329 | x: [
|
40330 | 0.167
|
40331 | ],
|
40332 | y: [
|
40333 | 0.167
|
40334 | ]
|
40335 | },
|
40336 | n: [
|
40337 | "0p833_0p833_0p167_0p167"
|
40338 | ],
|
40339 | t: 115,
|
40340 | s: [
|
40341 | 100
|
40342 | ],
|
40343 | e: [
|
40344 | 100
|
40345 | ]
|
40346 | },
|
40347 | {
|
40348 | i: {
|
40349 | x: [
|
40350 | 0.833
|
40351 | ],
|
40352 | y: [
|
40353 | 0.833
|
40354 | ]
|
40355 | },
|
40356 | o: {
|
40357 | x: [
|
40358 | 0.167
|
40359 | ],
|
40360 | y: [
|
40361 | 0.167
|
40362 | ]
|
40363 | },
|
40364 | n: [
|
40365 | "0p833_0p833_0p167_0p167"
|
40366 | ],
|
40367 | t: 125,
|
40368 | s: [
|
40369 | 100
|
40370 | ],
|
40371 | e: [
|
40372 | 100
|
40373 | ]
|
40374 | },
|
40375 | {
|
40376 | t: 135
|
40377 | }
|
40378 | ],
|
40379 | ix: 11
|
40380 | },
|
40381 | rx: {
|
40382 | a: 1,
|
40383 | k: [
|
40384 | {
|
40385 | i: {
|
40386 | x: [
|
40387 | 0.833
|
40388 | ],
|
40389 | y: [
|
40390 | 0.833
|
40391 | ]
|
40392 | },
|
40393 | o: {
|
40394 | x: [
|
40395 | 0.167
|
40396 | ],
|
40397 | y: [
|
40398 | 0.167
|
40399 | ]
|
40400 | },
|
40401 | n: [
|
40402 | "0p833_0p833_0p167_0p167"
|
40403 | ],
|
40404 | t: 105,
|
40405 | s: [
|
40406 | -186
|
40407 | ],
|
40408 | e: [
|
40409 | 0
|
40410 | ]
|
40411 | },
|
40412 | {
|
40413 | i: {
|
40414 | x: [
|
40415 | 0.833
|
40416 | ],
|
40417 | y: [
|
40418 | 0.833
|
40419 | ]
|
40420 | },
|
40421 | o: {
|
40422 | x: [
|
40423 | 0.167
|
40424 | ],
|
40425 | y: [
|
40426 | 0.167
|
40427 | ]
|
40428 | },
|
40429 | n: [
|
40430 | "0p833_0p833_0p167_0p167"
|
40431 | ],
|
40432 | t: 115,
|
40433 | s: [
|
40434 | 0
|
40435 | ],
|
40436 | e: [
|
40437 | 0
|
40438 | ]
|
40439 | },
|
40440 | {
|
40441 | i: {
|
40442 | x: [
|
40443 | 0.833
|
40444 | ],
|
40445 | y: [
|
40446 | 0.833
|
40447 | ]
|
40448 | },
|
40449 | o: {
|
40450 | x: [
|
40451 | 0.167
|
40452 | ],
|
40453 | y: [
|
40454 | 0.167
|
40455 | ]
|
40456 | },
|
40457 | n: [
|
40458 | "0p833_0p833_0p167_0p167"
|
40459 | ],
|
40460 | t: 125,
|
40461 | s: [
|
40462 | 0
|
40463 | ],
|
40464 | e: [
|
40465 | -186
|
40466 | ]
|
40467 | },
|
40468 | {
|
40469 | t: 135
|
40470 | }
|
40471 | ],
|
40472 | ix: 8
|
40473 | },
|
40474 | ry: {
|
40475 | a: 0,
|
40476 | k: 0,
|
40477 | ix: 9
|
40478 | },
|
40479 | rz: {
|
40480 | a: 1,
|
40481 | k: [
|
40482 | {
|
40483 | i: {
|
40484 | x: [
|
40485 | 0.833
|
40486 | ],
|
40487 | y: [
|
40488 | 0.833
|
40489 | ]
|
40490 | },
|
40491 | o: {
|
40492 | x: [
|
40493 | 0.167
|
40494 | ],
|
40495 | y: [
|
40496 | 0.167
|
40497 | ]
|
40498 | },
|
40499 | n: [
|
40500 | "0p833_0p833_0p167_0p167"
|
40501 | ],
|
40502 | t: 105,
|
40503 | s: [
|
40504 | 61
|
40505 | ],
|
40506 | e: [
|
40507 | 0
|
40508 | ]
|
40509 | },
|
40510 | {
|
40511 | i: {
|
40512 | x: [
|
40513 | 0.833
|
40514 | ],
|
40515 | y: [
|
40516 | 0.833
|
40517 | ]
|
40518 | },
|
40519 | o: {
|
40520 | x: [
|
40521 | 0.167
|
40522 | ],
|
40523 | y: [
|
40524 | 0.167
|
40525 | ]
|
40526 | },
|
40527 | n: [
|
40528 | "0p833_0p833_0p167_0p167"
|
40529 | ],
|
40530 | t: 115,
|
40531 | s: [
|
40532 | 0
|
40533 | ],
|
40534 | e: [
|
40535 | 0
|
40536 | ]
|
40537 | },
|
40538 | {
|
40539 | i: {
|
40540 | x: [
|
40541 | 0.833
|
40542 | ],
|
40543 | y: [
|
40544 | 0.833
|
40545 | ]
|
40546 | },
|
40547 | o: {
|
40548 | x: [
|
40549 | 0.167
|
40550 | ],
|
40551 | y: [
|
40552 | 0.167
|
40553 | ]
|
40554 | },
|
40555 | n: [
|
40556 | "0p833_0p833_0p167_0p167"
|
40557 | ],
|
40558 | t: 125,
|
40559 | s: [
|
40560 | 0
|
40561 | ],
|
40562 | e: [
|
40563 | 60
|
40564 | ]
|
40565 | },
|
40566 | {
|
40567 | t: 135
|
40568 | }
|
40569 | ],
|
40570 | ix: 10
|
40571 | },
|
40572 | or: {
|
40573 | a: 0,
|
40574 | k: [
|
40575 | 0,
|
40576 | 0,
|
40577 | 0
|
40578 | ],
|
40579 | ix: 7
|
40580 | },
|
40581 | p: {
|
40582 | a: 0,
|
40583 | k: [
|
40584 | 25.656,
|
40585 | 29.156,
|
40586 | 0
|
40587 | ],
|
40588 | ix: 2
|
40589 | },
|
40590 | a: {
|
40591 | a: 0,
|
40592 | k: [
|
40593 | 0.375,
|
40594 | 13.75,
|
40595 | 0
|
40596 | ],
|
40597 | ix: 1
|
40598 | },
|
40599 | s: {
|
40600 | a: 0,
|
40601 | k: [
|
40602 | 100,
|
40603 | 100,
|
40604 | 100
|
40605 | ],
|
40606 | ix: 6
|
40607 | }
|
40608 | },
|
40609 | ao: 0,
|
40610 | ip: 105,
|
40611 | op: 135,
|
40612 | st: 0,
|
40613 | bm: 0
|
40614 | },
|
40615 | {
|
40616 | ddd: 1,
|
40617 | ind: 2,
|
40618 | ty: 2,
|
40619 | nm: "qube-icon-07.ai",
|
40620 | cl: "ai",
|
40621 | parent: 3,
|
40622 | refId: "image_1",
|
40623 | sr: 1,
|
40624 | ks: {
|
40625 | o: {
|
40626 | a: 1,
|
40627 | k: [
|
40628 | {
|
40629 | i: {
|
40630 | x: [
|
40631 | 0.833
|
40632 | ],
|
40633 | y: [
|
40634 | 0.833
|
40635 | ]
|
40636 | },
|
40637 | o: {
|
40638 | x: [
|
40639 | 0.167
|
40640 | ],
|
40641 | y: [
|
40642 | 0.167
|
40643 | ]
|
40644 | },
|
40645 | n: [
|
40646 | "0p833_0p833_0p167_0p167"
|
40647 | ],
|
40648 | t: 90,
|
40649 | s: [
|
40650 | 0
|
40651 | ],
|
40652 | e: [
|
40653 | 100
|
40654 | ]
|
40655 | },
|
40656 | {
|
40657 | i: {
|
40658 | x: [
|
40659 | 0.833
|
40660 | ],
|
40661 | y: [
|
40662 | 0.833
|
40663 | ]
|
40664 | },
|
40665 | o: {
|
40666 | x: [
|
40667 | 0.167
|
40668 | ],
|
40669 | y: [
|
40670 | 0.167
|
40671 | ]
|
40672 | },
|
40673 | n: [
|
40674 | "0p833_0p833_0p167_0p167"
|
40675 | ],
|
40676 | t: 105,
|
40677 | s: [
|
40678 | 100
|
40679 | ],
|
40680 | e: [
|
40681 | 100
|
40682 | ]
|
40683 | },
|
40684 | {
|
40685 | i: {
|
40686 | x: [
|
40687 | 0.833
|
40688 | ],
|
40689 | y: [
|
40690 | 0.833
|
40691 | ]
|
40692 | },
|
40693 | o: {
|
40694 | x: [
|
40695 | 0.167
|
40696 | ],
|
40697 | y: [
|
40698 | 0.167
|
40699 | ]
|
40700 | },
|
40701 | n: [
|
40702 | "0p833_0p833_0p167_0p167"
|
40703 | ],
|
40704 | t: 135,
|
40705 | s: [
|
40706 | 100
|
40707 | ],
|
40708 | e: [
|
40709 | 0
|
40710 | ]
|
40711 | },
|
40712 | {
|
40713 | t: 150
|
40714 | }
|
40715 | ],
|
40716 | ix: 11
|
40717 | },
|
40718 | rx: {
|
40719 | a: 1,
|
40720 | k: [
|
40721 | {
|
40722 | i: {
|
40723 | x: [
|
40724 | 0.833
|
40725 | ],
|
40726 | y: [
|
40727 | 0.833
|
40728 | ]
|
40729 | },
|
40730 | o: {
|
40731 | x: [
|
40732 | 0.167
|
40733 | ],
|
40734 | y: [
|
40735 | 0.167
|
40736 | ]
|
40737 | },
|
40738 | n: [
|
40739 | "0p833_0p833_0p167_0p167"
|
40740 | ],
|
40741 | t: 90,
|
40742 | s: [
|
40743 | -163
|
40744 | ],
|
40745 | e: [
|
40746 | 0
|
40747 | ]
|
40748 | },
|
40749 | {
|
40750 | i: {
|
40751 | x: [
|
40752 | 0.833
|
40753 | ],
|
40754 | y: [
|
40755 | 0.833
|
40756 | ]
|
40757 | },
|
40758 | o: {
|
40759 | x: [
|
40760 | 0.167
|
40761 | ],
|
40762 | y: [
|
40763 | 0.167
|
40764 | ]
|
40765 | },
|
40766 | n: [
|
40767 | "0p833_0p833_0p167_0p167"
|
40768 | ],
|
40769 | t: 105,
|
40770 | s: [
|
40771 | 0
|
40772 | ],
|
40773 | e: [
|
40774 | 0
|
40775 | ]
|
40776 | },
|
40777 | {
|
40778 | i: {
|
40779 | x: [
|
40780 | 0.833
|
40781 | ],
|
40782 | y: [
|
40783 | 0.833
|
40784 | ]
|
40785 | },
|
40786 | o: {
|
40787 | x: [
|
40788 | 0.167
|
40789 | ],
|
40790 | y: [
|
40791 | 0.167
|
40792 | ]
|
40793 | },
|
40794 | n: [
|
40795 | "0p833_0p833_0p167_0p167"
|
40796 | ],
|
40797 | t: 135,
|
40798 | s: [
|
40799 | 0
|
40800 | ],
|
40801 | e: [
|
40802 | -163
|
40803 | ]
|
40804 | },
|
40805 | {
|
40806 | t: 150
|
40807 | }
|
40808 | ],
|
40809 | ix: 8
|
40810 | },
|
40811 | ry: {
|
40812 | a: 1,
|
40813 | k: [
|
40814 | {
|
40815 | i: {
|
40816 | x: [
|
40817 | 0.833
|
40818 | ],
|
40819 | y: [
|
40820 | 0.833
|
40821 | ]
|
40822 | },
|
40823 | o: {
|
40824 | x: [
|
40825 | 0.167
|
40826 | ],
|
40827 | y: [
|
40828 | 0.167
|
40829 | ]
|
40830 | },
|
40831 | n: [
|
40832 | "0p833_0p833_0p167_0p167"
|
40833 | ],
|
40834 | t: 90,
|
40835 | s: [
|
40836 | 30
|
40837 | ],
|
40838 | e: [
|
40839 | 0
|
40840 | ]
|
40841 | },
|
40842 | {
|
40843 | i: {
|
40844 | x: [
|
40845 | 0.833
|
40846 | ],
|
40847 | y: [
|
40848 | 0.833
|
40849 | ]
|
40850 | },
|
40851 | o: {
|
40852 | x: [
|
40853 | 0.167
|
40854 | ],
|
40855 | y: [
|
40856 | 0.167
|
40857 | ]
|
40858 | },
|
40859 | n: [
|
40860 | "0p833_0p833_0p167_0p167"
|
40861 | ],
|
40862 | t: 105,
|
40863 | s: [
|
40864 | 0
|
40865 | ],
|
40866 | e: [
|
40867 | 0
|
40868 | ]
|
40869 | },
|
40870 | {
|
40871 | i: {
|
40872 | x: [
|
40873 | 0.833
|
40874 | ],
|
40875 | y: [
|
40876 | 0.833
|
40877 | ]
|
40878 | },
|
40879 | o: {
|
40880 | x: [
|
40881 | 0.167
|
40882 | ],
|
40883 | y: [
|
40884 | 0.167
|
40885 | ]
|
40886 | },
|
40887 | n: [
|
40888 | "0p833_0p833_0p167_0p167"
|
40889 | ],
|
40890 | t: 135,
|
40891 | s: [
|
40892 | 0
|
40893 | ],
|
40894 | e: [
|
40895 | 30
|
40896 | ]
|
40897 | },
|
40898 | {
|
40899 | t: 150
|
40900 | }
|
40901 | ],
|
40902 | ix: 9
|
40903 | },
|
40904 | rz: {
|
40905 | a: 1,
|
40906 | k: [
|
40907 | {
|
40908 | i: {
|
40909 | x: [
|
40910 | 0.833
|
40911 | ],
|
40912 | y: [
|
40913 | 0.833
|
40914 | ]
|
40915 | },
|
40916 | o: {
|
40917 | x: [
|
40918 | 0.167
|
40919 | ],
|
40920 | y: [
|
40921 | 0.167
|
40922 | ]
|
40923 | },
|
40924 | n: [
|
40925 | "0p833_0p833_0p167_0p167"
|
40926 | ],
|
40927 | t: 90,
|
40928 | s: [
|
40929 | 53
|
40930 | ],
|
40931 | e: [
|
40932 | 0
|
40933 | ]
|
40934 | },
|
40935 | {
|
40936 | i: {
|
40937 | x: [
|
40938 | 0.833
|
40939 | ],
|
40940 | y: [
|
40941 | 0.833
|
40942 | ]
|
40943 | },
|
40944 | o: {
|
40945 | x: [
|
40946 | 0.167
|
40947 | ],
|
40948 | y: [
|
40949 | 0.167
|
40950 | ]
|
40951 | },
|
40952 | n: [
|
40953 | "0p833_0p833_0p167_0p167"
|
40954 | ],
|
40955 | t: 105,
|
40956 | s: [
|
40957 | 0
|
40958 | ],
|
40959 | e: [
|
40960 | 0
|
40961 | ]
|
40962 | },
|
40963 | {
|
40964 | i: {
|
40965 | x: [
|
40966 | 0.833
|
40967 | ],
|
40968 | y: [
|
40969 | 0.833
|
40970 | ]
|
40971 | },
|
40972 | o: {
|
40973 | x: [
|
40974 | 0.167
|
40975 | ],
|
40976 | y: [
|
40977 | 0.167
|
40978 | ]
|
40979 | },
|
40980 | n: [
|
40981 | "0p833_0p833_0p167_0p167"
|
40982 | ],
|
40983 | t: 135,
|
40984 | s: [
|
40985 | 0
|
40986 | ],
|
40987 | e: [
|
40988 | 53
|
40989 | ]
|
40990 | },
|
40991 | {
|
40992 | t: 150
|
40993 | }
|
40994 | ],
|
40995 | ix: 10
|
40996 | },
|
40997 | or: {
|
40998 | a: 0,
|
40999 | k: [
|
41000 | 0,
|
41001 | 0,
|
41002 | 0
|
41003 | ],
|
41004 | ix: 7
|
41005 | },
|
41006 | p: {
|
41007 | a: 0,
|
41008 | k: [
|
41009 | 13.625,
|
41010 | 106.25,
|
41011 | 0
|
41012 | ],
|
41013 | ix: 2
|
41014 | },
|
41015 | a: {
|
41016 | a: 0,
|
41017 | k: [
|
41018 | 12.875,
|
41019 | 7,
|
41020 | 0
|
41021 | ],
|
41022 | ix: 1
|
41023 | },
|
41024 | s: {
|
41025 | a: 0,
|
41026 | k: [
|
41027 | 100,
|
41028 | 100,
|
41029 | 100
|
41030 | ],
|
41031 | ix: 6
|
41032 | }
|
41033 | },
|
41034 | ao: 0,
|
41035 | ip: 90,
|
41036 | op: 150,
|
41037 | st: 0,
|
41038 | bm: 0
|
41039 | },
|
41040 | {
|
41041 | ddd: 1,
|
41042 | ind: 3,
|
41043 | ty: 2,
|
41044 | nm: "qube-icon-06.ai",
|
41045 | cl: "ai",
|
41046 | parent: 4,
|
41047 | refId: "image_2",
|
41048 | sr: 1,
|
41049 | ks: {
|
41050 | o: {
|
41051 | a: 1,
|
41052 | k: [
|
41053 | {
|
41054 | i: {
|
41055 | x: [
|
41056 | 0.833
|
41057 | ],
|
41058 | y: [
|
41059 | 0.833
|
41060 | ]
|
41061 | },
|
41062 | o: {
|
41063 | x: [
|
41064 | 0.167
|
41065 | ],
|
41066 | y: [
|
41067 | 0.167
|
41068 | ]
|
41069 | },
|
41070 | n: [
|
41071 | "0p833_0p833_0p167_0p167"
|
41072 | ],
|
41073 | t: 75,
|
41074 | s: [
|
41075 | 0
|
41076 | ],
|
41077 | e: [
|
41078 | 100
|
41079 | ]
|
41080 | },
|
41081 | {
|
41082 | i: {
|
41083 | x: [
|
41084 | 0.833
|
41085 | ],
|
41086 | y: [
|
41087 | 0.833
|
41088 | ]
|
41089 | },
|
41090 | o: {
|
41091 | x: [
|
41092 | 0.167
|
41093 | ],
|
41094 | y: [
|
41095 | 0.167
|
41096 | ]
|
41097 | },
|
41098 | n: [
|
41099 | "0p833_0p833_0p167_0p167"
|
41100 | ],
|
41101 | t: 90,
|
41102 | s: [
|
41103 | 100
|
41104 | ],
|
41105 | e: [
|
41106 | 100
|
41107 | ]
|
41108 | },
|
41109 | {
|
41110 | i: {
|
41111 | x: [
|
41112 | 0.833
|
41113 | ],
|
41114 | y: [
|
41115 | 0.833
|
41116 | ]
|
41117 | },
|
41118 | o: {
|
41119 | x: [
|
41120 | 0.167
|
41121 | ],
|
41122 | y: [
|
41123 | 0.167
|
41124 | ]
|
41125 | },
|
41126 | n: [
|
41127 | "0p833_0p833_0p167_0p167"
|
41128 | ],
|
41129 | t: 150,
|
41130 | s: [
|
41131 | 100
|
41132 | ],
|
41133 | e: [
|
41134 | 0
|
41135 | ]
|
41136 | },
|
41137 | {
|
41138 | t: 166
|
41139 | }
|
41140 | ],
|
41141 | ix: 11
|
41142 | },
|
41143 | rx: {
|
41144 | a: 1,
|
41145 | k: [
|
41146 | {
|
41147 | i: {
|
41148 | x: [
|
41149 | 0.833
|
41150 | ],
|
41151 | y: [
|
41152 | 0.833
|
41153 | ]
|
41154 | },
|
41155 | o: {
|
41156 | x: [
|
41157 | 0.167
|
41158 | ],
|
41159 | y: [
|
41160 | 0.167
|
41161 | ]
|
41162 | },
|
41163 | n: [
|
41164 | "0p833_0p833_0p167_0p167"
|
41165 | ],
|
41166 | t: 75,
|
41167 | s: [
|
41168 | 170
|
41169 | ],
|
41170 | e: [
|
41171 | 0
|
41172 | ]
|
41173 | },
|
41174 | {
|
41175 | i: {
|
41176 | x: [
|
41177 | 0.833
|
41178 | ],
|
41179 | y: [
|
41180 | 0.833
|
41181 | ]
|
41182 | },
|
41183 | o: {
|
41184 | x: [
|
41185 | 0.167
|
41186 | ],
|
41187 | y: [
|
41188 | 0.167
|
41189 | ]
|
41190 | },
|
41191 | n: [
|
41192 | "0p833_0p833_0p167_0p167"
|
41193 | ],
|
41194 | t: 90,
|
41195 | s: [
|
41196 | 0
|
41197 | ],
|
41198 | e: [
|
41199 | 0
|
41200 | ]
|
41201 | },
|
41202 | {
|
41203 | i: {
|
41204 | x: [
|
41205 | 0.833
|
41206 | ],
|
41207 | y: [
|
41208 | 0.833
|
41209 | ]
|
41210 | },
|
41211 | o: {
|
41212 | x: [
|
41213 | 0.167
|
41214 | ],
|
41215 | y: [
|
41216 | 0.167
|
41217 | ]
|
41218 | },
|
41219 | n: [
|
41220 | "0p833_0p833_0p167_0p167"
|
41221 | ],
|
41222 | t: 150,
|
41223 | s: [
|
41224 | 0
|
41225 | ],
|
41226 | e: [
|
41227 | 170
|
41228 | ]
|
41229 | },
|
41230 | {
|
41231 | t: 166
|
41232 | }
|
41233 | ],
|
41234 | ix: 8
|
41235 | },
|
41236 | ry: {
|
41237 | a: 0,
|
41238 | k: 0,
|
41239 | ix: 9
|
41240 | },
|
41241 | rz: {
|
41242 | a: 1,
|
41243 | k: [
|
41244 | {
|
41245 | i: {
|
41246 | x: [
|
41247 | 0.833
|
41248 | ],
|
41249 | y: [
|
41250 | 0.833
|
41251 | ]
|
41252 | },
|
41253 | o: {
|
41254 | x: [
|
41255 | 0.167
|
41256 | ],
|
41257 | y: [
|
41258 | 0.167
|
41259 | ]
|
41260 | },
|
41261 | n: [
|
41262 | "0p833_0p833_0p167_0p167"
|
41263 | ],
|
41264 | t: 75,
|
41265 | s: [
|
41266 | 60
|
41267 | ],
|
41268 | e: [
|
41269 | 0
|
41270 | ]
|
41271 | },
|
41272 | {
|
41273 | i: {
|
41274 | x: [
|
41275 | 0.833
|
41276 | ],
|
41277 | y: [
|
41278 | 0.833
|
41279 | ]
|
41280 | },
|
41281 | o: {
|
41282 | x: [
|
41283 | 0.167
|
41284 | ],
|
41285 | y: [
|
41286 | 0.167
|
41287 | ]
|
41288 | },
|
41289 | n: [
|
41290 | "0p833_0p833_0p167_0p167"
|
41291 | ],
|
41292 | t: 90,
|
41293 | s: [
|
41294 | 0
|
41295 | ],
|
41296 | e: [
|
41297 | 0
|
41298 | ]
|
41299 | },
|
41300 | {
|
41301 | i: {
|
41302 | x: [
|
41303 | 0.833
|
41304 | ],
|
41305 | y: [
|
41306 | 0.833
|
41307 | ]
|
41308 | },
|
41309 | o: {
|
41310 | x: [
|
41311 | 0.167
|
41312 | ],
|
41313 | y: [
|
41314 | 0.167
|
41315 | ]
|
41316 | },
|
41317 | n: [
|
41318 | "0p833_0p833_0p167_0p167"
|
41319 | ],
|
41320 | t: 150,
|
41321 | s: [
|
41322 | 0
|
41323 | ],
|
41324 | e: [
|
41325 | 60
|
41326 | ]
|
41327 | },
|
41328 | {
|
41329 | t: 166
|
41330 | }
|
41331 | ],
|
41332 | ix: 10
|
41333 | },
|
41334 | or: {
|
41335 | a: 0,
|
41336 | k: [
|
41337 | 0,
|
41338 | 0,
|
41339 | 0
|
41340 | ],
|
41341 | ix: 7
|
41342 | },
|
41343 | p: {
|
41344 | a: 0,
|
41345 | k: [
|
41346 | 85.719,
|
41347 | 65.781,
|
41348 | 0
|
41349 | ],
|
41350 | ix: 2
|
41351 | },
|
41352 | a: {
|
41353 | a: 0,
|
41354 | k: [
|
41355 | 11.5,
|
41356 | 9,
|
41357 | 0
|
41358 | ],
|
41359 | ix: 1
|
41360 | },
|
41361 | s: {
|
41362 | a: 0,
|
41363 | k: [
|
41364 | 100,
|
41365 | 100,
|
41366 | 100
|
41367 | ],
|
41368 | ix: 6
|
41369 | }
|
41370 | },
|
41371 | ao: 0,
|
41372 | ip: 75,
|
41373 | op: 166,
|
41374 | st: 0,
|
41375 | bm: 0
|
41376 | },
|
41377 | {
|
41378 | ddd: 1,
|
41379 | ind: 4,
|
41380 | ty: 2,
|
41381 | nm: "qube-icon-05.ai",
|
41382 | cl: "ai",
|
41383 | parent: 5,
|
41384 | refId: "image_3",
|
41385 | sr: 1,
|
41386 | ks: {
|
41387 | o: {
|
41388 | a: 1,
|
41389 | k: [
|
41390 | {
|
41391 | i: {
|
41392 | x: [
|
41393 | 0.833
|
41394 | ],
|
41395 | y: [
|
41396 | 0.833
|
41397 | ]
|
41398 | },
|
41399 | o: {
|
41400 | x: [
|
41401 | 0.167
|
41402 | ],
|
41403 | y: [
|
41404 | 0.167
|
41405 | ]
|
41406 | },
|
41407 | n: [
|
41408 | "0p833_0p833_0p167_0p167"
|
41409 | ],
|
41410 | t: 60,
|
41411 | s: [
|
41412 | 0
|
41413 | ],
|
41414 | e: [
|
41415 | 100
|
41416 | ]
|
41417 | },
|
41418 | {
|
41419 | i: {
|
41420 | x: [
|
41421 | 0.833
|
41422 | ],
|
41423 | y: [
|
41424 | 0.833
|
41425 | ]
|
41426 | },
|
41427 | o: {
|
41428 | x: [
|
41429 | 0.167
|
41430 | ],
|
41431 | y: [
|
41432 | 0.167
|
41433 | ]
|
41434 | },
|
41435 | n: [
|
41436 | "0p833_0p833_0p167_0p167"
|
41437 | ],
|
41438 | t: 75,
|
41439 | s: [
|
41440 | 100
|
41441 | ],
|
41442 | e: [
|
41443 | 100
|
41444 | ]
|
41445 | },
|
41446 | {
|
41447 | i: {
|
41448 | x: [
|
41449 | 0.833
|
41450 | ],
|
41451 | y: [
|
41452 | 0.833
|
41453 | ]
|
41454 | },
|
41455 | o: {
|
41456 | x: [
|
41457 | 0.167
|
41458 | ],
|
41459 | y: [
|
41460 | 0.167
|
41461 | ]
|
41462 | },
|
41463 | n: [
|
41464 | "0p833_0p833_0p167_0p167"
|
41465 | ],
|
41466 | t: 166,
|
41467 | s: [
|
41468 | 100
|
41469 | ],
|
41470 | e: [
|
41471 | 0
|
41472 | ]
|
41473 | },
|
41474 | {
|
41475 | t: 180
|
41476 | }
|
41477 | ],
|
41478 | ix: 11
|
41479 | },
|
41480 | rx: {
|
41481 | a: 0,
|
41482 | k: 0,
|
41483 | ix: 8
|
41484 | },
|
41485 | ry: {
|
41486 | a: 1,
|
41487 | k: [
|
41488 | {
|
41489 | i: {
|
41490 | x: [
|
41491 | 0.833
|
41492 | ],
|
41493 | y: [
|
41494 | 0.833
|
41495 | ]
|
41496 | },
|
41497 | o: {
|
41498 | x: [
|
41499 | 0.167
|
41500 | ],
|
41501 | y: [
|
41502 | 0.167
|
41503 | ]
|
41504 | },
|
41505 | n: [
|
41506 | "0p833_0p833_0p167_0p167"
|
41507 | ],
|
41508 | t: 60,
|
41509 | s: [
|
41510 | 170
|
41511 | ],
|
41512 | e: [
|
41513 | 0
|
41514 | ]
|
41515 | },
|
41516 | {
|
41517 | i: {
|
41518 | x: [
|
41519 | 0.833
|
41520 | ],
|
41521 | y: [
|
41522 | 0.833
|
41523 | ]
|
41524 | },
|
41525 | o: {
|
41526 | x: [
|
41527 | 0.167
|
41528 | ],
|
41529 | y: [
|
41530 | 0.167
|
41531 | ]
|
41532 | },
|
41533 | n: [
|
41534 | "0p833_0p833_0p167_0p167"
|
41535 | ],
|
41536 | t: 75,
|
41537 | s: [
|
41538 | 0
|
41539 | ],
|
41540 | e: [
|
41541 | 0
|
41542 | ]
|
41543 | },
|
41544 | {
|
41545 | i: {
|
41546 | x: [
|
41547 | 0.833
|
41548 | ],
|
41549 | y: [
|
41550 | 0.833
|
41551 | ]
|
41552 | },
|
41553 | o: {
|
41554 | x: [
|
41555 | 0.167
|
41556 | ],
|
41557 | y: [
|
41558 | 0.167
|
41559 | ]
|
41560 | },
|
41561 | n: [
|
41562 | "0p833_0p833_0p167_0p167"
|
41563 | ],
|
41564 | t: 166,
|
41565 | s: [
|
41566 | 0
|
41567 | ],
|
41568 | e: [
|
41569 | 170
|
41570 | ]
|
41571 | },
|
41572 | {
|
41573 | t: 180
|
41574 | }
|
41575 | ],
|
41576 | ix: 9
|
41577 | },
|
41578 | rz: {
|
41579 | a: 0,
|
41580 | k: 0,
|
41581 | ix: 10
|
41582 | },
|
41583 | or: {
|
41584 | a: 0,
|
41585 | k: [
|
41586 | 0,
|
41587 | 0,
|
41588 | 0
|
41589 | ],
|
41590 | ix: 7
|
41591 | },
|
41592 | p: {
|
41593 | a: 0,
|
41594 | k: [
|
41595 | 99.25,
|
41596 | 15,
|
41597 | 0
|
41598 | ],
|
41599 | ix: 2
|
41600 | },
|
41601 | a: {
|
41602 | a: 0,
|
41603 | k: [
|
41604 | 0,
|
41605 | 15,
|
41606 | 0
|
41607 | ],
|
41608 | ix: 1
|
41609 | },
|
41610 | s: {
|
41611 | a: 0,
|
41612 | k: [
|
41613 | 100,
|
41614 | 100,
|
41615 | 100
|
41616 | ],
|
41617 | ix: 6
|
41618 | }
|
41619 | },
|
41620 | ao: 0,
|
41621 | ip: 60,
|
41622 | op: 180,
|
41623 | st: 0,
|
41624 | bm: 0
|
41625 | },
|
41626 | {
|
41627 | ddd: 1,
|
41628 | ind: 5,
|
41629 | ty: 2,
|
41630 | nm: "qube-icon-04.ai",
|
41631 | cl: "ai",
|
41632 | parent: 6,
|
41633 | refId: "image_4",
|
41634 | sr: 1,
|
41635 | ks: {
|
41636 | o: {
|
41637 | a: 1,
|
41638 | k: [
|
41639 | {
|
41640 | i: {
|
41641 | x: [
|
41642 | 0.833
|
41643 | ],
|
41644 | y: [
|
41645 | 0.833
|
41646 | ]
|
41647 | },
|
41648 | o: {
|
41649 | x: [
|
41650 | 0.167
|
41651 | ],
|
41652 | y: [
|
41653 | 0.167
|
41654 | ]
|
41655 | },
|
41656 | n: [
|
41657 | "0p833_0p833_0p167_0p167"
|
41658 | ],
|
41659 | t: 45,
|
41660 | s: [
|
41661 | 0
|
41662 | ],
|
41663 | e: [
|
41664 | 100
|
41665 | ]
|
41666 | },
|
41667 | {
|
41668 | i: {
|
41669 | x: [
|
41670 | 0.833
|
41671 | ],
|
41672 | y: [
|
41673 | 0.833
|
41674 | ]
|
41675 | },
|
41676 | o: {
|
41677 | x: [
|
41678 | 0.167
|
41679 | ],
|
41680 | y: [
|
41681 | 0.167
|
41682 | ]
|
41683 | },
|
41684 | n: [
|
41685 | "0p833_0p833_0p167_0p167"
|
41686 | ],
|
41687 | t: 60,
|
41688 | s: [
|
41689 | 100
|
41690 | ],
|
41691 | e: [
|
41692 | 100
|
41693 | ]
|
41694 | },
|
41695 | {
|
41696 | i: {
|
41697 | x: [
|
41698 | 0.833
|
41699 | ],
|
41700 | y: [
|
41701 | 0.833
|
41702 | ]
|
41703 | },
|
41704 | o: {
|
41705 | x: [
|
41706 | 0.167
|
41707 | ],
|
41708 | y: [
|
41709 | 0.167
|
41710 | ]
|
41711 | },
|
41712 | n: [
|
41713 | "0p833_0p833_0p167_0p167"
|
41714 | ],
|
41715 | t: 180,
|
41716 | s: [
|
41717 | 100
|
41718 | ],
|
41719 | e: [
|
41720 | 0
|
41721 | ]
|
41722 | },
|
41723 | {
|
41724 | t: 195
|
41725 | }
|
41726 | ],
|
41727 | ix: 11
|
41728 | },
|
41729 | rx: {
|
41730 | a: 1,
|
41731 | k: [
|
41732 | {
|
41733 | i: {
|
41734 | x: [
|
41735 | 0.833
|
41736 | ],
|
41737 | y: [
|
41738 | 0.833
|
41739 | ]
|
41740 | },
|
41741 | o: {
|
41742 | x: [
|
41743 | 0.167
|
41744 | ],
|
41745 | y: [
|
41746 | 0.167
|
41747 | ]
|
41748 | },
|
41749 | n: [
|
41750 | "0p833_0p833_0p167_0p167"
|
41751 | ],
|
41752 | t: 45,
|
41753 | s: [
|
41754 | 170
|
41755 | ],
|
41756 | e: [
|
41757 | 0
|
41758 | ]
|
41759 | },
|
41760 | {
|
41761 | i: {
|
41762 | x: [
|
41763 | 0.833
|
41764 | ],
|
41765 | y: [
|
41766 | 0.833
|
41767 | ]
|
41768 | },
|
41769 | o: {
|
41770 | x: [
|
41771 | 0.167
|
41772 | ],
|
41773 | y: [
|
41774 | 0.167
|
41775 | ]
|
41776 | },
|
41777 | n: [
|
41778 | "0p833_0p833_0p167_0p167"
|
41779 | ],
|
41780 | t: 60,
|
41781 | s: [
|
41782 | 0
|
41783 | ],
|
41784 | e: [
|
41785 | 0
|
41786 | ]
|
41787 | },
|
41788 | {
|
41789 | i: {
|
41790 | x: [
|
41791 | 0.833
|
41792 | ],
|
41793 | y: [
|
41794 | 0.833
|
41795 | ]
|
41796 | },
|
41797 | o: {
|
41798 | x: [
|
41799 | 0.167
|
41800 | ],
|
41801 | y: [
|
41802 | 0.167
|
41803 | ]
|
41804 | },
|
41805 | n: [
|
41806 | "0p833_0p833_0p167_0p167"
|
41807 | ],
|
41808 | t: 180,
|
41809 | s: [
|
41810 | 0
|
41811 | ],
|
41812 | e: [
|
41813 | 170
|
41814 | ]
|
41815 | },
|
41816 | {
|
41817 | t: 195
|
41818 | }
|
41819 | ],
|
41820 | ix: 8
|
41821 | },
|
41822 | ry: {
|
41823 | a: 0,
|
41824 | k: 0,
|
41825 | ix: 9
|
41826 | },
|
41827 | rz: {
|
41828 | a: 1,
|
41829 | k: [
|
41830 | {
|
41831 | i: {
|
41832 | x: [
|
41833 | 0.833
|
41834 | ],
|
41835 | y: [
|
41836 | 0.833
|
41837 | ]
|
41838 | },
|
41839 | o: {
|
41840 | x: [
|
41841 | 0.167
|
41842 | ],
|
41843 | y: [
|
41844 | 0.167
|
41845 | ]
|
41846 | },
|
41847 | n: [
|
41848 | "0p833_0p833_0p167_0p167"
|
41849 | ],
|
41850 | t: 45,
|
41851 | s: [
|
41852 | -60
|
41853 | ],
|
41854 | e: [
|
41855 | 0
|
41856 | ]
|
41857 | },
|
41858 | {
|
41859 | i: {
|
41860 | x: [
|
41861 | 0.833
|
41862 | ],
|
41863 | y: [
|
41864 | 0.833
|
41865 | ]
|
41866 | },
|
41867 | o: {
|
41868 | x: [
|
41869 | 0.167
|
41870 | ],
|
41871 | y: [
|
41872 | 0.167
|
41873 | ]
|
41874 | },
|
41875 | n: [
|
41876 | "0p833_0p833_0p167_0p167"
|
41877 | ],
|
41878 | t: 60,
|
41879 | s: [
|
41880 | 0
|
41881 | ],
|
41882 | e: [
|
41883 | 0
|
41884 | ]
|
41885 | },
|
41886 | {
|
41887 | i: {
|
41888 | x: [
|
41889 | 0.833
|
41890 | ],
|
41891 | y: [
|
41892 | 0.833
|
41893 | ]
|
41894 | },
|
41895 | o: {
|
41896 | x: [
|
41897 | 0.167
|
41898 | ],
|
41899 | y: [
|
41900 | 0.167
|
41901 | ]
|
41902 | },
|
41903 | n: [
|
41904 | "0p833_0p833_0p167_0p167"
|
41905 | ],
|
41906 | t: 180,
|
41907 | s: [
|
41908 | 0
|
41909 | ],
|
41910 | e: [
|
41911 | -60
|
41912 | ]
|
41913 | },
|
41914 | {
|
41915 | t: 195
|
41916 | }
|
41917 | ],
|
41918 | ix: 10
|
41919 | },
|
41920 | or: {
|
41921 | a: 0,
|
41922 | k: [
|
41923 | 0,
|
41924 | 0,
|
41925 | 0
|
41926 | ],
|
41927 | ix: 7
|
41928 | },
|
41929 | p: {
|
41930 | a: 0,
|
41931 | k: [
|
41932 | 13.25,
|
41933 | 7.75,
|
41934 | 0
|
41935 | ],
|
41936 | ix: 2
|
41937 | },
|
41938 | a: {
|
41939 | a: 0,
|
41940 | k: [
|
41941 | 13.375,
|
41942 | 64.5,
|
41943 | 0
|
41944 | ],
|
41945 | ix: 1
|
41946 | },
|
41947 | s: {
|
41948 | a: 0,
|
41949 | k: [
|
41950 | 100,
|
41951 | 100,
|
41952 | 100
|
41953 | ],
|
41954 | ix: 6
|
41955 | }
|
41956 | },
|
41957 | ao: 0,
|
41958 | ip: 45,
|
41959 | op: 195,
|
41960 | st: 0,
|
41961 | bm: 0
|
41962 | },
|
41963 | {
|
41964 | ddd: 1,
|
41965 | ind: 6,
|
41966 | ty: 2,
|
41967 | nm: "qube-icon-03.ai",
|
41968 | cl: "ai",
|
41969 | parent: 7,
|
41970 | refId: "image_5",
|
41971 | sr: 1,
|
41972 | ks: {
|
41973 | o: {
|
41974 | a: 1,
|
41975 | k: [
|
41976 | {
|
41977 | i: {
|
41978 | x: [
|
41979 | 0.833
|
41980 | ],
|
41981 | y: [
|
41982 | 0.833
|
41983 | ]
|
41984 | },
|
41985 | o: {
|
41986 | x: [
|
41987 | 0.167
|
41988 | ],
|
41989 | y: [
|
41990 | 0.167
|
41991 | ]
|
41992 | },
|
41993 | n: [
|
41994 | "0p833_0p833_0p167_0p167"
|
41995 | ],
|
41996 | t: 30,
|
41997 | s: [
|
41998 | 0
|
41999 | ],
|
42000 | e: [
|
42001 | 100
|
42002 | ]
|
42003 | },
|
42004 | {
|
42005 | i: {
|
42006 | x: [
|
42007 | 0.833
|
42008 | ],
|
42009 | y: [
|
42010 | 0.833
|
42011 | ]
|
42012 | },
|
42013 | o: {
|
42014 | x: [
|
42015 | 0.167
|
42016 | ],
|
42017 | y: [
|
42018 | 0.167
|
42019 | ]
|
42020 | },
|
42021 | n: [
|
42022 | "0p833_0p833_0p167_0p167"
|
42023 | ],
|
42024 | t: 45,
|
42025 | s: [
|
42026 | 100
|
42027 | ],
|
42028 | e: [
|
42029 | 100
|
42030 | ]
|
42031 | },
|
42032 | {
|
42033 | i: {
|
42034 | x: [
|
42035 | 0.833
|
42036 | ],
|
42037 | y: [
|
42038 | 0.833
|
42039 | ]
|
42040 | },
|
42041 | o: {
|
42042 | x: [
|
42043 | 0.167
|
42044 | ],
|
42045 | y: [
|
42046 | 0.167
|
42047 | ]
|
42048 | },
|
42049 | n: [
|
42050 | "0p833_0p833_0p167_0p167"
|
42051 | ],
|
42052 | t: 195,
|
42053 | s: [
|
42054 | 100
|
42055 | ],
|
42056 | e: [
|
42057 | 0
|
42058 | ]
|
42059 | },
|
42060 | {
|
42061 | t: 211
|
42062 | }
|
42063 | ],
|
42064 | ix: 11
|
42065 | },
|
42066 | rx: {
|
42067 | a: 1,
|
42068 | k: [
|
42069 | {
|
42070 | i: {
|
42071 | x: [
|
42072 | 0.833
|
42073 | ],
|
42074 | y: [
|
42075 | 0.833
|
42076 | ]
|
42077 | },
|
42078 | o: {
|
42079 | x: [
|
42080 | 0.167
|
42081 | ],
|
42082 | y: [
|
42083 | 0.167
|
42084 | ]
|
42085 | },
|
42086 | n: [
|
42087 | "0p833_0p833_0p167_0p167"
|
42088 | ],
|
42089 | t: 30,
|
42090 | s: [
|
42091 | 170
|
42092 | ],
|
42093 | e: [
|
42094 | 0
|
42095 | ]
|
42096 | },
|
42097 | {
|
42098 | i: {
|
42099 | x: [
|
42100 | 0.833
|
42101 | ],
|
42102 | y: [
|
42103 | 0.833
|
42104 | ]
|
42105 | },
|
42106 | o: {
|
42107 | x: [
|
42108 | 0.167
|
42109 | ],
|
42110 | y: [
|
42111 | 0.167
|
42112 | ]
|
42113 | },
|
42114 | n: [
|
42115 | "0p833_0p833_0p167_0p167"
|
42116 | ],
|
42117 | t: 45,
|
42118 | s: [
|
42119 | 0
|
42120 | ],
|
42121 | e: [
|
42122 | 0
|
42123 | ]
|
42124 | },
|
42125 | {
|
42126 | i: {
|
42127 | x: [
|
42128 | 0.833
|
42129 | ],
|
42130 | y: [
|
42131 | 0.833
|
42132 | ]
|
42133 | },
|
42134 | o: {
|
42135 | x: [
|
42136 | 0.167
|
42137 | ],
|
42138 | y: [
|
42139 | 0.167
|
42140 | ]
|
42141 | },
|
42142 | n: [
|
42143 | "0p833_0p833_0p167_0p167"
|
42144 | ],
|
42145 | t: 195,
|
42146 | s: [
|
42147 | 0
|
42148 | ],
|
42149 | e: [
|
42150 | 170
|
42151 | ]
|
42152 | },
|
42153 | {
|
42154 | t: 211
|
42155 | }
|
42156 | ],
|
42157 | ix: 8
|
42158 | },
|
42159 | ry: {
|
42160 | a: 0,
|
42161 | k: 0,
|
42162 | ix: 9
|
42163 | },
|
42164 | rz: {
|
42165 | a: 1,
|
42166 | k: [
|
42167 | {
|
42168 | i: {
|
42169 | x: [
|
42170 | 0.833
|
42171 | ],
|
42172 | y: [
|
42173 | 0.833
|
42174 | ]
|
42175 | },
|
42176 | o: {
|
42177 | x: [
|
42178 | 0.167
|
42179 | ],
|
42180 | y: [
|
42181 | 0.167
|
42182 | ]
|
42183 | },
|
42184 | n: [
|
42185 | "0p833_0p833_0p167_0p167"
|
42186 | ],
|
42187 | t: 30,
|
42188 | s: [
|
42189 | 60
|
42190 | ],
|
42191 | e: [
|
42192 | 0
|
42193 | ]
|
42194 | },
|
42195 | {
|
42196 | i: {
|
42197 | x: [
|
42198 | 0.833
|
42199 | ],
|
42200 | y: [
|
42201 | 0.833
|
42202 | ]
|
42203 | },
|
42204 | o: {
|
42205 | x: [
|
42206 | 0.167
|
42207 | ],
|
42208 | y: [
|
42209 | 0.167
|
42210 | ]
|
42211 | },
|
42212 | n: [
|
42213 | "0p833_0p833_0p167_0p167"
|
42214 | ],
|
42215 | t: 45,
|
42216 | s: [
|
42217 | 0
|
42218 | ],
|
42219 | e: [
|
42220 | 0
|
42221 | ]
|
42222 | },
|
42223 | {
|
42224 | i: {
|
42225 | x: [
|
42226 | 0.833
|
42227 | ],
|
42228 | y: [
|
42229 | 0.833
|
42230 | ]
|
42231 | },
|
42232 | o: {
|
42233 | x: [
|
42234 | 0.167
|
42235 | ],
|
42236 | y: [
|
42237 | 0.167
|
42238 | ]
|
42239 | },
|
42240 | n: [
|
42241 | "0p833_0p833_0p167_0p167"
|
42242 | ],
|
42243 | t: 195,
|
42244 | s: [
|
42245 | 0
|
42246 | ],
|
42247 | e: [
|
42248 | 60
|
42249 | ]
|
42250 | },
|
42251 | {
|
42252 | t: 211
|
42253 | }
|
42254 | ],
|
42255 | ix: 10
|
42256 | },
|
42257 | or: {
|
42258 | a: 0,
|
42259 | k: [
|
42260 | 0,
|
42261 | 0,
|
42262 | 0
|
42263 | ],
|
42264 | ix: 7
|
42265 | },
|
42266 | p: {
|
42267 | a: 0,
|
42268 | k: [
|
42269 | 12.625,
|
42270 | 5,
|
42271 | 0
|
42272 | ],
|
42273 | ix: 2
|
42274 | },
|
42275 | a: {
|
42276 | a: 0,
|
42277 | k: [
|
42278 | 13,
|
42279 | 93.5,
|
42280 | 0
|
42281 | ],
|
42282 | ix: 1
|
42283 | },
|
42284 | s: {
|
42285 | a: 0,
|
42286 | k: [
|
42287 | 100,
|
42288 | 100,
|
42289 | 100
|
42290 | ],
|
42291 | ix: 6
|
42292 | }
|
42293 | },
|
42294 | ao: 0,
|
42295 | ip: 30,
|
42296 | op: 211,
|
42297 | st: 0,
|
42298 | bm: 0
|
42299 | },
|
42300 | {
|
42301 | ddd: 1,
|
42302 | ind: 7,
|
42303 | ty: 2,
|
42304 | nm: "qube-icon-02.ai",
|
42305 | cl: "ai",
|
42306 | parent: 8,
|
42307 | refId: "image_6",
|
42308 | sr: 1,
|
42309 | ks: {
|
42310 | o: {
|
42311 | a: 1,
|
42312 | k: [
|
42313 | {
|
42314 | i: {
|
42315 | x: [
|
42316 | 0.833
|
42317 | ],
|
42318 | y: [
|
42319 | 0.833
|
42320 | ]
|
42321 | },
|
42322 | o: {
|
42323 | x: [
|
42324 | 0.167
|
42325 | ],
|
42326 | y: [
|
42327 | 0.167
|
42328 | ]
|
42329 | },
|
42330 | n: [
|
42331 | "0p833_0p833_0p167_0p167"
|
42332 | ],
|
42333 | t: 15,
|
42334 | s: [
|
42335 | 0
|
42336 | ],
|
42337 | e: [
|
42338 | 100
|
42339 | ]
|
42340 | },
|
42341 | {
|
42342 | i: {
|
42343 | x: [
|
42344 | 0.833
|
42345 | ],
|
42346 | y: [
|
42347 | 0.833
|
42348 | ]
|
42349 | },
|
42350 | o: {
|
42351 | x: [
|
42352 | 0.167
|
42353 | ],
|
42354 | y: [
|
42355 | 0.167
|
42356 | ]
|
42357 | },
|
42358 | n: [
|
42359 | "0p833_0p833_0p167_0p167"
|
42360 | ],
|
42361 | t: 30,
|
42362 | s: [
|
42363 | 100
|
42364 | ],
|
42365 | e: [
|
42366 | 100
|
42367 | ]
|
42368 | },
|
42369 | {
|
42370 | i: {
|
42371 | x: [
|
42372 | 0.833
|
42373 | ],
|
42374 | y: [
|
42375 | 0.833
|
42376 | ]
|
42377 | },
|
42378 | o: {
|
42379 | x: [
|
42380 | 0.167
|
42381 | ],
|
42382 | y: [
|
42383 | 0.167
|
42384 | ]
|
42385 | },
|
42386 | n: [
|
42387 | "0p833_0p833_0p167_0p167"
|
42388 | ],
|
42389 | t: 211,
|
42390 | s: [
|
42391 | 100
|
42392 | ],
|
42393 | e: [
|
42394 | 0
|
42395 | ]
|
42396 | },
|
42397 | {
|
42398 | t: 225
|
42399 | }
|
42400 | ],
|
42401 | ix: 11
|
42402 | },
|
42403 | rx: {
|
42404 | a: 0,
|
42405 | k: 0,
|
42406 | ix: 8
|
42407 | },
|
42408 | ry: {
|
42409 | a: 1,
|
42410 | k: [
|
42411 | {
|
42412 | i: {
|
42413 | x: [
|
42414 | 0.833
|
42415 | ],
|
42416 | y: [
|
42417 | 0.833
|
42418 | ]
|
42419 | },
|
42420 | o: {
|
42421 | x: [
|
42422 | 0.167
|
42423 | ],
|
42424 | y: [
|
42425 | 0.167
|
42426 | ]
|
42427 | },
|
42428 | n: [
|
42429 | "0p833_0p833_0p167_0p167"
|
42430 | ],
|
42431 | t: 15,
|
42432 | s: [
|
42433 | -180
|
42434 | ],
|
42435 | e: [
|
42436 | 0
|
42437 | ]
|
42438 | },
|
42439 | {
|
42440 | i: {
|
42441 | x: [
|
42442 | 0.833
|
42443 | ],
|
42444 | y: [
|
42445 | 0.833
|
42446 | ]
|
42447 | },
|
42448 | o: {
|
42449 | x: [
|
42450 | 0.167
|
42451 | ],
|
42452 | y: [
|
42453 | 0.167
|
42454 | ]
|
42455 | },
|
42456 | n: [
|
42457 | "0p833_0p833_0p167_0p167"
|
42458 | ],
|
42459 | t: 30,
|
42460 | s: [
|
42461 | 0
|
42462 | ],
|
42463 | e: [
|
42464 | 0
|
42465 | ]
|
42466 | },
|
42467 | {
|
42468 | i: {
|
42469 | x: [
|
42470 | 0.833
|
42471 | ],
|
42472 | y: [
|
42473 | 0.833
|
42474 | ]
|
42475 | },
|
42476 | o: {
|
42477 | x: [
|
42478 | 0.167
|
42479 | ],
|
42480 | y: [
|
42481 | 0.167
|
42482 | ]
|
42483 | },
|
42484 | n: [
|
42485 | "0p833_0p833_0p167_0p167"
|
42486 | ],
|
42487 | t: 211,
|
42488 | s: [
|
42489 | 0
|
42490 | ],
|
42491 | e: [
|
42492 | 180
|
42493 | ]
|
42494 | },
|
42495 | {
|
42496 | t: 225
|
42497 | }
|
42498 | ],
|
42499 | ix: 9
|
42500 | },
|
42501 | rz: {
|
42502 | a: 0,
|
42503 | k: 0,
|
42504 | ix: 10
|
42505 | },
|
42506 | or: {
|
42507 | a: 0,
|
42508 | k: [
|
42509 | 0,
|
42510 | 0,
|
42511 | 0
|
42512 | ],
|
42513 | ix: 7
|
42514 | },
|
42515 | p: {
|
42516 | a: 0,
|
42517 | k: [
|
42518 | -0.375,
|
42519 | 39.875,
|
42520 | 0
|
42521 | ],
|
42522 | ix: 2
|
42523 | },
|
42524 | a: {
|
42525 | a: 0,
|
42526 | k: [
|
42527 | 99.375,
|
42528 | 54.625,
|
42529 | 0
|
42530 | ],
|
42531 | ix: 1
|
42532 | },
|
42533 | s: {
|
42534 | a: 0,
|
42535 | k: [
|
42536 | 100,
|
42537 | 100,
|
42538 | 100
|
42539 | ],
|
42540 | ix: 6
|
42541 | }
|
42542 | },
|
42543 | ao: 0,
|
42544 | ip: 15,
|
42545 | op: 225,
|
42546 | st: 0,
|
42547 | bm: 0
|
42548 | },
|
42549 | {
|
42550 | ddd: 1,
|
42551 | ind: 8,
|
42552 | ty: 2,
|
42553 | nm: "qube-icon-01.ai",
|
42554 | cl: "ai",
|
42555 | refId: "image_7",
|
42556 | sr: 1,
|
42557 | ks: {
|
42558 | o: {
|
42559 | a: 1,
|
42560 | k: [
|
42561 | {
|
42562 | i: {
|
42563 | x: [
|
42564 | 0.833
|
42565 | ],
|
42566 | y: [
|
42567 | 0.833
|
42568 | ]
|
42569 | },
|
42570 | o: {
|
42571 | x: [
|
42572 | 0.167
|
42573 | ],
|
42574 | y: [
|
42575 | 0.167
|
42576 | ]
|
42577 | },
|
42578 | n: [
|
42579 | "0p833_0p833_0p167_0p167"
|
42580 | ],
|
42581 | t: 0,
|
42582 | s: [
|
42583 | 0
|
42584 | ],
|
42585 | e: [
|
42586 | 100
|
42587 | ]
|
42588 | },
|
42589 | {
|
42590 | i: {
|
42591 | x: [
|
42592 | 0.833
|
42593 | ],
|
42594 | y: [
|
42595 | 0.833
|
42596 | ]
|
42597 | },
|
42598 | o: {
|
42599 | x: [
|
42600 | 0.167
|
42601 | ],
|
42602 | y: [
|
42603 | 0.167
|
42604 | ]
|
42605 | },
|
42606 | n: [
|
42607 | "0p833_0p833_0p167_0p167"
|
42608 | ],
|
42609 | t: 15,
|
42610 | s: [
|
42611 | 100
|
42612 | ],
|
42613 | e: [
|
42614 | 100
|
42615 | ]
|
42616 | },
|
42617 | {
|
42618 | i: {
|
42619 | x: [
|
42620 | 0.833
|
42621 | ],
|
42622 | y: [
|
42623 | 0.833
|
42624 | ]
|
42625 | },
|
42626 | o: {
|
42627 | x: [
|
42628 | 0.167
|
42629 | ],
|
42630 | y: [
|
42631 | 0.167
|
42632 | ]
|
42633 | },
|
42634 | n: [
|
42635 | "0p833_0p833_0p167_0p167"
|
42636 | ],
|
42637 | t: 225,
|
42638 | s: [
|
42639 | 100
|
42640 | ],
|
42641 | e: [
|
42642 | 0
|
42643 | ]
|
42644 | },
|
42645 | {
|
42646 | t: 239
|
42647 | }
|
42648 | ],
|
42649 | ix: 11
|
42650 | },
|
42651 | rx: {
|
42652 | a: 1,
|
42653 | k: [
|
42654 | {
|
42655 | i: {
|
42656 | x: [
|
42657 | 0.833
|
42658 | ],
|
42659 | y: [
|
42660 | 0.833
|
42661 | ]
|
42662 | },
|
42663 | o: {
|
42664 | x: [
|
42665 | 0.167
|
42666 | ],
|
42667 | y: [
|
42668 | 0.167
|
42669 | ]
|
42670 | },
|
42671 | n: [
|
42672 | "0p833_0p833_0p167_0p167"
|
42673 | ],
|
42674 | t: 0,
|
42675 | s: [
|
42676 | 85
|
42677 | ],
|
42678 | e: [
|
42679 | 0
|
42680 | ]
|
42681 | },
|
42682 | {
|
42683 | i: {
|
42684 | x: [
|
42685 | 0.833
|
42686 | ],
|
42687 | y: [
|
42688 | 0.833
|
42689 | ]
|
42690 | },
|
42691 | o: {
|
42692 | x: [
|
42693 | 0.167
|
42694 | ],
|
42695 | y: [
|
42696 | 0.167
|
42697 | ]
|
42698 | },
|
42699 | n: [
|
42700 | "0p833_0p833_0p167_0p167"
|
42701 | ],
|
42702 | t: 15,
|
42703 | s: [
|
42704 | 0
|
42705 | ],
|
42706 | e: [
|
42707 | 0
|
42708 | ]
|
42709 | },
|
42710 | {
|
42711 | i: {
|
42712 | x: [
|
42713 | 0.833
|
42714 | ],
|
42715 | y: [
|
42716 | 0.833
|
42717 | ]
|
42718 | },
|
42719 | o: {
|
42720 | x: [
|
42721 | 0.167
|
42722 | ],
|
42723 | y: [
|
42724 | 0.167
|
42725 | ]
|
42726 | },
|
42727 | n: [
|
42728 | "0p833_0p833_0p167_0p167"
|
42729 | ],
|
42730 | t: 225,
|
42731 | s: [
|
42732 | 0
|
42733 | ],
|
42734 | e: [
|
42735 | 85
|
42736 | ]
|
42737 | },
|
42738 | {
|
42739 | t: 239
|
42740 | }
|
42741 | ],
|
42742 | ix: 8
|
42743 | },
|
42744 | ry: {
|
42745 | a: 0,
|
42746 | k: 0,
|
42747 | ix: 9
|
42748 | },
|
42749 | rz: {
|
42750 | a: 0,
|
42751 | k: 0,
|
42752 | ix: 10
|
42753 | },
|
42754 | or: {
|
42755 | a: 0,
|
42756 | k: [
|
42757 | 0,
|
42758 | 0,
|
42759 | 0
|
42760 | ],
|
42761 | ix: 7
|
42762 | },
|
42763 | p: {
|
42764 | a: 0,
|
42765 | k: [
|
42766 | 282,
|
42767 | 330,
|
42768 | 0
|
42769 | ],
|
42770 | ix: 2
|
42771 | },
|
42772 | a: {
|
42773 | a: 0,
|
42774 | k: [
|
42775 | 48.75,
|
42776 | 0,
|
42777 | 0
|
42778 | ],
|
42779 | ix: 1
|
42780 | },
|
42781 | s: {
|
42782 | a: 0,
|
42783 | k: [
|
42784 | 100,
|
42785 | 100,
|
42786 | 100
|
42787 | ],
|
42788 | ix: 6
|
42789 | }
|
42790 | },
|
42791 | ao: 0,
|
42792 | ip: 0,
|
42793 | op: 240,
|
42794 | st: 0,
|
42795 | bm: 0
|
42796 | }
|
42797 | ];
|
42798 | var markers$1 = [
|
42799 | ];
|
42800 | var whiteAnimation = {
|
42801 | v: v$1,
|
42802 | fr: fr$1,
|
42803 | ip: ip$1,
|
42804 | op: op$1,
|
42805 | w: w$1,
|
42806 | h: h$1,
|
42807 | nm: nm$1,
|
42808 | ddd: ddd$1,
|
42809 | assets: assets$1,
|
42810 | layers: layers$1,
|
42811 | markers: markers$1
|
42812 | };
|
42813 |
|
42814 | function _templateObject$14() {
|
42815 | var data = taggedTemplateLiteralLoose(["\n\twidth: ", ";\n\theight: ", ";\n"]);
|
42816 |
|
42817 | _templateObject$14 = function _templateObject() {
|
42818 | return data;
|
42819 | };
|
42820 |
|
42821 | return data;
|
42822 | }
|
42823 | var LoadingDiv = styled.div(_templateObject$14(), function (_ref) {
|
42824 | var size = _ref.size;
|
42825 | return size || '200px';
|
42826 | }, function (_ref2) {
|
42827 | var size = _ref2.size;
|
42828 | return size || '200px';
|
42829 | });
|
42830 |
|
42831 | var Loading =
|
42832 | /*#__PURE__*/
|
42833 | function (_Component) {
|
42834 | inheritsLoose(Loading, _Component);
|
42835 |
|
42836 | function Loading() {
|
42837 | return _Component.apply(this, arguments) || this;
|
42838 | }
|
42839 |
|
42840 | var _proto = Loading.prototype;
|
42841 |
|
42842 | _proto.componentDidMount = function componentDidMount() {
|
42843 | var color = this.props.color;
|
42844 | lottie.loadAnimation({
|
42845 | container: this.loadingContainer,
|
42846 | renderer: 'svg',
|
42847 | loop: true,
|
42848 | autoplay: true,
|
42849 | animationData: color === 'white' ? whiteAnimation : blueAnimation
|
42850 | });
|
42851 | };
|
42852 |
|
42853 | _proto.render = function render() {
|
42854 | var _this = this;
|
42855 |
|
42856 | return React.createElement(LoadingDiv, _extends_1({
|
42857 | className: "loading-animated-qube",
|
42858 | ref: function ref(el) {
|
42859 | return _this.loadingContainer = el;
|
42860 | }
|
42861 | }, this.props));
|
42862 | };
|
42863 |
|
42864 | return Loading;
|
42865 | }(Component);
|
42866 |
|
42867 | Loading.defaultProps = {
|
42868 | color: 'blue'
|
42869 | };
|
42870 | Loading.displayName = 'Loading';
|
42871 | Loading.propTypes = {
|
42872 | color: PropTypes.oneOf(['white', 'blue'])
|
42873 | };
|
42874 |
|
42875 | function _templateObject$15() {
|
42876 | var data = taggedTemplateLiteralLoose(["\n\tposition: absolute;\n\tdisplay: ", ";\n\n\twidth: 100%;\n\theight: 100%;\n\tbackground: rgba(255, 255, 255, 0.8);\n"]);
|
42877 |
|
42878 | _templateObject$15 = function _templateObject() {
|
42879 | return data;
|
42880 | };
|
42881 |
|
42882 | return data;
|
42883 | }
|
42884 | var ModalLoading = styled.div(_templateObject$15(), function (_ref) {
|
42885 | var active = _ref.active;
|
42886 | return active ? 'block' : 'none';
|
42887 | });
|
42888 |
|
42889 | var LoadingModal = function LoadingModal(props) {
|
42890 | return React.createElement(ModalLoading, props, React.createElement(CenteredGrid, {
|
42891 | width: "100%",
|
42892 | height: "100%"
|
42893 | }, React.createElement(Loading, {
|
42894 | style: {
|
42895 | margin: 'auto'
|
42896 | },
|
42897 | size: "200px"
|
42898 | })));
|
42899 | };
|
42900 |
|
42901 | LoadingModal.displayName = 'Loading';
|
42902 | LoadingModal.propTypes = {
|
42903 | active: PropTypes.bool.isRequired
|
42904 | };
|
42905 |
|
42906 | function _templateObject$16() {
|
42907 | var data = taggedTemplateLiteralLoose(["\n\tborder-top: 1px solid #ddd;\n"]);
|
42908 |
|
42909 | _templateObject$16 = function _templateObject() {
|
42910 | return data;
|
42911 | };
|
42912 |
|
42913 | return data;
|
42914 | }
|
42915 | var ListHeaderContainer = styled(Grid)(_templateObject$16());
|
42916 |
|
42917 | function _templateObject$17() {
|
42918 | var data = taggedTemplateLiteralLoose(["\n\ttext-align: end;\n"]);
|
42919 |
|
42920 | _templateObject$17 = function _templateObject() {
|
42921 | return data;
|
42922 | };
|
42923 |
|
42924 | return data;
|
42925 | }
|
42926 | var ListHeaderPaginationContainer = styled(Grid.Column)(_templateObject$17());
|
42927 |
|
42928 | function _templateObject$18() {
|
42929 | var data = taggedTemplateLiteralLoose(["\n\tdiv:first-child {\n\t\tmargin-right: 21px;\n\t}\n"]);
|
42930 |
|
42931 | _templateObject$18 = function _templateObject() {
|
42932 | return data;
|
42933 | };
|
42934 |
|
42935 | return data;
|
42936 | }
|
42937 |
|
42938 | var ListHeader = function ListHeader(_ref) {
|
42939 | var checked = _ref.checked,
|
42940 | handleSelectAll = _ref.handleSelectAll,
|
42941 | pagination = _ref.pagination,
|
42942 | children = _ref.children;
|
42943 | return React.createElement(ListHeaderContainer, {
|
42944 | padded: true,
|
42945 | verticalAlign: "middle"
|
42946 | }, React.createElement(ActionsListWrapper, {
|
42947 | tablet: 8
|
42948 | }, checked !== undefined && React.createElement(Checkbox$1, {
|
42949 | onChange: handleSelectAll,
|
42950 | checked: checked
|
42951 | }), children), pagination && pagination.totalPages > 1 && React.createElement(ListHeaderPaginationContainer, {
|
42952 | computer: 8,
|
42953 | tablet: 8,
|
42954 | mobile: 16,
|
42955 | floated: "right"
|
42956 | }, React.createElement(Pagination$1, {
|
42957 | activePage: pagination.activePage,
|
42958 | onPageChange: pagination.handlePageChange,
|
42959 | totalPages: pagination.totalPages,
|
42960 | siblingRange: 1
|
42961 | })));
|
42962 | };
|
42963 |
|
42964 | var ActionsListWrapper = styled(Grid.Column)(_templateObject$18());
|
42965 | ListHeader.defaultProps = {
|
42966 | children: undefined,
|
42967 | checked: undefined,
|
42968 | handleSelectAll: undefined,
|
42969 | pagination: undefined,
|
42970 | selectAllCheckboxColor: undefined
|
42971 | };
|
42972 | ListHeader.displayName = 'ListHeader';
|
42973 | ListHeader.propTypes = {
|
42974 | children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),
|
42975 | checked: PropTypes.bool,
|
42976 | handleSelectAll: PropTypes.func,
|
42977 | pagination: PropTypes.shape({
|
42978 | activePage: PropTypes.number.isRequired,
|
42979 | handlePageChange: PropTypes.func.isRequired,
|
42980 | totalPages: PropTypes.number.isRequired
|
42981 | }),
|
42982 | selectAllCheckboxColor: PropTypes.string
|
42983 | };
|
42984 |
|
42985 | function _templateObject$19() {
|
42986 | var data = taggedTemplateLiteralLoose(["\n\t&&&&.list-wrapper {\n\t\twidth: 100% !important;\n\t\tmargin: 0 !important;\n\t}\n\n\t@media only screen and (max-width: 767px) {\n\t\t&&&&.list-wrapper {\n\t\t\twidth: 100% !important;\n\t\t\tmargin-right: 0 !important;\n\t\t\tmargin-left: 0 !important;\n\t\t}\n\t}\n"]);
|
42987 |
|
42988 | _templateObject$19 = function _templateObject() {
|
42989 | return data;
|
42990 | };
|
42991 |
|
42992 | return data;
|
42993 | }
|
42994 | var ListCardContainerWrapper = styled(Grid)(_templateObject$19());
|
42995 |
|
42996 | var ListCardWrapper = function ListCardWrapper(props) {
|
42997 | return React.createElement(ListCardContainerWrapper, _extends_1({
|
42998 | className: "list-wrapper",
|
42999 | stackable: true,
|
43000 | columns: 4
|
43001 | }, props));
|
43002 | };
|
43003 |
|
43004 | ListCardWrapper.displayName = 'ListCardWrapper';
|
43005 |
|
43006 | function _templateObject$1a() {
|
43007 | var data = taggedTemplateLiteralLoose(["\n\tmin-width: ", ";\n"]);
|
43008 |
|
43009 | _templateObject$1a = function _templateObject() {
|
43010 | return data;
|
43011 | };
|
43012 |
|
43013 | return data;
|
43014 | }
|
43015 |
|
43016 | var List = function List(_ref) {
|
43017 | var checked = _ref.checked,
|
43018 | _handleSelectAll = _ref.handleSelectAll,
|
43019 | pagination = _ref.pagination,
|
43020 | extra = _ref.extra,
|
43021 | selectAllCheckboxColor = _ref.selectAllCheckboxColor,
|
43022 | children = _ref.children,
|
43023 | cards = _ref.cards,
|
43024 | props = objectWithoutPropertiesLoose(_ref, ["checked", "handleSelectAll", "pagination", "extra", "selectAllCheckboxColor", "children", "cards"]);
|
43025 |
|
43026 | return React.createElement(ListContainer, _extends_1({
|
43027 | pagination: pagination
|
43028 | }, props), (checked !== undefined || pagination) && React.createElement(ListHeader, {
|
43029 | checked: checked,
|
43030 | handleSelectAll: function handleSelectAll() {
|
43031 | return _handleSelectAll(!checked);
|
43032 | },
|
43033 | pagination: pagination,
|
43034 | selectAllCheckboxColor: selectAllCheckboxColor
|
43035 | }, extra && children[0]), cards ? React.createElement(ListCardWrapper, null, !extra ? children : children[1]) : React.createElement(React.Fragment, null, !extra ? children : children[1]));
|
43036 | };
|
43037 |
|
43038 | var ListContainer = styled(function (_ref2) {
|
43039 | var pagination = _ref2.pagination,
|
43040 | props = objectWithoutPropertiesLoose(_ref2, ["pagination"]);
|
43041 |
|
43042 | return React.createElement(Grid.Row, props);
|
43043 | })(_templateObject$1a(), function (_ref3) {
|
43044 | var pagination = _ref3.pagination;
|
43045 | return pagination && pagination.totalPages > 1 ? '410px' : 'min-content';
|
43046 | });
|
43047 | ListContainer.displayName = 'ListContainer';
|
43048 | List.defaultProps = {
|
43049 | checked: undefined,
|
43050 | extra: undefined,
|
43051 | cards: undefined,
|
43052 | handleSelectAll: undefined,
|
43053 | pagination: undefined,
|
43054 | selectAllCheckboxColor: theme.colors.activeBlue
|
43055 | };
|
43056 | List.displayName = 'List';
|
43057 | List.propTypes = {
|
43058 | children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
|
43059 |
|
43060 | /** state of the select all checkbox */
|
43061 | checked: PropTypes.bool,
|
43062 |
|
43063 | /** activate extra actions in header, must use ListHeaderAction container */
|
43064 | extra: PropTypes.bool,
|
43065 |
|
43066 | /** activate card display in body, must use ListCard container for each item */
|
43067 | cards: PropTypes.bool,
|
43068 |
|
43069 | /** select all handler function, return checkbox state */
|
43070 | handleSelectAll: PropTypes.func,
|
43071 |
|
43072 | /** set pagination options to show the pagination wrapper */
|
43073 | pagination: PropTypes.shape({
|
43074 | activePage: PropTypes.number.isRequired,
|
43075 | handlePageChange: PropTypes.func.isRequired,
|
43076 | totalPages: PropTypes.number.isRequired
|
43077 | }),
|
43078 | selectAllCheckboxColor: PropTypes.string
|
43079 | };
|
43080 |
|
43081 | function _templateObject$1b() {
|
43082 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: inline-flex !important;\n\tmargin-left: 18px !important;\n\tcursor: pointer !important;\n"]);
|
43083 |
|
43084 | _templateObject$1b = function _templateObject() {
|
43085 | return data;
|
43086 | };
|
43087 |
|
43088 | return data;
|
43089 | }
|
43090 | var ListHeaderAction = styled(Icon$1)(_templateObject$1b());
|
43091 | ListHeaderAction.displayName = 'ListHeaderAction';
|
43092 |
|
43093 | function _templateObject$1c() {
|
43094 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\twidth: 100%;\n\talign-items: center;\n\tjustify-content: space-between;\n\tpadding: 0 1rem;\n\tbackground-color: ", ";\n\tcursor: pointer;\n\n\t&&&&.active {\n\t\tbackground-color: ", ";\n\t}\n\n\t", "\n"]);
|
43095 |
|
43096 | _templateObject$1c = function _templateObject() {
|
43097 | return data;
|
43098 | };
|
43099 |
|
43100 | return data;
|
43101 | }
|
43102 | var ListRowWrapper = styled(function (_ref) {
|
43103 | var index = _ref.index,
|
43104 | props = objectWithoutPropertiesLoose(_ref, ["index"]);
|
43105 |
|
43106 | return React.createElement("div", props);
|
43107 | })(_templateObject$1c(), function (_ref2) {
|
43108 | var theme = _ref2.theme,
|
43109 | index = _ref2.index;
|
43110 | return index % 2 === 0 ? theme.list.pairCell : theme.list.unPairCell;
|
43111 | }, function (_ref3) {
|
43112 | var theme = _ref3.theme;
|
43113 | return theme.colors.lightBlue;
|
43114 | }, function (_ref4) {
|
43115 | var removehover = _ref4.removehover,
|
43116 | theme = _ref4.theme;
|
43117 | return !removehover && "\n\t&&&&:hover {\n\t\tposition: relative;\n\t\tbackground-color: " + theme.colors.lightBlue + ";\n\t\tbox-shadow: " + theme.list.boxShadow + ";\n\t\ttransition: all 0.2s ease-in-out;\n\n\t\t.onHoverShow {\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t}\n\t}";
|
43118 | });
|
43119 | ListRowWrapper.displayName = 'ListRowWrapper';
|
43120 |
|
43121 | function _templateObject2$r() {
|
43122 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tcursor: ", ";\n"]);
|
43123 |
|
43124 | _templateObject2$r = function _templateObject2() {
|
43125 | return data;
|
43126 | };
|
43127 |
|
43128 | return data;
|
43129 | }
|
43130 |
|
43131 | function _templateObject$1d() {
|
43132 | var data = taggedTemplateLiteralLoose(["\n\t&&&& {\n\t\theight: 100%;\n\t}\n"]);
|
43133 |
|
43134 | _templateObject$1d = function _templateObject() {
|
43135 | return data;
|
43136 | };
|
43137 |
|
43138 | return data;
|
43139 | }
|
43140 |
|
43141 | var ListRowActionWrapper = function ListRowActionWrapper(_ref) {
|
43142 | var color = _ref.color,
|
43143 | typeAction = _ref.typeAction,
|
43144 | isActive = _ref.isActive,
|
43145 | handleAction = _ref.handleAction,
|
43146 | props = objectWithoutPropertiesLoose(_ref, ["color", "typeAction", "isActive", "handleAction"]);
|
43147 |
|
43148 | return React.createElement(ListBlockContainer, _extends_1({
|
43149 | onClick: function onClick(e) {
|
43150 | return e.stopPropagation();
|
43151 | },
|
43152 | typeAction: typeAction
|
43153 | }, props), typeAction === 'checkbox' && React.createElement(Checkbox$1, {
|
43154 | onChange: function onChange() {
|
43155 | return handleAction(!isActive);
|
43156 | },
|
43157 | checked: isActive
|
43158 | }), typeAction === 'radio' && React.createElement(Radio, {
|
43159 | onChange: function onChange() {
|
43160 | return handleAction(!isActive);
|
43161 | },
|
43162 | checked: isActive
|
43163 | }), typeAction === 'icon' && React.createElement(IconWrapper, {
|
43164 | icon: "lock",
|
43165 | color: theme.colors.red
|
43166 | }));
|
43167 | };
|
43168 |
|
43169 | var IconWrapper = styled(Icon$1)(_templateObject$1d());
|
43170 | var ListBlockContainer = styled.div(_templateObject2$r(), function (_ref2) {
|
43171 | var typeAction = _ref2.typeAction;
|
43172 | return typeAction === 'icon' ? 'default' : 'pointer';
|
43173 | });
|
43174 | ListRowActionWrapper.defaultProps = {
|
43175 | color: theme.colors.activeBlue
|
43176 | };
|
43177 | ListBlockContainer.displayName = 'ListBlockContainer';
|
43178 | ListRowActionWrapper.displayName = 'ListRowActionWrapper';
|
43179 | ListRowActionWrapper.propTypes = {
|
43180 | /** string with type of the row action */
|
43181 | typeAction: PropTypes.oneOf(['checkbox', 'radio', 'icon']).isRequired,
|
43182 |
|
43183 | /** bool to control the state of the action */
|
43184 | isActive: PropTypes.bool.isRequired,
|
43185 |
|
43186 | /** function handler to the row action */
|
43187 | handleAction: PropTypes.func.isRequired,
|
43188 |
|
43189 | /** string with action color */
|
43190 | color: PropTypes.string
|
43191 | };
|
43192 |
|
43193 | function _templateObject$1e() {
|
43194 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\talign-items: center;\n"]);
|
43195 |
|
43196 | _templateObject$1e = function _templateObject() {
|
43197 | return data;
|
43198 | };
|
43199 |
|
43200 | return data;
|
43201 | }
|
43202 |
|
43203 | var ListRowLeft = function ListRowLeft(_ref) {
|
43204 | var children = _ref.children,
|
43205 | color = _ref.color,
|
43206 | typeAction = _ref.typeAction,
|
43207 | handleAction = _ref.handleAction,
|
43208 | isActive = _ref.isActive,
|
43209 | props = objectWithoutPropertiesLoose(_ref, ["children", "color", "typeAction", "handleAction", "isActive"]);
|
43210 |
|
43211 | return React.createElement(Wrapper$1, props, typeAction !== undefined && React.createElement(ListRowActionWrapper, {
|
43212 | color: color,
|
43213 | typeAction: typeAction,
|
43214 | isActive: isActive,
|
43215 | handleAction: handleAction
|
43216 | }), children);
|
43217 | };
|
43218 |
|
43219 | var Wrapper$1 = styled.div(_templateObject$1e());
|
43220 | ListRowLeft.defaultProps = {
|
43221 | typeAction: undefined,
|
43222 | isActive: undefined,
|
43223 | handleAction: undefined,
|
43224 | color: theme.colors.activeBlue
|
43225 | };
|
43226 | ListRowLeft.propTypes = {
|
43227 | children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
|
43228 |
|
43229 | /** string with type of the row action */
|
43230 | typeAction: PropTypes.oneOf(['checkbox', 'radio', 'icon']),
|
43231 |
|
43232 | /** bool to control the state of the action */
|
43233 | isActive: PropTypes.bool,
|
43234 |
|
43235 | /** function handler to the row action */
|
43236 | handleAction: PropTypes.func,
|
43237 |
|
43238 | /** string with action color */
|
43239 | color: PropTypes.string
|
43240 | };
|
43241 | ListRowLeft.displayName = 'ListRowLeft';
|
43242 |
|
43243 | function _templateObject4$c() {
|
43244 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: none;\n"]);
|
43245 |
|
43246 | _templateObject4$c = function _templateObject4() {
|
43247 | return data;
|
43248 | };
|
43249 |
|
43250 | return data;
|
43251 | }
|
43252 |
|
43253 | function _templateObject3$h() {
|
43254 | var data = taggedTemplateLiteralLoose(["\n\tmargin-right: 18px;\n\n\t:last-child {\n\t\tmargin-right: 0;\n\t}\n"]);
|
43255 |
|
43256 | _templateObject3$h = function _templateObject3() {
|
43257 | return data;
|
43258 | };
|
43259 |
|
43260 | return data;
|
43261 | }
|
43262 |
|
43263 | function _templateObject2$s() {
|
43264 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n"]);
|
43265 |
|
43266 | _templateObject2$s = function _templateObject2() {
|
43267 | return data;
|
43268 | };
|
43269 |
|
43270 | return data;
|
43271 | }
|
43272 |
|
43273 | function _templateObject$1f() {
|
43274 | var data = taggedTemplateLiteralLoose(["\n\toutline: none;\n"]);
|
43275 |
|
43276 | _templateObject$1f = function _templateObject() {
|
43277 | return data;
|
43278 | };
|
43279 |
|
43280 | return data;
|
43281 | }
|
43282 |
|
43283 | var renderElements = function renderElements(element) {
|
43284 | return Array.isArray(element) ? element.map(function (child, i) {
|
43285 | return React.createElement(Div, {
|
43286 | key: i
|
43287 | }, child);
|
43288 | }) : React.createElement(Div, null, element);
|
43289 | };
|
43290 |
|
43291 | var ListRowRight = function ListRowRight(_ref) {
|
43292 | var children = _ref.children,
|
43293 | showOnHover = _ref.showOnHover;
|
43294 | return React.createElement(ListRowRightStyled, {
|
43295 | role: "row",
|
43296 | tabIndex: "0",
|
43297 | onClick: function onClick(e) {
|
43298 | return e.stopPropagation();
|
43299 | }
|
43300 | }, showOnHover && React.createElement(OnHoverShow, {
|
43301 | className: "onHoverShow"
|
43302 | }, renderElements(showOnHover)), React.createElement(Flex$2, null, renderElements(children)));
|
43303 | };
|
43304 |
|
43305 | var ListRowRightStyled = styled.div(_templateObject$1f());
|
43306 | var Flex$2 = styled.div(_templateObject2$s());
|
43307 | var Div = styled.div(_templateObject3$h());
|
43308 | var OnHoverShow = styled.span(_templateObject4$c());
|
43309 | OnHoverShow.displayName = 'OnHoverShow';
|
43310 | ListRowRight.defaultProps = {
|
43311 | showOnHover: null,
|
43312 | children: null
|
43313 | };
|
43314 | ListRowRight.propTypes = {
|
43315 | children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),
|
43316 |
|
43317 | /** components shown when hovered */
|
43318 | showOnHover: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node])
|
43319 | };
|
43320 | ListRowRight.displayName = 'ListRowRight';
|
43321 |
|
43322 | var ListRow = function ListRow(_ref) {
|
43323 | var index = _ref.index,
|
43324 | isActive = _ref.isActive,
|
43325 | handleAction = _ref.handleAction,
|
43326 | children = _ref.children,
|
43327 | props = objectWithoutPropertiesLoose(_ref, ["index", "isActive", "handleAction", "children"]);
|
43328 |
|
43329 | var renderChildrenWithProps = function renderChildrenWithProps() {
|
43330 | return React.Children.map(children, function (child) {
|
43331 | return React.cloneElement(child, {
|
43332 | handleAction: handleAction,
|
43333 | isActive: isActive
|
43334 | });
|
43335 | });
|
43336 | };
|
43337 |
|
43338 | return React.createElement(ListRowWrapper, _extends_1({
|
43339 | index: index,
|
43340 | className: isActive && 'active'
|
43341 | }, props), renderChildrenWithProps(children));
|
43342 | };
|
43343 |
|
43344 | ListRow.Left = function (_ref2) {
|
43345 | var props = _extends_1({}, _ref2);
|
43346 |
|
43347 | return React.createElement(ListRowLeft, props);
|
43348 | };
|
43349 |
|
43350 | ListRow.Left.displayName = 'ListRow.Left';
|
43351 |
|
43352 | ListRow.Right = function (_ref3) {
|
43353 | var props = _extends_1({}, _ref3);
|
43354 |
|
43355 | return React.createElement(ListRowRight, props);
|
43356 | };
|
43357 |
|
43358 | ListRow.Right.displayName = 'ListRow.Right';
|
43359 | ListRow.defaultProps = {
|
43360 | isActive: false,
|
43361 | handleAction: undefined
|
43362 | };
|
43363 | ListRow.displayName = 'ListRow';
|
43364 | ListRow.propTypes = {
|
43365 | children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
|
43366 |
|
43367 | /** array index for striping css */
|
43368 | index: PropTypes.number.isRequired,
|
43369 |
|
43370 | /** bool that control the action state */
|
43371 | isActive: PropTypes.bool,
|
43372 |
|
43373 | /** handle action function */
|
43374 | handleAction: PropTypes.func
|
43375 | };
|
43376 |
|
43377 | function _templateObject$1g() {
|
43378 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: block;\n\tmargin-right: 12px;\n\tmargin-left: auto;\n\tcursor: pointer;\n\tfloat: right;\n\tline-height: 34px;\n\n\t& > div > i {\n\t\tline-height: 34px;\n\t}\n"]);
|
43379 |
|
43380 | _templateObject$1g = function _templateObject() {
|
43381 | return data;
|
43382 | };
|
43383 |
|
43384 | return data;
|
43385 | }
|
43386 | var ListRowRight$1 = styled.div(_templateObject$1g());
|
43387 |
|
43388 | var ListAddInfoWrapper = function ListAddInfoWrapper(props) {
|
43389 | return React.createElement(ListRowRight$1, _extends_1({
|
43390 | className: "additional-info-wrapper"
|
43391 | }, props));
|
43392 | };
|
43393 |
|
43394 | ListAddInfoWrapper.propTypes = {
|
43395 | children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired
|
43396 | };
|
43397 | ListAddInfoWrapper.displayName = 'ListAddInfoWrapper';
|
43398 |
|
43399 | function _templateObject$1h() {
|
43400 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: block;\n\tmargin-right: 12px;\n\tmargin-left: auto;\n\tcursor: pointer;\n\tfloat: right;\n\tline-height: 34px;\n\n\t& > div > i {\n\t\tline-height: 34px;\n\t}\n"]);
|
43401 |
|
43402 | _templateObject$1h = function _templateObject() {
|
43403 | return data;
|
43404 | };
|
43405 |
|
43406 | return data;
|
43407 | }
|
43408 | var ListRowRight$2 = styled.div(_templateObject$1h());
|
43409 |
|
43410 | var ListActionsWrapper = function ListActionsWrapper(props) {
|
43411 | return React.createElement(ListRowRight$2, _extends_1({
|
43412 | className: "actions-wrapper",
|
43413 | onClick: function onClick(e) {
|
43414 | return e.stopPropagation();
|
43415 | }
|
43416 | }, props));
|
43417 | };
|
43418 |
|
43419 | ListActionsWrapper.propTypes = {
|
43420 | children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired
|
43421 | };
|
43422 | ListActionsWrapper.displayName = 'ListActionsWrapper';
|
43423 |
|
43424 | function _templateObject$1i() {
|
43425 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\twidth: ", ";\n\tmin-height: 68px;\n\tflex-wrap: wrap;\n\tjustify-content: space-between;\n\tpadding: 14px 12px 16px;\n\tmargin-right: ", ";\n\tmargin-bottom: 20px;\n\tborder: 1px solid ", " !important;\n\tborder-radius: 4px;\n\tcursor: pointer;\n\n\t@media only screen and (max-width: 767px) {\n\t\twidth: 100% !important;\n\t\tmargin-right: 0 !important;\n\t\tmargin-bottom: 20px !important;\n\t}\n\n\t:hover {\n\t\tposition: relative;\n\t\tbackground-color: #daedff !important;\n\t\tbox-shadow: 0 3px 3px rgba(0, 0, 0, 0.25) !important;\n\t\ttransition: all 0.2s ease-in-out;\n\t}\n\n\t:hover > .additional-info-wrapper {\n\t\tdisplay: ", ";\n\t}\n\n\t> .actions-wrapper {\n\t\tdisplay: ", ";\n\t}\n\n\t:hover > .actions-wrapper {\n\t\tdisplay: ", ";\n\t\ttransition: all 0.1s ease-in;\n\t}\n\n\t.active {\n\t\tbackground-color: #daedff !important;\n\t}\n"]);
|
43426 |
|
43427 | _templateObject$1i = function _templateObject() {
|
43428 | return data;
|
43429 | };
|
43430 |
|
43431 | return data;
|
43432 | }
|
43433 | var CardWrapper = styled(function (_ref) {
|
43434 | var numCols = _ref.numCols,
|
43435 | last = _ref.last,
|
43436 | actions = _ref.actions,
|
43437 | addInfo = _ref.addInfo,
|
43438 | error = _ref.error,
|
43439 | props = objectWithoutPropertiesLoose(_ref, ["numCols", "last", "actions", "addInfo", "error"]);
|
43440 |
|
43441 | return React.createElement(Grid.Column, props);
|
43442 | })(_templateObject$1i(), function (_ref2) {
|
43443 | var numCols = _ref2.numCols;
|
43444 | return (100 - (numCols - 1) * 2) / numCols + "% !important";
|
43445 | }, function (_ref3) {
|
43446 | var last = _ref3.last,
|
43447 | numCols = _ref3.numCols;
|
43448 | return last || numCols === 1 ? '0' : '2%';
|
43449 | }, function (_ref4) {
|
43450 | var error = _ref4.error;
|
43451 | return error ? theme.listCard.errorBorder : theme.listCard.defaultBorder;
|
43452 | }, function (_ref5) {
|
43453 | var actions = _ref5.actions;
|
43454 | return actions && 'none';
|
43455 | }, function (_ref6) {
|
43456 | var actions = _ref6.actions,
|
43457 | addInfo = _ref6.addInfo;
|
43458 | return !addInfo && actions ? 'block' : 'none';
|
43459 | }, function (_ref7) {
|
43460 | var actions = _ref7.actions;
|
43461 | return actions && 'block';
|
43462 | });
|
43463 |
|
43464 | var ListCard = function ListCard(_ref8) {
|
43465 | var checked = _ref8.checked,
|
43466 | props = objectWithoutPropertiesLoose(_ref8, ["checked"]);
|
43467 |
|
43468 | return React.createElement(CardWrapper, _extends_1({
|
43469 | className: "" + (checked && 'active')
|
43470 | }, props));
|
43471 | };
|
43472 |
|
43473 | ListCard.defaultProps = {
|
43474 | checked: undefined,
|
43475 | last: false,
|
43476 | numCols: 4,
|
43477 | error: false
|
43478 | };
|
43479 | ListCard.displayName = 'ListCard';
|
43480 | ListCard.propTypes = {
|
43481 | checked: PropTypes.bool,
|
43482 | last: PropTypes.bool,
|
43483 | numCols: PropTypes.number,
|
43484 | error: PropTypes.bool
|
43485 | };
|
43486 |
|
43487 | function _templateObject6$4() {
|
43488 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: ", ";\n\tpadding: 16px 0;\n\tborder-bottom: 1px solid ", ";\n"]);
|
43489 |
|
43490 | _templateObject6$4 = function _templateObject6() {
|
43491 | return data;
|
43492 | };
|
43493 |
|
43494 | return data;
|
43495 | }
|
43496 |
|
43497 | function _templateObject5$5() {
|
43498 | var data = taggedTemplateLiteralLoose(["\n\ttransform: ", ";\n\ttransition: 0.33s;\n"]);
|
43499 |
|
43500 | _templateObject5$5 = function _templateObject5() {
|
43501 | return data;
|
43502 | };
|
43503 |
|
43504 | return data;
|
43505 | }
|
43506 |
|
43507 | function _templateObject4$d() {
|
43508 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: none;\n"]);
|
43509 |
|
43510 | _templateObject4$d = function _templateObject4() {
|
43511 | return data;
|
43512 | };
|
43513 |
|
43514 | return data;
|
43515 | }
|
43516 |
|
43517 | function _templateObject3$i() {
|
43518 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\talign-items: center;\n"]);
|
43519 |
|
43520 | _templateObject3$i = function _templateObject3() {
|
43521 | return data;
|
43522 | };
|
43523 |
|
43524 | return data;
|
43525 | }
|
43526 |
|
43527 | function _templateObject2$t() {
|
43528 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\talign-items: center;\n\tmargin-right: 18px;\n"]);
|
43529 |
|
43530 | _templateObject2$t = function _templateObject2() {
|
43531 | return data;
|
43532 | };
|
43533 |
|
43534 | return data;
|
43535 | }
|
43536 |
|
43537 | function _templateObject$1j() {
|
43538 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\twidth: 100%;\n\talign-items: center;\n\tjustify-content: space-between;\n\tpadding: 10px 12px 10px 10px;\n\tmargin-bottom: 1px;\n\n\tbackground: ", ";\n\n\tcursor: pointer;\n\n\t:hover {\n\t\tposition: relative;\n\t\tbackground-color: ", " !important;\n\t\tbox-shadow: 0 3px 3px rgba(0, 0, 0, 0.25);\n\t\ttransition: all 0.2s ease-in-out;\n\n\t\t.onHoverShow {\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t}\n\n\t\t.OnHoverHide {\n\t\t\tdisplay: none;\n\t\t}\n\t}\n"]);
|
43539 |
|
43540 | _templateObject$1j = function _templateObject() {
|
43541 | return data;
|
43542 | };
|
43543 |
|
43544 | return data;
|
43545 | }
|
43546 |
|
43547 | var ListExpandableRow = function ListExpandableRow(_ref) {
|
43548 | var children = _ref.children,
|
43549 | activeIndex = _ref.activeIndex,
|
43550 | index = _ref.index,
|
43551 | _onClick = _ref.onClick,
|
43552 | componentsLeft = _ref.componentsLeft,
|
43553 | componentsRightShowOnHover = _ref.componentsRightShowOnHover,
|
43554 | componentsRight = _ref.componentsRight,
|
43555 | componentsRightHideOnHover = _ref.componentsRightHideOnHover,
|
43556 | props = objectWithoutPropertiesLoose(_ref, ["children", "activeIndex", "index", "onClick", "componentsLeft", "componentsRightShowOnHover", "componentsRight", "componentsRightHideOnHover"]);
|
43557 |
|
43558 | var renderElements = function renderElements(element) {
|
43559 | return element.map(function (child, i) {
|
43560 | return React.createElement(FlexCenter, {
|
43561 | key: i
|
43562 | }, child);
|
43563 | });
|
43564 | };
|
43565 |
|
43566 | return React.createElement(Fragment, null, React.createElement(Row, _extends_1({
|
43567 | expanded: index === activeIndex,
|
43568 | index: index,
|
43569 | onClick: function onClick() {
|
43570 | return _onClick(index);
|
43571 | }
|
43572 | }, props), React.createElement(Flex$3, null, renderElements(componentsLeft)), React.createElement(Flex$3, null, componentsRightHideOnHover && React.createElement(Flex$3, {
|
43573 | className: "OnHoverHide"
|
43574 | }, renderElements(componentsRightHideOnHover)), componentsRightShowOnHover && React.createElement(OnHoverShow$1, {
|
43575 | className: "onHoverShow"
|
43576 | }, renderElements(componentsRightShowOnHover)), componentsRight && renderElements(componentsRight), React.createElement(IconAnimated$1, {
|
43577 | expanded: index === activeIndex,
|
43578 | icon: "select-down"
|
43579 | }))), React.createElement(Body, {
|
43580 | expanded: index === activeIndex,
|
43581 | index: index
|
43582 | }, children));
|
43583 | };
|
43584 |
|
43585 | var Row = styled.div(_templateObject$1j(), function (_ref2) {
|
43586 | var index = _ref2.index,
|
43587 | expanded = _ref2.expanded,
|
43588 | theme = _ref2.theme;
|
43589 | return expanded ? theme.colors.lightBlue : index % 2 ? 'white' : theme.colors.lightGray;
|
43590 | }, function (_ref3) {
|
43591 | var theme = _ref3.theme;
|
43592 | return theme.colors.lightBlue;
|
43593 | });
|
43594 | Row.displayName = 'Row';
|
43595 | var FlexCenter = styled.div(_templateObject2$t());
|
43596 | var Flex$3 = styled.div(_templateObject3$i());
|
43597 | Flex$3.displayName = 'Flex';
|
43598 | var OnHoverShow$1 = styled.span(_templateObject4$d());
|
43599 | OnHoverShow$1.displayName = 'OnHoverShow';
|
43600 | var IconAnimated$1 = styled(function (_ref4) {
|
43601 | var expanded = _ref4.expanded,
|
43602 | props = objectWithoutPropertiesLoose(_ref4, ["expanded"]);
|
43603 |
|
43604 | return React.createElement(Icon$1, props);
|
43605 | })(_templateObject5$5(), function (_ref5) {
|
43606 | var expanded = _ref5.expanded;
|
43607 | return expanded && 'rotate(180deg)';
|
43608 | });
|
43609 | IconAnimated$1.displayName = 'IconAnimated';
|
43610 | var Body = styled.div(_templateObject6$4(), function (_ref6) {
|
43611 | var expanded = _ref6.expanded;
|
43612 | return expanded ? 'block' : 'none';
|
43613 | }, function (_ref7) {
|
43614 | var theme = _ref7.theme;
|
43615 | return theme.colors.strokeGray;
|
43616 | });
|
43617 | Body.displayName = 'Body';
|
43618 | ListExpandableRow.defaultProps = {
|
43619 | activeIndex: null,
|
43620 | componentsRightHideOnHover: []
|
43621 | };
|
43622 | ListExpandableRow.propTypes = {
|
43623 | activeIndex: PropTypes.number,
|
43624 | index: PropTypes.number.isRequired,
|
43625 | onClick: PropTypes.func.isRequired,
|
43626 | children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
|
43627 | componentsRight: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
|
43628 | componentsLeft: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
|
43629 | componentsRightShowOnHover: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
|
43630 | componentsRightHideOnHover: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node])
|
43631 | };
|
43632 | ListExpandableRow.displayName = 'ListExpandableRow';
|
43633 |
|
43634 | function _templateObject6$5() {
|
43635 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: ", ";\n\tborder-bottom: ", ";\n"]);
|
43636 |
|
43637 | _templateObject6$5 = function _templateObject6() {
|
43638 | return data;
|
43639 | };
|
43640 |
|
43641 | return data;
|
43642 | }
|
43643 |
|
43644 | function _templateObject5$6() {
|
43645 | var data = taggedTemplateLiteralLoose(["\n\ttransform: ", ";\n\ttransition: 0.33s;\n"]);
|
43646 |
|
43647 | _templateObject5$6 = function _templateObject5() {
|
43648 | return data;
|
43649 | };
|
43650 |
|
43651 | return data;
|
43652 | }
|
43653 |
|
43654 | function _templateObject4$e() {
|
43655 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\talign-items: center;\n"]);
|
43656 |
|
43657 | _templateObject4$e = function _templateObject4() {
|
43658 | return data;
|
43659 | };
|
43660 |
|
43661 | return data;
|
43662 | }
|
43663 |
|
43664 | function _templateObject3$j() {
|
43665 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\twidth: 100%;\n\talign-items: center;\n\n\tcursor: pointer;\n"]);
|
43666 |
|
43667 | _templateObject3$j = function _templateObject3() {
|
43668 | return data;
|
43669 | };
|
43670 |
|
43671 | return data;
|
43672 | }
|
43673 |
|
43674 | function _templateObject2$u() {
|
43675 | var data = taggedTemplateLiteralLoose(["\n\twidth: 40px;\n\theight: 40px;\n\tmargin-right: 12px;\n"]);
|
43676 |
|
43677 | _templateObject2$u = function _templateObject2() {
|
43678 | return data;
|
43679 | };
|
43680 |
|
43681 | return data;
|
43682 | }
|
43683 |
|
43684 | function _templateObject$1k() {
|
43685 | var data = taggedTemplateLiteralLoose(["\n\tmargin-right: 5px;\n\tcolor: ", ";\n\tfont-size: 15px;\n\tline-height: 16px;\n\n\t:hover {\n\t\tcolor: ", ";\n\t}\n"]);
|
43686 |
|
43687 | _templateObject$1k = function _templateObject() {
|
43688 | return data;
|
43689 | };
|
43690 |
|
43691 | return data;
|
43692 | }
|
43693 |
|
43694 | var ListExpandableCustomRow = function ListExpandableCustomRow(_ref) {
|
43695 | var children = _ref.children,
|
43696 | activeIndex = _ref.activeIndex,
|
43697 | index = _ref.index,
|
43698 | _onClick = _ref.onClick,
|
43699 | image = _ref.image,
|
43700 | title = _ref.title,
|
43701 | arrow = _ref.arrow,
|
43702 | divider = _ref.divider,
|
43703 | props = objectWithoutPropertiesLoose(_ref, ["children", "activeIndex", "index", "onClick", "image", "title", "arrow", "divider"]);
|
43704 |
|
43705 | var expanded = index === activeIndex;
|
43706 | return React.createElement(Fragment, null, React.createElement(Row$1, _extends_1({
|
43707 | expanded: expanded,
|
43708 | index: index,
|
43709 | onClick: function onClick() {
|
43710 | return _onClick(index);
|
43711 | }
|
43712 | }, props), React.createElement(Flex$4, null, React.createElement(Flex$4, null, image && React.createElement(Image$1, {
|
43713 | src: image,
|
43714 | alt: "qube standard",
|
43715 | draggable: "false"
|
43716 | }), title && React.createElement(Title$2, {
|
43717 | expanded: expanded
|
43718 | }, title)), arrow && React.createElement(IconAnimated$2, {
|
43719 | expanded: expanded,
|
43720 | icon: "select-down"
|
43721 | }))), React.createElement(Body$1, {
|
43722 | expanded: expanded,
|
43723 | index: index,
|
43724 | divider: divider
|
43725 | }, children));
|
43726 | };
|
43727 |
|
43728 | var Title$2 = styled.div(_templateObject$1k(), function (_ref2) {
|
43729 | var theme = _ref2.theme,
|
43730 | expanded = _ref2.expanded;
|
43731 | return expanded ? theme.colors.deepBlue : theme.colors.activeBlue;
|
43732 | }, function (_ref3) {
|
43733 | var theme = _ref3.theme;
|
43734 | return theme.colors.deepBlue;
|
43735 | });
|
43736 | Title$2.displayName = 'Title';
|
43737 | var Image$1 = styled.img(_templateObject2$u());
|
43738 | Image$1.displayName = 'Image';
|
43739 | var Row$1 = styled.div(_templateObject3$j());
|
43740 | Row$1.displayName = 'Row';
|
43741 | var Flex$4 = styled.div(_templateObject4$e());
|
43742 | Flex$4.displayName = 'Flex';
|
43743 | var IconAnimated$2 = styled(function (_ref4) {
|
43744 | var expanded = _ref4.expanded,
|
43745 | props = objectWithoutPropertiesLoose(_ref4, ["expanded"]);
|
43746 |
|
43747 | return React.createElement(Icon$1, props);
|
43748 | })(_templateObject5$6(), function (_ref5) {
|
43749 | var expanded = _ref5.expanded;
|
43750 | return expanded && 'rotate(180deg)';
|
43751 | });
|
43752 | IconAnimated$2.displayName = 'IconAnimated';
|
43753 | var Body$1 = styled.div(_templateObject6$5(), function (_ref6) {
|
43754 | var expanded = _ref6.expanded;
|
43755 | return expanded ? 'block' : 'none';
|
43756 | }, function (_ref7) {
|
43757 | var theme = _ref7.theme,
|
43758 | divider = _ref7.divider;
|
43759 | return divider ? "thin solid " + theme.colors.strokeGray : 'none';
|
43760 | });
|
43761 | Body$1.displayName = 'Body';
|
43762 | ListExpandableCustomRow.defaultProps = {
|
43763 | activeIndex: null,
|
43764 | image: null,
|
43765 | title: null,
|
43766 | arrow: true,
|
43767 | divider: false
|
43768 | };
|
43769 | ListExpandableCustomRow.propTypes = {
|
43770 | activeIndex: PropTypes.number,
|
43771 | index: PropTypes.number.isRequired,
|
43772 | onClick: PropTypes.func.isRequired,
|
43773 | children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
|
43774 | image: PropTypes.string,
|
43775 | title: PropTypes.string,
|
43776 | arrow: PropTypes.bool,
|
43777 | divider: PropTypes.bool
|
43778 | };
|
43779 | ListExpandableCustomRow.displayName = 'ListExpandableCustomRow';
|
43780 |
|
43781 | var ListExpandable = function ListExpandable(_ref) {
|
43782 | var children = _ref.children,
|
43783 | expandedIndex = _ref.expandedIndex,
|
43784 | props = objectWithoutPropertiesLoose(_ref, ["children", "expandedIndex"]);
|
43785 |
|
43786 | var _useState = useState(expandedIndex),
|
43787 | activeIndex = _useState[0],
|
43788 | setActiveIndex = _useState[1];
|
43789 |
|
43790 | useEffect(function () {
|
43791 | setActiveIndex(expandedIndex);
|
43792 | }, [expandedIndex]);
|
43793 |
|
43794 | var onClick = function onClick(index) {
|
43795 | return index === activeIndex ? setActiveIndex(null) : setActiveIndex(index);
|
43796 | };
|
43797 |
|
43798 | var renderChildrenWithProps = function renderChildrenWithProps() {
|
43799 | return React.Children.map(children, function (child) {
|
43800 | return React.cloneElement(child, {
|
43801 | onClick: onClick,
|
43802 | activeIndex: activeIndex
|
43803 | });
|
43804 | });
|
43805 | };
|
43806 |
|
43807 | return React.createElement("div", props, renderChildrenWithProps());
|
43808 | };
|
43809 |
|
43810 | ListExpandable.Row = function (_ref2) {
|
43811 | var props = _extends_1({}, _ref2);
|
43812 |
|
43813 | return React.createElement(ListExpandableRow, props);
|
43814 | };
|
43815 |
|
43816 | ListExpandable.CustomRow = function (_ref3) {
|
43817 | var props = _extends_1({}, _ref3);
|
43818 |
|
43819 | return React.createElement(ListExpandableCustomRow, props);
|
43820 | };
|
43821 |
|
43822 | ListExpandable.Row.displayName = 'ListExpandable.Row';
|
43823 | ListExpandable.CustomRow.displayName = 'ListExpandable.CustomRow';
|
43824 | ListExpandable.Row.propTypes = {
|
43825 | children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired
|
43826 | };
|
43827 | ListExpandable.CustomRow.propTypes = {
|
43828 | children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired
|
43829 | };
|
43830 | ListExpandable.defaultProps = {
|
43831 | expandedIndex: null
|
43832 | };
|
43833 | ListExpandable.propTypes = {
|
43834 | /** index of the initial expanded element */
|
43835 | expandedIndex: PropTypes.number,
|
43836 | children: PropTypes.node.isRequired
|
43837 | };
|
43838 | ListExpandable.displayName = 'ListExpandable';
|
43839 |
|
43840 | /**
|
43841 | * Copyright (c) 2013-present, Facebook, Inc.
|
43842 | *
|
43843 | * This source code is licensed under the MIT license found in the
|
43844 | * LICENSE file in the root directory of this source tree.
|
43845 | */
|
43846 |
|
43847 | /**
|
43848 | * Use invariant() to assert state which your program assumes to be true.
|
43849 | *
|
43850 | * Provide sprintf-style format (only %s is supported) and arguments
|
43851 | * to provide information about what broke and what you were
|
43852 | * expecting.
|
43853 | *
|
43854 | * The invariant message will be stripped in production, but the invariant
|
43855 | * will remain to ensure logic does not differ in production.
|
43856 | */
|
43857 |
|
43858 | var NODE_ENV = process.env.NODE_ENV;
|
43859 |
|
43860 | var invariant = function(condition, format, a, b, c, d, e, f) {
|
43861 | if (NODE_ENV !== 'production') {
|
43862 | if (format === undefined) {
|
43863 | throw new Error('invariant requires an error message argument');
|
43864 | }
|
43865 | }
|
43866 |
|
43867 | if (!condition) {
|
43868 | var error;
|
43869 | if (format === undefined) {
|
43870 | error = new Error(
|
43871 | 'Minified exception occurred; use the non-minified dev environment ' +
|
43872 | 'for the full error message and additional helpful warnings.'
|
43873 | );
|
43874 | } else {
|
43875 | var args = [a, b, c, d, e, f];
|
43876 | var argIndex = 0;
|
43877 | error = new Error(
|
43878 | format.replace(/%s/g, function() { return args[argIndex++]; })
|
43879 | );
|
43880 | error.name = 'Invariant Violation';
|
43881 | }
|
43882 |
|
43883 | error.framesToPop = 1; // we don't care about invariant's own frame
|
43884 | throw error;
|
43885 | }
|
43886 | };
|
43887 |
|
43888 | var invariant_1 = invariant;
|
43889 |
|
43890 | //
|
43891 |
|
43892 | var shallowequal = function shallowEqual(objA, objB, compare, compareContext) {
|
43893 | var ret = compare ? compare.call(compareContext, objA, objB) : void 0;
|
43894 |
|
43895 | if (ret !== void 0) {
|
43896 | return !!ret;
|
43897 | }
|
43898 |
|
43899 | if (objA === objB) {
|
43900 | return true;
|
43901 | }
|
43902 |
|
43903 | if (typeof objA !== "object" || !objA || typeof objB !== "object" || !objB) {
|
43904 | return false;
|
43905 | }
|
43906 |
|
43907 | var keysA = Object.keys(objA);
|
43908 | var keysB = Object.keys(objB);
|
43909 |
|
43910 | if (keysA.length !== keysB.length) {
|
43911 | return false;
|
43912 | }
|
43913 |
|
43914 | var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB);
|
43915 |
|
43916 | // Test for A's keys different from B.
|
43917 | for (var idx = 0; idx < keysA.length; idx++) {
|
43918 | var key = keysA[idx];
|
43919 |
|
43920 | if (!bHasOwnProperty(key)) {
|
43921 | return false;
|
43922 | }
|
43923 |
|
43924 | var valueA = objA[key];
|
43925 | var valueB = objB[key];
|
43926 |
|
43927 | ret = compare ? compare.call(compareContext, valueA, valueB, key) : void 0;
|
43928 |
|
43929 | if (ret === false || (ret === void 0 && valueA !== valueB)) {
|
43930 | return false;
|
43931 | }
|
43932 | }
|
43933 |
|
43934 | return true;
|
43935 | };
|
43936 |
|
43937 | var useCollector_1 = createCommonjsModule(function (module, exports) {
|
43938 | var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
43939 | return (mod && mod.__esModule) ? mod : { "default": mod };
|
43940 | };
|
43941 | Object.defineProperty(exports, "__esModule", { value: true });
|
43942 | var shallowequal_1 = __importDefault(shallowequal);
|
43943 |
|
43944 | /**
|
43945 | *
|
43946 | * @param monitor The monitor to collect state from
|
43947 | * @param collect The collecting function
|
43948 | * @param onUpdate A method to invoke when updates occur
|
43949 | */
|
43950 | function useCollector(monitor, collect, onUpdate) {
|
43951 | var _a = React.useState(function () { return collect(monitor); }), collected = _a[0], setCollected = _a[1];
|
43952 | var updateCollected = React.useCallback(function () {
|
43953 | var nextValue = collect(monitor);
|
43954 | if (!shallowequal_1.default(collected, nextValue)) {
|
43955 | setCollected(nextValue);
|
43956 | if (onUpdate) {
|
43957 | onUpdate();
|
43958 | }
|
43959 | }
|
43960 | }, [collected, monitor, onUpdate]);
|
43961 | // update the collected properties after the first render
|
43962 | // and the components are attached to dnd-core
|
43963 | React.useLayoutEffect(updateCollected, []);
|
43964 | return [collected, updateCollected];
|
43965 | }
|
43966 | exports.useCollector = useCollector;
|
43967 | });
|
43968 |
|
43969 | unwrapExports(useCollector_1);
|
43970 | var useCollector_2 = useCollector_1.useCollector;
|
43971 |
|
43972 | var useMonitorOutput_1 = createCommonjsModule(function (module, exports) {
|
43973 | Object.defineProperty(exports, "__esModule", { value: true });
|
43974 |
|
43975 |
|
43976 | function useMonitorOutput(monitor, collect, onCollect) {
|
43977 | var _a = useCollector_1.useCollector(monitor, collect, onCollect), collected = _a[0], updateCollected = _a[1];
|
43978 | React.useLayoutEffect(function subscribeToMonitorStateChange() {
|
43979 | var handlerId = monitor.getHandlerId();
|
43980 | if (handlerId == null) {
|
43981 | return undefined;
|
43982 | }
|
43983 | return monitor.subscribeToStateChange(updateCollected, {
|
43984 | handlerIds: [handlerId],
|
43985 | });
|
43986 | }, [monitor, updateCollected]);
|
43987 | return collected;
|
43988 | }
|
43989 | exports.useMonitorOutput = useMonitorOutput;
|
43990 | });
|
43991 |
|
43992 | unwrapExports(useMonitorOutput_1);
|
43993 | var useMonitorOutput_2 = useMonitorOutput_1.useMonitorOutput;
|
43994 |
|
43995 | var registration = createCommonjsModule(function (module, exports) {
|
43996 | Object.defineProperty(exports, "__esModule", { value: true });
|
43997 | function registerTarget(type, target, manager) {
|
43998 | var registry = manager.getRegistry();
|
43999 | var targetId = registry.addTarget(type, target);
|
44000 | return [targetId, function () { return registry.removeTarget(targetId); }];
|
44001 | }
|
44002 | exports.registerTarget = registerTarget;
|
44003 | function registerSource(type, source, manager) {
|
44004 | var registry = manager.getRegistry();
|
44005 | var sourceId = registry.addSource(type, source);
|
44006 | return [sourceId, function () { return registry.removeSource(sourceId); }];
|
44007 | }
|
44008 | exports.registerSource = registerSource;
|
44009 | });
|
44010 |
|
44011 | unwrapExports(registration);
|
44012 | var registration_1 = registration.registerTarget;
|
44013 | var registration_2 = registration.registerSource;
|
44014 |
|
44015 | var interfaces = createCommonjsModule(function (module, exports) {
|
44016 | Object.defineProperty(exports, "__esModule", { value: true });
|
44017 | var HandlerRole;
|
44018 | (function (HandlerRole) {
|
44019 | HandlerRole["SOURCE"] = "SOURCE";
|
44020 | HandlerRole["TARGET"] = "TARGET";
|
44021 | })(HandlerRole = exports.HandlerRole || (exports.HandlerRole = {}));
|
44022 | });
|
44023 |
|
44024 | unwrapExports(interfaces);
|
44025 | var interfaces_1 = interfaces.HandlerRole;
|
44026 |
|
44027 | function symbolObservablePonyfill(root) {
|
44028 | var result;
|
44029 | var Symbol = root.Symbol;
|
44030 |
|
44031 | if (typeof Symbol === 'function') {
|
44032 | if (Symbol.observable) {
|
44033 | result = Symbol.observable;
|
44034 | } else {
|
44035 | result = Symbol('observable');
|
44036 | Symbol.observable = result;
|
44037 | }
|
44038 | } else {
|
44039 | result = '@@observable';
|
44040 | }
|
44041 |
|
44042 | return result;
|
44043 | }
|
44044 |
|
44045 | /* global window */
|
44046 |
|
44047 | var root$1;
|
44048 |
|
44049 | if (typeof self !== 'undefined') {
|
44050 | root$1 = self;
|
44051 | } else if (typeof window !== 'undefined') {
|
44052 | root$1 = window;
|
44053 | } else if (typeof global !== 'undefined') {
|
44054 | root$1 = global;
|
44055 | } else if (typeof module !== 'undefined') {
|
44056 | root$1 = module;
|
44057 | } else {
|
44058 | root$1 = Function('return this')();
|
44059 | }
|
44060 |
|
44061 | var result = symbolObservablePonyfill(root$1);
|
44062 |
|
44063 | /**
|
44064 | * These are private action types reserved by Redux.
|
44065 | * For any unknown actions, you must return the current state.
|
44066 | * If the current state is undefined, you must return the initial state.
|
44067 | * Do not reference these action types directly in your code.
|
44068 | */
|
44069 | var randomString = function randomString() {
|
44070 | return Math.random().toString(36).substring(7).split('').join('.');
|
44071 | };
|
44072 |
|
44073 | var ActionTypes = {
|
44074 | INIT: "@@redux/INIT" + randomString(),
|
44075 | REPLACE: "@@redux/REPLACE" + randomString(),
|
44076 | PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() {
|
44077 | return "@@redux/PROBE_UNKNOWN_ACTION" + randomString();
|
44078 | }
|
44079 | };
|
44080 |
|
44081 | /**
|
44082 | * @param {any} obj The object to inspect.
|
44083 | * @returns {boolean} True if the argument appears to be a plain object.
|
44084 | */
|
44085 | function isPlainObject(obj) {
|
44086 | if (typeof obj !== 'object' || obj === null) return false;
|
44087 | var proto = obj;
|
44088 |
|
44089 | while (Object.getPrototypeOf(proto) !== null) {
|
44090 | proto = Object.getPrototypeOf(proto);
|
44091 | }
|
44092 |
|
44093 | return Object.getPrototypeOf(obj) === proto;
|
44094 | }
|
44095 |
|
44096 | /**
|
44097 | * Creates a Redux store that holds the state tree.
|
44098 | * The only way to change the data in the store is to call `dispatch()` on it.
|
44099 | *
|
44100 | * There should only be a single store in your app. To specify how different
|
44101 | * parts of the state tree respond to actions, you may combine several reducers
|
44102 | * into a single reducer function by using `combineReducers`.
|
44103 | *
|
44104 | * @param {Function} reducer A function that returns the next state tree, given
|
44105 | * the current state tree and the action to handle.
|
44106 | *
|
44107 | * @param {any} [preloadedState] The initial state. You may optionally specify it
|
44108 | * to hydrate the state from the server in universal apps, or to restore a
|
44109 | * previously serialized user session.
|
44110 | * If you use `combineReducers` to produce the root reducer function, this must be
|
44111 | * an object with the same shape as `combineReducers` keys.
|
44112 | *
|
44113 | * @param {Function} [enhancer] The store enhancer. You may optionally specify it
|
44114 | * to enhance the store with third-party capabilities such as middleware,
|
44115 | * time travel, persistence, etc. The only store enhancer that ships with Redux
|
44116 | * is `applyMiddleware()`.
|
44117 | *
|
44118 | * @returns {Store} A Redux store that lets you read the state, dispatch actions
|
44119 | * and subscribe to changes.
|
44120 | */
|
44121 |
|
44122 | function createStore(reducer, preloadedState, enhancer) {
|
44123 | var _ref2;
|
44124 |
|
44125 | if (typeof preloadedState === 'function' && typeof enhancer === 'function' || typeof enhancer === 'function' && typeof arguments[3] === 'function') {
|
44126 | throw new Error('It looks like you are passing several store enhancers to ' + 'createStore(). This is not supported. Instead, compose them ' + 'together to a single function');
|
44127 | }
|
44128 |
|
44129 | if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') {
|
44130 | enhancer = preloadedState;
|
44131 | preloadedState = undefined;
|
44132 | }
|
44133 |
|
44134 | if (typeof enhancer !== 'undefined') {
|
44135 | if (typeof enhancer !== 'function') {
|
44136 | throw new Error('Expected the enhancer to be a function.');
|
44137 | }
|
44138 |
|
44139 | return enhancer(createStore)(reducer, preloadedState);
|
44140 | }
|
44141 |
|
44142 | if (typeof reducer !== 'function') {
|
44143 | throw new Error('Expected the reducer to be a function.');
|
44144 | }
|
44145 |
|
44146 | var currentReducer = reducer;
|
44147 | var currentState = preloadedState;
|
44148 | var currentListeners = [];
|
44149 | var nextListeners = currentListeners;
|
44150 | var isDispatching = false;
|
44151 |
|
44152 | function ensureCanMutateNextListeners() {
|
44153 | if (nextListeners === currentListeners) {
|
44154 | nextListeners = currentListeners.slice();
|
44155 | }
|
44156 | }
|
44157 | /**
|
44158 | * Reads the state tree managed by the store.
|
44159 | *
|
44160 | * @returns {any} The current state tree of your application.
|
44161 | */
|
44162 |
|
44163 |
|
44164 | function getState() {
|
44165 | if (isDispatching) {
|
44166 | throw new Error('You may not call store.getState() while the reducer is executing. ' + 'The reducer has already received the state as an argument. ' + 'Pass it down from the top reducer instead of reading it from the store.');
|
44167 | }
|
44168 |
|
44169 | return currentState;
|
44170 | }
|
44171 | /**
|
44172 | * Adds a change listener. It will be called any time an action is dispatched,
|
44173 | * and some part of the state tree may potentially have changed. You may then
|
44174 | * call `getState()` to read the current state tree inside the callback.
|
44175 | *
|
44176 | * You may call `dispatch()` from a change listener, with the following
|
44177 | * caveats:
|
44178 | *
|
44179 | * 1. The subscriptions are snapshotted just before every `dispatch()` call.
|
44180 | * If you subscribe or unsubscribe while the listeners are being invoked, this
|
44181 | * will not have any effect on the `dispatch()` that is currently in progress.
|
44182 | * However, the next `dispatch()` call, whether nested or not, will use a more
|
44183 | * recent snapshot of the subscription list.
|
44184 | *
|
44185 | * 2. The listener should not expect to see all state changes, as the state
|
44186 | * might have been updated multiple times during a nested `dispatch()` before
|
44187 | * the listener is called. It is, however, guaranteed that all subscribers
|
44188 | * registered before the `dispatch()` started will be called with the latest
|
44189 | * state by the time it exits.
|
44190 | *
|
44191 | * @param {Function} listener A callback to be invoked on every dispatch.
|
44192 | * @returns {Function} A function to remove this change listener.
|
44193 | */
|
44194 |
|
44195 |
|
44196 | function subscribe(listener) {
|
44197 | if (typeof listener !== 'function') {
|
44198 | throw new Error('Expected the listener to be a function.');
|
44199 | }
|
44200 |
|
44201 | if (isDispatching) {
|
44202 | throw new Error('You may not call store.subscribe() while the reducer is executing. ' + 'If you would like to be notified after the store has been updated, subscribe from a ' + 'component and invoke store.getState() in the callback to access the latest state. ' + 'See https://redux.js.org/api-reference/store#subscribe(listener) for more details.');
|
44203 | }
|
44204 |
|
44205 | var isSubscribed = true;
|
44206 | ensureCanMutateNextListeners();
|
44207 | nextListeners.push(listener);
|
44208 | return function unsubscribe() {
|
44209 | if (!isSubscribed) {
|
44210 | return;
|
44211 | }
|
44212 |
|
44213 | if (isDispatching) {
|
44214 | throw new Error('You may not unsubscribe from a store listener while the reducer is executing. ' + 'See https://redux.js.org/api-reference/store#subscribe(listener) for more details.');
|
44215 | }
|
44216 |
|
44217 | isSubscribed = false;
|
44218 | ensureCanMutateNextListeners();
|
44219 | var index = nextListeners.indexOf(listener);
|
44220 | nextListeners.splice(index, 1);
|
44221 | };
|
44222 | }
|
44223 | /**
|
44224 | * Dispatches an action. It is the only way to trigger a state change.
|
44225 | *
|
44226 | * The `reducer` function, used to create the store, will be called with the
|
44227 | * current state tree and the given `action`. Its return value will
|
44228 | * be considered the **next** state of the tree, and the change listeners
|
44229 | * will be notified.
|
44230 | *
|
44231 | * The base implementation only supports plain object actions. If you want to
|
44232 | * dispatch a Promise, an Observable, a thunk, or something else, you need to
|
44233 | * wrap your store creating function into the corresponding middleware. For
|
44234 | * example, see the documentation for the `redux-thunk` package. Even the
|
44235 | * middleware will eventually dispatch plain object actions using this method.
|
44236 | *
|
44237 | * @param {Object} action A plain object representing “what changed”. It is
|
44238 | * a good idea to keep actions serializable so you can record and replay user
|
44239 | * sessions, or use the time travelling `redux-devtools`. An action must have
|
44240 | * a `type` property which may not be `undefined`. It is a good idea to use
|
44241 | * string constants for action types.
|
44242 | *
|
44243 | * @returns {Object} For convenience, the same action object you dispatched.
|
44244 | *
|
44245 | * Note that, if you use a custom middleware, it may wrap `dispatch()` to
|
44246 | * return something else (for example, a Promise you can await).
|
44247 | */
|
44248 |
|
44249 |
|
44250 | function dispatch(action) {
|
44251 | if (!isPlainObject(action)) {
|
44252 | throw new Error('Actions must be plain objects. ' + 'Use custom middleware for async actions.');
|
44253 | }
|
44254 |
|
44255 | if (typeof action.type === 'undefined') {
|
44256 | throw new Error('Actions may not have an undefined "type" property. ' + 'Have you misspelled a constant?');
|
44257 | }
|
44258 |
|
44259 | if (isDispatching) {
|
44260 | throw new Error('Reducers may not dispatch actions.');
|
44261 | }
|
44262 |
|
44263 | try {
|
44264 | isDispatching = true;
|
44265 | currentState = currentReducer(currentState, action);
|
44266 | } finally {
|
44267 | isDispatching = false;
|
44268 | }
|
44269 |
|
44270 | var listeners = currentListeners = nextListeners;
|
44271 |
|
44272 | for (var i = 0; i < listeners.length; i++) {
|
44273 | var listener = listeners[i];
|
44274 | listener();
|
44275 | }
|
44276 |
|
44277 | return action;
|
44278 | }
|
44279 | /**
|
44280 | * Replaces the reducer currently used by the store to calculate the state.
|
44281 | *
|
44282 | * You might need this if your app implements code splitting and you want to
|
44283 | * load some of the reducers dynamically. You might also need this if you
|
44284 | * implement a hot reloading mechanism for Redux.
|
44285 | *
|
44286 | * @param {Function} nextReducer The reducer for the store to use instead.
|
44287 | * @returns {void}
|
44288 | */
|
44289 |
|
44290 |
|
44291 | function replaceReducer(nextReducer) {
|
44292 | if (typeof nextReducer !== 'function') {
|
44293 | throw new Error('Expected the nextReducer to be a function.');
|
44294 | }
|
44295 |
|
44296 | currentReducer = nextReducer;
|
44297 | dispatch({
|
44298 | type: ActionTypes.REPLACE
|
44299 | });
|
44300 | }
|
44301 | /**
|
44302 | * Interoperability point for observable/reactive libraries.
|
44303 | * @returns {observable} A minimal observable of state changes.
|
44304 | * For more information, see the observable proposal:
|
44305 | * https://github.com/tc39/proposal-observable
|
44306 | */
|
44307 |
|
44308 |
|
44309 | function observable() {
|
44310 | var _ref;
|
44311 |
|
44312 | var outerSubscribe = subscribe;
|
44313 | return _ref = {
|
44314 | /**
|
44315 | * The minimal observable subscription method.
|
44316 | * @param {Object} observer Any object that can be used as an observer.
|
44317 | * The observer object should have a `next` method.
|
44318 | * @returns {subscription} An object with an `unsubscribe` method that can
|
44319 | * be used to unsubscribe the observable from the store, and prevent further
|
44320 | * emission of values from the observable.
|
44321 | */
|
44322 | subscribe: function subscribe(observer) {
|
44323 | if (typeof observer !== 'object' || observer === null) {
|
44324 | throw new TypeError('Expected the observer to be an object.');
|
44325 | }
|
44326 |
|
44327 | function observeState() {
|
44328 | if (observer.next) {
|
44329 | observer.next(getState());
|
44330 | }
|
44331 | }
|
44332 |
|
44333 | observeState();
|
44334 | var unsubscribe = outerSubscribe(observeState);
|
44335 | return {
|
44336 | unsubscribe: unsubscribe
|
44337 | };
|
44338 | }
|
44339 | }, _ref[result] = function () {
|
44340 | return this;
|
44341 | }, _ref;
|
44342 | } // When a store is created, an "INIT" action is dispatched so that every
|
44343 | // reducer returns their initial state. This effectively populates
|
44344 | // the initial state tree.
|
44345 |
|
44346 |
|
44347 | dispatch({
|
44348 | type: ActionTypes.INIT
|
44349 | });
|
44350 | return _ref2 = {
|
44351 | dispatch: dispatch,
|
44352 | subscribe: subscribe,
|
44353 | getState: getState,
|
44354 | replaceReducer: replaceReducer
|
44355 | }, _ref2[result] = observable, _ref2;
|
44356 | }
|
44357 |
|
44358 | /**
|
44359 | * Prints a warning in the console if it exists.
|
44360 | *
|
44361 | * @param {String} message The warning message.
|
44362 | * @returns {void}
|
44363 | */
|
44364 | function warning(message) {
|
44365 | /* eslint-disable no-console */
|
44366 | if (typeof console !== 'undefined' && typeof console.error === 'function') {
|
44367 | console.error(message);
|
44368 | }
|
44369 | /* eslint-enable no-console */
|
44370 |
|
44371 |
|
44372 | try {
|
44373 | // This error was thrown as a convenience so that if you enable
|
44374 | // "break on all exceptions" in your console,
|
44375 | // it would pause the execution at this line.
|
44376 | throw new Error(message);
|
44377 | } catch (e) {} // eslint-disable-line no-empty
|
44378 |
|
44379 | }
|
44380 |
|
44381 | function getUndefinedStateErrorMessage(key, action) {
|
44382 | var actionType = action && action.type;
|
44383 | var actionDescription = actionType && "action \"" + String(actionType) + "\"" || 'an action';
|
44384 | return "Given " + actionDescription + ", reducer \"" + key + "\" returned undefined. " + "To ignore an action, you must explicitly return the previous state. " + "If you want this reducer to hold no value, you can return null instead of undefined.";
|
44385 | }
|
44386 |
|
44387 | function getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) {
|
44388 | var reducerKeys = Object.keys(reducers);
|
44389 | var argumentName = action && action.type === ActionTypes.INIT ? 'preloadedState argument passed to createStore' : 'previous state received by the reducer';
|
44390 |
|
44391 | if (reducerKeys.length === 0) {
|
44392 | return 'Store does not have a valid reducer. Make sure the argument passed ' + 'to combineReducers is an object whose values are reducers.';
|
44393 | }
|
44394 |
|
44395 | if (!isPlainObject(inputState)) {
|
44396 | return "The " + argumentName + " has unexpected type of \"" + {}.toString.call(inputState).match(/\s([a-z|A-Z]+)/)[1] + "\". Expected argument to be an object with the following " + ("keys: \"" + reducerKeys.join('", "') + "\"");
|
44397 | }
|
44398 |
|
44399 | var unexpectedKeys = Object.keys(inputState).filter(function (key) {
|
44400 | return !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key];
|
44401 | });
|
44402 | unexpectedKeys.forEach(function (key) {
|
44403 | unexpectedKeyCache[key] = true;
|
44404 | });
|
44405 | if (action && action.type === ActionTypes.REPLACE) return;
|
44406 |
|
44407 | if (unexpectedKeys.length > 0) {
|
44408 | return "Unexpected " + (unexpectedKeys.length > 1 ? 'keys' : 'key') + " " + ("\"" + unexpectedKeys.join('", "') + "\" found in " + argumentName + ". ") + "Expected to find one of the known reducer keys instead: " + ("\"" + reducerKeys.join('", "') + "\". Unexpected keys will be ignored.");
|
44409 | }
|
44410 | }
|
44411 |
|
44412 | function assertReducerShape(reducers) {
|
44413 | Object.keys(reducers).forEach(function (key) {
|
44414 | var reducer = reducers[key];
|
44415 | var initialState = reducer(undefined, {
|
44416 | type: ActionTypes.INIT
|
44417 | });
|
44418 |
|
44419 | if (typeof initialState === 'undefined') {
|
44420 | throw new Error("Reducer \"" + key + "\" returned undefined during initialization. " + "If the state passed to the reducer is undefined, you must " + "explicitly return the initial state. The initial state may " + "not be undefined. If you don't want to set a value for this reducer, " + "you can use null instead of undefined.");
|
44421 | }
|
44422 |
|
44423 | if (typeof reducer(undefined, {
|
44424 | type: ActionTypes.PROBE_UNKNOWN_ACTION()
|
44425 | }) === 'undefined') {
|
44426 | throw new Error("Reducer \"" + key + "\" returned undefined when probed with a random type. " + ("Don't try to handle " + ActionTypes.INIT + " or other actions in \"redux/*\" ") + "namespace. They are considered private. Instead, you must return the " + "current state for any unknown actions, unless it is undefined, " + "in which case you must return the initial state, regardless of the " + "action type. The initial state may not be undefined, but can be null.");
|
44427 | }
|
44428 | });
|
44429 | }
|
44430 | /**
|
44431 | * Turns an object whose values are different reducer functions, into a single
|
44432 | * reducer function. It will call every child reducer, and gather their results
|
44433 | * into a single state object, whose keys correspond to the keys of the passed
|
44434 | * reducer functions.
|
44435 | *
|
44436 | * @param {Object} reducers An object whose values correspond to different
|
44437 | * reducer functions that need to be combined into one. One handy way to obtain
|
44438 | * it is to use ES6 `import * as reducers` syntax. The reducers may never return
|
44439 | * undefined for any action. Instead, they should return their initial state
|
44440 | * if the state passed to them was undefined, and the current state for any
|
44441 | * unrecognized action.
|
44442 | *
|
44443 | * @returns {Function} A reducer function that invokes every reducer inside the
|
44444 | * passed object, and builds a state object with the same shape.
|
44445 | */
|
44446 |
|
44447 |
|
44448 | function combineReducers(reducers) {
|
44449 | var reducerKeys = Object.keys(reducers);
|
44450 | var finalReducers = {};
|
44451 |
|
44452 | for (var i = 0; i < reducerKeys.length; i++) {
|
44453 | var key = reducerKeys[i];
|
44454 |
|
44455 | if (process.env.NODE_ENV !== 'production') {
|
44456 | if (typeof reducers[key] === 'undefined') {
|
44457 | warning("No reducer provided for key \"" + key + "\"");
|
44458 | }
|
44459 | }
|
44460 |
|
44461 | if (typeof reducers[key] === 'function') {
|
44462 | finalReducers[key] = reducers[key];
|
44463 | }
|
44464 | }
|
44465 |
|
44466 | var finalReducerKeys = Object.keys(finalReducers);
|
44467 | var unexpectedKeyCache;
|
44468 |
|
44469 | if (process.env.NODE_ENV !== 'production') {
|
44470 | unexpectedKeyCache = {};
|
44471 | }
|
44472 |
|
44473 | var shapeAssertionError;
|
44474 |
|
44475 | try {
|
44476 | assertReducerShape(finalReducers);
|
44477 | } catch (e) {
|
44478 | shapeAssertionError = e;
|
44479 | }
|
44480 |
|
44481 | return function combination(state, action) {
|
44482 | if (state === void 0) {
|
44483 | state = {};
|
44484 | }
|
44485 |
|
44486 | if (shapeAssertionError) {
|
44487 | throw shapeAssertionError;
|
44488 | }
|
44489 |
|
44490 | if (process.env.NODE_ENV !== 'production') {
|
44491 | var warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache);
|
44492 |
|
44493 | if (warningMessage) {
|
44494 | warning(warningMessage);
|
44495 | }
|
44496 | }
|
44497 |
|
44498 | var hasChanged = false;
|
44499 | var nextState = {};
|
44500 |
|
44501 | for (var _i = 0; _i < finalReducerKeys.length; _i++) {
|
44502 | var _key = finalReducerKeys[_i];
|
44503 | var reducer = finalReducers[_key];
|
44504 | var previousStateForKey = state[_key];
|
44505 | var nextStateForKey = reducer(previousStateForKey, action);
|
44506 |
|
44507 | if (typeof nextStateForKey === 'undefined') {
|
44508 | var errorMessage = getUndefinedStateErrorMessage(_key, action);
|
44509 | throw new Error(errorMessage);
|
44510 | }
|
44511 |
|
44512 | nextState[_key] = nextStateForKey;
|
44513 | hasChanged = hasChanged || nextStateForKey !== previousStateForKey;
|
44514 | }
|
44515 |
|
44516 | return hasChanged ? nextState : state;
|
44517 | };
|
44518 | }
|
44519 |
|
44520 | function bindActionCreator(actionCreator, dispatch) {
|
44521 | return function () {
|
44522 | return dispatch(actionCreator.apply(this, arguments));
|
44523 | };
|
44524 | }
|
44525 | /**
|
44526 | * Turns an object whose values are action creators, into an object with the
|
44527 | * same keys, but with every function wrapped into a `dispatch` call so they
|
44528 | * may be invoked directly. This is just a convenience method, as you can call
|
44529 | * `store.dispatch(MyActionCreators.doSomething())` yourself just fine.
|
44530 | *
|
44531 | * For convenience, you can also pass a single function as the first argument,
|
44532 | * and get a function in return.
|
44533 | *
|
44534 | * @param {Function|Object} actionCreators An object whose values are action
|
44535 | * creator functions. One handy way to obtain it is to use ES6 `import * as`
|
44536 | * syntax. You may also pass a single function.
|
44537 | *
|
44538 | * @param {Function} dispatch The `dispatch` function available on your Redux
|
44539 | * store.
|
44540 | *
|
44541 | * @returns {Function|Object} The object mimicking the original object, but with
|
44542 | * every action creator wrapped into the `dispatch` call. If you passed a
|
44543 | * function as `actionCreators`, the return value will also be a single
|
44544 | * function.
|
44545 | */
|
44546 |
|
44547 |
|
44548 | function bindActionCreators(actionCreators, dispatch) {
|
44549 | if (typeof actionCreators === 'function') {
|
44550 | return bindActionCreator(actionCreators, dispatch);
|
44551 | }
|
44552 |
|
44553 | if (typeof actionCreators !== 'object' || actionCreators === null) {
|
44554 | throw new Error("bindActionCreators expected an object or a function, instead received " + (actionCreators === null ? 'null' : typeof actionCreators) + ". " + "Did you write \"import ActionCreators from\" instead of \"import * as ActionCreators from\"?");
|
44555 | }
|
44556 |
|
44557 | var keys = Object.keys(actionCreators);
|
44558 | var boundActionCreators = {};
|
44559 |
|
44560 | for (var i = 0; i < keys.length; i++) {
|
44561 | var key = keys[i];
|
44562 | var actionCreator = actionCreators[key];
|
44563 |
|
44564 | if (typeof actionCreator === 'function') {
|
44565 | boundActionCreators[key] = bindActionCreator(actionCreator, dispatch);
|
44566 | }
|
44567 | }
|
44568 |
|
44569 | return boundActionCreators;
|
44570 | }
|
44571 |
|
44572 | function _defineProperty$2(obj, key, value) {
|
44573 | if (key in obj) {
|
44574 | Object.defineProperty(obj, key, {
|
44575 | value: value,
|
44576 | enumerable: true,
|
44577 | configurable: true,
|
44578 | writable: true
|
44579 | });
|
44580 | } else {
|
44581 | obj[key] = value;
|
44582 | }
|
44583 |
|
44584 | return obj;
|
44585 | }
|
44586 |
|
44587 | function _objectSpread$1(target) {
|
44588 | for (var i = 1; i < arguments.length; i++) {
|
44589 | var source = arguments[i] != null ? arguments[i] : {};
|
44590 | var ownKeys = Object.keys(source);
|
44591 |
|
44592 | if (typeof Object.getOwnPropertySymbols === 'function') {
|
44593 | ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
|
44594 | return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
44595 | }));
|
44596 | }
|
44597 |
|
44598 | ownKeys.forEach(function (key) {
|
44599 | _defineProperty$2(target, key, source[key]);
|
44600 | });
|
44601 | }
|
44602 |
|
44603 | return target;
|
44604 | }
|
44605 |
|
44606 | /**
|
44607 | * Composes single-argument functions from right to left. The rightmost
|
44608 | * function can take multiple arguments as it provides the signature for
|
44609 | * the resulting composite function.
|
44610 | *
|
44611 | * @param {...Function} funcs The functions to compose.
|
44612 | * @returns {Function} A function obtained by composing the argument functions
|
44613 | * from right to left. For example, compose(f, g, h) is identical to doing
|
44614 | * (...args) => f(g(h(...args))).
|
44615 | */
|
44616 | function compose() {
|
44617 | for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {
|
44618 | funcs[_key] = arguments[_key];
|
44619 | }
|
44620 |
|
44621 | if (funcs.length === 0) {
|
44622 | return function (arg) {
|
44623 | return arg;
|
44624 | };
|
44625 | }
|
44626 |
|
44627 | if (funcs.length === 1) {
|
44628 | return funcs[0];
|
44629 | }
|
44630 |
|
44631 | return funcs.reduce(function (a, b) {
|
44632 | return function () {
|
44633 | return a(b.apply(void 0, arguments));
|
44634 | };
|
44635 | });
|
44636 | }
|
44637 |
|
44638 | /**
|
44639 | * Creates a store enhancer that applies middleware to the dispatch method
|
44640 | * of the Redux store. This is handy for a variety of tasks, such as expressing
|
44641 | * asynchronous actions in a concise manner, or logging every action payload.
|
44642 | *
|
44643 | * See `redux-thunk` package as an example of the Redux middleware.
|
44644 | *
|
44645 | * Because middleware is potentially asynchronous, this should be the first
|
44646 | * store enhancer in the composition chain.
|
44647 | *
|
44648 | * Note that each middleware will be given the `dispatch` and `getState` functions
|
44649 | * as named arguments.
|
44650 | *
|
44651 | * @param {...Function} middlewares The middleware chain to be applied.
|
44652 | * @returns {Function} A store enhancer applying the middleware.
|
44653 | */
|
44654 |
|
44655 | function applyMiddleware() {
|
44656 | for (var _len = arguments.length, middlewares = new Array(_len), _key = 0; _key < _len; _key++) {
|
44657 | middlewares[_key] = arguments[_key];
|
44658 | }
|
44659 |
|
44660 | return function (createStore) {
|
44661 | return function () {
|
44662 | var store = createStore.apply(void 0, arguments);
|
44663 |
|
44664 | var _dispatch = function dispatch() {
|
44665 | throw new Error("Dispatching while constructing your middleware is not allowed. " + "Other middleware would not be applied to this dispatch.");
|
44666 | };
|
44667 |
|
44668 | var middlewareAPI = {
|
44669 | getState: store.getState,
|
44670 | dispatch: function dispatch() {
|
44671 | return _dispatch.apply(void 0, arguments);
|
44672 | }
|
44673 | };
|
44674 | var chain = middlewares.map(function (middleware) {
|
44675 | return middleware(middlewareAPI);
|
44676 | });
|
44677 | _dispatch = compose.apply(void 0, chain)(store.dispatch);
|
44678 | return _objectSpread$1({}, store, {
|
44679 | dispatch: _dispatch
|
44680 | });
|
44681 | };
|
44682 | };
|
44683 | }
|
44684 |
|
44685 | /*
|
44686 | * This is a dummy function to check if the function name has been altered by minification.
|
44687 | * If the function has been minified and NODE_ENV !== 'production', warn the user.
|
44688 | */
|
44689 |
|
44690 | function isCrushed() {}
|
44691 |
|
44692 | if (process.env.NODE_ENV !== 'production' && typeof isCrushed.name === 'string' && isCrushed.name !== 'isCrushed') {
|
44693 | warning('You are currently using minified code outside of NODE_ENV === "production". ' + 'This means that you are running a slower development build of Redux. ' + 'You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify ' + 'or setting mode to production in webpack (https://webpack.js.org/concepts/mode/) ' + 'to ensure you have the correct code for your production build.');
|
44694 | }
|
44695 |
|
44696 | var redux = /*#__PURE__*/Object.freeze({
|
44697 | createStore: createStore,
|
44698 | combineReducers: combineReducers,
|
44699 | bindActionCreators: bindActionCreators,
|
44700 | applyMiddleware: applyMiddleware,
|
44701 | compose: compose,
|
44702 | __DO_NOT_USE__ActionTypes: ActionTypes
|
44703 | });
|
44704 |
|
44705 | var types = createCommonjsModule(function (module, exports) {
|
44706 | Object.defineProperty(exports, "__esModule", { value: true });
|
44707 | exports.INIT_COORDS = 'dnd-core/INIT_COORDS';
|
44708 | exports.BEGIN_DRAG = 'dnd-core/BEGIN_DRAG';
|
44709 | exports.PUBLISH_DRAG_SOURCE = 'dnd-core/PUBLISH_DRAG_SOURCE';
|
44710 | exports.HOVER = 'dnd-core/HOVER';
|
44711 | exports.DROP = 'dnd-core/DROP';
|
44712 | exports.END_DRAG = 'dnd-core/END_DRAG';
|
44713 | });
|
44714 |
|
44715 | unwrapExports(types);
|
44716 | var types_1 = types.INIT_COORDS;
|
44717 | var types_2 = types.BEGIN_DRAG;
|
44718 | var types_3 = types.PUBLISH_DRAG_SOURCE;
|
44719 | var types_4 = types.HOVER;
|
44720 | var types_5 = types.DROP;
|
44721 | var types_6 = types.END_DRAG;
|
44722 |
|
44723 | var setClientOffset_1 = createCommonjsModule(function (module, exports) {
|
44724 | Object.defineProperty(exports, "__esModule", { value: true });
|
44725 |
|
44726 | function setClientOffset(clientOffset, sourceClientOffset) {
|
44727 | return {
|
44728 | type: types.INIT_COORDS,
|
44729 | payload: {
|
44730 | sourceClientOffset: sourceClientOffset || null,
|
44731 | clientOffset: clientOffset || null,
|
44732 | },
|
44733 | };
|
44734 | }
|
44735 | exports.setClientOffset = setClientOffset;
|
44736 | });
|
44737 |
|
44738 | unwrapExports(setClientOffset_1);
|
44739 | var setClientOffset_2 = setClientOffset_1.setClientOffset;
|
44740 |
|
44741 | var js_utils = createCommonjsModule(function (module, exports) {
|
44742 | // cheap lodash replacements
|
44743 | Object.defineProperty(exports, "__esModule", { value: true });
|
44744 | /**
|
44745 | * drop-in replacement for _.get
|
44746 | * @param obj
|
44747 | * @param path
|
44748 | * @param defaultValue
|
44749 | */
|
44750 | function get(obj, path, defaultValue) {
|
44751 | return path
|
44752 | .split('.')
|
44753 | .reduce(function (a, c) { return (a && a[c] ? a[c] : defaultValue || null); }, obj);
|
44754 | }
|
44755 | exports.get = get;
|
44756 | /**
|
44757 | * drop-in replacement for _.without
|
44758 | */
|
44759 | function without(items, item) {
|
44760 | return items.filter(function (i) { return i !== item; });
|
44761 | }
|
44762 | exports.without = without;
|
44763 | /**
|
44764 | * drop-in replacement for _.isString
|
44765 | * @param input
|
44766 | */
|
44767 | function isString(input) {
|
44768 | return typeof input === 'string';
|
44769 | }
|
44770 | exports.isString = isString;
|
44771 | /**
|
44772 | * drop-in replacement for _.isString
|
44773 | * @param input
|
44774 | */
|
44775 | function isObject(input) {
|
44776 | return typeof input === 'object';
|
44777 | }
|
44778 | exports.isObject = isObject;
|
44779 | /**
|
44780 | * repalcement for _.xor
|
44781 | * @param itemsA
|
44782 | * @param itemsB
|
44783 | */
|
44784 | function xor(itemsA, itemsB) {
|
44785 | var map = new Map();
|
44786 | var insertItem = function (item) {
|
44787 | return map.set(item, map.has(item) ? map.get(item) + 1 : 1);
|
44788 | };
|
44789 | itemsA.forEach(insertItem);
|
44790 | itemsB.forEach(insertItem);
|
44791 | var result = [];
|
44792 | map.forEach(function (count, key) {
|
44793 | if (count === 1) {
|
44794 | result.push(key);
|
44795 | }
|
44796 | });
|
44797 | return result;
|
44798 | }
|
44799 | exports.xor = xor;
|
44800 | /**
|
44801 | * replacement for _.intersection
|
44802 | * @param itemsA
|
44803 | * @param itemsB
|
44804 | */
|
44805 | function intersection(itemsA, itemsB) {
|
44806 | return itemsA.filter(function (t) { return itemsB.indexOf(t) > -1; });
|
44807 | }
|
44808 | exports.intersection = intersection;
|
44809 | });
|
44810 |
|
44811 | unwrapExports(js_utils);
|
44812 | var js_utils_1 = js_utils.get;
|
44813 | var js_utils_2 = js_utils.without;
|
44814 | var js_utils_3 = js_utils.isString;
|
44815 | var js_utils_4 = js_utils.isObject;
|
44816 | var js_utils_5 = js_utils.xor;
|
44817 | var js_utils_6 = js_utils.intersection;
|
44818 |
|
44819 | var beginDrag = createCommonjsModule(function (module, exports) {
|
44820 | var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
44821 | return (mod && mod.__esModule) ? mod : { "default": mod };
|
44822 | };
|
44823 | Object.defineProperty(exports, "__esModule", { value: true });
|
44824 | var invariant_1$$1 = __importDefault(invariant_1);
|
44825 |
|
44826 |
|
44827 |
|
44828 | var ResetCoordinatesAction = {
|
44829 | type: types.INIT_COORDS,
|
44830 | payload: {
|
44831 | clientOffset: null,
|
44832 | sourceClientOffset: null,
|
44833 | },
|
44834 | };
|
44835 | function createBeginDrag(manager) {
|
44836 | return function beginDrag(sourceIds, options) {
|
44837 | if (sourceIds === void 0) { sourceIds = []; }
|
44838 | if (options === void 0) { options = {
|
44839 | publishSource: true,
|
44840 | }; }
|
44841 | var _a = options.publishSource, publishSource = _a === void 0 ? true : _a, clientOffset = options.clientOffset, getSourceClientOffset = options.getSourceClientOffset;
|
44842 | var monitor = manager.getMonitor();
|
44843 | var registry = manager.getRegistry();
|
44844 | // Initialize the coordinates using the client offset
|
44845 | manager.dispatch(setClientOffset_1.setClientOffset(clientOffset));
|
44846 | verifyInvariants(sourceIds, monitor, registry);
|
44847 | // Get the draggable source
|
44848 | var sourceId = getDraggableSource(sourceIds, monitor);
|
44849 | if (sourceId === null) {
|
44850 | manager.dispatch(ResetCoordinatesAction);
|
44851 | return;
|
44852 | }
|
44853 | // Get the source client offset
|
44854 | var sourceClientOffset = null;
|
44855 | if (clientOffset) {
|
44856 | verifyGetSourceClientOffsetIsFunction(getSourceClientOffset);
|
44857 | sourceClientOffset = getSourceClientOffset(sourceId);
|
44858 | }
|
44859 | // Initialize the full coordinates
|
44860 | manager.dispatch(setClientOffset_1.setClientOffset(clientOffset, sourceClientOffset));
|
44861 | var source = registry.getSource(sourceId);
|
44862 | var item = source.beginDrag(monitor, sourceId);
|
44863 | verifyItemIsObject(item);
|
44864 | registry.pinSource(sourceId);
|
44865 | var itemType = registry.getSourceType(sourceId);
|
44866 | return {
|
44867 | type: types.BEGIN_DRAG,
|
44868 | payload: {
|
44869 | itemType: itemType,
|
44870 | item: item,
|
44871 | sourceId: sourceId,
|
44872 | clientOffset: clientOffset || null,
|
44873 | sourceClientOffset: sourceClientOffset || null,
|
44874 | isSourcePublic: !!publishSource,
|
44875 | },
|
44876 | };
|
44877 | };
|
44878 | }
|
44879 | exports.default = createBeginDrag;
|
44880 | function verifyInvariants(sourceIds, monitor, registry) {
|
44881 | invariant_1$$1.default(!monitor.isDragging(), 'Cannot call beginDrag while dragging.');
|
44882 | for (var _i = 0, sourceIds_1 = sourceIds; _i < sourceIds_1.length; _i++) {
|
44883 | var s = sourceIds_1[_i];
|
44884 | invariant_1$$1.default(registry.getSource(s), 'Expected sourceIds to be registered.');
|
44885 | }
|
44886 | }
|
44887 | function verifyGetSourceClientOffsetIsFunction(getSourceClientOffset) {
|
44888 | invariant_1$$1.default(typeof getSourceClientOffset === 'function', 'When clientOffset is provided, getSourceClientOffset must be a function.');
|
44889 | }
|
44890 | function verifyItemIsObject(item) {
|
44891 | invariant_1$$1.default(js_utils.isObject(item), 'Item must be an object.');
|
44892 | }
|
44893 | function getDraggableSource(sourceIds, monitor) {
|
44894 | var sourceId = null;
|
44895 | for (var i = sourceIds.length - 1; i >= 0; i--) {
|
44896 | if (monitor.canDragSource(sourceIds[i])) {
|
44897 | sourceId = sourceIds[i];
|
44898 | break;
|
44899 | }
|
44900 | }
|
44901 | return sourceId;
|
44902 | }
|
44903 | });
|
44904 |
|
44905 | unwrapExports(beginDrag);
|
44906 |
|
44907 | var publishDragSource = createCommonjsModule(function (module, exports) {
|
44908 | Object.defineProperty(exports, "__esModule", { value: true });
|
44909 |
|
44910 | function createPublishDragSource(manager) {
|
44911 | return function publishDragSource() {
|
44912 | var monitor = manager.getMonitor();
|
44913 | if (monitor.isDragging()) {
|
44914 | return { type: types.PUBLISH_DRAG_SOURCE };
|
44915 | }
|
44916 | };
|
44917 | }
|
44918 | exports.default = createPublishDragSource;
|
44919 | });
|
44920 |
|
44921 | unwrapExports(publishDragSource);
|
44922 |
|
44923 | var matchesType_1 = createCommonjsModule(function (module, exports) {
|
44924 | Object.defineProperty(exports, "__esModule", { value: true });
|
44925 | function matchesType(targetType, draggedItemType) {
|
44926 | if (draggedItemType === null) {
|
44927 | return targetType === null;
|
44928 | }
|
44929 | return Array.isArray(targetType)
|
44930 | ? targetType.some(function (t) { return t === draggedItemType; })
|
44931 | : targetType === draggedItemType;
|
44932 | }
|
44933 | exports.default = matchesType;
|
44934 | });
|
44935 |
|
44936 | unwrapExports(matchesType_1);
|
44937 |
|
44938 | var hover = createCommonjsModule(function (module, exports) {
|
44939 | var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
44940 | return (mod && mod.__esModule) ? mod : { "default": mod };
|
44941 | };
|
44942 | Object.defineProperty(exports, "__esModule", { value: true });
|
44943 | var invariant_1$$1 = __importDefault(invariant_1);
|
44944 | var matchesType_1$$1 = __importDefault(matchesType_1);
|
44945 |
|
44946 | function createHover(manager) {
|
44947 | return function hover(targetIdsArg, _a) {
|
44948 | var clientOffset = (_a === void 0 ? {} : _a).clientOffset;
|
44949 | verifyTargetIdsIsArray(targetIdsArg);
|
44950 | var targetIds = targetIdsArg.slice(0);
|
44951 | var monitor = manager.getMonitor();
|
44952 | var registry = manager.getRegistry();
|
44953 | checkInvariants(targetIds, monitor, registry);
|
44954 | var draggedItemType = monitor.getItemType();
|
44955 | removeNonMatchingTargetIds(targetIds, registry, draggedItemType);
|
44956 | hoverAllTargets(targetIds, monitor, registry);
|
44957 | return {
|
44958 | type: types.HOVER,
|
44959 | payload: {
|
44960 | targetIds: targetIds,
|
44961 | clientOffset: clientOffset || null,
|
44962 | },
|
44963 | };
|
44964 | };
|
44965 | }
|
44966 | exports.default = createHover;
|
44967 | function verifyTargetIdsIsArray(targetIdsArg) {
|
44968 | invariant_1$$1.default(Array.isArray(targetIdsArg), 'Expected targetIds to be an array.');
|
44969 | }
|
44970 | function checkInvariants(targetIds, monitor, registry) {
|
44971 | invariant_1$$1.default(monitor.isDragging(), 'Cannot call hover while not dragging.');
|
44972 | invariant_1$$1.default(!monitor.didDrop(), 'Cannot call hover after drop.');
|
44973 | for (var i = 0; i < targetIds.length; i++) {
|
44974 | var targetId = targetIds[i];
|
44975 | invariant_1$$1.default(targetIds.lastIndexOf(targetId) === i, 'Expected targetIds to be unique in the passed array.');
|
44976 | var target = registry.getTarget(targetId);
|
44977 | invariant_1$$1.default(target, 'Expected targetIds to be registered.');
|
44978 | }
|
44979 | }
|
44980 | function removeNonMatchingTargetIds(targetIds, registry, draggedItemType) {
|
44981 | // Remove those targetIds that don't match the targetType. This
|
44982 | // fixes shallow isOver which would only be non-shallow because of
|
44983 | // non-matching targets.
|
44984 | for (var i = targetIds.length - 1; i >= 0; i--) {
|
44985 | var targetId = targetIds[i];
|
44986 | var targetType = registry.getTargetType(targetId);
|
44987 | if (!matchesType_1$$1.default(targetType, draggedItemType)) {
|
44988 | targetIds.splice(i, 1);
|
44989 | }
|
44990 | }
|
44991 | }
|
44992 | function hoverAllTargets(targetIds, monitor, registry) {
|
44993 | // Finally call hover on all matching targets.
|
44994 | for (var _i = 0, targetIds_1 = targetIds; _i < targetIds_1.length; _i++) {
|
44995 | var targetId = targetIds_1[_i];
|
44996 | var target = registry.getTarget(targetId);
|
44997 | target.hover(monitor, targetId);
|
44998 | }
|
44999 | }
|
45000 | });
|
45001 |
|
45002 | unwrapExports(hover);
|
45003 |
|
45004 | var drop = createCommonjsModule(function (module, exports) {
|
45005 | var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
|
45006 | __assign = Object.assign || function(t) {
|
45007 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
45008 | s = arguments[i];
|
45009 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
45010 | t[p] = s[p];
|
45011 | }
|
45012 | return t;
|
45013 | };
|
45014 | return __assign.apply(this, arguments);
|
45015 | };
|
45016 | var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
45017 | return (mod && mod.__esModule) ? mod : { "default": mod };
|
45018 | };
|
45019 | Object.defineProperty(exports, "__esModule", { value: true });
|
45020 | var invariant_1$$1 = __importDefault(invariant_1);
|
45021 |
|
45022 |
|
45023 | function createDrop(manager) {
|
45024 | return function drop(options) {
|
45025 | if (options === void 0) { options = {}; }
|
45026 | var monitor = manager.getMonitor();
|
45027 | var registry = manager.getRegistry();
|
45028 | verifyInvariants(monitor);
|
45029 | var targetIds = getDroppableTargets(monitor);
|
45030 | // Multiple actions are dispatched here, which is why this doesn't return an action
|
45031 | targetIds.forEach(function (targetId, index) {
|
45032 | var dropResult = determineDropResult(targetId, index, registry, monitor);
|
45033 | var action = {
|
45034 | type: types.DROP,
|
45035 | payload: {
|
45036 | dropResult: __assign({}, options, dropResult),
|
45037 | },
|
45038 | };
|
45039 | manager.dispatch(action);
|
45040 | });
|
45041 | };
|
45042 | }
|
45043 | exports.default = createDrop;
|
45044 | function verifyInvariants(monitor) {
|
45045 | invariant_1$$1.default(monitor.isDragging(), 'Cannot call drop while not dragging.');
|
45046 | invariant_1$$1.default(!monitor.didDrop(), 'Cannot call drop twice during one drag operation.');
|
45047 | }
|
45048 | function determineDropResult(targetId, index, registry, monitor) {
|
45049 | var target = registry.getTarget(targetId);
|
45050 | var dropResult = target ? target.drop(monitor, targetId) : undefined;
|
45051 | verifyDropResultType(dropResult);
|
45052 | if (typeof dropResult === 'undefined') {
|
45053 | dropResult = index === 0 ? {} : monitor.getDropResult();
|
45054 | }
|
45055 | return dropResult;
|
45056 | }
|
45057 | function verifyDropResultType(dropResult) {
|
45058 | invariant_1$$1.default(typeof dropResult === 'undefined' || js_utils.isObject(dropResult), 'Drop result must either be an object or undefined.');
|
45059 | }
|
45060 | function getDroppableTargets(monitor) {
|
45061 | var targetIds = monitor
|
45062 | .getTargetIds()
|
45063 | .filter(monitor.canDropOnTarget, monitor);
|
45064 | targetIds.reverse();
|
45065 | return targetIds;
|
45066 | }
|
45067 | });
|
45068 |
|
45069 | unwrapExports(drop);
|
45070 |
|
45071 | var endDrag = createCommonjsModule(function (module, exports) {
|
45072 | var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
45073 | return (mod && mod.__esModule) ? mod : { "default": mod };
|
45074 | };
|
45075 | Object.defineProperty(exports, "__esModule", { value: true });
|
45076 | var invariant_1$$1 = __importDefault(invariant_1);
|
45077 |
|
45078 | function createEndDrag(manager) {
|
45079 | return function endDrag() {
|
45080 | var monitor = manager.getMonitor();
|
45081 | var registry = manager.getRegistry();
|
45082 | verifyIsDragging(monitor);
|
45083 | var sourceId = monitor.getSourceId();
|
45084 | var source = registry.getSource(sourceId, true);
|
45085 | source.endDrag(monitor, sourceId);
|
45086 | registry.unpinSource();
|
45087 | return { type: types.END_DRAG };
|
45088 | };
|
45089 | }
|
45090 | exports.default = createEndDrag;
|
45091 | function verifyIsDragging(monitor) {
|
45092 | invariant_1$$1.default(monitor.isDragging(), 'Cannot call endDrag while not dragging.');
|
45093 | }
|
45094 | });
|
45095 |
|
45096 | unwrapExports(endDrag);
|
45097 |
|
45098 | var dragDrop = createCommonjsModule(function (module, exports) {
|
45099 | function __export(m) {
|
45100 | for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
45101 | }
|
45102 | var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
45103 | return (mod && mod.__esModule) ? mod : { "default": mod };
|
45104 | };
|
45105 | Object.defineProperty(exports, "__esModule", { value: true });
|
45106 | var beginDrag_1 = __importDefault(beginDrag);
|
45107 | var publishDragSource_1 = __importDefault(publishDragSource);
|
45108 | var hover_1 = __importDefault(hover);
|
45109 | var drop_1 = __importDefault(drop);
|
45110 | var endDrag_1 = __importDefault(endDrag);
|
45111 | __export(types);
|
45112 | function createDragDropActions(manager) {
|
45113 | return {
|
45114 | beginDrag: beginDrag_1.default(manager),
|
45115 | publishDragSource: publishDragSource_1.default(manager),
|
45116 | hover: hover_1.default(manager),
|
45117 | drop: drop_1.default(manager),
|
45118 | endDrag: endDrag_1.default(manager),
|
45119 | };
|
45120 | }
|
45121 | exports.default = createDragDropActions;
|
45122 | });
|
45123 |
|
45124 | unwrapExports(dragDrop);
|
45125 |
|
45126 | var equality = createCommonjsModule(function (module, exports) {
|
45127 | Object.defineProperty(exports, "__esModule", { value: true });
|
45128 | exports.strictEquality = function (a, b) { return a === b; };
|
45129 | /**
|
45130 | * Determine if two cartesian coordinate offsets are equal
|
45131 | * @param offsetA
|
45132 | * @param offsetB
|
45133 | */
|
45134 | function areCoordsEqual(offsetA, offsetB) {
|
45135 | if (!offsetA && !offsetB) {
|
45136 | return true;
|
45137 | }
|
45138 | else if (!offsetA || !offsetB) {
|
45139 | return false;
|
45140 | }
|
45141 | else {
|
45142 | return offsetA.x === offsetB.x && offsetA.y === offsetB.y;
|
45143 | }
|
45144 | }
|
45145 | exports.areCoordsEqual = areCoordsEqual;
|
45146 | /**
|
45147 | * Determines if two arrays of items are equal
|
45148 | * @param a The first array of items
|
45149 | * @param b The second array of items
|
45150 | */
|
45151 | function areArraysEqual(a, b, isEqual) {
|
45152 | if (isEqual === void 0) { isEqual = exports.strictEquality; }
|
45153 | if (a.length !== b.length) {
|
45154 | return false;
|
45155 | }
|
45156 | for (var i = 0; i < a.length; ++i) {
|
45157 | if (!isEqual(a[i], b[i])) {
|
45158 | return false;
|
45159 | }
|
45160 | }
|
45161 | return true;
|
45162 | }
|
45163 | exports.areArraysEqual = areArraysEqual;
|
45164 | });
|
45165 |
|
45166 | unwrapExports(equality);
|
45167 | var equality_1 = equality.strictEquality;
|
45168 | var equality_2 = equality.areCoordsEqual;
|
45169 | var equality_3 = equality.areArraysEqual;
|
45170 |
|
45171 | var dragOffset_1 = createCommonjsModule(function (module, exports) {
|
45172 | var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
|
45173 | __assign = Object.assign || function(t) {
|
45174 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
45175 | s = arguments[i];
|
45176 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
45177 | t[p] = s[p];
|
45178 | }
|
45179 | return t;
|
45180 | };
|
45181 | return __assign.apply(this, arguments);
|
45182 | };
|
45183 | Object.defineProperty(exports, "__esModule", { value: true });
|
45184 |
|
45185 |
|
45186 | var initialState = {
|
45187 | initialSourceClientOffset: null,
|
45188 | initialClientOffset: null,
|
45189 | clientOffset: null,
|
45190 | };
|
45191 | function dragOffset(state, action) {
|
45192 | if (state === void 0) { state = initialState; }
|
45193 | var payload = action.payload;
|
45194 | switch (action.type) {
|
45195 | case dragDrop.INIT_COORDS:
|
45196 | case dragDrop.BEGIN_DRAG:
|
45197 | return {
|
45198 | initialSourceClientOffset: payload.sourceClientOffset,
|
45199 | initialClientOffset: payload.clientOffset,
|
45200 | clientOffset: payload.clientOffset,
|
45201 | };
|
45202 | case dragDrop.HOVER:
|
45203 | if (equality.areCoordsEqual(state.clientOffset, payload.clientOffset)) {
|
45204 | return state;
|
45205 | }
|
45206 | return __assign({}, state, { clientOffset: payload.clientOffset });
|
45207 | case dragDrop.END_DRAG:
|
45208 | case dragDrop.DROP:
|
45209 | return initialState;
|
45210 | default:
|
45211 | return state;
|
45212 | }
|
45213 | }
|
45214 | exports.default = dragOffset;
|
45215 | });
|
45216 |
|
45217 | unwrapExports(dragOffset_1);
|
45218 |
|
45219 | var registry = createCommonjsModule(function (module, exports) {
|
45220 | Object.defineProperty(exports, "__esModule", { value: true });
|
45221 | exports.ADD_SOURCE = 'dnd-core/ADD_SOURCE';
|
45222 | exports.ADD_TARGET = 'dnd-core/ADD_TARGET';
|
45223 | exports.REMOVE_SOURCE = 'dnd-core/REMOVE_SOURCE';
|
45224 | exports.REMOVE_TARGET = 'dnd-core/REMOVE_TARGET';
|
45225 | function addSource(sourceId) {
|
45226 | return {
|
45227 | type: exports.ADD_SOURCE,
|
45228 | payload: {
|
45229 | sourceId: sourceId,
|
45230 | },
|
45231 | };
|
45232 | }
|
45233 | exports.addSource = addSource;
|
45234 | function addTarget(targetId) {
|
45235 | return {
|
45236 | type: exports.ADD_TARGET,
|
45237 | payload: {
|
45238 | targetId: targetId,
|
45239 | },
|
45240 | };
|
45241 | }
|
45242 | exports.addTarget = addTarget;
|
45243 | function removeSource(sourceId) {
|
45244 | return {
|
45245 | type: exports.REMOVE_SOURCE,
|
45246 | payload: {
|
45247 | sourceId: sourceId,
|
45248 | },
|
45249 | };
|
45250 | }
|
45251 | exports.removeSource = removeSource;
|
45252 | function removeTarget(targetId) {
|
45253 | return {
|
45254 | type: exports.REMOVE_TARGET,
|
45255 | payload: {
|
45256 | targetId: targetId,
|
45257 | },
|
45258 | };
|
45259 | }
|
45260 | exports.removeTarget = removeTarget;
|
45261 | });
|
45262 |
|
45263 | unwrapExports(registry);
|
45264 | var registry_1 = registry.ADD_SOURCE;
|
45265 | var registry_2 = registry.ADD_TARGET;
|
45266 | var registry_3 = registry.REMOVE_SOURCE;
|
45267 | var registry_4 = registry.REMOVE_TARGET;
|
45268 | var registry_5 = registry.addSource;
|
45269 | var registry_6 = registry.addTarget;
|
45270 | var registry_7 = registry.removeSource;
|
45271 | var registry_8 = registry.removeTarget;
|
45272 |
|
45273 | var dragOperation_1 = createCommonjsModule(function (module, exports) {
|
45274 | var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
|
45275 | __assign = Object.assign || function(t) {
|
45276 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
45277 | s = arguments[i];
|
45278 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
45279 | t[p] = s[p];
|
45280 | }
|
45281 | return t;
|
45282 | };
|
45283 | return __assign.apply(this, arguments);
|
45284 | };
|
45285 | Object.defineProperty(exports, "__esModule", { value: true });
|
45286 |
|
45287 |
|
45288 |
|
45289 | var initialState = {
|
45290 | itemType: null,
|
45291 | item: null,
|
45292 | sourceId: null,
|
45293 | targetIds: [],
|
45294 | dropResult: null,
|
45295 | didDrop: false,
|
45296 | isSourcePublic: null,
|
45297 | };
|
45298 | function dragOperation(state, action) {
|
45299 | if (state === void 0) { state = initialState; }
|
45300 | var payload = action.payload;
|
45301 | switch (action.type) {
|
45302 | case dragDrop.BEGIN_DRAG:
|
45303 | return __assign({}, state, { itemType: payload.itemType, item: payload.item, sourceId: payload.sourceId, isSourcePublic: payload.isSourcePublic, dropResult: null, didDrop: false });
|
45304 | case dragDrop.PUBLISH_DRAG_SOURCE:
|
45305 | return __assign({}, state, { isSourcePublic: true });
|
45306 | case dragDrop.HOVER:
|
45307 | return __assign({}, state, { targetIds: payload.targetIds });
|
45308 | case registry.REMOVE_TARGET:
|
45309 | if (state.targetIds.indexOf(payload.targetId) === -1) {
|
45310 | return state;
|
45311 | }
|
45312 | return __assign({}, state, { targetIds: js_utils.without(state.targetIds, payload.targetId) });
|
45313 | case dragDrop.DROP:
|
45314 | return __assign({}, state, { dropResult: payload.dropResult, didDrop: true, targetIds: [] });
|
45315 | case dragDrop.END_DRAG:
|
45316 | return __assign({}, state, { itemType: null, item: null, sourceId: null, dropResult: null, didDrop: false, isSourcePublic: null, targetIds: [] });
|
45317 | default:
|
45318 | return state;
|
45319 | }
|
45320 | }
|
45321 | exports.default = dragOperation;
|
45322 | });
|
45323 |
|
45324 | unwrapExports(dragOperation_1);
|
45325 |
|
45326 | var refCount_1 = createCommonjsModule(function (module, exports) {
|
45327 | Object.defineProperty(exports, "__esModule", { value: true });
|
45328 |
|
45329 | function refCount(state, action) {
|
45330 | if (state === void 0) { state = 0; }
|
45331 | switch (action.type) {
|
45332 | case registry.ADD_SOURCE:
|
45333 | case registry.ADD_TARGET:
|
45334 | return state + 1;
|
45335 | case registry.REMOVE_SOURCE:
|
45336 | case registry.REMOVE_TARGET:
|
45337 | return state - 1;
|
45338 | default:
|
45339 | return state;
|
45340 | }
|
45341 | }
|
45342 | exports.default = refCount;
|
45343 | });
|
45344 |
|
45345 | unwrapExports(refCount_1);
|
45346 |
|
45347 | var dirtiness = createCommonjsModule(function (module, exports) {
|
45348 | Object.defineProperty(exports, "__esModule", { value: true });
|
45349 |
|
45350 | exports.NONE = [];
|
45351 | exports.ALL = [];
|
45352 | exports.NONE.__IS_NONE__ = true;
|
45353 | exports.ALL.__IS_ALL__ = true;
|
45354 | /**
|
45355 | * Determines if the given handler IDs are dirty or not.
|
45356 | *
|
45357 | * @param dirtyIds The set of dirty handler ids
|
45358 | * @param handlerIds The set of handler ids to check
|
45359 | */
|
45360 | function areDirty(dirtyIds, handlerIds) {
|
45361 | if (dirtyIds === exports.NONE) {
|
45362 | return false;
|
45363 | }
|
45364 | if (dirtyIds === exports.ALL || typeof handlerIds === 'undefined') {
|
45365 | return true;
|
45366 | }
|
45367 | var commonIds = js_utils.intersection(handlerIds, dirtyIds);
|
45368 | return commonIds.length > 0;
|
45369 | }
|
45370 | exports.areDirty = areDirty;
|
45371 | });
|
45372 |
|
45373 | unwrapExports(dirtiness);
|
45374 | var dirtiness_1 = dirtiness.NONE;
|
45375 | var dirtiness_2 = dirtiness.ALL;
|
45376 | var dirtiness_3 = dirtiness.areDirty;
|
45377 |
|
45378 | var dirtyHandlerIds_1 = createCommonjsModule(function (module, exports) {
|
45379 | Object.defineProperty(exports, "__esModule", { value: true });
|
45380 |
|
45381 |
|
45382 |
|
45383 |
|
45384 |
|
45385 | function dirtyHandlerIds(state, action) {
|
45386 | if (state === void 0) { state = dirtiness.NONE; }
|
45387 | switch (action.type) {
|
45388 | case dragDrop.HOVER:
|
45389 | break;
|
45390 | case registry.ADD_SOURCE:
|
45391 | case registry.ADD_TARGET:
|
45392 | case registry.REMOVE_TARGET:
|
45393 | case registry.REMOVE_SOURCE:
|
45394 | return dirtiness.NONE;
|
45395 | case dragDrop.BEGIN_DRAG:
|
45396 | case dragDrop.PUBLISH_DRAG_SOURCE:
|
45397 | case dragDrop.END_DRAG:
|
45398 | case dragDrop.DROP:
|
45399 | default:
|
45400 | return dirtiness.ALL;
|
45401 | }
|
45402 | var _a = action.payload, _b = _a.targetIds, targetIds = _b === void 0 ? [] : _b, _c = _a.prevTargetIds, prevTargetIds = _c === void 0 ? [] : _c;
|
45403 | var result = js_utils.xor(targetIds, prevTargetIds);
|
45404 | var didChange = result.length > 0 || !equality.areArraysEqual(targetIds, prevTargetIds);
|
45405 | if (!didChange) {
|
45406 | return dirtiness.NONE;
|
45407 | }
|
45408 | // Check the target ids at the innermost position. If they are valid, add them
|
45409 | // to the result
|
45410 | var prevInnermostTargetId = prevTargetIds[prevTargetIds.length - 1];
|
45411 | var innermostTargetId = targetIds[targetIds.length - 1];
|
45412 | if (prevInnermostTargetId !== innermostTargetId) {
|
45413 | if (prevInnermostTargetId) {
|
45414 | result.push(prevInnermostTargetId);
|
45415 | }
|
45416 | if (innermostTargetId) {
|
45417 | result.push(innermostTargetId);
|
45418 | }
|
45419 | }
|
45420 | return result;
|
45421 | }
|
45422 | exports.default = dirtyHandlerIds;
|
45423 | });
|
45424 |
|
45425 | unwrapExports(dirtyHandlerIds_1);
|
45426 |
|
45427 | var stateId_1 = createCommonjsModule(function (module, exports) {
|
45428 | Object.defineProperty(exports, "__esModule", { value: true });
|
45429 | function stateId(state) {
|
45430 | if (state === void 0) { state = 0; }
|
45431 | return state + 1;
|
45432 | }
|
45433 | exports.default = stateId;
|
45434 | });
|
45435 |
|
45436 | unwrapExports(stateId_1);
|
45437 |
|
45438 | var reducers = createCommonjsModule(function (module, exports) {
|
45439 | var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
|
45440 | __assign = Object.assign || function(t) {
|
45441 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
45442 | s = arguments[i];
|
45443 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
45444 | t[p] = s[p];
|
45445 | }
|
45446 | return t;
|
45447 | };
|
45448 | return __assign.apply(this, arguments);
|
45449 | };
|
45450 | var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
45451 | return (mod && mod.__esModule) ? mod : { "default": mod };
|
45452 | };
|
45453 | Object.defineProperty(exports, "__esModule", { value: true });
|
45454 | var dragOffset_1$$1 = __importDefault(dragOffset_1);
|
45455 | var dragOperation_1$$1 = __importDefault(dragOperation_1);
|
45456 | var refCount_1$$1 = __importDefault(refCount_1);
|
45457 | var dirtyHandlerIds_1$$1 = __importDefault(dirtyHandlerIds_1);
|
45458 | var stateId_1$$1 = __importDefault(stateId_1);
|
45459 |
|
45460 | function reduce(state, action) {
|
45461 | if (state === void 0) { state = {}; }
|
45462 | return {
|
45463 | dirtyHandlerIds: dirtyHandlerIds_1$$1.default(state.dirtyHandlerIds, {
|
45464 | type: action.type,
|
45465 | payload: __assign({}, action.payload, { prevTargetIds: js_utils.get(state, 'dragOperation.targetIds', []) }),
|
45466 | }),
|
45467 | dragOffset: dragOffset_1$$1.default(state.dragOffset, action),
|
45468 | refCount: refCount_1$$1.default(state.refCount, action),
|
45469 | dragOperation: dragOperation_1$$1.default(state.dragOperation, action),
|
45470 | stateId: stateId_1$$1.default(state.stateId),
|
45471 | };
|
45472 | }
|
45473 | exports.default = reduce;
|
45474 | });
|
45475 |
|
45476 | unwrapExports(reducers);
|
45477 |
|
45478 | var coords = createCommonjsModule(function (module, exports) {
|
45479 | Object.defineProperty(exports, "__esModule", { value: true });
|
45480 | /**
|
45481 | * Coordinate addition
|
45482 | * @param a The first coordinate
|
45483 | * @param b The second coordinate
|
45484 | */
|
45485 | function add(a, b) {
|
45486 | return {
|
45487 | x: a.x + b.x,
|
45488 | y: a.y + b.y,
|
45489 | };
|
45490 | }
|
45491 | exports.add = add;
|
45492 | /**
|
45493 | * Coordinate subtraction
|
45494 | * @param a The first coordinate
|
45495 | * @param b The second coordinate
|
45496 | */
|
45497 | function subtract(a, b) {
|
45498 | return {
|
45499 | x: a.x - b.x,
|
45500 | y: a.y - b.y,
|
45501 | };
|
45502 | }
|
45503 | exports.subtract = subtract;
|
45504 | /**
|
45505 | * Returns the cartesian distance of the drag source component's position, based on its position
|
45506 | * at the time when the current drag operation has started, and the movement difference.
|
45507 | *
|
45508 | * Returns null if no item is being dragged.
|
45509 | *
|
45510 | * @param state The offset state to compute from
|
45511 | */
|
45512 | function getSourceClientOffset(state) {
|
45513 | var clientOffset = state.clientOffset, initialClientOffset = state.initialClientOffset, initialSourceClientOffset = state.initialSourceClientOffset;
|
45514 | if (!clientOffset || !initialClientOffset || !initialSourceClientOffset) {
|
45515 | return null;
|
45516 | }
|
45517 | return subtract(add(clientOffset, initialSourceClientOffset), initialClientOffset);
|
45518 | }
|
45519 | exports.getSourceClientOffset = getSourceClientOffset;
|
45520 | /**
|
45521 | * Determines the x,y offset between the client offset and the initial client offset
|
45522 | *
|
45523 | * @param state The offset state to compute from
|
45524 | */
|
45525 | function getDifferenceFromInitialOffset(state) {
|
45526 | var clientOffset = state.clientOffset, initialClientOffset = state.initialClientOffset;
|
45527 | if (!clientOffset || !initialClientOffset) {
|
45528 | return null;
|
45529 | }
|
45530 | return subtract(clientOffset, initialClientOffset);
|
45531 | }
|
45532 | exports.getDifferenceFromInitialOffset = getDifferenceFromInitialOffset;
|
45533 | });
|
45534 |
|
45535 | unwrapExports(coords);
|
45536 | var coords_1 = coords.add;
|
45537 | var coords_2 = coords.subtract;
|
45538 | var coords_3 = coords.getSourceClientOffset;
|
45539 | var coords_4 = coords.getDifferenceFromInitialOffset;
|
45540 |
|
45541 | var DragDropMonitorImpl_1 = createCommonjsModule(function (module, exports) {
|
45542 | var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
45543 | return (mod && mod.__esModule) ? mod : { "default": mod };
|
45544 | };
|
45545 | Object.defineProperty(exports, "__esModule", { value: true });
|
45546 | var invariant_1$$1 = __importDefault(invariant_1);
|
45547 | var matchesType_1$$1 = __importDefault(matchesType_1);
|
45548 |
|
45549 |
|
45550 | var DragDropMonitorImpl = /** @class */ (function () {
|
45551 | function DragDropMonitorImpl(store, registry) {
|
45552 | this.store = store;
|
45553 | this.registry = registry;
|
45554 | }
|
45555 | DragDropMonitorImpl.prototype.subscribeToStateChange = function (listener, options) {
|
45556 | var _this = this;
|
45557 | if (options === void 0) { options = { handlerIds: undefined }; }
|
45558 | var handlerIds = options.handlerIds;
|
45559 | invariant_1$$1.default(typeof listener === 'function', 'listener must be a function.');
|
45560 | invariant_1$$1.default(typeof handlerIds === 'undefined' || Array.isArray(handlerIds), 'handlerIds, when specified, must be an array of strings.');
|
45561 | var prevStateId = this.store.getState().stateId;
|
45562 | var handleChange = function () {
|
45563 | var state = _this.store.getState();
|
45564 | var currentStateId = state.stateId;
|
45565 | try {
|
45566 | var canSkipListener = currentStateId === prevStateId ||
|
45567 | (currentStateId === prevStateId + 1 &&
|
45568 | !dirtiness.areDirty(state.dirtyHandlerIds, handlerIds));
|
45569 | if (!canSkipListener) {
|
45570 | listener();
|
45571 | }
|
45572 | }
|
45573 | finally {
|
45574 | prevStateId = currentStateId;
|
45575 | }
|
45576 | };
|
45577 | return this.store.subscribe(handleChange);
|
45578 | };
|
45579 | DragDropMonitorImpl.prototype.subscribeToOffsetChange = function (listener) {
|
45580 | var _this = this;
|
45581 | invariant_1$$1.default(typeof listener === 'function', 'listener must be a function.');
|
45582 | var previousState = this.store.getState().dragOffset;
|
45583 | var handleChange = function () {
|
45584 | var nextState = _this.store.getState().dragOffset;
|
45585 | if (nextState === previousState) {
|
45586 | return;
|
45587 | }
|
45588 | previousState = nextState;
|
45589 | listener();
|
45590 | };
|
45591 | return this.store.subscribe(handleChange);
|
45592 | };
|
45593 | DragDropMonitorImpl.prototype.canDragSource = function (sourceId) {
|
45594 | if (!sourceId) {
|
45595 | return false;
|
45596 | }
|
45597 | var source = this.registry.getSource(sourceId);
|
45598 | invariant_1$$1.default(source, 'Expected to find a valid source.');
|
45599 | if (this.isDragging()) {
|
45600 | return false;
|
45601 | }
|
45602 | return source.canDrag(this, sourceId);
|
45603 | };
|
45604 | DragDropMonitorImpl.prototype.canDropOnTarget = function (targetId) {
|
45605 | // undefined on initial render
|
45606 | if (!targetId) {
|
45607 | return false;
|
45608 | }
|
45609 | var target = this.registry.getTarget(targetId);
|
45610 | invariant_1$$1.default(target, 'Expected to find a valid target.');
|
45611 | if (!this.isDragging() || this.didDrop()) {
|
45612 | return false;
|
45613 | }
|
45614 | var targetType = this.registry.getTargetType(targetId);
|
45615 | var draggedItemType = this.getItemType();
|
45616 | return (matchesType_1$$1.default(targetType, draggedItemType) && target.canDrop(this, targetId));
|
45617 | };
|
45618 | DragDropMonitorImpl.prototype.isDragging = function () {
|
45619 | return Boolean(this.getItemType());
|
45620 | };
|
45621 | DragDropMonitorImpl.prototype.isDraggingSource = function (sourceId) {
|
45622 | // undefined on initial render
|
45623 | if (!sourceId) {
|
45624 | return false;
|
45625 | }
|
45626 | var source = this.registry.getSource(sourceId, true);
|
45627 | invariant_1$$1.default(source, 'Expected to find a valid source.');
|
45628 | if (!this.isDragging() || !this.isSourcePublic()) {
|
45629 | return false;
|
45630 | }
|
45631 | var sourceType = this.registry.getSourceType(sourceId);
|
45632 | var draggedItemType = this.getItemType();
|
45633 | if (sourceType !== draggedItemType) {
|
45634 | return false;
|
45635 | }
|
45636 | return source.isDragging(this, sourceId);
|
45637 | };
|
45638 | DragDropMonitorImpl.prototype.isOverTarget = function (targetId, options) {
|
45639 | if (options === void 0) { options = { shallow: false }; }
|
45640 | // undefined on initial render
|
45641 | if (!targetId) {
|
45642 | return false;
|
45643 | }
|
45644 | var shallow = options.shallow;
|
45645 | if (!this.isDragging()) {
|
45646 | return false;
|
45647 | }
|
45648 | var targetType = this.registry.getTargetType(targetId);
|
45649 | var draggedItemType = this.getItemType();
|
45650 | if (draggedItemType && !matchesType_1$$1.default(targetType, draggedItemType)) {
|
45651 | return false;
|
45652 | }
|
45653 | var targetIds = this.getTargetIds();
|
45654 | if (!targetIds.length) {
|
45655 | return false;
|
45656 | }
|
45657 | var index = targetIds.indexOf(targetId);
|
45658 | if (shallow) {
|
45659 | return index === targetIds.length - 1;
|
45660 | }
|
45661 | else {
|
45662 | return index > -1;
|
45663 | }
|
45664 | };
|
45665 | DragDropMonitorImpl.prototype.getItemType = function () {
|
45666 | return this.store.getState().dragOperation.itemType;
|
45667 | };
|
45668 | DragDropMonitorImpl.prototype.getItem = function () {
|
45669 | return this.store.getState().dragOperation.item;
|
45670 | };
|
45671 | DragDropMonitorImpl.prototype.getSourceId = function () {
|
45672 | return this.store.getState().dragOperation.sourceId;
|
45673 | };
|
45674 | DragDropMonitorImpl.prototype.getTargetIds = function () {
|
45675 | return this.store.getState().dragOperation.targetIds;
|
45676 | };
|
45677 | DragDropMonitorImpl.prototype.getDropResult = function () {
|
45678 | return this.store.getState().dragOperation.dropResult;
|
45679 | };
|
45680 | DragDropMonitorImpl.prototype.didDrop = function () {
|
45681 | return this.store.getState().dragOperation.didDrop;
|
45682 | };
|
45683 | DragDropMonitorImpl.prototype.isSourcePublic = function () {
|
45684 | return this.store.getState().dragOperation.isSourcePublic;
|
45685 | };
|
45686 | DragDropMonitorImpl.prototype.getInitialClientOffset = function () {
|
45687 | return this.store.getState().dragOffset.initialClientOffset;
|
45688 | };
|
45689 | DragDropMonitorImpl.prototype.getInitialSourceClientOffset = function () {
|
45690 | return this.store.getState().dragOffset.initialSourceClientOffset;
|
45691 | };
|
45692 | DragDropMonitorImpl.prototype.getClientOffset = function () {
|
45693 | return this.store.getState().dragOffset.clientOffset;
|
45694 | };
|
45695 | DragDropMonitorImpl.prototype.getSourceClientOffset = function () {
|
45696 | return coords.getSourceClientOffset(this.store.getState().dragOffset);
|
45697 | };
|
45698 | DragDropMonitorImpl.prototype.getDifferenceFromInitialOffset = function () {
|
45699 | return coords.getDifferenceFromInitialOffset(this.store.getState().dragOffset);
|
45700 | };
|
45701 | return DragDropMonitorImpl;
|
45702 | }());
|
45703 | exports.default = DragDropMonitorImpl;
|
45704 | });
|
45705 |
|
45706 | unwrapExports(DragDropMonitorImpl_1);
|
45707 |
|
45708 | var domain$1; // The domain module is executed on demand
|
45709 | var hasSetImmediate = typeof setImmediate === "function";
|
45710 |
|
45711 | // Use the fastest means possible to execute a task in its own turn, with
|
45712 | // priority over other events including network IO events in Node.js.
|
45713 | //
|
45714 | // An exception thrown by a task will permanently interrupt the processing of
|
45715 | // subsequent tasks. The higher level `asap` function ensures that if an
|
45716 | // exception is thrown by a task, that the task queue will continue flushing as
|
45717 | // soon as possible, but if you use `rawAsap` directly, you are responsible to
|
45718 | // either ensure that no exceptions are thrown from your task, or to manually
|
45719 | // call `rawAsap.requestFlush` if an exception is thrown.
|
45720 | var raw = rawAsap;
|
45721 | function rawAsap(task) {
|
45722 | if (!queue$1.length) {
|
45723 | requestFlush();
|
45724 | flushing = true;
|
45725 | }
|
45726 | // Avoids a function call
|
45727 | queue$1[queue$1.length] = task;
|
45728 | }
|
45729 |
|
45730 | var queue$1 = [];
|
45731 | // Once a flush has been requested, no further calls to `requestFlush` are
|
45732 | // necessary until the next `flush` completes.
|
45733 | var flushing = false;
|
45734 | // The position of the next task to execute in the task queue. This is
|
45735 | // preserved between calls to `flush` so that it can be resumed if
|
45736 | // a task throws an exception.
|
45737 | var index$8 = 0;
|
45738 | // If a task schedules additional tasks recursively, the task queue can grow
|
45739 | // unbounded. To prevent memory excaustion, the task queue will periodically
|
45740 | // truncate already-completed tasks.
|
45741 | var capacity = 1024;
|
45742 |
|
45743 | // The flush function processes all tasks that have been scheduled with
|
45744 | // `rawAsap` unless and until one of those tasks throws an exception.
|
45745 | // If a task throws an exception, `flush` ensures that its state will remain
|
45746 | // consistent and will resume where it left off when called again.
|
45747 | // However, `flush` does not make any arrangements to be called again if an
|
45748 | // exception is thrown.
|
45749 | function flush$1() {
|
45750 | while (index$8 < queue$1.length) {
|
45751 | var currentIndex = index$8;
|
45752 | // Advance the index before calling the task. This ensures that we will
|
45753 | // begin flushing on the next task the task throws an error.
|
45754 | index$8 = index$8 + 1;
|
45755 | queue$1[currentIndex].call();
|
45756 | // Prevent leaking memory for long chains of recursive calls to `asap`.
|
45757 | // If we call `asap` within tasks scheduled by `asap`, the queue will
|
45758 | // grow, but to avoid an O(n) walk for every task we execute, we don't
|
45759 | // shift tasks off the queue after they have been executed.
|
45760 | // Instead, we periodically shift 1024 tasks off the queue.
|
45761 | if (index$8 > capacity) {
|
45762 | // Manually shift all values starting at the index back to the
|
45763 | // beginning of the queue.
|
45764 | for (var scan = 0, newLength = queue$1.length - index$8; scan < newLength; scan++) {
|
45765 | queue$1[scan] = queue$1[scan + index$8];
|
45766 | }
|
45767 | queue$1.length -= index$8;
|
45768 | index$8 = 0;
|
45769 | }
|
45770 | }
|
45771 | queue$1.length = 0;
|
45772 | index$8 = 0;
|
45773 | flushing = false;
|
45774 | }
|
45775 |
|
45776 | rawAsap.requestFlush = requestFlush;
|
45777 | function requestFlush() {
|
45778 | // Ensure flushing is not bound to any domain.
|
45779 | // It is not sufficient to exit the domain, because domains exist on a stack.
|
45780 | // To execute code outside of any domain, the following dance is necessary.
|
45781 | var parentDomain = process.domain;
|
45782 | if (parentDomain) {
|
45783 | if (!domain$1) {
|
45784 | // Lazy execute the domain module.
|
45785 | // Only employed if the user elects to use domains.
|
45786 | domain$1 = domain;
|
45787 | }
|
45788 | domain$1.active = process.domain = null;
|
45789 | }
|
45790 |
|
45791 | // `setImmediate` is slower that `process.nextTick`, but `process.nextTick`
|
45792 | // cannot handle recursion.
|
45793 | // `requestFlush` will only be called recursively from `asap.js`, to resume
|
45794 | // flushing after an error is thrown into a domain.
|
45795 | // Conveniently, `setImmediate` was introduced in the same version
|
45796 | // `process.nextTick` started throwing recursion errors.
|
45797 | if (flushing && hasSetImmediate) {
|
45798 | setImmediate(flush$1);
|
45799 | } else {
|
45800 | process.nextTick(flush$1);
|
45801 | }
|
45802 |
|
45803 | if (parentDomain) {
|
45804 | domain$1.active = process.domain = parentDomain;
|
45805 | }
|
45806 | }
|
45807 |
|
45808 | var freeTasks = [];
|
45809 |
|
45810 | /**
|
45811 | * Calls a task as soon as possible after returning, in its own event, with
|
45812 | * priority over IO events. An exception thrown in a task can be handled by
|
45813 | * `process.on("uncaughtException") or `domain.on("error")`, but will otherwise
|
45814 | * crash the process. If the error is handled, all subsequent tasks will
|
45815 | * resume.
|
45816 | *
|
45817 | * @param {{call}} task A callable object, typically a function that takes no
|
45818 | * arguments.
|
45819 | */
|
45820 | var asap_1 = asap;
|
45821 | function asap(task) {
|
45822 | var rawTask;
|
45823 | if (freeTasks.length) {
|
45824 | rawTask = freeTasks.pop();
|
45825 | } else {
|
45826 | rawTask = new RawTask();
|
45827 | }
|
45828 | rawTask.task = task;
|
45829 | rawTask.domain = process.domain;
|
45830 | raw(rawTask);
|
45831 | }
|
45832 |
|
45833 | function RawTask() {
|
45834 | this.task = null;
|
45835 | this.domain = null;
|
45836 | }
|
45837 |
|
45838 | RawTask.prototype.call = function () {
|
45839 | if (this.domain) {
|
45840 | this.domain.enter();
|
45841 | }
|
45842 | var threw = true;
|
45843 | try {
|
45844 | this.task.call();
|
45845 | threw = false;
|
45846 | // If the task throws an exception (presumably) Node.js restores the
|
45847 | // domain stack for the next event.
|
45848 | if (this.domain) {
|
45849 | this.domain.exit();
|
45850 | }
|
45851 | } finally {
|
45852 | // We use try/finally and a threw flag to avoid messing up stack traces
|
45853 | // when we catch and release errors.
|
45854 | if (threw) {
|
45855 | // In Node.js, uncaught exceptions are considered fatal errors.
|
45856 | // Re-throw them to interrupt flushing!
|
45857 | // Ensure that flushing continues if an uncaught exception is
|
45858 | // suppressed listening process.on("uncaughtException") or
|
45859 | // domain.on("error").
|
45860 | raw.requestFlush();
|
45861 | }
|
45862 | // If the task threw an error, we do not want to exit the domain here.
|
45863 | // Exiting the domain would prevent the domain from catching the error.
|
45864 | this.task = null;
|
45865 | this.domain = null;
|
45866 | freeTasks.push(this);
|
45867 | }
|
45868 | };
|
45869 |
|
45870 | var getNextUniqueId_1 = createCommonjsModule(function (module, exports) {
|
45871 | Object.defineProperty(exports, "__esModule", { value: true });
|
45872 | var nextUniqueId = 0;
|
45873 | function getNextUniqueId() {
|
45874 | return nextUniqueId++;
|
45875 | }
|
45876 | exports.default = getNextUniqueId;
|
45877 | });
|
45878 |
|
45879 | unwrapExports(getNextUniqueId_1);
|
45880 |
|
45881 | var contracts = createCommonjsModule(function (module, exports) {
|
45882 | var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
45883 | return (mod && mod.__esModule) ? mod : { "default": mod };
|
45884 | };
|
45885 | Object.defineProperty(exports, "__esModule", { value: true });
|
45886 | var invariant_1$$1 = __importDefault(invariant_1);
|
45887 | function validateSourceContract(source) {
|
45888 | invariant_1$$1.default(typeof source.canDrag === 'function', 'Expected canDrag to be a function.');
|
45889 | invariant_1$$1.default(typeof source.beginDrag === 'function', 'Expected beginDrag to be a function.');
|
45890 | invariant_1$$1.default(typeof source.endDrag === 'function', 'Expected endDrag to be a function.');
|
45891 | }
|
45892 | exports.validateSourceContract = validateSourceContract;
|
45893 | function validateTargetContract(target) {
|
45894 | invariant_1$$1.default(typeof target.canDrop === 'function', 'Expected canDrop to be a function.');
|
45895 | invariant_1$$1.default(typeof target.hover === 'function', 'Expected hover to be a function.');
|
45896 | invariant_1$$1.default(typeof target.drop === 'function', 'Expected beginDrag to be a function.');
|
45897 | }
|
45898 | exports.validateTargetContract = validateTargetContract;
|
45899 | function validateType(type, allowArray) {
|
45900 | if (allowArray && Array.isArray(type)) {
|
45901 | type.forEach(function (t) { return validateType(t, false); });
|
45902 | return;
|
45903 | }
|
45904 | invariant_1$$1.default(typeof type === 'string' || typeof type === 'symbol', allowArray
|
45905 | ? 'Type can only be a string, a symbol, or an array of either.'
|
45906 | : 'Type can only be a string or a symbol.');
|
45907 | }
|
45908 | exports.validateType = validateType;
|
45909 | });
|
45910 |
|
45911 | unwrapExports(contracts);
|
45912 | var contracts_1 = contracts.validateSourceContract;
|
45913 | var contracts_2 = contracts.validateTargetContract;
|
45914 | var contracts_3 = contracts.validateType;
|
45915 |
|
45916 | var HandlerRegistryImpl_1 = createCommonjsModule(function (module, exports) {
|
45917 | var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
45918 | return (mod && mod.__esModule) ? mod : { "default": mod };
|
45919 | };
|
45920 | Object.defineProperty(exports, "__esModule", { value: true });
|
45921 | var asap_1$$1 = __importDefault(asap_1);
|
45922 | var invariant_1$$1 = __importDefault(invariant_1);
|
45923 |
|
45924 | var getNextUniqueId_1$$1 = __importDefault(getNextUniqueId_1);
|
45925 |
|
45926 |
|
45927 | function getNextHandlerId(role) {
|
45928 | var id = getNextUniqueId_1$$1.default().toString();
|
45929 | switch (role) {
|
45930 | case interfaces.HandlerRole.SOURCE:
|
45931 | return "S" + id;
|
45932 | case interfaces.HandlerRole.TARGET:
|
45933 | return "T" + id;
|
45934 | default:
|
45935 | throw new Error("Unknown Handler Role: " + role);
|
45936 | }
|
45937 | }
|
45938 | function parseRoleFromHandlerId(handlerId) {
|
45939 | switch (handlerId[0]) {
|
45940 | case 'S':
|
45941 | return interfaces.HandlerRole.SOURCE;
|
45942 | case 'T':
|
45943 | return interfaces.HandlerRole.TARGET;
|
45944 | default:
|
45945 | invariant_1$$1.default(false, "Cannot parse handler ID: " + handlerId);
|
45946 | }
|
45947 | }
|
45948 | function mapContainsValue(map, searchValue) {
|
45949 | var entries = map.entries();
|
45950 | var isDone = false;
|
45951 | do {
|
45952 | var _a = entries.next(), done = _a.done, _b = _a.value, value = _b[1];
|
45953 | if (value === searchValue) {
|
45954 | return true;
|
45955 | }
|
45956 | isDone = done;
|
45957 | } while (!isDone);
|
45958 | return false;
|
45959 | }
|
45960 | var HandlerRegistryImpl = /** @class */ (function () {
|
45961 | function HandlerRegistryImpl(store) {
|
45962 | this.store = store;
|
45963 | this.types = new Map();
|
45964 | this.dragSources = new Map();
|
45965 | this.dropTargets = new Map();
|
45966 | this.pinnedSourceId = null;
|
45967 | this.pinnedSource = null;
|
45968 | }
|
45969 | HandlerRegistryImpl.prototype.addSource = function (type, source) {
|
45970 | contracts.validateType(type);
|
45971 | contracts.validateSourceContract(source);
|
45972 | var sourceId = this.addHandler(interfaces.HandlerRole.SOURCE, type, source);
|
45973 | this.store.dispatch(registry.addSource(sourceId));
|
45974 | return sourceId;
|
45975 | };
|
45976 | HandlerRegistryImpl.prototype.addTarget = function (type, target) {
|
45977 | contracts.validateType(type, true);
|
45978 | contracts.validateTargetContract(target);
|
45979 | var targetId = this.addHandler(interfaces.HandlerRole.TARGET, type, target);
|
45980 | this.store.dispatch(registry.addTarget(targetId));
|
45981 | return targetId;
|
45982 | };
|
45983 | HandlerRegistryImpl.prototype.containsHandler = function (handler) {
|
45984 | return (mapContainsValue(this.dragSources, handler) ||
|
45985 | mapContainsValue(this.dropTargets, handler));
|
45986 | };
|
45987 | HandlerRegistryImpl.prototype.getSource = function (sourceId, includePinned) {
|
45988 | if (includePinned === void 0) { includePinned = false; }
|
45989 | invariant_1$$1.default(this.isSourceId(sourceId), 'Expected a valid source ID.');
|
45990 | var isPinned = includePinned && sourceId === this.pinnedSourceId;
|
45991 | var source = isPinned ? this.pinnedSource : this.dragSources.get(sourceId);
|
45992 | return source;
|
45993 | };
|
45994 | HandlerRegistryImpl.prototype.getTarget = function (targetId) {
|
45995 | invariant_1$$1.default(this.isTargetId(targetId), 'Expected a valid target ID.');
|
45996 | return this.dropTargets.get(targetId);
|
45997 | };
|
45998 | HandlerRegistryImpl.prototype.getSourceType = function (sourceId) {
|
45999 | invariant_1$$1.default(this.isSourceId(sourceId), 'Expected a valid source ID.');
|
46000 | return this.types.get(sourceId);
|
46001 | };
|
46002 | HandlerRegistryImpl.prototype.getTargetType = function (targetId) {
|
46003 | invariant_1$$1.default(this.isTargetId(targetId), 'Expected a valid target ID.');
|
46004 | return this.types.get(targetId);
|
46005 | };
|
46006 | HandlerRegistryImpl.prototype.isSourceId = function (handlerId) {
|
46007 | var role = parseRoleFromHandlerId(handlerId);
|
46008 | return role === interfaces.HandlerRole.SOURCE;
|
46009 | };
|
46010 | HandlerRegistryImpl.prototype.isTargetId = function (handlerId) {
|
46011 | var role = parseRoleFromHandlerId(handlerId);
|
46012 | return role === interfaces.HandlerRole.TARGET;
|
46013 | };
|
46014 | HandlerRegistryImpl.prototype.removeSource = function (sourceId) {
|
46015 | var _this = this;
|
46016 | invariant_1$$1.default(this.getSource(sourceId), 'Expected an existing source.');
|
46017 | this.store.dispatch(registry.removeSource(sourceId));
|
46018 | asap_1$$1.default(function () {
|
46019 | _this.dragSources.delete(sourceId);
|
46020 | _this.types.delete(sourceId);
|
46021 | });
|
46022 | };
|
46023 | HandlerRegistryImpl.prototype.removeTarget = function (targetId) {
|
46024 | invariant_1$$1.default(this.getTarget(targetId), 'Expected an existing target.');
|
46025 | this.store.dispatch(registry.removeTarget(targetId));
|
46026 | this.dropTargets.delete(targetId);
|
46027 | this.types.delete(targetId);
|
46028 | };
|
46029 | HandlerRegistryImpl.prototype.pinSource = function (sourceId) {
|
46030 | var source = this.getSource(sourceId);
|
46031 | invariant_1$$1.default(source, 'Expected an existing source.');
|
46032 | this.pinnedSourceId = sourceId;
|
46033 | this.pinnedSource = source;
|
46034 | };
|
46035 | HandlerRegistryImpl.prototype.unpinSource = function () {
|
46036 | invariant_1$$1.default(this.pinnedSource, 'No source is pinned at the time.');
|
46037 | this.pinnedSourceId = null;
|
46038 | this.pinnedSource = null;
|
46039 | };
|
46040 | HandlerRegistryImpl.prototype.addHandler = function (role, type, handler) {
|
46041 | var id = getNextHandlerId(role);
|
46042 | this.types.set(id, type);
|
46043 | if (role === interfaces.HandlerRole.SOURCE) {
|
46044 | this.dragSources.set(id, handler);
|
46045 | }
|
46046 | else if (role === interfaces.HandlerRole.TARGET) {
|
46047 | this.dropTargets.set(id, handler);
|
46048 | }
|
46049 | return id;
|
46050 | };
|
46051 | return HandlerRegistryImpl;
|
46052 | }());
|
46053 | exports.default = HandlerRegistryImpl;
|
46054 | });
|
46055 |
|
46056 | unwrapExports(HandlerRegistryImpl_1);
|
46057 |
|
46058 | var DragDropManagerImpl_1 = createCommonjsModule(function (module, exports) {
|
46059 | var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
46060 | return (mod && mod.__esModule) ? mod : { "default": mod };
|
46061 | };
|
46062 | Object.defineProperty(exports, "__esModule", { value: true });
|
46063 |
|
46064 | var reducers_1 = __importDefault(reducers);
|
46065 | var dragDrop_1 = __importDefault(dragDrop);
|
46066 | var DragDropMonitorImpl_1$$1 = __importDefault(DragDropMonitorImpl_1);
|
46067 | var HandlerRegistryImpl_1$$1 = __importDefault(HandlerRegistryImpl_1);
|
46068 | function makeStoreInstance(debugMode) {
|
46069 | // TODO: if we ever make a react-native version of this,
|
46070 | // we'll need to consider how to pull off dev-tooling
|
46071 | var reduxDevTools = typeof window !== 'undefined' &&
|
46072 | window.__REDUX_DEVTOOLS_EXTENSION__;
|
46073 | return redux.createStore(reducers_1.default, debugMode &&
|
46074 | reduxDevTools &&
|
46075 | reduxDevTools({
|
46076 | name: 'dnd-core',
|
46077 | instanceId: 'dnd-core',
|
46078 | }));
|
46079 | }
|
46080 | var DragDropManagerImpl = /** @class */ (function () {
|
46081 | function DragDropManagerImpl(debugMode) {
|
46082 | var _this = this;
|
46083 | if (debugMode === void 0) { debugMode = false; }
|
46084 | this.isSetUp = false;
|
46085 | this.handleRefCountChange = function () {
|
46086 | var shouldSetUp = _this.store.getState().refCount > 0;
|
46087 | if (_this.backend) {
|
46088 | if (shouldSetUp && !_this.isSetUp) {
|
46089 | _this.backend.setup();
|
46090 | _this.isSetUp = true;
|
46091 | }
|
46092 | else if (!shouldSetUp && _this.isSetUp) {
|
46093 | _this.backend.teardown();
|
46094 | _this.isSetUp = false;
|
46095 | }
|
46096 | }
|
46097 | };
|
46098 | var store = makeStoreInstance(debugMode);
|
46099 | this.store = store;
|
46100 | this.monitor = new DragDropMonitorImpl_1$$1.default(store, new HandlerRegistryImpl_1$$1.default(store));
|
46101 | store.subscribe(this.handleRefCountChange);
|
46102 | }
|
46103 | DragDropManagerImpl.prototype.receiveBackend = function (backend) {
|
46104 | this.backend = backend;
|
46105 | };
|
46106 | DragDropManagerImpl.prototype.getMonitor = function () {
|
46107 | return this.monitor;
|
46108 | };
|
46109 | DragDropManagerImpl.prototype.getBackend = function () {
|
46110 | return this.backend;
|
46111 | };
|
46112 | DragDropManagerImpl.prototype.getRegistry = function () {
|
46113 | return this.monitor.registry;
|
46114 | };
|
46115 | DragDropManagerImpl.prototype.getActions = function () {
|
46116 | var manager = this;
|
46117 | var dispatch = this.store.dispatch;
|
46118 | function bindActionCreator(actionCreator) {
|
46119 | return function () {
|
46120 | var args = [];
|
46121 | for (var _i = 0; _i < arguments.length; _i++) {
|
46122 | args[_i] = arguments[_i];
|
46123 | }
|
46124 | var action = actionCreator.apply(manager, args);
|
46125 | if (typeof action !== 'undefined') {
|
46126 | dispatch(action);
|
46127 | }
|
46128 | };
|
46129 | }
|
46130 | var actions = dragDrop_1.default(this);
|
46131 | return Object.keys(actions).reduce(function (boundActions, key) {
|
46132 | var action = actions[key];
|
46133 | boundActions[key] = bindActionCreator(action);
|
46134 | return boundActions;
|
46135 | }, {});
|
46136 | };
|
46137 | DragDropManagerImpl.prototype.dispatch = function (action) {
|
46138 | this.store.dispatch(action);
|
46139 | };
|
46140 | return DragDropManagerImpl;
|
46141 | }());
|
46142 | exports.default = DragDropManagerImpl;
|
46143 | });
|
46144 |
|
46145 | unwrapExports(DragDropManagerImpl_1);
|
46146 |
|
46147 | var factories = createCommonjsModule(function (module, exports) {
|
46148 | var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
46149 | return (mod && mod.__esModule) ? mod : { "default": mod };
|
46150 | };
|
46151 | Object.defineProperty(exports, "__esModule", { value: true });
|
46152 | var DragDropManagerImpl_1$$1 = __importDefault(DragDropManagerImpl_1);
|
46153 | function createDragDropManager(backendFactory, globalContext, backendOptions, debugMode) {
|
46154 | var manager = new DragDropManagerImpl_1$$1.default(debugMode);
|
46155 | var backend = backendFactory(manager, globalContext, backendOptions);
|
46156 | manager.receiveBackend(backend);
|
46157 | return manager;
|
46158 | }
|
46159 | exports.createDragDropManager = createDragDropManager;
|
46160 | });
|
46161 |
|
46162 | unwrapExports(factories);
|
46163 | var factories_1 = factories.createDragDropManager;
|
46164 |
|
46165 | var lib$1 = createCommonjsModule(function (module, exports) {
|
46166 | function __export(m) {
|
46167 | for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
46168 | }
|
46169 | Object.defineProperty(exports, "__esModule", { value: true });
|
46170 | __export(interfaces);
|
46171 | __export(factories);
|
46172 | });
|
46173 |
|
46174 | unwrapExports(lib$1);
|
46175 |
|
46176 | var DndContext = createCommonjsModule(function (module, exports) {
|
46177 | var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
|
46178 | if (mod && mod.__esModule) return mod;
|
46179 | var result = {};
|
46180 | if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
46181 | result["default"] = mod;
|
46182 | return result;
|
46183 | };
|
46184 | Object.defineProperty(exports, "__esModule", { value: true });
|
46185 | var React$$1 = __importStar(React);
|
46186 |
|
46187 | /**
|
46188 | * Create the React Context
|
46189 | */
|
46190 | exports.DndContext = React$$1.createContext({
|
46191 | dragDropManager: undefined,
|
46192 | });
|
46193 | /**
|
46194 | * Creates the context object we're providing
|
46195 | * @param backend
|
46196 | * @param context
|
46197 | */
|
46198 | function createDndContext(backend, context, options, debugMode) {
|
46199 | return {
|
46200 | dragDropManager: lib$1.createDragDropManager(backend, context, options, debugMode),
|
46201 | };
|
46202 | }
|
46203 | exports.createDndContext = createDndContext;
|
46204 | });
|
46205 |
|
46206 | unwrapExports(DndContext);
|
46207 | var DndContext_1 = DndContext.DndContext;
|
46208 | var DndContext_2 = DndContext.createDndContext;
|
46209 |
|
46210 | var useDragDropManager_1 = createCommonjsModule(function (module, exports) {
|
46211 | var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
46212 | return (mod && mod.__esModule) ? mod : { "default": mod };
|
46213 | };
|
46214 | Object.defineProperty(exports, "__esModule", { value: true });
|
46215 |
|
46216 | var invariant_1$$1 = __importDefault(invariant_1);
|
46217 |
|
46218 | /**
|
46219 | * A hook to retrieve the DragDropManager from Context
|
46220 | */
|
46221 | function useDragDropManager() {
|
46222 | var dragDropManager = React.useContext(DndContext.DndContext).dragDropManager;
|
46223 | invariant_1$$1.default(dragDropManager != null, 'Expected drag drop context');
|
46224 | return dragDropManager;
|
46225 | }
|
46226 | exports.useDragDropManager = useDragDropManager;
|
46227 | });
|
46228 |
|
46229 | unwrapExports(useDragDropManager_1);
|
46230 | var useDragDropManager_2 = useDragDropManager_1.useDragDropManager;
|
46231 |
|
46232 | var DragSourceMonitorImpl_1 = createCommonjsModule(function (module, exports) {
|
46233 | var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
46234 | return (mod && mod.__esModule) ? mod : { "default": mod };
|
46235 | };
|
46236 | Object.defineProperty(exports, "__esModule", { value: true });
|
46237 | var invariant_1$$1 = __importDefault(invariant_1);
|
46238 | var isCallingCanDrag = false;
|
46239 | var isCallingIsDragging = false;
|
46240 | var DragSourceMonitorImpl = /** @class */ (function () {
|
46241 | function DragSourceMonitorImpl(manager) {
|
46242 | this.sourceId = null;
|
46243 | this.internalMonitor = manager.getMonitor();
|
46244 | }
|
46245 | DragSourceMonitorImpl.prototype.receiveHandlerId = function (sourceId) {
|
46246 | this.sourceId = sourceId;
|
46247 | };
|
46248 | DragSourceMonitorImpl.prototype.getHandlerId = function () {
|
46249 | return this.sourceId;
|
46250 | };
|
46251 | DragSourceMonitorImpl.prototype.canDrag = function () {
|
46252 | invariant_1$$1.default(!isCallingCanDrag, 'You may not call monitor.canDrag() inside your canDrag() implementation. ' +
|
46253 | 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor');
|
46254 | try {
|
46255 | isCallingCanDrag = true;
|
46256 | return this.internalMonitor.canDragSource(this.sourceId);
|
46257 | }
|
46258 | finally {
|
46259 | isCallingCanDrag = false;
|
46260 | }
|
46261 | };
|
46262 | DragSourceMonitorImpl.prototype.isDragging = function () {
|
46263 | if (!this.sourceId) {
|
46264 | return false;
|
46265 | }
|
46266 | invariant_1$$1.default(!isCallingIsDragging, 'You may not call monitor.isDragging() inside your isDragging() implementation. ' +
|
46267 | 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor');
|
46268 | try {
|
46269 | isCallingIsDragging = true;
|
46270 | return this.internalMonitor.isDraggingSource(this.sourceId);
|
46271 | }
|
46272 | finally {
|
46273 | isCallingIsDragging = false;
|
46274 | }
|
46275 | };
|
46276 | DragSourceMonitorImpl.prototype.subscribeToStateChange = function (listener, options) {
|
46277 | return this.internalMonitor.subscribeToStateChange(listener, options);
|
46278 | };
|
46279 | DragSourceMonitorImpl.prototype.isDraggingSource = function (sourceId) {
|
46280 | return this.internalMonitor.isDraggingSource(sourceId);
|
46281 | };
|
46282 | DragSourceMonitorImpl.prototype.isOverTarget = function (targetId, options) {
|
46283 | return this.internalMonitor.isOverTarget(targetId, options);
|
46284 | };
|
46285 | DragSourceMonitorImpl.prototype.getTargetIds = function () {
|
46286 | return this.internalMonitor.getTargetIds();
|
46287 | };
|
46288 | DragSourceMonitorImpl.prototype.isSourcePublic = function () {
|
46289 | return this.internalMonitor.isSourcePublic();
|
46290 | };
|
46291 | DragSourceMonitorImpl.prototype.getSourceId = function () {
|
46292 | return this.internalMonitor.getSourceId();
|
46293 | };
|
46294 | DragSourceMonitorImpl.prototype.subscribeToOffsetChange = function (listener) {
|
46295 | return this.internalMonitor.subscribeToOffsetChange(listener);
|
46296 | };
|
46297 | DragSourceMonitorImpl.prototype.canDragSource = function (sourceId) {
|
46298 | return this.internalMonitor.canDragSource(sourceId);
|
46299 | };
|
46300 | DragSourceMonitorImpl.prototype.canDropOnTarget = function (targetId) {
|
46301 | return this.internalMonitor.canDropOnTarget(targetId);
|
46302 | };
|
46303 | DragSourceMonitorImpl.prototype.getItemType = function () {
|
46304 | return this.internalMonitor.getItemType();
|
46305 | };
|
46306 | DragSourceMonitorImpl.prototype.getItem = function () {
|
46307 | return this.internalMonitor.getItem();
|
46308 | };
|
46309 | DragSourceMonitorImpl.prototype.getDropResult = function () {
|
46310 | return this.internalMonitor.getDropResult();
|
46311 | };
|
46312 | DragSourceMonitorImpl.prototype.didDrop = function () {
|
46313 | return this.internalMonitor.didDrop();
|
46314 | };
|
46315 | DragSourceMonitorImpl.prototype.getInitialClientOffset = function () {
|
46316 | return this.internalMonitor.getInitialClientOffset();
|
46317 | };
|
46318 | DragSourceMonitorImpl.prototype.getInitialSourceClientOffset = function () {
|
46319 | return this.internalMonitor.getInitialSourceClientOffset();
|
46320 | };
|
46321 | DragSourceMonitorImpl.prototype.getSourceClientOffset = function () {
|
46322 | return this.internalMonitor.getSourceClientOffset();
|
46323 | };
|
46324 | DragSourceMonitorImpl.prototype.getClientOffset = function () {
|
46325 | return this.internalMonitor.getClientOffset();
|
46326 | };
|
46327 | DragSourceMonitorImpl.prototype.getDifferenceFromInitialOffset = function () {
|
46328 | return this.internalMonitor.getDifferenceFromInitialOffset();
|
46329 | };
|
46330 | return DragSourceMonitorImpl;
|
46331 | }());
|
46332 | exports.DragSourceMonitorImpl = DragSourceMonitorImpl;
|
46333 | });
|
46334 |
|
46335 | unwrapExports(DragSourceMonitorImpl_1);
|
46336 | var DragSourceMonitorImpl_2 = DragSourceMonitorImpl_1.DragSourceMonitorImpl;
|
46337 |
|
46338 | var cloneWithRef_1 = createCommonjsModule(function (module, exports) {
|
46339 | var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
46340 | return (mod && mod.__esModule) ? mod : { "default": mod };
|
46341 | };
|
46342 | Object.defineProperty(exports, "__esModule", { value: true });
|
46343 |
|
46344 | var invariant_1$$1 = __importDefault(invariant_1);
|
46345 | function setRef(ref, node) {
|
46346 | if (typeof ref === 'function') {
|
46347 | ref(node);
|
46348 | }
|
46349 | else {
|
46350 | ref.current = node;
|
46351 | }
|
46352 | }
|
46353 | function cloneWithRef(element, newRef) {
|
46354 | var previousRef = element.ref;
|
46355 | invariant_1$$1.default(typeof previousRef !== 'string', 'Cannot connect React DnD to an element with an existing string ref. ' +
|
46356 | 'Please convert it to use a callback ref instead, or wrap it into a <span> or <div>. ' +
|
46357 | 'Read more: https://facebook.github.io/react/docs/more-about-refs.html#the-ref-callback-attribute');
|
46358 | if (!previousRef) {
|
46359 | // When there is no ref on the element, use the new ref directly
|
46360 | return React.cloneElement(element, {
|
46361 | ref: newRef,
|
46362 | });
|
46363 | }
|
46364 | return React.cloneElement(element, {
|
46365 | ref: function (node) {
|
46366 | setRef(newRef, node);
|
46367 | if (previousRef) {
|
46368 | setRef(previousRef, node);
|
46369 | }
|
46370 | },
|
46371 | });
|
46372 | }
|
46373 | exports.cloneWithRef = cloneWithRef;
|
46374 | });
|
46375 |
|
46376 | unwrapExports(cloneWithRef_1);
|
46377 | var cloneWithRef_2 = cloneWithRef_1.cloneWithRef;
|
46378 |
|
46379 | var wrapConnectorHooks_1 = createCommonjsModule(function (module, exports) {
|
46380 | Object.defineProperty(exports, "__esModule", { value: true });
|
46381 |
|
46382 |
|
46383 | function throwIfCompositeComponentElement(element) {
|
46384 | // Custom components can no longer be wrapped directly in React DnD 2.0
|
46385 | // so that we don't need to depend on findDOMNode() from react-dom.
|
46386 | if (typeof element.type === 'string') {
|
46387 | return;
|
46388 | }
|
46389 | var displayName = element.type.displayName || element.type.name || 'the component';
|
46390 | throw new Error('Only native element nodes can now be passed to React DnD connectors.' +
|
46391 | ("You can either wrap " + displayName + " into a <div>, or turn it into a ") +
|
46392 | 'drag source or a drop target itself.');
|
46393 | }
|
46394 | function wrapHookToRecognizeElement(hook) {
|
46395 | return function (elementOrNode, options) {
|
46396 | if (elementOrNode === void 0) { elementOrNode = null; }
|
46397 | if (options === void 0) { options = null; }
|
46398 | // When passed a node, call the hook straight away.
|
46399 | if (!React.isValidElement(elementOrNode)) {
|
46400 | var node = elementOrNode;
|
46401 | hook(node, options);
|
46402 | // return the node so it can be chained (e.g. when within callback refs
|
46403 | // <div ref={node => connectDragSource(connectDropTarget(node))}/>
|
46404 | return node;
|
46405 | }
|
46406 | // If passed a ReactElement, clone it and attach this function as a ref.
|
46407 | // This helps us achieve a neat API where user doesn't even know that refs
|
46408 | // are being used under the hood.
|
46409 | var element = elementOrNode;
|
46410 | throwIfCompositeComponentElement(element);
|
46411 | // When no options are passed, use the hook directly
|
46412 | var ref = options ? function (node) { return hook(node, options); } : hook;
|
46413 | return cloneWithRef_1.cloneWithRef(element, ref);
|
46414 | };
|
46415 | }
|
46416 | function wrapConnectorHooks(hooks) {
|
46417 | var wrappedHooks = {};
|
46418 | Object.keys(hooks).forEach(function (key) {
|
46419 | var hook = hooks[key];
|
46420 | // ref objects should be passed straight through without wrapping
|
46421 | if (key.endsWith('Ref')) {
|
46422 | wrappedHooks[key] = hooks[key];
|
46423 | }
|
46424 | else {
|
46425 | var wrappedHook_1 = wrapHookToRecognizeElement(hook);
|
46426 | wrappedHooks[key] = function () { return wrappedHook_1; };
|
46427 | }
|
46428 | });
|
46429 | return wrappedHooks;
|
46430 | }
|
46431 | exports.default = wrapConnectorHooks;
|
46432 | });
|
46433 |
|
46434 | unwrapExports(wrapConnectorHooks_1);
|
46435 |
|
46436 | var isRef_1 = createCommonjsModule(function (module, exports) {
|
46437 | Object.defineProperty(exports, "__esModule", { value: true });
|
46438 | function isRef(obj) {
|
46439 | return (
|
46440 | // eslint-disable-next-line no-prototype-builtins
|
46441 | obj !== null && typeof obj === 'object' && obj.hasOwnProperty('current'));
|
46442 | }
|
46443 | exports.isRef = isRef;
|
46444 | });
|
46445 |
|
46446 | unwrapExports(isRef_1);
|
46447 | var isRef_2 = isRef_1.isRef;
|
46448 |
|
46449 | var SourceConnector_1 = createCommonjsModule(function (module, exports) {
|
46450 | var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
46451 | return (mod && mod.__esModule) ? mod : { "default": mod };
|
46452 | };
|
46453 | Object.defineProperty(exports, "__esModule", { value: true });
|
46454 | var wrapConnectorHooks_1$$1 = __importDefault(wrapConnectorHooks_1);
|
46455 |
|
46456 | var shallowequal_1 = __importDefault(shallowequal);
|
46457 | var SourceConnector = /** @class */ (function () {
|
46458 | function SourceConnector(backend) {
|
46459 | var _this = this;
|
46460 | this.backend = backend;
|
46461 | this.hooks = wrapConnectorHooks_1$$1.default({
|
46462 | dragSource: function (node, options) {
|
46463 | _this.dragSourceOptions = options || null;
|
46464 | if (isRef_1.isRef(node)) {
|
46465 | _this.dragSourceRef = node;
|
46466 | }
|
46467 | else {
|
46468 | _this.dragSourceNode = node;
|
46469 | }
|
46470 | _this.reconnectDragSource();
|
46471 | },
|
46472 | dragPreview: function (node, options) {
|
46473 | _this.dragPreviewOptions = options || null;
|
46474 | if (isRef_1.isRef(node)) {
|
46475 | _this.dragPreviewRef = node;
|
46476 | }
|
46477 | else {
|
46478 | _this.dragPreviewNode = node;
|
46479 | }
|
46480 | _this.reconnectDragPreview();
|
46481 | },
|
46482 | });
|
46483 | this.handlerId = null;
|
46484 | // The drop target may either be attached via ref or connect function
|
46485 | this.dragSourceRef = null;
|
46486 | this.dragSourceOptionsInternal = null;
|
46487 | // The drag preview may either be attached via ref or connect function
|
46488 | this.dragPreviewRef = null;
|
46489 | this.dragPreviewOptionsInternal = null;
|
46490 | this.lastConnectedHandlerId = null;
|
46491 | this.lastConnectedDragSource = null;
|
46492 | this.lastConnectedDragSourceOptions = null;
|
46493 | this.lastConnectedDragPreview = null;
|
46494 | this.lastConnectedDragPreviewOptions = null;
|
46495 | }
|
46496 | SourceConnector.prototype.receiveHandlerId = function (newHandlerId) {
|
46497 | if (this.handlerId === newHandlerId) {
|
46498 | return;
|
46499 | }
|
46500 | this.handlerId = newHandlerId;
|
46501 | this.reconnect();
|
46502 | };
|
46503 | Object.defineProperty(SourceConnector.prototype, "connectTarget", {
|
46504 | get: function () {
|
46505 | return this.dragSource;
|
46506 | },
|
46507 | enumerable: true,
|
46508 | configurable: true
|
46509 | });
|
46510 | Object.defineProperty(SourceConnector.prototype, "dragSourceOptions", {
|
46511 | get: function () {
|
46512 | return this.dragSourceOptionsInternal;
|
46513 | },
|
46514 | set: function (options) {
|
46515 | this.dragSourceOptionsInternal = options;
|
46516 | },
|
46517 | enumerable: true,
|
46518 | configurable: true
|
46519 | });
|
46520 | Object.defineProperty(SourceConnector.prototype, "dragPreviewOptions", {
|
46521 | get: function () {
|
46522 | return this.dragPreviewOptionsInternal;
|
46523 | },
|
46524 | set: function (options) {
|
46525 | this.dragPreviewOptionsInternal = options;
|
46526 | },
|
46527 | enumerable: true,
|
46528 | configurable: true
|
46529 | });
|
46530 | SourceConnector.prototype.reconnect = function () {
|
46531 | this.reconnectDragSource();
|
46532 | this.reconnectDragPreview();
|
46533 | };
|
46534 | SourceConnector.prototype.reconnectDragSource = function () {
|
46535 | // if nothing has changed then don't resubscribe
|
46536 | var didChange = this.didHandlerIdChange() ||
|
46537 | this.didConnectedDragSourceChange() ||
|
46538 | this.didDragSourceOptionsChange();
|
46539 | if (didChange) {
|
46540 | this.disconnectDragSource();
|
46541 | }
|
46542 | var dragSource = this.dragSource;
|
46543 | if (!this.handlerId) {
|
46544 | return;
|
46545 | }
|
46546 | if (!dragSource) {
|
46547 | this.lastConnectedDragSource = dragSource;
|
46548 | return;
|
46549 | }
|
46550 | if (didChange) {
|
46551 | this.lastConnectedHandlerId = this.handlerId;
|
46552 | this.lastConnectedDragSource = dragSource;
|
46553 | this.lastConnectedDragSourceOptions = this.dragSourceOptions;
|
46554 | this.dragSourceUnsubscribe = this.backend.connectDragSource(this.handlerId, dragSource, this.dragSourceOptions);
|
46555 | }
|
46556 | };
|
46557 | SourceConnector.prototype.reconnectDragPreview = function () {
|
46558 | // if nothing has changed then don't resubscribe
|
46559 | var didChange = this.didHandlerIdChange() ||
|
46560 | this.didConnectedDragPreviewChange() ||
|
46561 | this.didDragPreviewOptionsChange();
|
46562 | if (didChange) {
|
46563 | this.disconnectDragPreview();
|
46564 | }
|
46565 | var dragPreview = this.dragPreview;
|
46566 | if (!this.handlerId || !dragPreview) {
|
46567 | return;
|
46568 | }
|
46569 | if (didChange) {
|
46570 | this.lastConnectedHandlerId = this.handlerId;
|
46571 | this.lastConnectedDragPreview = dragPreview;
|
46572 | this.lastConnectedDragPreviewOptions = this.dragPreviewOptions;
|
46573 | this.dragPreviewUnsubscribe = this.backend.connectDragPreview(this.handlerId, dragPreview, this.dragPreviewOptions);
|
46574 | }
|
46575 | };
|
46576 | SourceConnector.prototype.didHandlerIdChange = function () {
|
46577 | return this.lastConnectedHandlerId !== this.handlerId;
|
46578 | };
|
46579 | SourceConnector.prototype.didConnectedDragSourceChange = function () {
|
46580 | return this.lastConnectedDragSource !== this.dragSource;
|
46581 | };
|
46582 | SourceConnector.prototype.didConnectedDragPreviewChange = function () {
|
46583 | return this.lastConnectedDragPreview !== this.dragPreview;
|
46584 | };
|
46585 | SourceConnector.prototype.didDragSourceOptionsChange = function () {
|
46586 | return !shallowequal_1.default(this.lastConnectedDragSourceOptions, this.dragSourceOptions);
|
46587 | };
|
46588 | SourceConnector.prototype.didDragPreviewOptionsChange = function () {
|
46589 | return !shallowequal_1.default(this.lastConnectedDragPreviewOptions, this.dragPreviewOptions);
|
46590 | };
|
46591 | SourceConnector.prototype.disconnectDragSource = function () {
|
46592 | if (this.dragSourceUnsubscribe) {
|
46593 | this.dragSourceUnsubscribe();
|
46594 | this.dragSourceUnsubscribe = undefined;
|
46595 | }
|
46596 | };
|
46597 | SourceConnector.prototype.disconnectDragPreview = function () {
|
46598 | if (this.dragPreviewUnsubscribe) {
|
46599 | this.dragPreviewUnsubscribe();
|
46600 | this.dragPreviewUnsubscribe = undefined;
|
46601 | this.dragPreviewNode = null;
|
46602 | this.dragPreviewRef = null;
|
46603 | }
|
46604 | };
|
46605 | Object.defineProperty(SourceConnector.prototype, "dragSource", {
|
46606 | get: function () {
|
46607 | return (this.dragSourceNode || (this.dragSourceRef && this.dragSourceRef.current));
|
46608 | },
|
46609 | enumerable: true,
|
46610 | configurable: true
|
46611 | });
|
46612 | Object.defineProperty(SourceConnector.prototype, "dragPreview", {
|
46613 | get: function () {
|
46614 | return (this.dragPreviewNode ||
|
46615 | (this.dragPreviewRef && this.dragPreviewRef.current));
|
46616 | },
|
46617 | enumerable: true,
|
46618 | configurable: true
|
46619 | });
|
46620 | return SourceConnector;
|
46621 | }());
|
46622 | exports.SourceConnector = SourceConnector;
|
46623 | });
|
46624 |
|
46625 | unwrapExports(SourceConnector_1);
|
46626 | var SourceConnector_2 = SourceConnector_1.SourceConnector;
|
46627 |
|
46628 | var drag = createCommonjsModule(function (module, exports) {
|
46629 | var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
46630 | return (mod && mod.__esModule) ? mod : { "default": mod };
|
46631 | };
|
46632 | Object.defineProperty(exports, "__esModule", { value: true });
|
46633 |
|
46634 | var invariant_1$$1 = __importDefault(invariant_1);
|
46635 |
|
46636 |
|
46637 |
|
46638 |
|
46639 | function useDragSourceMonitor() {
|
46640 | var manager = useDragDropManager_1.useDragDropManager();
|
46641 | var monitor = React.useMemo(function () { return new DragSourceMonitorImpl_1.DragSourceMonitorImpl(manager); }, [manager]);
|
46642 | var connector = React.useMemo(function () { return new SourceConnector_1.SourceConnector(manager.getBackend()); }, [
|
46643 | manager,
|
46644 | ]);
|
46645 | return [monitor, connector];
|
46646 | }
|
46647 | exports.useDragSourceMonitor = useDragSourceMonitor;
|
46648 | function useDragHandler(spec, monitor, connector) {
|
46649 | var manager = useDragDropManager_1.useDragDropManager();
|
46650 | var handler = React.useMemo(function () {
|
46651 | return {
|
46652 | beginDrag: function () {
|
46653 | var _a = spec.current, begin = _a.begin, item = _a.item;
|
46654 | if (begin) {
|
46655 | var beginResult = begin(monitor);
|
46656 | invariant_1$$1.default(beginResult == null || typeof beginResult === 'object', 'dragSpec.begin() must either return an object, undefined, or null');
|
46657 | return beginResult || item || {};
|
46658 | }
|
46659 | return item || {};
|
46660 | },
|
46661 | canDrag: function () {
|
46662 | if (typeof spec.current.canDrag === 'boolean') {
|
46663 | return spec.current.canDrag;
|
46664 | }
|
46665 | else if (typeof spec.current.canDrag === 'function') {
|
46666 | return spec.current.canDrag(monitor);
|
46667 | }
|
46668 | else {
|
46669 | return true;
|
46670 | }
|
46671 | },
|
46672 | isDragging: function (globalMonitor, target) {
|
46673 | var isDragging = spec.current.isDragging;
|
46674 | return isDragging
|
46675 | ? isDragging(monitor)
|
46676 | : target === globalMonitor.getSourceId();
|
46677 | },
|
46678 | endDrag: function () {
|
46679 | var end = spec.current.end;
|
46680 | if (end) {
|
46681 | end(monitor.getItem(), monitor);
|
46682 | }
|
46683 | connector.reconnect();
|
46684 | },
|
46685 | };
|
46686 | }, []);
|
46687 | React.useLayoutEffect(function registerHandler() {
|
46688 | var _a = registration.registerSource(spec.current.item.type, handler, manager), handlerId = _a[0], unregister = _a[1];
|
46689 | monitor.receiveHandlerId(handlerId);
|
46690 | connector.receiveHandlerId(handlerId);
|
46691 | return unregister;
|
46692 | }, []);
|
46693 | }
|
46694 | exports.useDragHandler = useDragHandler;
|
46695 | });
|
46696 |
|
46697 | unwrapExports(drag);
|
46698 | var drag_1 = drag.useDragSourceMonitor;
|
46699 | var drag_2 = drag.useDragHandler;
|
46700 |
|
46701 | var useDrag_1 = createCommonjsModule(function (module, exports) {
|
46702 | var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
46703 | return (mod && mod.__esModule) ? mod : { "default": mod };
|
46704 | };
|
46705 | Object.defineProperty(exports, "__esModule", { value: true });
|
46706 |
|
46707 | var invariant_1$$1 = __importDefault(invariant_1);
|
46708 |
|
46709 |
|
46710 | /**
|
46711 | * useDragSource hook
|
46712 | * @param sourceSpec The drag source specification *
|
46713 | */
|
46714 | function useDrag(spec) {
|
46715 | var specRef = React.useRef(spec);
|
46716 | specRef.current = spec;
|
46717 | // TODO: wire options into createSourceConnector
|
46718 | invariant_1$$1.default(spec.item != null, 'item must be defined');
|
46719 | invariant_1$$1.default(spec.item.type != null, 'item type must be defined');
|
46720 | var _a = drag.useDragSourceMonitor(), monitor = _a[0], connector = _a[1];
|
46721 | drag.useDragHandler(specRef, monitor, connector);
|
46722 | var result = useMonitorOutput_1.useMonitorOutput(monitor, specRef.current.collect || (function () { return ({}); }), function () { return connector.reconnect(); });
|
46723 | var connectDragSource = React.useMemo(function () { return connector.hooks.dragSource(); }, [
|
46724 | connector,
|
46725 | ]);
|
46726 | var connectDragPreview = React.useMemo(function () { return connector.hooks.dragPreview(); }, [
|
46727 | connector,
|
46728 | ]);
|
46729 | React.useLayoutEffect(function () {
|
46730 | connector.dragSourceOptions = specRef.current.options || null;
|
46731 | connector.reconnect();
|
46732 | }, [connector]);
|
46733 | React.useLayoutEffect(function () {
|
46734 | connector.dragPreviewOptions = specRef.current.previewOptions || null;
|
46735 | connector.reconnect();
|
46736 | }, [connector]);
|
46737 | return [result, connectDragSource, connectDragPreview];
|
46738 | }
|
46739 | exports.useDrag = useDrag;
|
46740 | });
|
46741 |
|
46742 | unwrapExports(useDrag_1);
|
46743 | var useDrag_2 = useDrag_1.useDrag;
|
46744 |
|
46745 | var TargetConnector_1 = createCommonjsModule(function (module, exports) {
|
46746 | var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
46747 | return (mod && mod.__esModule) ? mod : { "default": mod };
|
46748 | };
|
46749 | Object.defineProperty(exports, "__esModule", { value: true });
|
46750 | var shallowequal_1 = __importDefault(shallowequal);
|
46751 | var wrapConnectorHooks_1$$1 = __importDefault(wrapConnectorHooks_1);
|
46752 |
|
46753 | var TargetConnector = /** @class */ (function () {
|
46754 | function TargetConnector(backend) {
|
46755 | var _this = this;
|
46756 | this.backend = backend;
|
46757 | this.hooks = wrapConnectorHooks_1$$1.default({
|
46758 | dropTarget: function (node, options) {
|
46759 | _this.dropTargetOptions = options;
|
46760 | if (isRef_1.isRef(node)) {
|
46761 | _this.dropTargetRef = node;
|
46762 | }
|
46763 | else {
|
46764 | _this.dropTargetNode = node;
|
46765 | }
|
46766 | _this.reconnect();
|
46767 | },
|
46768 | });
|
46769 | this.handlerId = null;
|
46770 | // The drop target may either be attached via ref or connect function
|
46771 | this.dropTargetRef = null;
|
46772 | this.dropTargetOptionsInternal = null;
|
46773 | this.lastConnectedHandlerId = null;
|
46774 | this.lastConnectedDropTarget = null;
|
46775 | this.lastConnectedDropTargetOptions = null;
|
46776 | }
|
46777 | Object.defineProperty(TargetConnector.prototype, "connectTarget", {
|
46778 | get: function () {
|
46779 | return this.dropTarget;
|
46780 | },
|
46781 | enumerable: true,
|
46782 | configurable: true
|
46783 | });
|
46784 | TargetConnector.prototype.reconnect = function () {
|
46785 | // if nothing has changed then don't resubscribe
|
46786 | var didChange = this.didHandlerIdChange() ||
|
46787 | this.didDropTargetChange() ||
|
46788 | this.didOptionsChange();
|
46789 | if (didChange) {
|
46790 | this.disconnectDropTarget();
|
46791 | }
|
46792 | var dropTarget = this.dropTarget;
|
46793 | if (!this.handlerId) {
|
46794 | return;
|
46795 | }
|
46796 | if (!dropTarget) {
|
46797 | this.lastConnectedDropTarget = dropTarget;
|
46798 | return;
|
46799 | }
|
46800 | if (didChange) {
|
46801 | this.lastConnectedHandlerId = this.handlerId;
|
46802 | this.lastConnectedDropTarget = dropTarget;
|
46803 | this.lastConnectedDropTargetOptions = this.dropTargetOptions;
|
46804 | this.unsubscribeDropTarget = this.backend.connectDropTarget(this.handlerId, dropTarget, this.dropTargetOptions);
|
46805 | }
|
46806 | };
|
46807 | TargetConnector.prototype.receiveHandlerId = function (newHandlerId) {
|
46808 | if (newHandlerId === this.handlerId) {
|
46809 | return;
|
46810 | }
|
46811 | this.handlerId = newHandlerId;
|
46812 | this.reconnect();
|
46813 | };
|
46814 | Object.defineProperty(TargetConnector.prototype, "dropTargetOptions", {
|
46815 | get: function () {
|
46816 | return this.dropTargetOptionsInternal;
|
46817 | },
|
46818 | set: function (options) {
|
46819 | this.dropTargetOptionsInternal = options;
|
46820 | },
|
46821 | enumerable: true,
|
46822 | configurable: true
|
46823 | });
|
46824 | TargetConnector.prototype.didHandlerIdChange = function () {
|
46825 | return this.lastConnectedHandlerId !== this.handlerId;
|
46826 | };
|
46827 | TargetConnector.prototype.didDropTargetChange = function () {
|
46828 | return this.lastConnectedDropTarget !== this.dropTarget;
|
46829 | };
|
46830 | TargetConnector.prototype.didOptionsChange = function () {
|
46831 | return !shallowequal_1.default(this.lastConnectedDropTargetOptions, this.dropTargetOptions);
|
46832 | };
|
46833 | TargetConnector.prototype.disconnectDropTarget = function () {
|
46834 | if (this.unsubscribeDropTarget) {
|
46835 | this.unsubscribeDropTarget();
|
46836 | this.unsubscribeDropTarget = undefined;
|
46837 | }
|
46838 | };
|
46839 | Object.defineProperty(TargetConnector.prototype, "dropTarget", {
|
46840 | get: function () {
|
46841 | return (this.dropTargetNode || (this.dropTargetRef && this.dropTargetRef.current));
|
46842 | },
|
46843 | enumerable: true,
|
46844 | configurable: true
|
46845 | });
|
46846 | return TargetConnector;
|
46847 | }());
|
46848 | exports.TargetConnector = TargetConnector;
|
46849 | });
|
46850 |
|
46851 | unwrapExports(TargetConnector_1);
|
46852 | var TargetConnector_2 = TargetConnector_1.TargetConnector;
|
46853 |
|
46854 | var DropTargetMonitorImpl_1 = createCommonjsModule(function (module, exports) {
|
46855 | var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
46856 | return (mod && mod.__esModule) ? mod : { "default": mod };
|
46857 | };
|
46858 | Object.defineProperty(exports, "__esModule", { value: true });
|
46859 | var invariant_1$$1 = __importDefault(invariant_1);
|
46860 | var isCallingCanDrop = false;
|
46861 | var DropTargetMonitorImpl = /** @class */ (function () {
|
46862 | function DropTargetMonitorImpl(manager) {
|
46863 | this.targetId = null;
|
46864 | this.internalMonitor = manager.getMonitor();
|
46865 | }
|
46866 | DropTargetMonitorImpl.prototype.receiveHandlerId = function (targetId) {
|
46867 | this.targetId = targetId;
|
46868 | };
|
46869 | DropTargetMonitorImpl.prototype.getHandlerId = function () {
|
46870 | return this.targetId;
|
46871 | };
|
46872 | DropTargetMonitorImpl.prototype.subscribeToStateChange = function (listener, options) {
|
46873 | return this.internalMonitor.subscribeToStateChange(listener, options);
|
46874 | };
|
46875 | DropTargetMonitorImpl.prototype.canDrop = function () {
|
46876 | // Cut out early if the target id has not been set. This should prevent errors
|
46877 | // where the user has an older version of dnd-core like in
|
46878 | // https://github.com/react-dnd/react-dnd/issues/1310
|
46879 | if (!this.targetId) {
|
46880 | return false;
|
46881 | }
|
46882 | invariant_1$$1.default(!isCallingCanDrop, 'You may not call monitor.canDrop() inside your canDrop() implementation. ' +
|
46883 | 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor');
|
46884 | try {
|
46885 | isCallingCanDrop = true;
|
46886 | return this.internalMonitor.canDropOnTarget(this.targetId);
|
46887 | }
|
46888 | finally {
|
46889 | isCallingCanDrop = false;
|
46890 | }
|
46891 | };
|
46892 | DropTargetMonitorImpl.prototype.isOver = function (options) {
|
46893 | if (!this.targetId) {
|
46894 | return false;
|
46895 | }
|
46896 | return this.internalMonitor.isOverTarget(this.targetId, options);
|
46897 | };
|
46898 | DropTargetMonitorImpl.prototype.getItemType = function () {
|
46899 | return this.internalMonitor.getItemType();
|
46900 | };
|
46901 | DropTargetMonitorImpl.prototype.getItem = function () {
|
46902 | return this.internalMonitor.getItem();
|
46903 | };
|
46904 | DropTargetMonitorImpl.prototype.getDropResult = function () {
|
46905 | return this.internalMonitor.getDropResult();
|
46906 | };
|
46907 | DropTargetMonitorImpl.prototype.didDrop = function () {
|
46908 | return this.internalMonitor.didDrop();
|
46909 | };
|
46910 | DropTargetMonitorImpl.prototype.getInitialClientOffset = function () {
|
46911 | return this.internalMonitor.getInitialClientOffset();
|
46912 | };
|
46913 | DropTargetMonitorImpl.prototype.getInitialSourceClientOffset = function () {
|
46914 | return this.internalMonitor.getInitialSourceClientOffset();
|
46915 | };
|
46916 | DropTargetMonitorImpl.prototype.getSourceClientOffset = function () {
|
46917 | return this.internalMonitor.getSourceClientOffset();
|
46918 | };
|
46919 | DropTargetMonitorImpl.prototype.getClientOffset = function () {
|
46920 | return this.internalMonitor.getClientOffset();
|
46921 | };
|
46922 | DropTargetMonitorImpl.prototype.getDifferenceFromInitialOffset = function () {
|
46923 | return this.internalMonitor.getDifferenceFromInitialOffset();
|
46924 | };
|
46925 | return DropTargetMonitorImpl;
|
46926 | }());
|
46927 | exports.DropTargetMonitorImpl = DropTargetMonitorImpl;
|
46928 | });
|
46929 |
|
46930 | unwrapExports(DropTargetMonitorImpl_1);
|
46931 | var DropTargetMonitorImpl_2 = DropTargetMonitorImpl_1.DropTargetMonitorImpl;
|
46932 |
|
46933 | var drop$2 = createCommonjsModule(function (module, exports) {
|
46934 | Object.defineProperty(exports, "__esModule", { value: true });
|
46935 |
|
46936 |
|
46937 |
|
46938 |
|
46939 |
|
46940 | function useDropTargetMonitor() {
|
46941 | var manager = useDragDropManager_1.useDragDropManager();
|
46942 | var monitor = React.useMemo(function () { return new DropTargetMonitorImpl_1.DropTargetMonitorImpl(manager); }, [manager]);
|
46943 | var connector = React.useMemo(function () { return new TargetConnector_1.TargetConnector(manager.getBackend()); }, [
|
46944 | manager,
|
46945 | ]);
|
46946 | return [monitor, connector];
|
46947 | }
|
46948 | exports.useDropTargetMonitor = useDropTargetMonitor;
|
46949 | function useDropHandler(spec, monitor, connector) {
|
46950 | var manager = useDragDropManager_1.useDragDropManager();
|
46951 | var handler = React.useMemo(function () {
|
46952 | return {
|
46953 | canDrop: function () {
|
46954 | var canDrop = spec.current.canDrop;
|
46955 | return canDrop ? canDrop(monitor.getItem(), monitor) : true;
|
46956 | },
|
46957 | hover: function () {
|
46958 | var hover = spec.current.hover;
|
46959 | if (hover) {
|
46960 | hover(monitor.getItem(), monitor);
|
46961 | }
|
46962 | },
|
46963 | drop: function () {
|
46964 | var drop = spec.current.drop;
|
46965 | if (drop) {
|
46966 | return drop(monitor.getItem(), monitor);
|
46967 | }
|
46968 | },
|
46969 | };
|
46970 | }, [monitor]);
|
46971 | React.useLayoutEffect(function registerHandler() {
|
46972 | var _a = registration.registerTarget(spec.current.accept, handler, manager), handlerId = _a[0], unregister = _a[1];
|
46973 | monitor.receiveHandlerId(handlerId);
|
46974 | connector.receiveHandlerId(handlerId);
|
46975 | return unregister;
|
46976 | }, [monitor, connector]);
|
46977 | }
|
46978 | exports.useDropHandler = useDropHandler;
|
46979 | });
|
46980 |
|
46981 | unwrapExports(drop$2);
|
46982 | var drop_1 = drop$2.useDropTargetMonitor;
|
46983 | var drop_2 = drop$2.useDropHandler;
|
46984 |
|
46985 | var useDrop_1 = createCommonjsModule(function (module, exports) {
|
46986 | var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
46987 | return (mod && mod.__esModule) ? mod : { "default": mod };
|
46988 | };
|
46989 | Object.defineProperty(exports, "__esModule", { value: true });
|
46990 |
|
46991 | var invariant_1$$1 = __importDefault(invariant_1);
|
46992 |
|
46993 |
|
46994 | /**
|
46995 | * useDropTarget Hook
|
46996 | * @param spec The drop target specification
|
46997 | */
|
46998 | function useDrop(spec) {
|
46999 | var specRef = React.useRef(spec);
|
47000 | specRef.current = spec;
|
47001 | invariant_1$$1.default(spec.accept != null, 'accept must be defined');
|
47002 | var _a = drop$2.useDropTargetMonitor(), monitor = _a[0], connector = _a[1];
|
47003 | drop$2.useDropHandler(specRef, monitor, connector);
|
47004 | var result = useMonitorOutput_1.useMonitorOutput(monitor, specRef.current.collect || (function () { return ({}); }), function () { return connector.reconnect(); });
|
47005 | var connectDropTarget = React.useMemo(function () { return connector.hooks.dropTarget(); }, [
|
47006 | connector,
|
47007 | ]);
|
47008 | React.useLayoutEffect(function () {
|
47009 | connector.dropTargetOptions = spec.options || null;
|
47010 | connector.reconnect();
|
47011 | }, [spec.options]);
|
47012 | return [result, connectDropTarget];
|
47013 | }
|
47014 | exports.useDrop = useDrop;
|
47015 | });
|
47016 |
|
47017 | unwrapExports(useDrop_1);
|
47018 | var useDrop_2 = useDrop_1.useDrop;
|
47019 |
|
47020 | var ItemTypes = {
|
47021 | ROW: 'ROW',
|
47022 | CARD: 'CARD'
|
47023 | };
|
47024 |
|
47025 | var _ref$2 =
|
47026 | /*#__PURE__*/
|
47027 | React.createElement("path", {
|
47028 | d: "M2.781.151H.755A.755.755 0 0 0 0 .906v2.026c0 .416.339.755.755.755H2.78a.755.755 0 0 0 .755-.755V.906A.755.755 0 0 0 2.78.15zM9.013.151H6.987a.756.756 0 0 0-.755.755v2.026c0 .416.338.755.755.755h2.026a.756.756 0 0 0 .755-.755V.906A.756.756 0 0 0 9.013.15zM15.245.151H13.22a.755.755 0 0 0-.755.755v2.026c0 .416.339.755.755.755h2.027A.755.755 0 0 0 16 2.932V.906a.755.755 0 0 0-.755-.755zM2.781 6.232H.755A.756.756 0 0 0 0 6.987v2.026c0 .417.339.755.755.755H2.78a.756.756 0 0 0 .755-.755V6.987a.755.755 0 0 0-.755-.755zM9.013 6.232H6.987a.756.756 0 0 0-.755.755v2.026c0 .417.338.755.755.755h2.026a.756.756 0 0 0 .755-.755V6.987a.756.756 0 0 0-.755-.755zM15.245 6.232H13.22a.756.756 0 0 0-.755.755v2.026c0 .417.339.755.755.755h2.027A.756.756 0 0 0 16 9.013V6.987a.756.756 0 0 0-.755-.755zM2.781 12.313H.755a.756.756 0 0 0-.755.755v2.026c0 .416.339.755.755.755H2.78a.756.756 0 0 0 .755-.755v-2.026a.755.755 0 0 0-.755-.755zM9.013 12.313H6.987a.756.756 0 0 0-.755.755v2.026c0 .416.338.755.755.755h2.026a.756.756 0 0 0 .755-.755v-2.026a.756.756 0 0 0-.755-.755zM15.245 12.313H13.22a.755.755 0 0 0-.755.755v2.026c0 .416.339.755.755.755h2.027a.755.755 0 0 0 .754-.755v-2.026a.755.755 0 0 0-.755-.755z",
|
47029 | fill: "#424242"
|
47030 | });
|
47031 |
|
47032 | var dragIconBlack = 'data:image/svg+xml,%3Csvg%20width%3D%2216%22%20height%3D%2216%22%20viewBox%3D%220%200%2016%2016%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%20%20%3Cpath%20d%3D%22M2.78144%200.151001H0.75456C0.33856%200.151001%200%200.489561%200%200.905561V2.93212C0%203.34812%200.33856%203.68668%200.75456%203.68668H2.78112C3.19712%203.68668%203.53568%203.34812%203.53568%202.93212V0.905561C3.536%200.489561%203.19744%200.151001%202.78144%200.151001Z%22%20fill%3D%22%23424242%22%2F%3E%20%20%3Cpath%20d%3D%22M9.01337%200.151001H6.98681C6.57049%200.151001%206.23193%200.489561%206.23193%200.905561V2.93212C6.23193%203.34812%206.57049%203.68668%206.98681%203.68668H9.01337C9.42969%203.68668%209.76825%203.34812%209.76825%202.93212V0.905561C9.76793%200.489561%209.42937%200.151001%209.01337%200.151001Z%22%20fill%3D%22%23424242%22%2F%3E%20%20%3Cpath%20d%3D%22M15.2455%200.151001H13.2189C12.8029%200.151001%2012.4644%200.489561%2012.4644%200.905561V2.93212C12.4644%203.34812%2012.8029%203.68668%2013.2189%203.68668H15.2455C15.6615%203.68668%2016%203.34812%2016%202.93212V0.905561C16%200.489561%2015.6615%200.151001%2015.2455%200.151001Z%22%20fill%3D%22%23424242%22%2F%3E%20%20%3Cpath%20d%3D%22M2.78144%206.23193H0.75456C0.33856%206.23193%200%206.57049%200%206.98681V9.01337C0%209.42969%200.33856%209.76825%200.75456%209.76825H2.78112C3.19712%209.76825%203.53568%209.42969%203.53568%209.01337V6.98681C3.536%206.57049%203.19744%206.23193%202.78144%206.23193Z%22%20fill%3D%22%23424242%22%2F%3E%20%20%3Cpath%20d%3D%22M9.01337%206.23193H6.98681C6.57049%206.23193%206.23193%206.57049%206.23193%206.98681V9.01337C6.23193%209.42969%206.57049%209.76825%206.98681%209.76825H9.01337C9.42969%209.76825%209.76825%209.42969%209.76825%209.01337V6.98681C9.76793%206.57049%209.42937%206.23193%209.01337%206.23193Z%22%20fill%3D%22%23424242%22%2F%3E%20%20%3Cpath%20d%3D%22M15.2455%206.23193H13.2189C12.8029%206.23193%2012.4644%206.57049%2012.4644%206.98681V9.01337C12.4644%209.42969%2012.8029%209.76825%2013.2189%209.76825H15.2455C15.6615%209.76825%2016%209.42969%2016%209.01337V6.98681C16%206.57049%2015.6615%206.23193%2015.2455%206.23193Z%22%20fill%3D%22%23424242%22%2F%3E%20%20%3Cpath%20d%3D%22M2.78144%2012.3129H0.75456C0.33856%2012.3129%200%2012.6515%200%2013.0675V15.094C0%2015.5104%200.33856%2015.8486%200.75456%2015.8486H2.78112C3.19712%2015.8486%203.53568%2015.51%203.53568%2015.094V13.0675C3.536%2012.6515%203.19744%2012.3129%202.78144%2012.3129Z%22%20fill%3D%22%23424242%22%2F%3E%20%20%3Cpath%20d%3D%22M9.01337%2012.3129H6.98681C6.57049%2012.3129%206.23193%2012.6515%206.23193%2013.0675V15.094C6.23193%2015.5104%206.57049%2015.8486%206.98681%2015.8486H9.01337C9.42969%2015.8486%209.76825%2015.51%209.76825%2015.094V13.0675C9.76793%2012.6515%209.42937%2012.3129%209.01337%2012.3129Z%22%20fill%3D%22%23424242%22%2F%3E%20%20%3Cpath%20d%3D%22M15.2455%2012.3129H13.2189C12.8029%2012.3129%2012.4644%2012.6515%2012.4644%2013.0675V15.094C12.4644%2015.5104%2012.8029%2015.8486%2013.2189%2015.8486H15.2455C15.6615%2015.8486%2016%2015.51%2016%2015.094V13.0675C16%2012.6515%2015.6615%2012.3129%2015.2455%2012.3129Z%22%20fill%3D%22%23424242%22%2F%3E%3C%2Fsvg%3E';
|
47033 |
|
47034 | function _templateObject4$f() {
|
47035 | var data = taggedTemplateLiteralLoose(["\n\tcursor: grab;\n"]);
|
47036 |
|
47037 | _templateObject4$f = function _templateObject4() {
|
47038 | return data;
|
47039 | };
|
47040 |
|
47041 | return data;
|
47042 | }
|
47043 |
|
47044 | function _templateObject3$k() {
|
47045 | var data = taggedTemplateLiteralLoose(["\n\tbackground-color: ", ";\n"]);
|
47046 |
|
47047 | _templateObject3$k = function _templateObject3() {
|
47048 | return data;
|
47049 | };
|
47050 |
|
47051 | return data;
|
47052 | }
|
47053 |
|
47054 | function _templateObject2$v() {
|
47055 | var data = taggedTemplateLiteralLoose(["\n\topacity: ", ";\n"]);
|
47056 |
|
47057 | _templateObject2$v = function _templateObject2() {
|
47058 | return data;
|
47059 | };
|
47060 |
|
47061 | return data;
|
47062 | }
|
47063 |
|
47064 | function _templateObject$1l() {
|
47065 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tflex-grow: 2;\n\talign-items: center;\n\tjustify-content: space-between;\n"]);
|
47066 |
|
47067 | _templateObject$1l = function _templateObject() {
|
47068 | return data;
|
47069 | };
|
47070 |
|
47071 | return data;
|
47072 | }
|
47073 | var dragEndHandler = function dragEndHandler(index, callback) {
|
47074 | return function (item) {
|
47075 | return callback(index, item);
|
47076 | };
|
47077 | };
|
47078 | var dropHandler = function dropHandler(index, callback) {
|
47079 | return function (item) {
|
47080 | item.type === ItemTypes.CARD && callback(index, item);
|
47081 | return item;
|
47082 | };
|
47083 | };
|
47084 | var hoverHandler = function hoverHandler(ref, index, newItemCallback, moveCallback) {
|
47085 | return function (item) {
|
47086 | if (!ref.current) return;
|
47087 | var dragIndex = item.index;
|
47088 | var hoverIndex = index;
|
47089 | if (dragIndex === hoverIndex) return;
|
47090 | item.type === ItemTypes.CARD ? newItemCallback(hoverIndex, item) : moveCallback(dragIndex, hoverIndex);
|
47091 | item.index = hoverIndex;
|
47092 | };
|
47093 | };
|
47094 |
|
47095 | var DndListRow = function DndListRow(_ref) {
|
47096 | var id = _ref.id,
|
47097 | index = _ref.index,
|
47098 | moveItem = _ref.moveItem,
|
47099 | changedNewItem = _ref.changedNewItem,
|
47100 | isNewItem = _ref.isNewItem,
|
47101 | children = _ref.children,
|
47102 | dragComplete = _ref.dragComplete,
|
47103 | props = objectWithoutPropertiesLoose(_ref, ["id", "index", "moveItem", "changedNewItem", "isNewItem", "children", "dragComplete"]);
|
47104 |
|
47105 | var ref = useRef(null);
|
47106 |
|
47107 | var _useDrag = useDrag_2({
|
47108 | item: {
|
47109 | type: ItemTypes.ROW,
|
47110 | id: id,
|
47111 | index: index
|
47112 | },
|
47113 | end: dragEndHandler(index, dragComplete),
|
47114 | collect: function collect(monitor) {
|
47115 | return {
|
47116 | isDragging: monitor.isDragging()
|
47117 | };
|
47118 | }
|
47119 | }),
|
47120 | isDragging = _useDrag[0].isDragging,
|
47121 | drag = _useDrag[1],
|
47122 | preview = _useDrag[2];
|
47123 |
|
47124 | var _useDrop = useDrop_2({
|
47125 | accept: [ItemTypes.ROW, ItemTypes.CARD],
|
47126 | drop: dropHandler(index, dragComplete),
|
47127 | hover: hoverHandler(ref, index, changedNewItem, moveItem),
|
47128 | collect: function collect(monitor) {
|
47129 | return {
|
47130 | canDrop: monitor.canDrop(),
|
47131 | isUserDragging: !!monitor.getItem()
|
47132 | };
|
47133 | }
|
47134 | }),
|
47135 | _useDrop$ = _useDrop[0],
|
47136 | canDrop = _useDrop$.canDrop,
|
47137 | isUserDragging = _useDrop$.isUserDragging,
|
47138 | drop = _useDrop[1];
|
47139 |
|
47140 | if (!isUserDragging && isNewItem) changedNewItem(-1);
|
47141 | preview(drop(ref));
|
47142 | return React.createElement(DivStyled, {
|
47143 | ref: ref,
|
47144 | drawBackground: isDragging && canDrop || isNewItem
|
47145 | }, React.createElement(ListRowStyled, _extends_1({
|
47146 | removehover: canDrop ? 'removeHover' : undefined,
|
47147 | transparent: isDragging || isNewItem ? 'transparent' : undefined,
|
47148 | index: index,
|
47149 | key: id
|
47150 | }, props), React.createElement(FlexGrow, null, children), React.createElement(DragIcon, {
|
47151 | ref: drag,
|
47152 | src: dragIconBlack,
|
47153 | alt: "drag"
|
47154 | })));
|
47155 | };
|
47156 |
|
47157 | var FlexGrow = styled.div(_templateObject$1l());
|
47158 | DndListRow.displayName = 'DndListRow';
|
47159 | var ListRowStyled = styled(ListRow)(_templateObject2$v(), function (_ref2) {
|
47160 | var transparent = _ref2.transparent;
|
47161 | return transparent ? 0 : 1;
|
47162 | });
|
47163 | ListRowStyled.displayName = 'ListRowStyled';
|
47164 | var DivStyled = styled.div(_templateObject3$k(), function (_ref3) {
|
47165 | var drawBackground = _ref3.drawBackground,
|
47166 | theme = _ref3.theme;
|
47167 | return drawBackground && theme.dndList.dragOver;
|
47168 | });
|
47169 | DivStyled.displayName = 'DivStyled';
|
47170 | var DragIcon = styled.img(_templateObject4$f());
|
47171 | DragIcon.displayName = 'DragIcon';
|
47172 | DndListRow.defaultProps = {
|
47173 | changedNewItem: function changedNewItem() {},
|
47174 | isNewItem: false
|
47175 | };
|
47176 | DndListRow.propTypes = {
|
47177 | id: PropTypes.number.isRequired,
|
47178 | index: PropTypes.number.isRequired,
|
47179 | moveItem: PropTypes.func.isRequired,
|
47180 | dragComplete: PropTypes.func.isRequired,
|
47181 | changedNewItem: PropTypes.func,
|
47182 | isNewItem: PropTypes.bool,
|
47183 | children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired
|
47184 | };
|
47185 |
|
47186 | function _templateObject$1m() {
|
47187 | var data = taggedTemplateLiteralLoose(["\n\theight: 50px;\n\tbackground-color: ", ";\n"]);
|
47188 |
|
47189 | _templateObject$1m = function _templateObject() {
|
47190 | return data;
|
47191 | };
|
47192 |
|
47193 | return data;
|
47194 | }
|
47195 |
|
47196 | var DndEmptyList = function DndEmptyList(_ref) {
|
47197 | var addFirstItem = _ref.addFirstItem;
|
47198 |
|
47199 | var _useDrop = useDrop_2({
|
47200 | accept: [ItemTypes.CARD],
|
47201 | drop: addFirstItem,
|
47202 | collect: function collect(monitor) {
|
47203 | return {
|
47204 | isOver: monitor.isOver(),
|
47205 | canDrop: monitor.canDrop()
|
47206 | };
|
47207 | }
|
47208 | }),
|
47209 | _useDrop$ = _useDrop[0],
|
47210 | canDrop = _useDrop$.canDrop,
|
47211 | isOver = _useDrop$.isOver,
|
47212 | drop = _useDrop[1];
|
47213 |
|
47214 | return React.createElement(EmptyList, {
|
47215 | ref: drop,
|
47216 | hover: canDrop && isOver
|
47217 | });
|
47218 | };
|
47219 |
|
47220 | DndEmptyList.displayName = 'DndEmptyList';
|
47221 | DndEmptyList.propTypes = {
|
47222 | addFirstItem: PropTypes.func.isRequired
|
47223 | };
|
47224 | var EmptyList = styled.div(_templateObject$1m(), function (_ref2) {
|
47225 | var hover = _ref2.hover,
|
47226 | theme = _ref2.theme;
|
47227 | return hover && theme.dndList.dragOver;
|
47228 | });
|
47229 | EmptyList.displayName = 'EmptyList';
|
47230 |
|
47231 | var DndListContainer = function DndListContainer(_ref) {
|
47232 | var items = _ref.items,
|
47233 | Component$$1 = _ref.container,
|
47234 | onItemChange = _ref.onItemChange,
|
47235 | onNewItem = _ref.onNewItem,
|
47236 | props = objectWithoutPropertiesLoose(_ref, ["items", "container", "onItemChange", "onNewItem"]);
|
47237 |
|
47238 | var _useState = useState(items),
|
47239 | itemsArr = _useState[0],
|
47240 | setItemsArr = _useState[1];
|
47241 |
|
47242 | var _useState2 = useState(-1),
|
47243 | newItemIndex = _useState2[0],
|
47244 | setNewItemIndex = _useState2[1];
|
47245 |
|
47246 | useEffect(function () {
|
47247 | setItemsArr([].concat(items));
|
47248 | setNewItemIndex(-1);
|
47249 | }, [JSON.stringify(items)]);
|
47250 |
|
47251 | var moveItem = function moveItem(index, atIndex) {
|
47252 | itemsArr.splice(atIndex, 0, itemsArr.splice(index, 1)[0]);
|
47253 | setItemsArr([].concat(itemsArr));
|
47254 | };
|
47255 |
|
47256 | var dragComplete = function dragComplete(index, item) {
|
47257 | newItemIndex !== -1 ? setTimeout(function () {
|
47258 | return onNewItem(item, index);
|
47259 | }, 10) : onItemChange(item, index);
|
47260 | };
|
47261 |
|
47262 | var changedNewItemHandler = function changedNewItemHandler(index, item) {
|
47263 | if (index === -1) itemsArr.splice(newItemIndex, 1);else if (newItemIndex === -1) itemsArr.splice(index, 0, _extends_1({}, item, {
|
47264 | id: -1,
|
47265 | index: index
|
47266 | }));else itemsArr.splice(index, 0, itemsArr.splice(newItemIndex, 1)[0]);
|
47267 | setItemsArr([].concat(itemsArr));
|
47268 | setNewItemIndex(index);
|
47269 | };
|
47270 |
|
47271 | var addFirstItem = function addFirstItem(item) {
|
47272 | setItemsArr([item]);
|
47273 | onNewItem(item, 0);
|
47274 | };
|
47275 |
|
47276 | return items.length ? itemsArr.map(function (item, index) {
|
47277 | return React.createElement(DndListRow, _extends_1({
|
47278 | isNewItem: index === newItemIndex,
|
47279 | changedNewItem: changedNewItemHandler,
|
47280 | key: item.id,
|
47281 | index: index,
|
47282 | id: item.id,
|
47283 | moveItem: moveItem,
|
47284 | dragComplete: dragComplete
|
47285 | }, props), React.createElement(Component$$1, {
|
47286 | item: item,
|
47287 | index: index
|
47288 | }));
|
47289 | }) : React.createElement(DndEmptyList, {
|
47290 | addFirstItem: addFirstItem
|
47291 | });
|
47292 | };
|
47293 |
|
47294 | DndListContainer.propTypes = {
|
47295 | items: PropTypes.arrayOf(PropTypes.shape({
|
47296 | id: PropTypes.number.isRequired
|
47297 | })).isRequired,
|
47298 | container: PropTypes.func.isRequired,
|
47299 | onItemChange: PropTypes.func.isRequired,
|
47300 | onNewItem: PropTypes.func.isRequired
|
47301 | };
|
47302 |
|
47303 | var DndProvider = createCommonjsModule(function (module, exports) {
|
47304 | var __rest = (commonjsGlobal && commonjsGlobal.__rest) || function (s, e) {
|
47305 | var t = {};
|
47306 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
47307 | t[p] = s[p];
|
47308 | if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
47309 | for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
47310 | if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
47311 | t[p[i]] = s[p[i]];
|
47312 | }
|
47313 | return t;
|
47314 | };
|
47315 | var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
|
47316 | if (mod && mod.__esModule) return mod;
|
47317 | var result = {};
|
47318 | if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
47319 | result["default"] = mod;
|
47320 | return result;
|
47321 | };
|
47322 | Object.defineProperty(exports, "__esModule", { value: true });
|
47323 | var React$$1 = __importStar(React);
|
47324 | var react_1 = React;
|
47325 |
|
47326 | /**
|
47327 | * A React component that provides the React-DnD context
|
47328 | */
|
47329 | exports.DndProvider = react_1.memo(function (_a) {
|
47330 | var children = _a.children, props = __rest(_a, ["children"]);
|
47331 | var context = 'manager' in props
|
47332 | ? { dragDropManager: props.manager }
|
47333 | : createSingletonDndContext(props.backend, props.context, props.options, props.debugMode);
|
47334 | return React$$1.createElement(DndContext.DndContext.Provider, { value: context }, children);
|
47335 | });
|
47336 | var instanceSymbol = Symbol.for('__REACT_DND_CONTEXT_INSTANCE__');
|
47337 | function createSingletonDndContext(backend, context, options, debugMode) {
|
47338 | if (context === void 0) { context = getGlobalContext(); }
|
47339 | var ctx = context;
|
47340 | if (!ctx[instanceSymbol]) {
|
47341 | ctx[instanceSymbol] = DndContext.createDndContext(backend, context, options, debugMode);
|
47342 | }
|
47343 | return ctx[instanceSymbol];
|
47344 | }
|
47345 | function getGlobalContext() {
|
47346 | return typeof commonjsGlobal !== 'undefined' ? commonjsGlobal : window;
|
47347 | }
|
47348 | });
|
47349 |
|
47350 | unwrapExports(DndProvider);
|
47351 | var DndProvider_1 = DndProvider.DndProvider;
|
47352 |
|
47353 | var js_utils$2 = createCommonjsModule(function (module, exports) {
|
47354 | // cheap lodash replacements
|
47355 | Object.defineProperty(exports, "__esModule", { value: true });
|
47356 | function memoize(fn) {
|
47357 | var result = null;
|
47358 | var memoized = function () {
|
47359 | if (result == null) {
|
47360 | result = fn();
|
47361 | }
|
47362 | return result;
|
47363 | };
|
47364 | return memoized;
|
47365 | }
|
47366 | exports.memoize = memoize;
|
47367 | /**
|
47368 | * drop-in replacement for _.without
|
47369 | */
|
47370 | function without(items, item) {
|
47371 | return items.filter(function (i) { return i !== item; });
|
47372 | }
|
47373 | exports.without = without;
|
47374 | function union(itemsA, itemsB) {
|
47375 | var set = new Set();
|
47376 | var insertItem = function (item) { return set.add(item); };
|
47377 | itemsA.forEach(insertItem);
|
47378 | itemsB.forEach(insertItem);
|
47379 | var result = [];
|
47380 | set.forEach(function (key) { return result.push(key); });
|
47381 | return result;
|
47382 | }
|
47383 | exports.union = union;
|
47384 | });
|
47385 |
|
47386 | unwrapExports(js_utils$2);
|
47387 | var js_utils_1$1 = js_utils$2.memoize;
|
47388 | var js_utils_2$1 = js_utils$2.without;
|
47389 | var js_utils_3$1 = js_utils$2.union;
|
47390 |
|
47391 | var EnterLeaveCounter_1 = createCommonjsModule(function (module, exports) {
|
47392 | Object.defineProperty(exports, "__esModule", { value: true });
|
47393 |
|
47394 | var EnterLeaveCounter = /** @class */ (function () {
|
47395 | function EnterLeaveCounter(isNodeInDocument) {
|
47396 | this.entered = [];
|
47397 | this.isNodeInDocument = isNodeInDocument;
|
47398 | }
|
47399 | EnterLeaveCounter.prototype.enter = function (enteringNode) {
|
47400 | var _this = this;
|
47401 | var previousLength = this.entered.length;
|
47402 | var isNodeEntered = function (node) {
|
47403 | return _this.isNodeInDocument(node) &&
|
47404 | (!node.contains || node.contains(enteringNode));
|
47405 | };
|
47406 | this.entered = js_utils$2.union(this.entered.filter(isNodeEntered), [enteringNode]);
|
47407 | return previousLength === 0 && this.entered.length > 0;
|
47408 | };
|
47409 | EnterLeaveCounter.prototype.leave = function (leavingNode) {
|
47410 | var previousLength = this.entered.length;
|
47411 | this.entered = js_utils$2.without(this.entered.filter(this.isNodeInDocument), leavingNode);
|
47412 | return previousLength > 0 && this.entered.length === 0;
|
47413 | };
|
47414 | EnterLeaveCounter.prototype.reset = function () {
|
47415 | this.entered = [];
|
47416 | };
|
47417 | return EnterLeaveCounter;
|
47418 | }());
|
47419 | exports.default = EnterLeaveCounter;
|
47420 | });
|
47421 |
|
47422 | unwrapExports(EnterLeaveCounter_1);
|
47423 |
|
47424 | var BrowserDetector = createCommonjsModule(function (module, exports) {
|
47425 | Object.defineProperty(exports, "__esModule", { value: true });
|
47426 |
|
47427 | exports.isFirefox = js_utils$2.memoize(function () {
|
47428 | return /firefox/i.test(navigator.userAgent);
|
47429 | });
|
47430 | exports.isSafari = js_utils$2.memoize(function () { return Boolean(window.safari); });
|
47431 | });
|
47432 |
|
47433 | unwrapExports(BrowserDetector);
|
47434 | var BrowserDetector_1 = BrowserDetector.isFirefox;
|
47435 | var BrowserDetector_2 = BrowserDetector.isSafari;
|
47436 |
|
47437 | var MonotonicInterpolant_1 = createCommonjsModule(function (module, exports) {
|
47438 | Object.defineProperty(exports, "__esModule", { value: true });
|
47439 | var MonotonicInterpolant = /** @class */ (function () {
|
47440 | function MonotonicInterpolant(xs, ys) {
|
47441 | var length = xs.length;
|
47442 | // Rearrange xs and ys so that xs is sorted
|
47443 | var indexes = [];
|
47444 | for (var i = 0; i < length; i++) {
|
47445 | indexes.push(i);
|
47446 | }
|
47447 | indexes.sort(function (a, b) { return (xs[a] < xs[b] ? -1 : 1); });
|
47448 | var dxs = [];
|
47449 | var ms = [];
|
47450 | var dx;
|
47451 | var dy;
|
47452 | for (var i = 0; i < length - 1; i++) {
|
47453 | dx = xs[i + 1] - xs[i];
|
47454 | dy = ys[i + 1] - ys[i];
|
47455 | dxs.push(dx);
|
47456 | ms.push(dy / dx);
|
47457 | }
|
47458 | // Get degree-1 coefficients
|
47459 | var c1s = [ms[0]];
|
47460 | for (var i = 0; i < dxs.length - 1; i++) {
|
47461 | var m2 = ms[i];
|
47462 | var mNext = ms[i + 1];
|
47463 | if (m2 * mNext <= 0) {
|
47464 | c1s.push(0);
|
47465 | }
|
47466 | else {
|
47467 | dx = dxs[i];
|
47468 | var dxNext = dxs[i + 1];
|
47469 | var common = dx + dxNext;
|
47470 | c1s.push((3 * common) / ((common + dxNext) / m2 + (common + dx) / mNext));
|
47471 | }
|
47472 | }
|
47473 | c1s.push(ms[ms.length - 1]);
|
47474 | // Get degree-2 and degree-3 coefficients
|
47475 | var c2s = [];
|
47476 | var c3s = [];
|
47477 | var m;
|
47478 | for (var i = 0; i < c1s.length - 1; i++) {
|
47479 | m = ms[i];
|
47480 | var c1 = c1s[i];
|
47481 | var invDx = 1 / dxs[i];
|
47482 | var common = c1 + c1s[i + 1] - m - m;
|
47483 | c2s.push((m - c1 - common) * invDx);
|
47484 | c3s.push(common * invDx * invDx);
|
47485 | }
|
47486 | this.xs = xs;
|
47487 | this.ys = ys;
|
47488 | this.c1s = c1s;
|
47489 | this.c2s = c2s;
|
47490 | this.c3s = c3s;
|
47491 | }
|
47492 | MonotonicInterpolant.prototype.interpolate = function (x) {
|
47493 | var _a = this, xs = _a.xs, ys = _a.ys, c1s = _a.c1s, c2s = _a.c2s, c3s = _a.c3s;
|
47494 | // The rightmost point in the dataset should give an exact result
|
47495 | var i = xs.length - 1;
|
47496 | if (x === xs[i]) {
|
47497 | return ys[i];
|
47498 | }
|
47499 | // Search for the interval x is in, returning the corresponding y if x is one of the original xs
|
47500 | var low = 0;
|
47501 | var high = c3s.length - 1;
|
47502 | var mid;
|
47503 | while (low <= high) {
|
47504 | mid = Math.floor(0.5 * (low + high));
|
47505 | var xHere = xs[mid];
|
47506 | if (xHere < x) {
|
47507 | low = mid + 1;
|
47508 | }
|
47509 | else if (xHere > x) {
|
47510 | high = mid - 1;
|
47511 | }
|
47512 | else {
|
47513 | return ys[mid];
|
47514 | }
|
47515 | }
|
47516 | i = Math.max(0, high);
|
47517 | // Interpolate
|
47518 | var diff = x - xs[i];
|
47519 | var diffSq = diff * diff;
|
47520 | return ys[i] + c1s[i] * diff + c2s[i] * diffSq + c3s[i] * diff * diffSq;
|
47521 | };
|
47522 | return MonotonicInterpolant;
|
47523 | }());
|
47524 | exports.default = MonotonicInterpolant;
|
47525 | });
|
47526 |
|
47527 | unwrapExports(MonotonicInterpolant_1);
|
47528 |
|
47529 | var OffsetUtils = createCommonjsModule(function (module, exports) {
|
47530 | var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
47531 | return (mod && mod.__esModule) ? mod : { "default": mod };
|
47532 | };
|
47533 | Object.defineProperty(exports, "__esModule", { value: true });
|
47534 |
|
47535 | var MonotonicInterpolant_1$$1 = __importDefault(MonotonicInterpolant_1);
|
47536 | var ELEMENT_NODE = 1;
|
47537 | function getNodeClientOffset(node) {
|
47538 | var el = node.nodeType === ELEMENT_NODE ? node : node.parentElement;
|
47539 | if (!el) {
|
47540 | return null;
|
47541 | }
|
47542 | var _a = el.getBoundingClientRect(), top = _a.top, left = _a.left;
|
47543 | return { x: left, y: top };
|
47544 | }
|
47545 | exports.getNodeClientOffset = getNodeClientOffset;
|
47546 | function getEventClientOffset(e) {
|
47547 | return {
|
47548 | x: e.clientX,
|
47549 | y: e.clientY,
|
47550 | };
|
47551 | }
|
47552 | exports.getEventClientOffset = getEventClientOffset;
|
47553 | function isImageNode(node) {
|
47554 | return (node.nodeName === 'IMG' &&
|
47555 | (BrowserDetector.isFirefox() || !document.documentElement.contains(node)));
|
47556 | }
|
47557 | function getDragPreviewSize(isImage, dragPreview, sourceWidth, sourceHeight) {
|
47558 | var dragPreviewWidth = isImage ? dragPreview.width : sourceWidth;
|
47559 | var dragPreviewHeight = isImage ? dragPreview.height : sourceHeight;
|
47560 | // Work around @2x coordinate discrepancies in browsers
|
47561 | if (BrowserDetector.isSafari() && isImage) {
|
47562 | dragPreviewHeight /= window.devicePixelRatio;
|
47563 | dragPreviewWidth /= window.devicePixelRatio;
|
47564 | }
|
47565 | return { dragPreviewWidth: dragPreviewWidth, dragPreviewHeight: dragPreviewHeight };
|
47566 | }
|
47567 | function getDragPreviewOffset(sourceNode, dragPreview, clientOffset, anchorPoint, offsetPoint) {
|
47568 | // The browsers will use the image intrinsic size under different conditions.
|
47569 | // Firefox only cares if it's an image, but WebKit also wants it to be detached.
|
47570 | var isImage = isImageNode(dragPreview);
|
47571 | var dragPreviewNode = isImage ? sourceNode : dragPreview;
|
47572 | var dragPreviewNodeOffsetFromClient = getNodeClientOffset(dragPreviewNode);
|
47573 | var offsetFromDragPreview = {
|
47574 | x: clientOffset.x - dragPreviewNodeOffsetFromClient.x,
|
47575 | y: clientOffset.y - dragPreviewNodeOffsetFromClient.y,
|
47576 | };
|
47577 | var sourceWidth = sourceNode.offsetWidth, sourceHeight = sourceNode.offsetHeight;
|
47578 | var anchorX = anchorPoint.anchorX, anchorY = anchorPoint.anchorY;
|
47579 | var _a = getDragPreviewSize(isImage, dragPreview, sourceWidth, sourceHeight), dragPreviewWidth = _a.dragPreviewWidth, dragPreviewHeight = _a.dragPreviewHeight;
|
47580 | var calculateYOffset = function () {
|
47581 | var interpolantY = new MonotonicInterpolant_1$$1.default([0, 0.5, 1], [
|
47582 | // Dock to the top
|
47583 | offsetFromDragPreview.y,
|
47584 | // Align at the center
|
47585 | (offsetFromDragPreview.y / sourceHeight) * dragPreviewHeight,
|
47586 | // Dock to the bottom
|
47587 | offsetFromDragPreview.y + dragPreviewHeight - sourceHeight,
|
47588 | ]);
|
47589 | var y = interpolantY.interpolate(anchorY);
|
47590 | // Work around Safari 8 positioning bug
|
47591 | if (BrowserDetector.isSafari() && isImage) {
|
47592 | // We'll have to wait for @3x to see if this is entirely correct
|
47593 | y += (window.devicePixelRatio - 1) * dragPreviewHeight;
|
47594 | }
|
47595 | return y;
|
47596 | };
|
47597 | var calculateXOffset = function () {
|
47598 | // Interpolate coordinates depending on anchor point
|
47599 | // If you know a simpler way to do this, let me know
|
47600 | var interpolantX = new MonotonicInterpolant_1$$1.default([0, 0.5, 1], [
|
47601 | // Dock to the left
|
47602 | offsetFromDragPreview.x,
|
47603 | // Align at the center
|
47604 | (offsetFromDragPreview.x / sourceWidth) * dragPreviewWidth,
|
47605 | // Dock to the right
|
47606 | offsetFromDragPreview.x + dragPreviewWidth - sourceWidth,
|
47607 | ]);
|
47608 | return interpolantX.interpolate(anchorX);
|
47609 | };
|
47610 | // Force offsets if specified in the options.
|
47611 | var offsetX = offsetPoint.offsetX, offsetY = offsetPoint.offsetY;
|
47612 | var isManualOffsetX = offsetX === 0 || offsetX;
|
47613 | var isManualOffsetY = offsetY === 0 || offsetY;
|
47614 | return {
|
47615 | x: isManualOffsetX ? offsetX : calculateXOffset(),
|
47616 | y: isManualOffsetY ? offsetY : calculateYOffset(),
|
47617 | };
|
47618 | }
|
47619 | exports.getDragPreviewOffset = getDragPreviewOffset;
|
47620 | });
|
47621 |
|
47622 | unwrapExports(OffsetUtils);
|
47623 | var OffsetUtils_1 = OffsetUtils.getNodeClientOffset;
|
47624 | var OffsetUtils_2 = OffsetUtils.getEventClientOffset;
|
47625 | var OffsetUtils_3 = OffsetUtils.getDragPreviewOffset;
|
47626 |
|
47627 | var NativeTypes = createCommonjsModule(function (module, exports) {
|
47628 | Object.defineProperty(exports, "__esModule", { value: true });
|
47629 | exports.FILE = '__NATIVE_FILE__';
|
47630 | exports.URL = '__NATIVE_URL__';
|
47631 | exports.TEXT = '__NATIVE_TEXT__';
|
47632 | });
|
47633 |
|
47634 | unwrapExports(NativeTypes);
|
47635 | var NativeTypes_1 = NativeTypes.FILE;
|
47636 | var NativeTypes_2 = NativeTypes.URL;
|
47637 | var NativeTypes_3 = NativeTypes.TEXT;
|
47638 |
|
47639 | var getDataFromDataTransfer_1 = createCommonjsModule(function (module, exports) {
|
47640 | Object.defineProperty(exports, "__esModule", { value: true });
|
47641 | function getDataFromDataTransfer(dataTransfer, typesToTry, defaultValue) {
|
47642 | var result = typesToTry.reduce(function (resultSoFar, typeToTry) { return resultSoFar || dataTransfer.getData(typeToTry); }, '');
|
47643 | return result != null ? result : defaultValue;
|
47644 | }
|
47645 | exports.getDataFromDataTransfer = getDataFromDataTransfer;
|
47646 | });
|
47647 |
|
47648 | unwrapExports(getDataFromDataTransfer_1);
|
47649 | var getDataFromDataTransfer_2 = getDataFromDataTransfer_1.getDataFromDataTransfer;
|
47650 |
|
47651 | var nativeTypesConfig = createCommonjsModule(function (module, exports) {
|
47652 | var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
|
47653 | if (mod && mod.__esModule) return mod;
|
47654 | var result = {};
|
47655 | if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
47656 | result["default"] = mod;
|
47657 | return result;
|
47658 | };
|
47659 | var _a;
|
47660 | Object.defineProperty(exports, "__esModule", { value: true });
|
47661 | var NativeTypes$$1 = __importStar(NativeTypes);
|
47662 |
|
47663 | exports.nativeTypesConfig = (_a = {},
|
47664 | _a[NativeTypes$$1.FILE] = {
|
47665 | exposeProperties: {
|
47666 | files: function (dataTransfer) {
|
47667 | return Array.prototype.slice.call(dataTransfer.files);
|
47668 | },
|
47669 | items: function (dataTransfer) { return dataTransfer.items; },
|
47670 | },
|
47671 | matchesTypes: ['Files'],
|
47672 | },
|
47673 | _a[NativeTypes$$1.URL] = {
|
47674 | exposeProperties: {
|
47675 | urls: function (dataTransfer, matchesTypes) {
|
47676 | return getDataFromDataTransfer_1.getDataFromDataTransfer(dataTransfer, matchesTypes, '').split('\n');
|
47677 | },
|
47678 | },
|
47679 | matchesTypes: ['Url', 'text/uri-list'],
|
47680 | },
|
47681 | _a[NativeTypes$$1.TEXT] = {
|
47682 | exposeProperties: {
|
47683 | text: function (dataTransfer, matchesTypes) {
|
47684 | return getDataFromDataTransfer_1.getDataFromDataTransfer(dataTransfer, matchesTypes, '');
|
47685 | },
|
47686 | },
|
47687 | matchesTypes: ['Text', 'text/plain'],
|
47688 | },
|
47689 | _a);
|
47690 | });
|
47691 |
|
47692 | unwrapExports(nativeTypesConfig);
|
47693 | var nativeTypesConfig_1 = nativeTypesConfig.nativeTypesConfig;
|
47694 |
|
47695 | var NativeDragSource_1 = createCommonjsModule(function (module, exports) {
|
47696 | Object.defineProperty(exports, "__esModule", { value: true });
|
47697 | var NativeDragSource = /** @class */ (function () {
|
47698 | function NativeDragSource(config) {
|
47699 | var _this = this;
|
47700 | this.config = config;
|
47701 | this.item = {};
|
47702 | Object.keys(this.config.exposeProperties).forEach(function (property) {
|
47703 | Object.defineProperty(_this.item, property, {
|
47704 | configurable: true,
|
47705 | enumerable: true,
|
47706 | get: function () {
|
47707 | // eslint-disable-next-line no-console
|
47708 | console.warn("Browser doesn't allow reading \"" + property + "\" until the drop event.");
|
47709 | return null;
|
47710 | },
|
47711 | });
|
47712 | });
|
47713 | }
|
47714 | NativeDragSource.prototype.mutateItemByReadingDataTransfer = function (dataTransfer) {
|
47715 | var _this = this;
|
47716 | var newProperties = {};
|
47717 | if (dataTransfer) {
|
47718 | Object.keys(this.config.exposeProperties).forEach(function (property) {
|
47719 | newProperties[property] = {
|
47720 | value: _this.config.exposeProperties[property](dataTransfer, _this.config.matchesTypes),
|
47721 | };
|
47722 | });
|
47723 | }
|
47724 | Object.defineProperties(this.item, newProperties);
|
47725 | };
|
47726 | NativeDragSource.prototype.canDrag = function () {
|
47727 | return true;
|
47728 | };
|
47729 | NativeDragSource.prototype.beginDrag = function () {
|
47730 | return this.item;
|
47731 | };
|
47732 | NativeDragSource.prototype.isDragging = function (monitor, handle) {
|
47733 | return handle === monitor.getSourceId();
|
47734 | };
|
47735 | NativeDragSource.prototype.endDrag = function () {
|
47736 | // empty
|
47737 | };
|
47738 | return NativeDragSource;
|
47739 | }());
|
47740 | exports.NativeDragSource = NativeDragSource;
|
47741 | });
|
47742 |
|
47743 | unwrapExports(NativeDragSource_1);
|
47744 | var NativeDragSource_2 = NativeDragSource_1.NativeDragSource;
|
47745 |
|
47746 | var NativeDragSources = createCommonjsModule(function (module, exports) {
|
47747 | Object.defineProperty(exports, "__esModule", { value: true });
|
47748 |
|
47749 |
|
47750 | function createNativeDragSource(type) {
|
47751 | return new NativeDragSource_1.NativeDragSource(nativeTypesConfig.nativeTypesConfig[type]);
|
47752 | }
|
47753 | exports.createNativeDragSource = createNativeDragSource;
|
47754 | function matchNativeItemType(dataTransfer) {
|
47755 | if (!dataTransfer) {
|
47756 | return null;
|
47757 | }
|
47758 | var dataTransferTypes = Array.prototype.slice.call(dataTransfer.types || []);
|
47759 | return (Object.keys(nativeTypesConfig.nativeTypesConfig).filter(function (nativeItemType) {
|
47760 | var matchesTypes = nativeTypesConfig.nativeTypesConfig[nativeItemType].matchesTypes;
|
47761 | return matchesTypes.some(function (t) { return dataTransferTypes.indexOf(t) > -1; });
|
47762 | })[0] || null);
|
47763 | }
|
47764 | exports.matchNativeItemType = matchNativeItemType;
|
47765 | });
|
47766 |
|
47767 | unwrapExports(NativeDragSources);
|
47768 | var NativeDragSources_1 = NativeDragSources.createNativeDragSource;
|
47769 | var NativeDragSources_2 = NativeDragSources.matchNativeItemType;
|
47770 |
|
47771 | var OptionsReader_1 = createCommonjsModule(function (module, exports) {
|
47772 | Object.defineProperty(exports, "__esModule", { value: true });
|
47773 | var OptionsReader = /** @class */ (function () {
|
47774 | function OptionsReader(globalContext) {
|
47775 | this.globalContext = globalContext;
|
47776 | }
|
47777 | Object.defineProperty(OptionsReader.prototype, "window", {
|
47778 | get: function () {
|
47779 | if (this.globalContext) {
|
47780 | return this.globalContext;
|
47781 | }
|
47782 | else if (typeof window !== 'undefined') {
|
47783 | return window;
|
47784 | }
|
47785 | return undefined;
|
47786 | },
|
47787 | enumerable: true,
|
47788 | configurable: true
|
47789 | });
|
47790 | Object.defineProperty(OptionsReader.prototype, "document", {
|
47791 | get: function () {
|
47792 | if (this.window) {
|
47793 | return this.window.document;
|
47794 | }
|
47795 | return undefined;
|
47796 | },
|
47797 | enumerable: true,
|
47798 | configurable: true
|
47799 | });
|
47800 | return OptionsReader;
|
47801 | }());
|
47802 | exports.OptionsReader = OptionsReader;
|
47803 | });
|
47804 |
|
47805 | unwrapExports(OptionsReader_1);
|
47806 | var OptionsReader_2 = OptionsReader_1.OptionsReader;
|
47807 |
|
47808 | var HTML5Backend_1 = createCommonjsModule(function (module, exports) {
|
47809 | var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
|
47810 | __assign = Object.assign || function(t) {
|
47811 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
47812 | s = arguments[i];
|
47813 | for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
47814 | t[p] = s[p];
|
47815 | }
|
47816 | return t;
|
47817 | };
|
47818 | return __assign.apply(this, arguments);
|
47819 | };
|
47820 | var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
47821 | return (mod && mod.__esModule) ? mod : { "default": mod };
|
47822 | };
|
47823 | var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
|
47824 | if (mod && mod.__esModule) return mod;
|
47825 | var result = {};
|
47826 | if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
47827 | result["default"] = mod;
|
47828 | return result;
|
47829 | };
|
47830 | Object.defineProperty(exports, "__esModule", { value: true });
|
47831 | var EnterLeaveCounter_1$$1 = __importDefault(EnterLeaveCounter_1);
|
47832 |
|
47833 |
|
47834 |
|
47835 | var NativeTypes$$1 = __importStar(NativeTypes);
|
47836 |
|
47837 | var HTML5Backend = /** @class */ (function () {
|
47838 | function HTML5Backend(manager, globalContext) {
|
47839 | var _this = this;
|
47840 | this.sourcePreviewNodes = new Map();
|
47841 | this.sourcePreviewNodeOptions = new Map();
|
47842 | this.sourceNodes = new Map();
|
47843 | this.sourceNodeOptions = new Map();
|
47844 | this.dragStartSourceIds = null;
|
47845 | this.dropTargetIds = [];
|
47846 | this.dragEnterTargetIds = [];
|
47847 | this.currentNativeSource = null;
|
47848 | this.currentNativeHandle = null;
|
47849 | this.currentDragSourceNode = null;
|
47850 | this.altKeyPressed = false;
|
47851 | this.mouseMoveTimeoutTimer = null;
|
47852 | this.asyncEndDragFrameId = null;
|
47853 | this.dragOverTargetIds = null;
|
47854 | this.getSourceClientOffset = function (sourceId) {
|
47855 | return OffsetUtils.getNodeClientOffset(_this.sourceNodes.get(sourceId));
|
47856 | };
|
47857 | this.endDragNativeItem = function () {
|
47858 | if (!_this.isDraggingNativeItem()) {
|
47859 | return;
|
47860 | }
|
47861 | _this.actions.endDrag();
|
47862 | _this.registry.removeSource(_this.currentNativeHandle);
|
47863 | _this.currentNativeHandle = null;
|
47864 | _this.currentNativeSource = null;
|
47865 | };
|
47866 | this.isNodeInDocument = function (node) {
|
47867 | // Check the node either in the main document or in the current context
|
47868 | return _this.document && _this.document.body && document.body.contains(node);
|
47869 | };
|
47870 | this.endDragIfSourceWasRemovedFromDOM = function () {
|
47871 | var node = _this.currentDragSourceNode;
|
47872 | if (_this.isNodeInDocument(node)) {
|
47873 | return;
|
47874 | }
|
47875 | if (_this.clearCurrentDragSourceNode()) {
|
47876 | _this.actions.endDrag();
|
47877 | }
|
47878 | };
|
47879 | this.handleTopDragStartCapture = function () {
|
47880 | _this.clearCurrentDragSourceNode();
|
47881 | _this.dragStartSourceIds = [];
|
47882 | };
|
47883 | this.handleTopDragStart = function (e) {
|
47884 | if (e.defaultPrevented) {
|
47885 | return;
|
47886 | }
|
47887 | var dragStartSourceIds = _this.dragStartSourceIds;
|
47888 | _this.dragStartSourceIds = null;
|
47889 | var clientOffset = OffsetUtils.getEventClientOffset(e);
|
47890 | // Avoid crashing if we missed a drop event or our previous drag died
|
47891 | if (_this.monitor.isDragging()) {
|
47892 | _this.actions.endDrag();
|
47893 | }
|
47894 | // Don't publish the source just yet (see why below)
|
47895 | _this.actions.beginDrag(dragStartSourceIds || [], {
|
47896 | publishSource: false,
|
47897 | getSourceClientOffset: _this.getSourceClientOffset,
|
47898 | clientOffset: clientOffset,
|
47899 | });
|
47900 | var dataTransfer = e.dataTransfer;
|
47901 | var nativeType = NativeDragSources.matchNativeItemType(dataTransfer);
|
47902 | if (_this.monitor.isDragging()) {
|
47903 | if (dataTransfer && typeof dataTransfer.setDragImage === 'function') {
|
47904 | // Use custom drag image if user specifies it.
|
47905 | // If child drag source refuses drag but parent agrees,
|
47906 | // use parent's node as drag image. Neither works in IE though.
|
47907 | var sourceId = _this.monitor.getSourceId();
|
47908 | var sourceNode = _this.sourceNodes.get(sourceId);
|
47909 | var dragPreview = _this.sourcePreviewNodes.get(sourceId) || sourceNode;
|
47910 | if (dragPreview) {
|
47911 | var _a = _this.getCurrentSourcePreviewNodeOptions(), anchorX = _a.anchorX, anchorY = _a.anchorY, offsetX = _a.offsetX, offsetY = _a.offsetY;
|
47912 | var anchorPoint = { anchorX: anchorX, anchorY: anchorY };
|
47913 | var offsetPoint = { offsetX: offsetX, offsetY: offsetY };
|
47914 | var dragPreviewOffset = OffsetUtils.getDragPreviewOffset(sourceNode, dragPreview, clientOffset, anchorPoint, offsetPoint);
|
47915 | dataTransfer.setDragImage(dragPreview, dragPreviewOffset.x, dragPreviewOffset.y);
|
47916 | }
|
47917 | }
|
47918 | try {
|
47919 | // Firefox won't drag without setting data
|
47920 | dataTransfer.setData('application/json', {});
|
47921 | }
|
47922 | catch (err) {
|
47923 | // IE doesn't support MIME types in setData
|
47924 | }
|
47925 | // Store drag source node so we can check whether
|
47926 | // it is removed from DOM and trigger endDrag manually.
|
47927 | _this.setCurrentDragSourceNode(e.target);
|
47928 | // Now we are ready to publish the drag source.. or are we not?
|
47929 | var captureDraggingState = _this.getCurrentSourcePreviewNodeOptions().captureDraggingState;
|
47930 | if (!captureDraggingState) {
|
47931 | // Usually we want to publish it in the next tick so that browser
|
47932 | // is able to screenshot the current (not yet dragging) state.
|
47933 | //
|
47934 | // It also neatly avoids a situation where render() returns null
|
47935 | // in the same tick for the source element, and browser freaks out.
|
47936 | setTimeout(function () { return _this.actions.publishDragSource(); }, 0);
|
47937 | }
|
47938 | else {
|
47939 | // In some cases the user may want to override this behavior, e.g.
|
47940 | // to work around IE not supporting custom drag previews.
|
47941 | //
|
47942 | // When using a custom drag layer, the only way to prevent
|
47943 | // the default drag preview from drawing in IE is to screenshot
|
47944 | // the dragging state in which the node itself has zero opacity
|
47945 | // and height. In this case, though, returning null from render()
|
47946 | // will abruptly end the dragging, which is not obvious.
|
47947 | //
|
47948 | // This is the reason such behavior is strictly opt-in.
|
47949 | _this.actions.publishDragSource();
|
47950 | }
|
47951 | }
|
47952 | else if (nativeType) {
|
47953 | // A native item (such as URL) dragged from inside the document
|
47954 | _this.beginDragNativeItem(nativeType);
|
47955 | }
|
47956 | else if (dataTransfer &&
|
47957 | !dataTransfer.types &&
|
47958 | ((e.target && !e.target.hasAttribute) ||
|
47959 | !e.target.hasAttribute('draggable'))) {
|
47960 | // Looks like a Safari bug: dataTransfer.types is null, but there was no draggable.
|
47961 | // Just let it drag. It's a native type (URL or text) and will be picked up in
|
47962 | // dragenter handler.
|
47963 | return;
|
47964 | }
|
47965 | else {
|
47966 | // If by this time no drag source reacted, tell browser not to drag.
|
47967 | e.preventDefault();
|
47968 | }
|
47969 | };
|
47970 | this.handleTopDragEndCapture = function () {
|
47971 | if (_this.clearCurrentDragSourceNode()) {
|
47972 | // Firefox can dispatch this event in an infinite loop
|
47973 | // if dragend handler does something like showing an alert.
|
47974 | // Only proceed if we have not handled it already.
|
47975 | _this.actions.endDrag();
|
47976 | }
|
47977 | };
|
47978 | this.handleTopDragEnterCapture = function (e) {
|
47979 | _this.dragEnterTargetIds = [];
|
47980 | var isFirstEnter = _this.enterLeaveCounter.enter(e.target);
|
47981 | if (!isFirstEnter || _this.monitor.isDragging()) {
|
47982 | return;
|
47983 | }
|
47984 | var dataTransfer = e.dataTransfer;
|
47985 | var nativeType = NativeDragSources.matchNativeItemType(dataTransfer);
|
47986 | if (nativeType) {
|
47987 | // A native item (such as file or URL) dragged from outside the document
|
47988 | _this.beginDragNativeItem(nativeType);
|
47989 | }
|
47990 | };
|
47991 | this.handleTopDragEnter = function (e) {
|
47992 | var dragEnterTargetIds = _this.dragEnterTargetIds;
|
47993 | _this.dragEnterTargetIds = [];
|
47994 | if (!_this.monitor.isDragging()) {
|
47995 | // This is probably a native item type we don't understand.
|
47996 | return;
|
47997 | }
|
47998 | _this.altKeyPressed = e.altKey;
|
47999 | if (!BrowserDetector.isFirefox()) {
|
48000 | // Don't emit hover in `dragenter` on Firefox due to an edge case.
|
48001 | // If the target changes position as the result of `dragenter`, Firefox
|
48002 | // will still happily dispatch `dragover` despite target being no longer
|
48003 | // there. The easy solution is to only fire `hover` in `dragover` on FF.
|
48004 | _this.actions.hover(dragEnterTargetIds, {
|
48005 | clientOffset: OffsetUtils.getEventClientOffset(e),
|
48006 | });
|
48007 | }
|
48008 | var canDrop = dragEnterTargetIds.some(function (targetId) {
|
48009 | return _this.monitor.canDropOnTarget(targetId);
|
48010 | });
|
48011 | if (canDrop) {
|
48012 | // IE requires this to fire dragover events
|
48013 | e.preventDefault();
|
48014 | if (e.dataTransfer) {
|
48015 | e.dataTransfer.dropEffect = _this.getCurrentDropEffect();
|
48016 | }
|
48017 | }
|
48018 | };
|
48019 | this.handleTopDragOverCapture = function () {
|
48020 | _this.dragOverTargetIds = [];
|
48021 | };
|
48022 | this.handleTopDragOver = function (e) {
|
48023 | var dragOverTargetIds = _this.dragOverTargetIds;
|
48024 | _this.dragOverTargetIds = [];
|
48025 | if (!_this.monitor.isDragging()) {
|
48026 | // This is probably a native item type we don't understand.
|
48027 | // Prevent default "drop and blow away the whole document" action.
|
48028 | e.preventDefault();
|
48029 | if (e.dataTransfer) {
|
48030 | e.dataTransfer.dropEffect = 'none';
|
48031 | }
|
48032 | return;
|
48033 | }
|
48034 | _this.altKeyPressed = e.altKey;
|
48035 | _this.actions.hover(dragOverTargetIds || [], {
|
48036 | clientOffset: OffsetUtils.getEventClientOffset(e),
|
48037 | });
|
48038 | var canDrop = (dragOverTargetIds || []).some(function (targetId) {
|
48039 | return _this.monitor.canDropOnTarget(targetId);
|
48040 | });
|
48041 | if (canDrop) {
|
48042 | // Show user-specified drop effect.
|
48043 | e.preventDefault();
|
48044 | if (e.dataTransfer) {
|
48045 | e.dataTransfer.dropEffect = _this.getCurrentDropEffect();
|
48046 | }
|
48047 | }
|
48048 | else if (_this.isDraggingNativeItem()) {
|
48049 | // Don't show a nice cursor but still prevent default
|
48050 | // "drop and blow away the whole document" action.
|
48051 | e.preventDefault();
|
48052 | }
|
48053 | else {
|
48054 | e.preventDefault();
|
48055 | if (e.dataTransfer) {
|
48056 | e.dataTransfer.dropEffect = 'none';
|
48057 | }
|
48058 | }
|
48059 | };
|
48060 | this.handleTopDragLeaveCapture = function (e) {
|
48061 | if (_this.isDraggingNativeItem()) {
|
48062 | e.preventDefault();
|
48063 | }
|
48064 | var isLastLeave = _this.enterLeaveCounter.leave(e.target);
|
48065 | if (!isLastLeave) {
|
48066 | return;
|
48067 | }
|
48068 | if (_this.isDraggingNativeItem()) {
|
48069 | _this.endDragNativeItem();
|
48070 | }
|
48071 | };
|
48072 | this.handleTopDropCapture = function (e) {
|
48073 | _this.dropTargetIds = [];
|
48074 | e.preventDefault();
|
48075 | if (_this.isDraggingNativeItem()) {
|
48076 | _this.currentNativeSource.mutateItemByReadingDataTransfer(e.dataTransfer);
|
48077 | }
|
48078 | _this.enterLeaveCounter.reset();
|
48079 | };
|
48080 | this.handleTopDrop = function (e) {
|
48081 | var dropTargetIds = _this.dropTargetIds;
|
48082 | _this.dropTargetIds = [];
|
48083 | _this.actions.hover(dropTargetIds, {
|
48084 | clientOffset: OffsetUtils.getEventClientOffset(e),
|
48085 | });
|
48086 | _this.actions.drop({ dropEffect: _this.getCurrentDropEffect() });
|
48087 | if (_this.isDraggingNativeItem()) {
|
48088 | _this.endDragNativeItem();
|
48089 | }
|
48090 | else {
|
48091 | _this.endDragIfSourceWasRemovedFromDOM();
|
48092 | }
|
48093 | };
|
48094 | this.handleSelectStart = function (e) {
|
48095 | var target = e.target;
|
48096 | // Only IE requires us to explicitly say
|
48097 | // we want drag drop operation to start
|
48098 | if (typeof target.dragDrop !== 'function') {
|
48099 | return;
|
48100 | }
|
48101 | // Inputs and textareas should be selectable
|
48102 | if (target.tagName === 'INPUT' ||
|
48103 | target.tagName === 'SELECT' ||
|
48104 | target.tagName === 'TEXTAREA' ||
|
48105 | target.isContentEditable) {
|
48106 | return;
|
48107 | }
|
48108 | // For other targets, ask IE
|
48109 | // to enable drag and drop
|
48110 | e.preventDefault();
|
48111 | target.dragDrop();
|
48112 | };
|
48113 | this.options = new OptionsReader_1.OptionsReader(globalContext);
|
48114 | this.actions = manager.getActions();
|
48115 | this.monitor = manager.getMonitor();
|
48116 | this.registry = manager.getRegistry();
|
48117 | this.enterLeaveCounter = new EnterLeaveCounter_1$$1.default(this.isNodeInDocument);
|
48118 | }
|
48119 | Object.defineProperty(HTML5Backend.prototype, "window", {
|
48120 | // public for test
|
48121 | get: function () {
|
48122 | return this.options.window;
|
48123 | },
|
48124 | enumerable: true,
|
48125 | configurable: true
|
48126 | });
|
48127 | Object.defineProperty(HTML5Backend.prototype, "document", {
|
48128 | get: function () {
|
48129 | return this.options.document;
|
48130 | },
|
48131 | enumerable: true,
|
48132 | configurable: true
|
48133 | });
|
48134 | HTML5Backend.prototype.setup = function () {
|
48135 | if (this.window === undefined) {
|
48136 | return;
|
48137 | }
|
48138 | if (this.window.__isReactDndBackendSetUp) {
|
48139 | throw new Error('Cannot have two HTML5 backends at the same time.');
|
48140 | }
|
48141 | this.window.__isReactDndBackendSetUp = true;
|
48142 | this.addEventListeners(this.window);
|
48143 | };
|
48144 | HTML5Backend.prototype.teardown = function () {
|
48145 | if (this.window === undefined) {
|
48146 | return;
|
48147 | }
|
48148 | this.window.__isReactDndBackendSetUp = false;
|
48149 | this.removeEventListeners(this.window);
|
48150 | this.clearCurrentDragSourceNode();
|
48151 | if (this.asyncEndDragFrameId) {
|
48152 | this.window.cancelAnimationFrame(this.asyncEndDragFrameId);
|
48153 | }
|
48154 | };
|
48155 | HTML5Backend.prototype.connectDragPreview = function (sourceId, node, options) {
|
48156 | var _this = this;
|
48157 | this.sourcePreviewNodeOptions.set(sourceId, options);
|
48158 | this.sourcePreviewNodes.set(sourceId, node);
|
48159 | return function () {
|
48160 | _this.sourcePreviewNodes.delete(sourceId);
|
48161 | _this.sourcePreviewNodeOptions.delete(sourceId);
|
48162 | };
|
48163 | };
|
48164 | HTML5Backend.prototype.connectDragSource = function (sourceId, node, options) {
|
48165 | var _this = this;
|
48166 | this.sourceNodes.set(sourceId, node);
|
48167 | this.sourceNodeOptions.set(sourceId, options);
|
48168 | var handleDragStart = function (e) { return _this.handleDragStart(e, sourceId); };
|
48169 | var handleSelectStart = function (e) { return _this.handleSelectStart(e); };
|
48170 | node.setAttribute('draggable', 'true');
|
48171 | node.addEventListener('dragstart', handleDragStart);
|
48172 | node.addEventListener('selectstart', handleSelectStart);
|
48173 | return function () {
|
48174 | _this.sourceNodes.delete(sourceId);
|
48175 | _this.sourceNodeOptions.delete(sourceId);
|
48176 | node.removeEventListener('dragstart', handleDragStart);
|
48177 | node.removeEventListener('selectstart', handleSelectStart);
|
48178 | node.setAttribute('draggable', 'false');
|
48179 | };
|
48180 | };
|
48181 | HTML5Backend.prototype.connectDropTarget = function (targetId, node) {
|
48182 | var _this = this;
|
48183 | var handleDragEnter = function (e) { return _this.handleDragEnter(e, targetId); };
|
48184 | var handleDragOver = function (e) { return _this.handleDragOver(e, targetId); };
|
48185 | var handleDrop = function (e) { return _this.handleDrop(e, targetId); };
|
48186 | node.addEventListener('dragenter', handleDragEnter);
|
48187 | node.addEventListener('dragover', handleDragOver);
|
48188 | node.addEventListener('drop', handleDrop);
|
48189 | return function () {
|
48190 | node.removeEventListener('dragenter', handleDragEnter);
|
48191 | node.removeEventListener('dragover', handleDragOver);
|
48192 | node.removeEventListener('drop', handleDrop);
|
48193 | };
|
48194 | };
|
48195 | HTML5Backend.prototype.addEventListeners = function (target) {
|
48196 | // SSR Fix (https://github.com/react-dnd/react-dnd/pull/813
|
48197 | if (!target.addEventListener) {
|
48198 | return;
|
48199 | }
|
48200 | target.addEventListener('dragstart', this
|
48201 | .handleTopDragStart);
|
48202 | target.addEventListener('dragstart', this.handleTopDragStartCapture, true);
|
48203 | target.addEventListener('dragend', this.handleTopDragEndCapture, true);
|
48204 | target.addEventListener('dragenter', this
|
48205 | .handleTopDragEnter);
|
48206 | target.addEventListener('dragenter', this.handleTopDragEnterCapture, true);
|
48207 | target.addEventListener('dragleave', this.handleTopDragLeaveCapture, true);
|
48208 | target.addEventListener('dragover', this.handleTopDragOver);
|
48209 | target.addEventListener('dragover', this.handleTopDragOverCapture, true);
|
48210 | target.addEventListener('drop', this.handleTopDrop);
|
48211 | target.addEventListener('drop', this.handleTopDropCapture, true);
|
48212 | };
|
48213 | HTML5Backend.prototype.removeEventListeners = function (target) {
|
48214 | // SSR Fix (https://github.com/react-dnd/react-dnd/pull/813
|
48215 | if (!target.removeEventListener) {
|
48216 | return;
|
48217 | }
|
48218 | target.removeEventListener('dragstart', this.handleTopDragStart);
|
48219 | target.removeEventListener('dragstart', this.handleTopDragStartCapture, true);
|
48220 | target.removeEventListener('dragend', this.handleTopDragEndCapture, true);
|
48221 | target.removeEventListener('dragenter', this
|
48222 | .handleTopDragEnter);
|
48223 | target.removeEventListener('dragenter', this.handleTopDragEnterCapture, true);
|
48224 | target.removeEventListener('dragleave', this.handleTopDragLeaveCapture, true);
|
48225 | target.removeEventListener('dragover', this
|
48226 | .handleTopDragOver);
|
48227 | target.removeEventListener('dragover', this.handleTopDragOverCapture, true);
|
48228 | target.removeEventListener('drop', this.handleTopDrop);
|
48229 | target.removeEventListener('drop', this.handleTopDropCapture, true);
|
48230 | };
|
48231 | HTML5Backend.prototype.getCurrentSourceNodeOptions = function () {
|
48232 | var sourceId = this.monitor.getSourceId();
|
48233 | var sourceNodeOptions = this.sourceNodeOptions.get(sourceId);
|
48234 | return __assign({ dropEffect: this.altKeyPressed ? 'copy' : 'move' }, (sourceNodeOptions || {}));
|
48235 | };
|
48236 | HTML5Backend.prototype.getCurrentDropEffect = function () {
|
48237 | if (this.isDraggingNativeItem()) {
|
48238 | // It makes more sense to default to 'copy' for native resources
|
48239 | return 'copy';
|
48240 | }
|
48241 | return this.getCurrentSourceNodeOptions().dropEffect;
|
48242 | };
|
48243 | HTML5Backend.prototype.getCurrentSourcePreviewNodeOptions = function () {
|
48244 | var sourceId = this.monitor.getSourceId();
|
48245 | var sourcePreviewNodeOptions = this.sourcePreviewNodeOptions.get(sourceId);
|
48246 | return __assign({ anchorX: 0.5, anchorY: 0.5, captureDraggingState: false }, (sourcePreviewNodeOptions || {}));
|
48247 | };
|
48248 | HTML5Backend.prototype.isDraggingNativeItem = function () {
|
48249 | var itemType = this.monitor.getItemType();
|
48250 | return Object.keys(NativeTypes$$1).some(function (key) { return NativeTypes$$1[key] === itemType; });
|
48251 | };
|
48252 | HTML5Backend.prototype.beginDragNativeItem = function (type) {
|
48253 | this.clearCurrentDragSourceNode();
|
48254 | this.currentNativeSource = NativeDragSources.createNativeDragSource(type);
|
48255 | this.currentNativeHandle = this.registry.addSource(type, this.currentNativeSource);
|
48256 | this.actions.beginDrag([this.currentNativeHandle]);
|
48257 | };
|
48258 | HTML5Backend.prototype.setCurrentDragSourceNode = function (node) {
|
48259 | var _this = this;
|
48260 | this.clearCurrentDragSourceNode();
|
48261 | this.currentDragSourceNode = node;
|
48262 | // A timeout of > 0 is necessary to resolve Firefox issue referenced
|
48263 | // See:
|
48264 | // * https://github.com/react-dnd/react-dnd/pull/928
|
48265 | // * https://github.com/react-dnd/react-dnd/issues/869
|
48266 | var MOUSE_MOVE_TIMEOUT = 1000;
|
48267 | // Receiving a mouse event in the middle of a dragging operation
|
48268 | // means it has ended and the drag source node disappeared from DOM,
|
48269 | // so the browser didn't dispatch the dragend event.
|
48270 | //
|
48271 | // We need to wait before we start listening for mousemove events.
|
48272 | // This is needed because the drag preview needs to be drawn or else it fires an 'mousemove' event
|
48273 | // immediately in some browsers.
|
48274 | //
|
48275 | // See:
|
48276 | // * https://github.com/react-dnd/react-dnd/pull/928
|
48277 | // * https://github.com/react-dnd/react-dnd/issues/869
|
48278 | //
|
48279 | this.mouseMoveTimeoutTimer = setTimeout(function () {
|
48280 | return (_this.window &&
|
48281 | _this.window.addEventListener('mousemove', _this.endDragIfSourceWasRemovedFromDOM, true));
|
48282 | }, MOUSE_MOVE_TIMEOUT);
|
48283 | };
|
48284 | HTML5Backend.prototype.clearCurrentDragSourceNode = function () {
|
48285 | if (this.currentDragSourceNode) {
|
48286 | this.currentDragSourceNode = null;
|
48287 | if (this.window) {
|
48288 | this.window.clearTimeout(this.mouseMoveTimeoutTimer || undefined);
|
48289 | this.window.removeEventListener('mousemove', this.endDragIfSourceWasRemovedFromDOM, true);
|
48290 | }
|
48291 | this.mouseMoveTimeoutTimer = null;
|
48292 | return true;
|
48293 | }
|
48294 | return false;
|
48295 | };
|
48296 | HTML5Backend.prototype.handleDragStart = function (e, sourceId) {
|
48297 | if (e.defaultPrevented) {
|
48298 | return;
|
48299 | }
|
48300 | if (!this.dragStartSourceIds) {
|
48301 | this.dragStartSourceIds = [];
|
48302 | }
|
48303 | this.dragStartSourceIds.unshift(sourceId);
|
48304 | };
|
48305 | HTML5Backend.prototype.handleDragEnter = function (e, targetId) {
|
48306 | this.dragEnterTargetIds.unshift(targetId);
|
48307 | };
|
48308 | HTML5Backend.prototype.handleDragOver = function (e, targetId) {
|
48309 | if (this.dragOverTargetIds === null) {
|
48310 | this.dragOverTargetIds = [];
|
48311 | }
|
48312 | this.dragOverTargetIds.unshift(targetId);
|
48313 | };
|
48314 | HTML5Backend.prototype.handleDrop = function (e, targetId) {
|
48315 | this.dropTargetIds.unshift(targetId);
|
48316 | };
|
48317 | return HTML5Backend;
|
48318 | }());
|
48319 | exports.default = HTML5Backend;
|
48320 | });
|
48321 |
|
48322 | unwrapExports(HTML5Backend_1);
|
48323 |
|
48324 | var getEmptyImage_1 = createCommonjsModule(function (module, exports) {
|
48325 | Object.defineProperty(exports, "__esModule", { value: true });
|
48326 | var emptyImage;
|
48327 | function getEmptyImage() {
|
48328 | if (!emptyImage) {
|
48329 | emptyImage = new Image();
|
48330 | emptyImage.src =
|
48331 | 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
|
48332 | }
|
48333 | return emptyImage;
|
48334 | }
|
48335 | exports.getEmptyImage = getEmptyImage;
|
48336 | });
|
48337 |
|
48338 | unwrapExports(getEmptyImage_1);
|
48339 | var getEmptyImage_2 = getEmptyImage_1.getEmptyImage;
|
48340 |
|
48341 | var lib$2 = createCommonjsModule(function (module, exports) {
|
48342 | var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
48343 | return (mod && mod.__esModule) ? mod : { "default": mod };
|
48344 | };
|
48345 | var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
|
48346 | if (mod && mod.__esModule) return mod;
|
48347 | var result = {};
|
48348 | if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
48349 | result["default"] = mod;
|
48350 | return result;
|
48351 | };
|
48352 | Object.defineProperty(exports, "__esModule", { value: true });
|
48353 | var HTML5Backend_1$$1 = __importDefault(HTML5Backend_1);
|
48354 | var NativeTypes$$1 = __importStar(NativeTypes);
|
48355 | exports.NativeTypes = NativeTypes$$1;
|
48356 |
|
48357 | exports.getEmptyImage = getEmptyImage_1.getEmptyImage;
|
48358 | var createHTML5Backend = function (manager, context) { return new HTML5Backend_1$$1.default(manager, context); };
|
48359 | exports.default = createHTML5Backend;
|
48360 | });
|
48361 |
|
48362 | var HTML5Backend$1 = unwrapExports(lib$2);
|
48363 | var lib_1$1 = lib$2.NativeTypes;
|
48364 | var lib_2$1 = lib$2.getEmptyImage;
|
48365 |
|
48366 | var DndHTML5Provider = function DndHTML5Provider(_ref) {
|
48367 | var children = _ref.children;
|
48368 | return React.createElement(DndProvider_1, {
|
48369 | backend: HTML5Backend$1
|
48370 | }, children);
|
48371 | };
|
48372 |
|
48373 | DndHTML5Provider.defaultProps = {
|
48374 | children: null
|
48375 | };
|
48376 | DndHTML5Provider.propTypes = {
|
48377 | children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node])
|
48378 | };
|
48379 |
|
48380 | var _ref$3 =
|
48381 | /*#__PURE__*/
|
48382 | React.createElement("g", {
|
48383 | clipPath: "url(#clip0)"
|
48384 | }, React.createElement("path", {
|
48385 | d: "M29.83 121.665L96.144 160V83.33L29.829 44.991v76.673z",
|
48386 | fill: "url(#paint0_linear)"
|
48387 | }), React.createElement("path", {
|
48388 | d: "M96.144 83.33l66.31-38.338-66.31-38.339V83.33z",
|
48389 | fill: "#1A00BB"
|
48390 | }), React.createElement("path", {
|
48391 | d: "M29.83 44.992l66.315 38.337V6.653L29.829 44.992z",
|
48392 | fill: "#0B009A"
|
48393 | }), React.createElement("path", {
|
48394 | d: "M162.454 121.665L96.144 160V83.33l66.31-38.338v76.673z",
|
48395 | fill: "url(#paint1_linear)"
|
48396 | }), React.createElement("path", {
|
48397 | d: "M64.15 111.361L0 70.586l29.84-25.59 66.305 38.33L64.15 111.36zM129.299 0l64.075 38.08-30.933 6.912L96.144 6.659 129.3 0zM67.12 0L.15 38.08l29.69 6.916L96.144 6.665 67.12 0zM128.648 111.361l64.577-40.775-30.784-25.594L96.144 83.32l32.504 28.04z",
|
48398 | fill: "#DDD"
|
48399 | }), React.createElement("mask", {
|
48400 | id: "a",
|
48401 | maskUnits: "userSpaceOnUse",
|
48402 | x: 96,
|
48403 | y: 6,
|
48404 | width: 67,
|
48405 | height: 78
|
48406 | }, React.createElement("path", {
|
48407 | d: "M96.144 83.303l66.31-38.336-66.31-38.336v76.672z",
|
48408 | fill: "url(#paint2_linear)"
|
48409 | })), React.createElement("g", {
|
48410 | mask: "url(#a)"
|
48411 | }, React.createElement("path", {
|
48412 | d: "M96.144 83.303l66.31-38.336-66.31-38.336v76.672z",
|
48413 | fill: "#0C00A9"
|
48414 | })), React.createElement("path", {
|
48415 | d: "M113.812 73.113L96.144 83.329V6.608l17.668 66.506z",
|
48416 | fill: "#14008C"
|
48417 | }));
|
48418 |
|
48419 | var _ref2$2 =
|
48420 | /*#__PURE__*/
|
48421 | React.createElement("defs", null, React.createElement("linearGradient", {
|
48422 | id: "paint0_linear",
|
48423 | x1: 80.904,
|
48424 | y1: 90.909,
|
48425 | x2: 34.389,
|
48426 | y2: 120.908,
|
48427 | gradientUnits: "userSpaceOnUse"
|
48428 | }, React.createElement("stop", {
|
48429 | offset: 0,
|
48430 | stopColor: "#0D0CB5"
|
48431 | }), React.createElement("stop", {
|
48432 | offset: 0.996,
|
48433 | stopColor: "#005BEA"
|
48434 | })), React.createElement("linearGradient", {
|
48435 | id: "paint1_linear",
|
48436 | x1: 129.3,
|
48437 | y1: 83.82,
|
48438 | x2: 129.3,
|
48439 | y2: 171.142,
|
48440 | gradientUnits: "userSpaceOnUse"
|
48441 | }, React.createElement("stop", {
|
48442 | offset: 0,
|
48443 | stopColor: "#0D0CB5"
|
48444 | }), React.createElement("stop", {
|
48445 | offset: 0.996,
|
48446 | stopColor: "#005BEA"
|
48447 | })), React.createElement("linearGradient", {
|
48448 | id: "paint2_linear",
|
48449 | x1: 54.966,
|
48450 | y1: 115.656,
|
48451 | x2: 129.024,
|
48452 | y2: 26.37,
|
48453 | gradientUnits: "userSpaceOnUse"
|
48454 | }, React.createElement("stop", {
|
48455 | stopColor: "#fff"
|
48456 | }), React.createElement("stop", {
|
48457 | offset: 1
|
48458 | })), React.createElement("clipPath", {
|
48459 | id: "clip0"
|
48460 | }, React.createElement("path", {
|
48461 | fill: "#fff",
|
48462 | d: "M0 0h193.374v160H0z"
|
48463 | })));
|
48464 |
|
48465 | var boxImage = 'data:image/svg+xml,%3Csvg%20width%3D%22194%22%20height%3D%22160%22%20viewBox%3D%220%200%20194%20160%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%20%20%3Cg%20clip-path%3D%22url%28%23clip0%29%22%3E%20%20%3Cpath%20d%3D%22M29.8291%20121.665L96.1446%20160V83.3294L29.8291%2044.9919V121.665Z%22%20fill%3D%22url%28%23paint0_linear%29%22%2F%3E%20%20%3Cpath%20d%3D%22M96.1445%2083.3294L162.454%2044.992L96.1445%206.65308V83.3294Z%22%20fill%3D%22%231A00BB%22%2F%3E%20%20%3Cpath%20d%3D%22M29.8291%2044.992L96.1446%2083.3294V6.65308L29.8291%2044.992Z%22%20fill%3D%22%230B009A%22%2F%3E%20%20%3Cpath%20d%3D%22M162.454%20121.665L96.1445%20160V83.3294L162.454%2044.9919V121.665Z%22%20fill%3D%22url%28%23paint1_linear%29%22%2F%3E%20%20%3Cpath%20d%3D%22M64.1496%20111.361L0%2070.5862L29.8407%2044.9963L96.1446%2083.3251L64.1496%20111.361Z%22%20fill%3D%22%23DDDDDD%22%2F%3E%20%20%3Cpath%20d%3D%22M129.299%200L193.374%2038.08L162.441%2044.992L96.1445%206.65891L129.299%200Z%22%20fill%3D%22%23DDDDDD%22%2F%3E%20%20%3Cpath%20d%3D%22M67.12%200L0.150879%2038.08L29.8405%2044.9964L96.1444%206.66473L67.12%200Z%22%20fill%3D%22%23DDDDDD%22%2F%3E%20%20%3Cpath%20d%3D%22M128.648%20111.361L193.225%2070.5861L162.441%2044.9919L96.1445%2083.3207L128.648%20111.361Z%22%20fill%3D%22%23DDDDDD%22%2F%3E%20%20%3Cmask%20id%3D%22mask0%22%20mask-type%3D%22alpha%22%20maskUnits%3D%22userSpaceOnUse%22%20x%3D%2296%22%20y%3D%226%22%20width%3D%2267%22%20height%3D%2278%22%3E%20%20%3Cpath%20d%3D%22M96.1445%2083.3034L162.454%2044.9674L96.1445%206.63135V83.3034Z%22%20fill%3D%22url%28%23paint2_linear%29%22%2F%3E%20%20%3C%2Fmask%3E%20%20%3Cg%20mask%3D%22url%28%23mask0%29%22%3E%20%20%3Cpath%20d%3D%22M96.1445%2083.3034L162.454%2044.9674L96.1445%206.63135V83.3034Z%22%20fill%3D%22%230C00A9%22%2F%3E%20%20%3C%2Fg%3E%20%20%3Cpath%20d%3D%22M113.812%2073.1127L96.1445%2083.3295V6.60657L113.812%2073.1127Z%22%20fill%3D%22%2314008C%22%2F%3E%20%20%3C%2Fg%3E%20%20%3Cdefs%3E%20%20%3ClinearGradient%20id%3D%22paint0_linear%22%20x1%3D%2280.9043%22%20y1%3D%2290.909%22%20x2%3D%2234.3888%22%20y2%3D%22120.908%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%20%20%3Cstop%20offset%3D%220.00027743%22%20stop-color%3D%22%230D0CB5%22%2F%3E%20%20%3Cstop%20offset%3D%220.9964%22%20stop-color%3D%22%23005BEA%22%2F%3E%20%20%3C%2FlinearGradient%3E%20%20%3ClinearGradient%20id%3D%22paint1_linear%22%20x1%3D%22129.3%22%20y1%3D%2283.8196%22%20x2%3D%22129.3%22%20y2%3D%22171.142%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%20%20%3Cstop%20offset%3D%220.00027743%22%20stop-color%3D%22%230D0CB5%22%2F%3E%20%20%3Cstop%20offset%3D%220.9964%22%20stop-color%3D%22%23005BEA%22%2F%3E%20%20%3C%2FlinearGradient%3E%20%20%3ClinearGradient%20id%3D%22paint2_linear%22%20x1%3D%2254.966%22%20y1%3D%22115.656%22%20x2%3D%22129.024%22%20y2%3D%2226.3697%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%20%20%3Cstop%20stop-color%3D%22white%22%2F%3E%20%20%3Cstop%20offset%3D%221%22%2F%3E%20%20%3C%2FlinearGradient%3E%20%20%3CclipPath%20id%3D%22clip0%22%3E%20%20%3Crect%20width%3D%22193.374%22%20height%3D%22160%22%20fill%3D%22white%22%2F%3E%20%20%3C%2FclipPath%3E%20%20%3C%2Fdefs%3E%3C%2Fsvg%3E';
|
48466 |
|
48467 | function _templateObject4$g() {
|
48468 | var data = taggedTemplateLiteralLoose(["\n\tmax-width: 350px;\n\tmargin: 16px 0 20px 0;\n\tcolor: ", ";\n\tfont-size: 13px;\n\ttext-align: center;\n"]);
|
48469 |
|
48470 | _templateObject4$g = function _templateObject4() {
|
48471 | return data;
|
48472 | };
|
48473 |
|
48474 | return data;
|
48475 | }
|
48476 |
|
48477 | function _templateObject3$l() {
|
48478 | var data = taggedTemplateLiteralLoose(["\n\tcolor: ", ";\n\tfont-size: 18px;\n\tfont-weight: bold;\n\ttext-align: center;\n"]);
|
48479 |
|
48480 | _templateObject3$l = function _templateObject3() {
|
48481 | return data;
|
48482 | };
|
48483 |
|
48484 | return data;
|
48485 | }
|
48486 |
|
48487 | function _templateObject2$w() {
|
48488 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tflex-direction: column;\n\talign-items: center;\n"]);
|
48489 |
|
48490 | _templateObject2$w = function _templateObject2() {
|
48491 | return data;
|
48492 | };
|
48493 |
|
48494 | return data;
|
48495 | }
|
48496 |
|
48497 | function _templateObject$1n() {
|
48498 | var data = taggedTemplateLiteralLoose(["\n\tmargin: 40px 0;\n"]);
|
48499 |
|
48500 | _templateObject$1n = function _templateObject() {
|
48501 | return data;
|
48502 | };
|
48503 |
|
48504 | return data;
|
48505 | }
|
48506 |
|
48507 | var EmptyState = function EmptyState(_ref) {
|
48508 | var image = _ref.image,
|
48509 | hasImage = _ref.hasImage,
|
48510 | title = _ref.title,
|
48511 | description = _ref.description,
|
48512 | component = _ref.component;
|
48513 | return React.createElement(Center, null, hasImage && React.createElement(ImageStyled, {
|
48514 | src: image,
|
48515 | alt: "box"
|
48516 | }), React.createElement(Title$3, null, title), React.createElement(Description, null, description), component && component());
|
48517 | };
|
48518 |
|
48519 | var ImageStyled = styled.img(_templateObject$1n());
|
48520 | var Center = styled.div(_templateObject2$w());
|
48521 | var Title$3 = styled.div(_templateObject3$l(), function (_ref2) {
|
48522 | var theme = _ref2.theme;
|
48523 | return theme.colors.darkGray;
|
48524 | });
|
48525 | var Description = styled.div(_templateObject4$g(), function (_ref3) {
|
48526 | var theme = _ref3.theme;
|
48527 | return theme.colors.mediumGray;
|
48528 | });
|
48529 | EmptyState.defaultProps = {
|
48530 | title: 'No results found',
|
48531 | description: 'We could not find any matching results, try search for another service, queue or product',
|
48532 | image: boxImage,
|
48533 | hasImage: true,
|
48534 | component: null
|
48535 | };
|
48536 | EmptyState.displayName = 'EmptyState';
|
48537 | EmptyState.propTypes = {
|
48538 | /** Component element */
|
48539 | component: PropTypes.func,
|
48540 |
|
48541 | /** Title of the emptyState */
|
48542 | title: PropTypes.string,
|
48543 |
|
48544 | /** Description of the emptyState */
|
48545 | description: PropTypes.string,
|
48546 |
|
48547 | /** The main image of the emptyState */
|
48548 | image: PropTypes.string,
|
48549 |
|
48550 | /** Bool to render image */
|
48551 | hasImage: PropTypes.bool
|
48552 | /** @component * */
|
48553 |
|
48554 | };
|
48555 |
|
48556 | function _templateObject$1o() {
|
48557 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: ", ";\n\twidth: 100%;\n\tpadding: 6px 15px;\n\n\tbackground: ", ";\n\tfont-weight: ", ";\n\tborder-radius: 4px;\n\tcolor: ", ";\n\tfont-size: 12px;\n"]);
|
48558 |
|
48559 | _templateObject$1o = function _templateObject() {
|
48560 | return data;
|
48561 | };
|
48562 |
|
48563 | return data;
|
48564 | }
|
48565 | var StatusMessage = styled.div(_templateObject$1o(), function (_ref) {
|
48566 | var show = _ref.show;
|
48567 | return show ? 'block' : 'none';
|
48568 | }, function (_ref2) {
|
48569 | var theme = _ref2.theme,
|
48570 | type = _ref2.type;
|
48571 | return theme.status.bg[type];
|
48572 | }, function (_ref3) {
|
48573 | var type = _ref3.type;
|
48574 | return type === 'blocked' && 'bold';
|
48575 | }, function (_ref4) {
|
48576 | var theme = _ref4.theme,
|
48577 | type = _ref4.type;
|
48578 | return theme.status.color[type];
|
48579 | });
|
48580 | StatusMessage.defaultProps = {
|
48581 | show: false,
|
48582 | children: 'Saving changes...',
|
48583 | type: 'info'
|
48584 | };
|
48585 | StatusMessage.propTypes = {
|
48586 | /** display status */
|
48587 | show: PropTypes.bool,
|
48588 |
|
48589 | /** message display on status */
|
48590 | type: PropTypes.oneOf(['success', 'error', 'info', 'blocked']),
|
48591 |
|
48592 | /** type of status */
|
48593 | children: PropTypes.string
|
48594 | };
|
48595 | StatusMessage.displayName = 'StatusMessage';
|
48596 |
|
48597 | function _templateObject$1p() {
|
48598 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: inline-block;\n\twidth: 6px;\n\theight: 6px;\n\tbackground-color: ", ";\n\tborder-radius: 50%;\n"]);
|
48599 |
|
48600 | _templateObject$1p = function _templateObject() {
|
48601 | return data;
|
48602 | };
|
48603 |
|
48604 | return data;
|
48605 | }
|
48606 | var states = ['on', 'off', 'away'];
|
48607 | var BulletState = styled.span(_templateObject$1p(), function (_ref) {
|
48608 | var theme = _ref.theme,
|
48609 | state = _ref.state;
|
48610 | return theme.bulletState.colors[state];
|
48611 | });
|
48612 | BulletState.propTypes = {
|
48613 | state: PropTypes.oneOf(states).isRequired
|
48614 | };
|
48615 | BulletState.displayName = 'BulletState';
|
48616 |
|
48617 | function _templateObject$1q() {
|
48618 | var data = taggedTemplateLiteralLoose(["\n\t:after {\n\t\tcontent: ", ";\n\t}\n"]);
|
48619 |
|
48620 | _templateObject$1q = function _templateObject() {
|
48621 | return data;
|
48622 | };
|
48623 |
|
48624 | return data;
|
48625 | }
|
48626 |
|
48627 | var getArrowContent = function getArrowContent(sortable, direction, isSorted) {
|
48628 | if (sortable === 'true') {
|
48629 | if (isSorted) {
|
48630 | if (direction === 'ascending') {
|
48631 | return '"\\F0D8"';
|
48632 | }
|
48633 |
|
48634 | return '"\\F0D7"';
|
48635 | }
|
48636 |
|
48637 | return '"\\F0DA"';
|
48638 | }
|
48639 |
|
48640 | return 'none';
|
48641 | };
|
48642 |
|
48643 | var getDirection = function getDirection(direction, isSorted) {
|
48644 | return isSorted && direction === 'ascending' ? 'descending' : 'ascending';
|
48645 | };
|
48646 |
|
48647 | var HeaderCell = function HeaderCell(_ref) {
|
48648 | var cell = _ref.cell,
|
48649 | sortable = _ref.sortable,
|
48650 | direction = _ref.direction,
|
48651 | sortHandler = _ref.sortHandler,
|
48652 | isSorted = _ref.isSorted,
|
48653 | children = _ref.children,
|
48654 | props = objectWithoutPropertiesLoose(_ref, ["cell", "sortable", "direction", "sortHandler", "isSorted", "children"]);
|
48655 |
|
48656 | return React.createElement(HeaderCellStyled, _extends_1({
|
48657 | sorted: sortable ? direction || 'ascending' : null,
|
48658 | sortable: sortable.toString(),
|
48659 | direction: direction,
|
48660 | onClick: function onClick() {
|
48661 | return sortable && sortHandler(_extends_1({}, cell, {
|
48662 | direction: getDirection(direction, isSorted)
|
48663 | }));
|
48664 | },
|
48665 | isSorted: isSorted
|
48666 | }, props), children);
|
48667 | };
|
48668 |
|
48669 | var HeaderCellStyled = styled(function (_ref2) {
|
48670 | var sortable = _ref2.sortable,
|
48671 | direction = _ref2.direction,
|
48672 | isSorted = _ref2.isSorted,
|
48673 | props = objectWithoutPropertiesLoose(_ref2, ["sortable", "direction", "isSorted"]);
|
48674 |
|
48675 | return React.createElement(Table.HeaderCell, props);
|
48676 | })(_templateObject$1q(), function (_ref3) {
|
48677 | var sortable = _ref3.sortable,
|
48678 | direction = _ref3.direction,
|
48679 | isSorted = _ref3.isSorted;
|
48680 | return getArrowContent(sortable, direction, isSorted) + " !important";
|
48681 | });
|
48682 | HeaderCell.displayName = 'HeaderCell';
|
48683 | HeaderCell.defaultProps = {
|
48684 | sortable: true,
|
48685 | direction: null,
|
48686 | isSorted: false
|
48687 | };
|
48688 | HeaderCell.propTypes = {
|
48689 | cell: PropTypes.shape({
|
48690 | value: PropTypes.string,
|
48691 | sortable: PropTypes.bool,
|
48692 | width: PropTypes.number
|
48693 | }).isRequired,
|
48694 | sortable: PropTypes.bool,
|
48695 | isSorted: PropTypes.bool,
|
48696 | direction: PropTypes.string,
|
48697 | sortHandler: PropTypes.func.isRequired,
|
48698 | children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired
|
48699 | };
|
48700 |
|
48701 | function _templateObject$1r() {
|
48702 | var data = taggedTemplateLiteralLoose(["\n\tbackground: linear-gradient(90deg, #6a11cb 0%, rgba(255, 255, 255, 0) 100%), #0d0cb5 !important;\n\n\t& th {\n\t\theight: 22px;\n\t\tpadding: 0 11px !important;\n\t\tborder-bottom: none !important;\n\t\tbackground: rgba(0, 0, 0, 0.05) !important;\n\t\tcolor: white !important;\n\t\tfont-size: 13px;\n\t}\n\n\tth:first-child {\n\t\tborder-bottom-left-radius: 4px !important;\n\t\tborder-top-left-radius: 4px !important;\n\t}\n\n\tth:last-child {\n\t\tborder-bottom-right-radius: 4px !important;\n\t\tborder-top-right-radius: 4px !important;\n\t}\n\n\tth:not(:first-child) {\n\t\tborder-left-color: white !important;\n\t}\n"]);
|
48703 |
|
48704 | _templateObject$1r = function _templateObject() {
|
48705 | return data;
|
48706 | };
|
48707 |
|
48708 | return data;
|
48709 | }
|
48710 |
|
48711 | var TableHeader = function TableHeader(_ref) {
|
48712 | var headers = _ref.headers,
|
48713 | columnSorted = _ref.columnSorted,
|
48714 | direction = _ref.direction,
|
48715 | sortHandler = _ref.sortHandler,
|
48716 | props = objectWithoutPropertiesLoose(_ref, ["headers", "columnSorted", "direction", "sortHandler"]);
|
48717 |
|
48718 | return React.createElement(Header$3, props, React.createElement(Table.Row, null, headers.map(function (obj) {
|
48719 | var value = obj.value,
|
48720 | sortable = obj.sortable,
|
48721 | style = obj.style;
|
48722 | return React.createElement(HeaderCell, {
|
48723 | key: value,
|
48724 | cell: obj,
|
48725 | sortable: sortable,
|
48726 | sortHandler: sortHandler,
|
48727 | isSorted: columnSorted === value,
|
48728 | direction: direction,
|
48729 | style: style
|
48730 | }, value);
|
48731 | })));
|
48732 | };
|
48733 |
|
48734 | TableHeader.defaultProps = {
|
48735 | columnSorted: '',
|
48736 | direction: null
|
48737 | };
|
48738 | TableHeader.displayName = 'TableHeader';
|
48739 | TableHeader.propTypes = {
|
48740 | headers: PropTypes.arrayOf(PropTypes.shape({
|
48741 | value: PropTypes.string,
|
48742 | sortable: PropTypes.bool,
|
48743 | style: PropTypes.shape({})
|
48744 | })).isRequired,
|
48745 | columnSorted: PropTypes.string,
|
48746 | direction: PropTypes.string,
|
48747 | sortHandler: PropTypes.func.isRequired
|
48748 | };
|
48749 | var Header$3 = styled(Table.Header)(_templateObject$1r());
|
48750 |
|
48751 | function _templateObject$1s() {
|
48752 | var data = taggedTemplateLiteralLoose(["\n\ttr:first-child {\n\t\theight: 8px;\n\t\tborder: none;\n\t\toutline: thin solid transparent;\n\t}\n\n\ttd {\n\t\tborder-top: none !important;\n\t\tborder-bottom: none !important;\n\t}\n"]);
|
48753 |
|
48754 | _templateObject$1s = function _templateObject() {
|
48755 | return data;
|
48756 | };
|
48757 |
|
48758 | return data;
|
48759 | }
|
48760 |
|
48761 | var TableBody = function TableBody(_ref) {
|
48762 | var children = _ref.children,
|
48763 | props = objectWithoutPropertiesLoose(_ref, ["children"]);
|
48764 |
|
48765 | return React.createElement(TableBodyStyled, props, React.createElement(Table.Row, null), children);
|
48766 | };
|
48767 |
|
48768 | TableBody.displayName = 'TableBody';
|
48769 | TableBody.propTypes = {
|
48770 | children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired
|
48771 | };
|
48772 | var TableBodyStyled = styled(Table.Body)(_templateObject$1s());
|
48773 |
|
48774 | var Table$1 = function Table$$1(_ref) {
|
48775 | var props = _extends_1({}, _ref);
|
48776 |
|
48777 | return React.createElement(Table, _extends_1({
|
48778 | sortable: true,
|
48779 | celled: true,
|
48780 | striped: true,
|
48781 | basic: "very"
|
48782 | }, props));
|
48783 | };
|
48784 |
|
48785 | Table$1.Header = function (_ref2) {
|
48786 | var props = _extends_1({}, _ref2);
|
48787 |
|
48788 | return React.createElement(TableHeader, props);
|
48789 | };
|
48790 |
|
48791 | Table$1.Body = function (_ref3) {
|
48792 | var props = _extends_1({}, _ref3);
|
48793 |
|
48794 | return React.createElement(TableBody, props);
|
48795 | };
|
48796 |
|
48797 | Table$1.Row = function (_ref4) {
|
48798 | var props = _extends_1({}, _ref4);
|
48799 |
|
48800 | return React.createElement(Table.Row, props);
|
48801 | };
|
48802 |
|
48803 | Table$1.Cell = function (_ref5) {
|
48804 | var props = _extends_1({}, _ref5);
|
48805 |
|
48806 | return React.createElement(Table.Cell, props);
|
48807 | };
|
48808 |
|
48809 | Table$1.defaultProps = {};
|
48810 | Table$1.displayName = 'Table';
|
48811 | Table$1.Header.displayName = 'Table.Header';
|
48812 | Table$1.Body.displayName = 'Table.Body';
|
48813 | Table$1.Row.displayName = 'Table.Row';
|
48814 | Table$1.Cell.displayName = 'Table.Cell';
|
48815 | Table$1.propTypes = {};
|
48816 |
|
48817 | function _templateObject$1t() {
|
48818 | var data = taggedTemplateLiteralLoose(["\n\tpadding-right: 16px !important;\n\tpadding-left: 16px !important;\n\tbackground-color: ", " !important;\n\tborder-radius: ", " !important;\n\tcolor: ", " !important;\n\n\tcursor: ", " !important;\n\n\t&&&.disabled {\n\t\tbackground-color: ", " !important;\n\t\tcolor: ", " !important;\n\t}\n\n\t&&&.visible {\n\t\tbackground-color: ", " !important;\n\t}\n\n\t&:active {\n\t\tbackground-color: ", " !important;\n\t}\n\n\ti.icon {\n\t\tmargin: 0 !important;\n\t\tmargin-left: 6px !important;\n\t}\n\n\t.visible.menu {\n\t\tmin-width: 90% !important;\n\t\tmargin-top: 2px;\n\t}\n\n\tdiv.item {\n\t\tborder-top: solid 1px ", " !important;\n\t\ttext-align: right !important;\n\t}\n\n\tdiv.item.active {\n\t\tbackground-color: ", " !important;\n\t\tfont-weight: normal !important;\n\t}\n"]);
|
48819 |
|
48820 | _templateObject$1t = function _templateObject() {
|
48821 | return data;
|
48822 | };
|
48823 |
|
48824 | return data;
|
48825 | }
|
48826 | /**
|
48827 | * extends react semantic ui default dropdown
|
48828 | * https://react.semantic-ui.com/modules/dropdown/
|
48829 | * dropdown module
|
48830 | */
|
48831 |
|
48832 | var Dropdown$1 = function Dropdown$$1(_ref) {
|
48833 | var icon = _ref.icon,
|
48834 | text = _ref.text,
|
48835 | options = _ref.options,
|
48836 | props = objectWithoutPropertiesLoose(_ref, ["icon", "text", "options"]);
|
48837 |
|
48838 | return React.createElement(DropdownStyled, _extends_1({
|
48839 | button: true,
|
48840 | direction: "left",
|
48841 | text: text,
|
48842 | options: options,
|
48843 | icon: React.createElement(Icon$1, {
|
48844 | icon: icon
|
48845 | })
|
48846 | }, props));
|
48847 | };
|
48848 |
|
48849 | Dropdown$1.defaultProps = {
|
48850 | icon: 'select-down',
|
48851 | text: '',
|
48852 | options: []
|
48853 | };
|
48854 | Dropdown$1.propTypes = {
|
48855 | /** icon of type iconName to be displayed (examples: success, add) */
|
48856 | icon: PropTypes.oneOf(IconName),
|
48857 |
|
48858 | /** text visible on the button */
|
48859 | text: PropTypes.string,
|
48860 |
|
48861 | /** options to show when expanded */
|
48862 | options: PropTypes.arrayOf(PropTypes.shape({
|
48863 | key: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
48864 | text: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
48865 | value: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
|
48866 | }))
|
48867 | };
|
48868 | Dropdown$1.displayName = 'Dropdown';
|
48869 | var DropdownStyled = styled(Dropdown)(_templateObject$1t(), function (_ref2) {
|
48870 | var theme = _ref2.theme;
|
48871 | return theme.buttons.bg;
|
48872 | }, function (_ref3) {
|
48873 | var theme = _ref3.theme;
|
48874 | return theme.buttons.borderRadius;
|
48875 | }, function (_ref4) {
|
48876 | var theme = _ref4.theme;
|
48877 | return theme.buttons.text;
|
48878 | }, function (_ref5) {
|
48879 | var disabled = _ref5.disabled;
|
48880 | return disabled ? 'not-allowed' : 'pointer';
|
48881 | }, function (_ref6) {
|
48882 | var theme = _ref6.theme;
|
48883 | return theme.colors.strokeGray;
|
48884 | }, function (_ref7) {
|
48885 | var theme = _ref7.theme;
|
48886 | return theme.colors.gray;
|
48887 | }, function (_ref8) {
|
48888 | var theme = _ref8.theme;
|
48889 | return theme.buttons.activeBg;
|
48890 | }, function (_ref9) {
|
48891 | var theme = _ref9.theme;
|
48892 | return theme.buttons.activeBg;
|
48893 | }, function (_ref10) {
|
48894 | var theme = _ref10.theme;
|
48895 | return theme.buttons.dropdown.separatorColor;
|
48896 | }, function (_ref11) {
|
48897 | var theme = _ref11.theme;
|
48898 | return theme.buttons.dropdown.activeBackgroundColor;
|
48899 | });
|
48900 | DropdownStyled.displayName = 'DropdownStyled';
|
48901 |
|
48902 | function _templateObject5$7() {
|
48903 | var data = taggedTemplateLiteralLoose(["\n\tcolor: ", ";\n"]);
|
48904 |
|
48905 | _templateObject5$7 = function _templateObject5() {
|
48906 | return data;
|
48907 | };
|
48908 |
|
48909 | return data;
|
48910 | }
|
48911 |
|
48912 | function _templateObject4$h() {
|
48913 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: inline-block;\n\twidth: 18px;\n\theight: 18px;\n\tmargin-right: 6px;\n\tbackground-color: ", ";\n"]);
|
48914 |
|
48915 | _templateObject4$h = function _templateObject4() {
|
48916 | return data;
|
48917 | };
|
48918 |
|
48919 | return data;
|
48920 | }
|
48921 |
|
48922 | function _templateObject3$m() {
|
48923 | var data = taggedTemplateLiteralLoose(["\n\t&&&& {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tpadding: 6px 8px !important;\n\t}\n\n\t&&&&:hover {\n\t\tbackground-color: ", " !important;\n\t\tborder-radius: 4px;\n\t}\n"]);
|
48924 |
|
48925 | _templateObject3$m = function _templateObject3() {
|
48926 | return data;
|
48927 | };
|
48928 |
|
48929 | return data;
|
48930 | }
|
48931 |
|
48932 | function _templateObject2$x() {
|
48933 | var data = taggedTemplateLiteralLoose(["\n\t&&&& {\n\t\tpadding: 0;\n\t\tmargin-top: 0;\n\t\tmargin-bottom: 10px;\n\t\tfont-size: 12px;\n\t\tfont-weight: bold;\n\t\tline-height: 14px;\n\t\ttext-transform: none;\n\t}\n"]);
|
48934 |
|
48935 | _templateObject2$x = function _templateObject2() {
|
48936 | return data;
|
48937 | };
|
48938 |
|
48939 | return data;
|
48940 | }
|
48941 |
|
48942 | function _templateObject$1u() {
|
48943 | var data = taggedTemplateLiteralLoose(["\n\t&&& {\n\t\twidth: 220px;\n\t\tpadding: 12px 8px 8px 8px;\n\t\tborder: 1px solid #ffffff;\n\t\tborder-radius: 4px;\n\t\tbox-shadow: 0px 2px 4px rgba(0, 0, 0, 0.25);\n\t}\n\n\t&&& .selected.item {\n\t\tbackground-color: ", ";\n\t\tborder-radius: 4px;\n\t}\n"]);
|
48944 |
|
48945 | _templateObject$1u = function _templateObject() {
|
48946 | return data;
|
48947 | };
|
48948 |
|
48949 | return data;
|
48950 | }
|
48951 |
|
48952 | var GradeDropdown = function GradeDropdown(_ref) {
|
48953 | var options = _ref.options,
|
48954 | header = _ref.header,
|
48955 | children = _ref.children,
|
48956 | onChange = _ref.onChange,
|
48957 | value = _ref.value,
|
48958 | props = objectWithoutPropertiesLoose(_ref, ["options", "header", "children", "onChange", "value"]);
|
48959 |
|
48960 | return React.createElement(Dropdown, _extends_1({
|
48961 | trigger: children,
|
48962 | icon: null
|
48963 | }, props), React.createElement(DropdownMenu, null, header && React.createElement(DropdownHeader, {
|
48964 | content: header
|
48965 | }), options.map(function (_ref2) {
|
48966 | var val = _ref2.value,
|
48967 | color = _ref2.color,
|
48968 | name = _ref2.name;
|
48969 | return React.createElement(DropdownItem, {
|
48970 | onClick: function onClick() {
|
48971 | return onChange({
|
48972 | value: val,
|
48973 | name: name
|
48974 | });
|
48975 | },
|
48976 | selected: value === val,
|
48977 | key: val
|
48978 | }, React.createElement(Square, {
|
48979 | color: color
|
48980 | }), React.createElement(Name, {
|
48981 | color: color
|
48982 | }, name));
|
48983 | })));
|
48984 | };
|
48985 |
|
48986 | var DropdownMenu = styled(Dropdown.Menu)(_templateObject$1u(), function (_ref3) {
|
48987 | var theme = _ref3.theme;
|
48988 | return theme.colors.lightBlue;
|
48989 | });
|
48990 | var DropdownHeader = styled(Dropdown.Header)(_templateObject2$x());
|
48991 | var DropdownItem = styled(Dropdown.Item)(_templateObject3$m(), function (_ref4) {
|
48992 | var theme = _ref4.theme;
|
48993 | return theme.colors.lightBlue;
|
48994 | });
|
48995 | var Square = styled.div(_templateObject4$h(), function (_ref5) {
|
48996 | var color = _ref5.color;
|
48997 | return color || 'black';
|
48998 | });
|
48999 | var Name = styled.div(_templateObject5$7(), function (_ref6) {
|
49000 | var color = _ref6.color;
|
49001 | return color || 'black';
|
49002 | });
|
49003 | GradeDropdown.displayName = 'GradeDropdown';
|
49004 | DropdownMenu.displayName = 'DropdownMenu';
|
49005 | DropdownHeader.displayName = 'DropdownHeader';
|
49006 | DropdownItem.displayName = 'DropdownItem';
|
49007 | Square.displayName = 'Square';
|
49008 | Name.displayName = 'Name';
|
49009 | GradeDropdown.defaultProps = {
|
49010 | header: null
|
49011 | };
|
49012 | GradeDropdown.propTypes = {
|
49013 | /** dropdown options */
|
49014 | options: PropTypes.arrayOf(PropTypes.shape({
|
49015 | value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
49016 | name: PropTypes.string.isRequired,
|
49017 | color: PropTypes.string
|
49018 | })).isRequired,
|
49019 |
|
49020 | /** value controlled by the parent */
|
49021 | value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
49022 |
|
49023 | /** dropdown header */
|
49024 | header: PropTypes.string,
|
49025 |
|
49026 | /** component that will trigger the dropdown */
|
49027 | children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
|
49028 |
|
49029 | /** function called when an option is clicked */
|
49030 | onChange: PropTypes.func.isRequired
|
49031 | };
|
49032 |
|
49033 | function _templateObject3$n() {
|
49034 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: inline-flex;\n\twidth: 50%;\n\theight: calc(100% - 20px);\n\tflex-flow: column;\n\talign-items: center;\n\tjustify-content: flex-start;\n\tpadding: 0 6px;\n\tcolor: ", ";\n\tfont-size: 10px;\n"]);
|
49035 |
|
49036 | _templateObject3$n = function _templateObject3() {
|
49037 | return data;
|
49038 | };
|
49039 |
|
49040 | return data;
|
49041 | }
|
49042 |
|
49043 | function _templateObject2$y() {
|
49044 | var data = taggedTemplateLiteralLoose(["\n\tposition: relative;\n\tdisplay: block;\n\twidth: 100%;\n\theight: 20px;\n\tfont-size: 10px;\n"]);
|
49045 |
|
49046 | _templateObject2$y = function _templateObject2() {
|
49047 | return data;
|
49048 | };
|
49049 |
|
49050 | return data;
|
49051 | }
|
49052 |
|
49053 | function _templateObject$1v() {
|
49054 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\twidth: 100%;\n\theight: ", ";\n\tflex-flow: column;\n\talign-items: baseline;\n\tjustify-content: space-evenly;\n\tpadding: 0 6px;\n\tcolor: ", ";\n\tfont-size: 28px;\n"]);
|
49055 |
|
49056 | _templateObject$1v = function _templateObject() {
|
49057 | return data;
|
49058 | };
|
49059 |
|
49060 | return data;
|
49061 | }
|
49062 |
|
49063 | var WidgetWeather = function WidgetWeather(_ref) {
|
49064 | var selected = _ref.selected,
|
49065 | temperature = _ref.temperature,
|
49066 | temperatureColor = _ref.temperatureColor,
|
49067 | temperatureMin = _ref.temperatureMin,
|
49068 | temperatureMinColor = _ref.temperatureMinColor,
|
49069 | temperatureMax = _ref.temperatureMax,
|
49070 | temperatureMaxColor = _ref.temperatureMaxColor,
|
49071 | props = objectWithoutPropertiesLoose(_ref, ["selected", "temperature", "temperatureColor", "temperatureMin", "temperatureMinColor", "temperatureMax", "temperatureMaxColor"]);
|
49072 |
|
49073 | return React.createElement(WidgetCardContainer, _extends_1({
|
49074 | selected: selected
|
49075 | }, props), React.createElement(TemperatureContainer, {
|
49076 | expand: temperatureMax !== undefined && temperatureMin !== undefined,
|
49077 | color: temperatureColor
|
49078 | }, temperature, "\xBA"), (temperatureMax !== undefined || temperatureMin !== undefined) && React.createElement(ContainerMinMax, null, temperatureMin && React.createElement(TemperatureMinMaxContainer, {
|
49079 | color: temperatureMinColor
|
49080 | }, temperatureMin, "\xBA"), temperatureMax && React.createElement(TemperatureMinMaxContainer, {
|
49081 | color: temperatureMaxColor
|
49082 | }, temperatureMax, "\xBA")));
|
49083 | };
|
49084 |
|
49085 | var TemperatureContainer = styled.div(_templateObject$1v(), function (_ref2) {
|
49086 | var expand = _ref2.expand;
|
49087 | return expand ? 'calc(100% - 20px)' : '100%';
|
49088 | }, function (_ref3) {
|
49089 | var color = _ref3.color;
|
49090 | return color;
|
49091 | });
|
49092 | TemperatureContainer.displayName = 'TemperatureContainer';
|
49093 | var ContainerMinMax = styled.div(_templateObject2$y());
|
49094 | var TemperatureMinMaxContainer = styled.div(_templateObject3$n(), function (_ref4) {
|
49095 | var color = _ref4.color;
|
49096 | return color;
|
49097 | });
|
49098 | TemperatureMinMaxContainer.displayName = 'TemperatureMinMaxContainer';
|
49099 | WidgetWeather.defaultProps = {
|
49100 | selected: false,
|
49101 | temperature: 24,
|
49102 | temperatureColor: 'black',
|
49103 | temperatureMin: undefined,
|
49104 | temperatureMinColor: 'black',
|
49105 | temperatureMax: undefined,
|
49106 | temperatureMaxColor: 'black'
|
49107 | };
|
49108 | WidgetWeather.propTypes = {
|
49109 | /** is selected */
|
49110 | selected: PropTypes.bool,
|
49111 |
|
49112 | /** temperature */
|
49113 | temperature: PropTypes.number,
|
49114 |
|
49115 | /** temperature color */
|
49116 | temperatureColor: PropTypes.string,
|
49117 |
|
49118 | /** temperature min */
|
49119 | temperatureMin: PropTypes.number,
|
49120 |
|
49121 | /** temperature min color */
|
49122 | temperatureMinColor: PropTypes.string,
|
49123 |
|
49124 | /** temperature max */
|
49125 | temperatureMax: PropTypes.number,
|
49126 |
|
49127 | /** temperature max color */
|
49128 | temperatureMaxColor: PropTypes.string
|
49129 | };
|
49130 | WidgetWeather.displayName = 'WidgetWeather';
|
49131 |
|
49132 | var _ref$4 =
|
49133 | /*#__PURE__*/
|
49134 | React.createElement("path", {
|
49135 | d: "M22.847 11.513H19.93a.486.486 0 1 0 0 .973h2.917a.487.487 0 0 0 0-.973zM3.403 11.513H.487a.486.486 0 1 0 0 .973h2.916a.486.486 0 0 0 0-.973zM19.917 3.75a.488.488 0 0 0-.688 0l-2.062 2.062a.485.485 0 1 0 .687.688v-.001l2.061-2.061h.001a.487.487 0 0 0 .001-.688zM6.167 17.5a.484.484 0 0 0-.687 0l-2.063 2.06v.001a.486.486 0 1 0 .688.688l2.061-2.062a.484.484 0 0 0 0-.688zM11.667.333a.486.486 0 0 0-.487.487v2.916a.486.486 0 0 0 .973 0V.82a.487.487 0 0 0-.486-.487zM11.667 19.777a.486.486 0 0 0-.487.486v2.916a.487.487 0 1 0 .973 0v-2.916a.486.486 0 0 0-.486-.486zM6.167 5.813L4.105 3.75a.487.487 0 0 0-.688.688l2.062 2.06V6.5a.485.485 0 1 0 .688-.687zM19.917 19.561L17.853 17.5v-.001a.486.486 0 1 0-.687.687l2.062 2.063a.487.487 0 0 0 .688-.688zM11.667 5.195a6.805 6.805 0 1 0 0 13.61 6.805 6.805 0 1 0 0-13.61zm4.124 10.93a5.794 5.794 0 0 1-4.124 1.708 5.797 5.797 0 0 1-4.125-1.709A5.794 5.794 0 0 1 5.833 12c0-1.559.607-3.023 1.71-4.125a5.796 5.796 0 0 1 4.124-1.709c1.558 0 3.023.607 4.124 1.709A5.794 5.794 0 0 1 17.5 12a5.794 5.794 0 0 1-1.71 4.124z",
|
49136 | fill: "#1A1A1A"
|
49137 | });
|
49138 |
|
49139 | var icon = 'data:image/svg+xml,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M22.8473%2011.5132H19.9304C19.6616%2011.5132%2019.4441%2011.731%2019.4441%2011.9995C19.4441%2012.2682%2019.6616%2012.4862%2019.9304%2012.4862H22.8466C22.8466%2012.4862%2022.8466%2012.4862%2022.8473%2012.4862C23.1154%2012.4862%2023.3333%2012.2682%2023.3333%2011.9995C23.3333%2011.731%2023.1154%2011.5132%2022.8473%2011.5132Z%22%20fill%3D%22%231A1A1A%22%2F%3E%3Cpath%20d%3D%22M3.40317%2011.5132H0.487H0.486333C0.217667%2011.5132%200%2011.731%200%2011.9995C0%2012.2677%200.217667%2012.4862%200.486333%2012.4862H3.40267H3.40317C3.67117%2012.4862%203.88883%2012.2682%203.88883%2011.9998C3.88883%2011.7317%203.67117%2011.5132%203.40317%2011.5132Z%22%20fill%3D%22%231A1A1A%22%2F%3E%3Cpath%20d%3D%22M19.9171%203.74955C19.7261%203.56005%2019.4186%203.56005%2019.2287%203.74955L17.1666%205.81238V5.81288C16.9764%206.00221%2016.9764%206.31005%2017.1666%206.49955C17.3561%206.68938%2017.6641%206.68938%2017.8537%206.49955L17.8544%206.49888L19.9154%204.43805C19.9162%204.43805%2019.9162%204.43738%2019.9162%204.43738C20.1064%204.24755%2020.1064%203.94005%2019.9171%203.74955Z%22%20fill%3D%22%231A1A1A%22%2F%3E%3Cpath%20d%3D%22M6.16679%2017.4994C5.97712%2017.3088%205.66896%2017.3088%205.47996%2017.4994C5.47996%2017.4994%205.47996%2017.4994%205.47912%2017.4994L3.41729%2019.5604C3.41729%2019.5604%203.41729%2019.561%203.41679%2019.561C3.22696%2019.7513%203.22696%2020.0588%203.41679%2020.2485C3.60729%2020.4386%203.91446%2020.4386%204.10479%2020.2485L6.16596%2018.1866L6.16679%2018.1861C6.35712%2017.9968%206.35712%2017.6889%206.16679%2017.4994Z%22%20fill%3D%22%231A1A1A%22%2F%3E%3Cpath%20d%3D%22M11.6666%200.333008C11.3981%200.333008%2011.1804%200.550841%2011.1804%200.819674V3.73551C11.1804%203.73601%2011.1804%203.73601%2011.1804%203.73601C11.1804%204.00468%2011.3981%204.22201%2011.6666%204.22201C11.9349%204.22201%2012.1526%204.00468%2012.1526%203.73651V0.819674C12.1526%200.550841%2011.9349%200.333674%2011.6666%200.333008Z%22%20fill%3D%22%231A1A1A%22%2F%3E%3Cpath%20d%3D%22M11.6666%2019.7773C11.3981%2019.7773%2011.1804%2019.9952%2011.1804%2020.2627V20.264V23.1792C11.1804%2023.4487%2011.3981%2023.6657%2011.6666%2023.6663C11.9349%2023.6663%2012.1526%2023.4487%2012.1526%2023.1792V20.2627C12.1526%2019.9952%2011.9349%2019.7773%2011.6666%2019.7773Z%22%20fill%3D%22%231A1A1A%22%2F%3E%3Cpath%20d%3D%22M6.16678%205.81288L4.10478%203.74955C3.91445%203.56005%203.60728%203.56005%203.41678%203.74955C3.22695%203.94005%203.22762%204.24788%203.41678%204.43738C3.41728%204.43738%203.41728%204.43738%203.41728%204.43805L5.47912%206.49871C5.47912%206.49871%205.47912%206.49938%205.47995%206.49955C5.66895%206.68938%205.97712%206.68938%206.16678%206.49955C6.35712%206.31005%206.35712%206.00221%206.16678%205.81288Z%22%20fill%3D%22%231A1A1A%22%2F%3E%3Cpath%20d%3D%22M19.917%2019.5612L19.9162%2019.5607L17.8544%2017.4997L17.8537%2017.4988C17.6641%2017.309%2017.3561%2017.309%2017.1666%2017.4988C16.9764%2017.6887%2016.9764%2017.997%2017.1666%2018.1863C17.1666%2018.1863%2017.1666%2018.1863%2017.1666%2018.1868L19.2287%2020.2487C19.4185%2020.4388%2019.7259%2020.4388%2019.917%2020.2487C20.1064%2020.059%2020.1064%2019.7515%2019.917%2019.5612Z%22%20fill%3D%22%231A1A1A%22%2F%3E%3Cpath%20d%3D%22M11.6667%205.19482C7.90841%205.19482%204.86157%208.24116%204.86157%2011.9998C4.86157%2015.7583%207.90841%2018.8042%2011.6667%2018.8042C15.4247%2018.8042%2018.4726%2015.7583%2018.4726%2011.9998C18.4726%208.24149%2015.4247%205.19482%2011.6667%205.19482ZM15.7909%2016.1243C14.6901%2017.2258%2013.2247%2017.8333%2011.6667%2017.8333C10.1089%2017.8333%208.64407%2017.2258%207.54224%2016.1243C6.44024%2015.0218%205.83341%2013.5583%205.83341%2011.9998C5.83341%2010.4412%206.44024%208.97699%207.54224%207.87482C8.64407%206.77332%2010.1089%206.16649%2011.6667%206.16649C13.2247%206.16649%2014.6901%206.77332%2015.7909%207.87482C16.8932%208.97699%2017.5002%2010.4412%2017.5002%2011.9998C17.5002%2013.5583%2016.8932%2015.0218%2015.7909%2016.1243Z%22%20fill%3D%22%231A1A1A%22%2F%3E%3C%2Fsvg%3E';
|
49140 |
|
49141 | function _templateObject8$1() {
|
49142 | var data = taggedTemplateLiteralLoose(["\n\tposition: relative;\n\ttop: -7px;\n\tleft: -1px;\n\tdisplay: inline-flex;\n\twidth: 50%;\n\theight: calc(100% - 20px);\n\tflex-flow: column;\n\talign-items: center;\n\tjustify-content: flex-start;\n\tpadding: 0 6px;\n\tcolor: ", ";\n\tfont-size: 6px;\n"]);
|
49143 |
|
49144 | _templateObject8$1 = function _templateObject8() {
|
49145 | return data;
|
49146 | };
|
49147 |
|
49148 | return data;
|
49149 | }
|
49150 |
|
49151 | function _templateObject7$2() {
|
49152 | var data = taggedTemplateLiteralLoose(["\n\tposition: relative;\n\ttop: -7px;\n\tleft: 2px;\n\tdisplay: inline-flex;\n\twidth: 50%;\n\theight: calc(100% - 20px);\n\tflex-flow: column;\n\talign-items: center;\n\tjustify-content: flex-start;\n\tpadding: 0 6px;\n\tcolor: ", ";\n\tfont-size: 6px;\n"]);
|
49153 |
|
49154 | _templateObject7$2 = function _templateObject7() {
|
49155 | return data;
|
49156 | };
|
49157 |
|
49158 | return data;
|
49159 | }
|
49160 |
|
49161 | function _templateObject6$6() {
|
49162 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: inline-flex;\n\twidth: 100%;\n\theight: 20px;\n"]);
|
49163 |
|
49164 | _templateObject6$6 = function _templateObject6() {
|
49165 | return data;
|
49166 | };
|
49167 |
|
49168 | return data;
|
49169 | }
|
49170 |
|
49171 | function _templateObject5$8() {
|
49172 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\twidth: 100%;\n\theight: ", ";\n\tflex-flow: column;\n\talign-items: baseline;\n\tjustify-content: ", ";\n\tpadding: 0 3px;\n\tcolor: ", ";\n\tfont-size: 14px;\n"]);
|
49173 |
|
49174 | _templateObject5$8 = function _templateObject5() {
|
49175 | return data;
|
49176 | };
|
49177 |
|
49178 | return data;
|
49179 | }
|
49180 |
|
49181 | function _templateObject4$i() {
|
49182 | var data = taggedTemplateLiteralLoose(["\n\tposition: relative;\n\tdisplay: inline-flex;\n\twidth: 50%;\n\theight: 100%;\n\tflex-flow: column;\n\tjustify-content: space-around;\n\tfloat: right;\n"]);
|
49183 |
|
49184 | _templateObject4$i = function _templateObject4() {
|
49185 | return data;
|
49186 | };
|
49187 |
|
49188 | return data;
|
49189 | }
|
49190 |
|
49191 | function _templateObject3$o() {
|
49192 | var data = taggedTemplateLiteralLoose(["\n\twidth: 23px;\n\theight: 23px;\n"]);
|
49193 |
|
49194 | _templateObject3$o = function _templateObject3() {
|
49195 | return data;
|
49196 | };
|
49197 |
|
49198 | return data;
|
49199 | }
|
49200 |
|
49201 | function _templateObject2$z() {
|
49202 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: inline-flex;\n\twidth: 50%;\n\theight: 100%;\n\tflex-flow: column;\n\tjustify-content: space-around;\n\tpadding-left: 4px;\n"]);
|
49203 |
|
49204 | _templateObject2$z = function _templateObject2() {
|
49205 | return data;
|
49206 | };
|
49207 |
|
49208 | return data;
|
49209 | }
|
49210 |
|
49211 | function _templateObject$1w() {
|
49212 | var data = taggedTemplateLiteralLoose(["\n\t&&&& {\n\t\tflex-flow: row;\n\t}\n"]);
|
49213 |
|
49214 | _templateObject$1w = function _templateObject() {
|
49215 | return data;
|
49216 | };
|
49217 |
|
49218 | return data;
|
49219 | }
|
49220 |
|
49221 | var WidgetWeatherIcon = function WidgetWeatherIcon(_ref) {
|
49222 | var selected = _ref.selected,
|
49223 | temperature = _ref.temperature,
|
49224 | temperatureColor = _ref.temperatureColor,
|
49225 | temperatureMin = _ref.temperatureMin,
|
49226 | temperatureMinColor = _ref.temperatureMinColor,
|
49227 | temperatureMax = _ref.temperatureMax,
|
49228 | temperatureMaxColor = _ref.temperatureMaxColor,
|
49229 | props = objectWithoutPropertiesLoose(_ref, ["selected", "temperature", "temperatureColor", "temperatureMin", "temperatureMinColor", "temperatureMax", "temperatureMaxColor"]);
|
49230 |
|
49231 | return React.createElement(WidgetWrapperCustom, _extends_1({
|
49232 | selected: selected
|
49233 | }, props), React.createElement(IconWrapper$1, null, React.createElement(IconImage, {
|
49234 | alt: "iconSun",
|
49235 | src: icon
|
49236 | })), React.createElement(TemperatureWrapper, null, React.createElement(TemperatureContainer$1, {
|
49237 | expand: temperatureMax !== undefined && temperatureMin !== undefined,
|
49238 | color: temperatureColor
|
49239 | }, temperature, "\xBA"), (temperatureMax !== undefined || temperatureMin !== undefined) && React.createElement(ContainerMinMax$1, null, temperatureMin && React.createElement(TemperatureMinContainer, {
|
49240 | color: temperatureMinColor
|
49241 | }, temperatureMin, "\xBA"), temperatureMax && React.createElement(TemperatureMaxContainer, {
|
49242 | color: temperatureMaxColor
|
49243 | }, temperatureMax, "\xBA"))));
|
49244 | };
|
49245 |
|
49246 | var WidgetWrapperCustom = styled(WidgetCardContainer)(_templateObject$1w());
|
49247 | var IconWrapper$1 = styled.div(_templateObject2$z());
|
49248 | var IconImage = styled.img(_templateObject3$o());
|
49249 | var TemperatureWrapper = styled.div(_templateObject4$i());
|
49250 | var TemperatureContainer$1 = styled.div(_templateObject5$8(), function (_ref2) {
|
49251 | var expand = _ref2.expand;
|
49252 | return expand ? 'calc(100% - 26px)' : '100%';
|
49253 | }, function (_ref3) {
|
49254 | var expand = _ref3.expand;
|
49255 | return expand ? 'flex-end' : 'space-around';
|
49256 | }, function (_ref4) {
|
49257 | var color = _ref4.color;
|
49258 | return color;
|
49259 | });
|
49260 | TemperatureContainer$1.displayName = 'TemperatureContainer';
|
49261 | var ContainerMinMax$1 = styled.div(_templateObject6$6());
|
49262 | var TemperatureMinContainer = styled.div(_templateObject7$2(), function (_ref5) {
|
49263 | var color = _ref5.color;
|
49264 | return color;
|
49265 | });
|
49266 | TemperatureMinContainer.displayName = 'TemperatureMinContainer';
|
49267 | var TemperatureMaxContainer = styled.div(_templateObject8$1(), function (_ref6) {
|
49268 | var color = _ref6.color;
|
49269 | return color;
|
49270 | });
|
49271 | TemperatureMaxContainer.displayName = 'TemperatureMaxContainer';
|
49272 | WidgetWeatherIcon.defaultProps = {
|
49273 | selected: false,
|
49274 | temperature: 24,
|
49275 | temperatureColor: 'black',
|
49276 | temperatureMin: undefined,
|
49277 | temperatureMinColor: 'black',
|
49278 | temperatureMax: undefined,
|
49279 | temperatureMaxColor: 'black'
|
49280 | };
|
49281 | WidgetWeatherIcon.propTypes = {
|
49282 | /** is selected */
|
49283 | selected: PropTypes.bool,
|
49284 |
|
49285 | /** temperature */
|
49286 | temperature: PropTypes.number,
|
49287 |
|
49288 | /** temperature color */
|
49289 | temperatureColor: PropTypes.string,
|
49290 |
|
49291 | /** temperature min */
|
49292 | temperatureMin: PropTypes.number,
|
49293 |
|
49294 | /** temperature min color */
|
49295 | temperatureMinColor: PropTypes.string,
|
49296 |
|
49297 | /** temperature max */
|
49298 | temperatureMax: PropTypes.number,
|
49299 |
|
49300 | /** temperature max color */
|
49301 | temperatureMaxColor: PropTypes.string
|
49302 | };
|
49303 | WidgetWeatherIcon.displayName = 'WidgetWrapper';
|
49304 |
|
49305 | function _templateObject$1x() {
|
49306 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\twidth: 100%;\n\theight: 100%;\n\tflex-flow: column;\n\talign-items: center;\n\tjustify-content: space-evenly;\n\tpadding: 0 6px;\n\tcolor: ", ";\n\tfont-size: ", ";\n\tfont-weight: bold;\n"]);
|
49307 |
|
49308 | _templateObject$1x = function _templateObject() {
|
49309 | return data;
|
49310 | };
|
49311 |
|
49312 | return data;
|
49313 | }
|
49314 |
|
49315 | var WidgetDate = function WidgetDate(_ref) {
|
49316 | var selected = _ref.selected,
|
49317 | format = _ref.format,
|
49318 | color = _ref.color,
|
49319 | font = _ref.font,
|
49320 | day = _ref.day,
|
49321 | month = _ref.month,
|
49322 | year = _ref.year,
|
49323 | props = objectWithoutPropertiesLoose(_ref, ["selected", "format", "color", "font", "day", "month", "year"]);
|
49324 |
|
49325 | var getFormat = function getFormat() {
|
49326 | switch (format) {
|
49327 | case 'mm/dd/yyyy':
|
49328 | return month + "/" + day + "/" + year;
|
49329 |
|
49330 | case 'dd/mm':
|
49331 | return day + "/" + month;
|
49332 |
|
49333 | case 'yyyy/mm/dd':
|
49334 | return year + "/" + month + "/" + day;
|
49335 |
|
49336 | case 'dd/mm/yyyy':
|
49337 | default:
|
49338 | return day + "/" + month + "/" + year;
|
49339 | }
|
49340 | };
|
49341 |
|
49342 | return React.createElement(WidgetCardContainer, _extends_1({
|
49343 | selected: selected
|
49344 | }, props), React.createElement(DateContainer, {
|
49345 | color: color,
|
49346 | font: font
|
49347 | }, getFormat()));
|
49348 | };
|
49349 |
|
49350 | var DateContainer = styled.div(_templateObject$1x(), function (_ref2) {
|
49351 | var color = _ref2.color;
|
49352 | return color;
|
49353 | }, function (_ref3) {
|
49354 | var font = _ref3.font;
|
49355 | return font + "px";
|
49356 | });
|
49357 | DateContainer.displayName = 'DateContainer';
|
49358 | WidgetDate.defaultProps = {
|
49359 | format: 'dd/mm/yyyy',
|
49360 | font: 10
|
49361 | };
|
49362 | WidgetDate.propTypes = {
|
49363 | /** is selected */
|
49364 | selected: PropTypes.bool.isRequired,
|
49365 |
|
49366 | /** date format */
|
49367 | format: PropTypes.oneOf(['dd/mm/yyyy', 'mm/dd/yyyy', 'dd/mm', 'yyyy/mm/dd']),
|
49368 |
|
49369 | /** color */
|
49370 | color: PropTypes.string.isRequired,
|
49371 |
|
49372 | /** date font */
|
49373 | font: PropTypes.number,
|
49374 |
|
49375 | /** day */
|
49376 | day: PropTypes.number.isRequired,
|
49377 |
|
49378 | /** month */
|
49379 | month: PropTypes.number.isRequired,
|
49380 |
|
49381 | /** year */
|
49382 | year: PropTypes.number.isRequired
|
49383 | };
|
49384 | WidgetDate.displayName = 'WidgetDate';
|
49385 |
|
49386 | function _templateObject3$p() {
|
49387 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\twidth: 100%;\n\theight: calc(100% - 19px);\n\tflex-flow: column;\n\talign-items: center;\n\tjustify-content: start;\n\tpadding: 3px 0 0;\n\tcolor: ", ";\n\tfont-size: ", ";\n"]);
|
49388 |
|
49389 | _templateObject3$p = function _templateObject3() {
|
49390 | return data;
|
49391 | };
|
49392 |
|
49393 | return data;
|
49394 | }
|
49395 |
|
49396 | function _templateObject2$A() {
|
49397 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\twidth: 100%;\n\theight: 19px;\n\tflex-flow: column;\n\talign-items: center;\n\tjustify-content: space-around;\n\tpadding: 0 3px;\n\tcolor: ", ";\n\tfont-size: ", ";\n\ttext-transform: uppercase;\n"]);
|
49398 |
|
49399 | _templateObject2$A = function _templateObject2() {
|
49400 | return data;
|
49401 | };
|
49402 |
|
49403 | return data;
|
49404 | }
|
49405 |
|
49406 | function _templateObject$1y() {
|
49407 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: inline-flex;\n\twidth: 100%;\n\theight: 100%;\n\tflex-flow: column;\n\tjustify-content: space-around;\n"]);
|
49408 |
|
49409 | _templateObject$1y = function _templateObject() {
|
49410 | return data;
|
49411 | };
|
49412 |
|
49413 | return data;
|
49414 | }
|
49415 |
|
49416 | var WidgetDateShort = function WidgetDateShort(_ref) {
|
49417 | var selected = _ref.selected,
|
49418 | colorDay = _ref.colorDay,
|
49419 | colorWeek = _ref.colorWeek,
|
49420 | fontDay = _ref.fontDay,
|
49421 | fontWeek = _ref.fontWeek,
|
49422 | dd = _ref.dd,
|
49423 | weekDay = _ref.weekDay,
|
49424 | props = objectWithoutPropertiesLoose(_ref, ["selected", "colorDay", "colorWeek", "fontDay", "fontWeek", "dd", "weekDay"]);
|
49425 |
|
49426 | return React.createElement(WidgetCardContainer, _extends_1({
|
49427 | selected: selected
|
49428 | }, props), React.createElement(DateWrapper, null, React.createElement(WeekContainer, {
|
49429 | color: colorWeek,
|
49430 | font: fontWeek
|
49431 | }, weekDay), React.createElement(DayContainer, {
|
49432 | color: colorDay,
|
49433 | font: fontDay
|
49434 | }, dd)));
|
49435 | };
|
49436 |
|
49437 | var DateWrapper = styled.div(_templateObject$1y());
|
49438 | var WeekContainer = styled.div(_templateObject2$A(), function (_ref2) {
|
49439 | var color = _ref2.color;
|
49440 | return color;
|
49441 | }, function (_ref3) {
|
49442 | var font = _ref3.font;
|
49443 | return font + "px";
|
49444 | });
|
49445 | WeekContainer.displayName = 'WeekContainer';
|
49446 | var DayContainer = styled.div(_templateObject3$p(), function (_ref4) {
|
49447 | var color = _ref4.color;
|
49448 | return color;
|
49449 | }, function (_ref5) {
|
49450 | var font = _ref5.font;
|
49451 | return font + "px";
|
49452 | });
|
49453 | DayContainer.displayName = 'DayContainer';
|
49454 | WidgetDateShort.defaultProps = {
|
49455 | selected: false,
|
49456 | colorWeek: 'black',
|
49457 | colorDay: 'black',
|
49458 | fontWeek: 16,
|
49459 | fontDay: 34,
|
49460 | dd: 1,
|
49461 | weekDay: 'Mon'
|
49462 | };
|
49463 | WidgetDateShort.propTypes = {
|
49464 | /** is selected */
|
49465 | selected: PropTypes.bool,
|
49466 |
|
49467 | /** color week */
|
49468 | colorWeek: PropTypes.string,
|
49469 |
|
49470 | /** color day */
|
49471 | colorDay: PropTypes.string,
|
49472 |
|
49473 | /** font week */
|
49474 | fontWeek: PropTypes.number,
|
49475 |
|
49476 | /** font day */
|
49477 | fontDay: PropTypes.number,
|
49478 |
|
49479 | /** day */
|
49480 | dd: PropTypes.number,
|
49481 |
|
49482 | /** week day */
|
49483 | weekDay: PropTypes.string
|
49484 | };
|
49485 | WidgetDateShort.displayName = 'WidgetWrapper';
|
49486 |
|
49487 | function _templateObject$1z() {
|
49488 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\twidth: 100%;\n\theight: 100%;\n\tflex-flow: column;\n\talign-items: center;\n\tjustify-content: space-evenly;\n\tfont-size: 13px;\n\tfont-weight: bold;\n"]);
|
49489 |
|
49490 | _templateObject$1z = function _templateObject() {
|
49491 | return data;
|
49492 | };
|
49493 |
|
49494 | return data;
|
49495 | }
|
49496 |
|
49497 | var WidgetCard = function WidgetCard(_ref) {
|
49498 | var image = _ref.image,
|
49499 | text = _ref.text,
|
49500 | place = _ref.place,
|
49501 | props = objectWithoutPropertiesLoose(_ref, ["image", "text", "place"]);
|
49502 |
|
49503 | return React.createElement(WidgetCardContainer, _extends_1({
|
49504 | width: 93,
|
49505 | height: 93
|
49506 | }, props), React.createElement(WidgetContainer, null, React.createElement("img", {
|
49507 | src: image,
|
49508 | alt: "box",
|
49509 | draggable: false
|
49510 | }), React.createElement(TextTruncate, {
|
49511 | text: text,
|
49512 | place: place,
|
49513 | length: 13
|
49514 | })));
|
49515 | };
|
49516 |
|
49517 | var WidgetContainer = styled.div(_templateObject$1z());
|
49518 | WidgetCard.displayName = 'WidgetCard';
|
49519 | WidgetCard.defaultProps = {
|
49520 | place: 'bottom'
|
49521 | };
|
49522 | WidgetCard.propTypes = {
|
49523 | /** Image to be displayed */
|
49524 | image: PropTypes.string.isRequired,
|
49525 |
|
49526 | /** Text to be displayed */
|
49527 | text: PropTypes.string.isRequired,
|
49528 |
|
49529 | /** Tooltip position */
|
49530 | place: PropTypes.oneOf(['top', 'right', 'left', 'bottom'])
|
49531 | };
|
49532 |
|
49533 | function _templateObject$1A() {
|
49534 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: inline-block;\n\twidth: fit-content;\n\tcolor: ", ";\n\tfont-family: ", ", sans-serif;\n\tfont-size: ", "px;\n\tfont-weight: ", ";\n\tline-height: 100%;\n\n\tspan {\n\t\tpadding-left: 7%;\n\t\tfont-family: Roboto, sans-serif;\n\t\tfont-size: 25%;\n\t\tline-height: 100%;\n\t\tvertical-align: ", ";\n\t}\n"]);
|
49535 |
|
49536 | _templateObject$1A = function _templateObject() {
|
49537 | return data;
|
49538 | };
|
49539 |
|
49540 | return data;
|
49541 | }
|
49542 |
|
49543 | var DigitalClock = function DigitalClock(_ref) {
|
49544 | var color = _ref.color,
|
49545 | font = _ref.font,
|
49546 | hour = _ref.hour,
|
49547 | minute = _ref.minute,
|
49548 | period = _ref.period,
|
49549 | size = _ref.size,
|
49550 | props = objectWithoutPropertiesLoose(_ref, ["color", "font", "hour", "minute", "period", "size"]);
|
49551 |
|
49552 | var fontSize = size || (font === 'Roboto' ? 20 : 30);
|
49553 | return React.createElement(DigitalClockContainer, _extends_1({
|
49554 | color: color,
|
49555 | font: font,
|
49556 | size: fontSize
|
49557 | }, props), hour + ":" + minute, period && React.createElement("span", null, period));
|
49558 | };
|
49559 |
|
49560 | var DigitalClockContainer = styled.div(_templateObject$1A(), function (_ref2) {
|
49561 | var theme = _ref2.theme,
|
49562 | color = _ref2.color;
|
49563 | return color || theme.colors.black;
|
49564 | }, function (_ref3) {
|
49565 | var font = _ref3.font;
|
49566 | return font;
|
49567 | }, function (_ref4) {
|
49568 | var size = _ref4.size;
|
49569 | return size;
|
49570 | }, function (_ref5) {
|
49571 | var font = _ref5.font;
|
49572 | return font === 'Roboto' ? 'bold' : 'normal';
|
49573 | }, function (_ref6) {
|
49574 | var font = _ref6.font;
|
49575 | return font === 'Roboto' ? 'top' : 'bottom';
|
49576 | });
|
49577 | DigitalClockContainer.displayName = 'DigitalClockContainer';
|
49578 | DigitalClock.displayName = 'DigitalClock';
|
49579 | DigitalClock.defaultProps = {
|
49580 | period: undefined,
|
49581 | size: undefined,
|
49582 | color: undefined,
|
49583 | font: 'Roboto',
|
49584 | hour: 10,
|
49585 | minute: 10
|
49586 | };
|
49587 | DigitalClock.propTypes = {
|
49588 | /** Text color */
|
49589 | color: PropTypes.string,
|
49590 |
|
49591 | /** Text font-family */
|
49592 | font: PropTypes.oneOf(['Roboto', 'DS-Digital']),
|
49593 |
|
49594 | /** Hour to be displayed */
|
49595 | hour: PropTypes.number,
|
49596 |
|
49597 | /** Minutes to be displayed */
|
49598 | minute: PropTypes.number,
|
49599 |
|
49600 | /** Hour period */
|
49601 | period: PropTypes.oneOf(['AM', 'PM']),
|
49602 |
|
49603 | /** Text font-size */
|
49604 | size: PropTypes.number
|
49605 | };
|
49606 |
|
49607 | function _templateObject$1B() {
|
49608 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\twidth: 100%;\n\theight: 100%;\n\talign-items: center;\n\tjustify-content: center;\n"]);
|
49609 |
|
49610 | _templateObject$1B = function _templateObject() {
|
49611 | return data;
|
49612 | };
|
49613 |
|
49614 | return data;
|
49615 | }
|
49616 |
|
49617 | var TimeWidget = function TimeWidget(_ref) {
|
49618 | var color = _ref.color,
|
49619 | font = _ref.font,
|
49620 | hour = _ref.hour,
|
49621 | minute = _ref.minute,
|
49622 | period = _ref.period,
|
49623 | size = _ref.size,
|
49624 | props = objectWithoutPropertiesLoose(_ref, ["color", "font", "hour", "minute", "period", "size"]);
|
49625 |
|
49626 | return React.createElement(WidgetCardContainer, props, React.createElement(TimeWidgetContainer, null, React.createElement(DigitalClock, {
|
49627 | color: color,
|
49628 | font: font,
|
49629 | hour: hour,
|
49630 | minute: minute,
|
49631 | period: period,
|
49632 | size: size
|
49633 | })));
|
49634 | };
|
49635 |
|
49636 | var TimeWidgetContainer = styled.div(_templateObject$1B());
|
49637 | TimeWidgetContainer.displayName = 'TimeWidgetContainer';
|
49638 | TimeWidget.displayName = 'TimeWidget';
|
49639 | TimeWidget.defaultProps = {
|
49640 | period: undefined,
|
49641 | size: undefined,
|
49642 | font: undefined,
|
49643 | color: undefined,
|
49644 | hour: undefined,
|
49645 | minute: undefined
|
49646 | };
|
49647 | TimeWidget.propTypes = {
|
49648 | /** Text color */
|
49649 | color: PropTypes.string,
|
49650 |
|
49651 | /** Text font-family */
|
49652 | font: PropTypes.oneOf(['Roboto', 'DS-Digital']),
|
49653 |
|
49654 | /** Hour to be displayed */
|
49655 | hour: PropTypes.number,
|
49656 |
|
49657 | /** Minutes to be displayed */
|
49658 | minute: PropTypes.number,
|
49659 |
|
49660 | /** Hour period */
|
49661 | period: PropTypes.oneOf(['AM', 'PM']),
|
49662 |
|
49663 | /** Text font-size */
|
49664 | size: PropTypes.number
|
49665 | };
|
49666 |
|
49667 | function _templateObject4$j() {
|
49668 | var data = taggedTemplateLiteralLoose(["\n\twidth: 100%;\n\theight: 100%;\n\tbackground-color: ", ";\n\tbackground-image: url(", ");\n\tbackground-position: center;\n\tbackground-repeat: no-repeat;\n\tbackground-size: 100% auto;\n\n\tborder-radius: 4px;\n\n\t&:hover,\n\t&focus {\n\t\tborder-radius: 0;\n\t}\n"]);
|
49669 |
|
49670 | _templateObject4$j = function _templateObject4() {
|
49671 | return data;
|
49672 | };
|
49673 |
|
49674 | return data;
|
49675 | }
|
49676 |
|
49677 | function _templateObject3$q() {
|
49678 | var data = taggedTemplateLiteralLoose(["\n\tposition: absolute;\n\tz-index: 2;\n\n\t:before {\n\t\tdisplay: inline-block;\n\t\tborder-radius: 2px;\n\t\tline-height: 0.9em;\n\t}\n\n\ttop: 3px;\n\tright: 8px;\n"]);
|
49679 |
|
49680 | _templateObject3$q = function _templateObject3() {
|
49681 | return data;
|
49682 | };
|
49683 |
|
49684 | return data;
|
49685 | }
|
49686 |
|
49687 | function _templateObject2$B() {
|
49688 | var data = taggedTemplateLiteralLoose(["\n\tposition: absolute;\n\tz-index: 2;\n\ttop: 8px;\n\tleft: 8px;\n"]);
|
49689 |
|
49690 | _templateObject2$B = function _templateObject2() {
|
49691 | return data;
|
49692 | };
|
49693 |
|
49694 | return data;
|
49695 | }
|
49696 |
|
49697 | function _templateObject$1C() {
|
49698 | var data = taggedTemplateLiteralLoose(["\n\tposition: relative;\n\twidth: ", ";\n\theight: ", ";\n\tborder: 2px solid transparent;\n\n\tcursor: pointer;\n\n\t&:after {\n\t\tposition: absolute;\n\t\ttop: 0;\n\t\tleft: 0;\n\t\twidth: 100%;\n\t\theight: 100%;\n\t\tborder-radius: 4px;\n\t\tbox-shadow: ", ";\n\t\tcontent: '';\n\t}\n\n\t&:hover,\n\t&:focus {\n\t\t&:after {\n\t\t\tbox-shadow: 0 0 0 2px ", ";\n\t\t}\n\t}\n"]);
|
49699 |
|
49700 | _templateObject$1C = function _templateObject() {
|
49701 | return data;
|
49702 | };
|
49703 |
|
49704 | return data;
|
49705 | }
|
49706 |
|
49707 | var ImageCard = function ImageCard(_ref) {
|
49708 | var checkboxId = _ref.checkboxId,
|
49709 | handleSelect = _ref.handleSelect,
|
49710 | image = _ref.image,
|
49711 | video = _ref.video,
|
49712 | checked = _ref.checked,
|
49713 | width = _ref.width,
|
49714 | height = _ref.height,
|
49715 | props = objectWithoutPropertiesLoose(_ref, ["checkboxId", "handleSelect", "image", "video", "checked", "width", "height"]);
|
49716 |
|
49717 | return React.createElement(ImageCardStyled, _extends_1({
|
49718 | checked: checked,
|
49719 | width: width,
|
49720 | height: height
|
49721 | }, props), checked !== undefined && React.createElement(CheckboxWrapper$1, null, React.createElement(Checkbox$1, {
|
49722 | checked: checked,
|
49723 | onChange: function onChange(e) {
|
49724 | e.stopPropagation();
|
49725 | handleSelect(e.target.checked);
|
49726 | }
|
49727 | })), video && React.createElement(IconStyled$2, {
|
49728 | size: "big",
|
49729 | checked: checked,
|
49730 | color: theme.colors.gray,
|
49731 | icon: "multimedia"
|
49732 | }), React.createElement(ImgCover, {
|
49733 | src: image,
|
49734 | alt: "image"
|
49735 | }));
|
49736 | };
|
49737 |
|
49738 | var ImageCardStyled = styled.div(_templateObject$1C(), function (_ref2) {
|
49739 | var width = _ref2.width;
|
49740 | return width ? width + "px" : '100%';
|
49741 | }, function (_ref3) {
|
49742 | var height = _ref3.height;
|
49743 | return height ? height + "px" : '100%';
|
49744 | }, function (_ref4) {
|
49745 | var theme$$1 = _ref4.theme,
|
49746 | checked = _ref4.checked;
|
49747 | return checked ? "0 0 0 2px " + theme$$1.colors.activeBlue : "0 0 0 1px " + theme$$1.colors.strokeGray;
|
49748 | }, function (_ref5) {
|
49749 | var theme$$1 = _ref5.theme;
|
49750 | return theme$$1.colors.activeBlue;
|
49751 | });
|
49752 | ImageCardStyled.displayName = 'ImageCardStyled';
|
49753 | var CheckboxWrapper$1 = styled.div(_templateObject2$B());
|
49754 | CheckboxWrapper$1.displayName = 'CheckboxWrapper';
|
49755 | var IconStyled$2 = styled(Icon$1)(_templateObject3$q());
|
49756 | IconStyled$2.displayName = 'IconStyled';
|
49757 | var ImgCover = styled.div(_templateObject4$j(), function (_ref6) {
|
49758 | var theme$$1 = _ref6.theme;
|
49759 | return theme$$1.colors.lightGray;
|
49760 | }, function (_ref7) {
|
49761 | var src = _ref7.src;
|
49762 | return src;
|
49763 | });
|
49764 | ImageCard.defaultProps = {
|
49765 | checked: undefined,
|
49766 | handleSelect: undefined,
|
49767 | checkboxId: undefined,
|
49768 | width: null,
|
49769 | height: null,
|
49770 | video: false
|
49771 | };
|
49772 | ImageCard.propTypes = {
|
49773 | /** checkbox is checked and the ImageCard is selected */
|
49774 | checked: PropTypes.bool,
|
49775 |
|
49776 | /** func to handle when element is selected */
|
49777 | handleSelect: PropTypes.func,
|
49778 |
|
49779 | /** background image url */
|
49780 | image: PropTypes.string.isRequired,
|
49781 |
|
49782 | /** button id to use in functional tests */
|
49783 | checkboxId: PropTypes.string,
|
49784 |
|
49785 | /** ImageCard's witdh */
|
49786 | width: PropTypes.number,
|
49787 |
|
49788 | /** ImageCard's height */
|
49789 | height: PropTypes.number,
|
49790 |
|
49791 | /** if is a video */
|
49792 | video: PropTypes.bool
|
49793 | };
|
49794 | ImageCard.displayName = 'ImageCard';
|
49795 |
|
49796 | function _templateObject$1D() {
|
49797 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: grid;\n\tgrid-column-gap: ", "px;\n\tgrid-row-gap: ", "px;\n\tgrid-template-columns: ", ";\n\n\t@media screen and (min-width: 768px) and (max-width: 991px) {\n\t\tgrid-template-columns: ", ";\n\t}\n\n\t@media screen and (min-width: 992px) and (max-width: 1200px) {\n\t\tgrid-template-columns: ", ";\n\t}\n\n\t@media screen and (min-width: 1200px) {\n\t\tgrid-template-columns: ", ";\n\t}\n\n\t", ";\n\n\t", "\n"]);
|
49798 |
|
49799 | _templateObject$1D = function _templateObject() {
|
49800 | return data;
|
49801 | };
|
49802 |
|
49803 | return data;
|
49804 | }
|
49805 |
|
49806 | var CustomGrid = function CustomGrid(_ref) {
|
49807 | var minWidth = _ref.minWidth,
|
49808 | rowGap = _ref.rowGap,
|
49809 | columnGap = _ref.columnGap,
|
49810 | children = _ref.children,
|
49811 | squared = _ref.squared,
|
49812 | mobile = _ref.mobile,
|
49813 | tablet = _ref.tablet,
|
49814 | desktop = _ref.desktop,
|
49815 | bigDesktop = _ref.bigDesktop;
|
49816 | return React.createElement(GridStyled, {
|
49817 | minWidth: minWidth,
|
49818 | squared: squared,
|
49819 | rowGap: rowGap,
|
49820 | columnGap: columnGap,
|
49821 | mobile: mobile,
|
49822 | tablet: tablet,
|
49823 | desktop: desktop,
|
49824 | bigDesktop: bigDesktop
|
49825 | }, children);
|
49826 | };
|
49827 |
|
49828 | var GridStyled = styled.div(_templateObject$1D(), function (_ref2) {
|
49829 | var columnGap = _ref2.columnGap;
|
49830 | return columnGap;
|
49831 | }, function (_ref3) {
|
49832 | var rowGap = _ref3.rowGap;
|
49833 | return rowGap;
|
49834 | }, function (_ref4) {
|
49835 | var mobile = _ref4.mobile,
|
49836 | minWidth = _ref4.minWidth;
|
49837 | return "repeat(" + (mobile || 'auto-fit') + ", minmax(" + minWidth + "px, 1fr))";
|
49838 | }, function (_ref5) {
|
49839 | var tablet = _ref5.tablet,
|
49840 | minWidth = _ref5.minWidth;
|
49841 | return "repeat(" + (tablet || 'auto-fit') + ", minmax(" + minWidth + "px, 1fr))";
|
49842 | }, function (_ref6) {
|
49843 | var desktop = _ref6.desktop,
|
49844 | minWidth = _ref6.minWidth;
|
49845 | return "repeat(" + (desktop || 'auto-fit') + ", minmax(" + minWidth + "px, 1fr))";
|
49846 | }, function (_ref7) {
|
49847 | var bigDesktop = _ref7.bigDesktop,
|
49848 | minWidth = _ref7.minWidth;
|
49849 | return "repeat(" + (bigDesktop || 'auto-fit') + ", minmax(" + minWidth + "px, 1fr))";
|
49850 | }, function (_ref8) {
|
49851 | var squared = _ref8.squared;
|
49852 | return squared && 'grid-auto-rows: 1fr';
|
49853 | }, function (_ref9) {
|
49854 | var squared = _ref9.squared;
|
49855 | return squared && " \n\t\t&:before {\n\t\t\twidth: 0;\n\t\t\tpadding-bottom: 100%;\n\t\t\tcontent: '';\n\t\t\tgrid-column: 1 / 1;\n\t\t\tgrid-row: 1 / 1;\n\t\t}\n\t\t*:first-child {\n\t\t\tgrid-column: 1 / 1;\n\t\t\tgrid-row: 1 / 1;\n\t\t}\n \t";
|
49856 | });
|
49857 | GridStyled.displayName = 'GridStyled';
|
49858 | CustomGrid.defaultProps = {
|
49859 | minWidth: 40,
|
49860 | rowGap: 20,
|
49861 | columnGap: 20,
|
49862 | squared: false,
|
49863 | mobile: undefined,
|
49864 | tablet: undefined,
|
49865 | desktop: undefined,
|
49866 | bigDesktop: undefined
|
49867 | };
|
49868 | CustomGrid.displayName = 'CustomGrid';
|
49869 | CustomGrid.propTypes = {
|
49870 | children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
|
49871 |
|
49872 | /** min width of grid column */
|
49873 | minWidth: PropTypes.number,
|
49874 |
|
49875 | /** space between rows */
|
49876 | rowGap: PropTypes.number,
|
49877 |
|
49878 | /** space between columns */
|
49879 | columnGap: PropTypes.number,
|
49880 |
|
49881 | /** grid elements in squared shape */
|
49882 | squared: PropTypes.bool,
|
49883 |
|
49884 | /** number of columns on mobile size */
|
49885 | mobile: PropTypes.number,
|
49886 |
|
49887 | /** number of columns on tablet size */
|
49888 | tablet: PropTypes.number,
|
49889 |
|
49890 | /** number of columns on desktop size */
|
49891 | desktop: PropTypes.number,
|
49892 |
|
49893 | /** number of columns on bigDesktop size */
|
49894 | bigDesktop: PropTypes.number
|
49895 | };
|
49896 |
|
49897 | function _templateObject8$2() {
|
49898 | var data = taggedTemplateLiteralLoose(["\n\tcolor: ", ";\n"]);
|
49899 |
|
49900 | _templateObject8$2 = function _templateObject8() {
|
49901 | return data;
|
49902 | };
|
49903 |
|
49904 | return data;
|
49905 | }
|
49906 |
|
49907 | function _templateObject7$3() {
|
49908 | var data = taggedTemplateLiteralLoose(["\n\toverflow: hidden;\n\tpadding-right: 2px;\n\tcolor: ", ";\n\ttext-overflow: ellipsis;\n\twhite-space: nowrap;\n"]);
|
49909 |
|
49910 | _templateObject7$3 = function _templateObject7() {
|
49911 | return data;
|
49912 | };
|
49913 |
|
49914 | return data;
|
49915 | }
|
49916 |
|
49917 | function _templateObject6$7() {
|
49918 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: space-between;\n"]);
|
49919 |
|
49920 | _templateObject6$7 = function _templateObject6() {
|
49921 | return data;
|
49922 | };
|
49923 |
|
49924 | return data;
|
49925 | }
|
49926 |
|
49927 | function _templateObject5$9() {
|
49928 | var data = taggedTemplateLiteralLoose(["\n\tmargin-bottom: 6px;\n\tcolor: ", ";\n\tfont-size: 13px;\n"]);
|
49929 |
|
49930 | _templateObject5$9 = function _templateObject5() {
|
49931 | return data;
|
49932 | };
|
49933 |
|
49934 | return data;
|
49935 | }
|
49936 |
|
49937 | function _templateObject4$k() {
|
49938 | var data = taggedTemplateLiteralLoose(["\n\tpadding: 10px 12px 12px 12px;\n"]);
|
49939 |
|
49940 | _templateObject4$k = function _templateObject4() {
|
49941 | return data;
|
49942 | };
|
49943 |
|
49944 | return data;
|
49945 | }
|
49946 |
|
49947 | function _templateObject3$r() {
|
49948 | var data = taggedTemplateLiteralLoose(["\n\tposition: absolute;\n\tz-index: 2;\n\ttop: 8px;\n\tleft: 8px;\n"]);
|
49949 |
|
49950 | _templateObject3$r = function _templateObject3() {
|
49951 | return data;
|
49952 | };
|
49953 |
|
49954 | return data;
|
49955 | }
|
49956 |
|
49957 | function _templateObject2$C() {
|
49958 | var data = taggedTemplateLiteralLoose(["\n\twidth: 100%;\n\theight: ", ";\n\tbackground-color: ", ";\n\tbackground-image: url(", ");\n\tbackground-size: cover;\n\n\t&:first-child {\n\t\tborder-top-left-radius: 4px;\n\t}\n\t&:last-child {\n\t\tborder-top-right-radius: 4px;\n\t}\n"]);
|
49959 |
|
49960 | _templateObject2$C = function _templateObject2() {
|
49961 | return data;
|
49962 | };
|
49963 |
|
49964 | return data;
|
49965 | }
|
49966 |
|
49967 | function _templateObject$1E() {
|
49968 | var data = taggedTemplateLiteralLoose(["\n\tposition: relative;\n\tdisplay: inline-block;\n\twidth: ", ";\n\theight: 100%;\n\tborder: 2px solid transparent;\n\tuser-select: none;\n\n\t&:after {\n\t\tposition: absolute;\n\t\ttop: 0%;\n\t\tleft: 0%;\n\t\twidth: 100%;\n\t\theight: 100%;\n\t\tborder-radius: 4px;\n\t\tbox-shadow: ", ";\n\t\tcontent: '';\n\t}\n\n\t&:hover,\n\t&:focus {\n\t\t&:after {\n\t\t\tbox-shadow: 0 0 0 2px ", ";\n\t\t}\n\t}\n"]);
|
49969 |
|
49970 | _templateObject$1E = function _templateObject() {
|
49971 | return data;
|
49972 | };
|
49973 |
|
49974 | return data;
|
49975 | }
|
49976 |
|
49977 | var PlaylistCard = function PlaylistCard(_ref) {
|
49978 | var buttonId = _ref.buttonId,
|
49979 | handleSelect = _ref.handleSelect,
|
49980 | images = _ref.images,
|
49981 | checked = _ref.checked,
|
49982 | selected = _ref.selected,
|
49983 | width = _ref.width,
|
49984 | imageHeight = _ref.imageHeight,
|
49985 | title = _ref.title,
|
49986 | leftText = _ref.leftText,
|
49987 | rightText = _ref.rightText,
|
49988 | props = objectWithoutPropertiesLoose(_ref, ["buttonId", "handleSelect", "images", "checked", "selected", "width", "imageHeight", "title", "leftText", "rightText"]);
|
49989 |
|
49990 | return React.createElement(PlaylistCardStyled, _extends_1({
|
49991 | checked: checked,
|
49992 | width: width
|
49993 | }, props, {
|
49994 | selected: selected
|
49995 | }), checked !== undefined && React.createElement(CheckboxWrapper$2, null, React.createElement(Checkbox$1, {
|
49996 | checked: checked,
|
49997 | onChange: function onChange(e) {
|
49998 | e.stopPropagation();
|
49999 | handleSelect(e.target.checked);
|
50000 | }
|
50001 | })), React.createElement(CustomGrid, {
|
50002 | rowGap: 0,
|
50003 | columnGap: 0,
|
50004 | minWidth: 30
|
50005 | }, images.slice(0, 3).map(function (image, index) {
|
50006 | return React.createElement(ImgCover$1, {
|
50007 | key: index,
|
50008 | src: image,
|
50009 | alt: "logo",
|
50010 | height: imageHeight
|
50011 | });
|
50012 | })), React.createElement(Content$2, null, React.createElement(Title$4, null, title), React.createElement(Flex$5, null, React.createElement(InfoLeft, null, leftText), React.createElement(InfoRight, null, rightText))));
|
50013 | };
|
50014 |
|
50015 | var PlaylistCardStyled = styled.div(_templateObject$1E(), function (_ref2) {
|
50016 | var width = _ref2.width;
|
50017 | return width && width + "px";
|
50018 | }, function (_ref3) {
|
50019 | var theme = _ref3.theme,
|
50020 | checked = _ref3.checked;
|
50021 | return checked ? " 0 0 0 2px " + theme.colors.activeBlue : " 0 0 0 1px " + theme.colors.strokeGray;
|
50022 | }, function (_ref4) {
|
50023 | var theme = _ref4.theme;
|
50024 | return theme.colors.activeBlue;
|
50025 | });
|
50026 | var ImgCover$1 = styled.div(_templateObject2$C(), function (_ref5) {
|
50027 | var height = _ref5.height;
|
50028 | return height && height + "px";
|
50029 | }, function (_ref6) {
|
50030 | var theme = _ref6.theme;
|
50031 | return theme.colors.strokeGray;
|
50032 | }, function (_ref7) {
|
50033 | var src = _ref7.src;
|
50034 | return src;
|
50035 | });
|
50036 | var CheckboxWrapper$2 = styled.div(_templateObject3$r());
|
50037 | CheckboxWrapper$2.displayName = 'CheckboxWrapper';
|
50038 | var Content$2 = styled.div(_templateObject4$k());
|
50039 | var Title$4 = styled.div(_templateObject5$9(), function (_ref8) {
|
50040 | var theme = _ref8.theme;
|
50041 | return theme.colors.activeBlue;
|
50042 | });
|
50043 | var Flex$5 = styled.div(_templateObject6$7());
|
50044 | var InfoLeft = styled.div(_templateObject7$3(), function (_ref9) {
|
50045 | var theme = _ref9.theme;
|
50046 | return theme.colors.mediumGray;
|
50047 | });
|
50048 | var InfoRight = styled.div(_templateObject8$2(), function (_ref10) {
|
50049 | var theme = _ref10.theme;
|
50050 | return theme.colors.mediumGray;
|
50051 | });
|
50052 | PlaylistCard.defaultProps = {
|
50053 | checked: undefined,
|
50054 | handleSelect: undefined,
|
50055 | buttonId: undefined,
|
50056 | width: undefined,
|
50057 | imageHeight: 74,
|
50058 | selected: false,
|
50059 | rightText: undefined,
|
50060 | leftText: undefined
|
50061 | };
|
50062 | PlaylistCard.propTypes = {
|
50063 | /** if is checked */
|
50064 | checked: PropTypes.bool,
|
50065 |
|
50066 | /** func to handle when element is selected */
|
50067 | handleSelect: PropTypes.func,
|
50068 |
|
50069 | /** array of images */
|
50070 | images: PropTypes.arrayOf(PropTypes.string).isRequired,
|
50071 |
|
50072 | /** button id to use in functional tests */
|
50073 | buttonId: PropTypes.string,
|
50074 |
|
50075 | /** card's width */
|
50076 | width: PropTypes.number,
|
50077 |
|
50078 | /** card's images height */
|
50079 | imageHeight: PropTypes.number,
|
50080 |
|
50081 | /** if the card is selected */
|
50082 | selected: PropTypes.bool,
|
50083 |
|
50084 | /** card's title */
|
50085 | title: PropTypes.string.isRequired,
|
50086 |
|
50087 | /** card's leftText */
|
50088 | leftText: PropTypes.string,
|
50089 |
|
50090 | /** card's rightText */
|
50091 | rightText: PropTypes.string
|
50092 | };
|
50093 | PlaylistCard.displayName = 'PlaylistCard';
|
50094 |
|
50095 | function _templateObject4$l() {
|
50096 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tmargin-left: auto;\n\tflex-direction: column;\n\ttext-align: end;\n"]);
|
50097 |
|
50098 | _templateObject4$l = function _templateObject4() {
|
50099 | return data;
|
50100 | };
|
50101 |
|
50102 | return data;
|
50103 | }
|
50104 |
|
50105 | function _templateObject3$s() {
|
50106 | var data = taggedTemplateLiteralLoose(["\n\tfont-weight: bold;\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\twhite-space: nowrap;\n\tmargin-right: 20px;\n"]);
|
50107 |
|
50108 | _templateObject3$s = function _templateObject3() {
|
50109 | return data;
|
50110 | };
|
50111 |
|
50112 | return data;
|
50113 | }
|
50114 |
|
50115 | function _templateObject2$D() {
|
50116 | var data = taggedTemplateLiteralLoose(["\n\tmargin-right: 20px;\n\tcolor: ", ";\n\tfont-size: 35px;\n\tline-height: 39px;\n\twhite-space: nowrap;\n"]);
|
50117 |
|
50118 | _templateObject2$D = function _templateObject2() {
|
50119 | return data;
|
50120 | };
|
50121 |
|
50122 | return data;
|
50123 | }
|
50124 |
|
50125 | function _templateObject$1F() {
|
50126 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tmin-width: 260px;\n\talign-items: center;\n\tpadding: 16px 16px 16px 20px;\n\tbackground-color: ", ";\n\tborder-radius: 4px;\n\tbox-shadow: 0 0 8px rgba(0, 0, 0, 0.15);\n\tborder: ", ";\n\n\tspan,\n\ti {\n\t\tcolor: ", "};\n\t}\n"]);
|
50127 |
|
50128 | _templateObject$1F = function _templateObject() {
|
50129 | return data;
|
50130 | };
|
50131 |
|
50132 | return data;
|
50133 | }
|
50134 |
|
50135 | var TicketCard = function TicketCard(_ref) {
|
50136 | var queueTag = _ref.queueTag,
|
50137 | ticketNumber = _ref.ticketNumber,
|
50138 | hour = _ref.hour,
|
50139 | language = _ref.language,
|
50140 | priority = _ref.priority,
|
50141 | props = objectWithoutPropertiesLoose(_ref, ["queueTag", "ticketNumber", "hour", "language", "priority"]);
|
50142 |
|
50143 | return React.createElement(TicketCardWrapper, _extends_1({
|
50144 | priority: priority,
|
50145 | color: theme.colors.strokeGray
|
50146 | }, props), React.createElement(TicketNumber$1, null, React.createElement(TicketLabel, {
|
50147 | queueTag: queueTag,
|
50148 | ticketNumber: ticketNumber
|
50149 | })), priority && React.createElement(PriorityWrapper, null, priority), React.createElement(InfoWrapper, null, React.createElement(Text, {
|
50150 | color: theme.colors.gray
|
50151 | }, hour), language && React.createElement(Text, {
|
50152 | color: theme.colors.mediumGray
|
50153 | }, language)));
|
50154 | };
|
50155 |
|
50156 | var TicketCardWrapper = styled(Ripple)(_templateObject$1F(), function (_ref2) {
|
50157 | var theme$$1 = _ref2.theme;
|
50158 | return theme$$1.colors.white;
|
50159 | }, function (_ref3) {
|
50160 | var priority = _ref3.priority,
|
50161 | theme$$1 = _ref3.theme;
|
50162 | return priority && "1px solid " + theme$$1.colors.activeBlue;
|
50163 | }, function (_ref4) {
|
50164 | var priority = _ref4.priority,
|
50165 | theme$$1 = _ref4.theme;
|
50166 | return priority && theme$$1.colors.activeBlue + " !important";
|
50167 | });
|
50168 | var TicketNumber$1 = styled.span(_templateObject2$D(), function (_ref5) {
|
50169 | var theme$$1 = _ref5.theme;
|
50170 | return theme$$1.colors.darkGray;
|
50171 | });
|
50172 | var PriorityWrapper = styled.span(_templateObject3$s());
|
50173 | var InfoWrapper = styled.div(_templateObject4$l());
|
50174 | PriorityWrapper.displayName = 'PriorityWrapper';
|
50175 | TicketCard.displayName = 'TicketCard';
|
50176 | TicketCard.defaultProps = {
|
50177 | priority: undefined,
|
50178 | language: undefined
|
50179 | };
|
50180 | TicketCard.propTypes = {
|
50181 | /** Queue Tag displayed in the ticket card */
|
50182 | queueTag: PropTypes.string.isRequired,
|
50183 |
|
50184 | /** Ticker Number displayed in the ticket card */
|
50185 | ticketNumber: PropTypes.string.isRequired,
|
50186 |
|
50187 | /** Hour displayed in the ticket card */
|
50188 | hour: PropTypes.string.isRequired,
|
50189 |
|
50190 | /** Language displayed in the ticket card */
|
50191 | language: PropTypes.string,
|
50192 |
|
50193 | /** Define ticket's priority */
|
50194 | priority: PropTypes.string,
|
50195 |
|
50196 | /** Number to be displayed in the ticket card */
|
50197 | onClick: PropTypes.func.isRequired
|
50198 | };
|
50199 |
|
50200 | function _templateObject$1G() {
|
50201 | var data = taggedTemplateLiteralLoose(["\n\tposition: relative;\n\tdisplay: block;\n\twidth: ", "%;\n\theight: ", "%;\n\tbox-sizing: border-box;\n\tfloat: left;\n"]);
|
50202 |
|
50203 | _templateObject$1G = function _templateObject() {
|
50204 | return data;
|
50205 | };
|
50206 |
|
50207 | return data;
|
50208 | }
|
50209 |
|
50210 | var Row$2 = function Row(_ref) {
|
50211 | var children = _ref.children,
|
50212 | width = _ref.width,
|
50213 | height = _ref.height,
|
50214 | props = objectWithoutPropertiesLoose(_ref, ["children", "width", "height"]);
|
50215 |
|
50216 | return React.createElement(RowWrapper, _extends_1({
|
50217 | width: width,
|
50218 | height: height
|
50219 | }, props), children);
|
50220 | };
|
50221 |
|
50222 | var RowWrapper = styled.div(_templateObject$1G(), function (_ref2) {
|
50223 | var width = _ref2.width;
|
50224 | return width;
|
50225 | }, function (_ref3) {
|
50226 | var height = _ref3.height;
|
50227 | return height;
|
50228 | });
|
50229 | RowWrapper.displayName = 'RowWrapper';
|
50230 | Row$2.displayName = 'Row';
|
50231 | Row$2.defaultProps = {
|
50232 | children: undefined,
|
50233 | width: 100,
|
50234 | height: 100
|
50235 | };
|
50236 | Row$2.propTypes = {
|
50237 | children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),
|
50238 | width: PropTypes.number,
|
50239 | height: PropTypes.number
|
50240 | };
|
50241 |
|
50242 | var build = createCommonjsModule(function (module) {
|
50243 | module.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r});},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0});},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=2)}([function(e,t){e.exports=React;},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r={alignItems:"center",display:"flex",userSelect:"none"};t.defaultMenuStyle=r;var i={overflow:"hidden",userSelect:"none"};t.defaultWrapperStyle=i;var s={alignCenter:!0,alignOnResize:!0,arrowClass:"scroll-menu-arrow",arrowDisabledClass:"scroll-menu-arrow--disabled",arrowLeft:null,arrowRight:null,clickWhenDrag:!1,data:[],dragging:!0,hideArrows:!1,hideSingleArrow:!1,inertiaScrolling:!1,inertiaScrollingSlowdown:.25,innerWrapperClass:"menu-wrapper--inner",innerWrapperStyle:{textAlign:"left",userSelect:"none",whiteSpace:"nowrap"},itemClass:"menu-item-wrapper",itemClassActive:"active",itemStyle:{display:"inline-block"},menuClass:"horizontal-menu",menuStyle:r,onSelect:function(){return !1},onUpdate:function(){return !1},scrollBy:0,scrollToSelected:!1,selected:"",transition:.4,translate:0,useButtonRole:!0,wrapperClass:"menu-wrapper",wrapperStyle:i,wheel:!0,xPoint:0,rtl:!1};t.defaultProps=s;},function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var i=r(n(3));t.default=i.default;},function(e,t,n){var r=this&&this.__extends||function(){var e=function(t,n){return (e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t;}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);})(t,n)};return function(t,n){function r(){this.constructor=t;}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r);}}(),i=this&&this.__assign||function(){return (i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var a=s(n(0)),o=n(1),l=n(4),u=n(5),d=function(e){function t(t){var n=e.call(this,t)||this;return n.state={dragging:!1,firstItemVisible:!0,lastItemVisible:!1,leftArrowVisible:!1,rightArrowVisible:!0,startDragTranslate:0,translate:n.props.translate,xDraggedDistance:0,xPoint:0},n.setRef=function(e){var t=Object.entries(e)[0],r=t[0],i=t[1];i.elem&&(n.ref[r]=i);},n.setMenuInnerRef=function(e){n.menuInner=e;},n.setWrapperRef=function(e){n.menuWrapper=e;},n.checkFirstLastItemVisibility=function(e){var t=e.translate,r=void 0===t?n.state.translate:t,i=n.menuItems,s=!0,a=!1;if(i){var o=n.getVisibleItems({offset:r});s=o.includes(i[0]),a=o.includes(i.slice(-1)[0]);}return {firstItemVisible:s,lastItemVisible:a}},n.setFirstLastItemVisibility=function(){var e=n.state,t=e.firstItemVisible,r=e.lastItemVisible,i=n.checkFirstLastItemVisibility({}),s=i.firstItemVisible,a=i.lastItemVisible;if(t!==s||r!==a){var o=!s,l=!a;n.setState({firstItemVisible:s,lastItemVisible:a,leftArrowVisible:o,rightArrowVisible:l});}},n.onLoad=function(){n.setInitial(),n.mounted=!0;},n.resizeHandler=function(){if(!n.props.alignOnResize)return !1;clearTimeout(n.resizeTimer),n.resizeTimer=setTimeout(function(){return n.resize()},250);},n.resize=function(){var e=n.props.alignCenter;n.updateWidth({});var t=n.getVisibleItems({}),r=n.getOffsetToItemByIndex({index:t[0]&&t[0][1].index||0}),i=e?n.getCenterOffset({items:t}):0;n.setState({translate:-r+i}),n.setFirstLastItemVisibility();},n.setInitial=function(){var e=n.props,t=e.selected,r=e.data,s=e.translate,a=e.scrollToSelected,u=e.alignCenter,d=n.state.translate;if(!r||!r.length)return !1;n.menuItems.length&&r===n.data||(n.menuItems=n.getMenuItems(),n.data=r),n.updateWidth({});var f=i({},n.state);(!n.mounted&&s===o.defaultProps.translate||!l.translateIsValid(s)&&!l.translateIsValid(d))&&(f.translate=u?n.firstPageOffset:o.defaultProps.translate);var c=n.checkFirstLastItemVisibility({translate:s}),m=c.firstItemVisible,p=c.lastItemVisible;(f.firstItemVisible=m,f.lastItemVisible=p,f.leftArrowVisible=!m,f.rightArrowVisible=!p,a)&&(n.isScrollNeeded({itemId:t,translate:f.translate})&&(f.translate=n.getOffsetToItemByKey(t)));n.setState(i({},f));},n.isScrollNeeded=function(e){var t=e.itemId,r=e.translate,i=void 0===r?n.state.translate:r,s=n.getItemByKey(t);return !n.getVisibleItems({offset:i}).includes(s)},n.scrollTo=function(e){var t=n.state.translate,r=n.getOffsetToItemByKey(e);if(n.selected=e,t===r)return !1;n.setState({translate:r});},n.getMenuItems=function(){return Object.entries(n.ref).slice(0,n.props.data.length||0)},n.getItemsWidth=function(e){var t=e.items;return (void 0===t?n.menuItems:t).map(function(e){return e[1].elem}).filter(Boolean).reduce(function(e,t){return e+l.getClientRect(t).width},0)},n.getWidth=function(e){var t=e.items,r=window&&window.innerWidth,i=l.getClientRect(n.menuWrapper);return {wWidth:r,menuPos:i.x,menuWidth:i.width,allItemsWidth:n.getItemsWidth({items:t})}},n.updateWidth=function(e){var t=e.items,r=void 0===t?n.menuItems:t,i=n.getWidth({items:r}),s=i.wWidth,a=i.menuPos,o=i.menuWidth,l=i.allItemsWidth,u=n.getPagesOffsets({allItemsWidth:l,items:r,menuWidth:o}),d=u.firstPageOffset,f=u.lastPageOffset;n.menuPos=a,n.wWidth=s,n.allItemsWidth=l,n.menuWidth=o,n.firstPageOffset=d,n.lastPageOffset=f;},n.getFirstPageOffset=function(e){var t=e.items,r=void 0===t?n.menuItems:t,i=e.offset,s=void 0===i?n.state.translate:i,a=e.menuWidth,o=void 0===a?n.menuWidth:a,l=n.getVisibleItems({items:r,menuWidth:o,offset:s});return n.getCenterOffset({items:l,menuWidth:o})},n.getLastPageOffset=function(e){var t=e.items,r=void 0===t?n.menuItems:t,i=e.allItemsWidth,s=void 0===i?n.allItemsWidth:i,a=e.menuWidth,o=void 0===a?n.menuWidth:a,l=n.props.rtl,u=n.getVisibleItems({items:r,menuWidth:o,offset:l?s-o:-s+o});return n.getCenterOffset({items:u,menuWidth:o})},n.getPagesOffsets=function(e){var t=e.items,r=void 0===t?n.menuItems:t,i=e.allItemsWidth,s=void 0===i?n.allItemsWidth:i,a=e.menuWidth,o=void 0===a?n.menuWidth:a,l=e.offset,u=void 0===l?n.state.translate:l;return {firstPageOffset:n.getFirstPageOffset({items:r,menuWidth:o,offset:u}),lastPageOffset:n.getLastPageOffset({allItemsWidth:s,items:r,menuWidth:o})}},n.onItemClick=function(e){var t=n.props,r=t.clickWhenDrag,i=t.onSelect;if(n.state.xDraggedDistance>5&&!r)return !1;n.selected=e,i&&i(e);},n.getVisibleItems=function(e){var t=e.items,r=void 0===t?n.menuItems:t,i=e.menuWidth,s=void 0===i?n.menuWidth:i,a=e.offset,u=void 0===a?n.state.translate:a,d=e.translate,f=void 0===d?n.state.translate||o.defaultProps.translate:d;return r.filter(function(e){var t=l.getClientRect(e[1].elem).width,i=n.getItemInd(r,e),a=n.getOffsetToItemByIndex({index:i,menuItems:r,translate:f});return n.elemVisible({elWidth:t,menuWidth:s,offset:u,x:a})})},n.elemVisible=function(e){var t=e.x,r=e.offset,i=void 0===r?0:r,s=e.elWidth,a=e.menuWidth,o=void 0===a?n.menuWidth:a,l=n.props.rtl,u=l?-(o+1):-1,d=l?1:o+1,f=l?-(t+i):t+i,c=l?f-s:f+s;return l?c>=u&&f<=d:f>=u&&c<=d},n.getItemInd=function(e,t){return void 0===e&&(e=n.menuItems),e&&t?e.findIndex(function(e){return e[0]===t[0]}):0},n.getNextItemInd=function(e,t){var r=n.menuItems;if(e){if(!t.length)return 0}else if(!t.length)return r.length;var i=e?n.getItemInd(r,t[0])-1:n.getItemInd(r,t.slice(-1)[0])+1;return i<0?0:i},n.getOffsetToItemByKey=function(e){var t=n.state.translate,r=n.getItemIndexByKey(e);if(-1===r)return t;var i=n.props,s=i.alignCenter,a=i.rtl;t=n.getOffsetToItemByIndex({index:r});var l=n.getVisibleItems({offset:-t}),u=s?n.getCenterOffset({items:l}):o.defaultProps.translate;return t=-(t-(a?-u:u)),n.itBeforeStart(t)?t=n.getOffsetAtStart():n.itAfterEnd(t)&&(t=n.getOffsetAtEnd()),t},n.getItemByKey=function(e){return n.menuItems.find(function(t){return t[1].key===e})||["",{key:"n",elem:null,index:-1}]},n.getItemIndexByKey=function(e){return e?n.menuItems.findIndex(function(t){return t[1].key===e}):-1},n.getOffsetToItemByIndex=function(e){var t=e.index,r=e.menuItems,i=void 0===r?n.menuItems:r,s=e.translate,a=void 0===s?n.state.translate:s;if(!i.length)return 0;var o=t>=i.length?i.length-1:t,u=l.getClientRect(i[o][1].elem),d=u.x,f=u.x2;return n.props.rtl?n.menuPos+n.menuWidth-a-f:+d-a-n.menuPos},n.getScrollRightOffset=function(e,t){void 0===t&&(t=n.menuItems);var r=n.props,i=r.scrollBy,s=r.rtl,a=i?e[0][1].index+i:s?n.getPrevItem((e[0]&&e[0][1]||t[0][1]).key)[1].index:n.getNextItem((e.slice(-1)[0]&&e.slice(-1)||t.slice(-1))[0][1].key)[1].index,o=-n.getOffsetToItemByIndex({index:a,menuItems:t});return s?-o:o},n.getScrollLeftOffset=function(e,t){void 0===t&&(t=n.menuItems);var r=n.props,i=r.scrollBy,s=(r.rtl?n.getNextItem((e.slice(-1)[0]&&e.slice(-1)||t.slice(-1))[0][1].key):n.getPrevItem((e[0]&&e[0][1]||t[0][1]).key))[1].index-(i?i-1:e.length);return -n.getOffsetToItemByIndex({index:s<0?0:s,menuItems:t})},n.getNextItem=function(e){var t=n.menuItems;return t[t.findIndex(function(t){return t[1].key===e})+1]||t.slice(-1)[0]},n.getPrevItem=function(e){var t=n.menuItems;return t[t.findIndex(function(t){return t[1].key===e})-1]||t[0]},n.getOffset=function(e,t){void 0===t&&(t=n.menuItems),e=n.props.rtl?!e:e;var r=n.getVisibleItems({items:t});return e?n.getScrollLeftOffset(r,t):n.getScrollRightOffset(r,t)},n.getCenterOffset=function(e){var t=e.items,r=void 0===t?n.menuItems:t,i=e.menuWidth,s=void 0===i?n.menuWidth:i;return r.length?(s-n.getItemsWidth({items:r}))/2:0},n.handleWheel=function(e){if(!n.props.wheel)return !1;e.deltaY<0?n.handleArrowClick():n.handleArrowClick(!1);},n.getOffsetAtStart=function(){var e=n.firstPageOffset;return n.props.alignCenter?e:o.defaultProps.translate},n.getOffsetAtEnd=function(){var e=n.props.alignCenter,t=n,r=t.allItemsWidth,i=t.menuWidth,s=t.lastPageOffset,a=r-i;return e?-a-s:-a},n.handleArrowClickRight=function(){n.handleArrowClick(!1);},n.handleArrowClick=function(e){void 0===e&&(e=!0);var t=n.props,r=t.alignCenter,i=t.rtl,s=n,a=s.allItemsWidth,l=s.menuWidth;if(!r&&!e&&a<l)return !1;var u=0,d=n.getVisibleItems({}),f=d[0]&&0===d[0][1].index,c=d.slice(-1)[0]&&d.slice(-1)[0][1].index===n.menuItems.length-1,m=n.getOffset(e);if(e&&(f||n.itBeforeStart(m)))u=n.getOffsetAtStart();else if(e||!c&&!n.itAfterEnd(m)){var p=r?n.getCenterOffset({items:n.getVisibleItems({offset:m})}):0;u=m+(i?e?p+n.menuWidth:-p-n.menuWidth:p);}else u=n.getOffsetAtEnd();n.setState({startDragTranslate:0,translate:u,xDraggedDistance:0,xPoint:o.defaultProps.xPoint});},n.itBeforeStart=function(e){var t=n.props.alignCenter,r=n,i=r.menuWidth,s=r.allItemsWidth,a=r.firstPageOffset;return s<i||(t?e>a:e>o.defaultProps.translate)},n.itAfterEnd=function(e){var t=n.props.alignCenter,r=n,i=r.menuWidth,s=r.allItemsWidth,a=r.lastPageOffset;return s<i||(t?e<o.defaultProps.translate&&Math.abs(e)>s-i+a:e<o.defaultProps.translate&&Math.abs(e)>s-i)},n.getPoint=function(e){return "touches"in e?e.touches[0].clientX:"clientX"in e?e.clientX:0},n.handleDragStart=function(e){if(e&&"buttons"in e&&2===e.buttons)return !1;if(!n.props.dragging)return !1;var t=n.state.translate;n.dragHistory=[{time:Date.now(),position:t}],n.setState({dragging:!0,startDragTranslate:t,xDraggedDistance:0,xPoint:0});},n.handleDrag=function(e){var t=n.props,r=t.dragging,i=t.rtl,s=n.state,a=s.translate,l=s.dragging,u=s.xPoint,d=s.xDraggedDistance;if(!r||!l)return !1;var f=n.getPoint(e),c=u===o.defaultProps.xPoint?o.defaultProps.xPoint:u-f,m=a-(i?-c:c);n.itBeforeStart(m)?m-=Math.abs(c)/2:n.itAfterEnd(m)&&(m+=Math.abs(c)/2),0!==c&&n.dragHistory.push({time:Date.now(),position:m});var p=m;n.setState({translate:p,xDraggedDistance:d+Math.abs(c),xPoint:f});},n.handleDragStop=function(e){var t=n,r=t.allItemsWidth,i=t.menuWidth,s=n.state,a=s.translate,l=s.xPoint,u=void 0===l?n.getPoint(e):l,d=n.state,f=d.dragging,c=d.startDragTranslate,m=n.props,p=m.dragging,g=m.alignCenter;if(!p||!f)return !1;if(n.props.inertiaScrolling){var h=Date.now(),v=n.dragHistory.filter(function(e){return h-e.time<150});if(v.length>2){var I=v[0],y=v[v.length-1],b=(y.position-I.position)/(y.time-I.time);a+=(b*=n.props.inertiaScrollingSlowdown)*(1e3*n.props.transition);}}var w=a;n.itBeforeStart(a)?(w=n.getOffsetAtStart(),u=o.defaultProps.xPoint):n.itAfterEnd(a)&&(w=n.getOffsetAtEnd(),u=o.defaultProps.xPoint),!g&&r<=i&&(w=o.defaultProps.translate,u=o.defaultProps.xPoint),n.setState({dragging:!1,translate:w,xPoint:u},function(){return n.onUpdate({translate:w,translateOld:c})});},n.isArrowsVisible=function(){var e=n,t=e.allItemsWidth,r=e.menuWidth,i=e.props.hideArrows;return !Boolean(i&&t<=r)},n.onUpdate=function(e){var t=e.translate,r=void 0===t?n.state.translate:t,i=e.translateOld,s=void 0===i?n.state.translate:i,a=n.props.onUpdate,o=n.lastTranslateUpdate;r!==s&&r!==o&&(n.lastTranslateUpdate=r,"function"==typeof a&&a({translate:r}));},n.ref={},n.menuWrapper=null,n.menuInner=null,n.mounted=!1,n.needUpdate=!1,n.allItemsWidth=0,n.menuPos=0,n.menuWidth=0,n.wWidth=0,n.firstPageOffset=0,n.lastPageOffset=0,n.lastTranslateUpdate=0,n.menuItems=[],n.selected=String(t.selected)||"",n.onLoadTimer=0,n.rafTimer=0,n.resizeTimer=0,n.frameId=0,n.data=null,n.dragHistory=[],n}return r(t,e),t.prototype.componentDidCatch=function(e,t){console.log("ScrollMenu catched error: ",e,t);},t.prototype.componentDidMount=function(){var e=this;this.setInitial(),window.requestAnimationFrame=window.requestAnimationFrame||function(){return !1};var t=l.testPassiveEventSupport(),n=!t||{passive:!0,capture:!0},r=!!t&&{passive:!0,capture:!1};window.addEventListener("load",this.onLoad,r),window.addEventListener("resize",this.resizeHandler,r),document.addEventListener("mousemove",this.handleDrag,n),document.addEventListener("mouseup",this.handleDragStop,n),this.onLoadTimer=setTimeout(function(){return e.onLoad(),e.forceUpdate()},0);},t.prototype.shouldComponentUpdate=function(e,t){var n=this.state,r=n.translate,i=n.dragging,s=n.firstItemVisible,a=n.lastItemVisible,o=t.translate,u=t.dragging,d=t.firstItemVisible,f=t.lastItemVisible,c=this.props,m=c.translate,p=c.selected,g=c.scrollToSelected,h=e.translate,v=e.selected,I=l.notUndefOrNull(h)&&m!==h,y=h!==o||r!==o||I,b=l.notUndefOrNull(v)&&p!==v,w=b||this.selected!==v,P=y||w,S=s!==d,W=a!==f,O=o,x=this.props.data!==e.data||this.props.data.length!==e.data.length,C=l.translateIsValid(h)&&I&&!x;return (x||g&&b)&&(this.needUpdate=!0),P&&(b&&(this.selected=v),C&&(O=h)),C&&this.setState({translate:+O}),x||y||i!==u||P||S||W},t.prototype.componentDidUpdate=function(e,t){var n=this;this.needUpdate&&(this.needUpdate=!1,this.onLoad());var r=t.translate,i=this.state,s=i.translate;i.dragging||r===s||this.onUpdate({translate:s,translateOld:r});var a=this.props,o=a.hideSingleArrow,l=a.transition;o&&(cancelAnimationFrame(this.frameId),clearTimeout(this.rafTimer),this.frameId=requestAnimationFrame(this.setFirstLastItemVisibility),this.rafTimer=setTimeout(function(){cancelAnimationFrame(n.frameId),n.frameId=requestAnimationFrame(n.setFirstLastItemVisibility);},1e3*l+10));},t.prototype.componentWillUnmount=function(){window.removeEventListener("resize",this.resizeHandler),document.removeEventListener("mousemove",this.handleDrag),document.removeEventListener("mouseup",this.handleDragStop),clearTimeout(this.rafTimer),clearTimeout(this.onLoadTimer),clearTimeout(this.resizeTimer),cancelAnimationFrame(this.frameId);},t.prototype.render=function(){var e=this.props,t=e.arrowClass,n=e.arrowDisabledClass,r=e.arrowLeft,s=e.arrowRight,l=e.data,d=e.inertiaScrolling,f=e.innerWrapperStyle,c=e.innerWrapperClass,m=e.itemStyle,p=e.itemClass,g=e.itemClassActive,h=e.menuStyle,v=e.menuClass,I=e.transition,y=e.useButtonRole,b=e.wrapperClass,w=e.wrapperStyle,P=e.rtl,S=this.state,W=S.translate,O=S.dragging,x=S.leftArrowVisible,C=S.rightArrowVisible,A=this.selected,_=this.mounted;if(!l||!l.length)return null;var V=!_||this.isArrowsVisible(),D=i({},o.defaultMenuStyle,h),T=i({},o.defaultWrapperStyle,w),k=i({},o.defaultProps.itemStyle,m),E={className:t,disabledClass:n};return a.createElement("div",{className:v,style:D,onWheel:this.handleWheel},r&&a.createElement(u.ArrowWrapper,i({},E,{isDisabled:!V||!x,onClick:this.handleArrowClick}),r),a.createElement("div",{className:b,style:T,ref:this.setWrapperRef,onMouseDown:this.handleDragStart,onTouchStart:this.handleDragStart,onTouchEnd:this.handleDragStop,onMouseMove:this.handleDrag,onTouchMove:this.handleDrag},a.createElement(u.InnerWrapper,{data:l,translate:W,dragging:O,mounted:_,transition:_?I:0,selected:A,setRef:this.setRef,setMenuInnerRef:this.setMenuInnerRef,onClick:this.onItemClick,innerWrapperStyle:f,innerWrapperClass:c,itemStyle:k,itemClass:p,itemClassActive:g,inertiaScrolling:d,useButtonRole:y,rtl:P})),s&&a.createElement(u.ArrowWrapper,i({},E,{isDisabled:!V||!C,onClick:this.handleArrowClickRight}),s))},t.defaultProps=o.defaultProps,t}(a.Component);t.ScrollMenu=d,t.default=d;},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});t.notUndefOrNull=function(e){return void 0!==e&&null!==e};t.getClientRect=function(e){if(!e||!e.getBoundingClientRect||"function"!=typeof e.getBoundingClientRect)return {width:0,x:0,x2:0};var t=e.getBoundingClientRect(),n=t.left,r=void 0===n?0:n,i=t.width,s=void 0===i?0:i,a=t.right;return {width:s,x:+r,x2:+(void 0===a?0:a)}};t.formatTranslate=function(e){return +e.toFixed(0)};var r=function(e){return "number"==typeof e&&!isNaN(+e)};t.translateIsValid=r;t.validateTranslate=function(e,t){return r(e)?+e:t};t.testPassiveEventSupport=function(){var e=!1;try{var t={get passive(){return e=!0,!1}};window.addEventListener("testPassiveEventSupport",t,t),window.removeEventListener("testPassiveEventSupport",t,t);}catch(t){e=!1;}return e};},function(e,t,n){var r=this&&this.__extends||function(){var e=function(t,n){return (e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t;}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);})(t,n)};return function(t,n){function r(){this.constructor=t;}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r);}}(),i=this&&this.__assign||function(){return (i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=s(n(0)),o=n(1),l={disabledClass:o.defaultProps.arrowDisabledClass},u=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t.prototype.render=function(){var e=this.props,t=e.isDisabled,n=e.className,r=e.disabledClass,i=e.onClick,s=e.children,o=n+" "+(t?r:"");return a.default.createElement("div",{className:o,onClick:function(){return i()}},a.default.cloneElement(s,s.props))},t.defaultProps=l,t}(a.default.PureComponent);t.ArrowWrapper=u,t.innerStyle=function(e){var t=e.translate,n=e.dragging,r=e.mounted,i=e.transition,s=e.inertiaScrolling;return {transform:"translate3d("+(e.rtl?-t:t)+"px, 0, 0)",transition:"transform "+(n||!r?"0":i)+"s"+(s?" ease-out":""),width:"9900px"}};var d=function(e){function n(t){var n=e.call(this,t)||this;return n.setMenuInnerRef=function(e){(0, n.props.setMenuInnerRef)({menuInner:{key:"menuInner",elem:e}});},n.setRef=function(e,t,r,i){var s;(0, n.props.setRef)(((s={})[e]={index:r,key:t,elem:i},s));},n.state={data:[],items:[],selected:""},n}return r(n,e),n.getDerivedStateFromProps=function(e,t){return t.data!==e.data||t.selected!==e.selected?{data:e.data,items:n.setItems(e.data,e.selected,e.onClick),selected:e.selected}:null},n.prototype.render=function(){var e=this,n=this.props,r=n.translate,s=n.dragging,o=n.mounted,l=n.transition,u=n.innerWrapperStyle,d=n.innerWrapperClass,f=n.itemStyle,c=n.itemClass,m=n.itemClassActive,p=n.inertiaScrolling,g=n.useButtonRole,h=n.rtl,v=t.innerStyle({dragging:s,inertiaScrolling:p,mounted:o,rtl:h,transition:l,translate:r}),I=i({},v,u);return a.default.createElement("div",{className:d,style:I,ref:function(t){return e.setMenuInnerRef(t)}},this.state.items.map(function(t,n){return a.default.createElement("div",{ref:function(r){return e.setRef("menuitem-"+n,String(t.key||""),n,r)},className:c+" "+(t.props.selected?m:""),key:"menuItem-"+t.key,style:f,onClick:t.props.onClick(),tabIndex:0,role:g?"button":""},t)}))},n.defaultProps={data:[],dragging:!0,mounted:!1,selected:o.defaultProps.selected,transition:o.defaultProps.transition,translate:o.defaultProps.translate},n.isElementActive=function(e,t){return String(e)===String(t)},n.setItems=function(e,t,r){return e.map(function(e){var i=e.props.onClick,s=void 0===i?function(){return !1}:i,o={onClick:function(){return n.forwardClickHandler(e.key,s,r)},selected:n.isElementActive(e.key,t)};return a.default.cloneElement(e,o)})},n.forwardClickHandler=function(e,t,n){return void 0===t&&(t=function(){return !1}),function(){t(),n(e);}},n}(a.default.PureComponent);t.InnerWrapper=d;}]);
|
50244 | });
|
50245 |
|
50246 | var ScrollMenu = unwrapExports(build);
|
50247 |
|
50248 | function _templateObject2$E() {
|
50249 | var data = taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\twidth: 13px;\n\theight: 26px;\n\n\talign-items: center;\n\tjustify-content: center;\n\n\tmargin-right: ", ";\n\tmargin-left: ", ";\n\n\tcursor: pointer;\n\ttext-align: center;\n\ttext-transform: uppercase;\n"]);
|
50250 |
|
50251 | _templateObject2$E = function _templateObject2() {
|
50252 | return data;
|
50253 | };
|
50254 |
|
50255 | return data;
|
50256 | }
|
50257 |
|
50258 | function _templateObject$1H() {
|
50259 | var data = taggedTemplateLiteralLoose(["\n\t", "\n\t.menu-item-wrapper:focus {\n\t\toutline: none !important;\n\t}\n\n\t.scroll-menu-arrow--disabled i {\n\t\tcolor: ", ";\n\t\tcursor: default;\n\t}\n"]);
|
50260 |
|
50261 | _templateObject$1H = function _templateObject() {
|
50262 | return data;
|
50263 | };
|
50264 |
|
50265 | return data;
|
50266 | }
|
50267 |
|
50268 | var Arrow = function Arrow(_ref) {
|
50269 | var side = _ref.side,
|
50270 | iconColor = _ref.iconColor;
|
50271 | return React.createElement(ArrowWrapper, {
|
50272 | side: side
|
50273 | }, React.createElement(Icon$1, {
|
50274 | icon: side === 'left' ? 'select-left' : 'select-right',
|
50275 | color: iconColor
|
50276 | }));
|
50277 | };
|
50278 |
|
50279 | var Carousel = function Carousel(_ref2) {
|
50280 | var data = _ref2.data,
|
50281 | arrowsColor = _ref2.arrowsColor,
|
50282 | arrowsColorDisabled = _ref2.arrowsColorDisabled,
|
50283 | borderColor = _ref2.borderColor,
|
50284 | props = objectWithoutPropertiesLoose(_ref2, ["data", "arrowsColor", "arrowsColorDisabled", "borderColor"]);
|
50285 |
|
50286 | return React.createElement("div", null, React.createElement(ScrollMenuContainer, {
|
50287 | arrowsColorDisabled: arrowsColorDisabled,
|
50288 | borderColor: borderColor
|
50289 | }, React.createElement(ScrollMenu, _extends_1({
|
50290 | data: data,
|
50291 | alignCenter: false,
|
50292 | arrowLeft: React.createElement(Arrow, {
|
50293 | side: "left",
|
50294 | iconColor: arrowsColor
|
50295 | }),
|
50296 | arrowRight: React.createElement(Arrow, {
|
50297 | side: "right",
|
50298 | iconColor: arrowsColor
|
50299 | }),
|
50300 | scrollBy: 1,
|
50301 | hideSingleArrow: true,
|
50302 | wheel: false
|
50303 | }, props))));
|
50304 | };
|
50305 |
|
50306 | var ScrollMenuContainer = styled.div(_templateObject$1H(), function (_ref3) {
|
50307 | var borderColor = _ref3.borderColor;
|
50308 | return borderColor && "\n\tborder: 2px solid " + borderColor + ";\n\tbox-sizing: border-box;\n\tborder-radius: 4px;\n\t\tpadding: 0 14px;\n\t";
|
50309 | }, function (_ref4) {
|
50310 | var arrowsColorDisabled = _ref4.arrowsColorDisabled;
|
50311 | return arrowsColorDisabled + " !important";
|
50312 | });
|
50313 | var ArrowWrapper = styled.div(_templateObject2$E(), function (_ref5) {
|
50314 | var side = _ref5.side;
|
50315 | return side === 'left' ? '6px' : '0';
|
50316 | }, function (_ref6) {
|
50317 | var side = _ref6.side;
|
50318 | return side === 'right' ? '6px' : '0';
|
50319 | });
|
50320 | ArrowWrapper.displayName = 'ArrowWrapper';
|
50321 | Arrow.defaultProps = {
|
50322 | iconColor: theme.colors.mediumGray
|
50323 | };
|
50324 | Arrow.propTypes = {
|
50325 | side: PropTypes.string.isRequired,
|
50326 | iconColor: PropTypes.string
|
50327 | };
|
50328 | Carousel.defaultProps = {
|
50329 | data: undefined,
|
50330 | arrowsColor: theme.colors.mediumGray,
|
50331 | arrowsColorDisabled: theme.colors.strokeGray,
|
50332 | borderColor: undefined
|
50333 | };
|
50334 | Carousel.propTypes = {
|
50335 | /** children components that will be inside carousel */
|
50336 | data: PropTypes.arrayOf(PropTypes.node),
|
50337 |
|
50338 | /** carousel arrows color */
|
50339 | arrowsColor: PropTypes.string,
|
50340 |
|
50341 | /** carousel arrows color when disabled*/
|
50342 | arrowsColorDisabled: PropTypes.string,
|
50343 |
|
50344 | /** carousel border color */
|
50345 | borderColor: PropTypes.string
|
50346 | };
|
50347 |
|
50348 | export { Button$1 as Button, IconButton, ButtonLink, TopButton, SelectButton, SelectGroupButton, GenerateButton, SquareButton, Navbar, Tabs, SideNav, AnchorMenu, Block, BlockWrapper, BlockBar, Span, Modal$1 as Modal, FullScreenModal, ErrorModal, ConfirmationModal, HelpTooltip, StyledTooltip, Tooltip, TooltipExample, Pagination$1 as Pagination, Input$1 as Input, InputField, InputFile, TextArea$1 as TextArea, Toggle, Checkbox$1 as Checkbox, Radio, Tag, InputGroup, InputPassword, InputRange, NumberSpinner, Error$1 as Error, Select$1 as Select, Collapse$1 as Collapse, ExpandableSection, DatePicker, ColorPicker, ColorDisplayer, TimePicker, TimePickerGroup, Rating, RatingBox, Icon$1 as Icon, IconName, Toast$1 as Toast, ToastWrapper, notify, notifySuccess, notifyError, notifyWarning, CenteredGrid, Section, Text, BigHeader, Header$2 as Header, SubHeader, ButtonText, LabelText, ErrorText, TextTruncate, BreadCrumbs, Loading, LoadingModal, List, ListHeader, ListHeaderAction, ListRow, ListAddInfoWrapper, ListActionsWrapper, ListCard, ListExpandable, DndListRow, DndListContainer, DndHTML5Provider, EmptyState, StatusMessage, BulletState, Table$1 as Table, TableHeader, TableBody, PasswordStrengthMeter, Dropdown$1 as Dropdown, GradeDropdown, ColorLabel, Label$1 as Label, BottomLabel, TicketLabel, WidgetWeather, WidgetWeatherIcon, WidgetDate, WidgetDateShort, WidgetCardContainer, WidgetCard, DigitalClock, TimeWidget, ImageCard, PlaylistCard, TicketCard, CustomGrid, Row$2 as Row, Carousel, Ripple, theme as DefaultTheme, secondary as SecondaryTheme };
|
50349 | //# sourceMappingURL=index.es.js.map
|