UNPKG

coveo-search-ui

Version:

Coveo JavaScript Search Framework

1 lines • 98.2 kB
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.pars