module.exports = "(function(e,n,t){var i=t(5894),a=t(7358),r=t(343),c=t(6322),o=t(280).v,d=t(9404),g=t(4527),s=t(1571),p=t(4810),h=t(4727).Promise,u=t(4365),A=g.get(\"stores/global\"),f=g.get(\"stores/action_data\"),l=g.get(\"stores/change_data\"),_=g.get(\"stores/session\"),v=t(1148);t(4721).initialize();var I=o(\"ActionError\");function E(e,n,t){if(!f.getActionState(n.id))return p.warn(\"Action / Attempted to prepare change for inactive action: \",n),void 0;var r=f.getChangeApplier(e.id,n.id);if(!i.isUndefined(r))return p.warn(\"Action / Attempted to prepare a change which is already being applied: \",e),void 0;var c={changeId:e.id,actionId:n.id,changeApplier:v.create(e,n,t)};s.dispatch(a.SET_CHANGE_APPLIER,c)}function m(e,n,a,o){if(i.includes(o,n))return p.error(\"Change with id \"+n+\" has circular dependencies: \"+o.concat(n)),void 0;if(!e[String(n)]){var g=l.getChange(n);if(!g){var s=\"Change with id \"+n+\" is absent\";return o.length&&(s+=\" but listed as a dependency for \"+o[o.length-1]),p.warn(s),void 0}e[String(n)]=new h((function(s){var A=i.map(g.dependencies||[],(function(t){return m(e,t,a,o.concat([n]))}));if(g.src){var _=\"change_\"+g.src,v=c.makeAsyncRequest(_,(function(){return u.addScriptAsync(__ASYNC_BASE_URL__+g.src,(function(){c.resolveRequest(_)}))})).then((function(){var e=l.getChange(g.id);e||r.emitError(new I(\"Failed to load async change from src: \"+g.src)),E(e,a,d.now())}));A.push(v)}h.all(A).then((function(){var e=d.now(),i=f.getChangeApplier(n,a.id);return i?(p.debug(\"Action / Applying change:\",g),i.apply().then((function(n){n?p.log(n):p.debug(\"Action / Applied change for the first time in \"+(d.now()-e)+\"ms:\",g),(__PROFILE__||__RUM_VERBOSE__)&&t(9256).timeEnd(\"flash\"),s()}))):(p.debug(\"Action / Not applying change \",n,\" - No changeApplier found.\"),s(),void 0)})).catch((function(e){p.error(\"Action / Failed to apply change:\",g,e),s()}))}))}return e[String(n)]}n.prepareAction=function(e){__INVARIANT__&&t(2048).isType(\"ActionData\",e),p.debug(\"Action / Preparing:\",e),s.dispatch(a.ACTION_EXECUTED,{actionId:e.id,sessionId:_.getSessionId(),layerId:e.layerId,pageId:e.pageId,timestamp:d.now(),activationId:A.getActivationId()});var n=d.now();i.forEach(e.changeSet,(function(t){var r=i.isObject(t)?t.id:t,c=l.getChange(r);c||(s.dispatch(a.ADD_CHANGE,t),c=l.getChange(t.id)),c.src||E(c,e,n)}))},n.executePreparedAction=function(e){__INVARIANT__&&t(2048).isType(\"ActionData\",e),p.debug(\"Action / Executing:\",e);var n={},a=i.map(e.changeSet,(function(t){var a=i.isObject(t)?t.id:t;return m(n,a,e,[])}));return h.all(a).then((function(){p.debug(\"changes for action id=\"+e.id+\" applied\")}))}})";