@jbpark/ui-kit 2.4.0 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/dist/Menu.d.mts +2 -2
  2. package/dist/Menu.d.mts.map +1 -1
  3. package/dist/Menu.mjs +4 -4
  4. package/dist/Menu.mjs.map +1 -1
  5. package/dist/components/atoms/Button/index.mjs +3 -3
  6. package/dist/components/atoms/Button/index.mjs.map +1 -1
  7. package/dist/components/atoms/Checkbox/index.mjs +3 -3
  8. package/dist/components/atoms/Checkbox/index.mjs.map +1 -1
  9. package/dist/components/atoms/Radio/index.mjs +2 -2
  10. package/dist/components/atoms/Switch/index.d.mts.map +1 -1
  11. package/dist/components/atoms/Switch/index.mjs +16 -15
  12. package/dist/components/atoms/Switch/index.mjs.map +1 -1
  13. package/dist/components/molecules/Marquees/Item/index.mjs +2 -2
  14. package/dist/components/molecules/Marquees/Item/index.mjs.map +1 -1
  15. package/dist/components/molecules/Space/index.mjs +2 -2
  16. package/dist/components/molecules/Space/index.mjs.map +1 -1
  17. package/dist/components/molecules/Splitter/index.d.mts +31 -0
  18. package/dist/components/molecules/Splitter/index.d.mts.map +1 -0
  19. package/dist/components/molecules/Splitter/index.mjs +37 -0
  20. package/dist/components/molecules/Splitter/index.mjs.map +1 -0
  21. package/dist/components/molecules/index.d.mts +1 -0
  22. package/dist/components/molecules/index.mjs +1 -0
  23. package/dist/components/organisms/Drawer/index.d.mts +7 -2
  24. package/dist/components/organisms/Drawer/index.d.mts.map +1 -1
  25. package/dist/components/organisms/Drawer/index.mjs +46 -22
  26. package/dist/components/organisms/Drawer/index.mjs.map +1 -1
  27. package/dist/components/organisms/Modal/index.mjs +3 -3
  28. package/dist/components/organisms/Modal/index.mjs.map +1 -1
  29. package/dist/components/organisms/index.d.mts +1 -1
  30. package/dist/components/templates/Layout/Content/index.d.mts +7 -1
  31. package/dist/components/templates/Layout/Content/index.d.mts.map +1 -0
  32. package/dist/components/templates/Layout/Content/index.mjs +2 -2
  33. package/dist/components/templates/Layout/Content/index.mjs.map +1 -1
  34. package/dist/components/templates/Layout/Footer/index.d.mts +7 -1
  35. package/dist/components/templates/Layout/Footer/index.d.mts.map +1 -0
  36. package/dist/components/templates/Layout/Footer/index.mjs +2 -2
  37. package/dist/components/templates/Layout/Footer/index.mjs.map +1 -1
  38. package/dist/components/templates/Layout/Header/index.d.mts +1 -1
  39. package/dist/components/templates/Layout/Header/index.mjs +2 -2
  40. package/dist/components/templates/Layout/Header/index.mjs.map +1 -1
  41. package/dist/components/templates/Layout/Sider/index.d.mts +19 -1
  42. package/dist/components/templates/Layout/Sider/index.d.mts.map +1 -0
  43. package/dist/components/templates/Layout/Sider/index.mjs +32 -5
  44. package/dist/components/templates/Layout/Sider/index.mjs.map +1 -1
  45. package/dist/components/templates/Layout/index.d.mts +18 -8
  46. package/dist/components/templates/Layout/index.d.mts.map +1 -1
  47. package/dist/components/templates/Layout/index.mjs +3 -1
  48. package/dist/components/templates/Layout/index.mjs.map +1 -1
  49. package/dist/core/resizable.d.mts +24 -0
  50. package/dist/core/resizable.d.mts.map +1 -0
  51. package/dist/core/resizable.mjs +52 -0
  52. package/dist/core/resizable.mjs.map +1 -0
  53. package/dist/core.d.mts +2 -1
  54. package/dist/core.mjs +2 -1
  55. package/dist/index.d.mts +7 -2
  56. package/dist/index.mjs +5 -1
  57. package/dist/providers/Config/context.d.mts +8 -0
  58. package/dist/providers/Config/context.d.mts.map +1 -0
  59. package/dist/providers/Config/context.mjs +11 -0
  60. package/dist/providers/Config/context.mjs.map +1 -0
  61. package/dist/providers/Config/index.d.mts +18 -0
  62. package/dist/providers/Config/index.d.mts.map +1 -0
  63. package/dist/providers/Config/index.mjs +67 -0
  64. package/dist/providers/Config/index.mjs.map +1 -0
  65. package/dist/providers/Config/types.d.mts +32 -0
  66. package/dist/providers/Config/types.d.mts.map +1 -0
  67. package/dist/providers/index.d.mts +3 -0
  68. package/dist/providers/index.mjs +4 -0
  69. package/dist/style.css +218 -56
  70. package/dist/utils.d.mts +2 -2
  71. package/dist/utils.d.mts.map +1 -1
  72. package/dist/utils.mjs +4 -4
  73. package/dist/utils.mjs.map +1 -1
  74. package/package.json +15 -11
  75. package/dist/node_modules/gsap/CSSPlugin.mjs +0 -920
  76. package/dist/node_modules/gsap/CSSPlugin.mjs.map +0 -1
  77. package/dist/node_modules/gsap/gsap-core.mjs +0 -2723
  78. package/dist/node_modules/gsap/gsap-core.mjs.map +0 -1
  79. package/dist/node_modules/gsap/index.mjs +0 -9
  80. package/dist/node_modules/gsap/index.mjs.map +0 -1
