import{__spreadArray}from"tslib"; /*! * (C) Ionic http://ionicframework.com - MIT License */import{w as win}from"./index-a5d50daf.js";import{r as raf}from"./helpers-be245865.js";var animationPrefix;var processKeyframes=function(n){n.forEach((function(n){for(var r in n){if(n.hasOwnProperty(r)){var e=n[r];if(r==="easing"){var t="animation-timing-function";n[t]=e;delete n[r]}else{var t=convertCamelCaseToHypen(r);if(t!==r){n[t]=e;delete n[r]}}}}}));return n};var convertCamelCaseToHypen=function(n){return n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()};var getAnimationPrefix=function(n){if(animationPrefix===undefined){var r=n.style.animationName!==undefined;var e=n.style.webkitAnimationName!==undefined;animationPrefix=!r&&e?"-webkit-":""}return animationPrefix};var setStyleProperty=function(n,r,e){var t=r.startsWith("animation")?getAnimationPrefix(n):"";n.style.setProperty(t+r,e)};var removeStyleProperty=function(n,r){var e=r.startsWith("animation")?getAnimationPrefix(n):"";n.style.removeProperty(e+r)};var animationEnd=function(n,r){var e;var t={passive:true};var i=function(){if(e){e()}};var a=function(e){if(n===e.target){i();r(e)}};if(n){n.addEventListener("webkitAnimationEnd",a,t);n.addEventListener("animationend",a,t);e=function(){n.removeEventListener("webkitAnimationEnd",a,t);n.removeEventListener("animationend",a,t)}}return i};var generateKeyframeRules=function(n){if(n===void 0){n=[]}return n.map((function(n){var r=n.offset;var e=[];for(var t in n){if(n.hasOwnProperty(t)&&t!=="offset"){e.push("".concat(t,": ").concat(n[t],";"))}}return"".concat(r*100,"% { ").concat(e.join(" ")," }")})).join(" ")};var keyframeIds=[];var generateKeyframeName=function(n){var r=keyframeIds.indexOf(n);if(r<0){r=keyframeIds.push(n)-1}return"ion-animation-".concat(r)};var getStyleContainer=function(n){var r=n.getRootNode!==undefined?n.getRootNode():n;return r.head||r};var createKeyframeStylesheet=function(n,r,e){var t;var i=getStyleContainer(e);var a=getAnimationPrefix(e);var f=i.querySelector("#"+n);if(f){return f}var o=((t=e.ownerDocument)!==null&&t!==void 0?t:document).createElement("style");o.id=n;o.textContent="@".concat(a,"keyframes ").concat(n," { ").concat(r," } @").concat(a,"keyframes ").concat(n,"-alt { ").concat(r," }");i.appendChild(o);return o};var addClassToArray=function(n,r){if(n===void 0){n=[]}if(r!==undefined){var e=Array.isArray(r)?r:[r];return __spreadArray(__spreadArray([],n,true),e,true)}return n};var createAnimation=function(n){var r;var e;var t;var i;var a;var f;var o=[];var u=[];var v=[];var l=false;var s;var c={};var d=[];var y=[];var m={};var p=0;var S=false;var P=false;var g;var A;var C;var b;var T=true;var k=false;var E=true;var _;var x;var K=false;var h=n;var w=[];var I=[];var R=[];var F=[];var D=[];var W=[];var j=[];var H=[];var M=[];var N=[];var $=[];var z=typeof AnimationEffect==="function"||win!==undefined&&typeof win.AnimationEffect==="function";var Z=typeof Element==="function"&&typeof Element.prototype.animate==="function"&&z;var q=100;var B=function(){return $};var G=function(n){D.forEach((function(r){r.destroy(n)}));J(n);F.length=0;D.length=0;o.length=0;X();l=false;E=true;return x};var J=function(n){Y();if(n){nn()}};var L=function(){S=false;P=false;E=true;A=undefined;C=undefined;b=undefined;p=0;k=false;T=true;K=false};var O=function(){return p!==0&&!K};var Q=function(n,r){var e=r.findIndex((function(r){return r.c===n}));if(e>-1){r.splice(e,1)}};var U=function(n,r){R.push({c:n,o:r});return x};var V=function(n,r){var e=(r===null||r===void 0?void 0:r.oneTimeCallback)?I:w;e.push({c:n,o:r});return x};var X=function(){w.length=0;I.length=0;return x};var Y=function(){if(Z){$.forEach((function(n){n.cancel()}));$.length=0}else{var n=F.slice();raf((function(){n.forEach((function(n){removeStyleProperty(n,"animation-name");removeStyleProperty(n,"animation-duration");removeStyleProperty(n,"animation-timing-function");removeStyleProperty(n,"animation-iteration-count");removeStyleProperty(n,"animation-delay");removeStyleProperty(n,"animation-play-state");removeStyleProperty(n,"animation-fill-mode");removeStyleProperty(n,"animation-direction")}))}))}};var nn=function(){W.forEach((function(n){if(n===null||n===void 0?void 0:n.parentNode){n.parentNode.removeChild(n)}}));W.length=0};var rn=function(n){j.push(n);return x};var en=function(n){H.push(n);return x};var tn=function(n){M.push(n);return x};var an=function(n){N.push(n);return x};var fn=function(n){u=addClassToArray(u,n);return x};var on=function(n){v=addClassToArray(v,n);return x};var un=function(n){if(n===void 0){n={}}c=n;return x};var vn=function(n){if(n===void 0){n=[]}for(var r=0,e=n;r=0){for(var r=0;r0){var i=generateKeyframeRules(e);_=n!==undefined?n:generateKeyframeName(i);var a=createKeyframeStylesheet(_,i,t);W.push(a);setStyleProperty(t,"animation-duration","".concat(Sn(),"ms"));setStyleProperty(t,"animation-timing-function",pn());setStyleProperty(t,"animation-delay","".concat(gn(),"ms"));setStyleProperty(t,"animation-fill-mode",yn());setStyleProperty(t,"animation-direction",mn());var f=Pn()===Infinity?"infinite":Pn().toString();setStyleProperty(t,"animation-iteration-count",f);setStyleProperty(t,"animation-play-state","paused");if(r){setStyleProperty(t,"animation-name","".concat(a.id,"-alt"))}raf((function(){setStyleProperty(t,"animation-name",a.id||null)}))}}))};var jn=function(){F.forEach((function(n){var r=n.animate(o,{id:h,delay:gn(),duration:Sn(),easing:pn(),iterations:Pn(),fill:yn(),direction:mn()});r.pause();$.push(r)}));if($.length>0){$[0].onfinish=function(){Dn()}}};var Hn=function(n){if(n===void 0){n=true}Rn();if(o.length>0){if(Z){jn()}else{Wn(n)}}l=true};var Mn=function(n){n=Math.min(Math.max(n,0),.9999);if(Z){$.forEach((function(r){r.currentTime=r.effect.getComputedTiming().delay+Sn()*n;r.pause()}))}else{var r="-".concat(Sn()*n,"ms");F.forEach((function(n){if(o.length>0){setStyleProperty(n,"animation-delay",r);setStyleProperty(n,"animation-play-state","paused")}}))}};var Nn=function(n){$.forEach((function(n){n.effect.updateTiming({delay:gn(),duration:Sn(),easing:pn(),iterations:Pn(),fill:yn(),direction:mn()})}));if(n!==undefined){Mn(n)}};var $n=function(n,r){if(n===void 0){n=true}raf((function(){F.forEach((function(e){setStyleProperty(e,"animation-name",_||null);setStyleProperty(e,"animation-duration","".concat(Sn(),"ms"));setStyleProperty(e,"animation-timing-function",pn());setStyleProperty(e,"animation-delay",r!==undefined?"-".concat(r*Sn(),"ms"):"".concat(gn(),"ms"));setStyleProperty(e,"animation-fill-mode",yn()||null);setStyleProperty(e,"animation-direction",mn()||null);var t=Pn()===Infinity?"infinite":Pn().toString();setStyleProperty(e,"animation-iteration-count",t);if(n){setStyleProperty(e,"animation-name","".concat(_,"-alt"))}raf((function(){setStyleProperty(e,"animation-name",_||null)}))}))}))};var zn=function(n,r,e){if(n===void 0){n=false}if(r===void 0){r=true}if(n){D.forEach((function(t){t.update(n,r,e)}))}if(Z){Nn(e)}else{$n(r,e)}return x};var Zn=function(n,r){if(n===void 0){n=false}D.forEach((function(e){e.progressStart(n,r)}));Gn();S=n;if(!l){Hn()}zn(false,true,r);return x};var qn=function(n){D.forEach((function(r){r.progressStep(n)}));Mn(n);return x};var Bn=function(n,r,e){S=false;D.forEach((function(t){t.progressEnd(n,r,e)}));if(e!==undefined){C=e}k=false;T=true;if(n===0){A=mn()==="reverse"?"normal":"reverse";if(A==="reverse"){T=false}if(Z){zn();Mn(1-r)}else{b=(1-r)*Sn()*-1;zn(false,false)}}else if(n===1){if(Z){zn();Mn(r)}else{b=r*Sn()*-1;zn(false,false)}}if(n!==undefined&&!s){Yn()}return x};var Gn=function(){if(l){if(Z){$.forEach((function(n){n.pause()}))}else{F.forEach((function(n){setStyleProperty(n,"animation-play-state","paused")}))}K=true}};var Jn=function(){D.forEach((function(n){n.pause()}));Gn();return x};var Ln=function(){g=undefined;Dn()};var On=function(){if(g){clearTimeout(g)}};var Qn=function(){On();raf((function(){F.forEach((function(n){if(o.length>0){setStyleProperty(n,"animation-play-state","running")}}))}));if(o.length===0||F.length===0){Dn()}else{var n=gn()||0;var r=Sn()||0;var e=Pn()||1;if(isFinite(e)){g=setTimeout(Ln,n+r*e+q)}animationEnd(F[0],(function(){On();raf((function(){Un();raf(Dn)}))}))}};var Un=function(){F.forEach((function(n){removeStyleProperty(n,"animation-duration");removeStyleProperty(n,"animation-delay");removeStyleProperty(n,"animation-play-state")}))};var Vn=function(){$.forEach((function(n){n.play()}));if(o.length===0||F.length===0){Dn()}};var Xn=function(){if(Z){Mn(0);Nn()}else{$n()}};var Yn=function(n){return new Promise((function(r){if(n===null||n===void 0?void 0:n.sync){P=true;V((function(){return P=false}),{oneTimeCallback:true})}if(!l){Hn()}if(k){Xn();k=false}if(E){p=D.length+1;E=false}var e=function(){Q(t,I);r()};var t=function(){Q(e,R);r()};V(t,{oneTimeCallback:true});U(e,{oneTimeCallback:true});D.forEach((function(n){n.play()}));if(Z){Vn()}else{Qn()}K=false}))};var nr=function(){D.forEach((function(n){n.stop()}));if(l){Y();l=false}L();R.forEach((function(n){return n.c(0,x)}));R.length=0};var rr=function(n,r){var e;var t=o[0];if(t!==undefined&&(t.offset===undefined||t.offset===0)){t[n]=r}else{o=__spreadArray([(e={offset:0},e[n]=r,e)],o,true)}return x};var er=function(n,r){var e;var t=o[o.length-1];if(t!==undefined&&(t.offset===undefined||t.offset===1)){t[n]=r}else{o=__spreadArray(__spreadArray([],o,true),[(e={offset:1},e[n]=r,e)],false)}return x};var tr=function(n,r,e){return rr(n,r).to(n,e)};return x={parentAnimation:s,elements:F,childAnimations:D,id:h,animationFinish:Dn,from:rr,to:er,fromTo:tr,parent:xn,play:Yn,pause:Jn,stop:nr,destroy:G,keyframes:wn,addAnimation:hn,addElement:Kn,update:zn,fill:bn,direction:Cn,iterations:_n,duration:En,easing:kn,delay:Tn,getWebAnimations:B,getKeyframes:An,getFill:yn,getDirection:mn,getDelay:gn,getIterations:Pn,getEasing:pn,getDuration:Sn,afterAddRead:tn,afterAddWrite:an,afterClearStyles:dn,afterStyles:cn,afterRemoveClass:sn,afterAddClass:ln,beforeAddRead:rn,beforeAddWrite:en,beforeClearStyles:vn,beforeStyles:un,beforeRemoveClass:on,beforeAddClass:fn,onFinish:V,isRunning:O,progressStart:Zn,progressStep:qn,progressEnd:Bn}};export{createAnimation as c};