gsap.js 148 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541
  1. function _assertThisInitialized(self) {
  2. if (self === void 0) {
  3. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  4. }
  5. return self;
  6. }
  7. function _inheritsLoose(subClass, superClass) {
  8. subClass.prototype = Object.create(superClass.prototype);
  9. subClass.prototype.constructor = subClass;
  10. subClass.__proto__ = superClass;
  11. }
  12. /*!
  13. * GSAP 3.10.4
  14. * https://greensock.com
  15. *
  16. * @license Copyright 2008-2022, GreenSock. All rights reserved.
  17. * Subject to the terms at https://greensock.com/standard-license or for
  18. * Club GreenSock members, the agreement issued with that membership.
  19. * @author: Jack Doyle, jack@greensock.com
  20. */
  21. var _config = {
  22. autoSleep: 120,
  23. force3D: "auto",
  24. nullTargetWarn: 1,
  25. units: {
  26. lineHeight: ""
  27. }
  28. }, _defaults = {
  29. duration: 0.5,
  30. overwrite: false,
  31. delay: 0
  32. }, _suppressOverwrites, _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 _isString2(value) {
  33. return typeof value === "string";
  34. }, _isFunction = function _isFunction2(value) {
  35. return typeof value === "function";
  36. }, _isNumber = function _isNumber2(value) {
  37. return typeof value === "number";
  38. }, _isUndefined = function _isUndefined2(value) {
  39. return typeof value === "undefined";
  40. }, _isObject = function _isObject2(value) {
  41. return typeof value === "object";
  42. }, _isNotFalse = function _isNotFalse2(value) {
  43. return value !== false;
  44. }, _windowExists = function _windowExists2() {
  45. return typeof window !== "undefined";
  46. }, _isFuncOrString = function _isFuncOrString2(value) {
  47. return _isFunction(value) || _isString(value);
  48. }, _isTypedArray = typeof ArrayBuffer === "function" && ArrayBuffer.isView || function() {
  49. }, _isArray = Array.isArray, _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 _install2(scope) {
  50. return (_installScope = _merge(scope, _globals)) && gsap;
  51. }, _missingPlugin = function _missingPlugin2(property, value) {
  52. return console.warn("Invalid property", property, "set to", value, "Missing plugin? gsap.registerPlugin()");
  53. }, _warn = function _warn2(message, suppress) {
  54. return !suppress && console.warn(message);
  55. }, _addGlobal = function _addGlobal2(name, obj) {
  56. return name && (_globals[name] = obj) && _installScope && (_installScope[name] = obj) || _globals;
  57. }, _emptyFunc = function _emptyFunc2() {
  58. return 0;
  59. }, _reservedProps = {}, _lazyTweens = [], _lazyLookup = {}, _lastRenderedFrame, _plugins = {}, _effects = {}, _nextGCFrame = 30, _harnessPlugins = [], _callbackNames = "", _harness = function _harness2(targets) {
  60. var target = targets[0], harnessPlugin, i;
  61. _isObject(target) || _isFunction(target) || (targets = [targets]);
  62. if (!(harnessPlugin = (target._gsap || {}).harness)) {
  63. i = _harnessPlugins.length;
  64. while (i-- && !_harnessPlugins[i].targetTest(target)) {
  65. }
  66. harnessPlugin = _harnessPlugins[i];
  67. }
  68. i = targets.length;
  69. while (i--) {
  70. targets[i] && (targets[i]._gsap || (targets[i]._gsap = new GSCache(targets[i], harnessPlugin))) || targets.splice(i, 1);
  71. }
  72. return targets;
  73. }, _getCache = function _getCache2(target) {
  74. return target._gsap || _harness(toArray(target))[0]._gsap;
  75. }, _getProperty = function _getProperty2(target, property, v) {
  76. return (v = target[property]) && _isFunction(v) ? target[property]() : _isUndefined(v) && target.getAttribute && target.getAttribute(property) || v;
  77. }, _forEachName = function _forEachName2(names, func) {
  78. return (names = names.split(",")).forEach(func) || names;
  79. }, _round = function _round2(value) {
  80. return Math.round(value * 1e5) / 1e5 || 0;
  81. }, _roundPrecise = function _roundPrecise2(value) {
  82. return Math.round(value * 1e7) / 1e7 || 0;
  83. }, _parseRelative = function _parseRelative2(start, value) {
  84. var operator = value.charAt(0), end = parseFloat(value.substr(2));
  85. start = parseFloat(start);
  86. return operator === "+" ? start + end : operator === "-" ? start - end : operator === "*" ? start * end : start / end;
  87. }, _arrayContainsAny = function _arrayContainsAny2(toSearch, toFind) {
  88. var l = toFind.length, i = 0;
  89. for (; toSearch.indexOf(toFind[i]) < 0 && ++i < l; ) {
  90. }
  91. return i < l;
  92. }, _lazyRender = function _lazyRender2() {
  93. var l = _lazyTweens.length, a = _lazyTweens.slice(0), i, tween;
  94. _lazyLookup = {};
  95. _lazyTweens.length = 0;
  96. for (i = 0; i < l; i++) {
  97. tween = a[i];
  98. tween && tween._lazy && (tween.render(tween._lazy[0], tween._lazy[1], true)._lazy = 0);
  99. }
  100. }, _lazySafeRender = function _lazySafeRender2(animation, time, suppressEvents, force) {
  101. _lazyTweens.length && _lazyRender();
  102. animation.render(time, suppressEvents, force);
  103. _lazyTweens.length && _lazyRender();
  104. }, _numericIfPossible = function _numericIfPossible2(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 _passThrough2(p) {
  108. return p;
  109. }, _setDefaults = function _setDefaults2(obj, defaults2) {
  110. for (var p in defaults2) {
  111. p in obj || (obj[p] = defaults2[p]);
  112. }
  113. return obj;
  114. }, _setKeyframeDefaults = function _setKeyframeDefaults2(excludeDuration) {
  115. return function(obj, defaults2) {
  116. for (var p in defaults2) {
  117. p in obj || p === "duration" && excludeDuration || p === "ease" || (obj[p] = defaults2[p]);
  118. }
  119. };
  120. }, _merge = function _merge2(base, toMerge) {
  121. for (var p in toMerge) {
  122. base[p] = toMerge[p];
  123. }
  124. return base;
  125. }, _mergeDeep = function _mergeDeep2(base, toMerge) {
  126. for (var p in toMerge) {
  127. p !== "__proto__" && p !== "constructor" && p !== "prototype" && (base[p] = _isObject(toMerge[p]) ? _mergeDeep2(base[p] || (base[p] = {}), toMerge[p]) : toMerge[p]);
  128. }
  129. return base;
  130. }, _copyExcluding = function _copyExcluding2(obj, excluding) {
  131. var copy = {}, p;
  132. for (p in obj) {
  133. p in excluding || (copy[p] = obj[p]);
  134. }
  135. return copy;
  136. }, _inheritDefaults = function _inheritDefaults2(vars) {
  137. var parent = vars.parent || _globalTimeline, func = vars.keyframes ? _setKeyframeDefaults(_isArray(vars.keyframes)) : _setDefaults;
  138. if (_isNotFalse(vars.inherit)) {
  139. while (parent) {
  140. func(vars, parent.vars.defaults);
  141. parent = parent.parent || parent._dp;
  142. }
  143. }
  144. return vars;
  145. }, _arraysMatch = function _arraysMatch2(a1, a2) {
  146. var i = a1.length, match = i === a2.length;
  147. while (match && i-- && a1[i] === a2[i]) {
  148. }
  149. return i < 0;
  150. }, _addLinkedListItem = function _addLinkedListItem2(parent, child, firstProp, lastProp, sortBy) {
  151. if (firstProp === void 0) {
  152. firstProp = "_first";
  153. }
  154. if (lastProp === void 0) {
  155. lastProp = "_last";
  156. }
  157. var prev = parent[lastProp], t;
  158. if (sortBy) {
  159. t = child[sortBy];
  160. while (prev && prev[sortBy] > t) {
  161. prev = prev._prev;
  162. }
  163. }
  164. if (prev) {
  165. child._next = prev._next;
  166. prev._next = child;
  167. } else {
  168. child._next = parent[firstProp];
  169. parent[firstProp] = child;
  170. }
  171. if (child._next) {
  172. child._next._prev = child;
  173. } else {
  174. parent[lastProp] = child;
  175. }
  176. child._prev = prev;
  177. child.parent = child._dp = parent;
  178. return child;
  179. }, _removeLinkedListItem = function _removeLinkedListItem2(parent, child, firstProp, lastProp) {
  180. if (firstProp === void 0) {
  181. firstProp = "_first";
  182. }
  183. if (lastProp === void 0) {
  184. lastProp = "_last";
  185. }
  186. var prev = child._prev, next = child._next;
  187. if (prev) {
  188. prev._next = next;
  189. } else if (parent[firstProp] === child) {
  190. parent[firstProp] = next;
  191. }
  192. if (next) {
  193. next._prev = prev;
  194. } else if (parent[lastProp] === child) {
  195. parent[lastProp] = prev;
  196. }
  197. child._next = child._prev = child.parent = null;
  198. }, _removeFromParent = function _removeFromParent2(child, onlyIfParentHasAutoRemove) {
  199. child.parent && (!onlyIfParentHasAutoRemove || child.parent.autoRemoveChildren) && child.parent.remove(child);
  200. child._act = 0;
  201. }, _uncache = function _uncache2(animation, child) {
  202. if (animation && (!child || child._end > animation._dur || child._start < 0)) {
  203. var a = animation;
  204. while (a) {
  205. a._dirty = 1;
  206. a = a.parent;
  207. }
  208. }
  209. return animation;
  210. }, _recacheAncestors = function _recacheAncestors2(animation) {
  211. var parent = animation.parent;
  212. while (parent && parent.parent) {
  213. parent._dirty = 1;
  214. parent.totalDuration();
  215. parent = parent.parent;
  216. }
  217. return animation;
  218. }, _hasNoPausedAncestors = function _hasNoPausedAncestors2(animation) {
  219. return !animation || animation._ts && _hasNoPausedAncestors2(animation.parent);
  220. }, _elapsedCycleDuration = function _elapsedCycleDuration2(animation) {
  221. return animation._repeat ? _animationCycle(animation._tTime, animation = animation.duration() + animation._rDelay) * animation : 0;
  222. }, _animationCycle = function _animationCycle2(tTime, cycleDuration) {
  223. var whole = Math.floor(tTime /= cycleDuration);
  224. return tTime && whole === tTime ? whole - 1 : whole;
  225. }, _parentToChildTotalTime = function _parentToChildTotalTime2(parentTime, child) {
  226. return (parentTime - child._start) * child._ts + (child._ts >= 0 ? 0 : child._dirty ? child.totalDuration() : child._tDur);
  227. }, _setEnd = function _setEnd2(animation) {
  228. return animation._end = _roundPrecise(animation._start + (animation._tDur / Math.abs(animation._ts || animation._rts || _tinyNum) || 0));
  229. }, _alignPlayhead = function _alignPlayhead2(animation, totalTime) {
  230. var parent = animation._dp;
  231. if (parent && parent.smoothChildTiming && animation._ts) {
  232. animation._start = _roundPrecise(parent._time - (animation._ts > 0 ? totalTime / animation._ts : ((animation._dirty ? animation.totalDuration() : animation._tDur) - totalTime) / -animation._ts));
  233. _setEnd(animation);
  234. parent._dirty || _uncache(parent, animation);
  235. }
  236. return animation;
  237. }, _postAddChecks = function _postAddChecks2(timeline2, child) {
  238. var t;
  239. if (child._time || child._initted && !child._dur) {
  240. t = _parentToChildTotalTime(timeline2.rawTime(), child);
  241. if (!child._dur || _clamp(0, child.totalDuration(), t) - child._tTime > _tinyNum) {
  242. child.render(t, true);
  243. }
  244. }
  245. if (_uncache(timeline2, child)._dp && timeline2._initted && timeline2._time >= timeline2._dur && timeline2._ts) {
  246. if (timeline2._dur < timeline2.duration()) {
  247. t = timeline2;
  248. while (t._dp) {
  249. t.rawTime() >= 0 && t.totalTime(t._tTime);
  250. t = t._dp;
  251. }
  252. }
  253. timeline2._zTime = -_tinyNum;
  254. }
  255. }, _addToTimeline = function _addToTimeline2(timeline2, child, position, skipChecks) {
  256. child.parent && _removeFromParent(child);
  257. child._start = _roundPrecise((_isNumber(position) ? position : position || timeline2 !== _globalTimeline ? _parsePosition(timeline2, position, child) : timeline2._time) + child._delay);
  258. child._end = _roundPrecise(child._start + (child.totalDuration() / Math.abs(child.timeScale()) || 0));
  259. _addLinkedListItem(timeline2, child, "_first", "_last", timeline2._sort ? "_start" : 0);
  260. _isFromOrFromStart(child) || (timeline2._recent = child);
  261. skipChecks || _postAddChecks(timeline2, child);
  262. return timeline2;
  263. }, _scrollTrigger = function _scrollTrigger2(animation, trigger) {
  264. return (_globals.ScrollTrigger || _missingPlugin("scrollTrigger", trigger)) && _globals.ScrollTrigger.create(trigger, animation);
  265. }, _attemptInitTween = function _attemptInitTween2(tween, totalTime, force, suppressEvents) {
  266. _initTween(tween, totalTime);
  267. if (!tween._initted) {
  268. return 1;
  269. }
  270. if (!force && tween._pt && (tween._dur && tween.vars.lazy !== false || !tween._dur && tween.vars.lazy) && _lastRenderedFrame !== _ticker.frame) {
  271. _lazyTweens.push(tween);
  272. tween._lazy = [totalTime, suppressEvents];
  273. return 1;
  274. }
  275. }, _parentPlayheadIsBeforeStart = function _parentPlayheadIsBeforeStart2(_ref) {
  276. var parent = _ref.parent;
  277. return parent && parent._ts && parent._initted && !parent._lock && (parent.rawTime() < 0 || _parentPlayheadIsBeforeStart2(parent));
  278. }, _isFromOrFromStart = function _isFromOrFromStart2(_ref2) {
  279. var data = _ref2.data;
  280. return data === "isFromStart" || data === "isStart";
  281. }, _renderZeroDurationTween = function _renderZeroDurationTween2(tween, totalTime, suppressEvents, force) {
  282. 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;
  283. if (repeatDelay && tween._repeat) {
  284. tTime = _clamp(0, tween._tDur, totalTime);
  285. iteration = _animationCycle(tTime, repeatDelay);
  286. tween._yoyo && iteration & 1 && (ratio = 1 - ratio);
  287. if (iteration !== _animationCycle(tween._tTime, repeatDelay)) {
  288. prevRatio = 1 - ratio;
  289. tween.vars.repeatRefresh && tween._initted && tween.invalidate();
  290. }
  291. }
  292. if (ratio !== prevRatio || force || tween._zTime === _tinyNum || !totalTime && tween._zTime) {
  293. if (!tween._initted && _attemptInitTween(tween, totalTime, force, suppressEvents)) {
  294. return;
  295. }
  296. prevIteration = tween._zTime;
  297. tween._zTime = totalTime || (suppressEvents ? _tinyNum : 0);
  298. suppressEvents || (suppressEvents = totalTime && !prevIteration);
  299. tween.ratio = ratio;
  300. tween._from && (ratio = 1 - ratio);
  301. tween._time = 0;
  302. tween._tTime = tTime;
  303. pt = tween._pt;
  304. while (pt) {
  305. pt.r(ratio, pt.d);
  306. pt = pt._next;
  307. }
  308. tween._startAt && totalTime < 0 && tween._startAt.render(totalTime, true, true);
  309. tween._onUpdate && !suppressEvents && _callback(tween, "onUpdate");
  310. tTime && tween._repeat && !suppressEvents && tween.parent && _callback(tween, "onRepeat");
  311. if ((totalTime >= tween._tDur || totalTime < 0) && tween.ratio === ratio) {
  312. ratio && _removeFromParent(tween, 1);
  313. if (!suppressEvents) {
  314. _callback(tween, ratio ? "onComplete" : "onReverseComplete", true);
  315. tween._prom && tween._prom();
  316. }
  317. }
  318. } else if (!tween._zTime) {
  319. tween._zTime = totalTime;
  320. }
  321. }, _findNextPauseTween = function _findNextPauseTween2(animation, prevTime, time) {
  322. var child;
  323. if (time > prevTime) {
  324. child = animation._first;
  325. while (child && child._start <= time) {
  326. if (child.data === "isPause" && child._start > prevTime) {
  327. return child;
  328. }
  329. child = child._next;
  330. }
  331. } else {
  332. child = animation._last;
  333. while (child && child._start >= time) {
  334. if (child.data === "isPause" && child._start < prevTime) {
  335. return child;
  336. }
  337. child = child._prev;
  338. }
  339. }
  340. }, _setDuration = function _setDuration2(animation, duration, skipUncache, leavePlayhead) {
  341. var repeat = animation._repeat, dur = _roundPrecise(duration) || 0, totalProgress = animation._tTime / animation._tDur;
  342. totalProgress && !leavePlayhead && (animation._time *= dur / animation._dur);
  343. animation._dur = dur;
  344. animation._tDur = !repeat ? dur : repeat < 0 ? 1e10 : _roundPrecise(dur * (repeat + 1) + animation._rDelay * repeat);
  345. totalProgress > 0 && !leavePlayhead ? _alignPlayhead(animation, animation._tTime = animation._tDur * totalProgress) : animation.parent && _setEnd(animation);
  346. skipUncache || _uncache(animation.parent, animation);
  347. return animation;
  348. }, _onUpdateTotalDuration = function _onUpdateTotalDuration2(animation) {
  349. return animation instanceof Timeline ? _uncache(animation) : _setDuration(animation, animation._dur);
  350. }, _zeroPosition = {
  351. _start: 0,
  352. endTime: _emptyFunc,
  353. totalDuration: _emptyFunc
  354. }, _parsePosition = function _parsePosition2(animation, position, percentAnimation) {
  355. var labels = animation.labels, recent = animation._recent || _zeroPosition, clippedDuration = animation.duration() >= _bigNum ? recent.endTime(false) : animation._dur, i, offset, isPercent;
  356. if (_isString(position) && (isNaN(position) || position in labels)) {
  357. offset = position.charAt(0);
  358. isPercent = position.substr(-1) === "%";
  359. i = position.indexOf("=");
  360. if (offset === "<" || offset === ">") {
  361. i >= 0 && (position = position.replace(/=/, ""));
  362. return (offset === "<" ? recent._start : recent.endTime(recent._repeat >= 0)) + (parseFloat(position.substr(1)) || 0) * (isPercent ? (i < 0 ? recent : percentAnimation).totalDuration() / 100 : 1);
  363. }
  364. if (i < 0) {
  365. position in labels || (labels[position] = clippedDuration);
  366. return labels[position];
  367. }
  368. offset = parseFloat(position.charAt(i - 1) + position.substr(i + 1));
  369. if (isPercent && percentAnimation) {
  370. offset = offset / 100 * (_isArray(percentAnimation) ? percentAnimation[0] : percentAnimation).totalDuration();
  371. }
  372. return i > 1 ? _parsePosition2(animation, position.substr(0, i - 1), percentAnimation) + offset : clippedDuration + offset;
  373. }
  374. return position == null ? clippedDuration : +position;
  375. }, _createTweenType = function _createTweenType2(type, params, timeline2) {
  376. var isLegacy = _isNumber(params[1]), varsIndex = (isLegacy ? 2 : 1) + (type < 2 ? 0 : 1), vars = params[varsIndex], irVars, parent;
  377. isLegacy && (vars.duration = params[1]);
  378. vars.parent = timeline2;
  379. if (type) {
  380. irVars = vars;
  381. parent = timeline2;
  382. while (parent && !("immediateRender" in irVars)) {
  383. irVars = parent.vars.defaults || {};
  384. parent = _isNotFalse(parent.vars.inherit) && parent.parent;
  385. }
  386. vars.immediateRender = _isNotFalse(irVars.immediateRender);
  387. type < 2 ? vars.runBackwards = 1 : vars.startAt = params[varsIndex - 1];
  388. }
  389. return new Tween(params[0], vars, params[varsIndex + 1]);
  390. }, _conditionalReturn = function _conditionalReturn2(value, func) {
  391. return value || value === 0 ? func(value) : func;
  392. }, _clamp = function _clamp2(min, max, value) {
  393. return value < min ? min : value > max ? max : value;
  394. }, getUnit = function getUnit2(value, v) {
  395. return !_isString(value) || !(v = _unitExp.exec(value)) ? "" : v[1];
  396. }, clamp = function clamp2(min, max, value) {
  397. return _conditionalReturn(value, function(v) {
  398. return _clamp(min, max, v);
  399. });
  400. }, _slice = [].slice, _isArrayLike = function _isArrayLike2(value, nonEmpty) {
  401. return value && _isObject(value) && "length" in value && (!nonEmpty && !value.length || value.length - 1 in value && _isObject(value[0])) && !value.nodeType && value !== _win;
  402. }, _flatten = function _flatten2(ar, leaveStrings, accumulator) {
  403. if (accumulator === void 0) {
  404. accumulator = [];
  405. }
  406. return ar.forEach(function(value) {
  407. var _accumulator;
  408. return _isString(value) && !leaveStrings || _isArrayLike(value, 1) ? (_accumulator = accumulator).push.apply(_accumulator, toArray(value)) : accumulator.push(value);
  409. }) || accumulator;
  410. }, toArray = function toArray2(value, scope, leaveStrings) {
  411. return _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] : [];
  412. }, selector = function selector2(value) {
  413. value = toArray(value)[0] || _warn("Invalid scope") || {};
  414. return function(v) {
  415. var el = value.current || value.nativeElement || value;
  416. return toArray(v, el.querySelectorAll ? el : el === value ? _warn("Invalid scope") || _doc.createElement("div") : value);
  417. };
  418. }, shuffle = function shuffle2(a) {
  419. return a.sort(function() {
  420. return 0.5 - Math.random();
  421. });
  422. }, distribute = function distribute2(v) {
  423. if (_isFunction(v)) {
  424. return v;
  425. }
  426. var vars = _isObject(v) ? v : {
  427. each: v
  428. }, 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;
  429. if (_isString(from)) {
  430. ratioX = ratioY = {
  431. center: 0.5,
  432. edges: 0.5,
  433. end: 1
  434. }[from] || 0;
  435. } else if (!isDecimal && ratios) {
  436. ratioX = from[0];
  437. ratioY = from[1];
  438. }
  439. return function(i, target, a) {
  440. var l = (a || vars).length, distances = cache[l], originX, originY, x, y, d, j, max, min, wrapAt;
  441. if (!distances) {
  442. wrapAt = vars.grid === "auto" ? 0 : (vars.grid || [1, _bigNum])[1];
  443. if (!wrapAt) {
  444. max = -_bigNum;
  445. while (max < (max = a[wrapAt++].getBoundingClientRect().left) && wrapAt < l) {
  446. }
  447. wrapAt--;
  448. }
  449. distances = cache[l] = [];
  450. originX = ratios ? Math.min(wrapAt, l) * ratioX - 0.5 : from % wrapAt;
  451. originY = wrapAt === _bigNum ? 0 : ratios ? l * ratioY / wrapAt - 0.5 : from / wrapAt | 0;
  452. max = 0;
  453. min = _bigNum;
  454. for (j = 0; j < l; j++) {
  455. x = j % wrapAt - originX;
  456. y = originY - (j / wrapAt | 0);
  457. distances[j] = d = !axis ? _sqrt(x * x + y * y) : Math.abs(axis === "y" ? y : x);
  458. d > max && (max = d);
  459. d < min && (min = d);
  460. }
  461. from === "random" && shuffle(distances);
  462. distances.max = max - min;
  463. distances.min = min;
  464. 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);
  465. distances.b = l < 0 ? base - l : base;
  466. distances.u = getUnit(vars.amount || vars.each) || 0;
  467. ease = ease && l < 0 ? _invertEase(ease) : ease;
  468. }
  469. l = (distances[i] - distances.min) / distances.max || 0;
  470. return _roundPrecise(distances.b + (ease ? ease(l) : l) * distances.v) + distances.u;
  471. };
  472. }, _roundModifier = function _roundModifier2(v) {
  473. var p = Math.pow(10, ((v + "").split(".")[1] || "").length);
  474. return function(raw) {
  475. var n = Math.round(parseFloat(raw) / v) * v * p;
  476. return (n - n % 1) / p + (_isNumber(raw) ? 0 : getUnit(raw));
  477. };
  478. }, snap = function snap2(snapTo, value) {
  479. var isArray = _isArray(snapTo), radius, is2D;
  480. if (!isArray && _isObject(snapTo)) {
  481. radius = isArray = snapTo.radius || _bigNum;
  482. if (snapTo.values) {
  483. snapTo = toArray(snapTo.values);
  484. if (is2D = !_isNumber(snapTo[0])) {
  485. radius *= radius;
  486. }
  487. } else {
  488. snapTo = _roundModifier(snapTo.increment);
  489. }
  490. }
  491. return _conditionalReturn(value, !isArray ? _roundModifier(snapTo) : _isFunction(snapTo) ? function(raw) {
  492. is2D = snapTo(raw);
  493. return Math.abs(is2D - raw) <= radius ? is2D : raw;
  494. } : function(raw) {
  495. var x = parseFloat(is2D ? raw.x : raw), y = parseFloat(is2D ? raw.y : 0), min = _bigNum, closest = 0, i = snapTo.length, dx, dy;
  496. while (i--) {
  497. if (is2D) {
  498. dx = snapTo[i].x - x;
  499. dy = snapTo[i].y - y;
  500. dx = dx * dx + dy * dy;
  501. } else {
  502. dx = Math.abs(snapTo[i] - x);
  503. }
  504. if (dx < min) {
  505. min = dx;
  506. closest = i;
  507. }
  508. }
  509. closest = !radius || min <= radius ? snapTo[closest] : raw;
  510. return is2D || closest === raw || _isNumber(raw) ? closest : closest + getUnit(raw);
  511. });
  512. }, random = function random2(min, max, roundingIncrement, returnFunction) {
  513. return _conditionalReturn(_isArray(min) ? !max : roundingIncrement === true ? !!(roundingIncrement = 0) : !returnFunction, function() {
  514. 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 * 0.99)) / roundingIncrement) * roundingIncrement * returnFunction) / returnFunction;
  515. });
  516. }, pipe = function pipe2() {
  517. for (var _len = arguments.length, functions = new Array(_len), _key = 0; _key < _len; _key++) {
  518. functions[_key] = arguments[_key];
  519. }
  520. return function(value) {
  521. return functions.reduce(function(v, f) {
  522. return f(v);
  523. }, value);
  524. };
  525. }, unitize = function unitize2(func, unit) {
  526. return function(value) {
  527. return func(parseFloat(value)) + (unit || getUnit(value));
  528. };
  529. }, normalize = function normalize2(min, max, value) {
  530. return mapRange(min, max, 0, 1, value);
  531. }, _wrapArray = function _wrapArray2(a, wrapper, value) {
  532. return _conditionalReturn(value, function(index) {
  533. return a[~~wrapper(index)];
  534. });
  535. }, wrap = function wrap2(min, max, value) {
  536. var range = max - min;
  537. return _isArray(min) ? _wrapArray(min, wrap2(0, min.length), max) : _conditionalReturn(value, function(value2) {
  538. return (range + (value2 - min) % range) % range + min;
  539. });
  540. }, wrapYoyo = function wrapYoyo2(min, max, value) {
  541. var range = max - min, total = range * 2;
  542. return _isArray(min) ? _wrapArray(min, wrapYoyo2(0, min.length - 1), max) : _conditionalReturn(value, function(value2) {
  543. value2 = (total + (value2 - min) % total) % total || 0;
  544. return min + (value2 > range ? total - value2 : value2);
  545. });
  546. }, _replaceRandom = function _replaceRandom2(value) {
  547. var prev = 0, s = "", i, nums, end, isArray;
  548. while (~(i = value.indexOf("random(", prev))) {
  549. end = value.indexOf(")", i);
  550. isArray = value.charAt(i + 7) === "[";
  551. nums = value.substr(i + 7, end - i - 7).match(isArray ? _delimitedValueExp : _strictNumExp);
  552. s += value.substr(prev, i - prev) + random(isArray ? nums : +nums[0], isArray ? 0 : +nums[1], +nums[2] || 1e-5);
  553. prev = end + 1;
  554. }
  555. return s + value.substr(prev, value.length - prev);
  556. }, mapRange = function mapRange2(inMin, inMax, outMin, outMax, value) {
  557. var inRange = inMax - inMin, outRange = outMax - outMin;
  558. return _conditionalReturn(value, function(value2) {
  559. return outMin + ((value2 - inMin) / inRange * outRange || 0);
  560. });
  561. }, interpolate = function interpolate2(start, end, progress, mutate) {
  562. var func = isNaN(start + end) ? 0 : function(p2) {
  563. return (1 - p2) * start + p2 * end;
  564. };
  565. if (!func) {
  566. var isString = _isString(start), master = {}, p, i, interpolators, l, il;
  567. progress === true && (mutate = 1) && (progress = null);
  568. if (isString) {
  569. start = {
  570. p: start
  571. };
  572. end = {
  573. p: end
  574. };
  575. } else if (_isArray(start) && !_isArray(end)) {
  576. interpolators = [];
  577. l = start.length;
  578. il = l - 2;
  579. for (i = 1; i < l; i++) {
  580. interpolators.push(interpolate2(start[i - 1], start[i]));
  581. }
  582. l--;
  583. func = function func2(p2) {
  584. p2 *= l;
  585. var i2 = Math.min(il, ~~p2);
  586. return interpolators[i2](p2 - i2);
  587. };
  588. progress = end;
  589. } else if (!mutate) {
  590. start = _merge(_isArray(start) ? [] : {}, start);
  591. }
  592. if (!interpolators) {
  593. for (p in end) {
  594. _addPropTween.call(master, start, p, "get", end[p]);
  595. }
  596. func = function func2(p2) {
  597. return _renderPropTweens(p2, master) || (isString ? start.p : start);
  598. };
  599. }
  600. }
  601. return _conditionalReturn(progress, func);
  602. }, _getLabelInDirection = function _getLabelInDirection2(timeline2, fromTime, backward) {
  603. var labels = timeline2.labels, min = _bigNum, p, distance, label;
  604. for (p in labels) {
  605. distance = labels[p] - fromTime;
  606. if (distance < 0 === !!backward && distance && min > (distance = Math.abs(distance))) {
  607. label = p;
  608. min = distance;
  609. }
  610. }
  611. return label;
  612. }, _callback = function _callback2(animation, type, executeLazyFirst) {
  613. var v = animation.vars, callback = v[type], params, scope;
  614. if (!callback) {
  615. return;
  616. }
  617. params = v[type + "Params"];
  618. scope = v.callbackScope || animation;
  619. executeLazyFirst && _lazyTweens.length && _lazyRender();
  620. return params ? callback.apply(scope, params) : callback.call(scope);
  621. }, _interrupt = function _interrupt2(animation) {
  622. _removeFromParent(animation);
  623. animation.scrollTrigger && animation.scrollTrigger.kill(false);
  624. animation.progress() < 1 && _callback(animation, "onInterrupt");
  625. return animation;
  626. }, _quickTween, _createPlugin = function _createPlugin2(config3) {
  627. config3 = !config3.name && config3["default"] || config3;
  628. var name = config3.name, isFunc = _isFunction(config3), Plugin = name && !isFunc && config3.init ? function() {
  629. this._props = [];
  630. } : config3, instanceDefaults = {
  631. init: _emptyFunc,
  632. render: _renderPropTweens,
  633. add: _addPropTween,
  634. kill: _killPropTweensOf,
  635. modifier: _addPluginModifier,
  636. rawVars: 0
  637. }, statics = {
  638. targetTest: 0,
  639. get: 0,
  640. getSetter: _getSetter,
  641. aliases: {},
  642. register: 0
  643. };
  644. _wake();
  645. if (config3 !== Plugin) {
  646. if (_plugins[name]) {
  647. return;
  648. }
  649. _setDefaults(Plugin, _setDefaults(_copyExcluding(config3, instanceDefaults), statics));
  650. _merge(Plugin.prototype, _merge(instanceDefaults, _copyExcluding(config3, statics)));
  651. _plugins[Plugin.prop = name] = Plugin;
  652. if (config3.targetTest) {
  653. _harnessPlugins.push(Plugin);
  654. _reservedProps[name] = 1;
  655. }
  656. name = (name === "css" ? "CSS" : name.charAt(0).toUpperCase() + name.substr(1)) + "Plugin";
  657. }
  658. _addGlobal(name, Plugin);
  659. config3.register && config3.register(gsap, Plugin, PropTween);
  660. }, _255 = 255, _colorLookup = {
  661. aqua: [0, _255, _255],
  662. lime: [0, _255, 0],
  663. silver: [192, 192, 192],
  664. black: [0, 0, 0],
  665. maroon: [128, 0, 0],
  666. teal: [0, 128, 128],
  667. blue: [0, 0, _255],
  668. navy: [0, 0, 128],
  669. white: [_255, _255, _255],
  670. olive: [128, 128, 0],
  671. yellow: [_255, _255, 0],
  672. orange: [_255, 165, 0],
  673. gray: [128, 128, 128],
  674. purple: [128, 0, 128],
  675. green: [0, 128, 0],
  676. red: [_255, 0, 0],
  677. pink: [_255, 192, 203],
  678. cyan: [0, _255, _255],
  679. transparent: [_255, _255, _255, 0]
  680. }, _hue = function _hue2(h, m1, m2) {
  681. h += h < 0 ? 1 : h > 1 ? -1 : 0;
  682. return (h * 6 < 1 ? m1 + (m2 - m1) * h * 6 : h < 0.5 ? m2 : h * 3 < 2 ? m1 + (m2 - m1) * (2 / 3 - h) * 6 : m1) * _255 + 0.5 | 0;
  683. }, splitColor = function splitColor2(v, toHSL, forceAlpha) {
  684. var a = !v ? _colorLookup.black : _isNumber(v) ? [v >> 16, v >> 8 & _255, v & _255] : 0, r, g, b, h, s, l, max, min, d, wasHSL;
  685. if (!a) {
  686. if (v.substr(-1) === ",") {
  687. v = v.substr(0, v.length - 1);
  688. }
  689. if (_colorLookup[v]) {
  690. a = _colorLookup[v];
  691. } else if (v.charAt(0) === "#") {
  692. if (v.length < 6) {
  693. r = v.charAt(1);
  694. g = v.charAt(2);
  695. b = v.charAt(3);
  696. v = "#" + r + r + g + g + b + b + (v.length === 5 ? v.charAt(4) + v.charAt(4) : "");
  697. }
  698. if (v.length === 9) {
  699. a = parseInt(v.substr(1, 6), 16);
  700. return [a >> 16, a >> 8 & _255, a & _255, parseInt(v.substr(7), 16) / 255];
  701. }
  702. v = parseInt(v.substr(1), 16);
  703. a = [v >> 16, v >> 8 & _255, v & _255];
  704. } else if (v.substr(0, 3) === "hsl") {
  705. a = wasHSL = v.match(_strictNumExp);
  706. if (!toHSL) {
  707. h = +a[0] % 360 / 360;
  708. s = +a[1] / 100;
  709. l = +a[2] / 100;
  710. g = l <= 0.5 ? l * (s + 1) : l + s - l * s;
  711. r = l * 2 - g;
  712. a.length > 3 && (a[3] *= 1);
  713. a[0] = _hue(h + 1 / 3, r, g);
  714. a[1] = _hue(h, r, g);
  715. a[2] = _hue(h - 1 / 3, r, g);
  716. } else if (~v.indexOf("=")) {
  717. a = v.match(_numExp);
  718. forceAlpha && a.length < 4 && (a[3] = 1);
  719. return a;
  720. }
  721. } else {
  722. a = v.match(_strictNumExp) || _colorLookup.transparent;
  723. }
  724. a = a.map(Number);
  725. }
  726. if (toHSL && !wasHSL) {
  727. r = a[0] / _255;
  728. g = a[1] / _255;
  729. b = a[2] / _255;
  730. max = Math.max(r, g, b);
  731. min = Math.min(r, g, b);
  732. l = (max + min) / 2;
  733. if (max === min) {
  734. h = s = 0;
  735. } else {
  736. d = max - min;
  737. s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
  738. h = max === r ? (g - b) / d + (g < b ? 6 : 0) : max === g ? (b - r) / d + 2 : (r - g) / d + 4;
  739. h *= 60;
  740. }
  741. a[0] = ~~(h + 0.5);
  742. a[1] = ~~(s * 100 + 0.5);
  743. a[2] = ~~(l * 100 + 0.5);
  744. }
  745. forceAlpha && a.length < 4 && (a[3] = 1);
  746. return a;
  747. }, _colorOrderData = function _colorOrderData2(v) {
  748. var values = [], c = [], i = -1;
  749. v.split(_colorExp).forEach(function(v2) {
  750. var a = v2.match(_numWithUnitExp) || [];
  751. values.push.apply(values, a);
  752. c.push(i += a.length + 1);
  753. });
  754. values.c = c;
  755. return values;
  756. }, _formatColors = function _formatColors2(s, toHSL, orderMatchData) {
  757. var result = "", colors = (s + result).match(_colorExp), type = toHSL ? "hsla(" : "rgba(", i = 0, c, shell, d, l;
  758. if (!colors) {
  759. return s;
  760. }
  761. colors = colors.map(function(color) {
  762. return (color = splitColor(color, toHSL, 1)) && type + (toHSL ? color[0] + "," + color[1] + "%," + color[2] + "%," + color[3] : color.join(",")) + ")";
  763. });
  764. if (orderMatchData) {
  765. d = _colorOrderData(s);
  766. c = orderMatchData.c;
  767. if (c.join(result) !== d.c.join(result)) {
  768. shell = s.replace(_colorExp, "1").split(_numWithUnitExp);
  769. l = shell.length - 1;
  770. for (; i < l; i++) {
  771. result += shell[i] + (~c.indexOf(i) ? colors.shift() || type + "0,0,0,0)" : (d.length ? d : colors.length ? colors : orderMatchData).shift());
  772. }
  773. }
  774. }
  775. if (!shell) {
  776. shell = s.split(_colorExp);
  777. l = shell.length - 1;
  778. for (; i < l; i++) {
  779. result += shell[i] + colors[i];
  780. }
  781. }
  782. return result + shell[l];
  783. }, _colorExp = function() {
  784. var s = "(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b", p;
  785. for (p in _colorLookup) {
  786. s += "|" + p + "\\b";
  787. }
  788. return new RegExp(s + ")", "gi");
  789. }(), _hslExp = /hsl[a]?\(/, _colorStringFilter = function _colorStringFilter2(a) {
  790. var combined = a.join(" "), toHSL;
  791. _colorExp.lastIndex = 0;
  792. if (_colorExp.test(combined)) {
  793. toHSL = _hslExp.test(combined);
  794. a[1] = _formatColors(a[1], toHSL);
  795. a[0] = _formatColors(a[0], toHSL, _colorOrderData(a[1]));
  796. return true;
  797. }
  798. }, _tickerActive, _ticker = function() {
  799. 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 _tick2(v) {
  800. var elapsed = _getTime() - _lastUpdate, manual = v === true, overlap, dispatch, time, frame;
  801. elapsed > _lagThreshold && (_startTime += elapsed - _adjustedLag);
  802. _lastUpdate += elapsed;
  803. time = _lastUpdate - _startTime;
  804. overlap = time - _nextTime;
  805. if (overlap > 0 || manual) {
  806. frame = ++_self.frame;
  807. _delta = time - _self.time * 1e3;
  808. _self.time = time = time / 1e3;
  809. _nextTime += overlap + (overlap >= _gap ? 4 : _gap - overlap);
  810. dispatch = 1;
  811. }
  812. manual || (_id = _req(_tick2));
  813. if (dispatch) {
  814. for (_i = 0; _i < _listeners.length; _i++) {
  815. _listeners[_i](time, _delta, frame, v);
  816. }
  817. }
  818. };
  819. _self = {
  820. time: 0,
  821. frame: 0,
  822. tick: function tick() {
  823. _tick(true);
  824. },
  825. deltaRatio: function deltaRatio(fps) {
  826. return _delta / (1e3 / (fps || 60));
  827. },
  828. wake: function wake() {
  829. if (_coreReady) {
  830. if (!_coreInitted && _windowExists()) {
  831. _win = _coreInitted = window;
  832. _doc = _win.document || {};
  833. _globals.gsap = gsap;
  834. (_win.gsapVersions || (_win.gsapVersions = [])).push(gsap.version);
  835. _install(_installScope || _win.GreenSockGlobals || !_win.gsap && _win || {});
  836. _raf = _win.requestAnimationFrame;
  837. }
  838. _id && _self.sleep();
  839. _req = _raf || function(f) {
  840. return setTimeout(f, _nextTime - _self.time * 1e3 + 1 | 0);
  841. };
  842. _tickerActive = 1;
  843. _tick(2);
  844. }
  845. },
  846. sleep: function sleep() {
  847. (_raf ? _win.cancelAnimationFrame : clearTimeout)(_id);
  848. _tickerActive = 0;
  849. _req = _emptyFunc;
  850. },
  851. lagSmoothing: function lagSmoothing(threshold, adjustedLag) {
  852. _lagThreshold = threshold || 1 / _tinyNum;
  853. _adjustedLag = Math.min(adjustedLag, _lagThreshold, 0);
  854. },
  855. fps: function fps(_fps) {
  856. _gap = 1e3 / (_fps || 240);
  857. _nextTime = _self.time * 1e3 + _gap;
  858. },
  859. add: function add(callback, once, prioritize) {
  860. var func = once ? function(t, d, f, v) {
  861. callback(t, d, f, v);
  862. _self.remove(func);
  863. } : callback;
  864. _self.remove(callback);
  865. _listeners[prioritize ? "unshift" : "push"](func);
  866. _wake();
  867. return func;
  868. },
  869. remove: function remove(callback, i) {
  870. ~(i = _listeners.indexOf(callback)) && _listeners.splice(i, 1) && _i >= i && _i--;
  871. },
  872. _listeners
  873. };
  874. return _self;
  875. }(), _wake = function _wake2() {
  876. return !_tickerActive && _ticker.wake();
  877. }, _easeMap = {}, _customEaseExp = /^[\d.\-M][\d.\-,\s]/, _quotesExp = /["']/g, _parseObjectInString = function _parseObjectInString2(value) {
  878. var obj = {}, split = value.substr(1, value.length - 3).split(":"), key = split[0], i = 1, l = split.length, index, val, parsedVal;
  879. for (; i < l; i++) {
  880. val = split[i];
  881. index = i !== l - 1 ? val.lastIndexOf(",") : val.length;
  882. parsedVal = val.substr(0, index);
  883. obj[key] = isNaN(parsedVal) ? parsedVal.replace(_quotesExp, "").trim() : +parsedVal;
  884. key = val.substr(index + 1).trim();
  885. }
  886. return obj;
  887. }, _valueInParentheses = function _valueInParentheses2(value) {
  888. var open = value.indexOf("(") + 1, close = value.indexOf(")"), nested = value.indexOf("(", open);
  889. return value.substring(open, ~nested && nested < close ? value.indexOf(")", close + 1) : close);
  890. }, _configEaseFromString = function _configEaseFromString2(name) {
  891. var split = (name + "").split("("), ease = _easeMap[split[0]];
  892. 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;
  893. }, _invertEase = function _invertEase2(ease) {
  894. return function(p) {
  895. return 1 - ease(1 - p);
  896. };
  897. }, _propagateYoyoEase = function _propagateYoyoEase2(timeline2, isYoyo) {
  898. var child = timeline2._first, ease;
  899. while (child) {
  900. if (child instanceof Timeline) {
  901. _propagateYoyoEase2(child, isYoyo);
  902. } else if (child.vars.yoyoEase && (!child._yoyo || !child._repeat) && child._yoyo !== isYoyo) {
  903. if (child.timeline) {
  904. _propagateYoyoEase2(child.timeline, isYoyo);
  905. } else {
  906. ease = child._ease;
  907. child._ease = child._yEase;
  908. child._yEase = ease;
  909. child._yoyo = isYoyo;
  910. }
  911. }
  912. child = child._next;
  913. }
  914. }, _parseEase = function _parseEase2(ease, defaultEase) {
  915. return !ease ? defaultEase : (_isFunction(ease) ? ease : _easeMap[ease] || _configEaseFromString(ease)) || defaultEase;
  916. }, _insertEase = function _insertEase2(names, easeIn, easeOut, easeInOut) {
  917. if (easeOut === void 0) {
  918. easeOut = function easeOut2(p) {
  919. return 1 - easeIn(1 - p);
  920. };
  921. }
  922. if (easeInOut === void 0) {
  923. easeInOut = function easeInOut2(p) {
  924. return p < 0.5 ? easeIn(p * 2) / 2 : 1 - easeIn((1 - p) * 2) / 2;
  925. };
  926. }
  927. var ease = {
  928. easeIn,
  929. easeOut,
  930. easeInOut
  931. }, lowercaseName;
  932. _forEachName(names, function(name) {
  933. _easeMap[name] = _globals[name] = ease;
  934. _easeMap[lowercaseName = name.toLowerCase()] = easeOut;
  935. for (var p in ease) {
  936. _easeMap[lowercaseName + (p === "easeIn" ? ".in" : p === "easeOut" ? ".out" : ".inOut")] = _easeMap[name + "." + p] = ease[p];
  937. }
  938. });
  939. return ease;
  940. }, _easeInOutFromOut = function _easeInOutFromOut2(easeOut) {
  941. return function(p) {
  942. return p < 0.5 ? (1 - easeOut(1 - p * 2)) / 2 : 0.5 + easeOut((p - 0.5) * 2) / 2;
  943. };
  944. }, _configElastic = function _configElastic2(type, amplitude, period) {
  945. var p1 = amplitude >= 1 ? amplitude : 1, p2 = (period || (type ? 0.3 : 0.45)) / (amplitude < 1 ? amplitude : 1), p3 = p2 / _2PI * (Math.asin(1 / p1) || 0), easeOut = function easeOut2(p) {
  946. return p === 1 ? 1 : p1 * Math.pow(2, -10 * p) * _sin((p - p3) * p2) + 1;
  947. }, ease = type === "out" ? easeOut : type === "in" ? function(p) {
  948. return 1 - easeOut(1 - p);
  949. } : _easeInOutFromOut(easeOut);
  950. p2 = _2PI / p2;
  951. ease.config = function(amplitude2, period2) {
  952. return _configElastic2(type, amplitude2, period2);
  953. };
  954. return ease;
  955. }, _configBack = function _configBack2(type, overshoot) {
  956. if (overshoot === void 0) {
  957. overshoot = 1.70158;
  958. }
  959. var easeOut = function easeOut2(p) {
  960. return p ? --p * p * ((overshoot + 1) * p + overshoot) + 1 : 0;
  961. }, ease = type === "out" ? easeOut : type === "in" ? function(p) {
  962. return 1 - easeOut(1 - p);
  963. } : _easeInOutFromOut(easeOut);
  964. ease.config = function(overshoot2) {
  965. return _configBack2(type, overshoot2);
  966. };
  967. return ease;
  968. };
  969. _forEachName("Linear,Quad,Cubic,Quart,Quint,Strong", function(name, i) {
  970. var power = i < 5 ? i + 1 : i;
  971. _insertEase(name + ",Power" + (power - 1), i ? function(p) {
  972. return Math.pow(p, power);
  973. } : function(p) {
  974. return p;
  975. }, function(p) {
  976. return 1 - Math.pow(1 - p, power);
  977. }, function(p) {
  978. return p < 0.5 ? Math.pow(p * 2, power) / 2 : 1 - Math.pow((1 - p) * 2, power) / 2;
  979. });
  980. });
  981. _easeMap.Linear.easeNone = _easeMap.none = _easeMap.Linear.easeIn;
  982. _insertEase("Elastic", _configElastic("in"), _configElastic("out"), _configElastic());
  983. (function(n, c) {
  984. var n1 = 1 / c, n2 = 2 * n1, n3 = 2.5 * n1, easeOut = function easeOut2(p) {
  985. return p < n1 ? n * p * p : p < n2 ? n * Math.pow(p - 1.5 / c, 2) + 0.75 : p < n3 ? n * (p -= 2.25 / c) * p + 0.9375 : n * Math.pow(p - 2.625 / c, 2) + 0.984375;
  986. };
  987. _insertEase("Bounce", function(p) {
  988. return 1 - easeOut(1 - p);
  989. }, easeOut);
  990. })(7.5625, 2.75);
  991. _insertEase("Expo", function(p) {
  992. return p ? Math.pow(2, 10 * (p - 1)) : 0;
  993. });
  994. _insertEase("Circ", function(p) {
  995. return -(_sqrt(1 - p * p) - 1);
  996. });
  997. _insertEase("Sine", function(p) {
  998. return p === 1 ? 1 : -_cos(p * _HALF_PI) + 1;
  999. });
  1000. _insertEase("Back", _configBack("in"), _configBack("out"), _configBack());
  1001. _easeMap.SteppedEase = _easeMap.steps = _globals.SteppedEase = {
  1002. config: function config(steps, immediateStart) {
  1003. if (steps === void 0) {
  1004. steps = 1;
  1005. }
  1006. var p1 = 1 / steps, p2 = steps + (immediateStart ? 0 : 1), p3 = immediateStart ? 1 : 0, max = 1 - _tinyNum;
  1007. return function(p) {
  1008. return ((p2 * _clamp(0, max, p) | 0) + p3) * p1;
  1009. };
  1010. }
  1011. };
  1012. _defaults.ease = _easeMap["quad.out"];
  1013. _forEachName("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt", function(name) {
  1014. return _callbackNames += name + "," + name + "Params,";
  1015. });
  1016. var GSCache = function GSCache2(target, harness) {
  1017. this.id = _gsID++;
  1018. target._gsap = this;
  1019. this.target = target;
  1020. this.harness = harness;
  1021. this.get = harness ? harness.get : _getProperty;
  1022. this.set = harness ? harness.getSetter : _getSetter;
  1023. };
  1024. var Animation = /* @__PURE__ */ function() {
  1025. function Animation2(vars) {
  1026. this.vars = vars;
  1027. this._delay = +vars.delay || 0;
  1028. if (this._repeat = vars.repeat === Infinity ? -2 : vars.repeat || 0) {
  1029. this._rDelay = vars.repeatDelay || 0;
  1030. this._yoyo = !!vars.yoyo || !!vars.yoyoEase;
  1031. }
  1032. this._ts = 1;
  1033. _setDuration(this, +vars.duration, 1, 1);
  1034. this.data = vars.data;
  1035. _tickerActive || _ticker.wake();
  1036. }
  1037. var _proto = Animation2.prototype;
  1038. _proto.delay = function delay(value) {
  1039. if (value || value === 0) {
  1040. this.parent && this.parent.smoothChildTiming && this.startTime(this._start + value - this._delay);
  1041. this._delay = value;
  1042. return this;
  1043. }
  1044. return this._delay;
  1045. };
  1046. _proto.duration = function duration(value) {
  1047. return arguments.length ? this.totalDuration(this._repeat > 0 ? value + (value + this._rDelay) * this._repeat : value) : this.totalDuration() && this._dur;
  1048. };
  1049. _proto.totalDuration = function totalDuration(value) {
  1050. if (!arguments.length) {
  1051. return this._tDur;
  1052. }
  1053. this._dirty = 0;
  1054. return _setDuration(this, this._repeat < 0 ? value : (value - this._repeat * this._rDelay) / (this._repeat + 1));
  1055. };
  1056. _proto.totalTime = function totalTime(_totalTime, suppressEvents) {
  1057. _wake();
  1058. if (!arguments.length) {
  1059. return this._tTime;
  1060. }
  1061. var parent = this._dp;
  1062. if (parent && parent.smoothChildTiming && this._ts) {
  1063. _alignPlayhead(this, _totalTime);
  1064. !parent._dp || parent.parent || _postAddChecks(parent, this);
  1065. while (parent && parent.parent) {
  1066. if (parent.parent._time !== parent._start + (parent._ts >= 0 ? parent._tTime / parent._ts : (parent.totalDuration() - parent._tTime) / -parent._ts)) {
  1067. parent.totalTime(parent._tTime, true);
  1068. }
  1069. parent = parent.parent;
  1070. }
  1071. if (!this.parent && this._dp.autoRemoveChildren && (this._ts > 0 && _totalTime < this._tDur || this._ts < 0 && _totalTime > 0 || !this._tDur && !_totalTime)) {
  1072. _addToTimeline(this._dp, this, this._start - this._delay);
  1073. }
  1074. }
  1075. if (this._tTime !== _totalTime || !this._dur && !suppressEvents || this._initted && Math.abs(this._zTime) === _tinyNum || !_totalTime && !this._initted && (this.add || this._ptLookup)) {
  1076. this._ts || (this._pTime = _totalTime);
  1077. _lazySafeRender(this, _totalTime, suppressEvents);
  1078. }
  1079. return this;
  1080. };
  1081. _proto.time = function time(value, suppressEvents) {
  1082. return arguments.length ? this.totalTime(Math.min(this.totalDuration(), value + _elapsedCycleDuration(this)) % (this._dur + this._rDelay) || (value ? this._dur : 0), suppressEvents) : this._time;
  1083. };
  1084. _proto.totalProgress = function totalProgress(value, suppressEvents) {
  1085. return arguments.length ? this.totalTime(this.totalDuration() * value, suppressEvents) : this.totalDuration() ? Math.min(1, this._tTime / this._tDur) : this.ratio;
  1086. };
  1087. _proto.progress = function progress(value, suppressEvents) {
  1088. 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.ratio;
  1089. };
  1090. _proto.iteration = function iteration(value, suppressEvents) {
  1091. var cycleDuration = this.duration() + this._rDelay;
  1092. return arguments.length ? this.totalTime(this._time + (value - 1) * cycleDuration, suppressEvents) : this._repeat ? _animationCycle(this._tTime, cycleDuration) + 1 : 1;
  1093. };
  1094. _proto.timeScale = function timeScale(value) {
  1095. if (!arguments.length) {
  1096. return this._rts === -_tinyNum ? 0 : this._rts;
  1097. }
  1098. if (this._rts === value) {
  1099. return this;
  1100. }
  1101. var tTime = this.parent && this._ts ? _parentToChildTotalTime(this.parent._time, this) : this._tTime;
  1102. this._rts = +value || 0;
  1103. this._ts = this._ps || value === -_tinyNum ? 0 : this._rts;
  1104. this.totalTime(_clamp(-this._delay, this._tDur, tTime), true);
  1105. _setEnd(this);
  1106. return _recacheAncestors(this);
  1107. };
  1108. _proto.paused = function paused(value) {
  1109. if (!arguments.length) {
  1110. return this._ps;
  1111. }
  1112. if (this._ps !== value) {
  1113. this._ps = value;
  1114. if (value) {
  1115. this._pTime = this._tTime || Math.max(-this._delay, this.rawTime());
  1116. this._ts = this._act = 0;
  1117. } else {
  1118. _wake();
  1119. this._ts = this._rts;
  1120. this.totalTime(this.parent && !this.parent.smoothChildTiming ? this.rawTime() : this._tTime || this._pTime, this.progress() === 1 && Math.abs(this._zTime) !== _tinyNum && (this._tTime -= _tinyNum));
  1121. }
  1122. }
  1123. return this;
  1124. };
  1125. _proto.startTime = function startTime(value) {
  1126. if (arguments.length) {
  1127. this._start = value;
  1128. var parent = this.parent || this._dp;
  1129. parent && (parent._sort || !this.parent) && _addToTimeline(parent, this, value - this._delay);
  1130. return this;
  1131. }
  1132. return this._start;
  1133. };
  1134. _proto.endTime = function endTime(includeRepeats) {
  1135. return this._start + (_isNotFalse(includeRepeats) ? this.totalDuration() : this.duration()) / Math.abs(this._ts || 1);
  1136. };
  1137. _proto.rawTime = function rawTime(wrapRepeats) {
  1138. var parent = this.parent || this._dp;
  1139. 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);
  1140. };
  1141. _proto.globalTime = function globalTime(rawTime) {
  1142. var animation = this, time = arguments.length ? rawTime : animation.rawTime();
  1143. while (animation) {
  1144. time = animation._start + time / (animation._ts || 1);
  1145. animation = animation._dp;
  1146. }
  1147. return time;
  1148. };
  1149. _proto.repeat = function repeat(value) {
  1150. if (arguments.length) {
  1151. this._repeat = value === Infinity ? -2 : value;
  1152. return _onUpdateTotalDuration(this);
  1153. }
  1154. return this._repeat === -2 ? Infinity : this._repeat;
  1155. };
  1156. _proto.repeatDelay = function repeatDelay(value) {
  1157. if (arguments.length) {
  1158. var time = this._time;
  1159. this._rDelay = value;
  1160. _onUpdateTotalDuration(this);
  1161. return time ? this.time(time) : this;
  1162. }
  1163. return this._rDelay;
  1164. };
  1165. _proto.yoyo = function yoyo(value) {
  1166. if (arguments.length) {
  1167. this._yoyo = value;
  1168. return this;
  1169. }
  1170. return this._yoyo;
  1171. };
  1172. _proto.seek = function seek(position, suppressEvents) {
  1173. return this.totalTime(_parsePosition(this, position), _isNotFalse(suppressEvents));
  1174. };
  1175. _proto.restart = function restart(includeDelay, suppressEvents) {
  1176. return this.play().totalTime(includeDelay ? -this._delay : 0, _isNotFalse(suppressEvents));
  1177. };
  1178. _proto.play = function play(from, suppressEvents) {
  1179. from != null && this.seek(from, suppressEvents);
  1180. return this.reversed(false).paused(false);
  1181. };
  1182. _proto.reverse = function reverse(from, suppressEvents) {
  1183. from != null && this.seek(from || this.totalDuration(), suppressEvents);
  1184. return this.reversed(true).paused(false);
  1185. };
  1186. _proto.pause = function pause(atTime, suppressEvents) {
  1187. atTime != null && this.seek(atTime, suppressEvents);
  1188. return this.paused(true);
  1189. };
  1190. _proto.resume = function resume() {
  1191. return this.paused(false);
  1192. };
  1193. _proto.reversed = function reversed(value) {
  1194. if (arguments.length) {
  1195. !!value !== this.reversed() && this.timeScale(-this._rts || (value ? -_tinyNum : 0));
  1196. return this;
  1197. }
  1198. return this._rts < 0;
  1199. };
  1200. _proto.invalidate = function invalidate() {
  1201. this._initted = this._act = 0;
  1202. this._zTime = -_tinyNum;
  1203. return this;
  1204. };
  1205. _proto.isActive = function isActive() {
  1206. var parent = this.parent || this._dp, start = this._start, rawTime;
  1207. return !!(!parent || this._ts && this._initted && parent.isActive() && (rawTime = parent.rawTime(true)) >= start && rawTime < this.endTime(true) - _tinyNum);
  1208. };
  1209. _proto.eventCallback = function eventCallback(type, callback, params) {
  1210. var vars = this.vars;
  1211. if (arguments.length > 1) {
  1212. if (!callback) {
  1213. delete vars[type];
  1214. } else {
  1215. vars[type] = callback;
  1216. params && (vars[type + "Params"] = params);
  1217. type === "onUpdate" && (this._onUpdate = callback);
  1218. }
  1219. return this;
  1220. }
  1221. return vars[type];
  1222. };
  1223. _proto.then = function then(onFulfilled) {
  1224. var self = this;
  1225. return new Promise(function(resolve) {
  1226. var f = _isFunction(onFulfilled) ? onFulfilled : _passThrough, _resolve = function _resolve2() {
  1227. var _then = self.then;
  1228. self.then = null;
  1229. _isFunction(f) && (f = f(self)) && (f.then || f === self) && (self.then = _then);
  1230. resolve(f);
  1231. self.then = _then;
  1232. };
  1233. if (self._initted && self.totalProgress() === 1 && self._ts >= 0 || !self._tTime && self._ts < 0) {
  1234. _resolve();
  1235. } else {
  1236. self._prom = _resolve;
  1237. }
  1238. });
  1239. };
  1240. _proto.kill = function kill() {
  1241. _interrupt(this);
  1242. };
  1243. return Animation2;
  1244. }();
  1245. _setDefaults(Animation.prototype, {
  1246. _time: 0,
  1247. _start: 0,
  1248. _end: 0,
  1249. _tTime: 0,
  1250. _tDur: 0,
  1251. _dirty: 0,
  1252. _repeat: 0,
  1253. _yoyo: false,
  1254. parent: null,
  1255. _initted: false,
  1256. _rDelay: 0,
  1257. _ts: 1,
  1258. _dp: 0,
  1259. ratio: 0,
  1260. _zTime: -_tinyNum,
  1261. _prom: 0,
  1262. _ps: false,
  1263. _rts: 1
  1264. });
  1265. var Timeline = /* @__PURE__ */ function(_Animation) {
  1266. _inheritsLoose(Timeline2, _Animation);
  1267. function Timeline2(vars, position) {
  1268. var _this;
  1269. if (vars === void 0) {
  1270. vars = {};
  1271. }
  1272. _this = _Animation.call(this, vars) || this;
  1273. _this.labels = {};
  1274. _this.smoothChildTiming = !!vars.smoothChildTiming;
  1275. _this.autoRemoveChildren = !!vars.autoRemoveChildren;
  1276. _this._sort = _isNotFalse(vars.sortChildren);
  1277. _globalTimeline && _addToTimeline(vars.parent || _globalTimeline, _assertThisInitialized(_this), position);
  1278. vars.reversed && _this.reverse();
  1279. vars.paused && _this.paused(true);
  1280. vars.scrollTrigger && _scrollTrigger(_assertThisInitialized(_this), vars.scrollTrigger);
  1281. return _this;
  1282. }
  1283. var _proto2 = Timeline2.prototype;
  1284. _proto2.to = function to(targets, vars, position) {
  1285. _createTweenType(0, arguments, this);
  1286. return this;
  1287. };
  1288. _proto2.from = function from(targets, vars, position) {
  1289. _createTweenType(1, arguments, this);
  1290. return this;
  1291. };
  1292. _proto2.fromTo = function fromTo(targets, fromVars, toVars, position) {
  1293. _createTweenType(2, arguments, this);
  1294. return this;
  1295. };
  1296. _proto2.set = function set(targets, vars, position) {
  1297. vars.duration = 0;
  1298. vars.parent = this;
  1299. _inheritDefaults(vars).repeatDelay || (vars.repeat = 0);
  1300. vars.immediateRender = !!vars.immediateRender;
  1301. new Tween(targets, vars, _parsePosition(this, position), 1);
  1302. return this;
  1303. };
  1304. _proto2.call = function call(callback, params, position) {
  1305. return _addToTimeline(this, Tween.delayedCall(0, callback, params), position);
  1306. };
  1307. _proto2.staggerTo = function staggerTo(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams) {
  1308. vars.duration = duration;
  1309. vars.stagger = vars.stagger || stagger;
  1310. vars.onComplete = onCompleteAll;
  1311. vars.onCompleteParams = onCompleteAllParams;
  1312. vars.parent = this;
  1313. new Tween(targets, vars, _parsePosition(this, position));
  1314. return this;
  1315. };
  1316. _proto2.staggerFrom = function staggerFrom(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams) {
  1317. vars.runBackwards = 1;
  1318. _inheritDefaults(vars).immediateRender = _isNotFalse(vars.immediateRender);
  1319. return this.staggerTo(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams);
  1320. };
  1321. _proto2.staggerFromTo = function staggerFromTo(targets, duration, fromVars, toVars, stagger, position, onCompleteAll, onCompleteAllParams) {
  1322. toVars.startAt = fromVars;
  1323. _inheritDefaults(toVars).immediateRender = _isNotFalse(toVars.immediateRender);
  1324. return this.staggerTo(targets, duration, toVars, stagger, position, onCompleteAll, onCompleteAllParams);
  1325. };
  1326. _proto2.render = function render(totalTime, suppressEvents, force) {
  1327. 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;
  1328. this !== _globalTimeline && tTime > tDur && totalTime >= 0 && (tTime = tDur);
  1329. if (tTime !== this._tTime || force || crossingStart) {
  1330. if (prevTime !== this._time && dur) {
  1331. tTime += this._time - prevTime;
  1332. totalTime += this._time - prevTime;
  1333. }
  1334. time = tTime;
  1335. prevStart = this._start;
  1336. timeScale = this._ts;
  1337. prevPaused = !timeScale;
  1338. if (crossingStart) {
  1339. dur || (prevTime = this._zTime);
  1340. (totalTime || !suppressEvents) && (this._zTime = totalTime);
  1341. }
  1342. if (this._repeat) {
  1343. yoyo = this._yoyo;
  1344. cycleDuration = dur + this._rDelay;
  1345. if (this._repeat < -1 && totalTime < 0) {
  1346. return this.totalTime(cycleDuration * 100 + totalTime, suppressEvents, force);
  1347. }
  1348. time = _roundPrecise(tTime % cycleDuration);
  1349. if (tTime === tDur) {
  1350. iteration = this._repeat;
  1351. time = dur;
  1352. } else {
  1353. iteration = ~~(tTime / cycleDuration);
  1354. if (iteration && iteration === tTime / cycleDuration) {
  1355. time = dur;
  1356. iteration--;
  1357. }
  1358. time > dur && (time = dur);
  1359. }
  1360. prevIteration = _animationCycle(this._tTime, cycleDuration);
  1361. !prevTime && this._tTime && prevIteration !== iteration && (prevIteration = iteration);
  1362. if (yoyo && iteration & 1) {
  1363. time = dur - time;
  1364. isYoyo = 1;
  1365. }
  1366. if (iteration !== prevIteration && !this._lock) {
  1367. var rewinding = yoyo && prevIteration & 1, doesWrap = rewinding === (yoyo && iteration & 1);
  1368. iteration < prevIteration && (rewinding = !rewinding);
  1369. prevTime = rewinding ? 0 : dur;
  1370. this._lock = 1;
  1371. this.render(prevTime || (isYoyo ? 0 : _roundPrecise(iteration * cycleDuration)), suppressEvents, !dur)._lock = 0;
  1372. this._tTime = tTime;
  1373. !suppressEvents && this.parent && _callback(this, "onRepeat");
  1374. this.vars.repeatRefresh && !isYoyo && (this.invalidate()._lock = 1);
  1375. if (prevTime && prevTime !== this._time || prevPaused !== !this._ts || this.vars.onRepeat && !this.parent && !this._act) {
  1376. return this;
  1377. }
  1378. dur = this._dur;
  1379. tDur = this._tDur;
  1380. if (doesWrap) {
  1381. this._lock = 2;
  1382. prevTime = rewinding ? dur : -1e-4;
  1383. this.render(prevTime, true);
  1384. this.vars.repeatRefresh && !isYoyo && this.invalidate();
  1385. }
  1386. this._lock = 0;
  1387. if (!this._ts && !prevPaused) {
  1388. return this;
  1389. }
  1390. _propagateYoyoEase(this, isYoyo);
  1391. }
  1392. }
  1393. if (this._hasPause && !this._forcing && this._lock < 2) {
  1394. pauseTween = _findNextPauseTween(this, _roundPrecise(prevTime), _roundPrecise(time));
  1395. if (pauseTween) {
  1396. tTime -= time - (time = pauseTween._start);
  1397. }
  1398. }
  1399. this._tTime = tTime;
  1400. this._time = time;
  1401. this._act = !timeScale;
  1402. if (!this._initted) {
  1403. this._onUpdate = this.vars.onUpdate;
  1404. this._initted = 1;
  1405. this._zTime = totalTime;
  1406. prevTime = 0;
  1407. }
  1408. if (!prevTime && time && !suppressEvents) {
  1409. _callback(this, "onStart");
  1410. if (this._tTime !== tTime) {
  1411. return this;
  1412. }
  1413. }
  1414. if (time >= prevTime && totalTime >= 0) {
  1415. child = this._first;
  1416. while (child) {
  1417. next = child._next;
  1418. if ((child._act || time >= child._start) && child._ts && pauseTween !== child) {
  1419. if (child.parent !== this) {
  1420. return this.render(totalTime, suppressEvents, force);
  1421. }
  1422. child.render(child._ts > 0 ? (time - child._start) * child._ts : (child._dirty ? child.totalDuration() : child._tDur) + (time - child._start) * child._ts, suppressEvents, force);
  1423. if (time !== this._time || !this._ts && !prevPaused) {
  1424. pauseTween = 0;
  1425. next && (tTime += this._zTime = -_tinyNum);
  1426. break;
  1427. }
  1428. }
  1429. child = next;
  1430. }
  1431. } else {
  1432. child = this._last;
  1433. var adjustedTime = totalTime < 0 ? totalTime : time;
  1434. while (child) {
  1435. next = child._prev;
  1436. if ((child._act || adjustedTime <= child._end) && child._ts && pauseTween !== child) {
  1437. if (child.parent !== this) {
  1438. return this.render(totalTime, suppressEvents, force);
  1439. }
  1440. child.render(child._ts > 0 ? (adjustedTime - child._start) * child._ts : (child._dirty ? child.totalDuration() : child._tDur) + (adjustedTime - child._start) * child._ts, suppressEvents, force);
  1441. if (time !== this._time || !this._ts && !prevPaused) {
  1442. pauseTween = 0;
  1443. next && (tTime += this._zTime = adjustedTime ? -_tinyNum : _tinyNum);
  1444. break;
  1445. }
  1446. }
  1447. child = next;
  1448. }
  1449. }
  1450. if (pauseTween && !suppressEvents) {
  1451. this.pause();
  1452. pauseTween.render(time >= prevTime ? 0 : -_tinyNum)._zTime = time >= prevTime ? 1 : -1;
  1453. if (this._ts) {
  1454. this._start = prevStart;
  1455. _setEnd(this);
  1456. return this.render(totalTime, suppressEvents, force);
  1457. }
  1458. }
  1459. this._onUpdate && !suppressEvents && _callback(this, "onUpdate", true);
  1460. if (tTime === tDur && this._tTime >= this.totalDuration() || !tTime && prevTime) {
  1461. if (prevStart === this._start || Math.abs(timeScale) !== Math.abs(this._ts)) {
  1462. if (!this._lock) {
  1463. (totalTime || !dur) && (tTime === tDur && this._ts > 0 || !tTime && this._ts < 0) && _removeFromParent(this, 1);
  1464. if (!suppressEvents && !(totalTime < 0 && !prevTime) && (tTime || prevTime || !tDur)) {
  1465. _callback(this, tTime === tDur && totalTime >= 0 ? "onComplete" : "onReverseComplete", true);
  1466. this._prom && !(tTime < tDur && this.timeScale() > 0) && this._prom();
  1467. }
  1468. }
  1469. }
  1470. }
  1471. }
  1472. return this;
  1473. };
  1474. _proto2.add = function add(child, position) {
  1475. var _this2 = this;
  1476. _isNumber(position) || (position = _parsePosition(this, position, child));
  1477. if (!(child instanceof Animation)) {
  1478. if (_isArray(child)) {
  1479. child.forEach(function(obj) {
  1480. return _this2.add(obj, position);
  1481. });
  1482. return this;
  1483. }
  1484. if (_isString(child)) {
  1485. return this.addLabel(child, position);
  1486. }
  1487. if (_isFunction(child)) {
  1488. child = Tween.delayedCall(0, child);
  1489. } else {
  1490. return this;
  1491. }
  1492. }
  1493. return this !== child ? _addToTimeline(this, child, position) : this;
  1494. };
  1495. _proto2.getChildren = function getChildren(nested, tweens, timelines, ignoreBeforeTime) {
  1496. if (nested === void 0) {
  1497. nested = true;
  1498. }
  1499. if (tweens === void 0) {
  1500. tweens = true;
  1501. }
  1502. if (timelines === void 0) {
  1503. timelines = true;
  1504. }
  1505. if (ignoreBeforeTime === void 0) {
  1506. ignoreBeforeTime = -_bigNum;
  1507. }
  1508. var a = [], child = this._first;
  1509. while (child) {
  1510. if (child._start >= ignoreBeforeTime) {
  1511. if (child instanceof Tween) {
  1512. tweens && a.push(child);
  1513. } else {
  1514. timelines && a.push(child);
  1515. nested && a.push.apply(a, child.getChildren(true, tweens, timelines));
  1516. }
  1517. }
  1518. child = child._next;
  1519. }
  1520. return a;
  1521. };
  1522. _proto2.getById = function getById2(id) {
  1523. var animations = this.getChildren(1, 1, 1), i = animations.length;
  1524. while (i--) {
  1525. if (animations[i].vars.id === id) {
  1526. return animations[i];
  1527. }
  1528. }
  1529. };
  1530. _proto2.remove = function remove(child) {
  1531. if (_isString(child)) {
  1532. return this.removeLabel(child);
  1533. }
  1534. if (_isFunction(child)) {
  1535. return this.killTweensOf(child);
  1536. }
  1537. _removeLinkedListItem(this, child);
  1538. if (child === this._recent) {
  1539. this._recent = this._last;
  1540. }
  1541. return _uncache(this);
  1542. };
  1543. _proto2.totalTime = function totalTime(_totalTime2, suppressEvents) {
  1544. if (!arguments.length) {
  1545. return this._tTime;
  1546. }
  1547. this._forcing = 1;
  1548. if (!this._dp && this._ts) {
  1549. this._start = _roundPrecise(_ticker.time - (this._ts > 0 ? _totalTime2 / this._ts : (this.totalDuration() - _totalTime2) / -this._ts));
  1550. }
  1551. _Animation.prototype.totalTime.call(this, _totalTime2, suppressEvents);
  1552. this._forcing = 0;
  1553. return this;
  1554. };
  1555. _proto2.addLabel = function addLabel(label, position) {
  1556. this.labels[label] = _parsePosition(this, position);
  1557. return this;
  1558. };
  1559. _proto2.removeLabel = function removeLabel(label) {
  1560. delete this.labels[label];
  1561. return this;
  1562. };
  1563. _proto2.addPause = function addPause(position, callback, params) {
  1564. var t = Tween.delayedCall(0, callback || _emptyFunc, params);
  1565. t.data = "isPause";
  1566. this._hasPause = 1;
  1567. return _addToTimeline(this, t, _parsePosition(this, position));
  1568. };
  1569. _proto2.removePause = function removePause(position) {
  1570. var child = this._first;
  1571. position = _parsePosition(this, position);
  1572. while (child) {
  1573. if (child._start === position && child.data === "isPause") {
  1574. _removeFromParent(child);
  1575. }
  1576. child = child._next;
  1577. }
  1578. };
  1579. _proto2.killTweensOf = function killTweensOf(targets, props, onlyActive) {
  1580. var tweens = this.getTweensOf(targets, onlyActive), i = tweens.length;
  1581. while (i--) {
  1582. _overwritingTween !== tweens[i] && tweens[i].kill(targets, props);
  1583. }
  1584. return this;
  1585. };
  1586. _proto2.getTweensOf = function getTweensOf2(targets, onlyActive) {
  1587. var a = [], parsedTargets = toArray(targets), child = this._first, isGlobalTime = _isNumber(onlyActive), children;
  1588. while (child) {
  1589. if (child instanceof Tween) {
  1590. if (_arrayContainsAny(child._targets, parsedTargets) && (isGlobalTime ? (!_overwritingTween || child._initted && child._ts) && child.globalTime(0) <= onlyActive && child.globalTime(child.totalDuration()) > onlyActive : !onlyActive || child.isActive())) {
  1591. a.push(child);
  1592. }
  1593. } else if ((children = child.getTweensOf(parsedTargets, onlyActive)).length) {
  1594. a.push.apply(a, children);
  1595. }
  1596. child = child._next;
  1597. }
  1598. return a;
  1599. };
  1600. _proto2.tweenTo = function tweenTo(position, vars) {
  1601. vars = vars || {};
  1602. 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({
  1603. ease: vars.ease || "none",
  1604. lazy: false,
  1605. immediateRender: false,
  1606. time: endTime,
  1607. overwrite: "auto",
  1608. duration: vars.duration || Math.abs((endTime - (startAt && "time" in startAt ? startAt.time : tl._time)) / tl.timeScale()) || _tinyNum,
  1609. onStart: function onStart() {
  1610. tl.pause();
  1611. if (!initted) {
  1612. var duration = vars.duration || Math.abs((endTime - (startAt && "time" in startAt ? startAt.time : tl._time)) / tl.timeScale());
  1613. tween._dur !== duration && _setDuration(tween, duration, 0, 1).render(tween._time, true, true);
  1614. initted = 1;
  1615. }
  1616. _onStart && _onStart.apply(tween, onStartParams || []);
  1617. }
  1618. }, vars));
  1619. return immediateRender ? tween.render(0) : tween;
  1620. };
  1621. _proto2.tweenFromTo = function tweenFromTo(fromPosition, toPosition, vars) {
  1622. return this.tweenTo(toPosition, _setDefaults({
  1623. startAt: {
  1624. time: _parsePosition(this, fromPosition)
  1625. }
  1626. }, vars));
  1627. };
  1628. _proto2.recent = function recent() {
  1629. return this._recent;
  1630. };
  1631. _proto2.nextLabel = function nextLabel(afterTime) {
  1632. if (afterTime === void 0) {
  1633. afterTime = this._time;
  1634. }
  1635. return _getLabelInDirection(this, _parsePosition(this, afterTime));
  1636. };
  1637. _proto2.previousLabel = function previousLabel(beforeTime) {
  1638. if (beforeTime === void 0) {
  1639. beforeTime = this._time;
  1640. }
  1641. return _getLabelInDirection(this, _parsePosition(this, beforeTime), 1);
  1642. };
  1643. _proto2.currentLabel = function currentLabel(value) {
  1644. return arguments.length ? this.seek(value, true) : this.previousLabel(this._time + _tinyNum);
  1645. };
  1646. _proto2.shiftChildren = function shiftChildren(amount, adjustLabels, ignoreBeforeTime) {
  1647. if (ignoreBeforeTime === void 0) {
  1648. ignoreBeforeTime = 0;
  1649. }
  1650. var child = this._first, labels = this.labels, p;
  1651. while (child) {
  1652. if (child._start >= ignoreBeforeTime) {
  1653. child._start += amount;
  1654. child._end += amount;
  1655. }
  1656. child = child._next;
  1657. }
  1658. if (adjustLabels) {
  1659. for (p in labels) {
  1660. if (labels[p] >= ignoreBeforeTime) {
  1661. labels[p] += amount;
  1662. }
  1663. }
  1664. }
  1665. return _uncache(this);
  1666. };
  1667. _proto2.invalidate = function invalidate() {
  1668. var child = this._first;
  1669. this._lock = 0;
  1670. while (child) {
  1671. child.invalidate();
  1672. child = child._next;
  1673. }
  1674. return _Animation.prototype.invalidate.call(this);
  1675. };
  1676. _proto2.clear = function clear(includeLabels) {
  1677. if (includeLabels === void 0) {
  1678. includeLabels = true;
  1679. }
  1680. var child = this._first, next;
  1681. while (child) {
  1682. next = child._next;
  1683. this.remove(child);
  1684. child = next;
  1685. }
  1686. this._dp && (this._time = this._tTime = this._pTime = 0);
  1687. includeLabels && (this.labels = {});
  1688. return _uncache(this);
  1689. };
  1690. _proto2.totalDuration = function totalDuration(value) {
  1691. var max = 0, self = this, child = self._last, prevStart = _bigNum, prev, start, parent;
  1692. if (arguments.length) {
  1693. return self.timeScale((self._repeat < 0 ? self.duration() : self.totalDuration()) / (self.reversed() ? -value : value));
  1694. }
  1695. if (self._dirty) {
  1696. parent = self.parent;
  1697. while (child) {
  1698. prev = child._prev;
  1699. child._dirty && child.totalDuration();
  1700. start = child._start;
  1701. if (start > prevStart && self._sort && child._ts && !self._lock) {
  1702. self._lock = 1;
  1703. _addToTimeline(self, child, start - child._delay, 1)._lock = 0;
  1704. } else {
  1705. prevStart = start;
  1706. }
  1707. if (start < 0 && child._ts) {
  1708. max -= start;
  1709. if (!parent && !self._dp || parent && parent.smoothChildTiming) {
  1710. self._start += start / self._ts;
  1711. self._time -= start;
  1712. self._tTime -= start;
  1713. }
  1714. self.shiftChildren(-start, false, -Infinity);
  1715. prevStart = 0;
  1716. }
  1717. child._end > max && child._ts && (max = child._end);
  1718. child = prev;
  1719. }
  1720. _setDuration(self, self === _globalTimeline && self._time > max ? self._time : max, 1, 1);
  1721. self._dirty = 0;
  1722. }
  1723. return self._tDur;
  1724. };
  1725. Timeline2.updateRoot = function updateRoot(time) {
  1726. if (_globalTimeline._ts) {
  1727. _lazySafeRender(_globalTimeline, _parentToChildTotalTime(time, _globalTimeline));
  1728. _lastRenderedFrame = _ticker.frame;
  1729. }
  1730. if (_ticker.frame >= _nextGCFrame) {
  1731. _nextGCFrame += _config.autoSleep || 120;
  1732. var child = _globalTimeline._first;
  1733. if (!child || !child._ts) {
  1734. if (_config.autoSleep && _ticker._listeners.length < 2) {
  1735. while (child && !child._ts) {
  1736. child = child._next;
  1737. }
  1738. child || _ticker.sleep();
  1739. }
  1740. }
  1741. }
  1742. };
  1743. return Timeline2;
  1744. }(Animation);
  1745. _setDefaults(Timeline.prototype, {
  1746. _lock: 0,
  1747. _hasPause: 0,
  1748. _forcing: 0
  1749. });
  1750. var _addComplexStringPropTween = function _addComplexStringPropTween2(target, prop, start, end, setter, stringFilter, funcParam) {
  1751. 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;
  1752. pt.b = start;
  1753. pt.e = end;
  1754. start += "";
  1755. end += "";
  1756. if (hasRandom = ~end.indexOf("random(")) {
  1757. end = _replaceRandom(end);
  1758. }
  1759. if (stringFilter) {
  1760. a = [start, end];
  1761. stringFilter(a, target, prop);
  1762. start = a[0];
  1763. end = a[1];
  1764. }
  1765. startNums = start.match(_complexStringNumExp) || [];
  1766. while (result = _complexStringNumExp.exec(end)) {
  1767. endNum = result[0];
  1768. chunk = end.substring(index, result.index);
  1769. if (color) {
  1770. color = (color + 1) % 5;
  1771. } else if (chunk.substr(-5) === "rgba(") {
  1772. color = 1;
  1773. }
  1774. if (endNum !== startNums[matchIndex++]) {
  1775. startNum = parseFloat(startNums[matchIndex - 1]) || 0;
  1776. pt._pt = {
  1777. _next: pt._pt,
  1778. p: chunk || matchIndex === 1 ? chunk : ",",
  1779. s: startNum,
  1780. c: endNum.charAt(1) === "=" ? _parseRelative(startNum, endNum) - startNum : parseFloat(endNum) - startNum,
  1781. m: color && color < 4 ? Math.round : 0
  1782. };
  1783. index = _complexStringNumExp.lastIndex;
  1784. }
  1785. }
  1786. pt.c = index < end.length ? end.substring(index, end.length) : "";
  1787. pt.fp = funcParam;
  1788. if (_relExp.test(end) || hasRandom) {
  1789. pt.e = 0;
  1790. }
  1791. this._pt = pt;
  1792. return pt;
  1793. }, _addPropTween = function _addPropTween2(target, prop, start, end, index, targets, modifier, stringFilter, funcParam) {
  1794. _isFunction(end) && (end = end(index || 0, target, targets));
  1795. 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;
  1796. if (_isString(end)) {
  1797. if (~end.indexOf("random(")) {
  1798. end = _replaceRandom(end);
  1799. }
  1800. if (end.charAt(1) === "=") {
  1801. pt = _parseRelative(parsedStart, end) + (getUnit(parsedStart) || 0);
  1802. if (pt || pt === 0) {
  1803. end = pt;
  1804. }
  1805. }
  1806. }
  1807. if (parsedStart !== end || _forceAllPropTweens) {
  1808. if (!isNaN(parsedStart * end) && end !== "") {
  1809. pt = new PropTween(this._pt, target, prop, +parsedStart || 0, end - (parsedStart || 0), typeof currentValue === "boolean" ? _renderBoolean : _renderPlain, 0, setter);
  1810. funcParam && (pt.fp = funcParam);
  1811. modifier && pt.modifier(modifier, this, target);
  1812. return this._pt = pt;
  1813. }
  1814. !currentValue && !(prop in target) && _missingPlugin(prop, end);
  1815. return _addComplexStringPropTween.call(this, target, prop, parsedStart, end, setter, stringFilter || _config.stringFilter, funcParam);
  1816. }
  1817. }, _processVars = function _processVars2(vars, index, target, targets, tween) {
  1818. _isFunction(vars) && (vars = _parseFuncOrString(vars, tween, index, target, targets));
  1819. if (!_isObject(vars) || vars.style && vars.nodeType || _isArray(vars) || _isTypedArray(vars)) {
  1820. return _isString(vars) ? _parseFuncOrString(vars, tween, index, target, targets) : vars;
  1821. }
  1822. var copy = {}, p;
  1823. for (p in vars) {
  1824. copy[p] = _parseFuncOrString(vars[p], tween, index, target, targets);
  1825. }
  1826. return copy;
  1827. }, _checkPlugin = function _checkPlugin2(property, vars, tween, index, target, targets) {
  1828. var plugin, pt, ptLookup, i;
  1829. if (_plugins[property] && (plugin = new _plugins[property]()).init(target, plugin.rawVars ? vars[property] : _processVars(vars[property], index, target, targets, tween), tween, index, targets) !== false) {
  1830. tween._pt = pt = new PropTween(tween._pt, target, property, 0, 1, plugin.render, plugin, 0, plugin.priority);
  1831. if (tween !== _quickTween) {
  1832. ptLookup = tween._ptLookup[tween._targets.indexOf(target)];
  1833. i = plugin._props.length;
  1834. while (i--) {
  1835. ptLookup[plugin._props[i]] = pt;
  1836. }
  1837. }
  1838. }
  1839. return plugin;
  1840. }, _overwritingTween, _forceAllPropTweens, _initTween = function _initTween2(tween, time) {
  1841. var vars = tween.vars, ease = vars.ease, startAt = vars.startAt, immediateRender = vars.immediateRender, lazy = vars.lazy, onUpdate = vars.onUpdate, onUpdateParams = vars.onUpdateParams, callbackScope = vars.callbackScope, 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.parent._targets : targets, autoOverwrite = tween._overwrite === "auto" && !_suppressOverwrites, tl = tween.timeline, cleanVars, i, p, pt, target, hasPriority, gsData, harness, plugin, ptLookup, index, harnessVars, overwritten;
  1842. tl && (!keyframes || !ease) && (ease = "none");
  1843. tween._ease = _parseEase(ease, _defaults.ease);
  1844. tween._yEase = yoyoEase ? _invertEase(_parseEase(yoyoEase === true ? ease : yoyoEase, _defaults.ease)) : 0;
  1845. if (yoyoEase && tween._yoyo && !tween._repeat) {
  1846. yoyoEase = tween._yEase;
  1847. tween._yEase = tween._ease;
  1848. tween._ease = yoyoEase;
  1849. }
  1850. tween._from = !tl && !!vars.runBackwards;
  1851. if (!tl || keyframes && !vars.stagger) {
  1852. harness = targets[0] ? _getCache(targets[0]).harness : 0;
  1853. harnessVars = harness && vars[harness.prop];
  1854. cleanVars = _copyExcluding(vars, _reservedProps);
  1855. if (prevStartAt) {
  1856. _removeFromParent(prevStartAt.render(-1, true));
  1857. prevStartAt._lazy = 0;
  1858. }
  1859. if (startAt) {
  1860. _removeFromParent(tween._startAt = Tween.set(targets, _setDefaults({
  1861. data: "isStart",
  1862. overwrite: false,
  1863. parent,
  1864. immediateRender: true,
  1865. lazy: _isNotFalse(lazy),
  1866. startAt: null,
  1867. delay: 0,
  1868. onUpdate,
  1869. onUpdateParams,
  1870. callbackScope,
  1871. stagger: 0
  1872. }, startAt)));
  1873. time < 0 && !immediateRender && !autoRevert && tween._startAt.render(-1, true);
  1874. if (immediateRender) {
  1875. time > 0 && !autoRevert && (tween._startAt = 0);
  1876. if (dur && time <= 0) {
  1877. time && (tween._zTime = time);
  1878. return;
  1879. }
  1880. } else if (autoRevert === false) {
  1881. tween._startAt = 0;
  1882. }
  1883. } else if (runBackwards && dur) {
  1884. if (prevStartAt) {
  1885. !autoRevert && (tween._startAt = 0);
  1886. } else {
  1887. time && (immediateRender = false);
  1888. p = _setDefaults({
  1889. overwrite: false,
  1890. data: "isFromStart",
  1891. lazy: immediateRender && _isNotFalse(lazy),
  1892. immediateRender,
  1893. stagger: 0,
  1894. parent
  1895. }, cleanVars);
  1896. harnessVars && (p[harness.prop] = harnessVars);
  1897. _removeFromParent(tween._startAt = Tween.set(targets, p));
  1898. time < 0 && tween._startAt.render(-1, true);
  1899. tween._zTime = time;
  1900. if (!immediateRender) {
  1901. _initTween2(tween._startAt, _tinyNum);
  1902. } else if (!time) {
  1903. return;
  1904. }
  1905. }
  1906. }
  1907. tween._pt = tween._ptCache = 0;
  1908. lazy = dur && _isNotFalse(lazy) || lazy && !dur;
  1909. for (i = 0; i < targets.length; i++) {
  1910. target = targets[i];
  1911. gsData = target._gsap || _harness(targets)[i]._gsap;
  1912. tween._ptLookup[i] = ptLookup = {};
  1913. _lazyLookup[gsData.id] && _lazyTweens.length && _lazyRender();
  1914. index = fullTargets === targets ? i : fullTargets.indexOf(target);
  1915. if (harness && (plugin = new harness()).init(target, harnessVars || cleanVars, tween, index, fullTargets) !== false) {
  1916. tween._pt = pt = new PropTween(tween._pt, target, plugin.name, 0, 1, plugin.render, plugin, 0, plugin.priority);
  1917. plugin._props.forEach(function(name) {
  1918. ptLookup[name] = pt;
  1919. });
  1920. plugin.priority && (hasPriority = 1);
  1921. }
  1922. if (!harness || harnessVars) {
  1923. for (p in cleanVars) {
  1924. if (_plugins[p] && (plugin = _checkPlugin(p, cleanVars, tween, index, target, fullTargets))) {
  1925. plugin.priority && (hasPriority = 1);
  1926. } else {
  1927. ptLookup[p] = pt = _addPropTween.call(tween, target, p, "get", cleanVars[p], index, fullTargets, 0, vars.stringFilter);
  1928. }
  1929. }
  1930. }
  1931. tween._op && tween._op[i] && tween.kill(target, tween._op[i]);
  1932. if (autoOverwrite && tween._pt) {
  1933. _overwritingTween = tween;
  1934. _globalTimeline.killTweensOf(target, ptLookup, tween.globalTime(time));
  1935. overwritten = !tween.parent;
  1936. _overwritingTween = 0;
  1937. }
  1938. tween._pt && lazy && (_lazyLookup[gsData.id] = 1);
  1939. }
  1940. hasPriority && _sortPropTweensByPriority(tween);
  1941. tween._onInit && tween._onInit(tween);
  1942. }
  1943. tween._onUpdate = onUpdate;
  1944. tween._initted = (!tween._op || tween._pt) && !overwritten;
  1945. keyframes && time <= 0 && tl.render(_bigNum, true, true);
  1946. }, _updatePropTweens = function _updatePropTweens2(tween, property, value, start, startIsRelative, ratio, time) {
  1947. var ptCache = (tween._pt && tween._ptCache || (tween._ptCache = {}))[property], pt, lookup, i;
  1948. if (!ptCache) {
  1949. ptCache = tween._ptCache[property] = [];
  1950. lookup = tween._ptLookup;
  1951. i = tween._targets.length;
  1952. while (i--) {
  1953. pt = lookup[i][property];
  1954. if (pt && pt.d && pt.d._pt) {
  1955. pt = pt.d._pt;
  1956. while (pt && pt.p !== property) {
  1957. pt = pt._next;
  1958. }
  1959. }
  1960. if (!pt) {
  1961. _forceAllPropTweens = 1;
  1962. tween.vars[property] = "+=0";
  1963. _initTween(tween, time);
  1964. _forceAllPropTweens = 0;
  1965. return 1;
  1966. }
  1967. ptCache.push(pt);
  1968. }
  1969. }
  1970. i = ptCache.length;
  1971. while (i--) {
  1972. pt = ptCache[i];
  1973. pt.s = (start || start === 0) && !startIsRelative ? start : pt.s + (start || 0) + ratio * pt.c;
  1974. pt.c = value - pt.s;
  1975. pt.e && (pt.e = _round(value) + getUnit(pt.e));
  1976. pt.b && (pt.b = pt.s + getUnit(pt.b));
  1977. }
  1978. }, _addAliasesToVars = function _addAliasesToVars2(targets, vars) {
  1979. var harness = targets[0] ? _getCache(targets[0]).harness : 0, propertyAliases = harness && harness.aliases, copy, p, i, aliases;
  1980. if (!propertyAliases) {
  1981. return vars;
  1982. }
  1983. copy = _merge({}, vars);
  1984. for (p in propertyAliases) {
  1985. if (p in copy) {
  1986. aliases = propertyAliases[p].split(",");
  1987. i = aliases.length;
  1988. while (i--) {
  1989. copy[aliases[i]] = copy[p];
  1990. }
  1991. }
  1992. }
  1993. return copy;
  1994. }, _parseKeyframe = function _parseKeyframe2(prop, obj, allProps, easeEach) {
  1995. var ease = obj.ease || easeEach || "power1.inOut", p, a;
  1996. if (_isArray(obj)) {
  1997. a = allProps[prop] || (allProps[prop] = []);
  1998. obj.forEach(function(value, i) {
  1999. return a.push({
  2000. t: i / (obj.length - 1) * 100,
  2001. v: value,
  2002. e: ease
  2003. });
  2004. });
  2005. } else {
  2006. for (p in obj) {
  2007. a = allProps[p] || (allProps[p] = []);
  2008. p === "ease" || a.push({
  2009. t: parseFloat(prop),
  2010. v: obj[p],
  2011. e: ease
  2012. });
  2013. }
  2014. }
  2015. }, _parseFuncOrString = function _parseFuncOrString2(value, tween, i, target, targets) {
  2016. return _isFunction(value) ? value.call(tween, i, target, targets) : _isString(value) && ~value.indexOf("random(") ? _replaceRandom(value) : value;
  2017. }, _staggerTweenProps = _callbackNames + "repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase,autoRevert", _staggerPropsToSkip = {};
  2018. _forEachName(_staggerTweenProps + ",id,stagger,delay,duration,paused,scrollTrigger", function(name) {
  2019. return _staggerPropsToSkip[name] = 1;
  2020. });
  2021. var Tween = /* @__PURE__ */ function(_Animation2) {
  2022. _inheritsLoose(Tween2, _Animation2);
  2023. function Tween2(targets, vars, position, skipInherit) {
  2024. var _this3;
  2025. if (typeof vars === "number") {
  2026. position.duration = vars;
  2027. vars = position;
  2028. position = null;
  2029. }
  2030. _this3 = _Animation2.call(this, skipInherit ? vars : _inheritDefaults(vars)) || this;
  2031. 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, defaults2 = _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;
  2032. _this3._targets = parsedTargets.length ? _harness(parsedTargets) : _warn("GSAP target " + targets + " not found. https://greensock.com", !_config.nullTargetWarn) || [];
  2033. _this3._ptLookup = [];
  2034. _this3._overwrite = overwrite;
  2035. if (keyframes || stagger || _isFuncOrString(duration) || _isFuncOrString(delay)) {
  2036. vars = _this3.vars;
  2037. tl = _this3.timeline = new Timeline({
  2038. data: "nested",
  2039. defaults: defaults2 || {}
  2040. });
  2041. tl.kill();
  2042. tl.parent = tl._dp = _assertThisInitialized(_this3);
  2043. tl._start = 0;
  2044. if (stagger || _isFuncOrString(duration) || _isFuncOrString(delay)) {
  2045. l = parsedTargets.length;
  2046. staggerFunc = stagger && distribute(stagger);
  2047. if (_isObject(stagger)) {
  2048. for (p in stagger) {
  2049. if (~_staggerTweenProps.indexOf(p)) {
  2050. staggerVarsToMerge || (staggerVarsToMerge = {});
  2051. staggerVarsToMerge[p] = stagger[p];
  2052. }
  2053. }
  2054. }
  2055. for (i = 0; i < l; i++) {
  2056. copy = _copyExcluding(vars, _staggerPropsToSkip);
  2057. copy.stagger = 0;
  2058. yoyoEase && (copy.yoyoEase = yoyoEase);
  2059. staggerVarsToMerge && _merge(copy, staggerVarsToMerge);
  2060. curTarget = parsedTargets[i];
  2061. copy.duration = +_parseFuncOrString(duration, _assertThisInitialized(_this3), i, curTarget, parsedTargets);
  2062. copy.delay = (+_parseFuncOrString(delay, _assertThisInitialized(_this3), i, curTarget, parsedTargets) || 0) - _this3._delay;
  2063. if (!stagger && l === 1 && copy.delay) {
  2064. _this3._delay = delay = copy.delay;
  2065. _this3._start += delay;
  2066. copy.delay = 0;
  2067. }
  2068. tl.to(curTarget, copy, staggerFunc ? staggerFunc(i, curTarget, parsedTargets) : 0);
  2069. tl._ease = _easeMap.none;
  2070. }
  2071. tl.duration() ? duration = delay = 0 : _this3.timeline = 0;
  2072. } else if (keyframes) {
  2073. _inheritDefaults(_setDefaults(tl.vars.defaults, {
  2074. ease: "none"
  2075. }));
  2076. tl._ease = _parseEase(keyframes.ease || vars.ease || "none");
  2077. var time = 0, a, kf, v;
  2078. if (_isArray(keyframes)) {
  2079. keyframes.forEach(function(frame) {
  2080. return tl.to(parsedTargets, frame, ">");
  2081. });
  2082. } else {
  2083. copy = {};
  2084. for (p in keyframes) {
  2085. p === "ease" || p === "easeEach" || _parseKeyframe(p, keyframes[p], copy, keyframes.easeEach);
  2086. }
  2087. for (p in copy) {
  2088. a = copy[p].sort(function(a2, b) {
  2089. return a2.t - b.t;
  2090. });
  2091. time = 0;
  2092. for (i = 0; i < a.length; i++) {
  2093. kf = a[i];
  2094. v = {
  2095. ease: kf.e,
  2096. duration: (kf.t - (i ? a[i - 1].t : 0)) / 100 * duration
  2097. };
  2098. v[p] = kf.v;
  2099. tl.to(parsedTargets, v, time);
  2100. time += v.duration;
  2101. }
  2102. }
  2103. tl.duration() < duration && tl.to({}, {
  2104. duration: duration - tl.duration()
  2105. });
  2106. }
  2107. }
  2108. duration || _this3.duration(duration = tl.duration());
  2109. } else {
  2110. _this3.timeline = 0;
  2111. }
  2112. if (overwrite === true && !_suppressOverwrites) {
  2113. _overwritingTween = _assertThisInitialized(_this3);
  2114. _globalTimeline.killTweensOf(parsedTargets);
  2115. _overwritingTween = 0;
  2116. }
  2117. _addToTimeline(parent, _assertThisInitialized(_this3), position);
  2118. vars.reversed && _this3.reverse();
  2119. vars.paused && _this3.paused(true);
  2120. if (immediateRender || !duration && !keyframes && _this3._start === _roundPrecise(parent._time) && _isNotFalse(immediateRender) && _hasNoPausedAncestors(_assertThisInitialized(_this3)) && parent.data !== "nested") {
  2121. _this3._tTime = -_tinyNum;
  2122. _this3.render(Math.max(0, -delay));
  2123. }
  2124. scrollTrigger && _scrollTrigger(_assertThisInitialized(_this3), scrollTrigger);
  2125. return _this3;
  2126. }
  2127. var _proto3 = Tween2.prototype;
  2128. _proto3.render = function render(totalTime, suppressEvents, force) {
  2129. var prevTime = this._time, tDur = this._tDur, dur = this._dur, tTime = totalTime > tDur - _tinyNum && totalTime >= 0 ? tDur : totalTime < _tinyNum ? 0 : totalTime, time, pt, iteration, cycleDuration, prevIteration, isYoyo, ratio, timeline2, yoyoEase;
  2130. if (!dur) {
  2131. _renderZeroDurationTween(this, totalTime, suppressEvents, force);
  2132. } else if (tTime !== this._tTime || !totalTime || force || !this._initted && this._tTime || this._startAt && this._zTime < 0 !== totalTime < 0) {
  2133. time = tTime;
  2134. timeline2 = this.timeline;
  2135. if (this._repeat) {
  2136. cycleDuration = dur + this._rDelay;
  2137. if (this._repeat < -1 && totalTime < 0) {
  2138. return this.totalTime(cycleDuration * 100 + totalTime, suppressEvents, force);
  2139. }
  2140. time = _roundPrecise(tTime % cycleDuration);
  2141. if (tTime === tDur) {
  2142. iteration = this._repeat;
  2143. time = dur;
  2144. } else {
  2145. iteration = ~~(tTime / cycleDuration);
  2146. if (iteration && iteration === tTime / cycleDuration) {
  2147. time = dur;
  2148. iteration--;
  2149. }
  2150. time > dur && (time = dur);
  2151. }
  2152. isYoyo = this._yoyo && iteration & 1;
  2153. if (isYoyo) {
  2154. yoyoEase = this._yEase;
  2155. time = dur - time;
  2156. }
  2157. prevIteration = _animationCycle(this._tTime, cycleDuration);
  2158. if (time === prevTime && !force && this._initted) {
  2159. this._tTime = tTime;
  2160. return this;
  2161. }
  2162. if (iteration !== prevIteration) {
  2163. timeline2 && this._yEase && _propagateYoyoEase(timeline2, isYoyo);
  2164. if (this.vars.repeatRefresh && !isYoyo && !this._lock) {
  2165. this._lock = force = 1;
  2166. this.render(_roundPrecise(cycleDuration * iteration), true).invalidate()._lock = 0;
  2167. }
  2168. }
  2169. }
  2170. if (!this._initted) {
  2171. if (_attemptInitTween(this, totalTime < 0 ? totalTime : time, force, suppressEvents)) {
  2172. this._tTime = 0;
  2173. return this;
  2174. }
  2175. if (prevTime !== this._time) {
  2176. return this;
  2177. }
  2178. if (dur !== this._dur) {
  2179. return this.render(totalTime, suppressEvents, force);
  2180. }
  2181. }
  2182. this._tTime = tTime;
  2183. this._time = time;
  2184. if (!this._act && this._ts) {
  2185. this._act = 1;
  2186. this._lazy = 0;
  2187. }
  2188. this.ratio = ratio = (yoyoEase || this._ease)(time / dur);
  2189. if (this._from) {
  2190. this.ratio = ratio = 1 - ratio;
  2191. }
  2192. if (time && !prevTime && !suppressEvents) {
  2193. _callback(this, "onStart");
  2194. if (this._tTime !== tTime) {
  2195. return this;
  2196. }
  2197. }
  2198. pt = this._pt;
  2199. while (pt) {
  2200. pt.r(ratio, pt.d);
  2201. pt = pt._next;
  2202. }
  2203. timeline2 && timeline2.render(totalTime < 0 ? totalTime : !time && isYoyo ? -_tinyNum : timeline2._dur * timeline2._ease(time / this._dur), suppressEvents, force) || this._startAt && (this._zTime = totalTime);
  2204. if (this._onUpdate && !suppressEvents) {
  2205. totalTime < 0 && this._startAt && this._startAt.render(totalTime, true, force);
  2206. _callback(this, "onUpdate");
  2207. }
  2208. this._repeat && iteration !== prevIteration && this.vars.onRepeat && !suppressEvents && this.parent && _callback(this, "onRepeat");
  2209. if ((tTime === this._tDur || !tTime) && this._tTime === tTime) {
  2210. totalTime < 0 && this._startAt && !this._onUpdate && this._startAt.render(totalTime, true, true);
  2211. (totalTime || !dur) && (tTime === this._tDur && this._ts > 0 || !tTime && this._ts < 0) && _removeFromParent(this, 1);
  2212. if (!suppressEvents && !(totalTime < 0 && !prevTime) && (tTime || prevTime)) {
  2213. _callback(this, tTime === tDur ? "onComplete" : "onReverseComplete", true);
  2214. this._prom && !(tTime < tDur && this.timeScale() > 0) && this._prom();
  2215. }
  2216. }
  2217. }
  2218. return this;
  2219. };
  2220. _proto3.targets = function targets() {
  2221. return this._targets;
  2222. };
  2223. _proto3.invalidate = function invalidate() {
  2224. this._pt = this._op = this._startAt = this._onUpdate = this._lazy = this.ratio = 0;
  2225. this._ptLookup = [];
  2226. this.timeline && this.timeline.invalidate();
  2227. return _Animation2.prototype.invalidate.call(this);
  2228. };
  2229. _proto3.resetTo = function resetTo(property, value, start, startIsRelative) {
  2230. _tickerActive || _ticker.wake();
  2231. this._ts || this.play();
  2232. var time = Math.min(this._dur, (this._dp._time - this._start) * this._ts), ratio;
  2233. this._initted || _initTween(this, time);
  2234. ratio = this._ease(time / this._dur);
  2235. if (_updatePropTweens(this, property, value, start, startIsRelative, ratio, time)) {
  2236. return this.resetTo(property, value, start, startIsRelative);
  2237. }
  2238. _alignPlayhead(this, 0);
  2239. this.parent || _addLinkedListItem(this._dp, this, "_first", "_last", this._dp._sort ? "_start" : 0);
  2240. return this.render(0);
  2241. };
  2242. _proto3.kill = function kill(targets, vars) {
  2243. if (vars === void 0) {
  2244. vars = "all";
  2245. }
  2246. if (!targets && (!vars || vars === "all")) {
  2247. this._lazy = this._pt = 0;
  2248. return this.parent ? _interrupt(this) : this;
  2249. }
  2250. if (this.timeline) {
  2251. var tDur = this.timeline.totalDuration();
  2252. this.timeline.killTweensOf(targets, vars, _overwritingTween && _overwritingTween.vars.overwrite !== true)._first || _interrupt(this);
  2253. this.parent && tDur !== this.timeline.totalDuration() && _setDuration(this, this._dur * this.timeline._tDur / tDur, 0, 1);
  2254. return this;
  2255. }
  2256. var parsedTargets = this._targets, killingTargets = targets ? toArray(targets) : parsedTargets, propTweenLookup = this._ptLookup, firstPT = this._pt, overwrittenProps, curLookup, curOverwriteProps, props, p, pt, i;
  2257. if ((!vars || vars === "all") && _arraysMatch(parsedTargets, killingTargets)) {
  2258. vars === "all" && (this._pt = 0);
  2259. return _interrupt(this);
  2260. }
  2261. overwrittenProps = this._op = this._op || [];
  2262. if (vars !== "all") {
  2263. if (_isString(vars)) {
  2264. p = {};
  2265. _forEachName(vars, function(name) {
  2266. return p[name] = 1;
  2267. });
  2268. vars = p;
  2269. }
  2270. vars = _addAliasesToVars(parsedTargets, vars);
  2271. }
  2272. i = parsedTargets.length;
  2273. while (i--) {
  2274. if (~killingTargets.indexOf(parsedTargets[i])) {
  2275. curLookup = propTweenLookup[i];
  2276. if (vars === "all") {
  2277. overwrittenProps[i] = vars;
  2278. props = curLookup;
  2279. curOverwriteProps = {};
  2280. } else {
  2281. curOverwriteProps = overwrittenProps[i] = overwrittenProps[i] || {};
  2282. props = vars;
  2283. }
  2284. for (p in props) {
  2285. pt = curLookup && curLookup[p];
  2286. if (pt) {
  2287. if (!("kill" in pt.d) || pt.d.kill(p) === true) {
  2288. _removeLinkedListItem(this, pt, "_pt");
  2289. }
  2290. delete curLookup[p];
  2291. }
  2292. if (curOverwriteProps !== "all") {
  2293. curOverwriteProps[p] = 1;
  2294. }
  2295. }
  2296. }
  2297. }
  2298. this._initted && !this._pt && firstPT && _interrupt(this);
  2299. return this;
  2300. };
  2301. Tween2.to = function to(targets, vars) {
  2302. return new Tween2(targets, vars, arguments[2]);
  2303. };
  2304. Tween2.from = function from(targets, vars) {
  2305. return _createTweenType(1, arguments);
  2306. };
  2307. Tween2.delayedCall = function delayedCall(delay, callback, params, scope) {
  2308. return new Tween2(callback, 0, {
  2309. immediateRender: false,
  2310. lazy: false,
  2311. overwrite: false,
  2312. delay,
  2313. onComplete: callback,
  2314. onReverseComplete: callback,
  2315. onCompleteParams: params,
  2316. onReverseCompleteParams: params,
  2317. callbackScope: scope
  2318. });
  2319. };
  2320. Tween2.fromTo = function fromTo(targets, fromVars, toVars) {
  2321. return _createTweenType(2, arguments);
  2322. };
  2323. Tween2.set = function set(targets, vars) {
  2324. vars.duration = 0;
  2325. vars.repeatDelay || (vars.repeat = 0);
  2326. return new Tween2(targets, vars);
  2327. };
  2328. Tween2.killTweensOf = function killTweensOf(targets, props, onlyActive) {
  2329. return _globalTimeline.killTweensOf(targets, props, onlyActive);
  2330. };
  2331. return Tween2;
  2332. }(Animation);
  2333. _setDefaults(Tween.prototype, {
  2334. _targets: [],
  2335. _lazy: 0,
  2336. _startAt: 0,
  2337. _op: 0,
  2338. _onInit: 0
  2339. });
  2340. _forEachName("staggerTo,staggerFrom,staggerFromTo", function(name) {
  2341. Tween[name] = function() {
  2342. var tl = new Timeline(), params = _slice.call(arguments, 0);
  2343. params.splice(name === "staggerFromTo" ? 5 : 4, 0, 0);
  2344. return tl[name].apply(tl, params);
  2345. };
  2346. });
  2347. var _setterPlain = function _setterPlain2(target, property, value) {
  2348. return target[property] = value;
  2349. }, _setterFunc = function _setterFunc2(target, property, value) {
  2350. return target[property](value);
  2351. }, _setterFuncWithParam = function _setterFuncWithParam2(target, property, value, data) {
  2352. return target[property](data.fp, value);
  2353. }, _setterAttribute = function _setterAttribute2(target, property, value) {
  2354. return target.setAttribute(property, value);
  2355. }, _getSetter = function _getSetter2(target, property) {
  2356. return _isFunction(target[property]) ? _setterFunc : _isUndefined(target[property]) && target.setAttribute ? _setterAttribute : _setterPlain;
  2357. }, _renderPlain = function _renderPlain2(ratio, data) {
  2358. return data.set(data.t, data.p, Math.round((data.s + data.c * ratio) * 1e6) / 1e6, data);
  2359. }, _renderBoolean = function _renderBoolean2(ratio, data) {
  2360. return data.set(data.t, data.p, !!(data.s + data.c * ratio), data);
  2361. }, _renderComplexString = function _renderComplexString2(ratio, data) {
  2362. var pt = data._pt, s = "";
  2363. if (!ratio && data.b) {
  2364. s = data.b;
  2365. } else if (ratio === 1 && data.e) {
  2366. s = data.e;
  2367. } else {
  2368. while (pt) {
  2369. s = pt.p + (pt.m ? pt.m(pt.s + pt.c * ratio) : Math.round((pt.s + pt.c * ratio) * 1e4) / 1e4) + s;
  2370. pt = pt._next;
  2371. }
  2372. s += data.c;
  2373. }
  2374. data.set(data.t, data.p, s, data);
  2375. }, _renderPropTweens = function _renderPropTweens2(ratio, data) {
  2376. var pt = data._pt;
  2377. while (pt) {
  2378. pt.r(ratio, pt.d);
  2379. pt = pt._next;
  2380. }
  2381. }, _addPluginModifier = function _addPluginModifier2(modifier, tween, target, property) {
  2382. var pt = this._pt, next;
  2383. while (pt) {
  2384. next = pt._next;
  2385. pt.p === property && pt.modifier(modifier, tween, target);
  2386. pt = next;
  2387. }
  2388. }, _killPropTweensOf = function _killPropTweensOf2(property) {
  2389. var pt = this._pt, hasNonDependentRemaining, next;
  2390. while (pt) {
  2391. next = pt._next;
  2392. if (pt.p === property && !pt.op || pt.op === property) {
  2393. _removeLinkedListItem(this, pt, "_pt");
  2394. } else if (!pt.dep) {
  2395. hasNonDependentRemaining = 1;
  2396. }
  2397. pt = next;
  2398. }
  2399. return !hasNonDependentRemaining;
  2400. }, _setterWithModifier = function _setterWithModifier2(target, property, value, data) {
  2401. data.mSet(target, property, data.m.call(data.tween, value, data.mt), data);
  2402. }, _sortPropTweensByPriority = function _sortPropTweensByPriority2(parent) {
  2403. var pt = parent._pt, next, pt2, first, last;
  2404. while (pt) {
  2405. next = pt._next;
  2406. pt2 = first;
  2407. while (pt2 && pt2.pr > pt.pr) {
  2408. pt2 = pt2._next;
  2409. }
  2410. if (pt._prev = pt2 ? pt2._prev : last) {
  2411. pt._prev._next = pt;
  2412. } else {
  2413. first = pt;
  2414. }
  2415. if (pt._next = pt2) {
  2416. pt2._prev = pt;
  2417. } else {
  2418. last = pt;
  2419. }
  2420. pt = next;
  2421. }
  2422. parent._pt = first;
  2423. };
  2424. var PropTween = /* @__PURE__ */ function() {
  2425. function PropTween2(next, target, prop, start, change, renderer, data, setter, priority) {
  2426. this.t = target;
  2427. this.s = start;
  2428. this.c = change;
  2429. this.p = prop;
  2430. this.r = renderer || _renderPlain;
  2431. this.d = data || this;
  2432. this.set = setter || _setterPlain;
  2433. this.pr = priority || 0;
  2434. this._next = next;
  2435. if (next) {
  2436. next._prev = this;
  2437. }
  2438. }
  2439. var _proto4 = PropTween2.prototype;
  2440. _proto4.modifier = function modifier(func, tween, target) {
  2441. this.mSet = this.mSet || this.set;
  2442. this.set = _setterWithModifier;
  2443. this.m = func;
  2444. this.mt = target;
  2445. this.tween = tween;
  2446. };
  2447. return PropTween2;
  2448. }();
  2449. _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) {
  2450. return _reservedProps[name] = 1;
  2451. });
  2452. _globals.TweenMax = _globals.TweenLite = Tween;
  2453. _globals.TimelineLite = _globals.TimelineMax = Timeline;
  2454. _globalTimeline = new Timeline({
  2455. sortChildren: false,
  2456. defaults: _defaults,
  2457. autoRemoveChildren: true,
  2458. id: "root",
  2459. smoothChildTiming: true
  2460. });
  2461. _config.stringFilter = _colorStringFilter;
  2462. var _gsap = {
  2463. registerPlugin: function registerPlugin() {
  2464. for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  2465. args[_key2] = arguments[_key2];
  2466. }
  2467. args.forEach(function(config3) {
  2468. return _createPlugin(config3);
  2469. });
  2470. },
  2471. timeline: function timeline(vars) {
  2472. return new Timeline(vars);
  2473. },
  2474. getTweensOf: function getTweensOf(targets, onlyActive) {
  2475. return _globalTimeline.getTweensOf(targets, onlyActive);
  2476. },
  2477. getProperty: function getProperty(target, property, unit, uncache) {
  2478. _isString(target) && (target = toArray(target)[0]);
  2479. var getter = _getCache(target || {}).get, format = unit ? _passThrough : _numericIfPossible;
  2480. unit === "native" && (unit = "");
  2481. return !target ? target : !property ? function(property2, unit2, uncache2) {
  2482. return format((_plugins[property2] && _plugins[property2].get || getter)(target, property2, unit2, uncache2));
  2483. } : format((_plugins[property] && _plugins[property].get || getter)(target, property, unit, uncache));
  2484. },
  2485. quickSetter: function quickSetter(target, property, unit) {
  2486. target = toArray(target);
  2487. if (target.length > 1) {
  2488. var setters = target.map(function(t) {
  2489. return gsap.quickSetter(t, property, unit);
  2490. }), l = setters.length;
  2491. return function(value) {
  2492. var i = l;
  2493. while (i--) {
  2494. setters[i](value);
  2495. }
  2496. };
  2497. }
  2498. target = target[0] || {};
  2499. var Plugin = _plugins[property], cache = _getCache(target), p = cache.harness && (cache.harness.aliases || {})[property] || property, setter = Plugin ? function(value) {
  2500. var p2 = new Plugin();
  2501. _quickTween._pt = 0;
  2502. p2.init(target, unit ? value + unit : value, _quickTween, 0, [target]);
  2503. p2.render(1, p2);
  2504. _quickTween._pt && _renderPropTweens(1, _quickTween);
  2505. } : cache.set(target, p);
  2506. return Plugin ? setter : function(value) {
  2507. return setter(target, p, unit ? value + unit : value, cache, 1);
  2508. };
  2509. },
  2510. quickTo: function quickTo(target, property, vars) {
  2511. var _merge22;
  2512. var tween = gsap.to(target, _merge((_merge22 = {}, _merge22[property] = "+=0.1", _merge22.paused = true, _merge22), vars || {})), func = function func2(value, start, startIsRelative) {
  2513. return tween.resetTo(property, value, start, startIsRelative);
  2514. };
  2515. func.tween = tween;
  2516. return func;
  2517. },
  2518. isTweening: function isTweening(targets) {
  2519. return _globalTimeline.getTweensOf(targets, true).length > 0;
  2520. },
  2521. defaults: function defaults(value) {
  2522. value && value.ease && (value.ease = _parseEase(value.ease, _defaults.ease));
  2523. return _mergeDeep(_defaults, value || {});
  2524. },
  2525. config: function config2(value) {
  2526. return _mergeDeep(_config, value || {});
  2527. },
  2528. registerEffect: function registerEffect(_ref3) {
  2529. var name = _ref3.name, effect = _ref3.effect, plugins = _ref3.plugins, defaults2 = _ref3.defaults, extendTimeline = _ref3.extendTimeline;
  2530. (plugins || "").split(",").forEach(function(pluginName) {
  2531. return pluginName && !_plugins[pluginName] && !_globals[pluginName] && _warn(name + " effect requires " + pluginName + " plugin.");
  2532. });
  2533. _effects[name] = function(targets, vars, tl) {
  2534. return effect(toArray(targets), _setDefaults(vars || {}, defaults2), tl);
  2535. };
  2536. if (extendTimeline) {
  2537. Timeline.prototype[name] = function(targets, vars, position) {
  2538. return this.add(_effects[name](targets, _isObject(vars) ? vars : (position = vars) && {}, this), position);
  2539. };
  2540. }
  2541. },
  2542. registerEase: function registerEase(name, ease) {
  2543. _easeMap[name] = _parseEase(ease);
  2544. },
  2545. parseEase: function parseEase(ease, defaultEase) {
  2546. return arguments.length ? _parseEase(ease, defaultEase) : _easeMap;
  2547. },
  2548. getById: function getById(id) {
  2549. return _globalTimeline.getById(id);
  2550. },
  2551. exportRoot: function exportRoot(vars, includeDelayedCalls) {
  2552. if (vars === void 0) {
  2553. vars = {};
  2554. }
  2555. var tl = new Timeline(vars), child, next;
  2556. tl.smoothChildTiming = _isNotFalse(vars.smoothChildTiming);
  2557. _globalTimeline.remove(tl);
  2558. tl._dp = 0;
  2559. tl._time = tl._tTime = _globalTimeline._time;
  2560. child = _globalTimeline._first;
  2561. while (child) {
  2562. next = child._next;
  2563. if (includeDelayedCalls || !(!child._dur && child instanceof Tween && child.vars.onComplete === child._targets[0])) {
  2564. _addToTimeline(tl, child, child._start - child._delay);
  2565. }
  2566. child = next;
  2567. }
  2568. _addToTimeline(_globalTimeline, tl, 0);
  2569. return tl;
  2570. },
  2571. utils: {
  2572. wrap,
  2573. wrapYoyo,
  2574. distribute,
  2575. random,
  2576. snap,
  2577. normalize,
  2578. getUnit,
  2579. clamp,
  2580. splitColor,
  2581. toArray,
  2582. selector,
  2583. mapRange,
  2584. pipe,
  2585. unitize,
  2586. interpolate,
  2587. shuffle
  2588. },
  2589. install: _install,
  2590. effects: _effects,
  2591. ticker: _ticker,
  2592. updateRoot: Timeline.updateRoot,
  2593. plugins: _plugins,
  2594. globalTimeline: _globalTimeline,
  2595. core: {
  2596. PropTween,
  2597. globals: _addGlobal,
  2598. Tween,
  2599. Timeline,
  2600. Animation,
  2601. getCache: _getCache,
  2602. _removeLinkedListItem,
  2603. suppressOverwrites: function suppressOverwrites(value) {
  2604. return _suppressOverwrites = value;
  2605. }
  2606. }
  2607. };
  2608. _forEachName("to,from,fromTo,delayedCall,set,killTweensOf", function(name) {
  2609. return _gsap[name] = Tween[name];
  2610. });
  2611. _ticker.add(Timeline.updateRoot);
  2612. _quickTween = _gsap.to({}, {
  2613. duration: 0
  2614. });
  2615. var _getPluginPropTween = function _getPluginPropTween2(plugin, prop) {
  2616. var pt = plugin._pt;
  2617. while (pt && pt.p !== prop && pt.op !== prop && pt.fp !== prop) {
  2618. pt = pt._next;
  2619. }
  2620. return pt;
  2621. }, _addModifiers = function _addModifiers2(tween, modifiers) {
  2622. var targets = tween._targets, p, i, pt;
  2623. for (p in modifiers) {
  2624. i = targets.length;
  2625. while (i--) {
  2626. pt = tween._ptLookup[i][p];
  2627. if (pt && (pt = pt.d)) {
  2628. if (pt._pt) {
  2629. pt = _getPluginPropTween(pt, p);
  2630. }
  2631. pt && pt.modifier && pt.modifier(modifiers[p], tween, targets[i], p);
  2632. }
  2633. }
  2634. }
  2635. }, _buildModifierPlugin = function _buildModifierPlugin2(name, modifier) {
  2636. return {
  2637. name,
  2638. rawVars: 1,
  2639. init: function init4(target, vars, tween) {
  2640. tween._onInit = function(tween2) {
  2641. var temp, p;
  2642. if (_isString(vars)) {
  2643. temp = {};
  2644. _forEachName(vars, function(name2) {
  2645. return temp[name2] = 1;
  2646. });
  2647. vars = temp;
  2648. }
  2649. if (modifier) {
  2650. temp = {};
  2651. for (p in vars) {
  2652. temp[p] = modifier(vars[p]);
  2653. }
  2654. vars = temp;
  2655. }
  2656. _addModifiers(tween2, vars);
  2657. };
  2658. }
  2659. };
  2660. };
  2661. var gsap = _gsap.registerPlugin({
  2662. name: "attr",
  2663. init: function init(target, vars, tween, index, targets) {
  2664. var p, pt;
  2665. for (p in vars) {
  2666. pt = this.add(target, "setAttribute", (target.getAttribute(p) || 0) + "", vars[p], index, targets, 0, 0, p);
  2667. pt && (pt.op = p);
  2668. this._props.push(p);
  2669. }
  2670. }
  2671. }, {
  2672. name: "endArray",
  2673. init: function init2(target, value) {
  2674. var i = value.length;
  2675. while (i--) {
  2676. this.add(target, i, target[i] || 0, value[i]);
  2677. }
  2678. }
  2679. }, _buildModifierPlugin("roundProps", _roundModifier), _buildModifierPlugin("modifiers"), _buildModifierPlugin("snap", snap)) || _gsap;
  2680. Tween.version = Timeline.version = gsap.version = "3.10.4";
  2681. _coreReady = 1;
  2682. _windowExists() && _wake();
  2683. 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;
  2684. /*!
  2685. * CSSPlugin 3.10.4
  2686. * https://greensock.com
  2687. *
  2688. * Copyright 2008-2022, GreenSock. All rights reserved.
  2689. * Subject to the terms at https://greensock.com/standard-license or for
  2690. * Club GreenSock members, the agreement issued with that membership.
  2691. * @author: Jack Doyle, jack@greensock.com
  2692. */
  2693. var _win$1, _doc$1, _docElement, _pluginInitted, _tempDiv, _recentSetterPlugin, _windowExists$1 = function _windowExists3() {
  2694. return typeof window !== "undefined";
  2695. }, _transformProps = {}, _RAD2DEG = 180 / Math.PI, _DEG2RAD = Math.PI / 180, _atan2 = Math.atan2, _bigNum$1 = 1e8, _capsExp = /([A-Z])/g, _horizontalExp = /(left|right|width|margin|padding|x)/i, _complexExp = /[\s,\(]\S/, _propertyAliases = {
  2696. autoAlpha: "opacity,visibility",
  2697. scale: "scaleX,scaleY",
  2698. alpha: "opacity"
  2699. }, _renderCSSProp = function _renderCSSProp2(ratio, data) {
  2700. return data.set(data.t, data.p, Math.round((data.s + data.c * ratio) * 1e4) / 1e4 + data.u, data);
  2701. }, _renderPropWithEnd = function _renderPropWithEnd2(ratio, data) {
  2702. return data.set(data.t, data.p, ratio === 1 ? data.e : Math.round((data.s + data.c * ratio) * 1e4) / 1e4 + data.u, data);
  2703. }, _renderCSSPropWithBeginning = function _renderCSSPropWithBeginning2(ratio, data) {
  2704. return data.set(data.t, data.p, ratio ? Math.round((data.s + data.c * ratio) * 1e4) / 1e4 + data.u : data.b, data);
  2705. }, _renderRoundedCSSProp = function _renderRoundedCSSProp2(ratio, data) {
  2706. var value = data.s + data.c * ratio;
  2707. data.set(data.t, data.p, ~~(value + (value < 0 ? -0.5 : 0.5)) + data.u, data);
  2708. }, _renderNonTweeningValue = function _renderNonTweeningValue2(ratio, data) {
  2709. return data.set(data.t, data.p, ratio ? data.e : data.b, data);
  2710. }, _renderNonTweeningValueOnlyAtEnd = function _renderNonTweeningValueOnlyAtEnd2(ratio, data) {
  2711. return data.set(data.t, data.p, ratio !== 1 ? data.b : data.e, data);
  2712. }, _setterCSSStyle = function _setterCSSStyle2(target, property, value) {
  2713. return target.style[property] = value;
  2714. }, _setterCSSProp = function _setterCSSProp2(target, property, value) {
  2715. return target.style.setProperty(property, value);
  2716. }, _setterTransform = function _setterTransform2(target, property, value) {
  2717. return target._gsap[property] = value;
  2718. }, _setterScale = function _setterScale2(target, property, value) {
  2719. return target._gsap.scaleX = target._gsap.scaleY = value;
  2720. }, _setterScaleWithRender = function _setterScaleWithRender2(target, property, value, data, ratio) {
  2721. var cache = target._gsap;
  2722. cache.scaleX = cache.scaleY = value;
  2723. cache.renderTransform(ratio, cache);
  2724. }, _setterTransformWithRender = function _setterTransformWithRender2(target, property, value, data, ratio) {
  2725. var cache = target._gsap;
  2726. cache[property] = value;
  2727. cache.renderTransform(ratio, cache);
  2728. }, _transformProp = "transform", _transformOriginProp = _transformProp + "Origin", _supports3D, _createElement = function _createElement2(type, ns) {
  2729. var e = _doc$1.createElementNS ? _doc$1.createElementNS((ns || "http://www.w3.org/1999/xhtml").replace(/^https/, "http"), type) : _doc$1.createElement(type);
  2730. return e.style ? e : _doc$1.createElement(type);
  2731. }, _getComputedProperty = function _getComputedProperty2(target, property, skipPrefixFallback) {
  2732. var cs = getComputedStyle(target);
  2733. return cs[property] || cs.getPropertyValue(property.replace(_capsExp, "-$1").toLowerCase()) || cs.getPropertyValue(property) || !skipPrefixFallback && _getComputedProperty2(target, _checkPropPrefix(property) || property, 1) || "";
  2734. }, _prefixes = "O,Moz,ms,Ms,Webkit".split(","), _checkPropPrefix = function _checkPropPrefix2(property, element, preferPrefix) {
  2735. var e = element || _tempDiv, s = e.style, i = 5;
  2736. if (property in s && !preferPrefix) {
  2737. return property;
  2738. }
  2739. property = property.charAt(0).toUpperCase() + property.substr(1);
  2740. while (i-- && !(_prefixes[i] + property in s)) {
  2741. }
  2742. return i < 0 ? null : (i === 3 ? "ms" : i >= 0 ? _prefixes[i] : "") + property;
  2743. }, _initCore = function _initCore2() {
  2744. if (_windowExists$1() && window.document) {
  2745. _win$1 = window;
  2746. _doc$1 = _win$1.document;
  2747. _docElement = _doc$1.documentElement;
  2748. _tempDiv = _createElement("div") || {
  2749. style: {}
  2750. };
  2751. _createElement("div");
  2752. _transformProp = _checkPropPrefix(_transformProp);
  2753. _transformOriginProp = _transformProp + "Origin";
  2754. _tempDiv.style.cssText = "border-width:0;line-height:0;position:absolute;padding:0";
  2755. _supports3D = !!_checkPropPrefix("perspective");
  2756. _pluginInitted = 1;
  2757. }
  2758. }, _getBBoxHack = function _getBBoxHack2(swapIfPossible) {
  2759. var svg = _createElement("svg", this.ownerSVGElement && this.ownerSVGElement.getAttribute("xmlns") || "http://www.w3.org/2000/svg"), oldParent = this.parentNode, oldSibling = this.nextSibling, oldCSS = this.style.cssText, bbox;
  2760. _docElement.appendChild(svg);
  2761. svg.appendChild(this);
  2762. this.style.display = "block";
  2763. if (swapIfPossible) {
  2764. try {
  2765. bbox = this.getBBox();
  2766. this._gsapBBox = this.getBBox;
  2767. this.getBBox = _getBBoxHack2;
  2768. } catch (e) {
  2769. }
  2770. } else if (this._gsapBBox) {
  2771. bbox = this._gsapBBox();
  2772. }
  2773. if (oldParent) {
  2774. if (oldSibling) {
  2775. oldParent.insertBefore(this, oldSibling);
  2776. } else {
  2777. oldParent.appendChild(this);
  2778. }
  2779. }
  2780. _docElement.removeChild(svg);
  2781. this.style.cssText = oldCSS;
  2782. return bbox;
  2783. }, _getAttributeFallbacks = function _getAttributeFallbacks2(target, attributesArray) {
  2784. var i = attributesArray.length;
  2785. while (i--) {
  2786. if (target.hasAttribute(attributesArray[i])) {
  2787. return target.getAttribute(attributesArray[i]);
  2788. }
  2789. }
  2790. }, _getBBox = function _getBBox2(target) {
  2791. var bounds;
  2792. try {
  2793. bounds = target.getBBox();
  2794. } catch (error) {
  2795. bounds = _getBBoxHack.call(target, true);
  2796. }
  2797. bounds && (bounds.width || bounds.height) || target.getBBox === _getBBoxHack || (bounds = _getBBoxHack.call(target, true));
  2798. return bounds && !bounds.width && !bounds.x && !bounds.y ? {
  2799. x: +_getAttributeFallbacks(target, ["x", "cx", "x1"]) || 0,
  2800. y: +_getAttributeFallbacks(target, ["y", "cy", "y1"]) || 0,
  2801. width: 0,
  2802. height: 0
  2803. } : bounds;
  2804. }, _isSVG = function _isSVG2(e) {
  2805. return !!(e.getCTM && (!e.parentNode || e.ownerSVGElement) && _getBBox(e));
  2806. }, _removeProperty = function _removeProperty2(target, property) {
  2807. if (property) {
  2808. var style = target.style;
  2809. if (property in _transformProps && property !== _transformOriginProp) {
  2810. property = _transformProp;
  2811. }
  2812. if (style.removeProperty) {
  2813. if (property.substr(0, 2) === "ms" || property.substr(0, 6) === "webkit") {
  2814. property = "-" + property;
  2815. }
  2816. style.removeProperty(property.replace(_capsExp, "-$1").toLowerCase());
  2817. } else {
  2818. style.removeAttribute(property);
  2819. }
  2820. }
  2821. }, _addNonTweeningPT = function _addNonTweeningPT2(plugin, target, property, beginning, end, onlySetAtEnd) {
  2822. var pt = new PropTween(plugin._pt, target, property, 0, 1, onlySetAtEnd ? _renderNonTweeningValueOnlyAtEnd : _renderNonTweeningValue);
  2823. plugin._pt = pt;
  2824. pt.b = beginning;
  2825. pt.e = end;
  2826. plugin._props.push(property);
  2827. return pt;
  2828. }, _nonConvertibleUnits = {
  2829. deg: 1,
  2830. rad: 1,
  2831. turn: 1
  2832. }, _convertToUnit = function _convertToUnit2(target, property, value, unit) {
  2833. var curValue = parseFloat(value) || 0, curUnit = (value + "").trim().substr((curValue + "").length) || "px", style = _tempDiv.style, horizontal = _horizontalExp.test(property), isRootSVG = target.tagName.toLowerCase() === "svg", measureProperty = (isRootSVG ? "client" : "offset") + (horizontal ? "Width" : "Height"), amount = 100, toPixels = unit === "px", toPercent = unit === "%", px, parent, cache, isSVG;
  2834. if (unit === curUnit || !curValue || _nonConvertibleUnits[unit] || _nonConvertibleUnits[curUnit]) {
  2835. return curValue;
  2836. }
  2837. curUnit !== "px" && !toPixels && (curValue = _convertToUnit2(target, property, value, "px"));
  2838. isSVG = target.getCTM && _isSVG(target);
  2839. if ((toPercent || curUnit === "%") && (_transformProps[property] || ~property.indexOf("adius"))) {
  2840. px = isSVG ? target.getBBox()[horizontal ? "width" : "height"] : target[measureProperty];
  2841. return _round(toPercent ? curValue / px * amount : curValue / 100 * px);
  2842. }
  2843. style[horizontal ? "width" : "height"] = amount + (toPixels ? curUnit : unit);
  2844. parent = ~property.indexOf("adius") || unit === "em" && target.appendChild && !isRootSVG ? target : target.parentNode;
  2845. if (isSVG) {
  2846. parent = (target.ownerSVGElement || {}).parentNode;
  2847. }
  2848. if (!parent || parent === _doc$1 || !parent.appendChild) {
  2849. parent = _doc$1.body;
  2850. }
  2851. cache = parent._gsap;
  2852. if (cache && toPercent && cache.width && horizontal && cache.time === _ticker.time) {
  2853. return _round(curValue / cache.width * amount);
  2854. } else {
  2855. (toPercent || curUnit === "%") && (style.position = _getComputedProperty(target, "position"));
  2856. parent === target && (style.position = "static");
  2857. parent.appendChild(_tempDiv);
  2858. px = _tempDiv[measureProperty];
  2859. parent.removeChild(_tempDiv);
  2860. style.position = "absolute";
  2861. if (horizontal && toPercent) {
  2862. cache = _getCache(parent);
  2863. cache.time = _ticker.time;
  2864. cache.width = parent[measureProperty];
  2865. }
  2866. }
  2867. return _round(toPixels ? px * curValue / amount : px && curValue ? amount / px * curValue : 0);
  2868. }, _get = function _get2(target, property, unit, uncache) {
  2869. var value;
  2870. _pluginInitted || _initCore();
  2871. if (property in _propertyAliases && property !== "transform") {
  2872. property = _propertyAliases[property];
  2873. if (~property.indexOf(",")) {
  2874. property = property.split(",")[0];
  2875. }
  2876. }
  2877. if (_transformProps[property] && property !== "transform") {
  2878. value = _parseTransform(target, uncache);
  2879. value = property !== "transformOrigin" ? value[property] : value.svg ? value.origin : _firstTwoOnly(_getComputedProperty(target, _transformOriginProp)) + " " + value.zOrigin + "px";
  2880. } else {
  2881. value = target.style[property];
  2882. if (!value || value === "auto" || uncache || ~(value + "").indexOf("calc(")) {
  2883. value = _specialProps[property] && _specialProps[property](target, property, unit) || _getComputedProperty(target, property) || _getProperty(target, property) || (property === "opacity" ? 1 : 0);
  2884. }
  2885. }
  2886. return unit && !~(value + "").trim().indexOf(" ") ? _convertToUnit(target, property, value, unit) + unit : value;
  2887. }, _tweenComplexCSSString = function _tweenComplexCSSString2(target, prop, start, end) {
  2888. if (!start || start === "none") {
  2889. var p = _checkPropPrefix(prop, target, 1), s = p && _getComputedProperty(target, p, 1);
  2890. if (s && s !== start) {
  2891. prop = p;
  2892. start = s;
  2893. } else if (prop === "borderColor") {
  2894. start = _getComputedProperty(target, "borderTopColor");
  2895. }
  2896. }
  2897. var pt = new PropTween(this._pt, target.style, prop, 0, 1, _renderComplexString), index = 0, matchIndex = 0, a, result, startValues, startNum, color, startValue, endValue, endNum, chunk, endUnit, startUnit, endValues;
  2898. pt.b = start;
  2899. pt.e = end;
  2900. start += "";
  2901. end += "";
  2902. if (end === "auto") {
  2903. target.style[prop] = end;
  2904. end = _getComputedProperty(target, prop) || end;
  2905. target.style[prop] = start;
  2906. }
  2907. a = [start, end];
  2908. _colorStringFilter(a);
  2909. start = a[0];
  2910. end = a[1];
  2911. startValues = start.match(_numWithUnitExp) || [];
  2912. endValues = end.match(_numWithUnitExp) || [];
  2913. if (endValues.length) {
  2914. while (result = _numWithUnitExp.exec(end)) {
  2915. endValue = result[0];
  2916. chunk = end.substring(index, result.index);
  2917. if (color) {
  2918. color = (color + 1) % 5;
  2919. } else if (chunk.substr(-5) === "rgba(" || chunk.substr(-5) === "hsla(") {
  2920. color = 1;
  2921. }
  2922. if (endValue !== (startValue = startValues[matchIndex++] || "")) {
  2923. startNum = parseFloat(startValue) || 0;
  2924. startUnit = startValue.substr((startNum + "").length);
  2925. endValue.charAt(1) === "=" && (endValue = _parseRelative(startNum, endValue) + startUnit);
  2926. endNum = parseFloat(endValue);
  2927. endUnit = endValue.substr((endNum + "").length);
  2928. index = _numWithUnitExp.lastIndex - endUnit.length;
  2929. if (!endUnit) {
  2930. endUnit = endUnit || _config.units[prop] || startUnit;
  2931. if (index === end.length) {
  2932. end += endUnit;
  2933. pt.e += endUnit;
  2934. }
  2935. }
  2936. if (startUnit !== endUnit) {
  2937. startNum = _convertToUnit(target, prop, startValue, endUnit) || 0;
  2938. }
  2939. pt._pt = {
  2940. _next: pt._pt,
  2941. p: chunk || matchIndex === 1 ? chunk : ",",
  2942. s: startNum,
  2943. c: endNum - startNum,
  2944. m: color && color < 4 || prop === "zIndex" ? Math.round : 0
  2945. };
  2946. }
  2947. }
  2948. pt.c = index < end.length ? end.substring(index, end.length) : "";
  2949. } else {
  2950. pt.r = prop === "display" && end === "none" ? _renderNonTweeningValueOnlyAtEnd : _renderNonTweeningValue;
  2951. }
  2952. _relExp.test(end) && (pt.e = 0);
  2953. this._pt = pt;
  2954. return pt;
  2955. }, _keywordToPercent = {
  2956. top: "0%",
  2957. bottom: "100%",
  2958. left: "0%",
  2959. right: "100%",
  2960. center: "50%"
  2961. }, _convertKeywordsToPercentages = function _convertKeywordsToPercentages2(value) {
  2962. var split = value.split(" "), x = split[0], y = split[1] || "50%";
  2963. if (x === "top" || x === "bottom" || y === "left" || y === "right") {
  2964. value = x;
  2965. x = y;
  2966. y = value;
  2967. }
  2968. split[0] = _keywordToPercent[x] || x;
  2969. split[1] = _keywordToPercent[y] || y;
  2970. return split.join(" ");
  2971. }, _renderClearProps = function _renderClearProps2(ratio, data) {
  2972. if (data.tween && data.tween._time === data.tween._dur) {
  2973. var target = data.t, style = target.style, props = data.u, cache = target._gsap, prop, clearTransforms, i;
  2974. if (props === "all" || props === true) {
  2975. style.cssText = "";
  2976. clearTransforms = 1;
  2977. } else {
  2978. props = props.split(",");
  2979. i = props.length;
  2980. while (--i > -1) {
  2981. prop = props[i];
  2982. if (_transformProps[prop]) {
  2983. clearTransforms = 1;
  2984. prop = prop === "transformOrigin" ? _transformOriginProp : _transformProp;
  2985. }
  2986. _removeProperty(target, prop);
  2987. }
  2988. }
  2989. if (clearTransforms) {
  2990. _removeProperty(target, _transformProp);
  2991. if (cache) {
  2992. cache.svg && target.removeAttribute("transform");
  2993. _parseTransform(target, 1);
  2994. cache.uncache = 1;
  2995. }
  2996. }
  2997. }
  2998. }, _specialProps = {
  2999. clearProps: function clearProps(plugin, target, property, endValue, tween) {
  3000. if (tween.data !== "isFromStart") {
  3001. var pt = plugin._pt = new PropTween(plugin._pt, target, property, 0, 0, _renderClearProps);
  3002. pt.u = endValue;
  3003. pt.pr = -10;
  3004. pt.tween = tween;
  3005. plugin._props.push(property);
  3006. return 1;
  3007. }
  3008. }
  3009. }, _identity2DMatrix = [1, 0, 0, 1, 0, 0], _rotationalProperties = {}, _isNullTransform = function _isNullTransform2(value) {
  3010. return value === "matrix(1, 0, 0, 1, 0, 0)" || value === "none" || !value;
  3011. }, _getComputedTransformMatrixAsArray = function _getComputedTransformMatrixAsArray2(target) {
  3012. var matrixString = _getComputedProperty(target, _transformProp);
  3013. return _isNullTransform(matrixString) ? _identity2DMatrix : matrixString.substr(7).match(_numExp).map(_round);
  3014. }, _getMatrix = function _getMatrix2(target, force2D) {
  3015. var cache = target._gsap || _getCache(target), style = target.style, matrix = _getComputedTransformMatrixAsArray(target), parent, nextSibling, temp, addedToDOM;
  3016. if (cache.svg && target.getAttribute("transform")) {
  3017. temp = target.transform.baseVal.consolidate().matrix;
  3018. matrix = [temp.a, temp.b, temp.c, temp.d, temp.e, temp.f];
  3019. return matrix.join(",") === "1,0,0,1,0,0" ? _identity2DMatrix : matrix;
  3020. } else if (matrix === _identity2DMatrix && !target.offsetParent && target !== _docElement && !cache.svg) {
  3021. temp = style.display;
  3022. style.display = "block";
  3023. parent = target.parentNode;
  3024. if (!parent || !target.offsetParent) {
  3025. addedToDOM = 1;
  3026. nextSibling = target.nextSibling;
  3027. _docElement.appendChild(target);
  3028. }
  3029. matrix = _getComputedTransformMatrixAsArray(target);
  3030. temp ? style.display = temp : _removeProperty(target, "display");
  3031. if (addedToDOM) {
  3032. nextSibling ? parent.insertBefore(target, nextSibling) : parent ? parent.appendChild(target) : _docElement.removeChild(target);
  3033. }
  3034. }
  3035. return force2D && matrix.length > 6 ? [matrix[0], matrix[1], matrix[4], matrix[5], matrix[12], matrix[13]] : matrix;
  3036. }, _applySVGOrigin = function _applySVGOrigin2(target, origin, originIsAbsolute, smooth, matrixArray, pluginToAddPropTweensTo) {
  3037. var cache = target._gsap, matrix = matrixArray || _getMatrix(target, true), xOriginOld = cache.xOrigin || 0, yOriginOld = cache.yOrigin || 0, xOffsetOld = cache.xOffset || 0, yOffsetOld = cache.yOffset || 0, a = matrix[0], b = matrix[1], c = matrix[2], d = matrix[3], tx = matrix[4], ty = matrix[5], originSplit = origin.split(" "), xOrigin = parseFloat(originSplit[0]) || 0, yOrigin = parseFloat(originSplit[1]) || 0, bounds, determinant, x, y;
  3038. if (!originIsAbsolute) {
  3039. bounds = _getBBox(target);
  3040. xOrigin = bounds.x + (~originSplit[0].indexOf("%") ? xOrigin / 100 * bounds.width : xOrigin);
  3041. yOrigin = bounds.y + (~(originSplit[1] || originSplit[0]).indexOf("%") ? yOrigin / 100 * bounds.height : yOrigin);
  3042. } else if (matrix !== _identity2DMatrix && (determinant = a * d - b * c)) {
  3043. x = xOrigin * (d / determinant) + yOrigin * (-c / determinant) + (c * ty - d * tx) / determinant;
  3044. y = xOrigin * (-b / determinant) + yOrigin * (a / determinant) - (a * ty - b * tx) / determinant;
  3045. xOrigin = x;
  3046. yOrigin = y;
  3047. }
  3048. if (smooth || smooth !== false && cache.smooth) {
  3049. tx = xOrigin - xOriginOld;
  3050. ty = yOrigin - yOriginOld;
  3051. cache.xOffset = xOffsetOld + (tx * a + ty * c) - tx;
  3052. cache.yOffset = yOffsetOld + (tx * b + ty * d) - ty;
  3053. } else {
  3054. cache.xOffset = cache.yOffset = 0;
  3055. }
  3056. cache.xOrigin = xOrigin;
  3057. cache.yOrigin = yOrigin;
  3058. cache.smooth = !!smooth;
  3059. cache.origin = origin;
  3060. cache.originIsAbsolute = !!originIsAbsolute;
  3061. target.style[_transformOriginProp] = "0px 0px";
  3062. if (pluginToAddPropTweensTo) {
  3063. _addNonTweeningPT(pluginToAddPropTweensTo, cache, "xOrigin", xOriginOld, xOrigin);
  3064. _addNonTweeningPT(pluginToAddPropTweensTo, cache, "yOrigin", yOriginOld, yOrigin);
  3065. _addNonTweeningPT(pluginToAddPropTweensTo, cache, "xOffset", xOffsetOld, cache.xOffset);
  3066. _addNonTweeningPT(pluginToAddPropTweensTo, cache, "yOffset", yOffsetOld, cache.yOffset);
  3067. }
  3068. target.setAttribute("data-svg-origin", xOrigin + " " + yOrigin);
  3069. }, _parseTransform = function _parseTransform2(target, uncache) {
  3070. var cache = target._gsap || new GSCache(target);
  3071. if ("x" in cache && !uncache && !cache.uncache) {
  3072. return cache;
  3073. }
  3074. var style = target.style, invertedScaleX = cache.scaleX < 0, px = "px", deg = "deg", origin = _getComputedProperty(target, _transformOriginProp) || "0", x, y, z, scaleX, scaleY, rotation, rotationX, rotationY, skewX, skewY, perspective, xOrigin, yOrigin, matrix, angle, cos, sin, a, b, c, d, a12, a22, t1, t2, t3, a13, a23, a33, a42, a43, a32;
  3075. x = y = z = rotation = rotationX = rotationY = skewX = skewY = perspective = 0;
  3076. scaleX = scaleY = 1;
  3077. cache.svg = !!(target.getCTM && _isSVG(target));
  3078. matrix = _getMatrix(target, cache.svg);
  3079. if (cache.svg) {
  3080. t1 = (!cache.uncache || origin === "0px 0px") && !uncache && target.getAttribute("data-svg-origin");
  3081. _applySVGOrigin(target, t1 || origin, !!t1 || cache.originIsAbsolute, cache.smooth !== false, matrix);
  3082. }
  3083. xOrigin = cache.xOrigin || 0;
  3084. yOrigin = cache.yOrigin || 0;
  3085. if (matrix !== _identity2DMatrix) {
  3086. a = matrix[0];
  3087. b = matrix[1];
  3088. c = matrix[2];
  3089. d = matrix[3];
  3090. x = a12 = matrix[4];
  3091. y = a22 = matrix[5];
  3092. if (matrix.length === 6) {
  3093. scaleX = Math.sqrt(a * a + b * b);
  3094. scaleY = Math.sqrt(d * d + c * c);
  3095. rotation = a || b ? _atan2(b, a) * _RAD2DEG : 0;
  3096. skewX = c || d ? _atan2(c, d) * _RAD2DEG + rotation : 0;
  3097. skewX && (scaleY *= Math.abs(Math.cos(skewX * _DEG2RAD)));
  3098. if (cache.svg) {
  3099. x -= xOrigin - (xOrigin * a + yOrigin * c);
  3100. y -= yOrigin - (xOrigin * b + yOrigin * d);
  3101. }
  3102. } else {
  3103. a32 = matrix[6];
  3104. a42 = matrix[7];
  3105. a13 = matrix[8];
  3106. a23 = matrix[9];
  3107. a33 = matrix[10];
  3108. a43 = matrix[11];
  3109. x = matrix[12];
  3110. y = matrix[13];
  3111. z = matrix[14];
  3112. angle = _atan2(a32, a33);
  3113. rotationX = angle * _RAD2DEG;
  3114. if (angle) {
  3115. cos = Math.cos(-angle);
  3116. sin = Math.sin(-angle);
  3117. t1 = a12 * cos + a13 * sin;
  3118. t2 = a22 * cos + a23 * sin;
  3119. t3 = a32 * cos + a33 * sin;
  3120. a13 = a12 * -sin + a13 * cos;
  3121. a23 = a22 * -sin + a23 * cos;
  3122. a33 = a32 * -sin + a33 * cos;
  3123. a43 = a42 * -sin + a43 * cos;
  3124. a12 = t1;
  3125. a22 = t2;
  3126. a32 = t3;
  3127. }
  3128. angle = _atan2(-c, a33);
  3129. rotationY = angle * _RAD2DEG;
  3130. if (angle) {
  3131. cos = Math.cos(-angle);
  3132. sin = Math.sin(-angle);
  3133. t1 = a * cos - a13 * sin;
  3134. t2 = b * cos - a23 * sin;
  3135. t3 = c * cos - a33 * sin;
  3136. a43 = d * sin + a43 * cos;
  3137. a = t1;
  3138. b = t2;
  3139. c = t3;
  3140. }
  3141. angle = _atan2(b, a);
  3142. rotation = angle * _RAD2DEG;
  3143. if (angle) {
  3144. cos = Math.cos(angle);
  3145. sin = Math.sin(angle);
  3146. t1 = a * cos + b * sin;
  3147. t2 = a12 * cos + a22 * sin;
  3148. b = b * cos - a * sin;
  3149. a22 = a22 * cos - a12 * sin;
  3150. a = t1;
  3151. a12 = t2;
  3152. }
  3153. if (rotationX && Math.abs(rotationX) + Math.abs(rotation) > 359.9) {
  3154. rotationX = rotation = 0;
  3155. rotationY = 180 - rotationY;
  3156. }
  3157. scaleX = _round(Math.sqrt(a * a + b * b + c * c));
  3158. scaleY = _round(Math.sqrt(a22 * a22 + a32 * a32));
  3159. angle = _atan2(a12, a22);
  3160. skewX = Math.abs(angle) > 2e-4 ? angle * _RAD2DEG : 0;
  3161. perspective = a43 ? 1 / (a43 < 0 ? -a43 : a43) : 0;
  3162. }
  3163. if (cache.svg) {
  3164. t1 = target.getAttribute("transform");
  3165. cache.forceCSS = target.setAttribute("transform", "") || !_isNullTransform(_getComputedProperty(target, _transformProp));
  3166. t1 && target.setAttribute("transform", t1);
  3167. }
  3168. }
  3169. if (Math.abs(skewX) > 90 && Math.abs(skewX) < 270) {
  3170. if (invertedScaleX) {
  3171. scaleX *= -1;
  3172. skewX += rotation <= 0 ? 180 : -180;
  3173. rotation += rotation <= 0 ? 180 : -180;
  3174. } else {
  3175. scaleY *= -1;
  3176. skewX += skewX <= 0 ? 180 : -180;
  3177. }
  3178. }
  3179. uncache = uncache || cache.uncache;
  3180. cache.x = x - ((cache.xPercent = x && (!uncache && cache.xPercent || (Math.round(target.offsetWidth / 2) === Math.round(-x) ? -50 : 0))) ? target.offsetWidth * cache.xPercent / 100 : 0) + px;
  3181. cache.y = y - ((cache.yPercent = y && (!uncache && cache.yPercent || (Math.round(target.offsetHeight / 2) === Math.round(-y) ? -50 : 0))) ? target.offsetHeight * cache.yPercent / 100 : 0) + px;
  3182. cache.z = z + px;
  3183. cache.scaleX = _round(scaleX);
  3184. cache.scaleY = _round(scaleY);
  3185. cache.rotation = _round(rotation) + deg;
  3186. cache.rotationX = _round(rotationX) + deg;
  3187. cache.rotationY = _round(rotationY) + deg;
  3188. cache.skewX = skewX + deg;
  3189. cache.skewY = skewY + deg;
  3190. cache.transformPerspective = perspective + px;
  3191. if (cache.zOrigin = parseFloat(origin.split(" ")[2]) || 0) {
  3192. style[_transformOriginProp] = _firstTwoOnly(origin);
  3193. }
  3194. cache.xOffset = cache.yOffset = 0;
  3195. cache.force3D = _config.force3D;
  3196. cache.renderTransform = cache.svg ? _renderSVGTransforms : _supports3D ? _renderCSSTransforms : _renderNon3DTransforms;
  3197. cache.uncache = 0;
  3198. return cache;
  3199. }, _firstTwoOnly = function _firstTwoOnly2(value) {
  3200. return (value = value.split(" "))[0] + " " + value[1];
  3201. }, _addPxTranslate = function _addPxTranslate2(target, start, value) {
  3202. var unit = getUnit(start);
  3203. return _round(parseFloat(start) + parseFloat(_convertToUnit(target, "x", value + "px", unit))) + unit;
  3204. }, _renderNon3DTransforms = function _renderNon3DTransforms2(ratio, cache) {
  3205. cache.z = "0px";
  3206. cache.rotationY = cache.rotationX = "0deg";
  3207. cache.force3D = 0;
  3208. _renderCSSTransforms(ratio, cache);
  3209. }, _zeroDeg = "0deg", _zeroPx = "0px", _endParenthesis = ") ", _renderCSSTransforms = function _renderCSSTransforms2(ratio, cache) {
  3210. var _ref = cache || this, xPercent = _ref.xPercent, yPercent = _ref.yPercent, x = _ref.x, y = _ref.y, z = _ref.z, rotation = _ref.rotation, rotationY = _ref.rotationY, rotationX = _ref.rotationX, skewX = _ref.skewX, skewY = _ref.skewY, scaleX = _ref.scaleX, scaleY = _ref.scaleY, transformPerspective = _ref.transformPerspective, force3D = _ref.force3D, target = _ref.target, zOrigin = _ref.zOrigin, transforms = "", use3D = force3D === "auto" && ratio && ratio !== 1 || force3D === true;
  3211. if (zOrigin && (rotationX !== _zeroDeg || rotationY !== _zeroDeg)) {
  3212. var angle = parseFloat(rotationY) * _DEG2RAD, a13 = Math.sin(angle), a33 = Math.cos(angle), cos;
  3213. angle = parseFloat(rotationX) * _DEG2RAD;
  3214. cos = Math.cos(angle);
  3215. x = _addPxTranslate(target, x, a13 * cos * -zOrigin);
  3216. y = _addPxTranslate(target, y, -Math.sin(angle) * -zOrigin);
  3217. z = _addPxTranslate(target, z, a33 * cos * -zOrigin + zOrigin);
  3218. }
  3219. if (transformPerspective !== _zeroPx) {
  3220. transforms += "perspective(" + transformPerspective + _endParenthesis;
  3221. }
  3222. if (xPercent || yPercent) {
  3223. transforms += "translate(" + xPercent + "%, " + yPercent + "%) ";
  3224. }
  3225. if (use3D || x !== _zeroPx || y !== _zeroPx || z !== _zeroPx) {
  3226. transforms += z !== _zeroPx || use3D ? "translate3d(" + x + ", " + y + ", " + z + ") " : "translate(" + x + ", " + y + _endParenthesis;
  3227. }
  3228. if (rotation !== _zeroDeg) {
  3229. transforms += "rotate(" + rotation + _endParenthesis;
  3230. }
  3231. if (rotationY !== _zeroDeg) {
  3232. transforms += "rotateY(" + rotationY + _endParenthesis;
  3233. }
  3234. if (rotationX !== _zeroDeg) {
  3235. transforms += "rotateX(" + rotationX + _endParenthesis;
  3236. }
  3237. if (skewX !== _zeroDeg || skewY !== _zeroDeg) {
  3238. transforms += "skew(" + skewX + ", " + skewY + _endParenthesis;
  3239. }
  3240. if (scaleX !== 1 || scaleY !== 1) {
  3241. transforms += "scale(" + scaleX + ", " + scaleY + _endParenthesis;
  3242. }
  3243. target.style[_transformProp] = transforms || "translate(0, 0)";
  3244. }, _renderSVGTransforms = function _renderSVGTransforms2(ratio, cache) {
  3245. var _ref2 = cache || this, xPercent = _ref2.xPercent, yPercent = _ref2.yPercent, x = _ref2.x, y = _ref2.y, rotation = _ref2.rotation, skewX = _ref2.skewX, skewY = _ref2.skewY, scaleX = _ref2.scaleX, scaleY = _ref2.scaleY, target = _ref2.target, xOrigin = _ref2.xOrigin, yOrigin = _ref2.yOrigin, xOffset = _ref2.xOffset, yOffset = _ref2.yOffset, forceCSS = _ref2.forceCSS, tx = parseFloat(x), ty = parseFloat(y), a11, a21, a12, a22, temp;
  3246. rotation = parseFloat(rotation);
  3247. skewX = parseFloat(skewX);
  3248. skewY = parseFloat(skewY);
  3249. if (skewY) {
  3250. skewY = parseFloat(skewY);
  3251. skewX += skewY;
  3252. rotation += skewY;
  3253. }
  3254. if (rotation || skewX) {
  3255. rotation *= _DEG2RAD;
  3256. skewX *= _DEG2RAD;
  3257. a11 = Math.cos(rotation) * scaleX;
  3258. a21 = Math.sin(rotation) * scaleX;
  3259. a12 = Math.sin(rotation - skewX) * -scaleY;
  3260. a22 = Math.cos(rotation - skewX) * scaleY;
  3261. if (skewX) {
  3262. skewY *= _DEG2RAD;
  3263. temp = Math.tan(skewX - skewY);
  3264. temp = Math.sqrt(1 + temp * temp);
  3265. a12 *= temp;
  3266. a22 *= temp;
  3267. if (skewY) {
  3268. temp = Math.tan(skewY);
  3269. temp = Math.sqrt(1 + temp * temp);
  3270. a11 *= temp;
  3271. a21 *= temp;
  3272. }
  3273. }
  3274. a11 = _round(a11);
  3275. a21 = _round(a21);
  3276. a12 = _round(a12);
  3277. a22 = _round(a22);
  3278. } else {
  3279. a11 = scaleX;
  3280. a22 = scaleY;
  3281. a21 = a12 = 0;
  3282. }
  3283. if (tx && !~(x + "").indexOf("px") || ty && !~(y + "").indexOf("px")) {
  3284. tx = _convertToUnit(target, "x", x, "px");
  3285. ty = _convertToUnit(target, "y", y, "px");
  3286. }
  3287. if (xOrigin || yOrigin || xOffset || yOffset) {
  3288. tx = _round(tx + xOrigin - (xOrigin * a11 + yOrigin * a12) + xOffset);
  3289. ty = _round(ty + yOrigin - (xOrigin * a21 + yOrigin * a22) + yOffset);
  3290. }
  3291. if (xPercent || yPercent) {
  3292. temp = target.getBBox();
  3293. tx = _round(tx + xPercent / 100 * temp.width);
  3294. ty = _round(ty + yPercent / 100 * temp.height);
  3295. }
  3296. temp = "matrix(" + a11 + "," + a21 + "," + a12 + "," + a22 + "," + tx + "," + ty + ")";
  3297. target.setAttribute("transform", temp);
  3298. forceCSS && (target.style[_transformProp] = temp);
  3299. }, _addRotationalPropTween = function _addRotationalPropTween2(plugin, target, property, startNum, endValue) {
  3300. var cap = 360, isString = _isString(endValue), endNum = parseFloat(endValue) * (isString && ~endValue.indexOf("rad") ? _RAD2DEG : 1), change = endNum - startNum, finalValue = startNum + change + "deg", direction, pt;
  3301. if (isString) {
  3302. direction = endValue.split("_")[1];
  3303. if (direction === "short") {
  3304. change %= cap;
  3305. if (change !== change % (cap / 2)) {
  3306. change += change < 0 ? cap : -cap;
  3307. }
  3308. }
  3309. if (direction === "cw" && change < 0) {
  3310. change = (change + cap * _bigNum$1) % cap - ~~(change / cap) * cap;
  3311. } else if (direction === "ccw" && change > 0) {
  3312. change = (change - cap * _bigNum$1) % cap - ~~(change / cap) * cap;
  3313. }
  3314. }
  3315. plugin._pt = pt = new PropTween(plugin._pt, target, property, startNum, change, _renderPropWithEnd);
  3316. pt.e = finalValue;
  3317. pt.u = "deg";
  3318. plugin._props.push(property);
  3319. return pt;
  3320. }, _assign = function _assign2(target, source) {
  3321. for (var p in source) {
  3322. target[p] = source[p];
  3323. }
  3324. return target;
  3325. }, _addRawTransformPTs = function _addRawTransformPTs2(plugin, transforms, target) {
  3326. var startCache = _assign({}, target._gsap), exclude = "perspective,force3D,transformOrigin,svgOrigin", style = target.style, endCache, p, startValue, endValue, startNum, endNum, startUnit, endUnit;
  3327. if (startCache.svg) {
  3328. startValue = target.getAttribute("transform");
  3329. target.setAttribute("transform", "");
  3330. style[_transformProp] = transforms;
  3331. endCache = _parseTransform(target, 1);
  3332. _removeProperty(target, _transformProp);
  3333. target.setAttribute("transform", startValue);
  3334. } else {
  3335. startValue = getComputedStyle(target)[_transformProp];
  3336. style[_transformProp] = transforms;
  3337. endCache = _parseTransform(target, 1);
  3338. style[_transformProp] = startValue;
  3339. }
  3340. for (p in _transformProps) {
  3341. startValue = startCache[p];
  3342. endValue = endCache[p];
  3343. if (startValue !== endValue && exclude.indexOf(p) < 0) {
  3344. startUnit = getUnit(startValue);
  3345. endUnit = getUnit(endValue);
  3346. startNum = startUnit !== endUnit ? _convertToUnit(target, p, startValue, endUnit) : parseFloat(startValue);
  3347. endNum = parseFloat(endValue);
  3348. plugin._pt = new PropTween(plugin._pt, endCache, p, startNum, endNum - startNum, _renderCSSProp);
  3349. plugin._pt.u = endUnit || 0;
  3350. plugin._props.push(p);
  3351. }
  3352. }
  3353. _assign(endCache, startCache);
  3354. };
  3355. _forEachName("padding,margin,Width,Radius", function(name, index) {
  3356. var t = "Top", r = "Right", b = "Bottom", l = "Left", props = (index < 3 ? [t, r, b, l] : [t + l, t + r, b + r, b + l]).map(function(side) {
  3357. return index < 2 ? name + side : "border" + side + name;
  3358. });
  3359. _specialProps[index > 1 ? "border" + name : name] = function(plugin, target, property, endValue, tween) {
  3360. var a, vars;
  3361. if (arguments.length < 4) {
  3362. a = props.map(function(prop) {
  3363. return _get(plugin, prop, property);
  3364. });
  3365. vars = a.join(" ");
  3366. return vars.split(a[0]).length === 5 ? a[0] : vars;
  3367. }
  3368. a = (endValue + "").split(" ");
  3369. vars = {};
  3370. props.forEach(function(prop, i) {
  3371. return vars[prop] = a[i] = a[i] || a[(i - 1) / 2 | 0];
  3372. });
  3373. plugin.init(target, vars, tween);
  3374. };
  3375. });
  3376. var CSSPlugin = {
  3377. name: "css",
  3378. register: _initCore,
  3379. targetTest: function targetTest(target) {
  3380. return target.style && target.nodeType;
  3381. },
  3382. init: function init3(target, vars, tween, index, targets) {
  3383. var props = this._props, style = target.style, startAt = tween.vars.startAt, startValue, endValue, endNum, startNum, type, specialProp, p, startUnit, endUnit, relative, isTransformRelated, transformPropTween, cache, smooth, hasPriority;
  3384. _pluginInitted || _initCore();
  3385. for (p in vars) {
  3386. if (p === "autoRound") {
  3387. continue;
  3388. }
  3389. endValue = vars[p];
  3390. if (_plugins[p] && _checkPlugin(p, vars, tween, index, target, targets)) {
  3391. continue;
  3392. }
  3393. type = typeof endValue;
  3394. specialProp = _specialProps[p];
  3395. if (type === "function") {
  3396. endValue = endValue.call(tween, index, target, targets);
  3397. type = typeof endValue;
  3398. }
  3399. if (type === "string" && ~endValue.indexOf("random(")) {
  3400. endValue = _replaceRandom(endValue);
  3401. }
  3402. if (specialProp) {
  3403. specialProp(this, target, p, endValue, tween) && (hasPriority = 1);
  3404. } else if (p.substr(0, 2) === "--") {
  3405. startValue = (getComputedStyle(target).getPropertyValue(p) + "").trim();
  3406. endValue += "";
  3407. _colorExp.lastIndex = 0;
  3408. if (!_colorExp.test(startValue)) {
  3409. startUnit = getUnit(startValue);
  3410. endUnit = getUnit(endValue);
  3411. }
  3412. endUnit ? startUnit !== endUnit && (startValue = _convertToUnit(target, p, startValue, endUnit) + endUnit) : startUnit && (endValue += startUnit);
  3413. this.add(style, "setProperty", startValue, endValue, index, targets, 0, 0, p);
  3414. props.push(p);
  3415. } else if (type !== "undefined") {
  3416. if (startAt && p in startAt) {
  3417. startValue = typeof startAt[p] === "function" ? startAt[p].call(tween, index, target, targets) : startAt[p];
  3418. _isString(startValue) && ~startValue.indexOf("random(") && (startValue = _replaceRandom(startValue));
  3419. getUnit(startValue + "") || (startValue += _config.units[p] || getUnit(_get(target, p)) || "");
  3420. (startValue + "").charAt(1) === "=" && (startValue = _get(target, p));
  3421. } else {
  3422. startValue = _get(target, p);
  3423. }
  3424. startNum = parseFloat(startValue);
  3425. relative = type === "string" && endValue.charAt(1) === "=" && endValue.substr(0, 2);
  3426. relative && (endValue = endValue.substr(2));
  3427. endNum = parseFloat(endValue);
  3428. if (p in _propertyAliases) {
  3429. if (p === "autoAlpha") {
  3430. if (startNum === 1 && _get(target, "visibility") === "hidden" && endNum) {
  3431. startNum = 0;
  3432. }
  3433. _addNonTweeningPT(this, style, "visibility", startNum ? "inherit" : "hidden", endNum ? "inherit" : "hidden", !endNum);
  3434. }
  3435. if (p !== "scale" && p !== "transform") {
  3436. p = _propertyAliases[p];
  3437. ~p.indexOf(",") && (p = p.split(",")[0]);
  3438. }
  3439. }
  3440. isTransformRelated = p in _transformProps;
  3441. if (isTransformRelated) {
  3442. if (!transformPropTween) {
  3443. cache = target._gsap;
  3444. cache.renderTransform && !vars.parseTransform || _parseTransform(target, vars.parseTransform);
  3445. smooth = vars.smoothOrigin !== false && cache.smooth;
  3446. transformPropTween = this._pt = new PropTween(this._pt, style, _transformProp, 0, 1, cache.renderTransform, cache, 0, -1);
  3447. transformPropTween.dep = 1;
  3448. }
  3449. if (p === "scale") {
  3450. this._pt = new PropTween(this._pt, cache, "scaleY", cache.scaleY, (relative ? _parseRelative(cache.scaleY, relative + endNum) : endNum) - cache.scaleY || 0);
  3451. props.push("scaleY", p);
  3452. p += "X";
  3453. } else if (p === "transformOrigin") {
  3454. endValue = _convertKeywordsToPercentages(endValue);
  3455. if (cache.svg) {
  3456. _applySVGOrigin(target, endValue, 0, smooth, 0, this);
  3457. } else {
  3458. endUnit = parseFloat(endValue.split(" ")[2]) || 0;
  3459. endUnit !== cache.zOrigin && _addNonTweeningPT(this, cache, "zOrigin", cache.zOrigin, endUnit);
  3460. _addNonTweeningPT(this, style, p, _firstTwoOnly(startValue), _firstTwoOnly(endValue));
  3461. }
  3462. continue;
  3463. } else if (p === "svgOrigin") {
  3464. _applySVGOrigin(target, endValue, 1, smooth, 0, this);
  3465. continue;
  3466. } else if (p in _rotationalProperties) {
  3467. _addRotationalPropTween(this, cache, p, startNum, relative ? _parseRelative(startNum, relative + endValue) : endValue);
  3468. continue;
  3469. } else if (p === "smoothOrigin") {
  3470. _addNonTweeningPT(this, cache, "smooth", cache.smooth, endValue);
  3471. continue;
  3472. } else if (p === "force3D") {
  3473. cache[p] = endValue;
  3474. continue;
  3475. } else if (p === "transform") {
  3476. _addRawTransformPTs(this, endValue, target);
  3477. continue;
  3478. }
  3479. } else if (!(p in style)) {
  3480. p = _checkPropPrefix(p) || p;
  3481. }
  3482. if (isTransformRelated || (endNum || endNum === 0) && (startNum || startNum === 0) && !_complexExp.test(endValue) && p in style) {
  3483. startUnit = (startValue + "").substr((startNum + "").length);
  3484. endNum || (endNum = 0);
  3485. endUnit = getUnit(endValue) || (p in _config.units ? _config.units[p] : startUnit);
  3486. startUnit !== endUnit && (startNum = _convertToUnit(target, p, startValue, endUnit));
  3487. this._pt = new PropTween(this._pt, isTransformRelated ? cache : style, p, startNum, (relative ? _parseRelative(startNum, relative + endNum) : endNum) - startNum, !isTransformRelated && (endUnit === "px" || p === "zIndex") && vars.autoRound !== false ? _renderRoundedCSSProp : _renderCSSProp);
  3488. this._pt.u = endUnit || 0;
  3489. if (startUnit !== endUnit && endUnit !== "%") {
  3490. this._pt.b = startValue;
  3491. this._pt.r = _renderCSSPropWithBeginning;
  3492. }
  3493. } else if (!(p in style)) {
  3494. if (p in target) {
  3495. this.add(target, p, startValue || target[p], relative ? relative + endValue : endValue, index, targets);
  3496. } else {
  3497. _missingPlugin(p, endValue);
  3498. continue;
  3499. }
  3500. } else {
  3501. _tweenComplexCSSString.call(this, target, p, startValue, relative ? relative + endValue : endValue);
  3502. }
  3503. props.push(p);
  3504. }
  3505. }
  3506. hasPriority && _sortPropTweensByPriority(this);
  3507. },
  3508. get: _get,
  3509. aliases: _propertyAliases,
  3510. getSetter: function getSetter(target, property, plugin) {
  3511. var p = _propertyAliases[property];
  3512. p && p.indexOf(",") < 0 && (property = p);
  3513. return property in _transformProps && property !== _transformOriginProp && (target._gsap.x || _get(target, "x")) ? plugin && _recentSetterPlugin === plugin ? property === "scale" ? _setterScale : _setterTransform : (_recentSetterPlugin = plugin || {}) && (property === "scale" ? _setterScaleWithRender : _setterTransformWithRender) : target.style && !_isUndefined(target.style[property]) ? _setterCSSStyle : ~property.indexOf("-") ? _setterCSSProp : _getSetter(target, property);
  3514. },
  3515. core: {
  3516. _removeProperty,
  3517. _getMatrix
  3518. }
  3519. };
  3520. gsap.utils.checkPrefix = _checkPropPrefix;
  3521. (function(positionAndScale, rotation, others, aliases) {
  3522. var all = _forEachName(positionAndScale + "," + rotation + "," + others, function(name) {
  3523. _transformProps[name] = 1;
  3524. });
  3525. _forEachName(rotation, function(name) {
  3526. _config.units[name] = "deg";
  3527. _rotationalProperties[name] = 1;
  3528. });
  3529. _propertyAliases[all[13]] = positionAndScale + "," + rotation;
  3530. _forEachName(aliases, function(name) {
  3531. var split = name.split(":");
  3532. _propertyAliases[split[1]] = all[split[0]];
  3533. });
  3534. })("x,y,z,scale,scaleX,scaleY,xPercent,yPercent", "rotation,rotationX,rotationY,skewX,skewY", "transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective", "0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY");
  3535. _forEachName("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective", function(name) {
  3536. _config.units[name] = "px";
  3537. });
  3538. gsap.registerPlugin(CSSPlugin);
  3539. var gsapWithCSS = gsap.registerPlugin(CSSPlugin) || gsap, TweenMaxWithCSS = gsapWithCSS.core.Tween;
  3540. export default gsapWithCSS;
  3541. export {Back, Bounce, CSSPlugin, Circ, Cubic, Elastic, Expo, Linear, Power0, Power1, Power2, Power3, Power4, Quad, Quart, Quint, Sine, SteppedEase, Strong, Timeline as TimelineLite, Timeline as TimelineMax, Tween as TweenLite, TweenMaxWithCSS as TweenMax, gsapWithCSS as gsap};