@angular/animations 11.2.12 → 11.2.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/animations.d.ts +1 -1
- package/browser/browser.d.ts +1 -1
- package/browser/testing/testing.d.ts +1 -1
- package/browser/testing.d.ts +1 -1
- package/browser.d.ts +1 -1
- package/bundles/animations-browser-testing.umd.js +1 -1
- package/bundles/animations-browser-testing.umd.min.js +1 -1
- package/bundles/animations-browser-testing.umd.min.js.map +1 -1
- package/bundles/animations-browser.umd.js +3 -3
- package/bundles/animations-browser.umd.js.map +1 -1
- package/bundles/animations-browser.umd.min.js +2 -2
- package/bundles/animations-browser.umd.min.js.map +1 -1
- package/bundles/animations.umd.js +1 -1
- package/bundles/animations.umd.min.js +1 -1
- package/bundles/animations.umd.min.js.map +1 -1
- package/esm2015/browser/src/render/transition_animation_engine.js +3 -3
- package/esm2015/src/version.js +1 -1
- package/fesm2015/animations.js +1 -1
- package/fesm2015/browser/testing.js +1 -1
- package/fesm2015/browser.js +3 -3
- package/fesm2015/browser.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v11.2.
|
|
2
|
+
* @license Angular v11.2.13
|
|
3
3
|
* (c) 2010-2021 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
*
|
|
46
46
|
* Use of this source code is governed by an MIT-style license that can be
|
|
47
47
|
* found in the LICENSE file at https://angular.io/license
|
|
48
|
-
*/var Nt=new st,Ot=function(){function t(t,e,n){this.bodyNode=t,this._driver=e,this._normalizer=n,this._animations={},this._playersById={},this.players=[]}return t.prototype.register=function(t,e){var n=[],r=X(this._driver,e,n);if(n.length)throw new Error("Unable to build the animation due to the following errors: "+n.join("\n"));this._animations[t]=r},t.prototype._buildPlayer=function(t,e,n){var r=t.element,i=o(0,this._normalizer,0,t.keyframes,e,n);return this._driver.animate(r,i,t.duration,t.delay,t.easing,[],!0)},t.prototype.create=function(t,n,r){var o=this;void 0===r&&(r={});var s,a=[],u=this._animations[t],h=new Map;if(u?(s=lt(this._driver,n,u,"ng-enter","ng-leave",{},{},r,Nt,a)).forEach((function(t){var e=l(h,t.element,{});t.postStyleProps.forEach((function(t){return e[t]=null}))})):(a.push("The requested animation doesn't exist or has already been destroyed"),s=[]),a.length)throw new Error("Unable to create the animation due to the following errors: "+a.join("\n"));h.forEach((function(t,n){Object.keys(t).forEach((function(r){t[r]=o._driver.computeStyle(n,r,e.AUTO_STYLE)}))}));var c=i(s.map((function(t){var e=h.get(t.element);return o._buildPlayer(t,{},e)})));return this._playersById[t]=c,c.onDestroy((function(){return o.destroy(t)})),this.players.push(c),c},t.prototype.destroy=function(t){var e=this._getPlayer(t);e.destroy(),delete this._playersById[t];var n=this.players.indexOf(e);n>=0&&this.players.splice(n,1)},t.prototype._getPlayer=function(t){var e=this._playersById[t];if(!e)throw new Error("Unable to find the timeline player referenced by "+t);return e},t.prototype.listen=function(t,e,n,r){var i=u(e,"","","");return s(this._getPlayer(t),n,i,r),function(){}},t.prototype.command=function(t,e,n,r){if("register"!=n)if("create"!=n){var i=this._getPlayer(t);switch(n){case"play":i.play();break;case"pause":i.pause();break;case"reset":i.reset();break;case"restart":i.restart();break;case"finish":i.finish();break;case"init":i.init();break;case"setPosition":i.setPosition(parseFloat(r[0]));break;case"destroy":this.destroy(t)}}else this.create(t,e,r[0]||{});else this.register(t,r[0])},t}(),Ct=[],Ft={namespaceId:"",setForRemoval:!1,setForMove:!1,hasAnimation:!1,removedBeforeQueried:!1},Dt={namespaceId:"",setForMove:!1,setForRemoval:!1,hasAnimation:!1,removedBeforeQueried:!0},Lt=function(){function t(t,e){void 0===e&&(e=""),this.namespaceId=e;var n=t&&t.hasOwnProperty("value");if(this.value=function r(t){return null!=t?t:null}(n?t.value:t),n){var i=A(t);delete i.value,this.options=i}else this.options={};this.options.params||(this.options.params={})}return Object.defineProperty(t.prototype,"params",{get:function(){return this.options.params},enumerable:!1,configurable:!0}),t.prototype.absorbOptions=function(t){var e=t.params;if(e){var n=this.options.params;Object.keys(e).forEach((function(t){null==n[t]&&(n[t]=e[t])}))}},t}(),xt=new Lt("void"),jt=function(){function t(t,e,n){this.id=t,this.hostElement=e,this._engine=n,this.players=[],this._triggers={},this._queue=[],this._elementListeners=new Map,this._hostClassName="ng-tns-"+t,Mt(e,this._hostClassName)}return t.prototype.listen=function(t,e,n,r){var i=this;if(!this._triggers.hasOwnProperty(e))throw new Error('Unable to listen on the animation trigger event "'+n+'" because the animation trigger "'+e+"\" doesn't exist!");if(null==n||0==n.length)throw new Error('Unable to listen on the animation trigger "'+e+'" because the provided event is undefined!');if(!function o(t){return"start"==t||"done"==t}(n))throw new Error('The provided animation trigger event "'+n+'" for the animation trigger "'+e+'" is not supported!');var s=l(this._elementListeners,t,[]),a={name:e,phase:n,callback:r};s.push(a);var u=l(this._engine.statesByElement,t,{});return u.hasOwnProperty(e)||(Mt(t,"ng-trigger"),Mt(t,"ng-trigger-"+e),u[e]=xt),function(){i._engine.afterFlush((function(){var t=s.indexOf(a);t>=0&&s.splice(t,1),i._triggers[e]||delete u[e]}))}},t.prototype.register=function(t,e){return!this._triggers[t]&&(this._triggers[t]=e,!0)},t.prototype._getTrigger=function(t){var e=this._triggers[t];if(!e)throw new Error('The provided animation trigger "'+t+'" has not been registered!');return e},t.prototype.trigger=function(t,e,n,r){var i=this;void 0===r&&(r=!0);var o=this._getTrigger(e),s=new Rt(this.id,e,t),a=this._engine.statesByElement.get(t);a||(Mt(t,"ng-trigger"),Mt(t,"ng-trigger-"+e),this._engine.statesByElement.set(t,a={}));var u=a[e],h=new Lt(n,this.id);if(!(n&&n.hasOwnProperty("value"))&&u&&h.absorbOptions(u.options),a[e]=h,u||(u=xt),"void"===h.value||u.value!==h.value){var c=l(this._engine.playersByElement,t,[]);c.forEach((function(t){t.namespaceId==i.id&&t.triggerName==e&&t.queued&&t.destroy()}));var p=o.matchTransition(u.value,h.value,t,h.params),f=!1;if(!p){if(!r)return;p=o.fallbackTransition,f=!0}return this._engine.totalQueuedPlayers++,this._queue.push({element:t,triggerName:e,transition:p,fromState:u,toState:h,player:s,isFallbackTransition:f}),f||(Mt(t,"ng-animate-queued"),s.onStart((function(){zt(t,"ng-animate-queued")}))),s.onDone((function(){var e=i.players.indexOf(s);e>=0&&i.players.splice(e,1);var n=i._engine.playersByElement.get(t);if(n){var r=n.indexOf(s);r>=0&&n.splice(r,1)}})),this.players.push(s),c.push(s),s}if(!function y(t,e){var n=Object.keys(t),r=Object.keys(e);if(n.length!=r.length)return!1;for(var i=0;i<n.length;i++){var o=n[i];if(!e.hasOwnProperty(o)||t[o]!==e[o])return!1}return!0}(u.params,h.params)){var m=[],d=o.matchStyles(u.value,u.params,m),v=o.matchStyles(h.value,h.params,m);m.length?this._engine.reportError(m):this._engine.afterFlush((function(){L(t,d),D(t,v)}))}},t.prototype.deregister=function(t){var e=this;delete this._triggers[t],this._engine.statesByElement.forEach((function(e,n){delete e[t]})),this._elementListeners.forEach((function(n,r){e._elementListeners.set(r,n.filter((function(e){return e.name!=t})))}))},t.prototype.clearElementCache=function(t){this._engine.statesByElement.delete(t),this._elementListeners.delete(t);var e=this._engine.playersByElement.get(t);e&&(e.forEach((function(t){return t.destroy()})),this._engine.playersByElement.delete(t))},t.prototype._signalRemovalForInnerTriggers=function(t,e){var n=this,r=this._engine.driver.query(t,".ng-trigger",!0);r.forEach((function(t){if(!t.__ng_removed){var r=n._engine.fetchNamespacesByElement(t);r.size?r.forEach((function(n){return n.triggerLeaveAnimation(t,e,!1,!0)})):n.clearElementCache(t)}})),this._engine.afterFlushAnimationsDone((function(){return r.forEach((function(t){return n.clearElementCache(t)}))}))},t.prototype.triggerLeaveAnimation=function(t,e,n,r){var o=this,s=this._engine.statesByElement.get(t);if(s){var a=[];if(Object.keys(s).forEach((function(e){if(o._triggers[e]){var n=o.trigger(t,e,"void",r);n&&a.push(n)}})),a.length)return this._engine.markElementAsRemoved(this.id,t,!0,e),n&&i(a).onDone((function(){return o._engine.processLeaveNode(t)})),!0}return!1},t.prototype.prepareLeaveAnimationListeners=function(t){var e=this,n=this._elementListeners.get(t),r=this._engine.statesByElement.get(t);if(n&&r){var i=new Set;n.forEach((function(n){var o=n.name;if(!i.has(o)){i.add(o);var s=e._triggers[o].fallbackTransition,a=r[o]||xt,u=new Lt("void"),l=new Rt(e.id,o,t);e._engine.totalQueuedPlayers++,e._queue.push({element:t,triggerName:o,transition:s,fromState:a,toState:u,player:l,isFallbackTransition:!0})}}))}},t.prototype.removeNode=function(t,e){var n=this,r=this._engine;if(t.childElementCount&&this._signalRemovalForInnerTriggers(t,e),!this.triggerLeaveAnimation(t,e,!0)){var i=!1;if(r.totalAnimations){var o=r.players.length?r.playersByQueriedElement.get(t):[];if(o&&o.length)i=!0;else for(var s=t;s=s.parentNode;)if(r.statesByElement.get(s)){i=!0;break}}if(this.prepareLeaveAnimationListeners(t),i)r.markElementAsRemoved(this.id,t,!1,e);else{var a=t.__ng_removed;a&&a!==Ft||(r.afterFlush((function(){return n.clearElementCache(t)})),r.destroyInnerAnimations(t),r._onRemovalComplete(t,e))}}},t.prototype.insertNode=function(t,e){Mt(t,this._hostClassName)},t.prototype.drainQueuedTransitions=function(t){var e=this,n=[];return this._queue.forEach((function(r){var i=r.player;if(!i.destroyed){var o=r.element,a=e._elementListeners.get(o);a&&a.forEach((function(e){if(e.name==r.triggerName){var n=u(o,r.triggerName,r.fromState.value,r.toState.value);n._data=t,s(r.player,e.phase,n,e.callback)}})),i.markedForDestroy?e._engine.afterFlush((function(){i.destroy()})):n.push(r)}})),this._queue=[],n.sort((function(t,n){var r=t.transition.ast.depCount,i=n.transition.ast.depCount;return 0==r||0==i?r-i:e._engine.driver.containsElement(t.element,n.element)?1:-1}))},t.prototype.destroy=function(t){this.players.forEach((function(t){return t.destroy()})),this._signalRemovalForInnerTriggers(this.hostElement,t)},t.prototype.elementContainsData=function(t){var e=!1;return this._elementListeners.has(t)&&(e=!0),!!this._queue.find((function(e){return e.element===t}))||e},t}(),qt=function(){function t(t,e,n){this.bodyNode=t,this.driver=e,this._normalizer=n,this.players=[],this.newHostElements=new Map,this.playersByElement=new Map,this.playersByQueriedElement=new Map,this.statesByElement=new Map,this.disabledNodes=new Set,this.totalAnimations=0,this.totalQueuedPlayers=0,this._namespaceLookup={},this._namespaceList=[],this._flushFns=[],this._whenQuietFns=[],this.namespacesByHostElement=new Map,this.collectedEnterElements=[],this.collectedLeaveElements=[],this.onRemovalComplete=function(t,e){}}return t.prototype._onRemovalComplete=function(t,e){this.onRemovalComplete(t,e)},Object.defineProperty(t.prototype,"queuedPlayers",{get:function(){var t=[];return this._namespaceList.forEach((function(e){e.players.forEach((function(e){e.queued&&t.push(e)}))})),t},enumerable:!1,configurable:!0}),t.prototype.createNamespace=function(t,e){var n=new jt(t,e,this);return e.parentNode?this._balanceNamespaceList(n,e):(this.newHostElements.set(e,n),this.collectEnterElement(e)),this._namespaceLookup[t]=n},t.prototype._balanceNamespaceList=function(t,e){var n=this._namespaceList.length-1;if(n>=0){for(var r=!1,i=n;i>=0;i--)if(this.driver.containsElement(this._namespaceList[i].hostElement,e)){this._namespaceList.splice(i+1,0,t),r=!0;break}r||this._namespaceList.splice(0,0,t)}else this._namespaceList.push(t);return this.namespacesByHostElement.set(e,t),t},t.prototype.register=function(t,e){var n=this._namespaceLookup[t];return n||(n=this.createNamespace(t,e)),n},t.prototype.registerTrigger=function(t,e,n){var r=this._namespaceLookup[t];r&&r.register(e,n)&&this.totalAnimations++},t.prototype.destroy=function(t,e){var n=this;if(t){var r=this._fetchNamespace(t);this.afterFlush((function(){n.namespacesByHostElement.delete(r.hostElement),delete n._namespaceLookup[t];var e=n._namespaceList.indexOf(r);e>=0&&n._namespaceList.splice(e,1)})),this.afterFlushAnimationsDone((function(){return r.destroy(e)}))}},t.prototype._fetchNamespace=function(t){return this._namespaceLookup[t]},t.prototype.fetchNamespacesByElement=function(t){var e=new Set,n=this.statesByElement.get(t);if(n)for(var r=Object.keys(n),i=0;i<r.length;i++){var o=n[r[i]].namespaceId;if(o){var s=this._fetchNamespace(o);s&&e.add(s)}}return e},t.prototype.trigger=function(t,e,n,r){if(Kt(e)){var i=this._fetchNamespace(t);if(i)return i.trigger(e,n,r),!0}return!1},t.prototype.insertNode=function(t,e,n,r){if(Kt(e)){var i=e.__ng_removed;if(i&&i.setForRemoval){i.setForRemoval=!1,i.setForMove=!0;var o=this.collectedLeaveElements.indexOf(e);o>=0&&this.collectedLeaveElements.splice(o,1)}if(t){var s=this._fetchNamespace(t);s&&s.insertNode(e,n)}r&&this.collectEnterElement(e)}},t.prototype.collectEnterElement=function(t){this.collectedEnterElements.push(t)},t.prototype.markElementAsDisabled=function(t,e){e?this.disabledNodes.has(t)||(this.disabledNodes.add(t),Mt(t,"ng-animate-disabled")):this.disabledNodes.has(t)&&(this.disabledNodes.delete(t),zt(t,"ng-animate-disabled"))},t.prototype.removeNode=function(t,e,n,r){if(Kt(e)){var i=t?this._fetchNamespace(t):null;if(i?i.removeNode(e,r):this.markElementAsRemoved(t,e,!1,r),n){var o=this.namespacesByHostElement.get(e);o&&o.id!==t&&o.removeNode(e,r)}}else this._onRemovalComplete(e,r)},t.prototype.markElementAsRemoved=function(t,e,n,r){this.collectedLeaveElements.push(e),e.__ng_removed={namespaceId:t,setForRemoval:r,hasAnimation:n,removedBeforeQueried:!1}},t.prototype.listen=function(t,e,n,r,i){return Kt(e)?this._fetchNamespace(t).listen(e,n,r,i):function(){}},t.prototype._buildInstruction=function(t,e,n,r,i){return t.transition.build(this.driver,t.element,t.fromState.value,t.toState.value,n,r,t.fromState.options,t.toState.options,e,i)},t.prototype.destroyInnerAnimations=function(t){var e=this,n=this.driver.query(t,".ng-trigger",!0);n.forEach((function(t){return e.destroyActiveAnimationsForElement(t)})),0!=this.playersByQueriedElement.size&&(n=this.driver.query(t,".ng-animating",!0)).forEach((function(t){return e.finishActiveQueriedAnimationOnElement(t)}))},t.prototype.destroyActiveAnimationsForElement=function(t){var e=this.playersByElement.get(t);e&&e.forEach((function(t){t.queued?t.markedForDestroy=!0:t.destroy()}))},t.prototype.finishActiveQueriedAnimationOnElement=function(t){var e=this.playersByQueriedElement.get(t);e&&e.forEach((function(t){return t.finish()}))},t.prototype.whenRenderingDone=function(){var t=this;return new Promise((function(e){if(t.players.length)return i(t.players).onDone((function(){return e()}));e()}))},t.prototype.processLeaveNode=function(t){var e=this,n=t.__ng_removed;if(n&&n.setForRemoval){if(t.__ng_removed=Ft,n.namespaceId){this.destroyInnerAnimations(t);var r=this._fetchNamespace(n.namespaceId);r&&r.clearElementCache(t)}this._onRemovalComplete(t,n.setForRemoval)}this.driver.matchesElement(t,".ng-animate-disabled")&&this.markElementAsDisabled(t,!1),this.driver.query(t,".ng-animate-disabled",!0).forEach((function(t){e.markElementAsDisabled(t,!1)}))},t.prototype.flush=function(t){var e=this;void 0===t&&(t=-1);var n=[];if(this.newHostElements.size&&(this.newHostElements.forEach((function(t,n){return e._balanceNamespaceList(t,n)})),this.newHostElements.clear()),this.totalAnimations&&this.collectedEnterElements.length)for(var r=0;r<this.collectedEnterElements.length;r++)Mt(this.collectedEnterElements[r],"ng-star-inserted");if(this._namespaceList.length&&(this.totalQueuedPlayers||this.collectedLeaveElements.length)){var o=[];try{n=this._flushAnimations(o,t)}finally{for(r=0;r<o.length;r++)o[r]()}}else for(r=0;r<this.collectedLeaveElements.length;r++)this.processLeaveNode(this.collectedLeaveElements[r]);if(this.totalQueuedPlayers=0,this.collectedEnterElements.length=0,this.collectedLeaveElements.length=0,this._flushFns.forEach((function(t){return t()})),this._flushFns=[],this._whenQuietFns.length){var s=this._whenQuietFns;this._whenQuietFns=[],n.length?i(n).onDone((function(){s.forEach((function(t){return t()}))})):s.forEach((function(t){return t()}))}},t.prototype.reportError=function(t){throw new Error("Unable to process animations due to the following failed trigger transitions\n "+t.join("\n"))},t.prototype._flushAnimations=function(t,n){var r=this,o=new st,s=[],a=new Map,u=[],h=new Map,c=new Map,p=new Map,f=new Set;this.disabledNodes.forEach((function(t){f.add(t);for(var e=r.driver.query(t,".ng-animate-queued",!0),n=0;n<e.length;n++)f.add(e[n])}));var y=this.bodyNode,m=Array.from(this.statesByElement.keys()),d=It(m,this.collectedEnterElements),v=new Map,g=0;d.forEach((function(t,e){var n="ng-enter"+g++;v.set(e,n),t.forEach((function(t){return Mt(t,n)}))}));for(var _=[],S=new Set,E=new Set,b=0;b<this.collectedLeaveElements.length;b++)(I=(B=this.collectedLeaveElements[b]).__ng_removed)&&I.setForRemoval&&(_.push(B),S.add(B),I.hasAnimation?this.driver.query(B,".ng-star-inserted",!0).forEach((function(t){return S.add(t)})):E.add(B));var T=new Map,w=It(m,Array.from(S));w.forEach((function(t,e){var n="ng-leave"+g++;T.set(e,n),t.forEach((function(t){return Mt(t,n)}))})),t.push((function(){d.forEach((function(t,e){var n=v.get(e);t.forEach((function(t){return zt(t,n)}))})),w.forEach((function(t,e){var n=T.get(e);t.forEach((function(t){return zt(t,n)}))})),_.forEach((function(t){r.processLeaveNode(t)}))}));for(var P=[],k=[],A=this._namespaceList.length-1;A>=0;A--)this._namespaceList[A].drainQueuedTransitions(n).forEach((function(t){var e=t.player,n=t.element;if(P.push(e),r.collectedEnterElements.length){var i=n.__ng_removed;if(i&&i.setForMove)return void e.destroy()}var a=!y||!r.driver.containsElement(y,n),f=T.get(n),m=v.get(n),d=r._buildInstruction(t,o,m,f,a);if(d.errors&&d.errors.length)k.push(d);else{if(a)return e.onStart((function(){return L(n,d.fromStyles)})),e.onDestroy((function(){return D(n,d.toStyles)})),void s.push(e);if(t.isFallbackTransition)return e.onStart((function(){return L(n,d.fromStyles)})),e.onDestroy((function(){return D(n,d.toStyles)})),void s.push(e);d.timelines.forEach((function(t){return t.stretchStartingKeyframe=!0})),o.append(n,d.timelines),u.push({instruction:d,player:e,element:n}),d.queriedElements.forEach((function(t){return l(h,t,[]).push(e)})),d.preStyleProps.forEach((function(t,e){var n=Object.keys(t);if(n.length){var r=c.get(e);r||c.set(e,r=new Set),n.forEach((function(t){return r.add(t)}))}})),d.postStyleProps.forEach((function(t,e){var n=Object.keys(t),r=p.get(e);r||p.set(e,r=new Set),n.forEach((function(t){return r.add(t)}))}))}}));if(k.length){var N=[];k.forEach((function(t){N.push("@"+t.triggerName+" has failed due to:\n"),t.errors.forEach((function(t){return N.push("- "+t+"\n")}))})),P.forEach((function(t){return t.destroy()})),this.reportError(N)}var O=new Map,C=new Map;u.forEach((function(t){var e=t.element;o.has(e)&&(C.set(e,e),r._beforeAnimationBuild(t.player.namespaceId,t.instruction,O))})),s.forEach((function(t){var e=t.element;r._getPreviousPlayers(e,!1,t.namespaceId,t.triggerName,null).forEach((function(t){l(O,e,[]).push(t),t.destroy()}))}));var F=_.filter((function(t){return Wt(t,c,p)})),x=new Map;Bt(x,this.driver,E,p,e.AUTO_STYLE).forEach((function(t){Wt(t,c,p)&&F.push(t)}));var j=new Map;d.forEach((function(t,n){Bt(j,r.driver,new Set(t),c,e.ɵPRE_STYLE)})),F.forEach((function(t){var e=x.get(t),n=j.get(t);x.set(t,Object.assign(Object.assign({},e),n))}));var q=[],R=[],K={};u.forEach((function(t){var e=t.element,n=t.player,u=t.instruction;if(o.has(e)){if(f.has(e))return n.onDestroy((function(){return D(e,u.toStyles)})),n.disabled=!0,n.overrideTotalTime(u.totalTime),void s.push(n);var l=K;if(C.size>1){for(var h=e,c=[];h=h.parentNode;){var p=C.get(h);if(p){l=p;break}c.push(h)}c.forEach((function(t){return C.set(t,l)}))}var y=r._buildAnimation(n.namespaceId,u,O,a,j,x);if(n.setRealPlayer(y),l===K)q.push(n);else{var m=r.playersByElement.get(l);m&&m.length&&(n.parentPlayer=i(m)),s.push(n)}}else L(e,u.fromStyles),n.onDestroy((function(){return D(e,u.toStyles)})),R.push(n),f.has(e)&&s.push(n)})),R.forEach((function(t){var e=a.get(t.element);if(e&&e.length){var n=i(e);t.setRealPlayer(n)}})),s.forEach((function(t){t.parentPlayer?t.syncPlayerEvents(t.parentPlayer):t.destroy()}));for(var Q=0;Q<_.length;Q++){var B,I=(B=_[Q]).__ng_removed;if(zt(B,"ng-leave"),!I||!I.hasAnimation){var M=[];if(h.size){var z=h.get(B);z&&z.length&&M.push.apply(M,H(z));for(var U=this.driver.query(B,".ng-animating",!0),W=0;W<U.length;W++){var $=h.get(U[W]);$&&$.length&&M.push.apply(M,H($))}}var Y=M.filter((function(t){return!t.destroyed}));Y.length?Ut(this,B,Y):this.processLeaveNode(B)}}return _.length=0,q.forEach((function(t){r.players.push(t),t.onDone((function(){t.destroy();var e=r.players.indexOf(t);r.players.splice(e,1)})),t.play()})),q},t.prototype.elementContainsData=function(t,e){var n=!1,r=e.__ng_removed;return r&&r.setForRemoval&&(n=!0),this.playersByElement.has(e)&&(n=!0),this.playersByQueriedElement.has(e)&&(n=!0),this.statesByElement.has(e)&&(n=!0),this._fetchNamespace(t).elementContainsData(e)||n},t.prototype.afterFlush=function(t){this._flushFns.push(t)},t.prototype.afterFlushAnimationsDone=function(t){this._whenQuietFns.push(t)},t.prototype._getPreviousPlayers=function(t,e,n,r,i){var o=[];if(e){var s=this.playersByQueriedElement.get(t);s&&(o=s)}else{var a=this.playersByElement.get(t);if(a){var u=!i||"void"==i;a.forEach((function(t){t.queued||(u||t.triggerName==r)&&o.push(t)}))}}return(n||r)&&(o=o.filter((function(t){return!(n&&n!=t.namespaceId||r&&r!=t.triggerName)}))),o},t.prototype._beforeAnimationBuild=function(t,e,n){var r,i,o=e.element,s=e.isRemovalTransition?void 0:t,a=e.isRemovalTransition?void 0:e.triggerName,u=function(t){var r=t.element,i=r!==o,u=l(n,r,[]);h._getPreviousPlayers(r,i,s,a,e.toState).forEach((function(t){var e=t.getRealPlayer();e.beforeDestroy&&e.beforeDestroy(),t.destroy(),u.push(t)}))},h=this;try{for(var c=function p(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}(e.timelines),f=c.next();!f.done;f=c.next())u(f.value)}catch(t){r={error:t}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}L(o,e.fromStyles)},t.prototype._buildAnimation=function(t,n,r,s,a,u){var h=this,c=n.triggerName,p=n.element,f=[],y=new Set,m=new Set,d=n.timelines.map((function(n){var i=n.element;y.add(i);var l=i.__ng_removed;if(l&&l.removedBeforeQueried)return new e.NoopAnimationPlayer(n.duration,n.delay);var d=i!==p,v=function g(t){var n=[];return function t(n,r){for(var i=0;i<n.length;i++){var o=n[i];o instanceof e.ɵAnimationGroupPlayer?t(o.players,r):r.push(o)}}(t,n),n}((r.get(i)||Ct).map((function(t){return t.getRealPlayer()}))).filter((function(t){return!!t.element&&t.element===i})),_=a.get(i),S=u.get(i),E=o(0,h._normalizer,0,n.keyframes,_,S),b=h._buildPlayer(n,E,v);if(n.subTimeline&&s&&m.add(i),d){var T=new Rt(t,c,i);T.setRealPlayer(b),f.push(T)}return b}));f.forEach((function(t){l(h.playersByQueriedElement,t.element,[]).push(t),t.onDone((function(){return function e(t,n,r){var i;if(t instanceof Map){if(i=t.get(n)){if(i.length){var o=i.indexOf(r);i.splice(o,1)}0==i.length&&t.delete(n)}}else(i=t[n])&&(i.length&&(o=i.indexOf(r),i.splice(o,1)),0==i.length&&delete t[n]);return i}(h.playersByQueriedElement,t.element,t)}))})),y.forEach((function(t){return Mt(t,"ng-animating")}));var v=i(d);return v.onDestroy((function(){y.forEach((function(t){return zt(t,"ng-animating")})),D(p,n.toStyles)})),m.forEach((function(t){l(s,t,[]).push(v)})),v},t.prototype._buildPlayer=function(t,n,r){return n.length>0?this.driver.animate(t.element,n,t.duration,t.delay,t.easing,r):new e.NoopAnimationPlayer(t.duration,t.delay)},t}(),Rt=function(){function t(t,n,r){this.namespaceId=t,this.triggerName=n,this.element=r,this._player=new e.NoopAnimationPlayer,this._containsRealPlayer=!1,this._queuedCallbacks={},this.destroyed=!1,this.markedForDestroy=!1,this.disabled=!1,this.queued=!0,this.totalTime=0}return t.prototype.setRealPlayer=function(t){var e=this;this._containsRealPlayer||(this._player=t,Object.keys(this._queuedCallbacks).forEach((function(n){e._queuedCallbacks[n].forEach((function(e){return s(t,n,void 0,e)}))})),this._queuedCallbacks={},this._containsRealPlayer=!0,this.overrideTotalTime(t.totalTime),this.queued=!1)},t.prototype.getRealPlayer=function(){return this._player},t.prototype.overrideTotalTime=function(t){this.totalTime=t},t.prototype.syncPlayerEvents=function(t){var e=this,n=this._player;n.triggerCallback&&t.onStart((function(){return n.triggerCallback("start")})),t.onDone((function(){return e.finish()})),t.onDestroy((function(){return e.destroy()}))},t.prototype._queueEvent=function(t,e){l(this._queuedCallbacks,t,[]).push(e)},t.prototype.onDone=function(t){this.queued&&this._queueEvent("done",t),this._player.onDone(t)},t.prototype.onStart=function(t){this.queued&&this._queueEvent("start",t),this._player.onStart(t)},t.prototype.onDestroy=function(t){this.queued&&this._queueEvent("destroy",t),this._player.onDestroy(t)},t.prototype.init=function(){this._player.init()},t.prototype.hasStarted=function(){return!this.queued&&this._player.hasStarted()},t.prototype.play=function(){!this.queued&&this._player.play()},t.prototype.pause=function(){!this.queued&&this._player.pause()},t.prototype.restart=function(){!this.queued&&this._player.restart()},t.prototype.finish=function(){this._player.finish()},t.prototype.destroy=function(){this.destroyed=!0,this._player.destroy()},t.prototype.reset=function(){!this.queued&&this._player.reset()},t.prototype.setPosition=function(t){this.queued||this._player.setPosition(t)},t.prototype.getPosition=function(){return this.queued?0:this._player.getPosition()},t.prototype.triggerCallback=function(t){var e=this._player;e.triggerCallback&&e.triggerCallback(t)},t}();function Kt(t){return t&&1===t.nodeType}function Qt(t,e){var n=t.style.display;return t.style.display=null!=e?e:"none",n}function Bt(t,e,n,r,i){var o=[];n.forEach((function(t){return o.push(Qt(t))}));var s=[];r.forEach((function(n,r){var o={};n.forEach((function(t){var n=o[t]=e.computeStyle(r,t,i);n&&0!=n.length||(r.__ng_removed=Dt,s.push(r))})),t.set(r,o)}));var a=0;return n.forEach((function(t){return Qt(t,o[a++])})),s}function It(t,e){var n=new Map;if(t.forEach((function(t){return n.set(t,[])})),0==e.length)return n;var r=new Set(e),i=new Map;return e.forEach((function(t){var e=function t(e){if(!e)return 1;var o=i.get(e);if(o)return o;var s=e.parentNode;return o=n.has(s)?s:r.has(s)?1:t(s),i.set(e,o),o}(t);1!==e&&n.get(e).push(t)})),n}function Mt(t,e){if(t.classList)t.classList.add(e);else{var n=t.$$classes;n||(n=t.$$classes={}),n[e]=!0}}function zt(t,e){if(t.classList)t.classList.remove(e);else{var n=t.$$classes;n&&delete n[e]}}function Ut(t,e,n){i(n).onDone((function(){return t.processLeaveNode(e)}))}function Wt(t,e,n){var r=n.get(t);if(!r)return!1;var i=e.get(t);return i?r.forEach((function(t){return i.add(t)})):e.set(t,r),n.delete(t),!0}var $t=function(){function t(t,e,n){var r=this;this.bodyNode=t,this._driver=e,this._triggerCache={},this.onRemovalComplete=function(t,e){},this._transitionEngine=new qt(t,e,n),this._timelineEngine=new Ot(t,e,n),this._transitionEngine.onRemovalComplete=function(t,e){return r.onRemovalComplete(t,e)}}return t.prototype.registerTrigger=function(t,e,n,r,i){var o=t+"-"+r,s=this._triggerCache[o];if(!s){var a=[],u=X(this._driver,i,a);if(a.length)throw new Error('The animation trigger "'+r+'" has failed to build due to the following errors:\n - '+a.join("\n - "));s=function l(t,e){return new kt(t,e)}(r,u),this._triggerCache[o]=s}this._transitionEngine.registerTrigger(e,r,s)},t.prototype.register=function(t,e){this._transitionEngine.register(t,e)},t.prototype.destroy=function(t,e){this._transitionEngine.destroy(t,e)},t.prototype.onInsert=function(t,e,n,r){this._transitionEngine.insertNode(t,e,n,r)},t.prototype.onRemove=function(t,e,n,r){this._transitionEngine.removeNode(t,e,r||!1,n)},t.prototype.disableAnimations=function(t,e){this._transitionEngine.markElementAsDisabled(t,e)},t.prototype.process=function(t,e,n,r){if("@"==n.charAt(0)){var i=Y(h(n),2);this._timelineEngine.command(i[0],e,i[1],r)}else this._transitionEngine.trigger(t,e,n,r)},t.prototype.listen=function(t,e,n,r,i){if("@"==n.charAt(0)){var o=Y(h(n),2);return this._timelineEngine.listen(o[0],e,o[1],i)}return this._transitionEngine.listen(t,e,n,r,i)},t.prototype.flush=function(t){void 0===t&&(t=-1),this._transitionEngine.flush(t)},Object.defineProperty(t.prototype,"players",{get:function(){return this._transitionEngine.players.concat(this._timelineEngine.players)},enumerable:!1,configurable:!0}),t.prototype.whenRenderingDone=function(){return this._transitionEngine.whenRenderingDone()},t}();
|
|
48
|
+
*/var Nt=new st,Ot=function(){function t(t,e,n){this.bodyNode=t,this._driver=e,this._normalizer=n,this._animations={},this._playersById={},this.players=[]}return t.prototype.register=function(t,e){var n=[],r=X(this._driver,e,n);if(n.length)throw new Error("Unable to build the animation due to the following errors: "+n.join("\n"));this._animations[t]=r},t.prototype._buildPlayer=function(t,e,n){var r=t.element,i=o(0,this._normalizer,0,t.keyframes,e,n);return this._driver.animate(r,i,t.duration,t.delay,t.easing,[],!0)},t.prototype.create=function(t,n,r){var o=this;void 0===r&&(r={});var s,a=[],u=this._animations[t],h=new Map;if(u?(s=lt(this._driver,n,u,"ng-enter","ng-leave",{},{},r,Nt,a)).forEach((function(t){var e=l(h,t.element,{});t.postStyleProps.forEach((function(t){return e[t]=null}))})):(a.push("The requested animation doesn't exist or has already been destroyed"),s=[]),a.length)throw new Error("Unable to create the animation due to the following errors: "+a.join("\n"));h.forEach((function(t,n){Object.keys(t).forEach((function(r){t[r]=o._driver.computeStyle(n,r,e.AUTO_STYLE)}))}));var c=i(s.map((function(t){var e=h.get(t.element);return o._buildPlayer(t,{},e)})));return this._playersById[t]=c,c.onDestroy((function(){return o.destroy(t)})),this.players.push(c),c},t.prototype.destroy=function(t){var e=this._getPlayer(t);e.destroy(),delete this._playersById[t];var n=this.players.indexOf(e);n>=0&&this.players.splice(n,1)},t.prototype._getPlayer=function(t){var e=this._playersById[t];if(!e)throw new Error("Unable to find the timeline player referenced by "+t);return e},t.prototype.listen=function(t,e,n,r){var i=u(e,"","","");return s(this._getPlayer(t),n,i,r),function(){}},t.prototype.command=function(t,e,n,r){if("register"!=n)if("create"!=n){var i=this._getPlayer(t);switch(n){case"play":i.play();break;case"pause":i.pause();break;case"reset":i.reset();break;case"restart":i.restart();break;case"finish":i.finish();break;case"init":i.init();break;case"setPosition":i.setPosition(parseFloat(r[0]));break;case"destroy":this.destroy(t)}}else this.create(t,e,r[0]||{});else this.register(t,r[0])},t}(),Ct=[],Ft={namespaceId:"",setForRemoval:!1,setForMove:!1,hasAnimation:!1,removedBeforeQueried:!1},Dt={namespaceId:"",setForMove:!1,setForRemoval:!1,hasAnimation:!1,removedBeforeQueried:!0},Lt=function(){function t(t,e){void 0===e&&(e=""),this.namespaceId=e;var n=t&&t.hasOwnProperty("value");if(this.value=function r(t){return null!=t?t:null}(n?t.value:t),n){var i=A(t);delete i.value,this.options=i}else this.options={};this.options.params||(this.options.params={})}return Object.defineProperty(t.prototype,"params",{get:function(){return this.options.params},enumerable:!1,configurable:!0}),t.prototype.absorbOptions=function(t){var e=t.params;if(e){var n=this.options.params;Object.keys(e).forEach((function(t){null==n[t]&&(n[t]=e[t])}))}},t}(),xt=new Lt("void"),jt=function(){function t(t,e,n){this.id=t,this.hostElement=e,this._engine=n,this.players=[],this._triggers={},this._queue=[],this._elementListeners=new Map,this._hostClassName="ng-tns-"+t,Mt(e,this._hostClassName)}return t.prototype.listen=function(t,e,n,r){var i=this;if(!this._triggers.hasOwnProperty(e))throw new Error('Unable to listen on the animation trigger event "'+n+'" because the animation trigger "'+e+"\" doesn't exist!");if(null==n||0==n.length)throw new Error('Unable to listen on the animation trigger "'+e+'" because the provided event is undefined!');if(!function o(t){return"start"==t||"done"==t}(n))throw new Error('The provided animation trigger event "'+n+'" for the animation trigger "'+e+'" is not supported!');var s=l(this._elementListeners,t,[]),a={name:e,phase:n,callback:r};s.push(a);var u=l(this._engine.statesByElement,t,{});return u.hasOwnProperty(e)||(Mt(t,"ng-trigger"),Mt(t,"ng-trigger-"+e),u[e]=xt),function(){i._engine.afterFlush((function(){var t=s.indexOf(a);t>=0&&s.splice(t,1),i._triggers[e]||delete u[e]}))}},t.prototype.register=function(t,e){return!this._triggers[t]&&(this._triggers[t]=e,!0)},t.prototype._getTrigger=function(t){var e=this._triggers[t];if(!e)throw new Error('The provided animation trigger "'+t+'" has not been registered!');return e},t.prototype.trigger=function(t,e,n,r){var i=this;void 0===r&&(r=!0);var o=this._getTrigger(e),s=new Rt(this.id,e,t),a=this._engine.statesByElement.get(t);a||(Mt(t,"ng-trigger"),Mt(t,"ng-trigger-"+e),this._engine.statesByElement.set(t,a={}));var u=a[e],h=new Lt(n,this.id);if(!(n&&n.hasOwnProperty("value"))&&u&&h.absorbOptions(u.options),a[e]=h,u||(u=xt),"void"===h.value||u.value!==h.value){var c=l(this._engine.playersByElement,t,[]);c.forEach((function(t){t.namespaceId==i.id&&t.triggerName==e&&t.queued&&t.destroy()}));var p=o.matchTransition(u.value,h.value,t,h.params),f=!1;if(!p){if(!r)return;p=o.fallbackTransition,f=!0}return this._engine.totalQueuedPlayers++,this._queue.push({element:t,triggerName:e,transition:p,fromState:u,toState:h,player:s,isFallbackTransition:f}),f||(Mt(t,"ng-animate-queued"),s.onStart((function(){zt(t,"ng-animate-queued")}))),s.onDone((function(){var e=i.players.indexOf(s);e>=0&&i.players.splice(e,1);var n=i._engine.playersByElement.get(t);if(n){var r=n.indexOf(s);r>=0&&n.splice(r,1)}})),this.players.push(s),c.push(s),s}if(!function y(t,e){var n=Object.keys(t),r=Object.keys(e);if(n.length!=r.length)return!1;for(var i=0;i<n.length;i++){var o=n[i];if(!e.hasOwnProperty(o)||t[o]!==e[o])return!1}return!0}(u.params,h.params)){var m=[],d=o.matchStyles(u.value,u.params,m),v=o.matchStyles(h.value,h.params,m);m.length?this._engine.reportError(m):this._engine.afterFlush((function(){L(t,d),D(t,v)}))}},t.prototype.deregister=function(t){var e=this;delete this._triggers[t],this._engine.statesByElement.forEach((function(e,n){delete e[t]})),this._elementListeners.forEach((function(n,r){e._elementListeners.set(r,n.filter((function(e){return e.name!=t})))}))},t.prototype.clearElementCache=function(t){this._engine.statesByElement.delete(t),this._elementListeners.delete(t);var e=this._engine.playersByElement.get(t);e&&(e.forEach((function(t){return t.destroy()})),this._engine.playersByElement.delete(t))},t.prototype._signalRemovalForInnerTriggers=function(t,e){var n=this,r=this._engine.driver.query(t,".ng-trigger",!0);r.forEach((function(t){if(!t.__ng_removed){var r=n._engine.fetchNamespacesByElement(t);r.size?r.forEach((function(n){return n.triggerLeaveAnimation(t,e,!1,!0)})):n.clearElementCache(t)}})),this._engine.afterFlushAnimationsDone((function(){return r.forEach((function(t){return n.clearElementCache(t)}))}))},t.prototype.triggerLeaveAnimation=function(t,e,n,r){var o=this,s=this._engine.statesByElement.get(t);if(s){var a=[];if(Object.keys(s).forEach((function(e){if(o._triggers[e]){var n=o.trigger(t,e,"void",r);n&&a.push(n)}})),a.length)return this._engine.markElementAsRemoved(this.id,t,!0,e),n&&i(a).onDone((function(){return o._engine.processLeaveNode(t)})),!0}return!1},t.prototype.prepareLeaveAnimationListeners=function(t){var e=this,n=this._elementListeners.get(t),r=this._engine.statesByElement.get(t);if(n&&r){var i=new Set;n.forEach((function(n){var o=n.name;if(!i.has(o)){i.add(o);var s=e._triggers[o].fallbackTransition,a=r[o]||xt,u=new Lt("void"),l=new Rt(e.id,o,t);e._engine.totalQueuedPlayers++,e._queue.push({element:t,triggerName:o,transition:s,fromState:a,toState:u,player:l,isFallbackTransition:!0})}}))}},t.prototype.removeNode=function(t,e){var n=this,r=this._engine;if(t.childElementCount&&this._signalRemovalForInnerTriggers(t,e),!this.triggerLeaveAnimation(t,e,!0)){var i=!1;if(r.totalAnimations){var o=r.players.length?r.playersByQueriedElement.get(t):[];if(o&&o.length)i=!0;else for(var s=t;s=s.parentNode;)if(r.statesByElement.get(s)){i=!0;break}}if(this.prepareLeaveAnimationListeners(t),i)r.markElementAsRemoved(this.id,t,!1,e);else{var a=t.__ng_removed;a&&a!==Ft||(r.afterFlush((function(){return n.clearElementCache(t)})),r.destroyInnerAnimations(t),r._onRemovalComplete(t,e))}}},t.prototype.insertNode=function(t,e){Mt(t,this._hostClassName)},t.prototype.drainQueuedTransitions=function(t){var e=this,n=[];return this._queue.forEach((function(r){var i=r.player;if(!i.destroyed){var o=r.element,a=e._elementListeners.get(o);a&&a.forEach((function(e){if(e.name==r.triggerName){var n=u(o,r.triggerName,r.fromState.value,r.toState.value);n._data=t,s(r.player,e.phase,n,e.callback)}})),i.markedForDestroy?e._engine.afterFlush((function(){i.destroy()})):n.push(r)}})),this._queue=[],n.sort((function(t,n){var r=t.transition.ast.depCount,i=n.transition.ast.depCount;return 0==r||0==i?r-i:e._engine.driver.containsElement(t.element,n.element)?1:-1}))},t.prototype.destroy=function(t){this.players.forEach((function(t){return t.destroy()})),this._signalRemovalForInnerTriggers(this.hostElement,t)},t.prototype.elementContainsData=function(t){var e=!1;return this._elementListeners.has(t)&&(e=!0),!!this._queue.find((function(e){return e.element===t}))||e},t}(),qt=function(){function t(t,e,n){this.bodyNode=t,this.driver=e,this._normalizer=n,this.players=[],this.newHostElements=new Map,this.playersByElement=new Map,this.playersByQueriedElement=new Map,this.statesByElement=new Map,this.disabledNodes=new Set,this.totalAnimations=0,this.totalQueuedPlayers=0,this._namespaceLookup={},this._namespaceList=[],this._flushFns=[],this._whenQuietFns=[],this.namespacesByHostElement=new Map,this.collectedEnterElements=[],this.collectedLeaveElements=[],this.onRemovalComplete=function(t,e){}}return t.prototype._onRemovalComplete=function(t,e){this.onRemovalComplete(t,e)},Object.defineProperty(t.prototype,"queuedPlayers",{get:function(){var t=[];return this._namespaceList.forEach((function(e){e.players.forEach((function(e){e.queued&&t.push(e)}))})),t},enumerable:!1,configurable:!0}),t.prototype.createNamespace=function(t,e){var n=new jt(t,e,this);return this.bodyNode&&this.driver.containsElement(this.bodyNode,e)?this._balanceNamespaceList(n,e):(this.newHostElements.set(e,n),this.collectEnterElement(e)),this._namespaceLookup[t]=n},t.prototype._balanceNamespaceList=function(t,e){var n=this._namespaceList.length-1;if(n>=0){for(var r=!1,i=n;i>=0;i--)if(this.driver.containsElement(this._namespaceList[i].hostElement,e)){this._namespaceList.splice(i+1,0,t),r=!0;break}r||this._namespaceList.splice(0,0,t)}else this._namespaceList.push(t);return this.namespacesByHostElement.set(e,t),t},t.prototype.register=function(t,e){var n=this._namespaceLookup[t];return n||(n=this.createNamespace(t,e)),n},t.prototype.registerTrigger=function(t,e,n){var r=this._namespaceLookup[t];r&&r.register(e,n)&&this.totalAnimations++},t.prototype.destroy=function(t,e){var n=this;if(t){var r=this._fetchNamespace(t);this.afterFlush((function(){n.namespacesByHostElement.delete(r.hostElement),delete n._namespaceLookup[t];var e=n._namespaceList.indexOf(r);e>=0&&n._namespaceList.splice(e,1)})),this.afterFlushAnimationsDone((function(){return r.destroy(e)}))}},t.prototype._fetchNamespace=function(t){return this._namespaceLookup[t]},t.prototype.fetchNamespacesByElement=function(t){var e=new Set,n=this.statesByElement.get(t);if(n)for(var r=Object.keys(n),i=0;i<r.length;i++){var o=n[r[i]].namespaceId;if(o){var s=this._fetchNamespace(o);s&&e.add(s)}}return e},t.prototype.trigger=function(t,e,n,r){if(Kt(e)){var i=this._fetchNamespace(t);if(i)return i.trigger(e,n,r),!0}return!1},t.prototype.insertNode=function(t,e,n,r){if(Kt(e)){var i=e.__ng_removed;if(i&&i.setForRemoval){i.setForRemoval=!1,i.setForMove=!0;var o=this.collectedLeaveElements.indexOf(e);o>=0&&this.collectedLeaveElements.splice(o,1)}if(t){var s=this._fetchNamespace(t);s&&s.insertNode(e,n)}r&&this.collectEnterElement(e)}},t.prototype.collectEnterElement=function(t){this.collectedEnterElements.push(t)},t.prototype.markElementAsDisabled=function(t,e){e?this.disabledNodes.has(t)||(this.disabledNodes.add(t),Mt(t,"ng-animate-disabled")):this.disabledNodes.has(t)&&(this.disabledNodes.delete(t),zt(t,"ng-animate-disabled"))},t.prototype.removeNode=function(t,e,n,r){if(Kt(e)){var i=t?this._fetchNamespace(t):null;if(i?i.removeNode(e,r):this.markElementAsRemoved(t,e,!1,r),n){var o=this.namespacesByHostElement.get(e);o&&o.id!==t&&o.removeNode(e,r)}}else this._onRemovalComplete(e,r)},t.prototype.markElementAsRemoved=function(t,e,n,r){this.collectedLeaveElements.push(e),e.__ng_removed={namespaceId:t,setForRemoval:r,hasAnimation:n,removedBeforeQueried:!1}},t.prototype.listen=function(t,e,n,r,i){return Kt(e)?this._fetchNamespace(t).listen(e,n,r,i):function(){}},t.prototype._buildInstruction=function(t,e,n,r,i){return t.transition.build(this.driver,t.element,t.fromState.value,t.toState.value,n,r,t.fromState.options,t.toState.options,e,i)},t.prototype.destroyInnerAnimations=function(t){var e=this,n=this.driver.query(t,".ng-trigger",!0);n.forEach((function(t){return e.destroyActiveAnimationsForElement(t)})),0!=this.playersByQueriedElement.size&&(n=this.driver.query(t,".ng-animating",!0)).forEach((function(t){return e.finishActiveQueriedAnimationOnElement(t)}))},t.prototype.destroyActiveAnimationsForElement=function(t){var e=this.playersByElement.get(t);e&&e.forEach((function(t){t.queued?t.markedForDestroy=!0:t.destroy()}))},t.prototype.finishActiveQueriedAnimationOnElement=function(t){var e=this.playersByQueriedElement.get(t);e&&e.forEach((function(t){return t.finish()}))},t.prototype.whenRenderingDone=function(){var t=this;return new Promise((function(e){if(t.players.length)return i(t.players).onDone((function(){return e()}));e()}))},t.prototype.processLeaveNode=function(t){var e=this,n=t.__ng_removed;if(n&&n.setForRemoval){if(t.__ng_removed=Ft,n.namespaceId){this.destroyInnerAnimations(t);var r=this._fetchNamespace(n.namespaceId);r&&r.clearElementCache(t)}this._onRemovalComplete(t,n.setForRemoval)}this.driver.matchesElement(t,".ng-animate-disabled")&&this.markElementAsDisabled(t,!1),this.driver.query(t,".ng-animate-disabled",!0).forEach((function(t){e.markElementAsDisabled(t,!1)}))},t.prototype.flush=function(t){var e=this;void 0===t&&(t=-1);var n=[];if(this.newHostElements.size&&(this.newHostElements.forEach((function(t,n){return e._balanceNamespaceList(t,n)})),this.newHostElements.clear()),this.totalAnimations&&this.collectedEnterElements.length)for(var r=0;r<this.collectedEnterElements.length;r++)Mt(this.collectedEnterElements[r],"ng-star-inserted");if(this._namespaceList.length&&(this.totalQueuedPlayers||this.collectedLeaveElements.length)){var o=[];try{n=this._flushAnimations(o,t)}finally{for(r=0;r<o.length;r++)o[r]()}}else for(r=0;r<this.collectedLeaveElements.length;r++)this.processLeaveNode(this.collectedLeaveElements[r]);if(this.totalQueuedPlayers=0,this.collectedEnterElements.length=0,this.collectedLeaveElements.length=0,this._flushFns.forEach((function(t){return t()})),this._flushFns=[],this._whenQuietFns.length){var s=this._whenQuietFns;this._whenQuietFns=[],n.length?i(n).onDone((function(){s.forEach((function(t){return t()}))})):s.forEach((function(t){return t()}))}},t.prototype.reportError=function(t){throw new Error("Unable to process animations due to the following failed trigger transitions\n "+t.join("\n"))},t.prototype._flushAnimations=function(t,n){var r=this,o=new st,s=[],a=new Map,u=[],h=new Map,c=new Map,p=new Map,f=new Set;this.disabledNodes.forEach((function(t){f.add(t);for(var e=r.driver.query(t,".ng-animate-queued",!0),n=0;n<e.length;n++)f.add(e[n])}));var y=this.bodyNode,m=Array.from(this.statesByElement.keys()),d=It(m,this.collectedEnterElements),v=new Map,g=0;d.forEach((function(t,e){var n="ng-enter"+g++;v.set(e,n),t.forEach((function(t){return Mt(t,n)}))}));for(var _=[],S=new Set,E=new Set,b=0;b<this.collectedLeaveElements.length;b++)(I=(B=this.collectedLeaveElements[b]).__ng_removed)&&I.setForRemoval&&(_.push(B),S.add(B),I.hasAnimation?this.driver.query(B,".ng-star-inserted",!0).forEach((function(t){return S.add(t)})):E.add(B));var T=new Map,w=It(m,Array.from(S));w.forEach((function(t,e){var n="ng-leave"+g++;T.set(e,n),t.forEach((function(t){return Mt(t,n)}))})),t.push((function(){d.forEach((function(t,e){var n=v.get(e);t.forEach((function(t){return zt(t,n)}))})),w.forEach((function(t,e){var n=T.get(e);t.forEach((function(t){return zt(t,n)}))})),_.forEach((function(t){r.processLeaveNode(t)}))}));for(var P=[],k=[],A=this._namespaceList.length-1;A>=0;A--)this._namespaceList[A].drainQueuedTransitions(n).forEach((function(t){var e=t.player,n=t.element;if(P.push(e),r.collectedEnterElements.length){var i=n.__ng_removed;if(i&&i.setForMove)return void e.destroy()}var a=!y||!r.driver.containsElement(y,n),f=T.get(n),m=v.get(n),d=r._buildInstruction(t,o,m,f,a);if(d.errors&&d.errors.length)k.push(d);else{if(a)return e.onStart((function(){return L(n,d.fromStyles)})),e.onDestroy((function(){return D(n,d.toStyles)})),void s.push(e);if(t.isFallbackTransition)return e.onStart((function(){return L(n,d.fromStyles)})),e.onDestroy((function(){return D(n,d.toStyles)})),void s.push(e);d.timelines.forEach((function(t){return t.stretchStartingKeyframe=!0})),o.append(n,d.timelines),u.push({instruction:d,player:e,element:n}),d.queriedElements.forEach((function(t){return l(h,t,[]).push(e)})),d.preStyleProps.forEach((function(t,e){var n=Object.keys(t);if(n.length){var r=c.get(e);r||c.set(e,r=new Set),n.forEach((function(t){return r.add(t)}))}})),d.postStyleProps.forEach((function(t,e){var n=Object.keys(t),r=p.get(e);r||p.set(e,r=new Set),n.forEach((function(t){return r.add(t)}))}))}}));if(k.length){var N=[];k.forEach((function(t){N.push("@"+t.triggerName+" has failed due to:\n"),t.errors.forEach((function(t){return N.push("- "+t+"\n")}))})),P.forEach((function(t){return t.destroy()})),this.reportError(N)}var O=new Map,C=new Map;u.forEach((function(t){var e=t.element;o.has(e)&&(C.set(e,e),r._beforeAnimationBuild(t.player.namespaceId,t.instruction,O))})),s.forEach((function(t){var e=t.element;r._getPreviousPlayers(e,!1,t.namespaceId,t.triggerName,null).forEach((function(t){l(O,e,[]).push(t),t.destroy()}))}));var F=_.filter((function(t){return Wt(t,c,p)})),x=new Map;Bt(x,this.driver,E,p,e.AUTO_STYLE).forEach((function(t){Wt(t,c,p)&&F.push(t)}));var j=new Map;d.forEach((function(t,n){Bt(j,r.driver,new Set(t),c,e.ɵPRE_STYLE)})),F.forEach((function(t){var e=x.get(t),n=j.get(t);x.set(t,Object.assign(Object.assign({},e),n))}));var q=[],R=[],K={};u.forEach((function(t){var e=t.element,n=t.player,u=t.instruction;if(o.has(e)){if(f.has(e))return n.onDestroy((function(){return D(e,u.toStyles)})),n.disabled=!0,n.overrideTotalTime(u.totalTime),void s.push(n);var l=K;if(C.size>1){for(var h=e,c=[];h=h.parentNode;){var p=C.get(h);if(p){l=p;break}c.push(h)}c.forEach((function(t){return C.set(t,l)}))}var y=r._buildAnimation(n.namespaceId,u,O,a,j,x);if(n.setRealPlayer(y),l===K)q.push(n);else{var m=r.playersByElement.get(l);m&&m.length&&(n.parentPlayer=i(m)),s.push(n)}}else L(e,u.fromStyles),n.onDestroy((function(){return D(e,u.toStyles)})),R.push(n),f.has(e)&&s.push(n)})),R.forEach((function(t){var e=a.get(t.element);if(e&&e.length){var n=i(e);t.setRealPlayer(n)}})),s.forEach((function(t){t.parentPlayer?t.syncPlayerEvents(t.parentPlayer):t.destroy()}));for(var Q=0;Q<_.length;Q++){var B,I=(B=_[Q]).__ng_removed;if(zt(B,"ng-leave"),!I||!I.hasAnimation){var M=[];if(h.size){var z=h.get(B);z&&z.length&&M.push.apply(M,H(z));for(var U=this.driver.query(B,".ng-animating",!0),W=0;W<U.length;W++){var $=h.get(U[W]);$&&$.length&&M.push.apply(M,H($))}}var Y=M.filter((function(t){return!t.destroyed}));Y.length?Ut(this,B,Y):this.processLeaveNode(B)}}return _.length=0,q.forEach((function(t){r.players.push(t),t.onDone((function(){t.destroy();var e=r.players.indexOf(t);r.players.splice(e,1)})),t.play()})),q},t.prototype.elementContainsData=function(t,e){var n=!1,r=e.__ng_removed;return r&&r.setForRemoval&&(n=!0),this.playersByElement.has(e)&&(n=!0),this.playersByQueriedElement.has(e)&&(n=!0),this.statesByElement.has(e)&&(n=!0),this._fetchNamespace(t).elementContainsData(e)||n},t.prototype.afterFlush=function(t){this._flushFns.push(t)},t.prototype.afterFlushAnimationsDone=function(t){this._whenQuietFns.push(t)},t.prototype._getPreviousPlayers=function(t,e,n,r,i){var o=[];if(e){var s=this.playersByQueriedElement.get(t);s&&(o=s)}else{var a=this.playersByElement.get(t);if(a){var u=!i||"void"==i;a.forEach((function(t){t.queued||(u||t.triggerName==r)&&o.push(t)}))}}return(n||r)&&(o=o.filter((function(t){return!(n&&n!=t.namespaceId||r&&r!=t.triggerName)}))),o},t.prototype._beforeAnimationBuild=function(t,e,n){var r,i,o=e.element,s=e.isRemovalTransition?void 0:t,a=e.isRemovalTransition?void 0:e.triggerName,u=function(t){var r=t.element,i=r!==o,u=l(n,r,[]);h._getPreviousPlayers(r,i,s,a,e.toState).forEach((function(t){var e=t.getRealPlayer();e.beforeDestroy&&e.beforeDestroy(),t.destroy(),u.push(t)}))},h=this;try{for(var c=function p(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}(e.timelines),f=c.next();!f.done;f=c.next())u(f.value)}catch(t){r={error:t}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}L(o,e.fromStyles)},t.prototype._buildAnimation=function(t,n,r,s,a,u){var h=this,c=n.triggerName,p=n.element,f=[],y=new Set,m=new Set,d=n.timelines.map((function(n){var i=n.element;y.add(i);var l=i.__ng_removed;if(l&&l.removedBeforeQueried)return new e.NoopAnimationPlayer(n.duration,n.delay);var d=i!==p,v=function g(t){var n=[];return function t(n,r){for(var i=0;i<n.length;i++){var o=n[i];o instanceof e.ɵAnimationGroupPlayer?t(o.players,r):r.push(o)}}(t,n),n}((r.get(i)||Ct).map((function(t){return t.getRealPlayer()}))).filter((function(t){return!!t.element&&t.element===i})),_=a.get(i),S=u.get(i),E=o(0,h._normalizer,0,n.keyframes,_,S),b=h._buildPlayer(n,E,v);if(n.subTimeline&&s&&m.add(i),d){var T=new Rt(t,c,i);T.setRealPlayer(b),f.push(T)}return b}));f.forEach((function(t){l(h.playersByQueriedElement,t.element,[]).push(t),t.onDone((function(){return function e(t,n,r){var i;if(t instanceof Map){if(i=t.get(n)){if(i.length){var o=i.indexOf(r);i.splice(o,1)}0==i.length&&t.delete(n)}}else(i=t[n])&&(i.length&&(o=i.indexOf(r),i.splice(o,1)),0==i.length&&delete t[n]);return i}(h.playersByQueriedElement,t.element,t)}))})),y.forEach((function(t){return Mt(t,"ng-animating")}));var v=i(d);return v.onDestroy((function(){y.forEach((function(t){return zt(t,"ng-animating")})),D(p,n.toStyles)})),m.forEach((function(t){l(s,t,[]).push(v)})),v},t.prototype._buildPlayer=function(t,n,r){return n.length>0?this.driver.animate(t.element,n,t.duration,t.delay,t.easing,r):new e.NoopAnimationPlayer(t.duration,t.delay)},t}(),Rt=function(){function t(t,n,r){this.namespaceId=t,this.triggerName=n,this.element=r,this._player=new e.NoopAnimationPlayer,this._containsRealPlayer=!1,this._queuedCallbacks={},this.destroyed=!1,this.markedForDestroy=!1,this.disabled=!1,this.queued=!0,this.totalTime=0}return t.prototype.setRealPlayer=function(t){var e=this;this._containsRealPlayer||(this._player=t,Object.keys(this._queuedCallbacks).forEach((function(n){e._queuedCallbacks[n].forEach((function(e){return s(t,n,void 0,e)}))})),this._queuedCallbacks={},this._containsRealPlayer=!0,this.overrideTotalTime(t.totalTime),this.queued=!1)},t.prototype.getRealPlayer=function(){return this._player},t.prototype.overrideTotalTime=function(t){this.totalTime=t},t.prototype.syncPlayerEvents=function(t){var e=this,n=this._player;n.triggerCallback&&t.onStart((function(){return n.triggerCallback("start")})),t.onDone((function(){return e.finish()})),t.onDestroy((function(){return e.destroy()}))},t.prototype._queueEvent=function(t,e){l(this._queuedCallbacks,t,[]).push(e)},t.prototype.onDone=function(t){this.queued&&this._queueEvent("done",t),this._player.onDone(t)},t.prototype.onStart=function(t){this.queued&&this._queueEvent("start",t),this._player.onStart(t)},t.prototype.onDestroy=function(t){this.queued&&this._queueEvent("destroy",t),this._player.onDestroy(t)},t.prototype.init=function(){this._player.init()},t.prototype.hasStarted=function(){return!this.queued&&this._player.hasStarted()},t.prototype.play=function(){!this.queued&&this._player.play()},t.prototype.pause=function(){!this.queued&&this._player.pause()},t.prototype.restart=function(){!this.queued&&this._player.restart()},t.prototype.finish=function(){this._player.finish()},t.prototype.destroy=function(){this.destroyed=!0,this._player.destroy()},t.prototype.reset=function(){!this.queued&&this._player.reset()},t.prototype.setPosition=function(t){this.queued||this._player.setPosition(t)},t.prototype.getPosition=function(){return this.queued?0:this._player.getPosition()},t.prototype.triggerCallback=function(t){var e=this._player;e.triggerCallback&&e.triggerCallback(t)},t}();function Kt(t){return t&&1===t.nodeType}function Qt(t,e){var n=t.style.display;return t.style.display=null!=e?e:"none",n}function Bt(t,e,n,r,i){var o=[];n.forEach((function(t){return o.push(Qt(t))}));var s=[];r.forEach((function(n,r){var o={};n.forEach((function(t){var n=o[t]=e.computeStyle(r,t,i);n&&0!=n.length||(r.__ng_removed=Dt,s.push(r))})),t.set(r,o)}));var a=0;return n.forEach((function(t){return Qt(t,o[a++])})),s}function It(t,e){var n=new Map;if(t.forEach((function(t){return n.set(t,[])})),0==e.length)return n;var r=new Set(e),i=new Map;return e.forEach((function(t){var e=function t(e){if(!e)return 1;var o=i.get(e);if(o)return o;var s=e.parentNode;return o=n.has(s)?s:r.has(s)?1:t(s),i.set(e,o),o}(t);1!==e&&n.get(e).push(t)})),n}function Mt(t,e){if(t.classList)t.classList.add(e);else{var n=t.$$classes;n||(n=t.$$classes={}),n[e]=!0}}function zt(t,e){if(t.classList)t.classList.remove(e);else{var n=t.$$classes;n&&delete n[e]}}function Ut(t,e,n){i(n).onDone((function(){return t.processLeaveNode(e)}))}function Wt(t,e,n){var r=n.get(t);if(!r)return!1;var i=e.get(t);return i?r.forEach((function(t){return i.add(t)})):e.set(t,r),n.delete(t),!0}var $t=function(){function t(t,e,n){var r=this;this.bodyNode=t,this._driver=e,this._triggerCache={},this.onRemovalComplete=function(t,e){},this._transitionEngine=new qt(t,e,n),this._timelineEngine=new Ot(t,e,n),this._transitionEngine.onRemovalComplete=function(t,e){return r.onRemovalComplete(t,e)}}return t.prototype.registerTrigger=function(t,e,n,r,i){var o=t+"-"+r,s=this._triggerCache[o];if(!s){var a=[],u=X(this._driver,i,a);if(a.length)throw new Error('The animation trigger "'+r+'" has failed to build due to the following errors:\n - '+a.join("\n - "));s=function l(t,e){return new kt(t,e)}(r,u),this._triggerCache[o]=s}this._transitionEngine.registerTrigger(e,r,s)},t.prototype.register=function(t,e){this._transitionEngine.register(t,e)},t.prototype.destroy=function(t,e){this._transitionEngine.destroy(t,e)},t.prototype.onInsert=function(t,e,n,r){this._transitionEngine.insertNode(t,e,n,r)},t.prototype.onRemove=function(t,e,n,r){this._transitionEngine.removeNode(t,e,r||!1,n)},t.prototype.disableAnimations=function(t,e){this._transitionEngine.markElementAsDisabled(t,e)},t.prototype.process=function(t,e,n,r){if("@"==n.charAt(0)){var i=Y(h(n),2);this._timelineEngine.command(i[0],e,i[1],r)}else this._transitionEngine.trigger(t,e,n,r)},t.prototype.listen=function(t,e,n,r,i){if("@"==n.charAt(0)){var o=Y(h(n),2);return this._timelineEngine.listen(o[0],e,o[1],i)}return this._transitionEngine.listen(t,e,n,r,i)},t.prototype.flush=function(t){void 0===t&&(t=-1),this._transitionEngine.flush(t)},Object.defineProperty(t.prototype,"players",{get:function(){return this._transitionEngine.players.concat(this._timelineEngine.players)},enumerable:!1,configurable:!0}),t.prototype.whenRenderingDone=function(){return this._transitionEngine.whenRenderingDone()},t}();
|
|
49
49
|
/**
|
|
50
50
|
* @license
|
|
51
51
|
* Copyright Google LLC All Rights Reserved.
|