coveo-search-ui
Version:
Coveo JavaScript Search Framework
2 lines • 52.2 kB
JavaScript
webpackJsonpCoveo__temporary([15,19],{118:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(7),o=n(93),s=n(1),r=n(0),l=n(9),a=function(){function e(){}return e.hideIfInfiniteScrollEnabled=function(t){e.isInfiniteScrollEnabled(t.searchInterface.element)?(t.disable(),s.$$(t.element).hide(),e.warnIfComponentNotNeeded(t)):(t.enable(),s.$$(t.element).unhide())},e.isInfiniteScrollEnabled=function(t){var n=e.getMainResultList(t);return!!n&&!!n.options.enableInfiniteScroll},e.scrollToTop=function(t){var n=e.getMainResultList(t);if(!n)return new l.Logger(this).warn("No active ResultList, scrolling to the top of the Window"),window.scrollTo(0,0);var i=n.searchInterface.element.getBoundingClientRect().top;i>0||window.scrollTo(0,window.pageYOffset+i)},e.getMainResultList=function(t){var n=e.getResultLists(t);return r.find(n,function(e){var t=e.searchInterface.element.classList.contains("CoveoRecommendation");return!e.disabled&&!t})},e.getResultLists=function(t){return s.$$(t).findAll("."+e.cssClass()).map(function(e){return i.Component.get(e,o.ResultList)})},e.cssClass=function(){return i.Component.computeCssClassName(o.ResultList)},e.warnIfComponentNotNeeded=function(t){var n=t.searchInterface.root;e.allResultListsUseInfiniteScroll(n)&&e.notNeededComponentWarning(t)},e.allResultListsUseInfiniteScroll=function(t){return 0===e.getResultLists(t).filter(function(e){return!e.options.enableInfiniteScroll}).length},e.notNeededComponentWarning=function(t){var n=i.Component.computeCssClassNameForType(t.type),o="The "+n+" component is not needed because all "+e.cssClass()+" components have enableInfiniteScroll set to 'true'.\n For the best performance, remove the "+n+" component from your search page.";new l.Logger(t).warn(o)},e}();t.ResultListUtils=a},215:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(7),o=n(0),s=function(){function e(e,t){this.resultListOptions=e,this.autoCreateComponentsFn=t}return e.prototype.renderResults=function(e,t,n){var s=this;return void 0===t&&(t=!1),Promise.all([this.getStartFragment(e,t),this.getEndFragment(e,t)]).then(function(t){var r=t[0],l=t[1],a=document.createDocumentFragment();r&&a.appendChild(r),o.each(e,function(e){a.appendChild(e),n(i.Component.getResult(e),e)}),l&&a.appendChild(l),s.resultListOptions.resultsContainer.appendChild(a)})},e.prototype.getStartFragment=function(e,t){return Promise.resolve(document.createDocumentFragment())},e.prototype.getEndFragment=function(e,t){return Promise.resolve(document.createDocumentFragment())},e}();t.ResultListRenderer=s},277:function(e,t,n){"use strict";var i=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}();Object.defineProperty(t,"__esModule",{value:!0}),n(667);var o=n(0),s=n(17),r=n(11),l=n(29),a=n(3),u=n(5),c=n(18),p=n(13),h=n(6),d=n(15),f=n(24),m=n(1),g=n(118),y=n(10),v=n(7),C=n(8),T=n(2),b=n(0),R=function(e){function t(n,i,o){var l=e.call(this,n,t.ID,o)||this;return l.element=n,l.options=i,l.options=C.ComponentOptions.initComponentOptions(n,t,i),l.bind.onRootElement(s.InitializationEvents.afterInitialization,function(){return l.resolveInitialState()}),l.bind.onRootElement(r.QueryEvents.querySuccess,function(e){return l.handleQuerySuccess(e)}),l.bind.onRootElement(r.QueryEvents.queryError,function(){return l.handleQueryError()}),l.bind.onRootElement(r.QueryEvents.noResults,function(e){return l.handleNoResults()}),l.bind.onQueryState(c.MODEL_EVENTS.CHANGE_ONE,p.QUERY_STATE_ATTRIBUTES.NUMBER_OF_RESULTS,function(e){return l.handleQueryStateModelChanged(e)}),l.addAlwaysActiveListeners(),l.initComponent(),l}return i(t,e),t.prototype.setResultsPerPage=function(e,t){void 0===t&&(t=y.analyticsActionCauseList.pagerResize),u.Assert.exists(e),u.Assert.check(this.isValidChoice(e),"The specified number of results is not available in the options."),this.updateResultsPerPage(e),this.updateQueryStateModelResultsPerPage(),this.logAnalyticsEvent(t),this.executeQuery()},Object.defineProperty(t.prototype,"resultsPerPage",{get:function(){return this.currentResultsPerPage},enumerable:!0,configurable:!0}),t.prototype.updateResultsPerPage=function(e){this.queryController.options.resultsPerPage=e,this.searchInterface.resultsPerPage=e,this.currentResultsPerPage=e},t.prototype.updateQueryStateModelResultsPerPage=function(){this.queryStateModel.set(p.QueryStateModel.attributesEnum.numberOfResults,this.currentResultsPerPage)},t.prototype.logAnalyticsEvent=function(e){this.usageAnalytics.logCustomEvent(e,{currentResultsPerPage:this.currentResultsPerPage},this.element)},t.prototype.executeQuery=function(){this.queryController.executeQuery({ignoreWarningSearchEvent:!0,keepLastSearchUid:!0,origin:this})},t.prototype.handleQueryStateModelChanged=function(e){var t=e.value;this.isValidChoice(t)?this.updateResultsPerPage(t):(this.logInvalidConfiguredChoiceWarning(t),this.resolveInitialState())},t.prototype.addAlwaysActiveListeners=function(){var e=this;this.searchInterface.element.addEventListener(l.ResultListEvents.newResultsDisplayed,function(){return g.ResultListUtils.hideIfInfiniteScrollEnabled(e)})},t.prototype.resolveInitialState=function(){this.updateResultsPerPage(this.getInitialChoice()),this.updateQueryStateModelResultsPerPage()},t.prototype.getInitialChoice=function(){var e=this.options.choicesDisplayed[0],t=this.options.initialChoice,n=this.queryStateModel.get(p.QueryStateModel.attributesEnum.numberOfResults);if(n!==p.QueryStateModel.defaultAttributes.numberOfResults&&this.isValidChoice(n))return n;if(void 0!==t){if(this.isValidChoice(t))return t;this.logInvalidConfiguredChoiceWarning(t)}return e},t.prototype.isValidChoice=function(e){return-1!==this.options.choicesDisplayed.indexOf(e)},t.prototype.logInvalidConfiguredChoiceWarning=function(e){var t=this.options.choicesDisplayed;this.logger.warn("The choice "+e+" is not within the choices displayed. Consider setting a value that is valid: "+t+". The first choice will be selected instead.")},t.prototype.initComponent=function(){this.span=m.$$("span",{id:b.uniqueId("coveo-results-per-page-text-"),className:"coveo-results-per-page-text"},h.l("ResultsPerPage")).el,this.element.appendChild(this.span),this.list=m.$$("ul",{className:"coveo-results-per-page-list","aria-labelledby":this.span.id}).el,this.element.appendChild(this.list)},t.prototype.render=function(){var e=this;m.$$(this.span).removeClass("coveo-results-per-page-no-results");for(var t=this.options.choicesDisplayed,n=this,i=0;i<t.length;i++)!function(){var o=m.$$("li",{className:"coveo-results-per-page-list-item"}).el,s=t[i],r=s===n.currentResultsPerPage;r&&m.$$(o).addClass("coveo-active");var l=function(t){t.stopPropagation(),e.handleClickPage(s)},a=m.$$("span",{className:"coveo-results-per-page-list-item-text",tabindex:0,ariaPressed:r.toString()},t[i].toString()).el;o.appendChild(a),o.addEventListener("click",function(e){return l(e)}),(new d.AccessibleButton).withElement(a).withLabel(h.l("DisplayResultsPerPage",t[i].toString())).withClickAction(l).withEnterKeyboardAction(l).build(),n.list.appendChild(o)}()},t.prototype.handleQueryError=function(){this.reset()},t.prototype.handleNoResults=function(){this.reset()},t.prototype.handleQuerySuccess=function(e){if(this.searchInterface.isResultsPerPageModifiedByPipeline){this.logger.info("Results per page was modified by backend code (query pipeline). ResultsPerPage component will be hidden",this),this.reset();var t=this.getInitialChoice();return void this.updateResultsPerPage(t)}0!=e.results.results.length&&(this.reset(),this.render())},t.prototype.handleClickPage=function(e){u.Assert.exists(e),this.setResultsPerPage(e)},t.prototype.reset=function(){m.$$(this.span).addClass("coveo-results-per-page-no-results"),m.$$(this.list).empty()},t.ID="ResultsPerPage",t.doExport=function(){a.exportGlobally({ResultsPerPage:t})},t.options={choicesDisplayed:C.ComponentOptions.buildCustomListOption(function(e){var t=o.map(e,function(e){return parseInt(e,10)});return 0==t.length?null:t},{defaultFunction:function(){return f.DeviceUtils.isMobileDevice()?[10,25,50]:[10,25,50,100]}}),initialChoice:C.ComponentOptions.buildNumberOption()},t}(v.Component);t.ResultsPerPage=R,T.Initialization.registerAutoCreateComponent(R)},40:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(22),o=n(21),s=n(121),r=n(33),l=n(4),a=n(1),u=n(0),c=n(6),p=function(){function e(){}return e.getRegexToUseForFacetSearch=function(e,t){return new RegExp(i.StringUtils.stringToRegex(e,t),"i")},e.getDisplayValueFromValueCaption=function(e,t,n){var i=this.tryToGetTranslatedCaption(t,e,!1);return n[e]||i},e.getValuesToUseForSearchInFacet=function(e,t){var n=[e],i=this.getRegexToUseForFacetSearch(e,t.options.facetSearchIgnoreAccents);return t.options.valueCaption?(u.chain(t.options.valueCaption).pairs().filter(function(e){return i.test(e[1])}).each(function(e){n.push(e[0])}),(o.QueryUtils.isStratusAgnosticField(t.options.field,"@objecttype")||o.QueryUtils.isStratusAgnosticField(t.options.field,"@filetype"))&&u.each(s.FileTypes.getFileTypeCaptions(),function(e,o){o in t.options.valueCaption||!i.test(e)||n.push(o)})):o.QueryUtils.isStratusAgnosticField(t.options.field,"@objecttype")||o.QueryUtils.isStratusAgnosticField(t.options.field,"@filetype")?u.each(u.filter(u.pairs(s.FileTypes.getFileTypeCaptions()),function(e){return i.test(e[1])}),function(e){n.push(e[0])}):o.QueryUtils.isStratusAgnosticField(t.options.field,"@month")&&u.each(u.range(1,13),function(e){i.test(r.DateUtils.monthToString(e-1))&&n.push(("0"+e.toString()).substr(-2))}),n},e.buildFacetSearchPattern=function(e){return e=u.map(e,function(e){return l.Utils.escapeRegexCharacter(e)}),e[0]=".*"+e[0]+".*",e.join("|")},e.needAnotherFacetSearch=function(e,t,n,i){return e<t&&e<i&&e>n},e.addNoStateCssClassToFacetValues=function(e,t){if(0!=e.values.getSelected().length){var n=a.$$(t).findAll("li:not(.coveo-selected)");u.each(n,function(e){a.$$(e).addClass("coveo-no-state")})}},e.tryToGetTranslatedCaption=function(t,n,i){void 0===i&&(i=!0);var a;if(o.QueryUtils.isStratusAgnosticField(t.toLowerCase(),"@filetype"))a=s.FileTypes.getFileType(n,i).caption;else if(o.QueryUtils.isStratusAgnosticField(t.toLowerCase(),"@objecttype"))a=s.FileTypes.getObjectType(n,i).caption;else if(e.isMonthFieldValue(t,n)){var u=parseInt(n,10);a=r.DateUtils.monthToString(u-1)}else i&&(a=c.l(n));return void 0!=a&&l.Utils.isNonEmptyString(a)?a:n},e.isMonthFieldValue=function(e,t){if(!o.QueryUtils.isStratusAgnosticField(e.toLowerCase(),"@month"))return!1;var n=parseInt(t,10);return!isNaN(n)&&!(n<1||n>12)},e}();t.FacetUtils=p},470:function(e,t,n){"use strict";var i=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=n(27),s=n(96),r=n(0),l=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.defaultTemplate='<td><a class="CoveoResultLink"></a></td>\n <td><span class="CoveoExcerpt"></span></td>\n <td><span class="CoveoFieldValue" data-field="@date" data-helper="date"></span></td>',t.defaultRoledTemplates={"table-header":'<th style="width: 40%">Link</th>\n <th>Excerpt</th>\n <th style="width: 20%"\n class="CoveoSort coveo-table-header-sort"\n data-sort-criteria="date ascending,date descending"\n data-display-unselected-icon="false">Date</th>',"table-footer":"<th>Link</th>\n <th>Excerpt</th>\n <th>Date</th>"},t}return i(t,e),t.prototype.instantiateRoleToString=function(e){var t=r.find(this.templates,function(t){return t.role===e});return t?t.instantiateToString(void 0,{}):this.defaultRoledTemplates[e]},t.prototype.instantiateRoleToElement=function(e){var t=this,n=r.find(this.templates,function(t){return t.role===e});if(n)return n.instantiateToElement(void 0,{});var i=new o.Template(function(){return t.defaultRoledTemplates[e]});return i.layout="table",i.instantiateToElement(void 0)},t.prototype.getFallbackTemplate=function(){var e=this;return new o.Template(function(){return e.defaultTemplate})},t.prototype.hasTemplateWithRole=function(e){return r.find(this.templates,function(t){return t.role===e})},t}(s.TemplateList);t.TableTemplate=l},472:function(e,t,n){"use strict";var i=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=n(27),s=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.instantiateToString=function(e){return'<div class="coveo-result-frame">\n <div class="coveo-result-row">\n <div class="coveo-result-cell" style="width:40px;text-align:center;vertical-align:middle;">\n <span class="CoveoIcon" data-small="true" data-with-label="false">\n </span>\n </div>\n <div class="coveo-result-cell" style="padding:0 0 3px 5px;vertical-align:middle">\n <div class="coveo-result-row">\n <div class="coveo-result-cell" style="font-size:10pt;">\n <a class="CoveoResultLink" style="display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis">\n </a>\n </div>\n </div>\n </div>\n </div>\n </div>'},t.prototype.instantiateToElement=function(e){var t=this;return new Promise(function(n,i){var o=document.createElement("div");o.innerHTML=t.instantiateToString(e),n(o)})},t}(o.Template);t.DefaultRecommendationTemplate=s},473:function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(o,s){function r(e){try{a(i.next(e))}catch(e){s(e)}}function l(e){try{a(i.throw(e))}catch(e){s(e)}}function a(e){e.done?o(e.value):new n(function(t){t(e.value)}).then(r,l)}a((i=i.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){function n(e){return function(t){return i([e,t])}}function i(n){if(o)throw new TypeError("Generator is already executing.");for(;a;)try{if(o=1,s&&(r=s[2&n[0]?"return":n[0]?"throw":"next"])&&!(r=r.call(s,n[1])).done)return r;switch(s=0,r&&(n=[0,r.value]),n[0]){case 0:case 1:r=n;break;case 4:return a.label++,{value:n[1],done:!1};case 5:a.label++,s=n[1],n=[0];continue;case 7:n=a.ops.pop(),a.trys.pop();continue;default:if(r=a.trys,!(r=r.length>0&&r[r.length-1])&&(6===n[0]||2===n[0])){a=0;continue}if(3===n[0]&&(!r||n[1]>r[0]&&n[1]<r[3])){a.label=n[1];break}if(6===n[0]&&a.label<r[1]){a.label=r[1],r=n;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(n);break}r[2]&&a.ops.pop(),a.trys.pop();continue}n=t.call(e,a)}catch(e){n=[6,e],s=0}finally{o=r=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var o,s,r,l,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return l={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(l[Symbol.iterator]=function(){return this}),l};Object.defineProperty(t,"__esModule",{value:!0});var s=n(20),r=n(93),l=n(0),a=n(1),u=n(9),c=function(){function e(e){this.args=e}return e.prototype.buildResults=function(e,t,n){return i(this,void 0,void 0,function(){var i,s,a=this;return o(this,function(o){return i=[],s=l.map(e.results,function(e,o){return a.buildResult(e,t,n).then(function(e){return null!=e&&i.push({elem:e,idx:o}),r.ResultList.resultCurrentlyBeingRendered=null,e})}),[2,Promise.all(s).then(function(){return l.pluck(l.sortBy(i,"idx"),"elem")})]})})},e.prototype.buildResult=function(e,t,n){return i(this,void 0,void 0,function(){var i;return o(this,function(o){switch(o.label){case 0:return s.Assert.exists(e),s.QueryUtils.setStateObjectOnQueryResult(this.args.queryStateModel.get(),e),s.QueryUtils.setSearchInterfaceObjectOnQueryResult(this.args.searchInterface,e),r.ResultList.resultCurrentlyBeingRendered=e,[4,this.createHtmlElement(e,t)];case 1:return i=o.sent(),null!=i&&s.Component.bindResultToElement(i,e),n.push(e),[4,this.autoCreateComponentsInsideResult(i,e).initResult];case 2:return o.sent(),this.verifyChildren(i),[2,i]}})})},e.prototype.autoCreateComponentsInsideResult=function(e,t){return s.Assert.exists(e),s.Initialization.automaticallyCreateComponentsInsideResult(e,t)},e.prototype.createHtmlElement=function(e,t){return this.args.resultTemplate.instantiateToElement(e,{wrapInDiv:!0,checkCondition:!0,currentLayout:t,responsiveComponents:this.args.searchInterface.responsiveComponents})},e.prototype.verifyChildren=function(e){a.$$(e).find(".CoveoResultLink")||new u.Logger(e).warn('Result does not contain a "CoveoResultLink" component, please verify the result template',this.args.resultTemplate)},e}();t.TemplateToHtml=c},474:function(e,t,n){"use strict";function i(){var e,t=E.Component.getComponentRef("ResultList");if(t&&(e=t.resultCurrentlyBeingRendered),!e){var n=E.Component.getComponentRef("Quickview");n&&(e=n.resultCurrentlyBeingRendered)}return e}function o(){var e=i();if(e)return e.termsToHighlight}function s(){var e=i();if(e)return e.phrasesToHighlight}function r(e,t){return d.Utils.isNonEmptyArray(w.keys(e))||d.Utils.isNonEmptyArray(w.keys(t))}var l=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++){t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e};Object.defineProperty(t,"__esModule",{value:!0});var a=n(122),u=n(69),c=n(33),p=n(135),h=n(179),d=n(4),f=n(22),m=n(73),g=n(178),y=n(21),v=n(24),C=n(1),T=n(53),b=n(120),R=n(40),S=n(23),w=n(0),E=n(7),H=n(68),O=function(){function e(){}return e.exportAllHelpersGlobally=function(e){w.each(a.TemplateHelpers.getHelpers(),function(t,n){void 0==e[n]&&(e[n]=t)})},e}();t.CoreHelpers=O,a.TemplateHelpers.registerFieldHelper("javascriptEncode",function(e){return d.Utils.exists(e)?f.StringUtils.javascriptEncode(e):void 0});var L=function(e,t){var n=u.StringAndHoles.shortenString(e,t.length,"...");return d.Utils.exists(t.highlights)?u.HighlightUtils.highlightString(n.value,t.highlights,n.holes,t.cssClass||"highlight"):n.value};a.TemplateHelpers.registerTemplateHelper("shorten",function(e,t,n,i){return L(e,{length:t,highlights:n,cssClass:i})}),a.TemplateHelpers.registerTemplateHelper("shortenv2",function(e,t){return L(e,t)});var I=function(e,t){var n=u.StringAndHoles.shortenPath(e,t.length);return d.Utils.exists(t.highlights)?u.HighlightUtils.highlightString(n.value,t.highlights,n.holes,t.cssClass||"highlight"):n.value};a.TemplateHelpers.registerTemplateHelper("shortenPath",function(e,t,n,i){return I(e,{length:t,highlights:n,cssClass:i})}),a.TemplateHelpers.registerFieldHelper("shortenPathv2",function(e,t){return I(e,t)});var A=function(e,t){var n=u.StringAndHoles.shortenUri(e,t.length);return d.Utils.exists(t.highlights)?u.HighlightUtils.highlightString(n.value,t.highlights,n.holes,t.cssClass||"highlight"):n.value};a.TemplateHelpers.registerTemplateHelper("shortenUri",function(e,t,n,i){return A(e,{length:t,highlights:n,cssClass:i})}),a.TemplateHelpers.registerTemplateHelper("shortenUriv2",function(e,t){return A(e,t)});var $=function(e,t){return d.Utils.exists(e)?d.Utils.exists(t.highlights)?u.HighlightUtils.highlightString(e,t.highlights,null,t.cssClass||"highlight"):e:void 0};a.TemplateHelpers.registerTemplateHelper("highlight",function(e,t,n){return $(e,{highlights:t,cssClass:n})}),a.TemplateHelpers.registerTemplateHelper("highlightv2",function(e,t){return $(e,t)});var F=function(e,t){return d.Utils.exists(e)&&d.Utils.exists(t.termsToHighlight)&&d.Utils.exists(t.phrasesToHighlight)?r(t.termsToHighlight,t.phrasesToHighlight)?b.StreamHighlightUtils.highlightStreamText(e,t.termsToHighlight,t.phrasesToHighlight,t.opts):e:void 0};a.TemplateHelpers.registerTemplateHelper("highlightStreamText",function(e,t,n,i){return void 0===t&&(t=o()),void 0===n&&(n=s()),F(e,{termsToHighlight:t,phrasesToHighlight:n,opts:i})}),a.TemplateHelpers.registerTemplateHelper("highlightStreamTextv2",function(e,t){var n=l({termsToHighlight:o(),phrasesToHighlight:s()},t);return F(e,n)});var _=function(e,t){return d.Utils.exists(e)&&d.Utils.exists(t.termsToHighlight)&&d.Utils.exists(t.phrasesToHighlight)?r(t.termsToHighlight,t.phrasesToHighlight)?b.StreamHighlightUtils.highlightStreamHTML(e,t.termsToHighlight,t.phrasesToHighlight,t.opts):e:void 0};a.TemplateHelpers.registerTemplateHelper("highlightStreamHTML",function(e,t,n,i){return void 0===t&&(t=o()),void 0===n&&(n=s()),_(e,{termsToHighlight:t,phrasesToHighlight:n,opts:i})}),a.TemplateHelpers.registerTemplateHelper("highlightStreamHTMLv2",function(e,t){var n=l({termsToHighlight:o(),phrasesToHighlight:s()},t);return _(e,n)}),a.TemplateHelpers.registerFieldHelper("number",function(e,t){if(d.Utils.exists(e)){var n=Number(e),i=w.isString(t)?t:t&&t.format;return i?f.StringUtils.htmlEncode(S.format(n,i)):f.StringUtils.htmlEncode(n.toString())}}),a.TemplateHelpers.registerFieldHelper("date",function(e,t){return c.DateUtils.dateToString(c.DateUtils.convertFromJsonDateIfNeeded(e),t)}),a.TemplateHelpers.registerFieldHelper("time",function(e,t){return c.DateUtils.timeToString(c.DateUtils.convertFromJsonDateIfNeeded(e),t)}),a.TemplateHelpers.registerFieldHelper("dateTime",function(e,t){return c.DateUtils.dateTimeToString(c.DateUtils.convertFromJsonDateIfNeeded(e),t)}),a.TemplateHelpers.registerFieldHelper("emailDateTime",function(e,t){var n={};n.includeTimeIfThisWeek=!0;var i=w.extend(t,n);return e?c.DateUtils.dateTimeToString(c.DateUtils.convertFromJsonDateIfNeeded(e),i):void 0}),a.TemplateHelpers.registerFieldHelper("currency",function(e,t){return p.CurrencyUtils.currencyToString(e,t)}),a.TemplateHelpers.registerFieldHelper("timeSpan",function(e,t){return void 0===t&&(t={isMilliseconds:!1}),new m.TimeSpan(e,t.isMilliseconds).getHHMMSS()}),a.TemplateHelpers.registerFieldHelper("email",function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var i,o,s,r;if(w.isObject(t[0])?(i=t[0].companyDomain,o=t[0].me,s=t[0].lengthLimit,r=t[0].truncateName):(i=t[0],o=t[1],s=t[2],r=t[3]),void 0==s&&(s=2),void 0==r&&(r=!1),w.isString(e)){var l=g.EmailUtils.splitSemicolonSeparatedListOfEmailAddresses(e);return g.EmailUtils.emailAddressesToHyperlinks(l,i,o,s,r)}return w.isArray(e)?g.EmailUtils.emailAddressesToHyperlinks(e,i,o,s,r):void 0}),a.TemplateHelpers.registerTemplateHelper("excessEmailToggle",function(e){C.$$(e).removeClass("coveo-active"),C.$$(e).hasClass("coveo-emails-excess-collapsed")?w.each(C.$$(e).siblings(".coveo-emails-excess-expanded"),function(e){C.$$(e).addClass("coveo-active")}):C.$$(e).hasClass("coveo-hide-expanded")&&(C.$$(e.parentElement).addClass("coveo-inactive"),w.each(C.$$(e.parentElement).siblings(".coveo-emails-excess-collapsed"),function(e){C.$$(e).addClass("coveo-active")}))}),a.TemplateHelpers.registerFieldHelper("anchor",function(e,t){return h.AnchorUtils.buildAnchor(e,t)}),a.TemplateHelpers.registerFieldHelper("image",function(e,t,n){return void 0===n&&(n=i()),t&&t.srcTemplate?h.ImageUtils.buildImage(f.StringUtils.buildStringTemplateFromResult(t.srcTemplate,n),{alt:t.alt,height:t.height,width:t.width}):h.ImageUtils.buildImage(e,t)}),a.TemplateHelpers.registerTemplateHelper("thumbnail",function(e,t,n){if(void 0===e&&(e=i()),void 0===t&&(t="default"),y.QueryUtils.hasThumbnail(e))return h.ImageUtils.buildImageFromResult(e,T.SearchEndpoint.endpoints[t],n)}),a.TemplateHelpers.registerTemplateHelper("fromFileTypeToIcon",function(e,t){void 0===e&&(e=i()),void 0===t&&(t={});var n=E.Component.getComponentRef("Icon");if(n)return n.createIcon(e,t).outerHTML}),a.TemplateHelpers.registerTemplateHelper("attrEncode",function(e){return(""+e).replace(/&/g,"&").replace(/'/g,"'").replace(/'/g,""").replace(/</g,"<").replace(/>/g,">")}),a.TemplateHelpers.registerTemplateHelper("loadTemplates",function(e,t){void 0===t&&(t=!0);var n,o="",s=i(),r=!1,l=e;return w.each(e,function(e,t,i){"default"==e&&(n=t)}),void 0!=n&&(l=w.omit(e,n)),w.each(l,function(e,n,i){r&&t||(r=r||e,o+=a.TemplateHelpers.getHelper("loadTemplate")(n,e,s))}),r||void 0==n||(o+=a.TemplateHelpers.getHelper("loadTemplate")(n,!0,s)),o});var P=["B","KB","MB","GB","TB","PB","EB"];a.TemplateHelpers.registerFieldHelper("size",function(e,t){for(var n=parseInt(e,10),i=null!=t&&null!=t.precision?t.precision:2,o=null!=t&&null!=t.base?t.base:0;n>1024&&o+1<P.length;)n/=1024,o++;return(n=Math.floor(n*Math.pow(10,i))/Math.pow(10,i))+" "+P[o]}),a.TemplateHelpers.registerFieldHelper("translatedCaption",function(e){return R.FacetUtils.tryToGetTranslatedCaption("@filetype",e)}),a.TemplateHelpers.registerTemplateHelper("loadTemplate",function(e,t,n){return void 0===t&&(t=!0),d.Utils.isNullOrUndefined(n)&&(n=i()),t?H.TemplateCache.getTemplate(e).instantiateToString(n,{checkCondition:!1}):""}),a.TemplateHelpers.registerTemplateHelper("encodeCarriageReturn",function(e){return d.Utils.isNullOrUndefined(e)?void 0:f.StringUtils.encodeCarriageReturn(e)}),a.TemplateHelpers.registerTemplateHelper("isMobileDevice",function(){return v.DeviceUtils.isMobileDevice()?v.DeviceUtils.getDeviceName():null}),a.TemplateHelpers.registerTemplateHelper("pluralHelper",function(e,t){return e>1?t.plural:t.singular})},528:function(e,t){},529:function(e,t){},530:function(e,t){},531:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(62),o=n(19),s=n(93),r=n(1),l=n(7),a=n(9),u=function(){function e(e,t,n,i){this.coveoRoot=e,this.ID=t,this.searchInterface=l.Component.get(this.coveoRoot.el,o.SearchInterface,!1),this.currentMode="large"}return e.init=function(t,n,o){if(!r.$$(t).find("."+l.Component.computeCssClassName(s.ResultList))){return void new a.Logger("ResponsiveDefaultResultTemplate").trace("No ResultLayout component found : Cannot instantiate ResponsiveResultLayout")}i.ResponsiveComponentsManager.register(e,r.$$(t),s.ResultList.ID,n,o)},e.prototype.registerComponent=function(e){return e instanceof s.ResultList&&(this.resultList=e,!0)},e.prototype.handleResizeEvent=function(){var e=this,t=this.resultList.queryController.getLastResults();this.needSmallMode()?(r.$$(this.resultList.options.resultsContainer).addClass("coveo-card-layout-container"),r.$$(this.resultList.options.resultsContainer).removeClass("coveo-list-layout-container"),"small"!=this.currentMode&&(t&&this.resultList.buildResults(t).then(function(t){e.resultList.renderResults(t)}),this.currentMode="small")):(r.$$(this.resultList.options.resultsContainer).removeClass("coveo-card-layout-container"),r.$$(this.resultList.options.resultsContainer).addClass("coveo-list-layout-container"),"large"!=this.currentMode&&(t&&this.resultList.buildResults(t).then(function(t){e.resultList.renderResults(t)}),this.currentMode="large"))},e.prototype.needSmallMode=function(){return this.coveoRoot.width()<=this.searchInterface.responsiveComponents.getSmallScreenWidth()},e}();t.ResponsiveDefaultResultTemplate=u},532:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),o=function(){function e(e,t){this.searchInterface=t,this.resultContainerElement=i.$$(e)}return e.prototype.empty=function(){this.searchInterface.detachComponentsInside(this.resultContainerElement.el),i.$$(this.resultContainerElement).empty()},e.prototype.addClass=function(e){this.resultContainerElement.addClass(e)},e.prototype.isEmpty=function(){return this.resultContainerElement.isEmpty()},e.prototype.hideChildren=function(){this.resultContainerElement.children().forEach(function(e){return i.$$(e).hide()})},e.prototype.getResultElements=function(){return this.resultContainerElement.findAll(".CoveoResult")},Object.defineProperty(e.prototype,"el",{get:function(){return this.resultContainerElement.el},enumerable:!0,configurable:!0}),e.resultCurrentlyBeingRendered=null,e}();t.ResultContainer=o},533:function(e,t,n){"use strict";var i=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=n(215),s=n(1),r=n(0),l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.getEndFragment=function(e){var t=this;return new Promise(function(n){if(!r.isEmpty(e)){if(t.resultListOptions.enableInfiniteScroll){var i=s.$$(t.resultListOptions.resultsContainer).findAll(".coveo-card-layout-padding");r.each(i,function(e){return s.$$(e).remove()})}var o=document.createDocumentFragment();r.times(3,function(){return o.appendChild(s.$$("div",{className:"coveo-card-layout coveo-card-layout-padding"}).el)}),n(o)}n(null)})},t}(o.ResultListRenderer);t.ResultListCardRenderer=l},534:function(e,t,n){"use strict";var i=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),o=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(o,s){function r(e){try{a(i.next(e))}catch(e){s(e)}}function l(e){try{a(i.throw(e))}catch(e){s(e)}}function a(e){e.done?o(e.value):new n(function(t){t(e.value)}).then(r,l)}a((i=i.apply(e,t||[])).next())})},s=this&&this.__generator||function(e,t){function n(e){return function(t){return i([e,t])}}function i(n){if(o)throw new TypeError("Generator is already executing.");for(;a;)try{if(o=1,s&&(r=s[2&n[0]?"return":n[0]?"throw":"next"])&&!(r=r.call(s,n[1])).done)return r;switch(s=0,r&&(n=[0,r.value]),n[0]){case 0:case 1:r=n;break;case 4:return a.label++,{value:n[1],done:!1};case 5:a.label++,s=n[1],n=[0];continue;case 7:n=a.ops.pop(),a.trys.pop();continue;default:if(r=a.trys,!(r=r.length>0&&r[r.length-1])&&(6===n[0]||2===n[0])){a=0;continue}if(3===n[0]&&(!r||n[1]>r[0]&&n[1]<r[3])){a.label=n[1];break}if(6===n[0]&&a.label<r[1]){a.label=r[1],r=n;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(n);break}r[2]&&a.ops.pop(),a.trys.pop();continue}n=t.call(e,a)}catch(e){n=[6,e],s=0}finally{o=r=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var o,s,r,l,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return l={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(l[Symbol.iterator]=function(){return this}),l};Object.defineProperty(t,"__esModule",{value:!0});var r=n(215),l=n(470),a=n(1),u=n(0),c=function(e){function t(t,n){var i=e.call(this,t,n)||this;return i.resultListOptions=t,i.autoCreateComponentsFn=n,i.shouldDisplayHeader=!0,i.shouldDisplayFooter=!1,i.resultListOptions.resultTemplate instanceof l.TableTemplate&&(i.resultListOptions.resultTemplate.hasTemplateWithRole("table-footer")&&(i.shouldDisplayFooter=!0),0===i.resultListOptions.resultTemplate.templates.length||i.resultListOptions.resultTemplate.hasTemplateWithRole("table-header")||(i.shouldDisplayHeader=!1)),i}return i(t,e),t.prototype.getStartFragment=function(e,t){if(!t&&!u.isEmpty(e)&&this.shouldDisplayHeader)return this.renderRoledTemplate("table-header")},t.prototype.getEndFragment=function(e,t){if(!t&&!u.isEmpty(e)&&this.shouldDisplayFooter)return this.renderRoledTemplate("table-footer")},t.prototype.renderRoledTemplate=function(e){return o(this,void 0,void 0,function(){var t,n;return s(this,function(i){switch(i.label){case 0:return[4,this.resultListOptions.resultTemplate.instantiateRoleToElement(e)];case 1:return t=i.sent(),a.$$(t).addClass("coveo-result-list-"+e),this.autoCreateComponentsFn(t,void 0),n=document.createDocumentFragment(),n.appendChild(t),[2,n]}})})},t}(r.ResultListRenderer);t.ResultListTableRenderer=c},667:function(e,t){},93:function(e,t,n){"use strict";var i=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),o=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(o,s){function r(e){try{a(i.next(e))}catch(e){s(e)}}function l(e){try{a(i.throw(e))}catch(e){s(e)}}function a(e){e.done?o(e.value):new n(function(t){t(e.value)}).then(r,l)}a((i=i.apply(e,t||[])).next())})},s=this&&this.__generator||function(e,t){function n(e){return function(t){return i([e,t])}}function i(n){if(o)throw new TypeError("Generator is already executing.");for(;a;)try{if(o=1,s&&(r=s[2&n[0]?"return":n[0]?"throw":"next"])&&!(r=r.call(s,n[1])).done)return r;switch(s=0,r&&(n=[0,r.value]),n[0]){case 0:case 1:r=n;break;case 4:return a.label++,{value:n[1],done:!1};case 5:a.label++,s=n[1],n=[0];continue;case 7:n=a.ops.pop(),a.trys.pop();continue;default:if(r=a.trys,!(r=r.length>0&&r[r.length-1])&&(6===n[0]||2===n[0])){a=0;continue}if(3===n[0]&&(!r||n[1]>r[0]&&n[1]<r[3])){a.label=n[1];break}if(6===n[0]&&a.label<r[1]){a.label=r[1],r=n;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(n);break}r[2]&&a.ops.pop(),a.trys.pop();continue}n=t.call(e,a)}catch(e){n=[6,e],s=0}finally{o=r=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var o,s,r,l,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return l={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(l[Symbol.iterator]=function(){return this}),l};Object.defineProperty(t,"__esModule",{value:!0}),n(528),n(529),n(530);var r=n(0),l=n(11),a=n(134),u=n(29),c=n(3),p=n(5),h=n(31),d=n(18),f=n(13),m=n(24),g=n(1),y=n(97),v=n(4),C=n(10),T=n(7),b=n(8),R=n(2),S=n(177),w=n(63),E=n(531),H=n(474),O=n(472),L=n(123),I=n(470),A=n(68),$=n(96),F=n(532),_=n(533),P=n(215),D=n(534),M=n(118),U=n(473);H.CoreHelpers.exportAllHelpersGlobally(window.Coveo);var x=function(e){function t(n,i,o,s){void 0===s&&(s=t.ID);var r=e.call(this,n,s,o)||this;return r.element=n,r.options=i,r.bindings=o,r.currentlyDisplayedResults=[],r.reachedTheEndOfResults=!1,r.disableLayoutChange=!1,r.successiveScrollCount=0,r.options=b.ComponentOptions.initComponentOptions(n,t,i),p.Assert.exists(n),p.Assert.exists(r.options),p.Assert.exists(r.options.resultTemplate),p.Assert.exists(r.options.infiniteScrollContainer),r.showOrHideElementsDependingOnState(!1,!1),r.addListeners(),r.resultContainer=r.initResultContainer(),p.Assert.exists(r.options.resultsContainer),r.initWaitAnimationContainer(),p.Assert.exists(r.options.waitAnimationContainer),r.setupTemplatesVersusLayouts(),g.$$(r.root).on(a.ResultLayoutEvents.populateResultLayout,function(e,t){return t.layouts.push(r.options.layout)}),r.setupRenderer(),r.makeElementFocusable(),r.ensureHasId(),r}return i(t,e),t.getDefaultTemplate=function(e){var n=t.loadTemplatesFromCache();if(null!=n)return n;var i=T.Component.get(e);return Coveo.Recommendation&&i.searchInterface instanceof Coveo.Recommendation?new O.DefaultRecommendationTemplate:new L.DefaultResultTemplate},t.loadTemplatesFromCache=function(){var e=A.TemplateCache.getResultListTemplateNames();return e.length>0?new $.TemplateList(r.compact(r.map(e,function(e){return A.TemplateCache.getTemplate(e)}))):null},t.prototype.addListeners=function(){var e=this;this.bind.onRootElement(l.QueryEvents.newQuery,function(t){return e.handleNewQuery()}),this.bind.onRootElement(l.QueryEvents.buildingQuery,function(t){return e.handleBuildingQuery(t)}),this.bind.onRootElement(l.QueryEvents.querySuccess,function(t){return e.handleQuerySuccess(t)}),this.bind.onRootElement(l.QueryEvents.fetchMoreSuccess,function(t){return e.handleFetchMoreSuccess(t)}),this.bind.onRootElement(l.QueryEvents.duringQuery,function(t){return e.handleDuringQuery()}),this.bind.onRootElement(l.QueryEvents.queryError,function(t){return e.handleQueryError()}),g.$$(this.root).on(u.ResultListEvents.changeLayout,function(t,n){return e.handleChangeLayout(n)}),this.options.enableInfiniteScroll?this.addInfiniteScrollListeners():this.addPagerListeners()},t.prototype.addInfiniteScrollListeners=function(){var e=this;this.bind.on(this.options.infiniteScrollContainer,"scroll",function(){e.successiveScrollCount=0,e.handleScrollOfResultList()}),this.bind.onRootElement(l.QueryEvents.deferredQuerySuccess,function(){setTimeout(function(){e.scrollToTopIfEnabled()},0)})},t.prototype.addPagerListeners=function(){var e=this;this.bind.onQueryState(d.MODEL_EVENTS.CHANGE_ONE,f.QUERY_STATE_ATTRIBUTES.FIRST,function(){e.bind.oneRootElement(l.QueryEvents.deferredQuerySuccess,function(){setTimeout(function(){e.scrollToTopIfEnabled()},0)})})},t.prototype.getAutoSelectedFieldsToInclude=function(){return r.chain(this.options.resultTemplate.getFields()).concat(this.getMinimalFieldsToInclude()).compact().unique().value()},t.prototype.setupTemplatesVersusLayouts=function(){var e=this,t="coveo-"+this.options.layout+"-layout-container";this.resultContainer.addClass(t),"table"===this.options.layout&&(this.options.resultTemplate=new I.TableTemplate(this.options.resultTemplate.templates||[])),this.options.resultTemplate instanceof $.TemplateList?r.each(this.options.resultTemplate.templates,function(t){t.layout||(t.layout=e.options.layout)}):this.options.resultTemplate instanceof L.DefaultResultTemplate&&"list"==this.options.layout&&E.ResponsiveDefaultResultTemplate.init(this.root,this,{})},t.prototype.renderResults=function(e,t){var n=this;return void 0===t&&(t=!1),t||this.resultContainer.empty(),this.renderer.renderResults(e,t,this.triggerNewResultDisplayed.bind(this)).then(function(){return n.triggerNewResultsDisplayed()})},t.prototype.buildResults=function(e){var t=this.options.layout;return this.templateToHtml.buildResults(e,t,this.currentlyDisplayedResults)},t.prototype.buildResult=function(e){var t=this.options.layout;return this.templateToHtml.buildResult(e,t,this.currentlyDisplayedResults)},t.prototype.displayMoreResults=function(e){return p.Assert.isLargerOrEqualsThan(1,e),this.isCurrentlyFetchingMoreResults()?void this.logger.warn("Ignoring request to display more results since we're already doing so"):this.hasPotentiallyMoreResultsToDisplay()?(this.options.enableInfiniteScrollWaitingAnimation&&this.showWaitingAnimationForInfiniteScrolling(),this.fetchAndRenderMoreResults(e)):void this.logger.warn("Ignoring request to display more results since we know there aren't more to display")},Object.defineProperty(t.prototype,"templateToHtml",{get:function(){var e={resultTemplate:this.options.resultTemplate,searchInterface:this.searchInterface,queryStateModel:this.queryStateModel};return new U.TemplateToHtml(e)},enumerable:!0,configurable:!0}),t.prototype.getDisplayedResults=function(){return this.currentlyDisplayedResults},t.prototype.getDisplayedResultsElements=function(){return this.resultContainer.getResultElements()},t.prototype.enable=function(){this.disableLayoutChange=!1,this.resultLayoutSelectors.length>0?this.enableBasedOnActiveLayouts():(e.prototype.enable.call(this),g.$$(this.element).removeClass("coveo-hidden"))},t.prototype.disable=function(){var t=this;e.prototype.disable.call(this);var n=r.map(this.otherResultLists,function(e){return e.options.layout});r.contains(n,this.options.layout)||this.disableLayoutChange||r.each(this.resultLayoutSelectors,function(e){e.disableLayouts([t.options.layout])}),this.disableLayoutChange=!1,g.$$(this.element).addClass("coveo-hidden")},t.prototype.autoCreateComponentsInsideResult=function(e,t){return this.templateToHtml.autoCreateComponentsInsideResult(e,t)},t.prototype.triggerNewResultDisplayed=function(e,t){var n={result:e,item:t};g.$$(this.element).trigger(u.ResultListEvents.newResultDisplayed,n)},t.prototype.triggerNewResultsDisplayed=function(){var e={isInfiniteScrollEnabled:this.options.enableInfiniteScroll};g.$$(this.element).trigger(u.ResultListEvents.newResultsDisplayed,e)},t.prototype.fetchAndRenderMoreResults=function(e){return o(this,void 0,void 0,function(){var t,n;return s(this,function(i){switch(i.label){case 0:this.fetchingMoreResults=this.queryController.fetchMore(e),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.fetchingMoreResults];case 2:return t=i.sent(),p.Assert.exists(t),this.usageAnalytics.logCustomEvent(C.analyticsActionCauseList.pagerScrolling,{},this.element),this.renderNewResults(t),this.resetStateAfterFetchingMoreResults(),[2,t];case 3:return n=i.sent(),this.resetStateAfterFetchingMoreResults(),[2,Promise.reject(n)];case 4:return[2]}})})},t.prototype.renderNewResults=function(e){return o(this,void 0,void 0,function(){var t,n;return s(this,function(i){switch(i.label){case 0:return[4,this.buildResults(e)];case 1:return t=i.sent(),this.renderResults(t,!0),(n=this.currentlyDisplayedResults).push.apply(n,e.results),[2]}})})},t.prototype.resetStateAfterFetchingMoreResults=function(){var e=this;this.hideWaitingAnimationForInfiniteScrolling(),this.fetchingMoreResults=void 0,h.Defer.defer(function(){e.successiveScrollCount++,e.successiveScrollCount<=t.MAX_AMOUNT_OF_SUCESSIVE_REQUESTS?e.handleScrollOfResultList():e.logger.info("Result list has triggered 5 consecutive queries to try and fill up the scrolling container, but it is still unable to do so.\n Try explicitly setting the 'data-infinite-scroll-container-selector' option on the result list. See: https://coveo.github.io/search-ui/components/resultlist.html#options.infinitescrollcontainer")})},t.prototype.handleDuringQuery=function(){this.logger.trace("Emptying the result container"),this.cancelFetchingMoreResultsIfNeeded(),this.showWaitingAnimation(),this.showOrHideElementsDependingOnState(!1,!1)},t.prototype.handleQueryError=function(){this.hideWaitingAnimation(),this.resultContainer.empty(),this.currentlyDisplayedResults=[],this.reachedTheEndOfResults=!0},t.prototype.handleQuerySuccess=function(e){var n=this;p.Assert.exists(e),p.Assert.exists(e.results);var i=e.results;this.logger.trace("Received query results from new query",i),this.hideWaitingAnimation(),t.resultCurrentlyBeingRendered=void 0,this.currentlyDisplayedResults=[],this.buildResults(e.results).then(function(t){return o(n,void 0,void 0,function(){return s(this,function(n){switch(n.label){case 0:return[4,this.renderResults(t)];case 1:return n.sent(),this.showOrHideElementsDependingOnState(!0,0!=this.currentlyDisplayedResults.length),m.DeviceUtils.isMobileDevice()&&void 0!=this.options.mobileScrollContainer&&(this.options.mobileScrollContainer.scrollTop=0),this.options.enableInfiniteScroll&&i.results.length==e.queryBuilder.numberOfResults&&(this.scrollToTopIfEnabled(),this.handleScrollOfResultList()),[2]}})})}),this.handleQueryOrFetchMoreSuccess(e.query,i)},t.prototype.handleFetchMoreSuccess=function(e){this.handleQueryOrFetchMoreSuccess(e.query,e.results)},t.prototype.handleQueryOrFetchMoreSuccess=function(e,t){var n=(e.firstResult||0)+t.results.length;this.reachedTheEndOfResults=n>=t.totalCountFiltered},t.prototype.handleScrollOfResultList=function(){!this.isCurrentlyFetchingMoreResults()&&this.options.enableInfiniteScroll&&this.isScrollingOfResultListAlmostAtTheBottom()&&this.hasPotentiallyMoreResultsToDisplay()&&this.displayMoreResults(this.options.infiniteScrollPageSize)},t.prototype.scrollToTopIfEnabled=function(){this.options.enableScrollToTop&&M.ResultListUtils.scrollToTop(this.root)},t.prototype.handleNewQuery=function(){g.$$(this.element).removeClass("coveo-hidden"),t.resultCurrentlyBeingRendered=void 0},Object.defineProperty(t.prototype,"otherResultLists",{get:function(){var e=this.searchInterface.getComponents(t.ID);return r.without(e,this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"resultLayoutSelectors",{get:function(){return this.searchInterface.getComponents("ResultLayoutSelector")},enumerable:!0,configurable:!0}),t.prototype.handleBuildingQuery=function(e){if(e.queryBuilder.addFieldsToInclude(this.getMinimalFieldsToInclude()),null!=this.options.fieldsToInclude&&e.queryBuilder.addFieldsToInclude(r.map(this.options.fieldsToInclude,function(e){return e.substr(1)})),this.options.autoSelectFieldsToInclude){var t=r.flatten(r.map(this.otherResultLists,function(e){return e.getAutoSelectedFieldsToInclude()}));e.queryBuilder.addRequiredFields(r.unique(t.concat(this.getAutoSelectedFieldsToInclude()))),e.queryBuilder.includeRequiredFields=!0}},t.prototype.handleChangeLayout=function(e){var t=this;e.layout===this.options.layout?(this.disableLayoutChange=!1,this.enable(),this.options.resultTemplate.layout=this.options.layout,e.results&&(this.resultContainer.isEmpty()&&new S.InitializationPlaceholder(this.root).withVisibleRootElement().withPlaceholderForResultList(),h.Defer.defer(function(){return o(t,void 0,void 0,function(){var t;return s(this,function(n){switch(n.label){case 0:return[4,this.buildResults(e.results)];case 1:return t=n.sent(),this.renderResults(t),this.showOrHideElementsDependingOnState(!0,0!==this.currentlyDisplayedResults.length),[2]}})})}))):(this.disableLayoutChange=!0,this.disable(),this.resultContainer.empty())},t.prototype.isCurrentlyFetchingMoreResults=function(){return v.Utils.exists(this.fetchingMoreResults)},t.prototype.getMinimalFieldsToInclude=function(){return["author","language","urihash","objecttype","collection","source","language","permanentid"]},t.prototype.isScrollingOfResultListAlmostAtTheBottom=function(){var e;try{e=this.options.infiniteScrollContainer instanceof Window}catch(t){e=!1}return e?this.isScrollAtBottomForWindowElement():this.isScrollAtBottomForHtmlElement()},t.prototype.isScrollAtBottomForWindowElement=function(){var e=new g.Win(window),t=e.height(),n=e.scrollY();return new g.Doc(document).height()-(t+n)<t/2},t.prototype.isScrollAtBottomForHtmlElement=function(){var e=this.options.infiniteScrollContainer,t=e.clientHeight;return e.scrollHeight-(e.scrollTop+t)<t/2},t.prototype.hasPotentiallyMoreResultsToDisplay=function(){return this.currentlyDisplayedResults.length>0&&!this.reachedTheEndOfResults},t.prototype.cancelFetchingMoreResultsIfNeeded=function(){this.isCurrentlyFetchingMoreResults()&&(this.logger.trace("Cancelling fetching more results"),Promise.reject(this.fetchingMoreResults),this.fetchingMoreResults=void 0)},t.prototype.showOrHideElementsDependingOnState=function(e,t){var n=g.$$(this.element).findAll(".coveo-show-if-query"),i=g.$$(this.element).findAll(".coveo-show-if-no-query"),o=g.$$(this.element).findAll(".coveo-show-if-results"),s=g.$$(this.element).findAll(".coveo-show-if-no-results");r.each(n,function(t){g.$$(t).toggle(e)}),r.each(i,function(t){g.$$(t).toggle(!e)}),r.each(o,function(n){g.$$(n).toggle(e&&t)}),r.each(s,function(n){g.$$(n).toggle(e&&!t)})},Object.defineProperty(t.prototype,"waitAnimation",{get:function(){return this.options.waitAnimation.toLowerCase()},enumerable:!0,configurable:!0}),t.prototype.showWaitingAnimation=function(){switch(this.waitAnimation){case"fade":g.$$(this.options.waitAnimationContainer).addClass("coveo-fade-out");break;case"spinner":this.resultContainer.hideChildren(),void 0==g.$$(this.options.waitAnimationContainer).find(".coveo-wait-animation")&&this.options.waitAnimationContainer.appendChild(y.DomUtils.getBasicLoadingAnimation())}},t.prototype.hideWaitingAnimation=function(){switch(this.waitAnimation){case"fade":g.$$(this.options.waitAnimationContainer).removeClass("coveo-fade-out");break;case"spinner":var e=g.$$(this.options.waitAnimationContainer).find(".coveo-loading-spinner");e&&g.$$(e).detach()}},t.prototype.showWaitingAnimationForInfiniteScrolling=function(){var e=y.DomUtils.getLoadingSpinner();if("card"==this.options.layout&&this.options.enableInfiniteScroll){var t=g.$$(this.options.waitAnimationContainer).findAll(".coveo-loading-spinner-container");r.each(t,function(e){return g.$$(e).remove()});var n=g.$$("div",{className:"coveo-loading-spinner-container"});n.append(e),this.options.waitAnimationContainer.appendChild(n.el)}else this.options.waitAnimationContainer.appendChild(y.DomUtils.getLoadingSpinner())},t.prototype.hideWaitingAnimationForInfiniteScrolling=function(){var e=g.$$(this.options.waitAnimationContainer).findAll(".coveo-loading-spinner"),t=g.$$(this.options.waitAnimationContainer).findAll(".coveo-loading-spinner-container");r.each(e,function(e){return g.$$(e).remove()}),r.each(t,function(e){return g.$$(e).remove()})},t.prototype.initResultContainer=function(){if(!this.options.resultsContainer){var e="table"===this.options.layout?"table":"div";this.options.resultsContainer=g.$$(e,{className:"coveo-result-list-container"}).el,this.initResultContainerAddToDom()}return new F.ResultContainer(this.options.resultsContainer,this.searchInterface)},t.prototype.initResultContainerAddToDom=function(){this.element.appendChild(this.options.resultsContainer)},t.prototype.initWaitAnimationContainer=function(){this.options.waitAnimationContainer||(this.options.waitAnimationContainer=this.resultContainer.el)},t.prototype.setupRenderer=function(){var e={options:this.searchInterface.options.originalOptionsObject,bindings:this.bindings},t=function(t){return R.Initialization.automaticallyCreateComponentsInside(t,e)};switch(this.options.layout){case"card":this.renderer=new _.ResultListCardRenderer(this.options,t);break;case"table":this.renderer=new D.ResultListTableRenderer(this.options,t);break;case"list":default:this.renderer=new P.ResultListRenderer(this.options,t)}},t.prototype.makeElementFocusable=function(){g.$$(this.element).setAttribute("tabindex","-1")},t.prototype.ensureHasId=function(){""===this.element.id&&(this.element.id=r.uniqueId("coveo-result-list"))},t.prototype.enableBasedOnActiveLayouts=function(){var t=this;r.each(this.resultLayoutSelectors,function(n){r.find(n.activeLayouts,function(e,n){return n==t.options.layout})&&(e.prototype.enable.call(t),n.enableLayouts([t.options.layout]),g.$$(t.element).removeClass("coveo-hidden"))})},t.ID="ResultList",t.doExport=function(){c.exportGlobally({ResultList:t})},t.options={resultsContainer:b.ComponentOptions.buildChildHtmlElementOption({alias:"resultContainerSelector"}),resultTemplate:w.TemplateComponentOptions.buildTemplateOption({defaultFunction:t.getDefaultTemplate}),waitAnimation:b.ComponentOptions.buildStringOption({defaultValue:"none"}),waitAnimationContainer:b.ComponentOptions.buildChildHtmlElementOption({postProcessing:function(e,t){return e||t.resultsContainer}}),enableInfiniteScroll:b.ComponentOptions.buildBooleanOption({defaultValue:!1}),infiniteScrollPageSize:b.ComponentOptions.buildNumberOption({defaultValue:10,min:1,depend:"enableInfiniteScroll"}),infiniteScrollContainer:b.ComponentOptions.buildChildHtmlElementOption({depend:"enableInfiniteScroll",defaultFunction:function(e){return b.ComponentOptions.findParentScrolling(e)}}),enableInfiniteScrollWaitingAnimation:b.ComponentOptions.buildBooleanOption({depend:"enableInfiniteScroll",defaultValue:!0}),mobileScrollContainer:b.ComponentOptions.buildSelectorOption({defaultFunction:function(){return document.querySelector(".coveo-results-column")}}),autoSelectFieldsToInclude:b.ComponentOptions.buildBooleanOption({defaultValue:!1}),fieldsToInclude:b.ComponentOptions.buildFieldsOption({includeInResults:!0}),layout:b.ComponentOptions.buildStringOption({defaultValue:"list",required:!0}),enableScrollToTop:b.ComponentOptions.buildBooleanOption({defaultValue:!0})},t.resultCurrentlyBeingRendered=null,t.MAX_AMOUNT_OF_SUCESSIVE_REQUESTS=5,t}(T.Component);t.ResultList=x,R.Initialization.registerAutoCreateComponent(x)}});
//# sourceMappingURL=ResultsPerPage.min__cf4c4f4dd6c8a707e936.js.map