webpackJsonpCoveo__temporary([59],{288:function(t,e,n){"use strict";function o(t){return"notify"===t.type}function i(t){return"redirect"===t.type}function r(t){return"query"===t.type}function s(t){return"execute"===t.type}var c=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}();Object.defineProperty(e,"__esModule",{value:!0});var u=n(7),a=n(8),l=n(5),p=n(11),g=n(1),y=n(10),f=n(13),h=n(2),m=n(0),d=n(3);n(679);var v=n(74),w=function(t){function e(n,o,i,r){var s=t.call(this,n,e.ID,i)||this;return s.element=n,s.options=o,s.bindings=i,s._window=r,s._window=s._window||window,s.options=a.ComponentOptions.initComponentOptions(n,e,o),l.Assert.exists(n),l.Assert.exists(s.options),s.notifications=[],s.bind.onRootElement(p.QueryEvents.querySuccess,s.handleProcessNewQueryResults),s}return c(e,t),e.prototype.handleProcessNewQueryResults=function(t){if(l.Assert.exists(t),l.Assert.exists(t.results),g.$$(this.element).empty(),this.notifications=[],v.Utils.isNullOrUndefined(t.results.triggers))return void g.$$(this.element).removeClass("coveo-visible");var e=[],n=null,c=null,u=null;t.results.triggers.forEach(function(t){o(t)?e.push(t):i(t)?n=n||t:r(t)?c=c||t:s(t)&&(u=u||t)}),e.length&&(this.processNotifyTriggers(e),g.$$(this.element).addClass("coveo-visible")),n&&this.processRedirectTrigger(n),c&&this.processQueryTrigger(c),u&&this.processExecuteTrigger(u,t.query)},e.prototype.processNotifyTriggers=function(t){var e=this;this.usageAnalytics.logCustomEvent(y.analyticsActionCauseList.triggerNotify,{notifications:t.map(function(t){return t.content})},this.element),t.forEach(function(t){e.notifications.push(t.content),e.element.appendChild(g.$$("div",{className:"coveo-trigger-notify"},t.content).el)})},e.prototype.processRedirectTrigger=function(t){this.usageAnalytics.logCustomEvent(y.analyticsActionCauseList.triggerRedirect,{redirectedTo:t.content},this.element),this._window.location.replace(t.content)},e.prototype.processQueryTrigger=function(t){var e=this;this.queryStateModel.set(f.QueryStateModel.attributesEnum.q,t.content),this.queryController.executeQuery({beforeExecuteQuery:function(){e.usageAnalytics.logCustomEvent(y.analyticsActionCauseList.triggerQuery,{query:t.content},e.element)}})},e.prototype.processExecuteTrigger=function(t,e){try{var n=this._window[""+t.content.name];if("function"==typeof n){var o=m.object(m.map(t.content.params,function(t,e){return["param"+(e+1),t]}));o.element=this.element,this.usageAnalytics.logCustomEvent(y.analyticsActionCauseList.triggerExecute,{executions:[{functionName:t.content.name,params:t.content.params}]},this.element),n.apply(this._window,[o])}else this.logger.error("A trigger tried to call the function '"+t.content.name+"', which doesn't exist.",this,e,t)}catch(n){this.logger.error("A trigger called the function '"+t.content.name+"', which threw an error.",this,e,t)}},e.ID="Triggers",e.options={},e.doExport=function(){d.exportGlobally({Triggers:e})},e}(u.Component);e.Triggers=w,h.Initialization.registerAutoCreateComponent(w)},679:function(t,e){}});
//# sourceMappingURL=Triggers.min__a9eab0177c0d546e03ad.js.map