coveo-search-ui
Version:
Coveo JavaScript Search Framework
2 lines • 98.2 kB
JavaScript
webpackJsonpCoveo__temporary([9,10,11,79],{133:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(52),o=n(52);t.notWordStart=" ()[],$@'\"",t.notInWord=" ()[],:",t.Basic={basicExpressions:["Word","DoubleQuoted"],grammars:{DoubleQuoted:'"[NotDoubleQuote]"',NotDoubleQuote:/[^"]*/,SingleQuoted:"'[NotSingleQuote]'",NotSingleQuote:/[^']*/,Number:/-?(0|[1-9]\d*)(\.\d+)?/,Word:function(e,n,s){var r=new RegExp("[^"+t.notWordStart.replace(/(.)/g,"\\$1")+"][^"+t.notInWord.replace(/(.)/g,"\\$1")+"]*"),u=e.match(r);null!=u&&0!=u.index&&(u=null);var a=new i.Result(null!=u?u[0]:null,s,e);return a.isSuccess()&&n&&e.length>a.value.length?new o.EndOfInputResult(a):a}}}},139: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(566);var o=n(11),s=n(100),r=n(3),u=n(176),a=n(222),l=n(5),c=n(18),p=n(13),h=n(6),g=n(1),d=n(10),f=n(7),y=n(8),m=n(2),b=n(511),x=n(140),v=function(e){function t(n,i,r){var l=e.call(this,n,t.ID,r)||this;l.element=n,l.options=i,l.bindings=r,n instanceof HTMLInputElement&&l.logger.error("Querybox cannot be used on an HTMLInputElement"),l.options=y.ComponentOptions.initComponentOptions(n,t,i),new b.QueryboxOptionsProcessing(l).postProcess(),g.$$(l.element).toggleClass("coveo-query-syntax-disabled",0==l.options.enableQuerySyntax),l.magicBox=a.createMagicBox(n,new u.Grammar("Query",{Query:"[Term*][Spaces?]",Term:"[Spaces?][Word]",Spaces:/ +/,Word:/[^ ]+/}),{inline:!0});var f=g.$$(l.magicBox.element).find("input");return f&&g.$$(f).setAttribute("aria-label",l.options.placeholder||h.l("Search")),l.bind.onRootElement(o.QueryEvents.buildingQuery,function(e){return l.handleBuildingQuery(e)}),l.bind.onRootElement(s.StandaloneSearchInterfaceEvents.beforeRedirect,function(){return l.updateQueryState()}),l.bind.onQueryState(c.MODEL_EVENTS.CHANGE_ONE,p.QUERY_STATE_ATTRIBUTES.Q,function(e){return l.handleQueryStateChanged(e)}),l.options.enableSearchAsYouType&&(g.$$(l.element).addClass("coveo-search-as-you-type"),l.magicBox.onchange=function(){l.searchAsYouType()}),l.magicBox.onsubmit=function(){l.submit()},l.magicBox.onblur=function(){l.updateQueryState()},l.magicBox.onclear=function(){l.updateQueryState(),l.options.triggerQueryOnClear&&(l.usageAnalytics.logSearchEvent(d.analyticsActionCauseList.searchboxClear,{}),l.triggerNewQuery(!1))},l}return i(t,e),t.prototype.submit=function(){this.magicBox.clearSuggestion(),this.updateQueryState(),this.usageAnalytics.logSearchEvent(d.analyticsActionCauseList.searchboxSubmit,{}),this.triggerNewQuery(!1)},t.prototype.setText=function(e){this.magicBox.setText(e),this.updateQueryState()},t.prototype.clear=function(){this.magicBox.clear()},t.prototype.getText=function(){return this.magicBox.getText()},t.prototype.getResult=function(){return this.magicBox.getResult()},t.prototype.getDisplayedResult=function(){return this.magicBox.getDisplayedResult()},t.prototype.getCursor=function(){return this.magicBox.getCursor()},t.prototype.resultAtCursor=function(e){return this.magicBox.resultAtCursor(e)},t.prototype.handleBuildingQuery=function(e){l.Assert.exists(e),l.Assert.exists(e.queryBuilder),this.updateQueryState(),this.lastQuery=this.magicBox.getText(),new x.QueryboxQueryParameters(this.options).addParameters(e.queryBuilder,this.lastQuery)},t.prototype.triggerNewQuery=function(e){clearTimeout(this.searchAsYouTypeTimeout);var t=this.magicBox.getText();this.lastQuery!=t&&null!=t&&(this.lastQuery=t,this.queryController.executeQuery({searchAsYouType:e,logInActionsHistory:!0}))},t.prototype.updateQueryState=function(){this.queryStateModel.set(p.QueryStateModel.attributesEnum.q,this.magicBox.getText())},t.prototype.handleQueryStateChanged=function(e){l.Assert.exists(e);var t=e.value;t!=this.magicBox.getText()&&this.magicBox.setText(t)},t.prototype.searchAsYouType=function(){var e=this;clearTimeout(this.searchAsYouTypeTimeout),this.searchAsYouTypeTimeout=window.setTimeout(function(){e.usageAnalytics.logSearchAsYouType(d.analyticsActionCauseList.searchboxAsYouType,{}),e.triggerNewQuery(!0)},this.options.searchAsYouTypeDelay)},t.ID="Querybox",t.doExport=function(){r.exportGlobally({Querybox:t,QueryboxQueryParameters:x.QueryboxQueryParameters})},t.options={enableSearchAsYouType:y.ComponentOptions.buildBooleanOption({defaultValue:!1,section:"Advanced Options"}),searchAsYouTypeDelay:y.ComponentOptions.buildNumberOption({defaultValue:50,min:0,section:"Advanced Options"}),enableQuerySyntax:y.ComponentOptions.buildBooleanOption({defaultValue:!1,section:"Advanced Options"}),enableWildcards:y.ComponentOptions.buildBooleanOption({defaultValue:!1,section:"Advanced Options"}),enableQuestionMarks:y.ComponentOptions.buildBooleanOption({defaultValue:!1,depend:"enableWildcards"}),enableLowercaseOperators:y.ComponentOptions.buildBooleanOption({defaultValue:!1,depend:"enableQuerySyntax"}),enablePartialMatch:y.ComponentOptions.buildBooleanOption({defaultValue:!1}),partialMatchKeywords:y.ComponentOptions.buildNumberOption({defaultValue:5,min:1,depend:"enablePartialMatch"}),partialMatchThreshold:y.ComponentOptions.buildStringOption({defaultValue:"50%",depend:"enablePartialMatch"}),triggerQueryOnClear:y.ComponentOptions.buildBooleanOption({defaultValue:!1})},t}(f.Component);t.Querybox=v,m.Initialization.registerAutoCreateComponent(v)},176:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(493),o=n(495),s=n(497),r=n(0),u=n(498),a=n(219),l=n(499),c=function(){function e(e,t){void 0===t&&(t={}),this.expressions={},this.start=new i.ExpressionRef(e,null,"start",this),this.addExpressions(t)}return e.prototype.addExpressions=function(e){var t=this;r.each(e,function(e,n){t.addExpression(n,e)})},e.prototype.addExpression=function(t,n){if(t in this.expressions)throw new Error("Grammar already contain the id:"+t);this.expressions[t]=e.buildExpression(n,t,this)},e.prototype.getExpression=function(e){return this.expressions[e]},e.prototype.parse=function(e){return this.start.parse(e,!0)},e.buildExpression=function(e,t,n){if(void 0===e)throw new Error("Invalid Expression: "+e);if(r.isString(e))return this.buildStringExpression(e,t,n);if(r.isArray(e))return new o.ExpressionOptions(r.map(e,function(e,o){return new i.ExpressionRef(e,null,t+"_"+o,n)}),t);if(r.isRegExp(e))return new s.ExpressionRegExp(e,t,n);if(r.isFunction(e))return new u.ExpressionFunction(e,t,n);throw new Error("Invalid Expression: "+e)},e.buildStringExpression=function(t,n,o){var s=e.stringMatch(t,e.spliter),u=r.map(s,function(e,t){if(e[1]){var s=e[1],r=e[3]?Number(e[3]):e[2]||null;return new i.ExpressionRef(s,r,n+"_"+t,o)}return new a.ExpressionConstant(e[4],n+"_"+t)});if(1==u.length){var c=u[0];return c.id=n,c}return new l.ExpressionList(u,n)},e.stringMatch=function(e,t){for(var n=[],i=new RegExp(t.source,"g"),o=i.exec(e);null!==o;)n.push(o),o=i.exec(e);return n},e.spliter=/\[(\w+)(\*|\+|\?|\{([1-9][0-9]*)\})?\]|(.[^\[]*)/,e}();t.Grammar=c},193: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.__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}),n(574);var s=n(0),r=n(0),u=n(35),a=n(34),l=n(11),c=n(100),p=n(3),h=n(176),g=n(508),d=n(509),f=n(222),y=n(5),m=n(28),b=n(18),x=n(13),v=n(6),S=n(1),O=n(4),w=n(10),E=n(128),C=n(126),A=n(7),Q=n(8),P=n(2),R=n(139),T=n(511),_=n(140),B=n(19),$=n(575),F=n(576),M=n(577),D=n(578),N=function(e){function t(n,i,o){var s=e.call(this,n,t.ID,o)||this;s.element=n,s.options=i,s.lastSuggestions=[],s.movedOnce=!1,s.skipAutoSuggest=!1,s.options=Q.ComponentOptions.initComponentOptions(n,t,i);var r=s.options.enableQuerySyntax;return new T.QueryboxOptionsProcessing(s).postProcess(),s.omniboxAnalytics=s.searchInterface.getOmniboxAnalytics(),S.$$(s.element).toggleClass("coveo-query-syntax-disabled",0==s.options.enableQuerySyntax),s.suggestionAddon=s.options.enableQuerySuggestAddon?new D.QuerySuggestAddon(s):new D.VoidQuerySuggestAddon,new F.OldOmniboxAddon(s),s.createMagicBox(),s.bind.onRootElement(l.QueryEvents.newQuery,function(e){return s.handleNewQuery(e)}),s.bind.onRootElement(l.QueryEvents.buildingQuery,function(e){return s.handleBuildingQuery(e)}),s.bind.onRootElement(c.StandaloneSearchInterfaceEvents.beforeRedirect,function(){return s.handleBeforeRedirect()}),s.bind.onRootElement(l.QueryEvents.querySuccess,function(){return s.handleQuerySuccess()}),s.bind.onQueryState(b.MODEL_EVENTS.CHANGE_ONE,x.QUERY_STATE_ATTRIBUTES.Q,function(e){return s.handleQueryStateChanged(e)}),s.isAutoSuggestion()&&s.bind.onRootElement(l.QueryEvents.duringQuery,function(e){return s.handleDuringQuery(e)}),s.bind.onComponentOptions(b.MODEL_EVENTS.CHANGE_ONE,m.COMPONENT_OPTIONS_ATTRIBUTES.SEARCH_BOX,function(e){null!=e.value.enableQuerySyntax?s.options.enableQuerySyntax=e.value.enableQuerySyntax:s.options.enableQuerySyntax=r,s.updateGrammar()}),s.bind.onRootElement(a.OmniboxEvents.querySuggestGetFocus,function(e){return s.handleQuerySuggestGetFocus(e)}),s}return i(t,e),t.prototype.submit=function(){var e=this;this.magicBox.clearSuggestion(),this.updateQueryState(),this.triggerNewQuery(!1,function(){C.logSearchBoxSubmitEvent(e.usageAnalytics)}),this.magicBox.blur()},t.prototype.getText=function(){return this.magicBox.getText()},t.prototype.setText=function(e){this.magicBox.setText(e),this.updateQueryState()},t.prototype.clear=function(){this.magicBox.clear()},t.prototype.getInput=function(){return this.magicBox.element.querySelector("input")},t.prototype.getResult=function(){return this.magicBox.getResult()},t.prototype.getDisplayedResult=function(){return this.magicBox.getDisplayedResult()},t.prototype.getCursor=function(){return this.magicBox.getCursor()},t.prototype.resultAtCursor=function(e){return this.magicBox.resultAtCursor(e)},t.prototype.createGrammar=function(){var e=null;return this.options.enableQuerySyntax?(e=d.Expressions(g.Complete),this.options.enableFieldAddon&&new $.FieldAddon(this),null!=this.options.fieldAlias&&(this.options.listOfFields=this.options.listOfFields||[],this.options.listOfFields=this.options.listOfFields.concat(s.keys(this.options.fieldAlias))),this.options.enableQueryExtensionAddon&&new M.QueryExtensionAddon(this)):e={start:"Any",expressions:{Any:/.*/}},null!=this.options.grammar&&(e=this.options.grammar(e)),e},t.prototype.updateGrammar=function(){var e=this.createGrammar();this.magicBox.grammar=new h.Grammar(e.start,e.expressions),this.magicBox.setText(this.magicBox.getText())},t.prototype.createMagicBox=function(){var e=this.createGrammar();this.magicBox=f.createMagicBox(this.element,new h.Grammar(e.start,e.expressions),{inline:this.options.inline,selectableSuggestionClass:"coveo-omnibox-selectable",selectedSuggestionClass:"coveo-omnibox-selected",suggestionTimeout:this.options.omniboxTimeout});var t=S.$$(this.magicBox.element).find("input");t&&S.$$(t).setAttribute("aria-label",v.l("Search")),this.setupMagicBox()},t.prototype.setupMagicBox=function(){var e=this;this.magicBox.onmove=function(){e.isAutoSuggestion()&&(e.modifyEventTo=e.getOmniboxAnalyticsEventCause()),e.movedOnce=!0},this.magicBox.onfocus=function(){e.isAutoSuggestion()&&(e.skipAutoSuggest=!0)},this.magicBox.onSuggestions=function(t){O.Utils.isEmptyString(e.getText())&&(e.omniboxAnalytics.partialQueries=[]),e.movedOnce=!1,e.lastSuggestions=t,e.isAutoSuggestion()&&!e.skipAutoSuggest&&e.searchAsYouType()},this.options.enableSearchAsYouType&&S.$$(this.element).addClass("coveo-magicbox-search-as-you-type"),this.magicBox.onchange=function(){e.skipAutoSuggest=!1;var t=e.getText();void 0!=t&&""!=t?e.isAutoSuggestion()?e.movedOnce&&e.searchAsYouType(!0):e.options.enableSearchAsYouType&&e.searchAsYouType(!0):e.clear()},this.options.placeholder&&(this.magicBox.element.querySelector("input").placeholder=this.options.placeholder),this.magicBox.onsubmit=function(){return e.submit()},this.magicBox.onselect=function(t){var n=s.indexOf(e.lastSuggestions,t),i=s.compact(s.map(e.lastSuggestions,function(e){return e.text}));e.magicBox.clearSuggestion(),e.updateQueryState(),e.isAutoSuggestion()?e.isAutoSuggestion()&&e.movedOnce?e.handleAutoSuggestionWithKeyboard(n,i):e.isAutoSuggestion()&&!e.movedOnce&&e.handleAutoSuggestionsWithMouse(n,i):(e.usageAnalytics.cancelAllPendingEvents(),e.triggerNewQuery(!1,function(){e.usageAnalytics.logSearchEvent(e.getOmniboxAnalyticsEventCause(),e.buildCustomDataForPartialQueries(n,i))})),e.isAutoSuggestion()&&(e.omniboxAnalytics.partialQueries=[])},this.magicBox.onblur=function(){e.isAutoSuggestion()&&(e.setText(e.getQuery(!0)),e.usageAnalytics.sendAllPendingEvents())},this.magicBox.onclear=function(){e.updateQueryState(),(e.options.triggerQueryOnClear||e.options.enableSearchAsYouType)&&e.triggerNewQuery(!1,function(){e.usageAnalytics.logSearchEvent(w.analyticsActionCauseList.searchboxClear,{})})},this.magicBox.ontabpress=function(){e.handleTabPress()},this.magicBox.getSuggestions=function(){return e.handleSuggestions()}},t.prototype.handleAutoSuggestionWithKeyboard=function(e,t){var n=this;this.searchAsYouTypeTimeout?(this.usageAnalytics.cancelAllPendingEvents(),clearTimeout(this.searchAsYouTypeTimeout),this.searchAsYouTypeTimeout=void 0,this.triggerNewQuery(!1,function(){n.usageAnalytics.logSearchEvent(n.getOmniboxAnalyticsEventCause(),n.buildCustomDataForPartialQueries(e,t))})):(this.modifyEventTo=this.getOmniboxAnalyticsEventCause(),this.modifyCustomDataOnPending(e,t),this.modifyQueryContentOnPending(),this.usageAnalytics.sendAllPendingEvents())},t.prototype.handleAutoSuggestionsWithMouse=function(e,t){var n=this;this.searchAsYouTypeTimeout||0!=e?(this.clearSearchAsYouType(),this.usageAnalytics.cancelAllPendingEvents(),this.triggerNewQuery(!1,function(){n.usageAnalytics.logSearchEvent(n.getOmniboxAnalyticsEventCause(),n.buildCustomDataForPartialQueries(e,t))})):(this.modifyEventTo=this.getOmniboxAnalyticsEventCause(),this.modifyCustomDataOnPending(e,t),this.modifyQueryContentOnPending(),this.usageAnalytics.sendAllPendingEvents(),this.lastQuery!=this.getText()&&this.triggerNewQuery(!1,function(){n.usageAnalytics.logSearchEvent(n.getOmniboxAnalyticsEventCause(),n.buildCustomDataForPartialQueries(e,t))}))},t.prototype.modifyCustomDataOnPending=function(e,t){var n=this.usageAnalytics.getPendingSearchEvent();if(n instanceof E.PendingSearchAsYouTypeSearchEvent){var i=this.buildCustomDataForPartialQueries(e,t);s.each(s.keys(i),function(e){n.modifyCustomData(e,i[e])})}},t.prototype.modifyQueryContentOnPending=function(){var e=this.usageAnalytics.getPendingSearchEvent();if(e instanceof E.PendingSearchAsYouTypeSearchEvent){var t=this.getQuery(this.options.enableSearchAsYouType);e.modifyQueryContent(t)}},t.prototype.buildCustomDataForPartialQueries=function(e,t){return this.updateOmniboxAnalytics(t,e),this.omniboxAnalytics.buildCustomDataForPartialQueries()},t.prototype.handleQuerySuggestGetFocus=function(e){var t=e.suggestion,n=s.compact(s.map(this.lastSuggestions,function(e){return e.text})),i=this.lastSuggestions.indexOf(r.findWhere(this.lastSuggestions,{text:t}));this.updateOmniboxAnalytics(n,i)},t.prototype.updateOmniboxAnalytics=function(e,t){this.omniboxAnalytics.suggestions=e,this.omniboxAnalytics.suggestionRanking=t},t.prototype.handleSuggestions=function(){var e=this.getText();if(this.options.querySuggestCharacterThreshold<=e.length){var t={suggestions:[],omnibox:this};return this.triggerOmniboxSuggestions(t),O.Utils.isNullOrEmptyString(e)||this.omniboxAnalytics.partialQueries.push(e),s.compact(t.suggestions)}return[]},t.prototype.triggerOmniboxSuggestions=function(e){this.bind.trigger(this.element,a.OmniboxEvents.populateOmniboxSuggestions,e),S.$$(this.element).isDescendant(this.root)||this.bind.trigger(this.root,a.OmniboxEvents.populateOmniboxSuggestions,e)},t.prototype.handleBeforeRedirect=function(){this.updateQueryState()},t.prototype.handleBuildingQuery=function(e){var t=this;y.Assert.exists(e),y.Assert.exists(e.queryBuilder),this.updateQueryState(),this.lastQuery=this.getQuery(e.searchAsYouType);var n=this.lastQuery==this.magicBox.getDisplayedResult().input?this.magicBox.getDisplayedResult().clone():this.magicBox.grammar.parse(this.lastQuery).clean(),i={result:n};if(this.options.enableQuerySyntax){var o=i.result.findAll("FieldValueNotQuoted");if(s.each(o,function(e){return e.value='"'+e.value.replace(/"|\u00A0/g," ")+'"'}),this.options.fieldAlias){var r=i.result.findAll(function(e){return"FieldName"==e.expression.id&&e.isSuccess()});s.each(r,function(e){var n=s.find(s.keys(t.options.fieldAlias),function(t){return t.toLowerCase()==e.value.toLowerCase()});null!=n&&(e.value=t.options.fieldAlias[n])})}}this.triggerOmniboxPreprocessResultForQuery(i);var u=i.result.toString();new _.QueryboxQueryParameters(this.options).addParameters(e.queryBuilder,u)},t.prototype.triggerOmniboxPreprocessResultForQuery=function(e){this.bind.trigger(this.element,a.OmniboxEvents.omniboxPreprocessResultForQuery,e),S.$$(this.element).isDescendant(this.root)||this.bind.trigger(this.root,a.OmniboxEvents.omniboxPreprocessResultForQuery,e)},t.prototype.handleNewQuery=function(e){y.Assert.exists(e),this.options.clearFiltersOnNewQuery&&this.clearFiltersIfNewQuery(e)},t.prototype.clearFiltersIfNewQuery=function(e){var n=e.origin,i=e.searchAsYouType;if(!this.queryController.firstQuery){var o=[t.ID,"SearchButton"];if(n&&-1!==o.indexOf(n.type)){(this.queryController.getLastQuery().q||"")!==this.getQuery(i)&&this.bind.trigger(this.root,u.BreadcrumbEvents.clearBreadcrumb)}}},t.prototype.handleTabPress=function(){this.options.enableQuerySuggestAddon&&this.handleTabPressForSuggestions(),this.handleTabPressForOldOmniboxAddon()},t.prototype.handleTabPressForSuggestions=function(){if(this.options.enableSearchAsYouType)this.setText(this.getQuery(!0));else{var e=s.compact(s.map(this.lastSuggestions,function(e){return e.text}));this.usageAnalytics.logCustomEvent(this.getOmniboxAnalyticsEventCause(),this.buildCustomDataForPartialQueries(0,e),this.element)}},t.prototype.handleTabPressForOldOmniboxAddon=function(){var e=this.lastSuggestions.filter(function(e){return e.dom}).map(function(e){return S.$$(e.dom)}),t=this.findAllElementsWithClass(e,".coveo-omnibox-selected");if(t.length>0)S.$$(t[0]).trigger("tabSelect");else if(!this.options.enableQuerySuggestAddon){var n=this.findAllElementsWithClass(e,".coveo-omnibox-selectable");n.length>0&&S.$$(n[0]).trigger("tabSelect")}},t.prototype.findAllElementsWithClass=function(e,t){return e.map(function(e){return e.find(t)}).filter(function(e){return e}).reduce(function(e,t){return e.concat(t)},[])},t.prototype.triggerNewQuery=function(e,t){clearTimeout(this.searchAsYouTypeTimeout);var n=this.shouldExecuteQuery(e);this.lastQuery=this.getQuery(e),n&&t(),this.queryController.executeQuery({searchAsYouType:e,logInActionsHistory:!0,cancel:!n,origin:this})},t.prototype.getQuery=function(e){if(this.lastQuery==this.magicBox.getText())return this.lastQuery;if(!e)return this.magicBox.getText();var t=this.magicBox.getWordCompletion();if(null!=t)return t;var n=this.magicBox.getWordCompletion()||this.getFirstSuggestion();return n||(this.isAutoSuggestion()?this.lastQuery||this.magicBox.getText():this.magicBox.getText())},t.prototype.getFirstSuggestion=function(){if(null==this.lastSuggestions)return"";if(this.lastSuggestions.length<=0)return"";var e=s.find(this.lastSuggestions,function(e){return null!=e.text});return null==e?"":e.text},t.prototype.updateQueryState=function(){this.queryStateModel.set(x.QueryStateModel.attributesEnum.q,this.magicBox.getText())},t.prototype.handleQueryStateChanged=function(e){y.Assert.exists(e);var t=e.value;t!=this.magicBox.getText()&&this.magicBox.setText(t)},t.prototype.handleQuerySuccess=function(){this.isAutoSuggestion()||(this.omniboxAnalytics.partialQueries=[])},t.prototype.handleDuringQuery=function(e){var t=this;e.promise.then(function(){var n=t.usageAnalytics.getPendingSearchEvent();n instanceof E.PendingSearchAsYouTypeSearchEvent&&n.beforeResolve.then(function(n){e.promise.then(function(){t.modifyEventTo&&(n.modifyEventCause(t.modifyEventTo),t.modifyEventTo=null)})})})},t.prototype.searchAsYouType=function(e){var t=this;void 0===e&&(e=!1),this.clearSearchAsYouType(),this.shouldExecuteQuery(!0)&&(this.searchAsYouTypeTimeout=window.setTimeout(function(){if(t.suggestionShouldTriggerQuery()||e){var n=s.map(t.lastSuggestions,function(e){return e.text}),i=s.indexOf(n,t.magicBox.getWordCompletion());t.triggerNewQuery(!0,function(){t.usageAnalytics.logSearchAsYouType(w.analyticsActionCauseList.searchboxAsYouType,t.buildCustomDataForPartialQueries(i,n))}),t.clearSearchAsYouType()}},this.options.searchAsYouTypeDelay))},t.prototype.isAutoSuggestion=function(){return this.options.enableSearchAsYouType&&this.options.enableQuerySuggestAddon},t.prototype.shouldExecuteQuery=function(e){var t=this.getQuery(e);return!1===this.searchInterface.options.allowQueriesWithoutKeywords?this.lastQuery!=t&&O.Utils.isNonEmptyString(t):this.lastQuery!=t&&null!=t},t.prototype.suggestionShouldTriggerQuery=function(e){if(void 0===e&&(e=this.lastSuggestions),this.shouldExecuteQuery(!0)&&e&&e[0]){var t=e[0];if(t&&void 0!=t.executableConfidence)return t.executableConfidence>=.8;if(t.text&&0==t.text.indexOf(this.magicBox.getText()))return!0}return!1},t.prototype.clearSearchAsYouType=function(){clearTimeout(this.searchAsYouTypeTimeout),this.searchAsYouTypeTimeout=void 0},t.prototype.getOmniboxAnalyticsEventCause=function(){return this.searchInterface instanceof B.StandaloneSearchInterface?w.analyticsActionCauseList.omniboxFromLink:w.analyticsActionCauseList.omniboxAnalytics},t.ID="Omnibox",t.doExport=function(){p.exportGlobally({Omnibox:t,QueryboxQueryParameters:_.QueryboxQueryParameters})},t.options={inline:Q.ComponentOptions.buildBooleanOption({defaultValue:!1}),enableSearchAsYouType:Q.ComponentOptions.buildBooleanOption({defaultValue:!1,section:"Advanced Options"}),searchAsYouTypeDelay:Q.ComponentOptions.buildNumberOption({defaultValue:2e3,min:0,depend:"enableSearchAsYouType",section:"Advanced Options"}),enableFieldAddon:Q.ComponentOptions.buildBooleanOption({defaultValue:!1,depend:"enableQuerySyntax",postProcessing:function(e,t){return e&&(t.enableQuerySyntax=!0),e},section:"Advanced Options"}),enableSimpleFieldAddon:Q.ComponentOptions.buildBooleanOption({defaultValue:!1,depend:"enableFieldAddon"}),listOfFields:Q.ComponentOptions.buildFieldsOption({depend:"enableFieldAddon"}),enableQuerySuggestAddon:Q.ComponentOptions.buildBooleanOption({defaultValue:!0,alias:["enableTopQueryAddon","enableRevealQuerySuggestAddon"]}),enableQueryExtensionAddon:Q.ComponentOptions.buildBooleanOption({defaultValue:!1,depend:"enableQuerySyntax",postProcessing:function(e,t){return e&&(t.enableQuerySyntax=!0),e},section:"Advanced Options"}),placeholder:Q.ComponentOptions.buildLocalizedStringOption(),omniboxTimeout:Q.ComponentOptions.buildNumberOption({defaultValue:2e3,min:0}),enableQuerySyntax:Q.ComponentOptions.buildBooleanOption({defaultValue:!1,section:"Advanced Options"}),numberOfSuggestions:Q.ComponentOptions.buildNumberOption({defaultValue:5,min:1}),querySuggestCharacterThreshold:Q.ComponentOptions.buildNumberOption({defaultValue:0,min:0}),clearFiltersOnNewQuery:Q.ComponentOptions.buildBooleanOption({defaultValue:!1})},t}(A.Component);t.Omnibox=N,N.options=o({},N.options,R.Querybox.options),P.Initialization.registerAutoCreateComponent(N)},195: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(3),s=n(6),r=n(15),u=n(1),a=n(16),l=n(12),c=n(4),p=n(10),h=n(7),g=n(2),d=n(13),f=function(e){function t(n,i,o){var p=e.call(this,n,t.ID,o)||this;if(p.element=n,p.options=i,(new r.AccessibleButton).withElement(n).withOwner(p.bind).withLabel(s.l("Search")).withSelectAction(function(){return p.handleClick()}).build(),""==c.Utils.trim(u.$$(p.element).text())){var h=u.$$("span",{className:"coveo-search-button"},l.SVGIcons.icons.search).el;a.SVGDom.addClassToSVGInContainer(h,"coveo-search-button-svg");var g=u.$$("span",{className:"coveo-search-button-loading"},l.SVGIcons.icons.loading).el;a.SVGDom.addClassToSVGInContainer(g,"coveo-search-button-loading-svg"),n.appendChild(h),n.appendChild(g)}return p}return i(t,e),t.prototype.click=function(){this.handleClick()},t.prototype.handleClick=function(){this.logger.debug("Performing query following button click"),this.updateQueryStateModelWithSearchboxQuery(),this.usageAnalytics.logSearchEvent(p.analyticsActionCauseList.searchboxSubmit,{}),this.queryController.executeQuery({origin:this,logInActionsHistory:!0})},t.prototype.updateQueryStateModelWithSearchboxQuery=function(){var e=this.options&&this.options.searchbox;e&&this.queryStateModel.set(d.QueryStateModel.attributesEnum.q,e.getText())},t.ID="SearchButton",t.doExport=function(){o.exportGlobally({SearchButton:t})},t.options={},t}(h.Component);t.SearchButton=f,g.Initialization.registerAutoCreateComponent(f)},218:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ExpressionEndOfInput={id:"end of input",parse:null}},219:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(52),o=n(52),s=function(){function e(e,t){this.value=e,this.id=t}return e.prototype.parse=function(e,t){var n=0==e.indexOf(this.value),s=new i.Result(n?this.value:null,this,e);return n&&t&&e.length>this.value.length?new o.EndOfInputResult(s):s},e.prototype.toString=function(){return this.value},e}();t.ExpressionConstant=s},220:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(133),o=n(501);t.Field={basicExpressions:["FieldSimpleQuery","FieldQuery","Field"],grammars:{FieldQuery:"[Field][OptionalSpaces][FieldQueryOperation]",FieldQueryOperation:["FieldQueryValue","FieldQueryNumeric"],FieldQueryValue:"[FieldOperator][OptionalSpaces][FieldValue]",FieldQueryNumeric:"[FieldOperatorNumeric][OptionalSpaces][FieldValueNumeric]",FieldSimpleQuery:"[FieldName]:[OptionalSpaces][FieldValue]",Field:"@[FieldName]",FieldName:/[a-zA-Z][a-zA-Z0-9\.\_]*/,FieldOperator:/==|=|<>/,FieldOperatorNumeric:/<=|>=|<|>/,FieldValue:["DateRange","NumberRange","DateRelative","Date","Number","FieldValueList","FieldValueString"],FieldValueNumeric:["DateRelative","Date","Number"],FieldValueString:["DoubleQuoted","FieldValueNotQuoted"],FieldValueList:"([FieldValueString][FieldValueStringList*])",FieldValueStringList:"[FieldValueSeparator][FieldValueString]",FieldValueSeparator:/ *, */,FieldValueNotQuoted:/[^ \(\)\[\],]+/,NumberRange:"[Number][Spaces?]..[Spaces?][Number]"},include:[o.Date,i.Basic]}},221: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 u(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,u)}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,u,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return u={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u};Object.defineProperty(t,"__esModule",{value:!0});var s,r=n(0),u=n(34),a=n(7),l=n(1),c=n(564),p=n(505),h=n(21);!function(e){e.Up="Up",e.Down="Down",e.Left="Left",e.Right="Right"}(s=t.Direction||(t.Direction={}));var g=function(){function e(e,t,n,i){var o=this;this.element=e,this.magicBoxContainer=t,this.inputManager=n,this.suggestionListboxID="coveo-magicbox-suggestions-"+h.QueryUtils.createGuid(),this.suggestionListboxClassName="coveo-magicbox-suggestions",this.root=a.Component.resolveRoot(e),this.options=r.defaults(i,{suggestionClass:"magic-box-suggestion",selectedClass:"magic-box-selected"}),void 0==this.options.timeout&&(this.options.timeout=500),l.$$(this.element).on("mouseover",function(e){o.handleMouseOver(e)}),l.$$(this.element).on("mouseout",function(e){o.handleMouseOut(e)}),this.suggestionsProcessor=new p.QueryProcessor({timeout:this.options.timeout}),this.resultPreviewsManager=new c.ResultPreviewsManager(e,{selectedClass:this.options.selectedClass,timeout:this.options.timeout}),this.suggestionsListbox=this.buildSuggestionsContainer(),l.$$(this.element).append(this.suggestionsListbox.el),this.addAccessibilityProperties(),this.appendEmptySuggestionOption()}return Object.defineProperty(e.prototype,"hasSuggestions",{get:function(){return this.currentSuggestions&&this.currentSuggestions.length>0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hasFocus",{get:function(){return l.$$(this.element).findClass(this.options.selectedClass).length>0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hasPreviews",{get:function(){return this.resultPreviewsManager.hasPreviews},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"focusedSuggestion",{get:function(){var e=this;return r.find(this.currentSuggestions,function(t){return l.$$(t.dom).hasClass(e.options.selectedClass)||l.$$(t.dom).findClass(e.options.selectedClass).length>0})},enumerable:!0,configurable:!0}),e.prototype.handleMouseOver=function(e){var t=l.$$(e.target),n=t.parents(this.options.suggestionClass);t.hasClass(this.options.suggestionClass)?this.processMouseSelection(t.el):n.length>0&&this.element.contains(n[0])&&this.processMouseSelection(n[0])},e.prototype.handleMouseOut=function(e){var t=l.$$(e.target),n=t.parents(this.options.suggestionClass);if(e.relatedTarget&&l.$$(e.relatedTarget).isValid()){var i=l.$$(e.relatedTarget).parents(this.options.suggestionClass);t.hasClass(this.options.selectedClass)&&!l.$$(e.relatedTarget).hasClass(this.options.suggestionClass)?this.removeSelectedStatus(t.el):0==i.length&&n.length>0&&this.removeSelectedStatus(n[0])}else t.hasClass(this.options.selectedClass)?this.removeSelectedStatus(t.el):n.length>0&&this.removeSelectedStatus(n[0]);l.$$(this.root).trigger(u.OmniboxEvents.querySuggestLoseFocus)},e.prototype.moveDown=function(){return i(this,void 0,void 0,function(){return o(this,function(e){switch(e.label){case 0:return[4,this.move(s.Down)];case 1:return e.sent(),[2]}})})},e.prototype.moveUp=function(){return i(this,void 0,void 0,function(){return o(this,function(e){switch(e.label){case 0:return[4,this.move(s.Up)];case 1:return e.sent(),[2]}})})},e.prototype.moveLeft=function(){return i(this,void 0,void 0,function(){return o(this,function(e){switch(e.label){case 0:return[4,this.move(s.Left)];case 1:return e.sent(),[2]}})})},e.prototype.moveRight=function(){return i(this,void 0,void 0,function(){return o(this,function(e){switch(e.label){case 0:return[4,this.move(s.Right)];case 1:return e.sent(),[2]}})})},e.prototype.selectAndReturnKeyboardFocusedElement=function(){var e=this.keyboardFocusedElement;return e&&(l.$$(e).trigger("keyboardSelect"),this.keyboardFocusedElement=null,this.inputManager.blur()),e},e.prototype.clearKeyboardFocusedElement=function(){this.keyboardFocusedElement=null},e.prototype.receiveSuggestions=function(e){return i(this,void 0,void 0,function(){var t,n,i;return o(this,function(o){switch(o.label){case 0:return[4,this.suggestionsProcessor.processQueries(e)];case 1:return t=o.sent(),(n=t.results,i=t.status,i===p.ProcessingStatus.Overriden)?[2,[]]:(this.updateSuggestions(n),[2,n])}})})},e.prototype.clearSuggestions=function(){this.updateSuggestions([])},e.prototype.updateSuggestions=function(e){var t=this;if(this.suggestionsListbox.empty(),this.inputManager.activeDescendant=null,this.currentSuggestions=e,l.$$(this.element).toggleClass("magic-box-hasSuggestion",this.hasSuggestions),this.inputManager.expanded=this.hasSuggestions,this.resultPreviewsManager.displaySearchResultPreviewsForSuggestion(null),!this.hasSuggestions)return this.appendEmptySuggestionOption(),void l.$$(this.root).trigger(u.OmniboxEvents.querySuggestLoseFocus);e.sort(function(e,t){return(t.index||0)-(e.index||0)}).forEach(function(n){var i=n.dom?t.modifyDomFromExistingSuggestion(n.dom):t.createDomFromSuggestion(n);i.setAttribute("id","magic-box-suggestion-"+r.indexOf(e,n)),i.setAttribute("role","option"),i.setAttribute("aria-selected","false"),i.setAttribute("aria-label",i.text()),i.suggestion=n,t.suggestionsListbox.append(i.el)});var n=this.suggestionsListbox.findAll("."+this.options.suggestionClass).length;l.$$(this.root).trigger(u.OmniboxEvents.querySuggestRendered,{numberOfSuggestions:n})},Object.defineProperty(e.prototype,"selectedSuggestion",{get:function(){return this.htmlElementIsSuggestion(this.keyboardFocusedElement)?this.returnMoved(this.keyboardFocusedElement):null},enumerable:!0,configurable:!0}),e.prototype.processKeyboardSelection=function(e){return i(this,void 0,void 0,function(){return o(this,function(t){switch(t.label){case 0:return this.addSelectedStatus(e),this.keyboardFocusedElement=e,[4,this.updateSelectedSuggestion(this.focusedSuggestion)];case 1:return t.sent(),[2]}})})},e.prototype.processKeyboardPreviewSelection=function(e){this.addSelectedStatus(e),this.keyboardFocusedElement=e},e.prototype.processMouseSelection=function(e){this.addSelectedStatus(e),this.updateSelectedSuggestion(this.focusedSuggestion),this.keyboardFocusedElement=null},e.prototype.buildSuggestionsContainer=function(){return l.$$("div",{className:this.suggestionListboxClassName,id:this.suggestionListboxID,role:"listbox",ariaLabel:"Search Suggestions"})},e.prototype.createDomFromSuggestion=function(e){var t=this,n=l.$$("div",{className:"magic-box-suggestion "+this.options.suggestionClass});if(e.dom=n.el,n.on("click",function(){t.selectSuggestion(e)}),n.on("keyboardSelect",function(){t.selectSuggestion(e)}),e.html)return n.el.innerHTML=e.html,n;if(e.text)return n.text(e.text),n;if(e.separator){n.addClass("magic-box-suggestion-seperator");var i=l.$$("div",{className:"magic-box-suggestion-seperator-label"},e.separator);return n.append(i.el),n}return n},e.prototype.selectSuggestion=function(e){e.onSelect(),l.$$(this.root).trigger(u.OmniboxEvents.querySuggestSelection,{suggestion:e.text})},e.prototype.appendEmptySuggestionOption=function(){this.suggestionsListbox.append(l.$$("div",{role:"option"}).el)},e.prototype.modifyDomFromExistingSuggestion=function(e){this.removeSelectedStatus(e);var t=e.classList.contains(this.options.suggestionClass)?e:l.$$(e).find("."+this.options.suggestionClass);return this.removeSelectedStatus(t),l.$$(e)},e.prototype.move=function(e){return i(this,void 0,void 0,function(){var t;return o(this,function(n){switch(n.label){case 0:return this.resultPreviewsManager.focusedPreviewElement?[4,this.moveWithinPreview(e)]:[3,2];case 1:return n.sent(),[2];case 2:return e!==s.Right&&e!==s.Left||!(t=this.resultPreviewsManager.previewElements[0])?[4,this.moveWithinSuggestion(e)]:(this.processKeyboardPreviewSelection(t),[2]);case 3:return n.sent(),[2]}})})},e.prototype.moveWithinSuggestion=function(e){return i(this,void 0,void 0,function(){var t,n,i,u;return o(this,function(o){switch(o.label){case 0:return t=l.$$(this.element).find("."+this.options.selectedClass),n=l.$$(this.element).findAll("."+this.options.suggestionClass),i=r.indexOf(n,t),u=e===s.Up?i-1:i+1,u=(u+n.length)%n.length,[4,this.selectQuerySuggest(n[u])];case 1:return o.sent(),[2]}})})},e.prototype.selectQuerySuggest=function(e){return i(this,void 0,void 0,function(){return o(this,function(t){switch(t.label){case 0:return e?[4,this.processKeyboardSelection(e)]:[3,2];case 1:return t.sent(),[3,3];case 2:this.keyboardFocusedElement=null,this.inputManager.input.removeAttribute("aria-activedescendant"),t.label=3;case 3:return[2,e]}})})},e.prototype.moveWithinPreview=function(e){return i(this,void 0,void 0,function(){var t;return o(this,function(n){switch(n.label){case 0:return t=this.resultPreviewsManager.getElementInDirection(e),t?[3,2]:[4,this.selectQuerySuggest(this.resultPreviewsManager.previewsOwner.dom)];case 1:return n.sent(),[2];case 2:return this.processKeyboardPreviewSelection(t),[2]}})})},e.prototype.returnMoved=function(e){if(e){if(e.suggestion)return e.suggestion;if(e["no-text-suggestion"])return null;if(e instanceof HTMLElement)return{text:l.$$(e).text()}}return null},e.prototype.addSelectedStatus=function(e){for(var t=this.element.getElementsByClassName(this.options.selectedClass),n=0;n<t.length;n++){var i=t.item(n);this.removeSelectedStatus(i)}l.$$(e).addClass(this.options.selectedClass),this.updateAreaSelectedIfDefined(e,"true")},e.prototype.updateSelectedSuggestion=function(e){return i(this,void 0,void 0,function(){return o(this,function(t){switch(t.label){case 0:return l.$$(this.root).trigger(u.OmniboxEvents.querySuggestGetFocus,{suggestion:e.text}),[4,this.resultPreviewsManager.displaySearchResultPreviewsForSuggestion(e)];case 1:return t.sent(),[2]}})})},e.prototype.removeSelectedStatus=function(e){l.$$(e).removeClass(this.options.selectedClass),this.updateAreaSelectedIfDefined(e,"false")},e.prototype.updateAreaSelectedIfDefined=function(e,t){l.$$(e).getAttribute("aria-selected")&&(this.inputManager.activeDescendant=e,l.$$(e).setAttribute("aria-selected",t))},e.prototype.addAccessibilityProperties=function(){this.addAccessibilityPropertiesForMagicBox(),this.addAccessibilityPropertiesForInput()},e.prototype.addAccessibilityPropertiesForMagicBox=function(){var e=l.$$(this.magicBoxContainer);e.setAttribute("role","search"),e.setAttribute("aria-haspopup","listbox")},e.prototype.addAccessibilityPropertiesForInput=function(){var e=l.$$(this.inputManager.input);this.inputManager.activeDescendant=null,this.inputManager.expanded=!1,e.setAttribute("aria-owns",this.suggestionListboxID),e.setAttribute("aria-controls",this.suggestionListboxID)},e.prototype.htmlElementIsSuggestion=function(e){var t=l.$$(this.element).findAll("."+this.options.suggestionClass);return r.indexOf(t,e)>-1},e}();t.SuggestionsManager=g},222:function(e,t,n){"use strict";function i(e,t,n){return new d(e,t,n)}function o(e){return"requestAnimationFrame"in window?window.requestAnimationFrame(e):setTimeout(e)}var s=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 u(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,u)}a((i=i.apply(e,t||[])).next())})},r=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,u,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return u={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u};Object.defineProperty(t,"__esModule",{value:!0});var u=n(0),a=n(20),l=n(1),c=n(562),p=n(504),h=n(565),g=n(221),d=function(){function e(e,t,n){void 0===n&&(n={});var i=this;this.element=e,this.grammar=t,this.options=n,this.lastSuggestions=[],u.isUndefined(this.options.inline)&&(this.options.inline=!1),l.$$(e).addClass("magic-box"),this.options.inline&&l.$$(e).addClass("magic-box-inline"),this.result=this.grammar.parse(""),this.displayedResult=this.result.clean();var o=l.$$(e).find(".magic-box-input");o||(o=document.createElement("div"),o.className="magic-box-input",e.appendChild(o)),this.inputManager=new p.InputManager(o,function(e,t){t?(i.setText(e),i.onselect&&i.onselect(i.firstSuggestionWithText)):(i.setText(e),i.addSuggestions(),i.onchange&&i.onchange())},this),this.inputManager.ontabpress=function(){i.ontabpress&&i.ontabpress()};var s=this.inputManager.getValue();s&&(this.displayedResult.input=s),this.inputManager.setResult(this.displayedResult);var r=document.createElement("div");r.className="magic-box-suggestions",this.element.appendChild(r),this.suggestionsManager=new g.SuggestionsManager(r,this.element,this.inputManager,{suggestionClass:this.options.selectableSuggestionClass,selectedClass:this.options.selectedSuggestionClass,timeout:this.options.suggestionTimeout}),this.magicBoxClear=new h.MagicBoxClear(this),this.setupHandler()}return Object.defineProperty(e.prototype,"firstSuggestionWithText",{get:function(){return u.find(this.lastSuggestions,function(e){return e.text})},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"firstSuggestionText",{get:function(){var e=this.firstSuggestionWithText;return e?e.text:""},enumerable:!0,configurable:!0}),e.prototype.getResult=function(){return this.result},e.prototype.getDisplayedResult=function(){return this.displayedResult},e.prototype.setText=function(e){l.$$(this.element).toggleClass("magic-box-notEmpty",e.length>0),this.magicBoxClear.toggleTabindexAndAriaHidden(e.length>0),this.result=this.grammar.parse(e),this.displayedResult=this.result.clean(),this.inputManager.setResult(this.displayedResult)},e.prototype.setCursor=function(e){this.inputManager.setCursor(e)},e.prototype.getCursor=function(){return this.inputManager.getCursor()},e.prototype.resultAtCursor=function(e){return this.displayedResult.resultAt(this.getCursor(),e)},e.prototype.setupHandler=function(){var e=this;this.inputManager.onblur=function(){l.$$(e.element).removeClass("magic-box-hasFocus"),e.onblur&&e.onblur(),e.options.inline||e.clearSuggestion()},this.inputManager.onfocus=function(){l.$$(e.element).addClass("magic-box-hasFocus"),e.addSuggestions(),e.onfocus&&e.onfocus()},this.inputManager.onkeydown=function(t){if(e.shouldMoveInSuggestions(t))return!1;if(t===a.KEYBOARD.ENTER){return null==e.suggestionsManager.selectAndReturnKeyboardFocusedElement()&&e.onsubmit&&e.onsubmit(),!1}return t===a.KEYBOARD.ESCAPE?(e.clearSuggestion(),e.blur()):e.suggestionsManager.clearKeyboardFocusedElement(),!0},this.inputManager.onchangecursor=function(){e.addSuggestions()},this.inputManager.onkeyup=function(t){if(e.onmove&&e.onmove(),!e.shouldMoveInSuggestions(t))return!0;switch(t){case a.KEYBOARD.UP_ARROW:e.suggestionsManager.moveUp();break;case a.KEYBOARD.DOWN_ARROW:e.suggestionsManager.moveDown();break;case a.KEYBOARD.LEFT_ARROW:e.suggestionsManager.moveLeft();break;case a.KEYBOARD.RIGHT_ARROW:e.suggestionsManager.moveRight()}return e.suggestionsManager.selectedSuggestion&&e.focusOnSuggestion(e.suggestionsManager.selectedSuggestion),e.onchange&&e.onchange(),!1}},e.prototype.addSuggestions=function(){return s(this,void 0,void 0,function(){var e;return r(this,function(t){switch(t.label){case 0:return[4,this.suggestionsManager.receiveSuggestions(null!=this.getSuggestions?this.getSuggestions():[])];case 1:return e=t.sent(),this.addSelectEventHandlers(e),this.inputManager.setWordCompletion(this.firstSuggestionText),this.onSuggestions(e),[2]}})})},e.prototype.shouldMoveInSuggestions=function(e){switch(e){case a.KEYBOARD.UP_ARROW:case a.KEYBOARD.DOWN_ARROW:return!0;case a.KEYBOARD.LEFT_ARROW:case a.KEYBOARD.RIGHT_ARROW:if(this.suggestionsManager.hasFocus&&this.suggestionsManager.hasPreviews)return!0}return!1},e.prototype.addSelectEventHandlers=function(e){var t=this;u.each(e,function(e){null==e.onSelect&&null!=e.text&&(e.onSelect=function(){t.setText(e.text),t.onselect&&t.onselect(e)})})},e.prototype.focus=function(){l.$$(this.element).addClass("magic-box-hasFocus"),this.inputManager.focus()},e.prototype.blur=function(){this.inputManager.blur()},e.prototype.clearSuggestion=function(){return s(this,void 0,void 0,function(){return r(this,function(e){return this.inputManager.setWordCompletion(null),this.suggestionsManager.clearSuggestions(),this.onSuggestions([]),[2]})})},e.prototype.focusOnSuggestion=function(e){null==e||null==e.text?this.inputManager.setResult(this.displayedResult,this.firstSuggestionText):this.inputManager.setResult(this.grammar.parse(e.text).clean(),e.text)},e.prototype.getText=function(){return this.inputManager.getValue()},e.prototype.getWordCompletion=function(){return this.inputManager.getWordCompletion()},e.prototype.clear=function(){this.setText(""),this.clearSuggestion(),this.focus(),this.onclear&&this.onclear()},e.prototype.hasSuggestions=function(){return this.suggestionsManager.hasSuggestions},e}();t.MagicBoxInstance=d,t.createMagicBox=i,t.requestAnimationFrame=o,c.doMagicBoxExport()},223:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(0),o=function(){function e(){}return e.escapeRegExp=function(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},e.highlightText=function(e,t,n,i,o){var s=this;if(void 0===n&&(n=!1),void 0===i&&(i="magic-box-hightlight"),void 0===o&&(o=""),0==t.length)return e;var r=this.escapeRegExp(t),u="("+r+")|(.*?(?="+r+")|.+)",a=new RegExp(u,n?"gi":"g");return e.replace(a,function(e,t,n){return s.escapeText(null!=t?i:o,e)})},e.escapeText=function(e,t){return'<span class="'+e+'">'+i.escape(t)+"</span>"},e}();t.MagicBoxUtils=o},282: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.__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}),n(671);var s=n(3),r=n(1),u=n(16),a=n(12),l=n(672),c=n(7),p=n(8),h=n(2),g=n(193),d=n(139),f=n(195),y=n(0),m=function(e){function t(n,i,o){var s=e.call(this,n,t.ID,o)||this;return s.element=n,s.options=i,s.bindings=o,s.options=p.ComponentOptions.initComponentOptions(n,t,i),s.options.inline&&r.$$(n).addClass("coveo-inline"),s.initSearchBox(),s.initSearchButton(),s.applyMagicBoxIcon(),s.applyCustomHeight(),s}return i(t,e),t.prototype.initSearchBox=function(){var e=document.createElement("div");this.element.appendChild(e),this.options.enableOmnibox?this.searchbox=new g.Omnibox(e,this.options,this.bindings):this.searchbox=new d.Querybox(e,this.options,this.bindings)},t.prototype.initSearchButton=function(){if(this.options.addSearchButton){var e=r.$$("a");this.element.appendChild(e.el),this.searchButton=new f.SearchButton(e.el,{searchbox:this.searchbox},this.bindings)}},t.prototype.applyMagicBoxIcon=function(){var e=r.$$(this.element).find(".magic-box-icon");e.innerHTML=a.SVGIcons.icons.mainClear,u.SVGDom.addClassToSVGInContainer(e,"magic-box-clear-svg")},t.prototype.applyCustomHeight=function(){this.options.height&&(r.$$(this.element).addClass("coveo-custom-height"),l.SearchBoxResize.resize(this.element,this.options.height))},t.ID="Searchbox",t.parent=g.Omnibox,t.doExport=function(){s.exportGlobally({Searchbox:t,SearchButton:f.SearchButton,Omnibox:g.Omnibox,Querybox:d.Querybox})},t.options={addSearchButton:p.ComponentOptions.buildBooleanOption({defaultValue:!0}),height:p.ComponentOptions.buildNumberOption({min:25}),enableOmnibox:p.ComponentOptions.buildBooleanOption({defaultValue:!0})},t}(c.Component);t.Searchbox=m,m.options=o({},m.options,g.Omnibox.options,d.Querybox.options),y.each(m.options,function(e,t){t in g.Omnibox.options&&!(t in d.Querybox.options)&&(m.options[t]=y.extend({depend:"enableOmnibox"},e))}),h.Initialization.registerAutoCreateComponent(m)},493:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(52),o=n(494),s=n(218),r=n(0),u=function(){function e(e,t,n,i){this.ref=e,this.occurrence=t,this.id=n,this.grammar=i}return e.prototype.parse=function(e,t){var n=this.grammar.getExpression(this.ref);if(null==n)throw new Error("Expression not found:"+this.ref);return"?"==this.occurrence||null==this.occurrence?this.parseOnce(e,t,n):this.parseMany(e,t,n)},e.prototype.parseOnce=function(e,t,n){var u=n.parse(e,t),a=u.isSuccess();return a||"?"!=this.occurrence?new o.RefResult([u],this,e,a?null:u):t?0==e.length?new o.RefResult([],this,e,u):r.all(u.getBestExpect(),function(e){return e.expression==s.ExpressionEndOfInput})?new o.RefResult([new i.Result(null,s.ExpressionEndOfInput,e)],this,e,u):u:new o.RefResult([],this,e,null)},e.prototype.parseMany=function(e,t,n){var u,a,l=[],c=e;do{u=n.parse(c,!1),(a=u.isSuccess())&&(l.push(u),c=c.substr(u.getLength()))}while(a&&u.input!=c);var p=r.isNumber(this.occurrence)?this.occurrence:"+"==this.occurrence?1:0;if(l.length<p)l.push(u);else if(t)if(l.length>0){var h=r.last(l);u=n.parse(h.input,!0),u.isSuccess()?l[l.length-1]=u:(l.push(new i.Result(null,s.ExpressionEndOfInput,h.input.substr(h.getLength()))),u=n.parse(h.input.substr(h.getLength()),!0))}else if(0!=e.length){var g=new i.Result(null,s.ExpressionEndOfInput,e);return new o.RefResult([g],this,e,u)}return new o.RefResult(l,this,e,u)},e.prototype.toString=function(){return this.id},e}();t.ExpressionRef=u},494: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(52),s=n(0),r=function(e){function t(t,n,i,o){var r=e.call(this,t,n,i)||this;return r.expression=n,r.input=i,s.last(t)!=o&&(r.failAttempt=o,null!=r.failAttempt&&(r.failAttempt.parent=r)),r}return i(t,e),t.prototype.getExpect=function(){var t=e.prototype.getExpect.call(this);return null!=this.failAttempt?t.concat(this.failAttempt.getExpect()):t},t.prototype.clean=function(t){if(null!=this.failAttempt&&(null!=t||!this.isSuccess())){t=t||s.last(this.getBestExpect()).path(this);var n=s.first(t);if(null!=n&&n==this.failAttempt){var i=s.last(this.subResults),r=s.map(null!=i&&i.isSuccess()?this.subResults:s.initial(this.subResults),function(e){return e.clean()});return r.push(n.clean(s.rest(t))),new o.Result(r,this.expression,this.input)}}return e.prototype.clean.call(this,t)},t}(o.Result);t.RefResult=r},495:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(496),o=function(){function e(e,t){this.parts=e,this.id=t}return e.prototype.parse=function(e,t){for(var n=[],o=0;o<this.parts.length;o++){var s=this.parts[o].parse(e,t);if(s.isSuccess())return new i.OptionResult(s,this,e,n);n.push(s)}return new i.OptionResult(null,this,e,n)},e.prototype.toString=function(){return this.id},e}();t.ExpressionOptions=o},496: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(52),s=n(0),r=function(e){function t(t,n,i,o){var r=e.call(this,null!=t?[t]:null,n,i)||this;return r.result=t,r.expression=n,r.input=i,r.failAttempt=o,s.forEach(r.failAttempt,function(e){e.parent=r}),r}return i(t,e),t.prototype.getExpect=function(){var e=this,t=[];return null!=this.result&&(t=this.result.getExpect()),t=s.reduce(this.failAttempt,function(e,t){return e.concat(t.getExpect())},t),t.length>0&&s.all(t,function(t){return t.input==e.input})?[this]:t},t.prototype.clean=function(e){if(null!=e||!this.isSuccess()){e=s.rest(e||s.last(this.getBestExpect()).path(this));var t=s.first(e);return null==t?new o.Result(null,this.expression,this.input):new o.Result([t.clean(s.rest(e))],this.expression,this.input)}return new o.Result(s.map(this.result.subResults,function(e){return e.clean()}),this.expression,this.input)},t}(o.Result);t.OptionResult=r},497:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(52),o=n(52),s=function(){function e(e,t,n){this.value=e,this.id=t}return e.prototype.parse=function(e,t){var n=e.match(this.value);null!=n&&0!=n.index&&(n=null);var s=new i.Result(null!=n?n[0]:null,this,e);return s.isSuccess()&&t&&e.length>s.value.length?new o.EndOfInputResult(s):s},e.prototype.toString=function(){return this.id},e}();t.ExpressionRegExp=s},498:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t,n){this.func=e,this.id=t,this.grammar=n}return e.prototype.parse=function(e,t){return this.func(e,t,this)},e.prototype.toString=function(){return this.id},e}();t.ExpressionFunction=i},499:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(52),o=function(){function e(e,t){if(this.parts=e,this.id=t,0==e.length)throw new Error(JSON.stringify(t)+" should have at least 1 parts")}return e.prototype.parse=function(e,t){for(var n,o=[],s=e,r=0;r<this.parts.length;r++){if(n=this.parts[r].parse(s,t&&r==this.parts.length-1),o.push(n),!n.isSuccess())break;s=s.substr(n.getLength())}return new i.Result(o,this,e)},e.prototype.toString=function(){return this.id},e}();t.ExpressionList=o},500:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(220);t.NestedQuery={basicExpressions:["NestedQuery"],grammars:{NestedQuery:"[[NestedField][OptionalSpaces][Expressions]]",NestedField:"[[Field]]",FieldValue:["NestedQuery"]},include:[i.Field]}},501:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(133);t.Date={grammars:{Date:"[DateYear]/[DateMonth]/[DateDay]",DateYear:/([0-9]{4})/,DateMonth:/(1[0-2]|0?[1-9])/,DateDay:/([1-2][0-9]|3[0-1]|0?[1-9])/,DateRange:"[Date][Spaces?]..[Spaces?][Date]",DateRelative:["DateRelativeNegative","DateRelativeTerm"],DateRelativeTerm:/now|today|yesterday/,DateRelativeNegative:"[DateRelativeTerm][DateRelativeNegativeRef]",DateRelativeNegativeRef:/([\-\+][0-9]+(s|m|h|d|mo|y))/},include:[i.Basic]}},502:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(133);t.QueryExtension={basicExpressions:["QueryExtension"],grammars:{QueryExtension:"$[QueryExtensionName]([QueryExtensionArguments])",QueryExtensionName:/\w+/,QueryExtensionArguments:"[QueryExtensionArgumentList*][QueryExtensionArgument]",QueryExtensionArgumentList:"[QueryExtensionArgument][Spaces?],[Spaces?]",QueryExtensionArgument:"[QueryExtensionArgumentName]:[Spaces?][QueryExtensionArgumentValue]",QueryExtensionArgumentName:/\w+/,QueryExtensionArgumentValue:["SingleQuoted","Expressions"]},include:[i.Basic]}},503:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SubExpression={basicExpressions:["SubExpression"],grammars:{SubExpression:"([Expressions])"}}},504:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(0),o=n(20),s=n(6),r=n(1),u=n(25),a=function(){function e(e,t,n){this.onchange=t,this.magicBox=n,this.hasFocus=!1,this.root=o.Component.resolveRoot(e),this.underlay=document.createElement("div"),this.underlay.className="magic-box-underlay",this.highlightContainer=document.createElement("span"),this.highlightContainer.className="magic-box-highlight-container",this.underlay.appendChild(this.highlightContainer),this.ghostTextContainer=document.createElement("span"),this.ghostTextContainer.className="magic-box-ghost-text",this.underlay.appendChild(this.ghostTextContainer),this.input=r.$$(e).find("input"),this.input?e.insertBefore(this.underlay,this.input):(this.input=document.createElement("input"),e.appendChild(this.underlay),e.appendChild(this.input)),this.setupHandler(),this.addAccessibilitiesProperties()}return Object.defineProperty(e.prototype,"expanded",{set:function(e){this.input.setAttribute("aria-expanded",e.toString())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"activeDescendant",{set:function(e){e?this.input.setAttribute("aria-activedescendant",e.id):this.input.removeAttribute("aria-activedescendant")},enumerable:!0,configurable:!0}),e.prototype.updateInput=function(){this.input.value!=this.result.input&&(this.input.value=this.result.input,this.hasFocus&&this.setCursor(this.getValue().length))},e.prototype.updateHighlight=function(){r.$$(this.highlightContainer).empty(),this.highlightContainer.appendChild(this.result.toHtmlElement())},e.prototype.updateWordCompletion=function(){r.$$(this.ghostTextContainer).empty(),this.ghostTextContainer.innerHTML="",null!=this.wordCompletion&&this.ghostTextContainer.appendChild(document.createTextNode(this.wordCompletion.substr(this.result.input.length)))},e.prototype.setResult=function(e,t){this.result=e,this.updateInput(),this.updateHighlight(),i.isUndefined(t)&&null!=this.wordCompletion&&0==this.wordCompletion.indexOf(this.result.input)?this.updateWordCompletion():this.setWordCompletion(t),this.updateScroll()},e.prototype.setWordCompletion=function(e){null!=e&&0!=e.toLowerCase().indexOf(this.result.input.toLowerCase())&&(e=null),this.wordCompletion=e,this.updateWordCompletion(),this.updateScroll()},e.prototype.setCursor=function(e){if(this.input.focus(),this.input.createTextRange){var t=this.input.createTextRange();t.move("character",e),t.select()}else null!=this.input.selectionStart&&(this.input.focus(),this.input.setSelectionRange(e,e))},e.prototype.getCursor=function(){return this.input.selectionStart},e.prototype.updateScroll=function(e){var t=this;void 0===e&&(e=!0);var n=function(){t.underlay.clientWidth<t.underlay.scrollWidth&&(t.underlay.style.visibility="hidden",t.underlay.scrollLeft=t.input.scrollLeft,t.underlay.scrollTop=t.input.scrollTop,t.underlay.style.visibility="visible"),t.updateScrollDefer=null,t.hasFocus&&t.updateScroll()};e?null==this.updateScrollDefer&&(this.updateScrollDefer=requestAnimationFrame(n)):n()},e.prototype.setupHandler=function(){var e=this;this.input.onblur=function(){e.hasFocus=!1,setTimeout(function(){e.hasFocus||e.onblur&&e.onblur()},300),e.updateScroll()},this.input.onfocus=function(){e.hasFocus||(e.hasFocus=!0,e.updateScroll(),e.onfocus&&e.onfocus())},this.input.onkeydown=function(t){e.keydown(t)},this.input.onkeyup=function(t){e.keyup(t)},this.input.oncut=function(){setTimeout(function(){e.onInputChange()})},this.input.onpaste=function(){setTimeout(function(){e.onInputChange()})}},e.prototype.addAccessibilitiesProperties=function(){this.input.setAttribute("autocomplete","off"),this.input.setAttribute("type","text"),this.input.setAttribute("role","combobox"),this.input.setAttribute("form","coveo-dummy-form"),this.input.setAttribute("aria-autocomplete","list"),this.input.setAttribute("title",s.l("InsertAQuery")+". "+s.l("PressEnterToSend"))},e.prototype.focus=function(){var e=this;setTimeout(function(){e.input.focus(),e.setCursor(e.getValue().length)})},e.prototype.blur=function(){this.hasFocus&&this.input.blur()},e.prototype.keydown=function(e){var t=this;switch(e.keyCode||e.which){case u.KEYBOARD.TAB:this.tabPress(),this.magicBox.clearSuggestion();break;default:e.stopPropagation(),null==this.onkeydown||this.onkeydown(e.keyCode||e.which)?requestAnimationFrame(function(){t.onInputChange()}):e.preventDefault()}},e.prototype.keyup=function(e){switch(e.keyCode||e.which){case u.KEYBOARD.LEFT_ARROW:case u.KEYBOARD.RIGHT_ARROW:this.handleLeftRightArrow(e);break;default:null==this.onkeydown||this.onkeyup(e.keyCode||e.which)?this.onInputChange():e.preventDefault()}},e.prototype.handleLeftRightArrow=function(e){r.$$(this.root).find("."+o.Component.computeCssClassNameForType("QuerySuggestPreview"))||this.onchangecursor(),null==this.onkeydown||this.onkeyup(e.keyCode||e.which)?this.onInputChange():e.preventDefault()},e.prototype.tabPress=function(){this.ontabpress&&this.ontabpress(),this.onblur&&this.onblur()},e.prototype.onInputChange=function(){this.result.input!=this.input.value&&this.onchange(this.input.value,!1)},e.prototype.getValue=function(){return this.input.value},e.prototype.getWordCompletion=function(){return this.wordCompletion},e}();t.InputManager=a},505:function(e,t,n){"use strict";function i(e){return new Promise(function(t,n){return e.forEach(function(e){return Promise.resolve(e).then(t,n)})})}var o=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},s=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 u(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,u)}a((i=i.apply(e,t||[])).next())})},r=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,u,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return u={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u};Object.defineProperty(t,"__esModule",{value:!0});var u,a=n(0);!function(e){e[e.Finished=0]="Finished",e[e.TimedOut=1]="TimedOut",e[e.Overriden=2]="Overriden"}(u=t.ProcessingStatus||(t.ProcessingStatus={}));var l=function(){function e(e){void 0===e&&(e={}),this.options=o({timeout:500},e)}return e.prototype.processQueries=function(e){return s(this,void 0,void 0,function(){var t,n=this;return r(this,function(o){return this.overrideIfProcessing(),this.processedResults=new Array(e.length),t=e.map(function(e){return e instanceof Promise?e:Promise.resolve(e)}),[2,i([this.accumulateResultsChronologically(t).then(function(){return n.buildProcessResults(u.Finished)}),this.waitForOverride().then(function(){return n.buildProcessResults(u.Overriden)}),this.waitForTimeout().then(function(){return n.buildProcessResults(u.TimedOut)})])]})})},e.prototype.overrideIfProcessing=function(){return s(this,void 0,void 0,function(){return r(this,function(e){return this.override&&this.override(),[2]})})},Object.defineProperty(e.prototype,"orderedResults",{get:function(){return a.flatten(this.processedResults.filter(function(e){return!!e}),!0)},enumerable:!0,configurable:!0}),e.prototype.buildProcessResults=function(e){return{status:e,results:e!==u.Overriden?this.orderedResults:[]}},e.prototype.accumulateResultsChronologically=function(e){return s(this,void 0,void 0,function(){var t;return r(this,function(n){switch(n.label){case 0:return t=this.processedResults,[4,Promise.all(e.map(function(e,n){return e.then(function(e){return t[n]=e})}))];case 1:return n.sent(),[2]}})})},e.prototype.waitForOverride=function(){var e=this;return new Promise(function(t){e.override=function(){e.override=null,t()}})},e.prototype.waitForTimeout=function(){var e=this;return new Promise(function(t){return setTimeout(function(){return t()},e.options.timeout)})},e}();t.QueryProcessor=l},508:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(500),o=n(502),s=n(133),r=n(220),u=n(503);t.Complete={include:[i.NestedQuery,o.QueryExtension,u.SubExpression,r.Field,s.Basic]}},509:function(e,t,n){"use strict";function i(e,t,n,i){u.each(i.expressions,function(t){u.contains(e,t)||e.push(t)}),u.each(i.basicExpressions,function(e){u.contains(t,e)||t.push(e)}),u.each(i.grammars,function(e,t){if(t in n){if(!u.isArray(n[t])||!u.isArray(e))throw u.each(e,function(e){n[t].push(e)}),new Error("Can not merge "+t+"("+JSON.stringify(e)+" => "+JSON.stringify(n[t])+")");u.each(e,function(e){n[t].push(e)})}else n[t]=e})}function o(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n=[],o=[],s={Start:["Expressions","Empty"],Expressions:"[OptionalSpaces][Expression][ExpressionsList*][OptionalSpaces]",ExpressionsList:"[Spaces][Expression]",Expression:n,BasicExpression:o,OptionalSpaces:/ */,Spaces:/ +/,Empty:/(?!.)/},r=0;r<e.length;r++)i(n,o,s,e[r]),u.each(e[r].include,function(t){u.contains(e,t)||e.push(t)});return n.push("BasicExpression"),{start:"Start",expressions:s}}function s(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=o.apply(this,e);return new r.Grammar(n.start,n.expressions)}Object.defineProperty(t,"__esModule",{value:!0});var r=n(176),u=n(0);t.Expressions=o,t.ExpressionsGrammar=s},510:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(){}return e.buildingResultPreviewsQuery="buildingResultPreviewsQuery",e.updateResultPreviewsManagerOptions="updateResultPreviewsManagerOptions",e.populateSearchResultPreviews="populateSearchResultPreviews",e}();t.ResultPreviewsManagerEvents=i},511:function(e,t,n){"use strict";var i=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 o=n(28),s=function(){function e(e){this.owner=e}return Object.defineProperty(e.prototype,"options",{get:function(){return this.owner.options},set:function(e){this.owner.options=e},enumerable:!0,configurable:!0}),e.prototype.postProcess=function(){this.options=i({},this.options,this.owner.componentOptionsModel.get(o.ComponentOptionsModel.attributesEnum.searchBox)),this.processQueryOnClearVersusEmptyQuery(),this.processQueryOnClearVersusSearchAsYouType()},e.prototype.processQueryOnClearVersusEmptyQuery=function(){this.options.triggerQueryOnClear&&!1===this.owner.searchInterface.options.allowQueriesWithoutKeywords&&(this.owner.logger.warn('Forcing option triggerQueryOnClear to false, as it is not supported when the search interface is configured to not allow queries without keywords (data-allow-queries-without-keywords="false")',this.owner),this.options.triggerQueryOnClear=!1)},e.prototype.processQueryOnClearVersusSearchAsYouType=function(){!0===this.owner.searchInterface.options.allowQueriesWithoutKeywords&&!1===this.options.triggerQueryOnClear&&!0===this.options.enableSearchAsYouType&&(this.owner.logger.warn("Forcing option triggerQueryOnClear to true, since search-as-you-type is enabled",this.owner),this.options.triggerQueryOnClear=!0)},e}();t.QueryboxOptionsProcessing=s},52: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(218),s=n(219),r=n(0),u=function(){function e(e,t,n){var i=this;this.expression=t,this.input=n,r.isString(e)?this.value=e:r.isArray(e)&&(this.subResults=e,r.forEach(this.subResults,function(e){e.parent=i}))}return e.prototype.isSuccess=function(){return null!=this.value||null!=this.subResults&&r.all(this.subResults,function(e){return e.isSuccess()})},e.prototype.path=function(e){var t=null!=this.parent&&this.parent!=e?this.parent.path(e):[];return t.push(this),t},e.prototype.findParent=function(e){for(var t=this,n=r.isString(e)?function(t){return e==t.expression.id}:e;null!=t&&!n(t);)t=t.parent;return t},e.prototype.find=function(e){var t=r.isString(e)?function(t){return e==t.expression.id}:e;if(t(this))return this;if(this.subResults)for(var n=0;n<this.subResults.length;n++){var i=this.subResults[n].find(t);if(i)return i}return null},e.prototype.findAll=function(e){var t=[],n=r.isString(e)?function(t){return e==t.expression.id}:e;return n(this)&&t.push(this),this.subResults&&(t=r.reduce(this.subResults,function(e,t){return e.concat(t.findAll(n))},t)),t},e.prototype.resultAt=function(e,t){if(e<0||e>this.getLength())return[];if(null!=t){if(r.isString(t)){if(t==this.expression.id)return[this]}else if(t(this))return[this]}else{if(null!=(null==this.value&&null==this.subResults?this.input:this.value))return[this]}if(null!=this.subResults){for(var n=[],i=0;i<this.subResults.length;i++){var o=this.subResults[i];if(n=n.concat(o.resultAt(e,t)),(e-=o.getLength())<0)break}return n}return[]},e.prototype.getExpect=function(){return null==this.value&&null==this.subResults?[this]:null!=this.subResults?r.reduce(this.subResults,function(e,t){return e.concat(t.getExpect())},[]):[]},e.prototype.getBestExpect=function(){var e=this.getExpect(),t=r.groupBy(e,function(e){return e.input}),n=r.last(r.keys(t).sort(function(e,t){return t.length-e.length})),i=t[n],t=r.groupBy(i,function(e){return e.expression.id});return r.map(t,function(e){return r.chain(e).map(function(e){return{path:e.path().length,result:e}}).sortBy("path").pluck("result").first().value()})},e.prototype.getHumanReadableExpect=function(){var e=this.getBestExpect(),t=e.length>0?r.last(e).input:"";return"Expected "+r.map(e,function(e){return e.getHumanReadable()}).join(" or ")+" but "+(t.length>0?JSON.stringify(t[0]):"end of input")+" found."},e.prototype.before=function(){if(null==this.parent)return"";var e=r.indexOf(this.parent.subResults,this);return this.parent.before()+r.chain(this.parent.subResults).first(e).map(function(e){return e.toString()}).join("").value()},e.prototype.after=function(){if(null==this.parent)return"";var e=r.indexOf(this.parent.subResults,this);return r.chain(this.parent.subResults).last(this.parent.subResults.length-e-1).map(function(e){return e.toString()}).join("").value()+this.parent.after()},e.prototype.getLength=function(){return null!=this.value?this.value.length:null!=this.subResults?r.reduce(this.subResults,function(e,t){return e+t.getLength()},0):this.input.length},e.prototype.toHtmlElement=function(){var e=document.createElement("span"),t=null!=this.expression?this.expression.id:null;return null!=t&&e.setAttribute("data-id",t),e.setAttribute("data-success",this.isSuccess().toString()),null!=this.value?(e.appendChild(document.createTextNode(this.value)),e.setAttribute("data-value",this.value)):null!=this.subResults?r.each(this.subResults,function(t){e.appendChild(t.toHtmlElement())}):(e.appendChild(document.createTextNode(this.input)),e.setAttribute("data-input",this.input),e.className="magic-box-error"+(this.input.length>0?"":" magic-box-error-empty")),e.result=this,e},e.prototype.clean=function(t){if(null!=t||!this.isSuccess()){t=t||r.last(this.getBestExpect()).path(this);var n=r.first(t);if(null!=n){var i=r.indexOf(this.subResults,n),o=-1==i?[]:r.map(r.first(this.subResults,i),function(e){return e.clean()});return o.push(n.clean(r.rest(t))),new e(o,this.expression,this.input)}return new e(null,this.expression,this.input)}return null!=this.value?new e(this.value,this.expression,this.input):null!=this.subResults?new e(r.map(this.subResults,function(e){return e.clean()}),this.expression,this.input):void 0},e.prototype.clone=function(){return null!=this.value?new e(this.value,this.expression,this.input):null!=this.subResults?new e(r.map(this.subResults,function(e){return e.clone()}),this.expression,this.input):new e(null,this.expression,this.input)},e.prototype.toString=function(){return null!=this.value?this.value:null!=this.subResults?r.map(this.subResults,function(e){return e.toString()}).join(""):this.input},e.prototype.getHumanReadable=function(){return this.expression instanceof s.ExpressionConstant?JSON.stringify(this.expression.value):this.expression.id},e}();t.Result=u;var a=function(e){function t(t){var n=e.call(this,[t],o.ExpressionEndOfInput,t.input)||this,i=new u(null,o.ExpressionEndOfInput,t.input.substr(t.getLength()));return i.parent=n,n.subResults.push(i),n}return i(t,e),t}(u);t.EndOfInputResult=a},562:function(e,t,n){"use strict";function i(){o.exportGlobally({MagicBox:{EndOfInputResult:x.EndOfInputResult,ExpressionConstant:s.ExpressionConstant,ExpressionEndOfInput:r.ExpressionEndOfInput,ExpressionFunction:u.ExpressionFunction,ExpressionList:a.ExpressionList,ExpressionOptions:l.ExpressionOptions,ExpressionRef:c.ExpressionRef,ExpressionRegExp:p.ExpressionRegExp,Grammar:h.Grammar,Grammars:g.Grammars,InputManager:d.InputManager,Instance:f.MagicBoxInstance,OptionResult:m.OptionResult,RefResult:b.RefResult,Result:x.Result,SuggestionsManager:v.SuggestionsManager,Utils:y.MagicBoxUtils,create:f.createMagicBox,requestAnimationFrame:f.requestAnimationFrame}})}Object.defineProperty(t,"__esModule",{value:!0});var o=n(3),s=n(219),r=n(218),u=n(498),a=n(499),l=n(495),c=n(493),p=n(497),h=n(176),g=n(563),d=n(504),f=n(222),y=n(223),m=n(496),b=n(494),x=n(52),v=n(221);t.GrammarsImportedLocally=g.Grammars,t.doMagicBoxExport=i},563:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(133),o=n(508),s=n(501),r=n(509),u=n(220),a=n(500),l=n(502),c=n(503);t.Grammars={Basic:i.Basic,notInWord:i.notInWord,notWordStart:i.notWordStart,Complete:o.Complete,Date:s.Date,Expressions:r.Expressions,ExpressionsGrammar:r.ExpressionsGrammar,Field:u.Field,NestedQuery:a.NestedQuery,QueryExtension:l.QueryExtension,SubExpression:c.SubExpression}},564: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 u(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,u)}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,u,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return u={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u};Object.defineProperty(t,"__esModule",{value:!0});var s=n(1),r=n(6),u=n(0),a=n(7),l=n(221),c=n(510),p=n(505),h=n(4),g=function(){function e(e,t){void 0===t&&(t={}),this.element=e,this.options=u.defaults(t,{previewHeaderText:r.l("QuerySuggestPreview"),previewHeaderFieldText:r.l("QuerySuggestPreviewWithField"),previewClass:"coveo-preview-selectable",selectedClass:"magic-box-selected"}),this.root=a.Component.resolveRoot(e),this.previewsProcessor=new p.QueryProcessor({timeout:this.options.timeout})}return Object.defineProperty(e.prototype,"previewsOwner",{get:function(){return this.lastDisplayedSuggestion},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hasPreviews",{get:function(){return!!this.suggestionsPreviewContainer},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"focusedPreviewElement",{get:function(){if(!this.hasPreviews)return null;var e=this.suggestionsPreviewContainer.findClass(this.options.selectedClass)[0];return e&&e.classList.contains(this.options.previewClass)?e:null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"previewElements",{get:function(){return this.hasPreviews?this.suggestionsPreviewContainer.findClass(this.options.previewClass):[]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"suggestionsListbox",{get:function(){return s.$$(s.$$(this.element).findClass("coveo-magicbox-suggestions")[0])},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"numberOfResultsPerRow",{get:function(){var e=this.suggestionsPreviewContainer.findClass(this.options.previewClass);if(0===e.length)return 0;var t=e[0].offsetTop,n=u.findIndex(e,function(e){return e.offsetTop!==t});return-1!==n?n:e.length},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"previewContainerId",{get:function(){return"coveo-previews-for-"+this.lastDisplayedSuggestion.dom.id},enumerable:!0,configurable:!0}),e.prototype.displaySearchResultPreviewsForSuggestion=function(e){return i(this,void 0,void 0,function(){var t,n,i,s,r,u,a;return o(this,function(o){switch(o.label){case 0:return t=this.getExternalOptions(),n=this.lastDelay=h.Utils.resolveAfter(h.Utils.isNullOrUndefined(t.displayAfterDuration)?200:t.displayAfterDuration),[4,n];case 1:return o.sent(),n!==this.lastDelay?[2]:(i=e&&this.lastQueriedSuggestion===e)?[2]:(s=this.lastDisplayedSuggestion===e)?(this.previewsProcessor.overrideIfProcessing(),this.lastQueriedSuggestion=null,[2]):(this.lastQueriedSuggestion=e,e?[4,this.getSearchResultPreviewsQuery(e)]:(this.displaySuggestionPreviews(null,[]),[2]));case 2:return r=o.sent(),(u=r.status,a=r.results,u===p.ProcessingStatus.Overriden)?[2]:(this.lastQueriedSuggestion=null,this.displaySuggestionPreviews(e,a),[2])}})})},e.prototype.getElementInDirection=function(e){var t=this.previewElements,n=t.indexOf(this.focusedPreviewElement);return-1===n?null:0===n&&e===l.Direction.Left?null:t[(n+this.getIncrementInDirection(e))%t.length]},e.prototype.getIncrementInDirection=function(e){switch(e){case l.Direction.Left:return-1;case l.Direction.Right:return 1;case l.Direction.Up:return-this.numberOfResultsPerRow;case l.Direction.Down:return this.numberOfResultsPerRow}},e.prototype.setHasPreviews=function(e){this.hasPreviews!==!!e&&(e?this.initPreviewForSuggestions():this.revertPreviewForSuggestions())},e.prototype.initPreviewForSuggestions=function(){this.suggestionsPreviewContainer=s.$$("div",{className:"coveo-suggestion-container"},this.suggestionsListbox.el,this.buildPreviewContainer()),this.element.appendChild(this.suggestionsPreviewContainer.el),this.suggestionsListbox.setAttribute("aria-controls",this.previewContainerId)},e.prototype.revertPreviewForSuggestions=function(){this.element.appendChild(this.suggestionsListbox.el),this.suggestionsPreviewContainer.remove(),this.suggestionsPreviewContainer=null},e.prototype.buildPreviewContainer=function(){return s.$$("div",{className:"coveo-preview-container",id:this.previewContainerId},this.resultPreviewsContainer=s.$$("div",{className:"coveo-preview-results",role:"listbox","aria-orientation":"horizontal"})).el},e.prototype.getExternalOptions=function(){var e={};return s.$$(this.root).trigger(c.ResultPreviewsManagerEvents.updateResultPreviewsManagerOptions,e),e},e.prototype.getSearchResultPreviewsQuery=function(e){var t={suggestion:e,previewsQueries:[]};return s.$$(this.root).trigger(c.ResultPreviewsManagerEvents.populateSearchResultPreviews,t),this.previewsProcessor.processQueries(t.previewsQueries)},e.prototype.appendSearchResultPreview=function(e,t){this.resultPreviewsContainer.append(e.element),e.element.id="coveo-result-preview-"+t;var n=s.$$(e.element);n.setAttribute("aria-selected","false"),n.setAttribute("role","option"),n.on("click",function(){return e.onSelect()}),n.on("keyboardSelect",function(){return e.onSelect()})},e.prototype.appendSearchResultPreviews=function(e){var t=this;this.resultPreviewsContainer.empty(),e.forEach(function(e,n){return t.appendSearchResultPreview(e,n)})},e.prototype.displaySuggestionPreviews=function(e,t){this.lastDisplayedSuggestion=e,this.setHasPreviews(t&&t.length>0),this.element.classList.toggle("magic-box-hasPreviews",this.hasPreviews),this.hasPreviews&&this.appendSearchResultPreviews(t)},e}();t.ResultPreviewsManager=g},565:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),o=n(6),s=n(15),r=function(){function e(e){this.element=i.$$("div",{className:"magic-box-clear"});var t=i.$$("div",{className:"magic-box-icon"});this.element.append(t.el),this.element.insertAfter(i.$$(e.element).find("input")),(new s.AccessibleButton).withElement(this.element).withLabel(o.l("Clear")).withSelectAction(function(){return e.clear()}).build(),this.toggleTabindexAndAriaHidden(!1)}return e.prototype.toggleTabindexAndAriaHidden=function(e){var t=e?"0":"-1";this.element.setAttribute("tabindex",t),this.element.setAttribute("aria-hidden",""+!e)},e}();t.MagicBoxClear=r},566:function(e,t){},574:function(e,t){},575:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(34),o=n(0),s=n(223),r=function(){function e(e){var t=this;this.omnibox=e,this.cache={},this.omnibox.bind.on(this.omnibox.element,i.OmniboxEvents.populateOmniboxSuggestions,function(e){e.suggestions.push(t.getSuggestion())})}return e.prototype.getSuggestion=function(){var e=this,t=this.getHash();if(null==t)return null;var n=this.hashToString(t);if(null!=this.cache[n])return this.hashValueToSuggestion(t,this.cache[n]);var i;return"FieldName"==t.type&&(i=this.fieldNames(t.current)),"FieldValue"==t.type&&(i=this.fieldValues(t.field,t.current)),"SimpleFieldName"==t.type&&(i=this.simpleFieldNames(t.current)),this.cache[n]=i,i.catch(function(){delete e.cache[n]}),this.hashValueToSuggestion(t,i)},e.prototype.getHash=function(){var e=o.last(this.omnibox.resultAtCursor("FieldName"));if(null!=e){e=e.findParent("Field")||e;var t=e.toString(),n=e.before(),i=e.after();return{type:"FieldName",current:t,before:n,after:i}}var s=o.last(this.omnibox.resultAtCursor("FieldValue"));if(s){var r=s.findParent("FieldQuery")||this.omnibox.options.enableSimpleFieldAddon&&s.findParent("FieldSimpleQuery");if(r){var u=r.find("FieldName").toString();this.omnibox.options.fieldAlias&&u in this.omnibox.options.fieldAlias&&(u=this.omnibox.options.fieldAlias[u]);var a=s.toString(),n=s.before(),i=s.after();return{type:"FieldValue",field:u,current:a,before:n,after:i}}}if(this.omnibox.options.enableSimpleFieldAddon){var l=o.last(this.omnibox.resultAtCursor("Word"));if(null!=l){var c=l.toString(),n=l.before(),i=l.after();return{type:"SimpleFieldName",current:c,before:n,after:i}}}},e.prototype.hashToString=function(e){return null==e?null:e.type+e.current+(e.field||"")},e.prototype.hashValueToSuggestion=function(t,n){return n.then(function(n){return o.map(n,function(i,o){return{text:t.before+(0==t.current.toLowerCase().indexOf(i.toLowerCase())?t.current+i.substr(t.current.length):i)+t.after,html:s.MagicBoxUtils.highlightText(i,t.current,!0),index:e.INDEX-o/n.length}})})},e.prototype.getFields=function(){var e=this;return null==this.fields&&(this.fields=new Promise(function(t,n){if(null!=e.omnibox.options.listOfFields)t(e.omnibox.options.listOfFields);else{e.omnibox.queryController.getEndpoint().listFields().then(function(e){var n=o.chain(e).filter(function(e){return e.includeInQuery&&e.groupByField}).map(function(e){return e.name.substr(1)}).value();t(n)}).catch(function(){n()})}})),this.fields},e.prototype.fieldNames=function(e){var t=e.length>0&&"@"==e[0],n=t?e.substr(1):e,i=n.toLowerCase();return this.getFields().then(function(t){var n=o.chain(t).map(function(e){var t=e.length>0&&"@"==e[0];return{index:e.toLowerCase().indexOf(i),field:t?e:"@"+e}}).filter(function(t){return-1!=t.index&&t.field.length>e.length}).sortBy("index").map(function(e){return e.field}).value();return n=o.first(n,5)})},e.prototype.fieldValues=function(e,t){return this.omnibox.queryController.getEndpoint().listFieldValues({pattern:".*"+t+".*",patternType:"RegularExpression",sortCriteria:"occurrences",field:"@"+e,maximumNumberOfValues:5}).then(function(e){return o.chain(e).map(function(e){return{index:e.value.toLowerCase().indexOf(t),value:e.value}}).filter(function(e){return e.value.length>t.length}).sortBy("index").map(function(e){return e.value.replace(/ /g," ")}).value()})},e.prototype.simpleFieldNames=function(e){var t=e,n=t.toLowerCase();return this.getFields().then(function(t){var i=o.chain(t).map(function(e){return{index:e.toLowerCase().indexOf(n),field:e+":"}}).filter(function(t){return-1!=t.index&&t.field.length>e.length}).sortBy("index").map(function(e){return e.field}).value();return i=o.first(i,5)})},e.INDEX=64,e}();t.FieldAddon=r},576:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(34),o=n(1),s=n(4),r=n(0),u=function(){function e(e){var t=this;this.omnibox=e,this.omnibox.bind.on(this.omnibox.element,i.OmniboxEvents.populateOmniboxSuggestions,function(e){r.each(t.getSuggestion(),function(t){e.suggestions.push(t)})})}return e.prototype.getSuggestion=function(){if(0==this.omnibox.magicBox.getText().length)return null;var e=this.buildPopulateOmniboxEventArgs();return o.$$(this.omnibox.root).trigger(i.OmniboxEvents.populateOmnibox,e),this.rowsToSuggestions(e.rows)},e.prototype.getCurrentQueryExpression=function(){var e=this.omnibox.getCursor(),t=this.omnibox.getText(),n=t.length,i=e,o=e;for(" "==t[i]&&i--;i>0&&" "!=t[i];)i--;for(;o<n&&" "!=t[o];)o++;return t.substring(i,o)},e.prototype.getRegexToSearch=function(e){return null==e&&(e=this.omnibox.getText()),new RegExp(s.Utils.escapeRegexCharacter(e),"i")},e.prototype.getQueryExpressionBreakDown=function(){var e=this,t=[],n=this.omnibox.getText().split(" ");return r.each(n,function(n){t.push({word:n,regex:e.getRegexToSearch(n)})}),t},e.prototype.replace=function(e,t){this.omnibox.setText(this.omnibox.getText().replace(e,t))},e.prototype.clearCurrentExpression=function(){this.replace(this.getCurrentQueryExpression(),"")},e.prototype.insertAt=function(e,t){var n=this.omnibox.getText(),i=[n.slice(0,e),t,n.slice(e)].join("");this.omnibox.setText(i)},e.prototype.replaceCurrentExpression=function(e){this.replace(this.getCurrentQueryExpression(),e)},e.prototype.buildPopulateOmniboxEventArgs=function(){var e=this,t=this.getCurrentQueryExpression();return{rows:[],completeQueryExpression:{word:this.omnibox.getText(),regex:this.getRegexToSearch()},currentQueryExpression:{word:t,regex:this.getRegexToSearch(t)},allQueryExpressions:this.getQueryExpressionBreakDown(),cursorPosition:this.omnibox.getCursor(),clear:function(){e.omnibox.clear()},clearCurrentExpression:function(){e.clearCurrentExpression()},replace:function(t,n){e.replace(t,n)},replaceCurrentExpression:function(t){e.replaceCurrentExpression(t)},insertAt:function(t,n){e.insertAt(t,n)},closeOmnibox:function(){e.omnibox.magicBox.blur()}}},e.prototype.rowsToSuggestions=function(e){return r.map(e,function(e){return s.Utils.isNullOrUndefined(e.element)?s.Utils.isNullOrUndefined(e.deferred)?null:new Promise(function(t){e.deferred.then(function(e){t(null!=e.element?[{dom:e.element,index:e.zIndex}]:null)})}):new Promise(function(t){t([{dom:e.element,index:e.zIndex}])})})},e}();t.OldOmniboxAddon=u},577:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(34),o=n(0),s=n(223),r=function(){function e(e){var t=this;this.omnibox=e,this.cache={},this.omnibox.bind.on(this.omnibox.element,i.OmniboxEvents.populateOmniboxSuggestions,function(e){e.suggestions.push(t.getSuggestion())})}return e.prototype.getSuggestion=function(){var e=this,t=this.getHash(this.omnibox.magicBox);if(null==t)return null;var n=this.hashToString(t);if(null!=this.cache[n])return this.hashValueToSuggestion(t,this.cache[n]);var i="QueryExtensionName"==t.type?this.names(t.current):this.attributeNames(t.name,t.current,t.used);return this.cache[n]=i,i.catch(function(){delete e.cache[n]}),this.hashValueToSuggestion(t,i)},e.prototype.getHash=function(e){var t=o.last(e.resultAtCursor("QueryExtension"));if(null!=t){var n=t.findAll("QueryExtensionArgument"),i=o.last(e.resultAtCursor("QueryExtensionName"));if(null!=i)return{type:"QueryExtensionName",current:i.toString(),before:i.before(),after:i.after()};if(null!=(i=o.last(e.resultAtCursor("QueryExtensionArgumentName")))){var s=o.chain(n).map(function(e){var t=e.find("QueryExtensionArgumentName");return t&&t.toString()}).compact().value(),r=t.find("QueryExtensionName").toString();return{type:"QueryExtensionArgumentName",current:i.toString(),before:i.before(),after:i.after(),name:r,used:s}}}return null},e.prototype.hashToString=function(e){return null==e?null:[e.type,e.current,e.name||"",e.used?e.used.join():""].join()},e.prototype.hashValueToSuggestion=function(t,n){return n.then(function(n){return o.map(n,function(i,o){return{html:s.MagicBoxUtils.highlightText(i,t.current,!0),text:t.before+i+t.after,index:e.INDEX-o/n.length}})})},e.prototype.getExtensions=function(){return null==this.extensions&&(this.extensions=this.omnibox.queryController.getEndpoint().extensions()),this.extensions},e.prototype.names=function(e){var t=e.toLowerCase();return this.getExtensions().then(function(e){var n=o.chain(e).map(function(e){return{index:e.name.toLowerCase().indexOf(t),extension:e.name}}).filter(function(e){return-1!=e.index&&e.extension.length>t.length}).sortBy("index").pluck("extension").value();return n=o.first(n,5)})},e.prototype.attributeNames=function(e,t,n){return this.getExtensions().then(function(i){var s=o.find(i,function(t){return t.name==e});return null==s?[]:o.filter(o.difference(s.argumentNames,n),function(e){return 0==e.indexOf(t)})})},e.prototype.hash=function(){},e.INDEX=62,e}();t.QueryExtensionAddon=r},578: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 u(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,u)}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,u,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return u={next:n(0),throw:n(1),return:n(2)},"function"==typeof Symbol&&(u[Symbol.iterator]=function(){return this}),u};Object.defineProperty(t,"__esModule",{value:!0});var s=n(1),r=n(28),u=n(34),a=n(22),l=n(0),c=n(13),p=n(4),h=n(89),g=n(50),d=function(){function e(e){var t=this;this.omnibox=e,s.$$(this.omnibox.element).on(u.OmniboxEvents.populateOmniboxSuggestions,function(e,n){n.suggestions.push(t.getSuggestion())})}return e.suggestiontHtml=function(e){return e.highlighted.replace(/\[(.*?)\]|\{(.*?)\}|\((.*?)\)/g,function(e,t,n,i){var o="";n&&(o="coveo-omnibox-hightlight"),i&&(o="coveo-omnibox-hightlight2");var r;return r=o?s.$$("span",{className:o}):s.$$("span"),r.text(t||n||i),r.el.outerHTML})},e.isPartialMatch=function(e){var t=a.StringUtils.match(e.highlighted,/\[(.*?)\]|\{(.*?)\}|\((.*?)\)/g),n=l.find(t,function(e){return null!=e[1]});return null==n||l.every(l.last(t,l.indexOf(t,n)-t.length),function(e){return null!=e[1]})},e.prototype.getSuggestion=function(){var e=this.omnibox.magicBox.getText();return e.length>=this.omnibox.options.querySuggestCharacterThreshold?this.getQuerySuggest(e):Promise.resolve([])},e.prototype.getQuerySuggest=function(t){return i(this,void 0,void 0,function(){var n,i,r,a;return o(this,function(o){switch(o.label){case 0:n={q:t,locale:this.locale,searchHub:this.searchHub,pipeline:this.pipeline,enableWordCompletion:this.enableWordCompletion,context:this.context,count:this.count,tab:this.tab,referrer:document.referrer,actionsHistory:this.actionsHistory,timezone:this.timezone,visitorId:this.visitorId,isGuestUser:this.isGuestUser},s.$$(this.omnibox.getBindings().searchInterface.element).trigger(u.OmniboxEvents.buildingQuerySuggest,{payload:n}),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this.omnibox.queryController.getEndpoint().getQuerySuggest(n)];case 2:return i=o.sent(),[3,4];case 3:return r=o.sent(),[2,[]];case 4:return a=i.completions,s.$$(this.omnibox.getBindings().searchInterface.element).trigger(u.OmniboxEvents.querySuggestSuccess,{completions:a}),[2,l.map(a,function(t,n){return{html:e.suggestiontHtml(t),text:t.expression,index:e.INDEX-n/a.length,partial:e.isPartialMatch(t),executableConfidence:t.executableConfidence}})]}})})},Object.defineProperty(e.prototype,"tab",{get:function(){var e=this.omnibox.getBindings().queryStateModel.get(c.QUERY_STATE_ATTRIBUTES.T);if(p.Utils.isNonEmptyString(e))return e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"locale",{get:function(){return String.locale},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"searchHub",{get:function(){return this.omnibox.getBindings().componentOptionsModel.get(r.ComponentOptionsModel.attributesEnum.searchHub)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"pipeline",{get:function(){return this.omnibox.getBindings().searchInterface.options.pipeline},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"enableWordCompletion",{get:function(){return this.omnibox.options.enableSearchAsYouType},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"context",{get:function(){return this.omnibox.getBindings().searchInterface.getQueryContext()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"count",{get:function(){return this.omnibox.options.numberOfSuggestions},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"actionsHistory",{get:function(){var e=h.buildHistoryStore(),t=e.getHistory();return null==t?[]:t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"timezone",{get:function(){return this.omnibox.getBindings().searchInterface.options.timezone},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"visitorId",{get:function(){return(new g.AnalyticsInformation).clientId},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isGuestUser",{get:function(){return this.omnibox.getBindings().queryController.getEndpoint().options.isGuestUser},enumerable:!0,configurable:!0}),e.INDEX=60,e}();t.QuerySuggestAddon=d;var f=function(){function e(){}return e.prototype.getSuggestion=function(){return Promise.resolve([])},e}();t.VoidQuerySuggestAddon=f},671:function(e,t){},672:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),o=function(){function e(){}return e.resize=function(e,t){var n=this,i=this.getSearchbox(e),o=this.getElementsToResize(e),s=this.getInput(e),r="height: "+t+"px; line-height: "+t+"px;",u="height: "+t+"px",a="height: "+(t-2)+"px;";this.applyStyle(i,r),this.applyStyle(s,a),o.forEach(function(e){n.applyStyle(e,u)})},e.applyStyle=function(e,t){e.style.cssText+=t},e.getSearchbox=function(e){return i.$$(e).find(".CoveoOmnibox")||i.$$(e).find(".CoveoQuerybox")},e.getElementsToResize=function(e){return[i.$$(e).find(".CoveoSearchButton"),i.$$(i.$$(e).find(".magic-box-input")).find("input"),i.$$(e).find(".magic-box-icon"),i.$$(e).find(".magic-box-clear"),i.$$(e).find(".magic-box-underlay")]},e.getInput=function(e){return i.$$(e).find(".magic-box-input")},e}();t.SearchBoxResize=o}});
//# sourceMappingURL=Searchbox.min__e5bf021b8d4fabc51251.js.map