@@ -1,2723 +0,0 @@
1
- //#region ../../node_modules/gsap/gsap-core.js
2
- function _assertThisInitialized(self) {
3
- if (self === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
4
- return self;
5
- }
6
- function _inheritsLoose(subClass, superClass) {
7
- subClass.prototype = Object.create(superClass.prototype);
8
- subClass.prototype.constructor = subClass;
9
- subClass.__proto__ = superClass;
10
- }
11
- /*!
12
- * GSAP 3.14.2
13
- * https://gsap.com
14
- *
15
- * @license Copyright 2008-2025, GreenSock. All rights reserved.
16
- * Subject to the terms at https://gsap.com/standard-license
17
- * @author: Jack Doyle, jack@greensock.com
18
- */
19
- var _config = {
20
- autoSleep: 120,
21
- force3D: "auto",
22
- nullTargetWarn: 1,
23
- units: { lineHeight: "" }
24
- }, _defaults = {
25
- duration: .5,
26
- overwrite: false,
27
- delay: 0
28
- }, _suppressOverwrites, _reverting, _context, _bigNum = 1e8, _tinyNum = 1 / _bigNum, _2PI = Math.PI * 2, _HALF_PI = _2PI / 4, _gsID = 0, _sqrt = Math.sqrt, _cos = Math.cos, _sin = Math.sin, _isString = function _isString(value) {
29
- return typeof value === "string";
30
- }, _isFunction = function _isFunction(value) {
31
- return typeof value === "function";
32
- }, _isNumber = function _isNumber(value) {
33
- return typeof value === "number";
34
- }, _isUndefined = function _isUndefined(value) {
35
- return typeof value === "undefined";
36
- }, _isObject = function _isObject(value) {
37
- return typeof value === "object";
38
- }, _isNotFalse = function _isNotFalse(value) {
39
- return value !== false;
40
- }, _windowExists = function _windowExists() {
41
- return typeof window !== "undefined";
42
- }, _isFuncOrString = function _isFuncOrString(value) {
43
- return _isFunction(value) || _isString(value);
44
- }, _isTypedArray = typeof ArrayBuffer === "function" && ArrayBuffer.isView || function() {}, _isArray = Array.isArray, _randomExp = /random\([^)]+\)/g, _commaDelimExp = /,\s*/g, _strictNumExp = /(?:-?\.?\d|\.)+/gi, _numExp = /[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g, _numWithUnitExp = /[-+=.]*\d+[.e-]*\d*[a-z%]*/g, _complexStringNumExp = /[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi, _relExp = /[+-]=-?[.\d]+/, _delimitedValueExp = /[^,'"\[\]\s]+/gi, _unitExp = /^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i, _globalTimeline, _win, _coreInitted, _doc, _globals = {}, _installScope = {}, _coreReady, _install = function _install(scope) {
45
- return (_installScope = _merge(scope, _globals)) && gsap;
46
- }, _missingPlugin = function _missingPlugin(property, value) {
47
- return console.warn("Invalid property", property, "set to", value, "Missing plugin? gsap.registerPlugin()");
48
- }, _warn = function _warn(message, suppress) {
49
- return !suppress && console.warn(message);
50
- }, _addGlobal = function _addGlobal(name, obj) {
51
- return name && (_globals[name] = obj) && _installScope && (_installScope[name] = obj) || _globals;
52
- }, _emptyFunc = function _emptyFunc() {
53
- return 0;
54
- }, _startAtRevertConfig = {
55
- suppressEvents: true,
56
- isStart: true,
57
- kill: false
58
- }, _revertConfigNoKill = {
59
- suppressEvents: true,
60
- kill: false
61
- }, _revertConfig = { suppressEvents: true }, _reservedProps = {}, _lazyTweens = [], _lazyLookup = {}, _lastRenderedFrame, _plugins = {}, _effects = {}, _nextGCFrame = 30, _harnessPlugins = [], _callbackNames = "", _harness = function _harness(targets) {
62
- var target = targets[0], harnessPlugin, i;
63
- _isObject(target) || _isFunction(target) || (targets = [targets]);
64
- if (!(harnessPlugin = (target._gsap || {}).harness)) {
65
- i = _harnessPlugins.length;
66
- while (i-- && !_harnessPlugins[i].targetTest(target));
67
- harnessPlugin = _harnessPlugins[i];
68
- }
69
- i = targets.length;
70
- while (i--) targets[i] && (targets[i]._gsap || (targets[i]._gsap = new GSCache(targets[i], harnessPlugin))) || targets.splice(i, 1);
71
- return targets;
72
- }, _getCache = function _getCache(target) {
73
- return target._gsap || _harness(toArray(target))[0]._gsap;
74
- }, _getProperty = function _getProperty(target, property, v) {
75
- return (v = target[property]) && _isFunction(v) ? target[property]() : _isUndefined(v) && target.getAttribute && target.getAttribute(property) || v;
76
- }, _forEachName = function _forEachName(names, func) {
77
- return (names = names.split(",")).forEach(func) || names;
78
- }, _round = function _round(value) {
79
- return Math.round(value * 1e5) / 1e5 || 0;
80
- }, _roundPrecise = function _roundPrecise(value) {
81
- return Math.round(value * 1e7) / 1e7 || 0;
82
- }, _parseRelative = function _parseRelative(start, value) {
83
- var operator = value.charAt(0), end = parseFloat(value.substr(2));
84
- start = parseFloat(start);
85
- return operator === "+" ? start + end : operator === "-" ? start - end : operator === "*" ? start * end : start / end;
86
- }, _arrayContainsAny = function _arrayContainsAny(toSearch, toFind) {
87
- var l = toFind.length, i = 0;
88
- for (; toSearch.indexOf(toFind[i]) < 0 && ++i < l;);
89
- return i < l;
90
- }, _lazyRender = function _lazyRender() {
91
- var l = _lazyTweens.length, a = _lazyTweens.slice(0), i, tween;
92
- _lazyLookup = {};
93
- _lazyTweens.length = 0;
94
- for (i = 0; i < l; i++) {
95
- tween = a[i];
96
- tween && tween._lazy && (tween.render(tween._lazy[0], tween._lazy[1], true)._lazy = 0);
97
- }
98
- }, _isRevertWorthy = function _isRevertWorthy(animation) {
99
- return !!(animation._initted || animation._startAt || animation.add);
100
- }, _lazySafeRender = function _lazySafeRender(animation, time, suppressEvents, force) {
101
- _lazyTweens.length && !_reverting && _lazyRender();
102
- animation.render(time, suppressEvents, force || !!(_reverting && time < 0 && _isRevertWorthy(animation)));
103
- _lazyTweens.length && !_reverting && _lazyRender();
104
- }, _numericIfPossible = function _numericIfPossible(value) {
105
- var n = parseFloat(value);
106
- return (n || n === 0) && (value + "").match(_delimitedValueExp).length < 2 ? n : _isString(value) ? value.trim() : value;
107
- }, _passThrough = function _passThrough(p) {
108
- return p;
109
- }, _setDefaults = function _setDefaults(obj, defaults) {
110
- for (var p in defaults) p in obj || (obj[p] = defaults[p]);
111
- return obj;
112
- }, _setKeyframeDefaults = function _setKeyframeDefaults(excludeDuration) {
113
- return function(obj, defaults) {
114
- for (var p in defaults) p in obj || p === "duration" && excludeDuration || p === "ease" || (obj[p] = defaults[p]);
115
- };
116
- }, _merge = function _merge(base, toMerge) {
117
- for (var p in toMerge) base[p] = toMerge[p];
118
- return base;
119
- }, _mergeDeep = function _mergeDeep(base, toMerge) {
120
- for (var p in toMerge) p !== "__proto__" && p !== "constructor" && p !== "prototype" && (base[p] = _isObject(toMerge[p]) ? _mergeDeep(base[p] || (base[p] = {}), toMerge[p]) : toMerge[p]);
121
- return base;
122
- }, _copyExcluding = function _copyExcluding(obj, excluding) {
123
- var copy = {}, p;
124
- for (p in obj) p in excluding || (copy[p] = obj[p]);
125
- return copy;
126
- }, _inheritDefaults = function _inheritDefaults(vars) {
127
- var parent = vars.parent || _globalTimeline, func = vars.keyframes ? _setKeyframeDefaults(_isArray(vars.keyframes)) : _setDefaults;
128
- if (_isNotFalse(vars.inherit)) while (parent) {
129
- func(vars, parent.vars.defaults);
130
- parent = parent.parent || parent._dp;
131
- }
132
- return vars;
133
- }, _arraysMatch = function _arraysMatch(a1, a2) {
134
- var i = a1.length, match = i === a2.length;
135
- while (match && i-- && a1[i] === a2[i]);
136
- return i < 0;
137
- }, _addLinkedListItem = function _addLinkedListItem(parent, child, firstProp, lastProp, sortBy) {
138
- if (firstProp === void 0) firstProp = "_first";
139
- if (lastProp === void 0) lastProp = "_last";
140
- var prev = parent[lastProp], t;
141
- if (sortBy) {
142
- t = child[sortBy];
143
- while (prev && prev[sortBy] > t) prev = prev._prev;
144
- }
145
- if (prev) {
146
- child._next = prev._next;
147
- prev._next = child;
148
- } else {
149
- child._next = parent[firstProp];
150
- parent[firstProp] = child;
151
- }
152
- if (child._next) child._next._prev = child;
153
- else parent[lastProp] = child;
154
- child._prev = prev;
155
- child.parent = child._dp = parent;
156
- return child;
157
- }, _removeLinkedListItem = function _removeLinkedListItem(parent, child, firstProp, lastProp) {
158
- if (firstProp === void 0) firstProp = "_first";
159
- if (lastProp === void 0) lastProp = "_last";
160
- var prev = child._prev, next = child._next;
161
- if (prev) prev._next = next;
162
- else if (parent[firstProp] === child) parent[firstProp] = next;
163
- if (next) next._prev = prev;
164
- else if (parent[lastProp] === child) parent[lastProp] = prev;
165
- child._next = child._prev = child.parent = null;
166
- }, _removeFromParent = function _removeFromParent(child, onlyIfParentHasAutoRemove) {
167
- child.parent && (!onlyIfParentHasAutoRemove || child.parent.autoRemoveChildren) && child.parent.remove && child.parent.remove(child);
168
- child._act = 0;
169
- }, _uncache = function _uncache(animation, child) {
170
- if (animation && (!child || child._end > animation._dur || child._start < 0)) {
171
- var a = animation;
172
- while (a) {
173
- a._dirty = 1;
174
- a = a.parent;
175
- }
176
- }
177
- return animation;
178
- }, _recacheAncestors = function _recacheAncestors(animation) {
179
- var parent = animation.parent;
180
- while (parent && parent.parent) {
181
- parent._dirty = 1;
182
- parent.totalDuration();
183
- parent = parent.parent;
184
- }
185
- return animation;
186
- }, _rewindStartAt = function _rewindStartAt(tween, totalTime, suppressEvents, force) {
187
- return tween._startAt && (_reverting ? tween._startAt.revert(_revertConfigNoKill) : tween.vars.immediateRender && !tween.vars.autoRevert || tween._startAt.render(totalTime, true, force));
188
- }, _hasNoPausedAncestors = function _hasNoPausedAncestors(animation) {
189
- return !animation || animation._ts && _hasNoPausedAncestors(animation.parent);
190
- }, _elapsedCycleDuration = function _elapsedCycleDuration(animation) {
191
- return animation._repeat ? _animationCycle(animation._tTime, animation = animation.duration() + animation._rDelay) * animation : 0;
192
- }, _animationCycle = function _animationCycle(tTime, cycleDuration) {
193
- var whole = Math.floor(tTime = _roundPrecise(tTime / cycleDuration));
194
- return tTime && whole === tTime ? whole - 1 : whole;
195
- }, _parentToChildTotalTime = function _parentToChildTotalTime(parentTime, child) {
196
- return (parentTime - child._start) * child._ts + (child._ts >= 0 ? 0 : child._dirty ? child.totalDuration() : child._tDur);
197
- }, _setEnd = function _setEnd(animation) {
198
- return animation._end = _roundPrecise(animation._start + (animation._tDur / Math.abs(animation._ts || animation._rts || _tinyNum) || 0));
199
- }, _alignPlayhead = function _alignPlayhead(animation, totalTime) {
200
- var parent = animation._dp;
201
- if (parent && parent.smoothChildTiming && animation._ts) {
202
- animation._start = _roundPrecise(parent._time - (animation._ts > 0 ? totalTime / animation._ts : ((animation._dirty ? animation.totalDuration() : animation._tDur) - totalTime) / -animation._ts));
203
- _setEnd(animation);
204
- parent._dirty || _uncache(parent, animation);
205
- }
206
- return animation;
207
- }, _postAddChecks = function _postAddChecks(timeline, child) {
208
- var t;
209
- if (child._time || !child._dur && child._initted || child._start < timeline._time && (child._dur || !child.add)) {
210
- t = _parentToChildTotalTime(timeline.rawTime(), child);
211
- if (!child._dur || _clamp(0, child.totalDuration(), t) - child._tTime > _tinyNum) child.render(t, true);
212
- }
213
- if (_uncache(timeline, child)._dp && timeline._initted && timeline._time >= timeline._dur && timeline._ts) {
214
- if (timeline._dur < timeline.duration()) {
215
- t = timeline;
216
- while (t._dp) {
217
- t.rawTime() >= 0 && t.totalTime(t._tTime);
218
- t = t._dp;
219
- }
220
- }
221
- timeline._zTime = -_tinyNum;
222
- }
223
- }, _addToTimeline = function _addToTimeline(timeline, child, position, skipChecks) {
224
- child.parent && _removeFromParent(child);
225
- child._start = _roundPrecise((_isNumber(position) ? position : position || timeline !== _globalTimeline ? _parsePosition(timeline, position, child) : timeline._time) + child._delay);
226
- child._end = _roundPrecise(child._start + (child.totalDuration() / Math.abs(child.timeScale()) || 0));
227
- _addLinkedListItem(timeline, child, "_first", "_last", timeline._sort ? "_start" : 0);
228
- _isFromOrFromStart(child) || (timeline._recent = child);
229
- skipChecks || _postAddChecks(timeline, child);
230
- timeline._ts < 0 && _alignPlayhead(timeline, timeline._tTime);
231
- return timeline;
232
- }, _scrollTrigger = function _scrollTrigger(animation, trigger) {
233
- return (_globals.ScrollTrigger || _missingPlugin("scrollTrigger", trigger)) && _globals.ScrollTrigger.create(trigger, animation);
234
- }, _attemptInitTween = function _attemptInitTween(tween, time, force, suppressEvents, tTime) {
235
- _initTween(tween, time, tTime);
236
- if (!tween._initted) return 1;
237
- if (!force && tween._pt && !_reverting && (tween._dur && tween.vars.lazy !== false || !tween._dur && tween.vars.lazy) && _lastRenderedFrame !== _ticker.frame) {
238
- _lazyTweens.push(tween);
239
- tween._lazy = [tTime, suppressEvents];
240
- return 1;
241
- }
242
- }, _parentPlayheadIsBeforeStart = function _parentPlayheadIsBeforeStart(_ref) {
243
- var parent = _ref.parent;
244
- return parent && parent._ts && parent._initted && !parent._lock && (parent.rawTime() < 0 || _parentPlayheadIsBeforeStart(parent));
245
- }, _isFromOrFromStart = function _isFromOrFromStart(_ref2) {
246
- var data = _ref2.data;
247
- return data === "isFromStart" || data === "isStart";
248
- }, _renderZeroDurationTween = function _renderZeroDurationTween(tween, totalTime, suppressEvents, force) {
249
- var prevRatio = tween.ratio, ratio = totalTime < 0 || !totalTime && (!tween._start && _parentPlayheadIsBeforeStart(tween) && !(!tween._initted && _isFromOrFromStart(tween)) || (tween._ts < 0 || tween._dp._ts < 0) && !_isFromOrFromStart(tween)) ? 0 : 1, repeatDelay = tween._rDelay, tTime = 0, pt, iteration, prevIteration;
250
- if (repeatDelay && tween._repeat) {
251
- tTime = _clamp(0, tween._tDur, totalTime);
252
- iteration = _animationCycle(tTime, repeatDelay);
253
- tween._yoyo && iteration & 1 && (ratio = 1 - ratio);
254
- if (iteration !== _animationCycle(tween._tTime, repeatDelay)) {
255
- prevRatio = 1 - ratio;
256
- tween.vars.repeatRefresh && tween._initted && tween.invalidate();
257
- }
258
- }
259
- if (ratio !== prevRatio || _reverting || force || tween._zTime === _tinyNum || !totalTime && tween._zTime) {
260
- if (!tween._initted && _attemptInitTween(tween, totalTime, force, suppressEvents, tTime)) return;
261
- prevIteration = tween._zTime;
262
- tween._zTime = totalTime || (suppressEvents ? _tinyNum : 0);
263
- suppressEvents || (suppressEvents = totalTime && !prevIteration);
264
- tween.ratio = ratio;
265
- tween._from && (ratio = 1 - ratio);
266
- tween._time = 0;
267
- tween._tTime = tTime;
268
- pt = tween._pt;
269
- while (pt) {
270
- pt.r(ratio, pt.d);
271
- pt = pt._next;
272
- }
273
- totalTime < 0 && _rewindStartAt(tween, totalTime, suppressEvents, true);
274
- tween._onUpdate && !suppressEvents && _callback(tween, "onUpdate");
275
- tTime && tween._repeat && !suppressEvents && tween.parent && _callback(tween, "onRepeat");
276
- if ((totalTime >= tween._tDur || totalTime < 0) && tween.ratio === ratio) {
277
- ratio && _removeFromParent(tween, 1);
278
- if (!suppressEvents && !_reverting) {
279
- _callback(tween, ratio ? "onComplete" : "onReverseComplete", true);
280
- tween._prom && tween._prom();
281
- }
282
- }
283
- } else if (!tween._zTime) tween._zTime = totalTime;
284
- }, _findNextPauseTween = function _findNextPauseTween(animation, prevTime, time) {
285
- var child;
286
- if (time > prevTime) {
287
- child = animation._first;
288
- while (child && child._start <= time) {
289
- if (child.data === "isPause" && child._start > prevTime) return child;
290
- child = child._next;
291
- }
292
- } else {
293
- child = animation._last;
294
- while (child && child._start >= time) {
295
- if (child.data === "isPause" && child._start < prevTime) return child;
296
- child = child._prev;
297
- }
298
- }
299
- }, _setDuration = function _setDuration(animation, duration, skipUncache, leavePlayhead) {
300
- var repeat = animation._repeat, dur = _roundPrecise(duration) || 0, totalProgress = animation._tTime / animation._tDur;
301
- totalProgress && !leavePlayhead && (animation._time *= dur / animation._dur);
302
- animation._dur = dur;
303
- animation._tDur = !repeat ? dur : repeat < 0 ? 1e10 : _roundPrecise(dur * (repeat + 1) + animation._rDelay * repeat);
304
- totalProgress > 0 && !leavePlayhead && _alignPlayhead(animation, animation._tTime = animation._tDur * totalProgress);
305
- animation.parent && _setEnd(animation);
306
- skipUncache || _uncache(animation.parent, animation);
307
- return animation;
308
- }, _onUpdateTotalDuration = function _onUpdateTotalDuration(animation) {
309
- return animation instanceof Timeline ? _uncache(animation) : _setDuration(animation, animation._dur);
310
- }, _zeroPosition = {
311
- _start: 0,
312
- endTime: _emptyFunc,
313
- totalDuration: _emptyFunc
314
- }, _parsePosition = function _parsePosition(animation, position, percentAnimation) {
315
- var labels = animation.labels, recent = animation._recent || _zeroPosition, clippedDuration = animation.duration() >= _bigNum ? recent.endTime(false) : animation._dur, i, offset, isPercent;
316
- if (_isString(position) && (isNaN(position) || position in labels)) {
317
- offset = position.charAt(0);
318
- isPercent = position.substr(-1) === "%";
319
- i = position.indexOf("=");
320
- if (offset === "<" || offset === ">") {
321
- i >= 0 && (position = position.replace(/=/, ""));
322
- return (offset === "<" ? recent._start : recent.endTime(recent._repeat >= 0)) + (parseFloat(position.substr(1)) || 0) * (isPercent ? (i < 0 ? recent : percentAnimation).totalDuration() / 100 : 1);
323
- }
324
- if (i < 0) {
325
- position in labels || (labels[position] = clippedDuration);
326
- return labels[position];
327
- }
328
- offset = parseFloat(position.charAt(i - 1) + position.substr(i + 1));
329
- if (isPercent && percentAnimation) offset = offset / 100 * (_isArray(percentAnimation) ? percentAnimation[0] : percentAnimation).totalDuration();
330
- return i > 1 ? _parsePosition(animation, position.substr(0, i - 1), percentAnimation) + offset : clippedDuration + offset;
331
- }
332
- return position == null ? clippedDuration : +position;
333
- }, _createTweenType = function _createTweenType(type, params, timeline) {
334
- var isLegacy = _isNumber(params[1]), varsIndex = (isLegacy ? 2 : 1) + (type < 2 ? 0 : 1), vars = params[varsIndex], irVars, parent;
335
- isLegacy && (vars.duration = params[1]);
336
- vars.parent = timeline;
337
- if (type) {
338
- irVars = vars;
339
- parent = timeline;
340
- while (parent && !("immediateRender" in irVars)) {
341
- irVars = parent.vars.defaults || {};
342
- parent = _isNotFalse(parent.vars.inherit) && parent.parent;
343
- }
344
- vars.immediateRender = _isNotFalse(irVars.immediateRender);
345
- type < 2 ? vars.runBackwards = 1 : vars.startAt = params[varsIndex - 1];
346
- }
347
- return new Tween(params[0], vars, params[varsIndex + 1]);
348
- }, _conditionalReturn = function _conditionalReturn(value, func) {
349
- return value || value === 0 ? func(value) : func;
350
- }, _clamp = function _clamp(min, max, value) {
351
- return value < min ? min : value > max ? max : value;
352
- }, getUnit = function getUnit(value, v) {
353
- return !_isString(value) || !(v = _unitExp.exec(value)) ? "" : v[1];
354
- }, clamp = function clamp(min, max, value) {
355
- return _conditionalReturn(value, function(v) {
356
- return _clamp(min, max, v);
357
- });
358
- }, _slice = [].slice, _isArrayLike = function _isArrayLike(value, nonEmpty) {
359
- return value && _isObject(value) && "length" in value && (!nonEmpty && !value.length || value.length - 1 in value && _isObject(value[0])) && !value.nodeType && value !== _win;
360
- }, _flatten = function _flatten(ar, leaveStrings, accumulator) {
361
- if (accumulator === void 0) accumulator = [];
362
- return ar.forEach(function(value) {
363
- var _accumulator;
364
- return _isString(value) && !leaveStrings || _isArrayLike(value, 1) ? (_accumulator = accumulator).push.apply(_accumulator, toArray(value)) : accumulator.push(value);
365
- }) || accumulator;
366
- }, toArray = function toArray(value, scope, leaveStrings) {
367
- return _context && !scope && _context.selector ? _context.selector(value) : _isString(value) && !leaveStrings && (_coreInitted || !_wake()) ? _slice.call((scope || _doc).querySelectorAll(value), 0) : _isArray(value) ? _flatten(value, leaveStrings) : _isArrayLike(value) ? _slice.call(value, 0) : value ? [value] : [];
368
- }, selector = function selector(value) {
369
- value = toArray(value)[0] || _warn("Invalid scope") || {};
370
- return function(v) {
371
- var el = value.current || value.nativeElement || value;
372
- return toArray(v, el.querySelectorAll ? el : el === value ? _warn("Invalid scope") || _doc.createElement("div") : value);
373
- };
374
- }, shuffle = function shuffle(a) {
375
- return a.sort(function() {
376
- return .5 - Math.random();
377
- });
378
- }, distribute = function distribute(v) {
379
- if (_isFunction(v)) return v;
380
- var vars = _isObject(v) ? v : { each: v }, ease = _parseEase(vars.ease), from = vars.from || 0, base = parseFloat(vars.base) || 0, cache = {}, isDecimal = from > 0 && from < 1, ratios = isNaN(from) || isDecimal, axis = vars.axis, ratioX = from, ratioY = from;
381
- if (_isString(from)) ratioX = ratioY = {
382
- center: .5,
383
- edges: .5,
384
- end: 1
385
- }[from] || 0;
386
- else if (!isDecimal && ratios) {
387
- ratioX = from[0];
388
- ratioY = from[1];
389
- }
390
- return function(i, target, a) {
391
- var l = (a || vars).length, distances = cache[l], originX, originY, x, y, d, j, max, min, wrapAt;
392
- if (!distances) {
393
- wrapAt = vars.grid === "auto" ? 0 : (vars.grid || [1, _bigNum])[1];
394
- if (!wrapAt) {
395
- max = -_bigNum;
396
- while (max < (max = a[wrapAt++].getBoundingClientRect().left) && wrapAt < l);
397
- wrapAt < l && wrapAt--;
398
- }
399
- distances = cache[l] = [];
400
- originX = ratios ? Math.min(wrapAt, l) * ratioX - .5 : from % wrapAt;
401
- originY = wrapAt === _bigNum ? 0 : ratios ? l * ratioY / wrapAt - .5 : from / wrapAt | 0;
402
- max = 0;
403
- min = _bigNum;
404
- for (j = 0; j < l; j++) {
405
- x = j % wrapAt - originX;
406
- y = originY - (j / wrapAt | 0);
407
- distances[j] = d = !axis ? _sqrt(x * x + y * y) : Math.abs(axis === "y" ? y : x);
408
- d > max && (max = d);
409
- d < min && (min = d);
410
- }
411
- from === "random" && shuffle(distances);
412
- distances.max = max - min;
413
- distances.min = min;
414
- distances.v = l = (parseFloat(vars.amount) || parseFloat(vars.each) * (wrapAt > l ? l - 1 : !axis ? Math.max(wrapAt, l / wrapAt) : axis === "y" ? l / wrapAt : wrapAt) || 0) * (from === "edges" ? -1 : 1);
415
- distances.b = l < 0 ? base - l : base;
416
- distances.u = getUnit(vars.amount || vars.each) || 0;
417
- ease = ease && l < 0 ? _invertEase(ease) : ease;
418
- }
419
- l = (distances[i] - distances.min) / distances.max || 0;
420
- return _roundPrecise(distances.b + (ease ? ease(l) : l) * distances.v) + distances.u;
421
- };
422
- }, _roundModifier = function _roundModifier(v) {
423
- var p = Math.pow(10, ((v + "").split(".")[1] || "").length);
424
- return function(raw) {
425
- var n = _roundPrecise(Math.round(parseFloat(raw) / v) * v * p);
426
- return (n - n % 1) / p + (_isNumber(raw) ? 0 : getUnit(raw));
427
- };
428
- }, snap = function snap(snapTo, value) {
429
- var isArray = _isArray(snapTo), radius, is2D;
430
- if (!isArray && _isObject(snapTo)) {
431
- radius = isArray = snapTo.radius || _bigNum;
432
- if (snapTo.values) {
433
- snapTo = toArray(snapTo.values);
434
- if (is2D = !_isNumber(snapTo[0])) radius *= radius;
435
- } else snapTo = _roundModifier(snapTo.increment);
436
- }
437
- return _conditionalReturn(value, !isArray ? _roundModifier(snapTo) : _isFunction(snapTo) ? function(raw) {
438
- is2D = snapTo(raw);
439
- return Math.abs(is2D - raw) <= radius ? is2D : raw;
440
- } : function(raw) {
441
- var x = parseFloat(is2D ? raw.x : raw), y = parseFloat(is2D ? raw.y : 0), min = _bigNum, closest = 0, i = snapTo.length, dx, dy;
442
- while (i--) {
443
- if (is2D) {
444
- dx = snapTo[i].x - x;
445
- dy = snapTo[i].y - y;
446
- dx = dx * dx + dy * dy;
447
- } else dx = Math.abs(snapTo[i] - x);
448
- if (dx < min) {
449
- min = dx;
450
- closest = i;
451
- }
452
- }
453
- closest = !radius || min <= radius ? snapTo[closest] : raw;
454
- return is2D || closest === raw || _isNumber(raw) ? closest : closest + getUnit(raw);
455
- });
456
- }, random = function random(min, max, roundingIncrement, returnFunction) {
457
- return _conditionalReturn(_isArray(min) ? !max : roundingIncrement === true ? !!(roundingIncrement = 0) : !returnFunction, function() {
458
- return _isArray(min) ? min[~~(Math.random() * min.length)] : (roundingIncrement = roundingIncrement || 1e-5) && (returnFunction = roundingIncrement < 1 ? Math.pow(10, (roundingIncrement + "").length - 2) : 1) && Math.floor(Math.round((min - roundingIncrement / 2 + Math.random() * (max - min + roundingIncrement * .99)) / roundingIncrement) * roundingIncrement * returnFunction) / returnFunction;
459
- });
460
- }, pipe = function pipe() {
461
- for (var _len = arguments.length, functions = new Array(_len), _key = 0; _key < _len; _key++) functions[_key] = arguments[_key];
462
- return function(value) {
463
- return functions.reduce(function(v, f) {
464
- return f(v);
465
- }, value);
466
- };
467
- }, unitize = function unitize(func, unit) {
468
- return function(value) {
469
- return func(parseFloat(value)) + (unit || getUnit(value));
470
- };
471
- }, normalize = function normalize(min, max, value) {
472
- return mapRange(min, max, 0, 1, value);
473
- }, _wrapArray = function _wrapArray(a, wrapper, value) {
474
- return _conditionalReturn(value, function(index) {
475
- return a[~~wrapper(index)];
476
- });
477
- }, wrap = function wrap(min, max, value) {
478
- var range = max - min;
479
- return _isArray(min) ? _wrapArray(min, wrap(0, min.length), max) : _conditionalReturn(value, function(value) {
480
- return (range + (value - min) % range) % range + min;
481
- });
482
- }, wrapYoyo = function wrapYoyo(min, max, value) {
483
- var range = max - min, total = range * 2;
484
- return _isArray(min) ? _wrapArray(min, wrapYoyo(0, min.length - 1), max) : _conditionalReturn(value, function(value) {
485
- value = (total + (value - min) % total) % total || 0;
486
- return min + (value > range ? total - value : value);
487
- });
488
- }, _replaceRandom = function _replaceRandom(s) {
489
- return s.replace(_randomExp, function(match) {
490
- var arIndex = match.indexOf("[") + 1, values = match.substring(arIndex || 7, arIndex ? match.indexOf("]") : match.length - 1).split(_commaDelimExp);
491
- return random(arIndex ? values : +values[0], arIndex ? 0 : +values[1], +values[2] || 1e-5);
492
- });
493
- }, mapRange = function mapRange(inMin, inMax, outMin, outMax, value) {
494
- var inRange = inMax - inMin, outRange = outMax - outMin;
495
- return _conditionalReturn(value, function(value) {
496
- return outMin + ((value - inMin) / inRange * outRange || 0);
497
- });
498
- }, interpolate = function interpolate(start, end, progress, mutate) {
499
- var func = isNaN(start + end) ? 0 : function(p) {
500
- return (1 - p) * start + p * end;
501
- };
502
- if (!func) {
503
- var isString = _isString(start), master = {}, p, i, interpolators, l, il;
504
- progress === true && (mutate = 1) && (progress = null);
505
- if (isString) {
506
- start = { p: start };
507
- end = { p: end };
508
- } else if (_isArray(start) && !_isArray(end)) {
509
- interpolators = [];
510
- l = start.length;
511
- il = l - 2;
512
- for (i = 1; i < l; i++) interpolators.push(interpolate(start[i - 1], start[i]));
513
- l--;
514
- func = function func(p) {
515
- p *= l;
516
- var i = Math.min(il, ~~p);
517
- return interpolators[i](p - i);
518
- };
519
- progress = end;
520
- } else if (!mutate) start = _merge(_isArray(start) ? [] : {}, start);
521
- if (!interpolators) {
522
- for (p in end) _addPropTween.call(master, start, p, "get", end[p]);
523
- func = function func(p) {
524
- return _renderPropTweens(p, master) || (isString ? start.p : start);
525
- };
526
- }
527
- }
528
- return _conditionalReturn(progress, func);
529
- }, _getLabelInDirection = function _getLabelInDirection(timeline, fromTime, backward) {
530
- var labels = timeline.labels, min = _bigNum, p, distance, label;
531
- for (p in labels) {
532
- distance = labels[p] - fromTime;
533
- if (distance < 0 === !!backward && distance && min > (distance = Math.abs(distance))) {
534
- label = p;
535
- min = distance;
536
- }
537
- }
538
- return label;
539
- }, _callback = function _callback(animation, type, executeLazyFirst) {
540
- var v = animation.vars, callback = v[type], prevContext = _context, context = animation._ctx, params, scope, result;
541
- if (!callback) return;
542
- params = v[type + "Params"];
543
- scope = v.callbackScope || animation;
544
- executeLazyFirst && _lazyTweens.length && _lazyRender();
545
- context && (_context = context);
546
- result = params ? callback.apply(scope, params) : callback.call(scope);
547
- _context = prevContext;
548
- return result;
549
- }, _interrupt = function _interrupt(animation) {
550
- _removeFromParent(animation);
551
- animation.scrollTrigger && animation.scrollTrigger.kill(!!_reverting);
552
- animation.progress() < 1 && _callback(animation, "onInterrupt");
553
- return animation;
554
- }, _quickTween, _registerPluginQueue = [], _createPlugin = function _createPlugin(config) {
555
- if (!config) return;
556
- config = !config.name && config["default"] || config;
557
- if (_windowExists() || config.headless) {
558
- var name = config.name, isFunc = _isFunction(config), Plugin = name && !isFunc && config.init ? function() {
559
- this._props = [];
560
- } : config, instanceDefaults = {
561
- init: _emptyFunc,
562
- render: _renderPropTweens,
563
- add: _addPropTween,
564
- kill: _killPropTweensOf,
565
- modifier: _addPluginModifier,
566
- rawVars: 0
567
- }, statics = {
568
- targetTest: 0,
569
- get: 0,
570
- getSetter: _getSetter,
571
- aliases: {},
572
- register: 0
573
- };
574
- _wake();
575
- if (config !== Plugin) {
576
- if (_plugins[name]) return;
577
- _setDefaults(Plugin, _setDefaults(_copyExcluding(config, instanceDefaults), statics));
578
- _merge(Plugin.prototype, _merge(instanceDefaults, _copyExcluding(config, statics)));
579
- _plugins[Plugin.prop = name] = Plugin;
580
- if (config.targetTest) {
581
- _harnessPlugins.push(Plugin);
582
- _reservedProps[name] = 1;
583
- }
584
- name = (name === "css" ? "CSS" : name.charAt(0).toUpperCase() + name.substr(1)) + "Plugin";
585
- }
586
- _addGlobal(name, Plugin);
587
- config.register && config.register(gsap, Plugin, PropTween);
588
- } else _registerPluginQueue.push(config);
589
- }, _255 = 255, _colorLookup = {
590
- aqua: [
591
- 0,
592
- _255,
593
- _255
594
- ],
595
- lime: [
596
- 0,
597
- _255,
598
- 0
599
- ],
600
- silver: [
601
- 192,
602
- 192,
603
- 192
604
- ],
605
- black: [
606
- 0,
607
- 0,
608
- 0
609
- ],
610
- maroon: [
611
- 128,
612
- 0,
613
- 0
614
- ],
615
- teal: [
616
- 0,
617
- 128,
618
- 128
619
- ],
620
- blue: [
621
- 0,
622
- 0,
623
- _255
624
- ],
625
- navy: [
626
- 0,
627
- 0,
628
- 128
629
- ],
630
- white: [
631
- _255,
632
- _255,
633
- _255
634
- ],
635
- olive: [
636
- 128,
637
- 128,
638
- 0
639
- ],
640
- yellow: [
641
- _255,
642
- _255,
643
- 0
644
- ],
645
- orange: [
646
- _255,
647
- 165,
648
- 0
649
- ],
650
- gray: [
651
- 128,
652
- 128,
653
- 128
654
- ],
655
- purple: [
656
- 128,
657
- 0,
658
- 128
659
- ],
660
- green: [
661
- 0,
662
- 128,
663
- 0
664
- ],
665
- red: [
666
- _255,
667
- 0,
668
- 0
669
- ],
670
- pink: [
671
- _255,
672
- 192,
673
- 203
674
- ],
675
- cyan: [
676
- 0,
677
- _255,
678
- _255
679
- ],
680
- transparent: [
681
- _255,
682
- _255,
683
- _255,
684
- 0
685
- ]
686
- }, _hue = function _hue(h, m1, m2) {
687
- h += h < 0 ? 1 : h > 1 ? -1 : 0;
688
- return (h * 6 < 1 ? m1 + (m2 - m1) * h * 6 : h < .5 ? m2 : h * 3 < 2 ? m1 + (m2 - m1) * (2 / 3 - h) * 6 : m1) * _255 + .5 | 0;
689
- }, splitColor = function splitColor(v, toHSL, forceAlpha) {
690
- var a = !v ? _colorLookup.black : _isNumber(v) ? [
691
- v >> 16,
692
- v >> 8 & _255,
693
- v & _255
694
- ] : 0, r, g, b, h, s, l, max, min, d, wasHSL;
695
- if (!a) {
696
- if (v.substr(-1) === ",") v = v.substr(0, v.length - 1);
697
- if (_colorLookup[v]) a = _colorLookup[v];
698
- else if (v.charAt(0) === "#") {
699
- if (v.length < 6) {
700
- r = v.charAt(1);
701
- g = v.charAt(2);
702
- b = v.charAt(3);
703
- v = "#" + r + r + g + g + b + b + (v.length === 5 ? v.charAt(4) + v.charAt(4) : "");
704
- }
705
- if (v.length === 9) {
706
- a = parseInt(v.substr(1, 6), 16);
707
- return [
708
- a >> 16,
709
- a >> 8 & _255,
710
- a & _255,
711
- parseInt(v.substr(7), 16) / 255
712
- ];
713
- }
714
- v = parseInt(v.substr(1), 16);
715
- a = [
716
- v >> 16,
717
- v >> 8 & _255,
718
- v & _255
719
- ];
720
- } else if (v.substr(0, 3) === "hsl") {
721
- a = wasHSL = v.match(_strictNumExp);
722
- if (!toHSL) {
723
- h = +a[0] % 360 / 360;
724
- s = +a[1] / 100;
725
- l = +a[2] / 100;
726
- g = l <= .5 ? l * (s + 1) : l + s - l * s;
727
- r = l * 2 - g;
728
- a.length > 3 && (a[3] *= 1);
729
- a[0] = _hue(h + 1 / 3, r, g);
730
- a[1] = _hue(h, r, g);
731
- a[2] = _hue(h - 1 / 3, r, g);
732
- } else if (~v.indexOf("=")) {
733
- a = v.match(_numExp);
734
- forceAlpha && a.length < 4 && (a[3] = 1);
735
- return a;
736
- }
737
- } else a = v.match(_strictNumExp) || _colorLookup.transparent;
738
- a = a.map(Number);
739
- }
740
- if (toHSL && !wasHSL) {
741
- r = a[0] / _255;
742
- g = a[1] / _255;
743
- b = a[2] / _255;
744
- max = Math.max(r, g, b);
745
- min = Math.min(r, g, b);
746
- l = (max + min) / 2;
747
- if (max === min) h = s = 0;
748
- else {
749
- d = max - min;
750
- s = l > .5 ? d / (2 - max - min) : d / (max + min);
751
- h = max === r ? (g - b) / d + (g < b ? 6 : 0) : max === g ? (b - r) / d + 2 : (r - g) / d + 4;
752
- h *= 60;
753
- }
754
- a[0] = ~~(h + .5);
755
- a[1] = ~~(s * 100 + .5);
756
- a[2] = ~~(l * 100 + .5);
757
- }
758
- forceAlpha && a.length < 4 && (a[3] = 1);
759
- return a;
760
- }, _colorOrderData = function _colorOrderData(v) {
761
- var values = [], c = [], i = -1;
762
- v.split(_colorExp).forEach(function(v) {
763
- var a = v.match(_numWithUnitExp) || [];
764
- values.push.apply(values, a);
765
- c.push(i += a.length + 1);
766
- });
767
- values.c = c;
768
- return values;
769
- }, _formatColors = function _formatColors(s, toHSL, orderMatchData) {
770
- var result = "", colors = (s + result).match(_colorExp), type = toHSL ? "hsla(" : "rgba(", i = 0, c, shell, d, l;
771
- if (!colors) return s;
772
- colors = colors.map(function(color) {
773
- return (color = splitColor(color, toHSL, 1)) && type + (toHSL ? color[0] + "," + color[1] + "%," + color[2] + "%," + color[3] : color.join(",")) + ")";
774
- });
775
- if (orderMatchData) {
776
- d = _colorOrderData(s);
777
- c = orderMatchData.c;
778
- if (c.join(result) !== d.c.join(result)) {
779
- shell = s.replace(_colorExp, "1").split(_numWithUnitExp);
780
- l = shell.length - 1;
781
- for (; i < l; i++) result += shell[i] + (~c.indexOf(i) ? colors.shift() || type + "0,0,0,0)" : (d.length ? d : colors.length ? colors : orderMatchData).shift());
782
- }
783
- }
784
- if (!shell) {
785
- shell = s.split(_colorExp);
786
- l = shell.length - 1;
787
- for (; i < l; i++) result += shell[i] + colors[i];
788
- }
789
- return result + shell[l];
790
- }, _colorExp = function() {
791
- var s = "(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b", p;
792
- for (p in _colorLookup) s += "|" + p + "\\b";
793
- return new RegExp(s + ")", "gi");
794
- }(), _hslExp = /hsl[a]?\(/, _colorStringFilter = function _colorStringFilter(a) {
795
- var combined = a.join(" "), toHSL;
796
- _colorExp.lastIndex = 0;
797
- if (_colorExp.test(combined)) {
798
- toHSL = _hslExp.test(combined);
799
- a[1] = _formatColors(a[1], toHSL);
800
- a[0] = _formatColors(a[0], toHSL, _colorOrderData(a[1]));
801
- return true;
802
- }
803
- }, _tickerActive, _ticker = function() {
804
- var _getTime = Date.now, _lagThreshold = 500, _adjustedLag = 33, _startTime = _getTime(), _lastUpdate = _startTime, _gap = 1e3 / 240, _nextTime = _gap, _listeners = [], _id, _req, _raf, _self, _delta, _i, _tick = function _tick(v) {
805
- var elapsed = _getTime() - _lastUpdate, manual = v === true, overlap, dispatch, time, frame;
806
- (elapsed > _lagThreshold || elapsed < 0) && (_startTime += elapsed - _adjustedLag);
807
- _lastUpdate += elapsed;
808
- time = _lastUpdate - _startTime;
809
- overlap = time - _nextTime;
810
- if (overlap > 0 || manual) {
811
- frame = ++_self.frame;
812
- _delta = time - _self.time * 1e3;
813
- _self.time = time = time / 1e3;
814
- _nextTime += overlap + (overlap >= _gap ? 4 : _gap - overlap);
815
- dispatch = 1;
816
- }
817
- manual || (_id = _req(_tick));
818
- if (dispatch) for (_i = 0; _i < _listeners.length; _i++) _listeners[_i](time, _delta, frame, v);
819
- };
820
- _self = {
821
- time: 0,
822
- frame: 0,
823
- tick: function tick() {
824
- _tick(true);
825
- },
826
- deltaRatio: function deltaRatio(fps) {
827
- return _delta / (1e3 / (fps || 60));
828
- },
829
- wake: function wake() {
830
- if (_coreReady) {
831
- if (!_coreInitted && _windowExists()) {
832
- _win = _coreInitted = window;
833
- _doc = _win.document || {};
834
- _globals.gsap = gsap;
835
- (_win.gsapVersions || (_win.gsapVersions = [])).push(gsap.version);
836
- _install(_installScope || _win.GreenSockGlobals || !_win.gsap && _win || {});
837
- _registerPluginQueue.forEach(_createPlugin);
838
- }
839
- _raf = typeof requestAnimationFrame !== "undefined" && requestAnimationFrame;
840
- _id && _self.sleep();
841
- _req = _raf || function(f) {
842
- return setTimeout(f, _nextTime - _self.time * 1e3 + 1 | 0);
843
- };
844
- _tickerActive = 1;
845
- _tick(2);
846
- }
847
- },
848
- sleep: function sleep() {
849
- (_raf ? cancelAnimationFrame : clearTimeout)(_id);
850
- _tickerActive = 0;
851
- _req = _emptyFunc;
852
- },
853
- lagSmoothing: function lagSmoothing(threshold, adjustedLag) {
854
- _lagThreshold = threshold || Infinity;
855
- _adjustedLag = Math.min(adjustedLag || 33, _lagThreshold);
856
- },
857
- fps: function fps(_fps) {
858
- _gap = 1e3 / (_fps || 240);
859
- _nextTime = _self.time * 1e3 + _gap;
860
- },
861
- add: function add(callback, once, prioritize) {
862
- var func = once ? function(t, d, f, v) {
863
- callback(t, d, f, v);
864
- _self.remove(func);
865
- } : callback;
866
- _self.remove(callback);
867
- _listeners[prioritize ? "unshift" : "push"](func);
868
- _wake();
869
- return func;
870
- },
871
- remove: function remove(callback, i) {
872
- ~(i = _listeners.indexOf(callback)) && _listeners.splice(i, 1) && _i >= i && _i--;
873
- },
874
- _listeners
875
- };
876
- return _self;
877
- }(), _wake = function _wake() {
878
- return !_tickerActive && _ticker.wake();
879
- }, _easeMap = {}, _customEaseExp = /^[\d.\-M][\d.\-,\s]/, _quotesExp = /["']/g, _parseObjectInString = function _parseObjectInString(value) {
880
- var obj = {}, split = value.substr(1, value.length - 3).split(":"), key = split[0], i = 1, l = split.length, index, val, parsedVal;
881
- for (; i < l; i++) {
882
- val = split[i];
883
- index = i !== l - 1 ? val.lastIndexOf(",") : val.length;
884
- parsedVal = val.substr(0, index);
885
- obj[key] = isNaN(parsedVal) ? parsedVal.replace(_quotesExp, "").trim() : +parsedVal;
886
- key = val.substr(index + 1).trim();
887
- }
888
- return obj;
889
- }, _valueInParentheses = function _valueInParentheses(value) {
890
- var open = value.indexOf("(") + 1, close = value.indexOf(")"), nested = value.indexOf("(", open);
891
- return value.substring(open, ~nested && nested < close ? value.indexOf(")", close + 1) : close);
892
- }, _configEaseFromString = function _configEaseFromString(name) {
893
- var split = (name + "").split("("), ease = _easeMap[split[0]];
894
- return ease && split.length > 1 && ease.config ? ease.config.apply(null, ~name.indexOf("{") ? [_parseObjectInString(split[1])] : _valueInParentheses(name).split(",").map(_numericIfPossible)) : _easeMap._CE && _customEaseExp.test(name) ? _easeMap._CE("", name) : ease;
895
- }, _invertEase = function _invertEase(ease) {
896
- return function(p) {
897
- return 1 - ease(1 - p);
898
- };
899
- }, _propagateYoyoEase = function _propagateYoyoEase(timeline, isYoyo) {
900
- var child = timeline._first, ease;
901
- while (child) {
902
- if (child instanceof Timeline) _propagateYoyoEase(child, isYoyo);
903
- else if (child.vars.yoyoEase && (!child._yoyo || !child._repeat) && child._yoyo !== isYoyo) if (child.timeline) _propagateYoyoEase(child.timeline, isYoyo);
904
- else {
905
- ease = child._ease;
906
- child._ease = child._yEase;
907
- child._yEase = ease;
908
- child._yoyo = isYoyo;
909
- }
910
- child = child._next;
911
- }
912
- }, _parseEase = function _parseEase(ease, defaultEase) {
913
- return !ease ? defaultEase : (_isFunction(ease) ? ease : _easeMap[ease] || _configEaseFromString(ease)) || defaultEase;
914
- }, _insertEase = function _insertEase(names, easeIn, easeOut, easeInOut) {
915
- if (easeOut === void 0) easeOut = function easeOut(p) {
916
- return 1 - easeIn(1 - p);
917
- };
918
- if (easeInOut === void 0) easeInOut = function easeInOut(p) {
919
- return p < .5 ? easeIn(p * 2) / 2 : 1 - easeIn((1 - p) * 2) / 2;
920
- };
921
- var ease = {
922
- easeIn,
923
- easeOut,
924
- easeInOut
925
- }, lowercaseName;
926
- _forEachName(names, function(name) {
927
- _easeMap[name] = _globals[name] = ease;
928
- _easeMap[lowercaseName = name.toLowerCase()] = easeOut;
929
- for (var p in ease) _easeMap[lowercaseName + (p === "easeIn" ? ".in" : p === "easeOut" ? ".out" : ".inOut")] = _easeMap[name + "." + p] = ease[p];
930
- });
931
- return ease;
932
- }, _easeInOutFromOut = function _easeInOutFromOut(easeOut) {
933
- return function(p) {
934
- return p < .5 ? (1 - easeOut(1 - p * 2)) / 2 : .5 + easeOut((p - .5) * 2) / 2;
935
- };
936
- }, _configElastic = function _configElastic(type, amplitude, period) {
937
- var p1 = amplitude >= 1 ? amplitude : 1, p2 = (period || (type ? .3 : .45)) / (amplitude < 1 ? amplitude : 1), p3 = p2 / _2PI * (Math.asin(1 / p1) || 0), easeOut = function easeOut(p) {
938
- return p === 1 ? 1 : p1 * Math.pow(2, -10 * p) * _sin((p - p3) * p2) + 1;
939
- }, ease = type === "out" ? easeOut : type === "in" ? function(p) {
940
- return 1 - easeOut(1 - p);
941
- } : _easeInOutFromOut(easeOut);
942
- p2 = _2PI / p2;
943
- ease.config = function(amplitude, period) {
944
- return _configElastic(type, amplitude, period);
945
- };
946
- return ease;
947
- }, _configBack = function _configBack(type, overshoot) {
948
- if (overshoot === void 0) overshoot = 1.70158;
949
- var easeOut = function easeOut(p) {
950
- return p ? --p * p * ((overshoot + 1) * p + overshoot) + 1 : 0;
951
- }, ease = type === "out" ? easeOut : type === "in" ? function(p) {
952
- return 1 - easeOut(1 - p);
953
- } : _easeInOutFromOut(easeOut);
954
- ease.config = function(overshoot) {
955
- return _configBack(type, overshoot);
956
- };
957
- return ease;
958
- };
959
- _forEachName("Linear,Quad,Cubic,Quart,Quint,Strong", function(name, i) {
960
- var power = i < 5 ? i + 1 : i;
961
- _insertEase(name + ",Power" + (power - 1), i ? function(p) {
962
- return Math.pow(p, power);
963
- } : function(p) {
964
- return p;
965
- }, function(p) {
966
- return 1 - Math.pow(1 - p, power);
967
- }, function(p) {
968
- return p < .5 ? Math.pow(p * 2, power) / 2 : 1 - Math.pow((1 - p) * 2, power) / 2;
969
- });
970
- });
971
- _easeMap.Linear.easeNone = _easeMap.none = _easeMap.Linear.easeIn;
972
- _insertEase("Elastic", _configElastic("in"), _configElastic("out"), _configElastic());
973
- (function(n, c) {
974
- var n1 = 1 / c, n2 = 2 * n1, n3 = 2.5 * n1, easeOut = function easeOut(p) {
975
- return p < n1 ? n * p * p : p < n2 ? n * Math.pow(p - 1.5 / c, 2) + .75 : p < n3 ? n * (p -= 2.25 / c) * p + .9375 : n * Math.pow(p - 2.625 / c, 2) + .984375;
976
- };
977
- _insertEase("Bounce", function(p) {
978
- return 1 - easeOut(1 - p);
979
- }, easeOut);
980
- })(7.5625, 2.75);
981
- _insertEase("Expo", function(p) {
982
- return Math.pow(2, 10 * (p - 1)) * p + p * p * p * p * p * p * (1 - p);
983
- });
984
- _insertEase("Circ", function(p) {
985
- return -(_sqrt(1 - p * p) - 1);
986
- });
987
- _insertEase("Sine", function(p) {
988
- return p === 1 ? 1 : -_cos(p * _HALF_PI) + 1;
989
- });
990
- _insertEase("Back", _configBack("in"), _configBack("out"), _configBack());
991
- _easeMap.SteppedEase = _easeMap.steps = _globals.SteppedEase = { config: function config(steps, immediateStart) {
992
- if (steps === void 0) steps = 1;
993
- var p1 = 1 / steps, p2 = steps + (immediateStart ? 0 : 1), p3 = immediateStart ? 1 : 0, max = 1 - _tinyNum;
994
- return function(p) {
995
- return ((p2 * _clamp(0, max, p) | 0) + p3) * p1;
996
- };
997
- } };
998
- _defaults.ease = _easeMap["quad.out"];
999
- _forEachName("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt", function(name) {
1000
- return _callbackNames += name + "," + name + "Params,";
1001
- });
1002
- var GSCache = function GSCache(target, harness) {
1003
- this.id = _gsID++;
1004
- target._gsap = this;
1005
- this.target = target;
1006
- this.harness = harness;
1007
- this.get = harness ? harness.get : _getProperty;
1008
- this.set = harness ? harness.getSetter : _getSetter;
1009
- };
1010
- var Animation = /* @__PURE__ */ function() {
1011
- function Animation(vars) {
1012
- this.vars = vars;
1013
- this._delay = +vars.delay || 0;
1014
- if (this._repeat = vars.repeat === Infinity ? -2 : vars.repeat || 0) {
1015
- this._rDelay = vars.repeatDelay || 0;
1016
- this._yoyo = !!vars.yoyo || !!vars.yoyoEase;
1017
- }
1018
- this._ts = 1;
1019
- _setDuration(this, +vars.duration, 1, 1);
1020
- this.data = vars.data;
1021
- if (_context) {
1022
- this._ctx = _context;
1023
- _context.data.push(this);
1024
- }
1025
- _tickerActive || _ticker.wake();
1026
- }
1027
- var _proto = Animation.prototype;
1028
- _proto.delay = function delay(value) {
1029
- if (value || value === 0) {
1030
- this.parent && this.parent.smoothChildTiming && this.startTime(this._start + value - this._delay);
1031
- this._delay = value;
1032
- return this;
1033
- }
1034
- return this._delay;
1035
- };
1036
- _proto.duration = function duration(value) {
1037
- return arguments.length ? this.totalDuration(this._repeat > 0 ? value + (value + this._rDelay) * this._repeat : value) : this.totalDuration() && this._dur;
1038
- };
1039
- _proto.totalDuration = function totalDuration(value) {
1040
- if (!arguments.length) return this._tDur;
1041
- this._dirty = 0;
1042
- return _setDuration(this, this._repeat < 0 ? value : (value - this._repeat * this._rDelay) / (this._repeat + 1));
1043
- };
1044
- _proto.totalTime = function totalTime(_totalTime, suppressEvents) {
1045
- _wake();
1046
- if (!arguments.length) return this._tTime;
1047
- var parent = this._dp;
1048
- if (parent && parent.smoothChildTiming && this._ts) {
1049
- _alignPlayhead(this, _totalTime);
1050
- !parent._dp || parent.parent || _postAddChecks(parent, this);
1051
- while (parent && parent.parent) {
1052
- if (parent.parent._time !== parent._start + (parent._ts >= 0 ? parent._tTime / parent._ts : (parent.totalDuration() - parent._tTime) / -parent._ts)) parent.totalTime(parent._tTime, true);
1053
- parent = parent.parent;
1054
- }
1055
- if (!this.parent && this._dp.autoRemoveChildren && (this._ts > 0 && _totalTime < this._tDur || this._ts < 0 && _totalTime > 0 || !this._tDur && !_totalTime)) _addToTimeline(this._dp, this, this._start - this._delay);
1056
- }
1057
- if (this._tTime !== _totalTime || !this._dur && !suppressEvents || this._initted && Math.abs(this._zTime) === _tinyNum || !this._initted && this._dur && _totalTime || !_totalTime && !this._initted && (this.add || this._ptLookup)) {
1058
- this._ts || (this._pTime = _totalTime);
1059
- _lazySafeRender(this, _totalTime, suppressEvents);
1060
- }
1061
- return this;
1062
- };
1063
- _proto.time = function time(value, suppressEvents) {
1064
- return arguments.length ? this.totalTime(Math.min(this.totalDuration(), value + _elapsedCycleDuration(this)) % (this._dur + this._rDelay) || (value ? this._dur : 0), suppressEvents) : this._time;
1065
- };
1066
- _proto.totalProgress = function totalProgress(value, suppressEvents) {
1067
- return arguments.length ? this.totalTime(this.totalDuration() * value, suppressEvents) : this.totalDuration() ? Math.min(1, this._tTime / this._tDur) : this.rawTime() >= 0 && this._initted ? 1 : 0;
1068
- };
1069
- _proto.progress = function progress(value, suppressEvents) {
1070
- return arguments.length ? this.totalTime(this.duration() * (this._yoyo && !(this.iteration() & 1) ? 1 - value : value) + _elapsedCycleDuration(this), suppressEvents) : this.duration() ? Math.min(1, this._time / this._dur) : this.rawTime() > 0 ? 1 : 0;
1071
- };
1072
- _proto.iteration = function iteration(value, suppressEvents) {
1073
- var cycleDuration = this.duration() + this._rDelay;
1074
- return arguments.length ? this.totalTime(this._time + (value - 1) * cycleDuration, suppressEvents) : this._repeat ? _animationCycle(this._tTime, cycleDuration) + 1 : 1;
1075
- };
1076
- _proto.timeScale = function timeScale(value, suppressEvents) {
1077
- if (!arguments.length) return this._rts === -_tinyNum ? 0 : this._rts;
1078
- if (this._rts === value) return this;
1079
- var tTime = this.parent && this._ts ? _parentToChildTotalTime(this.parent._time, this) : this._tTime;
1080
- this._rts = +value || 0;
1081
- this._ts = this._ps || value === -_tinyNum ? 0 : this._rts;
1082
- this.totalTime(_clamp(-Math.abs(this._delay), this.totalDuration(), tTime), suppressEvents !== false);
1083
- _setEnd(this);
1084
- return _recacheAncestors(this);
1085
- };
1086
- _proto.paused = function paused(value) {
1087
- if (!arguments.length) return this._ps;
1088
- if (this._ps !== value) {
1089
- this._ps = value;
1090
- if (value) {
1091
- this._pTime = this._tTime || Math.max(-this._delay, this.rawTime());
1092
- this._ts = this._act = 0;
1093
- } else {
1094
- _wake();
1095
- this._ts = this._rts;
1096
- this.totalTime(this.parent && !this.parent.smoothChildTiming ? this.rawTime() : this._tTime || this._pTime, this.progress() === 1 && Math.abs(this._zTime) !== _tinyNum && (this._tTime -= _tinyNum));
1097
- }
1098
- }
1099
- return this;
1100
- };
1101
- _proto.startTime = function startTime(value) {
1102
- if (arguments.length) {
1103
- this._start = _roundPrecise(value);
1104
- var parent = this.parent || this._dp;
1105
- parent && (parent._sort || !this.parent) && _addToTimeline(parent, this, this._start - this._delay);
1106
- return this;
1107
- }
1108
- return this._start;
1109
- };
1110
- _proto.endTime = function endTime(includeRepeats) {
1111
- return this._start + (_isNotFalse(includeRepeats) ? this.totalDuration() : this.duration()) / Math.abs(this._ts || 1);
1112
- };
1113
- _proto.rawTime = function rawTime(wrapRepeats) {
1114
- var parent = this.parent || this._dp;
1115
- return !parent ? this._tTime : wrapRepeats && (!this._ts || this._repeat && this._time && this.totalProgress() < 1) ? this._tTime % (this._dur + this._rDelay) : !this._ts ? this._tTime : _parentToChildTotalTime(parent.rawTime(wrapRepeats), this);
1116
- };
1117
- _proto.revert = function revert(config) {
1118
- if (config === void 0) config = _revertConfig;
1119
- var prevIsReverting = _reverting;
1120
- _reverting = config;
1121
- if (_isRevertWorthy(this)) {
1122
- this.timeline && this.timeline.revert(config);
1123
- this.totalTime(-.01, config.suppressEvents);
1124
- }
1125
- this.data !== "nested" && config.kill !== false && this.kill();
1126
- _reverting = prevIsReverting;
1127
- return this;
1128
- };
1129
- _proto.globalTime = function globalTime(rawTime) {
1130
- var animation = this, time = arguments.length ? rawTime : animation.rawTime();
1131
- while (animation) {
1132
- time = animation._start + time / (Math.abs(animation._ts) || 1);
1133
- animation = animation._dp;
1134
- }
1135
- return !this.parent && this._sat ? this._sat.globalTime(rawTime) : time;
1136
- };
1137
- _proto.repeat = function repeat(value) {
1138
- if (arguments.length) {
1139
- this._repeat = value === Infinity ? -2 : value;
1140
- return _onUpdateTotalDuration(this);
1141
- }
1142
- return this._repeat === -2 ? Infinity : this._repeat;
1143
- };
1144
- _proto.repeatDelay = function repeatDelay(value) {
1145
- if (arguments.length) {
1146
- var time = this._time;
1147
- this._rDelay = value;
1148
- _onUpdateTotalDuration(this);
1149
- return time ? this.time(time) : this;
1150
- }
1151
- return this._rDelay;
1152
- };
1153
- _proto.yoyo = function yoyo(value) {
1154
- if (arguments.length) {
1155
- this._yoyo = value;
1156
- return this;
1157
- }
1158
- return this._yoyo;
1159
- };
1160
- _proto.seek = function seek(position, suppressEvents) {
1161
- return this.totalTime(_parsePosition(this, position), _isNotFalse(suppressEvents));
1162
- };
1163
- _proto.restart = function restart(includeDelay, suppressEvents) {
1164
- this.play().totalTime(includeDelay ? -this._delay : 0, _isNotFalse(suppressEvents));
1165
- this._dur || (this._zTime = -_tinyNum);
1166
- return this;
1167
- };
1168
- _proto.play = function play(from, suppressEvents) {
1169
- from != null && this.seek(from, suppressEvents);
1170
- return this.reversed(false).paused(false);
1171
- };
1172
- _proto.reverse = function reverse(from, suppressEvents) {
1173
- from != null && this.seek(from || this.totalDuration(), suppressEvents);
1174
- return this.reversed(true).paused(false);
1175
- };
1176
- _proto.pause = function pause(atTime, suppressEvents) {
1177
- atTime != null && this.seek(atTime, suppressEvents);
1178
- return this.paused(true);
1179
- };
1180
- _proto.resume = function resume() {
1181
- return this.paused(false);
1182
- };
1183
- _proto.reversed = function reversed(value) {
1184
- if (arguments.length) {
1185
- !!value !== this.reversed() && this.timeScale(-this._rts || (value ? -_tinyNum : 0));
1186
- return this;
1187
- }
1188
- return this._rts < 0;
1189
- };
1190
- _proto.invalidate = function invalidate() {
1191
- this._initted = this._act = 0;
1192
- this._zTime = -_tinyNum;
1193
- return this;
1194
- };
1195
- _proto.isActive = function isActive() {
1196
- var parent = this.parent || this._dp, start = this._start, rawTime;
1197
- return !!(!parent || this._ts && this._initted && parent.isActive() && (rawTime = parent.rawTime(true)) >= start && rawTime < this.endTime(true) - _tinyNum);
1198
- };
1199
- _proto.eventCallback = function eventCallback(type, callback, params) {
1200
- var vars = this.vars;
1201
- if (arguments.length > 1) {
1202
- if (!callback) delete vars[type];
1203
- else {
1204
- vars[type] = callback;
1205
- params && (vars[type + "Params"] = params);
1206
- type === "onUpdate" && (this._onUpdate = callback);
1207
- }
1208
- return this;
1209
- }
1210
- return vars[type];
1211
- };
1212
- _proto.then = function then(onFulfilled) {
1213
- var self = this, prevProm = self._prom;
1214
- return new Promise(function(resolve) {
1215
- var f = _isFunction(onFulfilled) ? onFulfilled : _passThrough, _resolve = function _resolve() {
1216
- var _then = self.then;
1217
- self.then = null;
1218
- prevProm && prevProm();
1219
- _isFunction(f) && (f = f(self)) && (f.then || f === self) && (self.then = _then);
1220
- resolve(f);
1221
- self.then = _then;
1222
- };
1223
- if (self._initted && self.totalProgress() === 1 && self._ts >= 0 || !self._tTime && self._ts < 0) _resolve();
1224
- else self._prom = _resolve;
1225
- });
1226
- };
1227
- _proto.kill = function kill() {
1228
- _interrupt(this);
1229
- };
1230
- return Animation;
1231
- }();
1232
- _setDefaults(Animation.prototype, {
1233
- _time: 0,
1234
- _start: 0,
1235
- _end: 0,
1236
- _tTime: 0,
1237
- _tDur: 0,
1238
- _dirty: 0,
1239
- _repeat: 0,
1240
- _yoyo: false,
1241
- parent: null,
1242
- _initted: false,
1243
- _rDelay: 0,
1244
- _ts: 1,
1245
- _dp: 0,
1246
- ratio: 0,
1247
- _zTime: -_tinyNum,
1248
- _prom: 0,
1249
- _ps: false,
1250
- _rts: 1
1251
- });
1252
- var Timeline = /* @__PURE__ */ function(_Animation) {
1253
- _inheritsLoose(Timeline, _Animation);
1254
- function Timeline(vars, position) {
1255
- var _this;
1256
- if (vars === void 0) vars = {};
1257
- _this = _Animation.call(this, vars) || this;
1258
- _this.labels = {};
1259
- _this.smoothChildTiming = !!vars.smoothChildTiming;
1260
- _this.autoRemoveChildren = !!vars.autoRemoveChildren;
1261
- _this._sort = _isNotFalse(vars.sortChildren);
1262
- _globalTimeline && _addToTimeline(vars.parent || _globalTimeline, _assertThisInitialized(_this), position);
1263
- vars.reversed && _this.reverse();
1264
- vars.paused && _this.paused(true);
1265
- vars.scrollTrigger && _scrollTrigger(_assertThisInitialized(_this), vars.scrollTrigger);
1266
- return _this;
1267
- }
1268
- var _proto2 = Timeline.prototype;
1269
- _proto2.to = function to(targets, vars, position) {
1270
- _createTweenType(0, arguments, this);
1271
- return this;
1272
- };
1273
- _proto2.from = function from(targets, vars, position) {
1274
- _createTweenType(1, arguments, this);
1275
- return this;
1276
- };
1277
- _proto2.fromTo = function fromTo(targets, fromVars, toVars, position) {
1278
- _createTweenType(2, arguments, this);
1279
- return this;
1280
- };
1281
- _proto2.set = function set(targets, vars, position) {
1282
- vars.duration = 0;
1283
- vars.parent = this;
1284
- _inheritDefaults(vars).repeatDelay || (vars.repeat = 0);
1285
- vars.immediateRender = !!vars.immediateRender;
1286
- new Tween(targets, vars, _parsePosition(this, position), 1);
1287
- return this;
1288
- };
1289
- _proto2.call = function call(callback, params, position) {
1290
- return _addToTimeline(this, Tween.delayedCall(0, callback, params), position);
1291
- };
1292
- _proto2.staggerTo = function staggerTo(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams) {
1293
- vars.duration = duration;
1294
- vars.stagger = vars.stagger || stagger;
1295
- vars.onComplete = onCompleteAll;
1296
- vars.onCompleteParams = onCompleteAllParams;
1297
- vars.parent = this;
1298
- new Tween(targets, vars, _parsePosition(this, position));
1299
- return this;
1300
- };
1301
- _proto2.staggerFrom = function staggerFrom(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams) {
1302
- vars.runBackwards = 1;
1303
- _inheritDefaults(vars).immediateRender = _isNotFalse(vars.immediateRender);
1304
- return this.staggerTo(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams);
1305
- };
1306
- _proto2.staggerFromTo = function staggerFromTo(targets, duration, fromVars, toVars, stagger, position, onCompleteAll, onCompleteAllParams) {
1307
- toVars.startAt = fromVars;
1308
- _inheritDefaults(toVars).immediateRender = _isNotFalse(toVars.immediateRender);
1309
- return this.staggerTo(targets, duration, toVars, stagger, position, onCompleteAll, onCompleteAllParams);
1310
- };
1311
- _proto2.render = function render(totalTime, suppressEvents, force) {
1312
- var prevTime = this._time, tDur = this._dirty ? this.totalDuration() : this._tDur, dur = this._dur, tTime = totalTime <= 0 ? 0 : _roundPrecise(totalTime), crossingStart = this._zTime < 0 !== totalTime < 0 && (this._initted || !dur), time, child, next, iteration, cycleDuration, prevPaused, pauseTween, timeScale, prevStart, prevIteration, yoyo, isYoyo;
1313
- this !== _globalTimeline && tTime > tDur && totalTime >= 0 && (tTime = tDur);
1314
- if (tTime !== this._tTime || force || crossingStart) {
1315
- if (prevTime !== this._time && dur) {
1316
- tTime += this._time - prevTime;
1317
- totalTime += this._time - prevTime;
1318
- }
1319
- time = tTime;
1320
- prevStart = this._start;
1321
- timeScale = this._ts;
1322
- prevPaused = !timeScale;
1323
- if (crossingStart) {
1324
- dur || (prevTime = this._zTime);
1325
- (totalTime || !suppressEvents) && (this._zTime = totalTime);
1326
- }
1327
- if (this._repeat) {
1328
- yoyo = this._yoyo;
1329
- cycleDuration = dur + this._rDelay;
1330
- if (this._repeat < -1 && totalTime < 0) return this.totalTime(cycleDuration * 100 + totalTime, suppressEvents, force);
1331
- time = _roundPrecise(tTime % cycleDuration);
1332
- if (tTime === tDur) {
1333
- iteration = this._repeat;
1334
- time = dur;
1335
- } else {
1336
- prevIteration = _roundPrecise(tTime / cycleDuration);
1337
- iteration = ~~prevIteration;
1338
- if (iteration && iteration === prevIteration) {
1339
- time = dur;
1340
- iteration--;
1341
- }
1342
- time > dur && (time = dur);
1343
- }
1344
- prevIteration = _animationCycle(this._tTime, cycleDuration);
1345
- !prevTime && this._tTime && prevIteration !== iteration && this._tTime - prevIteration * cycleDuration - this._dur <= 0 && (prevIteration = iteration);
1346
- if (yoyo && iteration & 1) {
1347
- time = dur - time;
1348
- isYoyo = 1;
1349
- }
1350
- if (iteration !== prevIteration && !this._lock) {
1351
- var rewinding = yoyo && prevIteration & 1, doesWrap = rewinding === (yoyo && iteration & 1);
1352
- iteration < prevIteration && (rewinding = !rewinding);
1353
- prevTime = rewinding ? 0 : tTime % dur ? dur : tTime;
1354
- this._lock = 1;
1355
- this.render(prevTime || (isYoyo ? 0 : _roundPrecise(iteration * cycleDuration)), suppressEvents, !dur)._lock = 0;
1356
- this._tTime = tTime;
1357
- !suppressEvents && this.parent && _callback(this, "onRepeat");
1358
- if (this.vars.repeatRefresh && !isYoyo) {
1359
- this.invalidate()._lock = 1;
1360
- prevIteration = iteration;
1361
- }
1362
- if (prevTime && prevTime !== this._time || prevPaused !== !this._ts || this.vars.onRepeat && !this.parent && !this._act) return this;
1363
- dur = this._dur;
1364
- tDur = this._tDur;
1365
- if (doesWrap) {
1366
- this._lock = 2;
1367
- prevTime = rewinding ? dur : -1e-4;
1368
- this.render(prevTime, true);
1369
- this.vars.repeatRefresh && !isYoyo && this.invalidate();
1370
- }
1371
- this._lock = 0;
1372
- if (!this._ts && !prevPaused) return this;
1373
- _propagateYoyoEase(this, isYoyo);
1374
- }
1375
- }
1376
- if (this._hasPause && !this._forcing && this._lock < 2) {
1377
- pauseTween = _findNextPauseTween(this, _roundPrecise(prevTime), _roundPrecise(time));
1378
- if (pauseTween) tTime -= time - (time = pauseTween._start);
1379
- }
1380
- this._tTime = tTime;
1381
- this._time = time;
1382
- this._act = !timeScale;
1383
- if (!this._initted) {
1384
- this._onUpdate = this.vars.onUpdate;
1385
- this._initted = 1;
1386
- this._zTime = totalTime;
1387
- prevTime = 0;
1388
- }
1389
- if (!prevTime && tTime && dur && !suppressEvents && !prevIteration) {
1390
- _callback(this, "onStart");
1391
- if (this._tTime !== tTime) return this;
1392
- }
1393
- if (time >= prevTime && totalTime >= 0) {
1394
- child = this._first;
1395
- while (child) {
1396
- next = child._next;
1397
- if ((child._act || time >= child._start) && child._ts && pauseTween !== child) {
1398
- if (child.parent !== this) return this.render(totalTime, suppressEvents, force);
1399
- child.render(child._ts > 0 ? (time - child._start) * child._ts : (child._dirty ? child.totalDuration() : child._tDur) + (time - child._start) * child._ts, suppressEvents, force);
1400
- if (time !== this._time || !this._ts && !prevPaused) {
1401
- pauseTween = 0;
1402
- next && (tTime += this._zTime = -_tinyNum);
1403
- break;
1404
- }
1405
- }
1406
- child = next;
1407
- }
1408
- } else {
1409
- child = this._last;
1410
- var adjustedTime = totalTime < 0 ? totalTime : time;
1411
- while (child) {
1412
- next = child._prev;
1413
- if ((child._act || adjustedTime <= child._end) && child._ts && pauseTween !== child) {
1414
- if (child.parent !== this) return this.render(totalTime, suppressEvents, force);
1415
- child.render(child._ts > 0 ? (adjustedTime - child._start) * child._ts : (child._dirty ? child.totalDuration() : child._tDur) + (adjustedTime - child._start) * child._ts, suppressEvents, force || _reverting && _isRevertWorthy(child));
1416
- if (time !== this._time || !this._ts && !prevPaused) {
1417
- pauseTween = 0;
1418
- next && (tTime += this._zTime = adjustedTime ? -_tinyNum : _tinyNum);
1419
- break;
1420
- }
1421
- }
1422
- child = next;
1423
- }
1424
- }
1425
- if (pauseTween && !suppressEvents) {
1426
- this.pause();
1427
- pauseTween.render(time >= prevTime ? 0 : -_tinyNum)._zTime = time >= prevTime ? 1 : -1;
1428
- if (this._ts) {
1429
- this._start = prevStart;
1430
- _setEnd(this);
1431
- return this.render(totalTime, suppressEvents, force);
1432
- }
1433
- }
1434
- this._onUpdate && !suppressEvents && _callback(this, "onUpdate", true);
1435
- if (tTime === tDur && this._tTime >= this.totalDuration() || !tTime && prevTime) {
1436
- if (prevStart === this._start || Math.abs(timeScale) !== Math.abs(this._ts)) {
1437
- if (!this._lock) {
1438
- (totalTime || !dur) && (tTime === tDur && this._ts > 0 || !tTime && this._ts < 0) && _removeFromParent(this, 1);
1439
- if (!suppressEvents && !(totalTime < 0 && !prevTime) && (tTime || prevTime || !tDur)) {
1440
- _callback(this, tTime === tDur && totalTime >= 0 ? "onComplete" : "onReverseComplete", true);
1441
- this._prom && !(tTime < tDur && this.timeScale() > 0) && this._prom();
1442
- }
1443
- }
1444
- }
1445
- }
1446
- }
1447
- return this;
1448
- };
1449
- _proto2.add = function add(child, position) {
1450
- var _this2 = this;
1451
- _isNumber(position) || (position = _parsePosition(this, position, child));
1452
- if (!(child instanceof Animation)) {
1453
- if (_isArray(child)) {
1454
- child.forEach(function(obj) {
1455
- return _this2.add(obj, position);
1456
- });
1457
- return this;
1458
- }
1459
- if (_isString(child)) return this.addLabel(child, position);
1460
- if (_isFunction(child)) child = Tween.delayedCall(0, child);
1461
- else return this;
1462
- }
1463
- return this !== child ? _addToTimeline(this, child, position) : this;
1464
- };
1465
- _proto2.getChildren = function getChildren(nested, tweens, timelines, ignoreBeforeTime) {
1466
- if (nested === void 0) nested = true;
1467
- if (tweens === void 0) tweens = true;
1468
- if (timelines === void 0) timelines = true;
1469
- if (ignoreBeforeTime === void 0) ignoreBeforeTime = -_bigNum;
1470
- var a = [], child = this._first;
1471
- while (child) {
1472
- if (child._start >= ignoreBeforeTime) if (child instanceof Tween) tweens && a.push(child);
1473
- else {
1474
- timelines && a.push(child);
1475
- nested && a.push.apply(a, child.getChildren(true, tweens, timelines));
1476
- }
1477
- child = child._next;
1478
- }
1479
- return a;
1480
- };
1481
- _proto2.getById = function getById(id) {
1482
- var animations = this.getChildren(1, 1, 1), i = animations.length;
1483
- while (i--) if (animations[i].vars.id === id) return animations[i];
1484
- };
1485
- _proto2.remove = function remove(child) {
1486
- if (_isString(child)) return this.removeLabel(child);
1487
- if (_isFunction(child)) return this.killTweensOf(child);
1488
- child.parent === this && _removeLinkedListItem(this, child);
1489
- if (child === this._recent) this._recent = this._last;
1490
- return _uncache(this);
1491
- };
1492
- _proto2.totalTime = function totalTime(_totalTime2, suppressEvents) {
1493
- if (!arguments.length) return this._tTime;
1494
- this._forcing = 1;
1495
- if (!this._dp && this._ts) this._start = _roundPrecise(_ticker.time - (this._ts > 0 ? _totalTime2 / this._ts : (this.totalDuration() - _totalTime2) / -this._ts));
1496
- _Animation.prototype.totalTime.call(this, _totalTime2, suppressEvents);
1497
- this._forcing = 0;
1498
- return this;
1499
- };
1500
- _proto2.addLabel = function addLabel(label, position) {
1501
- this.labels[label] = _parsePosition(this, position);
1502
- return this;
1503
- };
1504
- _proto2.removeLabel = function removeLabel(label) {
1505
- delete this.labels[label];
1506
- return this;
1507
- };
1508
- _proto2.addPause = function addPause(position, callback, params) {
1509
- var t = Tween.delayedCall(0, callback || _emptyFunc, params);
1510
- t.data = "isPause";
1511
- this._hasPause = 1;
1512
- return _addToTimeline(this, t, _parsePosition(this, position));
1513
- };
1514
- _proto2.removePause = function removePause(position) {
1515
- var child = this._first;
1516
- position = _parsePosition(this, position);
1517
- while (child) {
1518
- if (child._start === position && child.data === "isPause") _removeFromParent(child);
1519
- child = child._next;
1520
- }
1521
- };
1522
- _proto2.killTweensOf = function killTweensOf(targets, props, onlyActive) {
1523
- var tweens = this.getTweensOf(targets, onlyActive), i = tweens.length;
1524
- while (i--) _overwritingTween !== tweens[i] && tweens[i].kill(targets, props);
1525
- return this;
1526
- };
1527
- _proto2.getTweensOf = function getTweensOf(targets, onlyActive) {
1528
- var a = [], parsedTargets = toArray(targets), child = this._first, isGlobalTime = _isNumber(onlyActive), children;
1529
- while (child) {
1530
- if (child instanceof Tween) {
1531
- if (_arrayContainsAny(child._targets, parsedTargets) && (isGlobalTime ? (!_overwritingTween || child._initted && child._ts) && child.globalTime(0) <= onlyActive && child.globalTime(child.totalDuration()) > onlyActive : !onlyActive || child.isActive())) a.push(child);
1532
- } else if ((children = child.getTweensOf(parsedTargets, onlyActive)).length) a.push.apply(a, children);
1533
- child = child._next;
1534
- }
1535
- return a;
1536
- };
1537
- _proto2.tweenTo = function tweenTo(position, vars) {
1538
- vars = vars || {};
1539
- var tl = this, endTime = _parsePosition(tl, position), _vars = vars, startAt = _vars.startAt, _onStart = _vars.onStart, onStartParams = _vars.onStartParams, immediateRender = _vars.immediateRender, initted, tween = Tween.to(tl, _setDefaults({
1540
- ease: vars.ease || "none",
1541
- lazy: false,
1542
- immediateRender: false,
1543
- time: endTime,
1544
- overwrite: "auto",
1545
- duration: vars.duration || Math.abs((endTime - (startAt && "time" in startAt ? startAt.time : tl._time)) / tl.timeScale()) || _tinyNum,
1546
- onStart: function onStart() {
1547
- tl.pause();
1548
- if (!initted) {
1549
- var duration = vars.duration || Math.abs((endTime - (startAt && "time" in startAt ? startAt.time : tl._time)) / tl.timeScale());
1550
- tween._dur !== duration && _setDuration(tween, duration, 0, 1).render(tween._time, true, true);
1551
- initted = 1;
1552
- }
1553
- _onStart && _onStart.apply(tween, onStartParams || []);
1554
- }
1555
- }, vars));
1556
- return immediateRender ? tween.render(0) : tween;
1557
- };
1558
- _proto2.tweenFromTo = function tweenFromTo(fromPosition, toPosition, vars) {
1559
- return this.tweenTo(toPosition, _setDefaults({ startAt: { time: _parsePosition(this, fromPosition) } }, vars));
1560
- };
1561
- _proto2.recent = function recent() {
1562
- return this._recent;
1563
- };
1564
- _proto2.nextLabel = function nextLabel(afterTime) {
1565
- if (afterTime === void 0) afterTime = this._time;
1566
- return _getLabelInDirection(this, _parsePosition(this, afterTime));
1567
- };
1568
- _proto2.previousLabel = function previousLabel(beforeTime) {
1569
- if (beforeTime === void 0) beforeTime = this._time;
1570
- return _getLabelInDirection(this, _parsePosition(this, beforeTime), 1);
1571
- };
1572
- _proto2.currentLabel = function currentLabel(value) {
1573
- return arguments.length ? this.seek(value, true) : this.previousLabel(this._time + _tinyNum);
1574
- };
1575
- _proto2.shiftChildren = function shiftChildren(amount, adjustLabels, ignoreBeforeTime) {
1576
- if (ignoreBeforeTime === void 0) ignoreBeforeTime = 0;
1577
- var child = this._first, labels = this.labels, p;
1578
- amount = _roundPrecise(amount);
1579
- while (child) {
1580
- if (child._start >= ignoreBeforeTime) {
1581
- child._start += amount;
1582
- child._end += amount;
1583
- }
1584
- child = child._next;
1585
- }
1586
- if (adjustLabels) {
1587
- for (p in labels) if (labels[p] >= ignoreBeforeTime) labels[p] += amount;
1588
- }
1589
- return _uncache(this);
1590
- };
1591
- _proto2.invalidate = function invalidate(soft) {
1592
- var child = this._first;
1593
- this._lock = 0;
1594
- while (child) {
1595
- child.invalidate(soft);
1596
- child = child._next;
1597
- }
1598
- return _Animation.prototype.invalidate.call(this, soft);
1599
- };
1600
- _proto2.clear = function clear(includeLabels) {
1601
- if (includeLabels === void 0) includeLabels = true;
1602
- var child = this._first, next;
1603
- while (child) {
1604
- next = child._next;
1605
- this.remove(child);
1606
- child = next;
1607
- }
1608
- this._dp && (this._time = this._tTime = this._pTime = 0);
1609
- includeLabels && (this.labels = {});
1610
- return _uncache(this);
1611
- };
1612
- _proto2.totalDuration = function totalDuration(value) {
1613
- var max = 0, self = this, child = self._last, prevStart = _bigNum, prev, start, parent;
1614
- if (arguments.length) return self.timeScale((self._repeat < 0 ? self.duration() : self.totalDuration()) / (self.reversed() ? -value : value));
1615
- if (self._dirty) {
1616
- parent = self.parent;
1617
- while (child) {
1618
- prev = child._prev;
1619
- child._dirty && child.totalDuration();
1620
- start = child._start;
1621
- if (start > prevStart && self._sort && child._ts && !self._lock) {
1622
- self._lock = 1;
1623
- _addToTimeline(self, child, start - child._delay, 1)._lock = 0;
1624
- } else prevStart = start;
1625
- if (start < 0 && child._ts) {
1626
- max -= start;
1627
- if (!parent && !self._dp || parent && parent.smoothChildTiming) {
1628
- self._start += _roundPrecise(start / self._ts);
1629
- self._time -= start;
1630
- self._tTime -= start;
1631
- }
1632
- self.shiftChildren(-start, false, -Infinity);
1633
- prevStart = 0;
1634
- }
1635
- child._end > max && child._ts && (max = child._end);
1636
- child = prev;
1637
- }
1638
- _setDuration(self, self === _globalTimeline && self._time > max ? self._time : max, 1, 1);
1639
- self._dirty = 0;
1640
- }
1641
- return self._tDur;
1642
- };
1643
- Timeline.updateRoot = function updateRoot(time) {
1644
- if (_globalTimeline._ts) {
1645
- _lazySafeRender(_globalTimeline, _parentToChildTotalTime(time, _globalTimeline));
1646
- _lastRenderedFrame = _ticker.frame;
1647
- }
1648
- if (_ticker.frame >= _nextGCFrame) {
1649
- _nextGCFrame += _config.autoSleep || 120;
1650
- var child = _globalTimeline._first;
1651
- if (!child || !child._ts) {
1652
- if (_config.autoSleep && _ticker._listeners.length < 2) {
1653
- while (child && !child._ts) child = child._next;
1654
- child || _ticker.sleep();
1655
- }
1656
- }
1657
- }
1658
- };
1659
- return Timeline;
1660
- }(Animation);
1661
- _setDefaults(Timeline.prototype, {
1662
- _lock: 0,
1663
- _hasPause: 0,
1664
- _forcing: 0
1665
- });
1666
- var _addComplexStringPropTween = function _addComplexStringPropTween(target, prop, start, end, setter, stringFilter, funcParam) {
1667
- var pt = new PropTween(this._pt, target, prop, 0, 1, _renderComplexString, null, setter), index = 0, matchIndex = 0, result, startNums, color, endNum, chunk, startNum, hasRandom, a;
1668
- pt.b = start;
1669
- pt.e = end;
1670
- start += "";
1671
- end += "";
1672
- if (hasRandom = ~end.indexOf("random(")) end = _replaceRandom(end);
1673
- if (stringFilter) {
1674
- a = [start, end];
1675
- stringFilter(a, target, prop);
1676
- start = a[0];
1677
- end = a[1];
1678
- }
1679
- startNums = start.match(_complexStringNumExp) || [];
1680
- while (result = _complexStringNumExp.exec(end)) {
1681
- endNum = result[0];
1682
- chunk = end.substring(index, result.index);
1683
- if (color) color = (color + 1) % 5;
1684
- else if (chunk.substr(-5) === "rgba(") color = 1;
1685
- if (endNum !== startNums[matchIndex++]) {
1686
- startNum = parseFloat(startNums[matchIndex - 1]) || 0;
1687
- pt._pt = {
1688
- _next: pt._pt,
1689
- p: chunk || matchIndex === 1 ? chunk : ",",
1690
- s: startNum,
1691
- c: endNum.charAt(1) === "=" ? _parseRelative(startNum, endNum) - startNum : parseFloat(endNum) - startNum,
1692
- m: color && color < 4 ? Math.round : 0
1693
- };
1694
- index = _complexStringNumExp.lastIndex;
1695
- }
1696
- }
1697
- pt.c = index < end.length ? end.substring(index, end.length) : "";
1698
- pt.fp = funcParam;
1699
- if (_relExp.test(end) || hasRandom) pt.e = 0;
1700
- this._pt = pt;
1701
- return pt;
1702
- }, _addPropTween = function _addPropTween(target, prop, start, end, index, targets, modifier, stringFilter, funcParam, optional) {
1703
- _isFunction(end) && (end = end(index || 0, target, targets));
1704
- var currentValue = target[prop], parsedStart = start !== "get" ? start : !_isFunction(currentValue) ? currentValue : funcParam ? target[prop.indexOf("set") || !_isFunction(target["get" + prop.substr(3)]) ? prop : "get" + prop.substr(3)](funcParam) : target[prop](), setter = !_isFunction(currentValue) ? _setterPlain : funcParam ? _setterFuncWithParam : _setterFunc, pt;
1705
- if (_isString(end)) {
1706
- if (~end.indexOf("random(")) end = _replaceRandom(end);
1707
- if (end.charAt(1) === "=") {
1708
- pt = _parseRelative(parsedStart, end) + (getUnit(parsedStart) || 0);
1709
- if (pt || pt === 0) end = pt;
1710
- }
1711
- }
1712
- if (!optional || parsedStart !== end || _forceAllPropTweens) {
1713
- if (!isNaN(parsedStart * end) && end !== "") {
1714
- pt = new PropTween(this._pt, target, prop, +parsedStart || 0, end - (parsedStart || 0), typeof currentValue === "boolean" ? _renderBoolean : _renderPlain, 0, setter);
1715
- funcParam && (pt.fp = funcParam);
1716
- modifier && pt.modifier(modifier, this, target);
1717
- return this._pt = pt;
1718
- }
1719
- !currentValue && !(prop in target) && _missingPlugin(prop, end);
1720
- return _addComplexStringPropTween.call(this, target, prop, parsedStart, end, setter, stringFilter || _config.stringFilter, funcParam);
1721
- }
1722
- }, _processVars = function _processVars(vars, index, target, targets, tween) {
1723
- _isFunction(vars) && (vars = _parseFuncOrString(vars, tween, index, target, targets));
1724
- if (!_isObject(vars) || vars.style && vars.nodeType || _isArray(vars) || _isTypedArray(vars)) return _isString(vars) ? _parseFuncOrString(vars, tween, index, target, targets) : vars;
1725
- var copy = {}, p;
1726
- for (p in vars) copy[p] = _parseFuncOrString(vars[p], tween, index, target, targets);
1727
- return copy;
1728
- }, _checkPlugin = function _checkPlugin(property, vars, tween, index, target, targets) {
1729
- var plugin, pt, ptLookup, i;
1730
- if (_plugins[property] && (plugin = new _plugins[property]()).init(target, plugin.rawVars ? vars[property] : _processVars(vars[property], index, target, targets, tween), tween, index, targets) !== false) {
1731
- tween._pt = pt = new PropTween(tween._pt, target, property, 0, 1, plugin.render, plugin, 0, plugin.priority);
1732
- if (tween !== _quickTween) {
1733
- ptLookup = tween._ptLookup[tween._targets.indexOf(target)];
1734
- i = plugin._props.length;
1735
- while (i--) ptLookup[plugin._props[i]] = pt;
1736
- }
1737
- }
1738
- return plugin;
1739
- }, _overwritingTween, _forceAllPropTweens, _initTween = function _initTween(tween, time, tTime) {
1740
- var vars = tween.vars, ease = vars.ease, startAt = vars.startAt, immediateRender = vars.immediateRender, lazy = vars.lazy, onUpdate = vars.onUpdate, runBackwards = vars.runBackwards, yoyoEase = vars.yoyoEase, keyframes = vars.keyframes, autoRevert = vars.autoRevert, dur = tween._dur, prevStartAt = tween._startAt, targets = tween._targets, parent = tween.parent, fullTargets = parent && parent.data === "nested" ? parent.vars.targets : targets, autoOverwrite = tween._overwrite === "auto" && !_suppressOverwrites, tl = tween.timeline, cleanVars, i, p, pt, target, hasPriority, gsData, harness, plugin, ptLookup, index, harnessVars, overwritten;
1741
- tl && (!keyframes || !ease) && (ease = "none");
1742
- tween._ease = _parseEase(ease, _defaults.ease);
1743
- tween._yEase = yoyoEase ? _invertEase(_parseEase(yoyoEase === true ? ease : yoyoEase, _defaults.ease)) : 0;
1744
- if (yoyoEase && tween._yoyo && !tween._repeat) {
1745
- yoyoEase = tween._yEase;
1746
- tween._yEase = tween._ease;
1747
- tween._ease = yoyoEase;
1748
- }
1749
- tween._from = !tl && !!vars.runBackwards;
1750
- if (!tl || keyframes && !vars.stagger) {
1751
- harness = targets[0] ? _getCache(targets[0]).harness : 0;
1752
- harnessVars = harness && vars[harness.prop];
1753
- cleanVars = _copyExcluding(vars, _reservedProps);
1754
- if (prevStartAt) {
1755
- prevStartAt._zTime < 0 && prevStartAt.progress(1);
1756
- time < 0 && runBackwards && immediateRender && !autoRevert ? prevStartAt.render(-1, true) : prevStartAt.revert(runBackwards && dur ? _revertConfigNoKill : _startAtRevertConfig);
1757
- prevStartAt._lazy = 0;
1758
- }
1759
- if (startAt) {
1760
- _removeFromParent(tween._startAt = Tween.set(targets, _setDefaults({
1761
- data: "isStart",
1762
- overwrite: false,
1763
- parent,
1764
- immediateRender: true,
1765
- lazy: !prevStartAt && _isNotFalse(lazy),
1766
- startAt: null,
1767
- delay: 0,
1768
- onUpdate: onUpdate && function() {
1769
- return _callback(tween, "onUpdate");
1770
- },
1771
- stagger: 0
1772
- }, startAt)));
1773
- tween._startAt._dp = 0;
1774
- tween._startAt._sat = tween;
1775
- time < 0 && (_reverting || !immediateRender && !autoRevert) && tween._startAt.revert(_revertConfigNoKill);
1776
- if (immediateRender) {
1777
- if (dur && time <= 0 && tTime <= 0) {
1778
- time && (tween._zTime = time);
1779
- return;
1780
- }
1781
- }
1782
- } else if (runBackwards && dur) {
1783
- if (!prevStartAt) {
1784
- time && (immediateRender = false);
1785
- p = _setDefaults({
1786
- overwrite: false,
1787
- data: "isFromStart",
1788
- lazy: immediateRender && !prevStartAt && _isNotFalse(lazy),
1789
- immediateRender,
1790
- stagger: 0,
1791
- parent
1792
- }, cleanVars);
1793
- harnessVars && (p[harness.prop] = harnessVars);
1794
- _removeFromParent(tween._startAt = Tween.set(targets, p));
1795
- tween._startAt._dp = 0;
1796
- tween._startAt._sat = tween;
1797
- time < 0 && (_reverting ? tween._startAt.revert(_revertConfigNoKill) : tween._startAt.render(-1, true));
1798
- tween._zTime = time;
1799
- if (!immediateRender) _initTween(tween._startAt, _tinyNum, _tinyNum);
1800
- else if (!time) return;
1801
- }
1802
- }
1803
- tween._pt = tween._ptCache = 0;
1804
- lazy = dur && _isNotFalse(lazy) || lazy && !dur;
1805
- for (i = 0; i < targets.length; i++) {
1806
- target = targets[i];
1807
- gsData = target._gsap || _harness(targets)[i]._gsap;
1808
- tween._ptLookup[i] = ptLookup = {};
1809
- _lazyLookup[gsData.id] && _lazyTweens.length && _lazyRender();
1810
- index = fullTargets === targets ? i : fullTargets.indexOf(target);
1811
- if (harness && (plugin = new harness()).init(target, harnessVars || cleanVars, tween, index, fullTargets) !== false) {
1812
- tween._pt = pt = new PropTween(tween._pt, target, plugin.name, 0, 1, plugin.render, plugin, 0, plugin.priority);
1813
- plugin._props.forEach(function(name) {
1814
- ptLookup[name] = pt;
1815
- });
1816
- plugin.priority && (hasPriority = 1);
1817
- }
1818
- if (!harness || harnessVars) for (p in cleanVars) if (_plugins[p] && (plugin = _checkPlugin(p, cleanVars, tween, index, target, fullTargets))) plugin.priority && (hasPriority = 1);
1819
- else ptLookup[p] = pt = _addPropTween.call(tween, target, p, "get", cleanVars[p], index, fullTargets, 0, vars.stringFilter);
1820
- tween._op && tween._op[i] && tween.kill(target, tween._op[i]);
1821
- if (autoOverwrite && tween._pt) {
1822
- _overwritingTween = tween;
1823
- _globalTimeline.killTweensOf(target, ptLookup, tween.globalTime(time));
1824
- overwritten = !tween.parent;
1825
- _overwritingTween = 0;
1826
- }
1827
- tween._pt && lazy && (_lazyLookup[gsData.id] = 1);
1828
- }
1829
- hasPriority && _sortPropTweensByPriority(tween);
1830
- tween._onInit && tween._onInit(tween);
1831
- }
1832
- tween._onUpdate = onUpdate;
1833
- tween._initted = (!tween._op || tween._pt) && !overwritten;
1834
- keyframes && time <= 0 && tl.render(_bigNum, true, true);
1835
- }, _updatePropTweens = function _updatePropTweens(tween, property, value, start, startIsRelative, ratio, time, skipRecursion) {
1836
- var ptCache = (tween._pt && tween._ptCache || (tween._ptCache = {}))[property], pt, rootPT, lookup, i;
1837
- if (!ptCache) {
1838
- ptCache = tween._ptCache[property] = [];
1839
- lookup = tween._ptLookup;
1840
- i = tween._targets.length;
1841
- while (i--) {
1842
- pt = lookup[i][property];
1843
- if (pt && pt.d && pt.d._pt) {
1844
- pt = pt.d._pt;
1845
- while (pt && pt.p !== property && pt.fp !== property) pt = pt._next;
1846
- }
1847
- if (!pt) {
1848
- _forceAllPropTweens = 1;
1849
- tween.vars[property] = "+=0";
1850
- _initTween(tween, time);
1851
- _forceAllPropTweens = 0;
1852
- return skipRecursion ? _warn(property + " not eligible for reset") : 1;
1853
- }
1854
- ptCache.push(pt);
1855
- }
1856
- }
1857
- i = ptCache.length;
1858
- while (i--) {
1859
- rootPT = ptCache[i];
1860
- pt = rootPT._pt || rootPT;
1861
- pt.s = (start || start === 0) && !startIsRelative ? start : pt.s + (start || 0) + ratio * pt.c;
1862
- pt.c = value - pt.s;
1863
- rootPT.e && (rootPT.e = _round(value) + getUnit(rootPT.e));
1864
- rootPT.b && (rootPT.b = pt.s + getUnit(rootPT.b));
1865
- }
1866
- }, _addAliasesToVars = function _addAliasesToVars(targets, vars) {
1867
- var harness = targets[0] ? _getCache(targets[0]).harness : 0, propertyAliases = harness && harness.aliases, copy, p, i, aliases;
1868
- if (!propertyAliases) return vars;
1869
- copy = _merge({}, vars);
1870
- for (p in propertyAliases) if (p in copy) {
1871
- aliases = propertyAliases[p].split(",");
1872
- i = aliases.length;
1873
- while (i--) copy[aliases[i]] = copy[p];
1874
- }
1875
- return copy;
1876
- }, _parseKeyframe = function _parseKeyframe(prop, obj, allProps, easeEach) {
1877
- var ease = obj.ease || easeEach || "power1.inOut", p, a;
1878
- if (_isArray(obj)) {
1879
- a = allProps[prop] || (allProps[prop] = []);
1880
- obj.forEach(function(value, i) {
1881
- return a.push({
1882
- t: i / (obj.length - 1) * 100,
1883
- v: value,
1884
- e: ease
1885
- });
1886
- });
1887
- } else for (p in obj) {
1888
- a = allProps[p] || (allProps[p] = []);
1889
- p === "ease" || a.push({
1890
- t: parseFloat(prop),
1891
- v: obj[p],
1892
- e: ease
1893
- });
1894
- }
1895
- }, _parseFuncOrString = function _parseFuncOrString(value, tween, i, target, targets) {
1896
- return _isFunction(value) ? value.call(tween, i, target, targets) : _isString(value) && ~value.indexOf("random(") ? _replaceRandom(value) : value;
1897
- }, _staggerTweenProps = _callbackNames + "repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase,autoRevert", _staggerPropsToSkip = {};
1898
- _forEachName(_staggerTweenProps + ",id,stagger,delay,duration,paused,scrollTrigger", function(name) {
1899
- return _staggerPropsToSkip[name] = 1;
1900
- });
1901
- var Tween = /* @__PURE__ */ function(_Animation2) {
1902
- _inheritsLoose(Tween, _Animation2);
1903
- function Tween(targets, vars, position, skipInherit) {
1904
- var _this3;
1905
- if (typeof vars === "number") {
1906
- position.duration = vars;
1907
- vars = position;
1908
- position = null;
1909
- }
1910
- _this3 = _Animation2.call(this, skipInherit ? vars : _inheritDefaults(vars)) || this;
1911
- var _this3$vars = _this3.vars, duration = _this3$vars.duration, delay = _this3$vars.delay, immediateRender = _this3$vars.immediateRender, stagger = _this3$vars.stagger, overwrite = _this3$vars.overwrite, keyframes = _this3$vars.keyframes, defaults = _this3$vars.defaults, scrollTrigger = _this3$vars.scrollTrigger, yoyoEase = _this3$vars.yoyoEase, parent = vars.parent || _globalTimeline, parsedTargets = (_isArray(targets) || _isTypedArray(targets) ? _isNumber(targets[0]) : "length" in vars) ? [targets] : toArray(targets), tl, i, copy, l, p, curTarget, staggerFunc, staggerVarsToMerge;
1912
- _this3._targets = parsedTargets.length ? _harness(parsedTargets) : _warn("GSAP target " + targets + " not found. https://gsap.com", !_config.nullTargetWarn) || [];
1913
- _this3._ptLookup = [];
1914
- _this3._overwrite = overwrite;
1915
- if (keyframes || stagger || _isFuncOrString(duration) || _isFuncOrString(delay)) {
1916
- vars = _this3.vars;
1917
- tl = _this3.timeline = new Timeline({
1918
- data: "nested",
1919
- defaults: defaults || {},
1920
- targets: parent && parent.data === "nested" ? parent.vars.targets : parsedTargets
1921
- });
1922
- tl.kill();
1923
- tl.parent = tl._dp = _assertThisInitialized(_this3);
1924
- tl._start = 0;
1925
- if (stagger || _isFuncOrString(duration) || _isFuncOrString(delay)) {
1926
- l = parsedTargets.length;
1927
- staggerFunc = stagger && distribute(stagger);
1928
- if (_isObject(stagger)) {
1929
- for (p in stagger) if (~_staggerTweenProps.indexOf(p)) {
1930
- staggerVarsToMerge || (staggerVarsToMerge = {});
1931
- staggerVarsToMerge[p] = stagger[p];
1932
- }
1933
- }
1934
- for (i = 0; i < l; i++) {
1935
- copy = _copyExcluding(vars, _staggerPropsToSkip);
1936
- copy.stagger = 0;
1937
- yoyoEase && (copy.yoyoEase = yoyoEase);
1938
- staggerVarsToMerge && _merge(copy, staggerVarsToMerge);
1939
- curTarget = parsedTargets[i];
1940
- copy.duration = +_parseFuncOrString(duration, _assertThisInitialized(_this3), i, curTarget, parsedTargets);
1941
- copy.delay = (+_parseFuncOrString(delay, _assertThisInitialized(_this3), i, curTarget, parsedTargets) || 0) - _this3._delay;
1942
- if (!stagger && l === 1 && copy.delay) {
1943
- _this3._delay = delay = copy.delay;
1944
- _this3._start += delay;
1945
- copy.delay = 0;
1946
- }
1947
- tl.to(curTarget, copy, staggerFunc ? staggerFunc(i, curTarget, parsedTargets) : 0);
1948
- tl._ease = _easeMap.none;
1949
- }
1950
- tl.duration() ? duration = delay = 0 : _this3.timeline = 0;
1951
- } else if (keyframes) {
1952
- _inheritDefaults(_setDefaults(tl.vars.defaults, { ease: "none" }));
1953
- tl._ease = _parseEase(keyframes.ease || vars.ease || "none");
1954
- var time = 0, a, kf, v;
1955
- if (_isArray(keyframes)) {
1956
- keyframes.forEach(function(frame) {
1957
- return tl.to(parsedTargets, frame, ">");
1958
- });
1959
- tl.duration();
1960
- } else {
1961
- copy = {};
1962
- for (p in keyframes) p === "ease" || p === "easeEach" || _parseKeyframe(p, keyframes[p], copy, keyframes.easeEach);
1963
- for (p in copy) {
1964
- a = copy[p].sort(function(a, b) {
1965
- return a.t - b.t;
1966
- });
1967
- time = 0;
1968
- for (i = 0; i < a.length; i++) {
1969
- kf = a[i];
1970
- v = {
1971
- ease: kf.e,
1972
- duration: (kf.t - (i ? a[i - 1].t : 0)) / 100 * duration
1973
- };
1974
- v[p] = kf.v;
1975
- tl.to(parsedTargets, v, time);
1976
- time += v.duration;
1977
- }
1978
- }
1979
- tl.duration() < duration && tl.to({}, { duration: duration - tl.duration() });
1980
- }
1981
- }
1982
- duration || _this3.duration(duration = tl.duration());
1983
- } else _this3.timeline = 0;
1984
- if (overwrite === true && !_suppressOverwrites) {
1985
- _overwritingTween = _assertThisInitialized(_this3);
1986
- _globalTimeline.killTweensOf(parsedTargets);
1987
- _overwritingTween = 0;
1988
- }
1989
- _addToTimeline(parent, _assertThisInitialized(_this3), position);
1990
- vars.reversed && _this3.reverse();
1991
- vars.paused && _this3.paused(true);
1992
- if (immediateRender || !duration && !keyframes && _this3._start === _roundPrecise(parent._time) && _isNotFalse(immediateRender) && _hasNoPausedAncestors(_assertThisInitialized(_this3)) && parent.data !== "nested") {
1993
- _this3._tTime = -_tinyNum;
1994
- _this3.render(Math.max(0, -delay) || 0);
1995
- }
1996
- scrollTrigger && _scrollTrigger(_assertThisInitialized(_this3), scrollTrigger);
1997
- return _this3;
1998
- }
1999
- var _proto3 = Tween.prototype;
2000
- _proto3.render = function render(totalTime, suppressEvents, force) {
2001
- var prevTime = this._time, tDur = this._tDur, dur = this._dur, isNegative = totalTime < 0, tTime = totalTime > tDur - _tinyNum && !isNegative ? tDur : totalTime < _tinyNum ? 0 : totalTime, time, pt, iteration, cycleDuration, prevIteration, isYoyo, ratio, timeline, yoyoEase;
2002
- if (!dur) _renderZeroDurationTween(this, totalTime, suppressEvents, force);
2003
- else if (tTime !== this._tTime || !totalTime || force || !this._initted && this._tTime || this._startAt && this._zTime < 0 !== isNegative || this._lazy) {
2004
- time = tTime;
2005
- timeline = this.timeline;
2006
- if (this._repeat) {
2007
- cycleDuration = dur + this._rDelay;
2008
- if (this._repeat < -1 && isNegative) return this.totalTime(cycleDuration * 100 + totalTime, suppressEvents, force);
2009
- time = _roundPrecise(tTime % cycleDuration);
2010
- if (tTime === tDur) {
2011
- iteration = this._repeat;
2012
- time = dur;
2013
- } else {
2014
- prevIteration = _roundPrecise(tTime / cycleDuration);
2015
- iteration = ~~prevIteration;
2016
- if (iteration && iteration === prevIteration) {
2017
- time = dur;
2018
- iteration--;
2019
- } else if (time > dur) time = dur;
2020
- }
2021
- isYoyo = this._yoyo && iteration & 1;
2022
- if (isYoyo) {
2023
- yoyoEase = this._yEase;
2024
- time = dur - time;
2025
- }
2026
- prevIteration = _animationCycle(this._tTime, cycleDuration);
2027
- if (time === prevTime && !force && this._initted && iteration === prevIteration) {
2028
- this._tTime = tTime;
2029
- return this;
2030
- }
2031
- if (iteration !== prevIteration) {
2032
- timeline && this._yEase && _propagateYoyoEase(timeline, isYoyo);
2033
- if (this.vars.repeatRefresh && !isYoyo && !this._lock && time !== cycleDuration && this._initted) {
2034
- this._lock = force = 1;
2035
- this.render(_roundPrecise(cycleDuration * iteration), true).invalidate()._lock = 0;
2036
- }
2037
- }
2038
- }
2039
- if (!this._initted) {
2040
- if (_attemptInitTween(this, isNegative ? totalTime : time, force, suppressEvents, tTime)) {
2041
- this._tTime = 0;
2042
- return this;
2043
- }
2044
- if (prevTime !== this._time && !(force && this.vars.repeatRefresh && iteration !== prevIteration)) return this;
2045
- if (dur !== this._dur) return this.render(totalTime, suppressEvents, force);
2046
- }
2047
- this._tTime = tTime;
2048
- this._time = time;
2049
- if (!this._act && this._ts) {
2050
- this._act = 1;
2051
- this._lazy = 0;
2052
- }
2053
- this.ratio = ratio = (yoyoEase || this._ease)(time / dur);
2054
- if (this._from) this.ratio = ratio = 1 - ratio;
2055
- if (!prevTime && tTime && !suppressEvents && !prevIteration) {
2056
- _callback(this, "onStart");
2057
- if (this._tTime !== tTime) return this;
2058
- }
2059
- pt = this._pt;
2060
- while (pt) {
2061
- pt.r(ratio, pt.d);
2062
- pt = pt._next;
2063
- }
2064
- timeline && timeline.render(totalTime < 0 ? totalTime : timeline._dur * timeline._ease(time / this._dur), suppressEvents, force) || this._startAt && (this._zTime = totalTime);
2065
- if (this._onUpdate && !suppressEvents) {
2066
- isNegative && _rewindStartAt(this, totalTime, suppressEvents, force);
2067
- _callback(this, "onUpdate");
2068
- }
2069
- this._repeat && iteration !== prevIteration && this.vars.onRepeat && !suppressEvents && this.parent && _callback(this, "onRepeat");
2070
- if ((tTime === this._tDur || !tTime) && this._tTime === tTime) {
2071
- isNegative && !this._onUpdate && _rewindStartAt(this, totalTime, true, true);
2072
- (totalTime || !dur) && (tTime === this._tDur && this._ts > 0 || !tTime && this._ts < 0) && _removeFromParent(this, 1);
2073
- if (!suppressEvents && !(isNegative && !prevTime) && (tTime || prevTime || isYoyo)) {
2074
- _callback(this, tTime === tDur ? "onComplete" : "onReverseComplete", true);
2075
- this._prom && !(tTime < tDur && this.timeScale() > 0) && this._prom();
2076
- }
2077
- }
2078
- }
2079
- return this;
2080
- };
2081
- _proto3.targets = function targets() {
2082
- return this._targets;
2083
- };
2084
- _proto3.invalidate = function invalidate(soft) {
2085
- (!soft || !this.vars.runBackwards) && (this._startAt = 0);
2086
- this._pt = this._op = this._onUpdate = this._lazy = this.ratio = 0;
2087
- this._ptLookup = [];
2088
- this.timeline && this.timeline.invalidate(soft);
2089
- return _Animation2.prototype.invalidate.call(this, soft);
2090
- };
2091
- _proto3.resetTo = function resetTo(property, value, start, startIsRelative, skipRecursion) {
2092
- _tickerActive || _ticker.wake();
2093
- this._ts || this.play();
2094
- var time = Math.min(this._dur, (this._dp._time - this._start) * this._ts), ratio;
2095
- this._initted || _initTween(this, time);
2096
- ratio = this._ease(time / this._dur);
2097
- if (_updatePropTweens(this, property, value, start, startIsRelative, ratio, time, skipRecursion)) return this.resetTo(property, value, start, startIsRelative, 1);
2098
- _alignPlayhead(this, 0);
2099
- this.parent || _addLinkedListItem(this._dp, this, "_first", "_last", this._dp._sort ? "_start" : 0);
2100
- return this.render(0);
2101
- };
2102
- _proto3.kill = function kill(targets, vars) {
2103
- if (vars === void 0) vars = "all";
2104
- if (!targets && (!vars || vars === "all")) {
2105
- this._lazy = this._pt = 0;
2106
- this.parent ? _interrupt(this) : this.scrollTrigger && this.scrollTrigger.kill(!!_reverting);
2107
- return this;
2108
- }
2109
- if (this.timeline) {
2110
- var tDur = this.timeline.totalDuration();
2111
- this.timeline.killTweensOf(targets, vars, _overwritingTween && _overwritingTween.vars.overwrite !== true)._first || _interrupt(this);
2112
- this.parent && tDur !== this.timeline.totalDuration() && _setDuration(this, this._dur * this.timeline._tDur / tDur, 0, 1);
2113
- return this;
2114
- }
2115
- var parsedTargets = this._targets, killingTargets = targets ? toArray(targets) : parsedTargets, propTweenLookup = this._ptLookup, firstPT = this._pt, overwrittenProps, curLookup, curOverwriteProps, props, p, pt, i;
2116
- if ((!vars || vars === "all") && _arraysMatch(parsedTargets, killingTargets)) {
2117
- vars === "all" && (this._pt = 0);
2118
- return _interrupt(this);
2119
- }
2120
- overwrittenProps = this._op = this._op || [];
2121
- if (vars !== "all") {
2122
- if (_isString(vars)) {
2123
- p = {};
2124
- _forEachName(vars, function(name) {
2125
- return p[name] = 1;
2126
- });
2127
- vars = p;
2128
- }
2129
- vars = _addAliasesToVars(parsedTargets, vars);
2130
- }
2131
- i = parsedTargets.length;
2132
- while (i--) if (~killingTargets.indexOf(parsedTargets[i])) {
2133
- curLookup = propTweenLookup[i];
2134
- if (vars === "all") {
2135
- overwrittenProps[i] = vars;
2136
- props = curLookup;
2137
- curOverwriteProps = {};
2138
- } else {
2139
- curOverwriteProps = overwrittenProps[i] = overwrittenProps[i] || {};
2140
- props = vars;
2141
- }
2142
- for (p in props) {
2143
- pt = curLookup && curLookup[p];
2144
- if (pt) {
2145
- if (!("kill" in pt.d) || pt.d.kill(p) === true) _removeLinkedListItem(this, pt, "_pt");
2146
- delete curLookup[p];
2147
- }
2148
- if (curOverwriteProps !== "all") curOverwriteProps[p] = 1;
2149
- }
2150
- }
2151
- this._initted && !this._pt && firstPT && _interrupt(this);
2152
- return this;
2153
- };
2154
- Tween.to = function to(targets, vars) {
2155
- return new Tween(targets, vars, arguments[2]);
2156
- };
2157
- Tween.from = function from(targets, vars) {
2158
- return _createTweenType(1, arguments);
2159
- };
2160
- Tween.delayedCall = function delayedCall(delay, callback, params, scope) {
2161
- return new Tween(callback, 0, {
2162
- immediateRender: false,
2163
- lazy: false,
2164
- overwrite: false,
2165
- delay,
2166
- onComplete: callback,
2167
- onReverseComplete: callback,
2168
- onCompleteParams: params,
2169
- onReverseCompleteParams: params,
2170
- callbackScope: scope
2171
- });
2172
- };
2173
- Tween.fromTo = function fromTo(targets, fromVars, toVars) {
2174
- return _createTweenType(2, arguments);
2175
- };
2176
- Tween.set = function set(targets, vars) {
2177
- vars.duration = 0;
2178
- vars.repeatDelay || (vars.repeat = 0);
2179
- return new Tween(targets, vars);
2180
- };
2181
- Tween.killTweensOf = function killTweensOf(targets, props, onlyActive) {
2182
- return _globalTimeline.killTweensOf(targets, props, onlyActive);
2183
- };
2184
- return Tween;
2185
- }(Animation);
2186
- _setDefaults(Tween.prototype, {
2187
- _targets: [],
2188
- _lazy: 0,
2189
- _startAt: 0,
2190
- _op: 0,
2191
- _onInit: 0
2192
- });
2193
- _forEachName("staggerTo,staggerFrom,staggerFromTo", function(name) {
2194
- Tween[name] = function() {
2195
- var tl = new Timeline(), params = _slice.call(arguments, 0);
2196
- params.splice(name === "staggerFromTo" ? 5 : 4, 0, 0);
2197
- return tl[name].apply(tl, params);
2198
- };
2199
- });
2200
- var _setterPlain = function _setterPlain(target, property, value) {
2201
- return target[property] = value;
2202
- }, _setterFunc = function _setterFunc(target, property, value) {
2203
- return target[property](value);
2204
- }, _setterFuncWithParam = function _setterFuncWithParam(target, property, value, data) {
2205
- return target[property](data.fp, value);
2206
- }, _setterAttribute = function _setterAttribute(target, property, value) {
2207
- return target.setAttribute(property, value);
2208
- }, _getSetter = function _getSetter(target, property) {
2209
- return _isFunction(target[property]) ? _setterFunc : _isUndefined(target[property]) && target.setAttribute ? _setterAttribute : _setterPlain;
2210
- }, _renderPlain = function _renderPlain(ratio, data) {
2211
- return data.set(data.t, data.p, Math.round((data.s + data.c * ratio) * 1e6) / 1e6, data);
2212
- }, _renderBoolean = function _renderBoolean(ratio, data) {
2213
- return data.set(data.t, data.p, !!(data.s + data.c * ratio), data);
2214
- }, _renderComplexString = function _renderComplexString(ratio, data) {
2215
- var pt = data._pt, s = "";
2216
- if (!ratio && data.b) s = data.b;
2217
- else if (ratio === 1 && data.e) s = data.e;
2218
- else {
2219
- while (pt) {
2220
- s = pt.p + (pt.m ? pt.m(pt.s + pt.c * ratio) : Math.round((pt.s + pt.c * ratio) * 1e4) / 1e4) + s;
2221
- pt = pt._next;
2222
- }
2223
- s += data.c;
2224
- }
2225
- data.set(data.t, data.p, s, data);
2226
- }, _renderPropTweens = function _renderPropTweens(ratio, data) {
2227
- var pt = data._pt;
2228
- while (pt) {
2229
- pt.r(ratio, pt.d);
2230
- pt = pt._next;
2231
- }
2232
- }, _addPluginModifier = function _addPluginModifier(modifier, tween, target, property) {
2233
- var pt = this._pt, next;
2234
- while (pt) {
2235
- next = pt._next;
2236
- pt.p === property && pt.modifier(modifier, tween, target);
2237
- pt = next;
2238
- }
2239
- }, _killPropTweensOf = function _killPropTweensOf(property) {
2240
- var pt = this._pt, hasNonDependentRemaining, next;
2241
- while (pt) {
2242
- next = pt._next;
2243
- if (pt.p === property && !pt.op || pt.op === property) _removeLinkedListItem(this, pt, "_pt");
2244
- else if (!pt.dep) hasNonDependentRemaining = 1;
2245
- pt = next;
2246
- }
2247
- return !hasNonDependentRemaining;
2248
- }, _setterWithModifier = function _setterWithModifier(target, property, value, data) {
2249
- data.mSet(target, property, data.m.call(data.tween, value, data.mt), data);
2250
- }, _sortPropTweensByPriority = function _sortPropTweensByPriority(parent) {
2251
- var pt = parent._pt, next, pt2, first, last;
2252
- while (pt) {
2253
- next = pt._next;
2254
- pt2 = first;
2255
- while (pt2 && pt2.pr > pt.pr) pt2 = pt2._next;
2256
- if (pt._prev = pt2 ? pt2._prev : last) pt._prev._next = pt;
2257
- else first = pt;
2258
- if (pt._next = pt2) pt2._prev = pt;
2259
- else last = pt;
2260
- pt = next;
2261
- }
2262
- parent._pt = first;
2263
- };
2264
- var PropTween = /* @__PURE__ */ function() {
2265
- function PropTween(next, target, prop, start, change, renderer, data, setter, priority) {
2266
- this.t = target;
2267
- this.s = start;
2268
- this.c = change;
2269
- this.p = prop;
2270
- this.r = renderer || _renderPlain;
2271
- this.d = data || this;
2272
- this.set = setter || _setterPlain;
2273
- this.pr = priority || 0;
2274
- this._next = next;
2275
- if (next) next._prev = this;
2276
- }
2277
- var _proto4 = PropTween.prototype;
2278
- _proto4.modifier = function modifier(func, tween, target) {
2279
- this.mSet = this.mSet || this.set;
2280
- this.set = _setterWithModifier;
2281
- this.m = func;
2282
- this.mt = target;
2283
- this.tween = tween;
2284
- };
2285
- return PropTween;
2286
- }();
2287
- _forEachName(_callbackNames + "parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger", function(name) {
2288
- return _reservedProps[name] = 1;
2289
- });
2290
- _globals.TweenMax = _globals.TweenLite = Tween;
2291
- _globals.TimelineLite = _globals.TimelineMax = Timeline;
2292
- _globalTimeline = new Timeline({
2293
- sortChildren: false,
2294
- defaults: _defaults,
2295
- autoRemoveChildren: true,
2296
- id: "root",
2297
- smoothChildTiming: true
2298
- });
2299
- _config.stringFilter = _colorStringFilter;
2300
- var _media = [], _listeners = {}, _emptyArray = [], _lastMediaTime = 0, _contextID = 0, _dispatch = function _dispatch(type) {
2301
- return (_listeners[type] || _emptyArray).map(function(f) {
2302
- return f();
2303
- });
2304
- }, _onMediaChange = function _onMediaChange() {
2305
- var time = Date.now(), matches = [];
2306
- if (time - _lastMediaTime > 2) {
2307
- _dispatch("matchMediaInit");
2308
- _media.forEach(function(c) {
2309
- var queries = c.queries, conditions = c.conditions, match, p, anyMatch, toggled;
2310
- for (p in queries) {
2311
- match = _win.matchMedia(queries[p]).matches;
2312
- match && (anyMatch = 1);
2313
- if (match !== conditions[p]) {
2314
- conditions[p] = match;
2315
- toggled = 1;
2316
- }
2317
- }
2318
- if (toggled) {
2319
- c.revert();
2320
- anyMatch && matches.push(c);
2321
- }
2322
- });
2323
- _dispatch("matchMediaRevert");
2324
- matches.forEach(function(c) {
2325
- return c.onMatch(c, function(func) {
2326
- return c.add(null, func);
2327
- });
2328
- });
2329
- _lastMediaTime = time;
2330
- _dispatch("matchMedia");
2331
- }
2332
- };
2333
- var Context = /* @__PURE__ */ function() {
2334
- function Context(func, scope) {
2335
- this.selector = scope && selector(scope);
2336
- this.data = [];
2337
- this._r = [];
2338
- this.isReverted = false;
2339
- this.id = _contextID++;
2340
- func && this.add(func);
2341
- }
2342
- var _proto5 = Context.prototype;
2343
- _proto5.add = function add(name, func, scope) {
2344
- if (_isFunction(name)) {
2345
- scope = func;
2346
- func = name;
2347
- name = _isFunction;
2348
- }
2349
- var self = this, f = function f() {
2350
- var prev = _context, prevSelector = self.selector, result;
2351
- prev && prev !== self && prev.data.push(self);
2352
- scope && (self.selector = selector(scope));
2353
- _context = self;
2354
- result = func.apply(self, arguments);
2355
- _isFunction(result) && self._r.push(result);
2356
- _context = prev;
2357
- self.selector = prevSelector;
2358
- self.isReverted = false;
2359
- return result;
2360
- };
2361
- self.last = f;
2362
- return name === _isFunction ? f(self, function(func) {
2363
- return self.add(null, func);
2364
- }) : name ? self[name] = f : f;
2365
- };
2366
- _proto5.ignore = function ignore(func) {
2367
- var prev = _context;
2368
- _context = null;
2369
- func(this);
2370
- _context = prev;
2371
- };
2372
- _proto5.getTweens = function getTweens() {
2373
- var a = [];
2374
- this.data.forEach(function(e) {
2375
- return e instanceof Context ? a.push.apply(a, e.getTweens()) : e instanceof Tween && !(e.parent && e.parent.data === "nested") && a.push(e);
2376
- });
2377
- return a;
2378
- };
2379
- _proto5.clear = function clear() {
2380
- this._r.length = this.data.length = 0;
2381
- };
2382
- _proto5.kill = function kill(revert, matchMedia) {
2383
- var _this4 = this;
2384
- if (revert) (function() {
2385
- var tweens = _this4.getTweens(), i = _this4.data.length, t;
2386
- while (i--) {
2387
- t = _this4.data[i];
2388
- if (t.data === "isFlip") {
2389
- t.revert();
2390
- t.getChildren(true, true, false).forEach(function(tween) {
2391
- return tweens.splice(tweens.indexOf(tween), 1);
2392
- });
2393
- }
2394
- }
2395
- tweens.map(function(t) {
2396
- return {
2397
- g: t._dur || t._delay || t._sat && !t._sat.vars.immediateRender ? t.globalTime(0) : -Infinity,
2398
- t
2399
- };
2400
- }).sort(function(a, b) {
2401
- return b.g - a.g || -Infinity;
2402
- }).forEach(function(o) {
2403
- return o.t.revert(revert);
2404
- });
2405
- i = _this4.data.length;
2406
- while (i--) {
2407
- t = _this4.data[i];
2408
- if (t instanceof Timeline) {
2409
- if (t.data !== "nested") {
2410
- t.scrollTrigger && t.scrollTrigger.revert();
2411
- t.kill();
2412
- }
2413
- } else !(t instanceof Tween) && t.revert && t.revert(revert);
2414
- }
2415
- _this4._r.forEach(function(f) {
2416
- return f(revert, _this4);
2417
- });
2418
- _this4.isReverted = true;
2419
- })();
2420
- else this.data.forEach(function(e) {
2421
- return e.kill && e.kill();
2422
- });
2423
- this.clear();
2424
- if (matchMedia) {
2425
- var i = _media.length;
2426
- while (i--) _media[i].id === this.id && _media.splice(i, 1);
2427
- }
2428
- };
2429
- _proto5.revert = function revert(config) {
2430
- this.kill(config || {});
2431
- };
2432
- return Context;
2433
- }();
2434
- var MatchMedia = /* @__PURE__ */ function() {
2435
- function MatchMedia(scope) {
2436
- this.contexts = [];
2437
- this.scope = scope;
2438
- _context && _context.data.push(this);
2439
- }
2440
- var _proto6 = MatchMedia.prototype;
2441
- _proto6.add = function add(conditions, func, scope) {
2442
- _isObject(conditions) || (conditions = { matches: conditions });
2443
- var context = new Context(0, scope || this.scope), cond = context.conditions = {}, mq, p, active;
2444
- _context && !context.selector && (context.selector = _context.selector);
2445
- this.contexts.push(context);
2446
- func = context.add("onMatch", func);
2447
- context.queries = conditions;
2448
- for (p in conditions) if (p === "all") active = 1;
2449
- else {
2450
- mq = _win.matchMedia(conditions[p]);
2451
- if (mq) {
2452
- _media.indexOf(context) < 0 && _media.push(context);
2453
- (cond[p] = mq.matches) && (active = 1);
2454
- mq.addListener ? mq.addListener(_onMediaChange) : mq.addEventListener("change", _onMediaChange);
2455
- }
2456
- }
2457
- active && func(context, function(f) {
2458
- return context.add(null, f);
2459
- });
2460
- return this;
2461
- };
2462
- _proto6.revert = function revert(config) {
2463
- this.kill(config || {});
2464
- };
2465
- _proto6.kill = function kill(revert) {
2466
- this.contexts.forEach(function(c) {
2467
- return c.kill(revert, true);
2468
- });
2469
- };
2470
- return MatchMedia;
2471
- }();
2472
- var _gsap = {
2473
- registerPlugin: function registerPlugin() {
2474
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) args[_key2] = arguments[_key2];
2475
- args.forEach(function(config) {
2476
- return _createPlugin(config);
2477
- });
2478
- },
2479
- timeline: function timeline(vars) {
2480
- return new Timeline(vars);
2481
- },
2482
- getTweensOf: function getTweensOf(targets, onlyActive) {
2483
- return _globalTimeline.getTweensOf(targets, onlyActive);
2484
- },
2485
- getProperty: function getProperty(target, property, unit, uncache) {
2486
- _isString(target) && (target = toArray(target)[0]);
2487
- var getter = _getCache(target || {}).get, format = unit ? _passThrough : _numericIfPossible;
2488
- unit === "native" && (unit = "");
2489
- return !target ? target : !property ? function(property, unit, uncache) {
2490
- return format((_plugins[property] && _plugins[property].get || getter)(target, property, unit, uncache));
2491
- } : format((_plugins[property] && _plugins[property].get || getter)(target, property, unit, uncache));
2492
- },
2493
- quickSetter: function quickSetter(target, property, unit) {
2494
- target = toArray(target);
2495
- if (target.length > 1) {
2496
- var setters = target.map(function(t) {
2497
- return gsap.quickSetter(t, property, unit);
2498
- }), l = setters.length;
2499
- return function(value) {
2500
- var i = l;
2501
- while (i--) setters[i](value);
2502
- };
2503
- }
2504
- target = target[0] || {};
2505
- var Plugin = _plugins[property], cache = _getCache(target), p = cache.harness && (cache.harness.aliases || {})[property] || property, setter = Plugin ? function(value) {
2506
- var p = new Plugin();
2507
- _quickTween._pt = 0;
2508
- p.init(target, unit ? value + unit : value, _quickTween, 0, [target]);
2509
- p.render(1, p);
2510
- _quickTween._pt && _renderPropTweens(1, _quickTween);
2511
- } : cache.set(target, p);
2512
- return Plugin ? setter : function(value) {
2513
- return setter(target, p, unit ? value + unit : value, cache, 1);
2514
- };
2515
- },
2516
- quickTo: function quickTo(target, property, vars) {
2517
- var _setDefaults2;
2518
- var tween = gsap.to(target, _setDefaults((_setDefaults2 = {}, _setDefaults2[property] = "+=0.1", _setDefaults2.paused = true, _setDefaults2.stagger = 0, _setDefaults2), vars || {})), func = function func(value, start, startIsRelative) {
2519
- return tween.resetTo(property, value, start, startIsRelative);
2520
- };
2521
- func.tween = tween;
2522
- return func;
2523
- },
2524
- isTweening: function isTweening(targets) {
2525
- return _globalTimeline.getTweensOf(targets, true).length > 0;
2526
- },
2527
- defaults: function defaults(value) {
2528
- value && value.ease && (value.ease = _parseEase(value.ease, _defaults.ease));
2529
- return _mergeDeep(_defaults, value || {});
2530
- },
2531
- config: function config(value) {
2532
- return _mergeDeep(_config, value || {});
2533
- },
2534
- registerEffect: function registerEffect(_ref3) {
2535
- var name = _ref3.name, effect = _ref3.effect, plugins = _ref3.plugins, defaults = _ref3.defaults, extendTimeline = _ref3.extendTimeline;
2536
- (plugins || "").split(",").forEach(function(pluginName) {
2537
- return pluginName && !_plugins[pluginName] && !_globals[pluginName] && _warn(name + " effect requires " + pluginName + " plugin.");
2538
- });
2539
- _effects[name] = function(targets, vars, tl) {
2540
- return effect(toArray(targets), _setDefaults(vars || {}, defaults), tl);
2541
- };
2542
- if (extendTimeline) Timeline.prototype[name] = function(targets, vars, position) {
2543
- return this.add(_effects[name](targets, _isObject(vars) ? vars : (position = vars) && {}, this), position);
2544
- };
2545
- },
2546
- registerEase: function registerEase(name, ease) {
2547
- _easeMap[name] = _parseEase(ease);
2548
- },
2549
- parseEase: function parseEase(ease, defaultEase) {
2550
- return arguments.length ? _parseEase(ease, defaultEase) : _easeMap;
2551
- },
2552
- getById: function getById(id) {
2553
- return _globalTimeline.getById(id);
2554
- },
2555
- exportRoot: function exportRoot(vars, includeDelayedCalls) {
2556
- if (vars === void 0) vars = {};
2557
- var tl = new Timeline(vars), child, next;
2558
- tl.smoothChildTiming = _isNotFalse(vars.smoothChildTiming);
2559
- _globalTimeline.remove(tl);
2560
- tl._dp = 0;
2561
- tl._time = tl._tTime = _globalTimeline._time;
2562
- child = _globalTimeline._first;
2563
- while (child) {
2564
- next = child._next;
2565
- if (includeDelayedCalls || !(!child._dur && child instanceof Tween && child.vars.onComplete === child._targets[0])) _addToTimeline(tl, child, child._start - child._delay);
2566
- child = next;
2567
- }
2568
- _addToTimeline(_globalTimeline, tl, 0);
2569
- return tl;
2570
- },
2571
- context: function context(func, scope) {
2572
- return func ? new Context(func, scope) : _context;
2573
- },
2574
- matchMedia: function matchMedia(scope) {
2575
- return new MatchMedia(scope);
2576
- },
2577
- matchMediaRefresh: function matchMediaRefresh() {
2578
- return _media.forEach(function(c) {
2579
- var cond = c.conditions, found, p;
2580
- for (p in cond) if (cond[p]) {
2581
- cond[p] = false;
2582
- found = 1;
2583
- }
2584
- found && c.revert();
2585
- }) || _onMediaChange();
2586
- },
2587
- addEventListener: function addEventListener(type, callback) {
2588
- var a = _listeners[type] || (_listeners[type] = []);
2589
- ~a.indexOf(callback) || a.push(callback);
2590
- },
2591
- removeEventListener: function removeEventListener(type, callback) {
2592
- var a = _listeners[type], i = a && a.indexOf(callback);
2593
- i >= 0 && a.splice(i, 1);
2594
- },
2595
- utils: {
2596
- wrap,
2597
- wrapYoyo,
2598
- distribute,
2599
- random,
2600
- snap,
2601
- normalize,
2602
- getUnit,
2603
- clamp,
2604
- splitColor,
2605
- toArray,
2606
- selector,
2607
- mapRange,
2608
- pipe,
2609
- unitize,
2610
- interpolate,
2611
- shuffle
2612
- },
2613
- install: _install,
2614
- effects: _effects,
2615
- ticker: _ticker,
2616
- updateRoot: Timeline.updateRoot,
2617
- plugins: _plugins,
2618
- globalTimeline: _globalTimeline,
2619
- core: {
2620
- PropTween,
2621
- globals: _addGlobal,
2622
- Tween,
2623
- Timeline,
2624
- Animation,
2625
- getCache: _getCache,
2626
- _removeLinkedListItem,
2627
- reverting: function reverting() {
2628
- return _reverting;
2629
- },
2630
- context: function context(toAdd) {
2631
- if (toAdd && _context) {
2632
- _context.data.push(toAdd);
2633
- toAdd._ctx = _context;
2634
- }
2635
- return _context;
2636
- },
2637
- suppressOverwrites: function suppressOverwrites(value) {
2638
- return _suppressOverwrites = value;
2639
- }
2640
- }
2641
- };
2642
- _forEachName("to,from,fromTo,delayedCall,set,killTweensOf", function(name) {
2643
- return _gsap[name] = Tween[name];
2644
- });
2645
- _ticker.add(Timeline.updateRoot);
2646
- _quickTween = _gsap.to({}, { duration: 0 });
2647
- var _getPluginPropTween = function _getPluginPropTween(plugin, prop) {
2648
- var pt = plugin._pt;
2649
- while (pt && pt.p !== prop && pt.op !== prop && pt.fp !== prop) pt = pt._next;
2650
- return pt;
2651
- }, _addModifiers = function _addModifiers(tween, modifiers) {
2652
- var targets = tween._targets, p, i, pt;
2653
- for (p in modifiers) {
2654
- i = targets.length;
2655
- while (i--) {
2656
- pt = tween._ptLookup[i][p];
2657
- if (pt && (pt = pt.d)) {
2658
- if (pt._pt) pt = _getPluginPropTween(pt, p);
2659
- pt && pt.modifier && pt.modifier(modifiers[p], tween, targets[i], p);
2660
- }
2661
- }
2662
- }
2663
- }, _buildModifierPlugin = function _buildModifierPlugin(name, modifier) {
2664
- return {
2665
- name,
2666
- headless: 1,
2667
- rawVars: 1,
2668
- init: function init(target, vars, tween) {
2669
- tween._onInit = function(tween) {
2670
- var temp, p;
2671
- if (_isString(vars)) {
2672
- temp = {};
2673
- _forEachName(vars, function(name) {
2674
- return temp[name] = 1;
2675
- });
2676
- vars = temp;
2677
- }
2678
- if (modifier) {
2679
- temp = {};
2680
- for (p in vars) temp[p] = modifier(vars[p]);
2681
- vars = temp;
2682
- }
2683
- _addModifiers(tween, vars);
2684
- };
2685
- }
2686
- };
2687
- };
2688
- var gsap = _gsap.registerPlugin({
2689
- name: "attr",
2690
- init: function init(target, vars, tween, index, targets) {
2691
- var p, pt, v;
2692
- this.tween = tween;
2693
- for (p in vars) {
2694
- v = target.getAttribute(p) || "";
2695
- pt = this.add(target, "setAttribute", (v || 0) + "", vars[p], index, targets, 0, 0, p);
2696
- pt.op = p;
2697
- pt.b = v;
2698
- this._props.push(p);
2699
- }
2700
- },
2701
- render: function render(ratio, data) {
2702
- var pt = data._pt;
2703
- while (pt) {
2704
- _reverting ? pt.set(pt.t, pt.p, pt.b, pt) : pt.r(ratio, pt.d);
2705
- pt = pt._next;
2706
- }
2707
- }
2708
- }, {
2709
- name: "endArray",
2710
- headless: 1,
2711
- init: function init(target, value) {
2712
- var i = value.length;
2713
- while (i--) this.add(target, i, target[i] || 0, value[i], 0, 0, 0, 0, 0, 1);
2714
- }
2715
- }, _buildModifierPlugin("roundProps", _roundModifier), _buildModifierPlugin("modifiers"), _buildModifierPlugin("snap", snap)) || _gsap;
2716
- Tween.version = Timeline.version = gsap.version = "3.14.2";
2717
- _coreReady = 1;
2718
- _windowExists() && _wake();
2719
- var Power0 = _easeMap.Power0, Power1 = _easeMap.Power1, Power2 = _easeMap.Power2, Power3 = _easeMap.Power3, Power4 = _easeMap.Power4, Linear = _easeMap.Linear, Quad = _easeMap.Quad, Cubic = _easeMap.Cubic, Quart = _easeMap.Quart, Quint = _easeMap.Quint, Strong = _easeMap.Strong, Elastic = _easeMap.Elastic, Back = _easeMap.Back, SteppedEase = _easeMap.SteppedEase, Bounce = _easeMap.Bounce, Sine = _easeMap.Sine, Expo = _easeMap.Expo, Circ = _easeMap.Circ;
2720
-
2721
- //#endregion
2722
- export { GSCache, PropTween, Timeline, Tween, _checkPlugin, _colorExp, _colorStringFilter, _config, _forEachName, _getCache, _getProperty, _getSetter, _isString, _isUndefined, _missingPlugin, _numExp, _numWithUnitExp, _parseRelative, _plugins, _relExp, _renderComplexString, _replaceRandom, _round, _sortPropTweensByPriority, _ticker, getUnit, gsap };
2723
- //# sourceMappingURL=gsap-core.mjs.map