coveo-search-ui
Version:
Coveo JavaScript Search Framework
2 lines • 32.6 kB
JavaScript
webpackJsonpCoveo__temporary([14,56,83,84],{127:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(3),i=n(6),r=n(1),a=n(16),s=n(12),u=function(){function e(e,t,n,o){void 0===e&&(e=function(e){}),void 0===t&&(t=0),this.onChange=e,this.min=t,this.max=n,this.label=o,this.buildContent(),this.bindEvents()}return e.doExport=function(){o.exportGlobally({NumericSpinner:e})},e.prototype.reset=function(){this.getSpinnerInput().value="",this.onChange(this)},e.prototype.getElement=function(){return this.element},e.prototype.getValue=function(){return this.getSpinnerInput().value},e.prototype.getIntValue=function(){return this.getSpinnerInput().value?parseInt(this.getSpinnerInput().value,10):this.min},e.prototype.getFloatValue=function(){return this.getSpinnerInput().value?parseFloat(this.getSpinnerInput().value):this.min},e.prototype.setValue=function(e){this.max&&e>this.max&&(e=this.max),e<this.min&&(e=this.min),this.getSpinnerInput().value=e.toString(),this.onChange(this)},e.prototype.build=function(){return this.element},e.prototype.buildContent=function(){var e=r.$$("div",{className:"coveo-numeric-spinner"}),t=r.$$("input",{className:"coveo-number-input",type:"text","aria-label":this.label?i.l(this.label):""}),n=r.$$("span",{className:"coveo-add-on"}),o=r.$$("div",{className:"coveo-spinner-up"},s.SVGIcons.icons.arrowUp);a.SVGDom.addClassToSVGInContainer(o.el,"coveo-spinner-up-svg");var u=r.$$("div",{className:"coveo-spinner-down"},s.SVGIcons.icons.arrowDown);a.SVGDom.addClassToSVGInContainer(u.el,"coveo-spinner-down-svg"),n.append(o.el),n.append(u.el),e.append(t.el),e.append(n.el),this.element=e.el},e.prototype.bindEvents=function(){var e=this,t=r.$$(this.element).find(".coveo-spinner-up");r.$$(t).on("click",function(){e.setValue(e.getFloatValue()+1)});var n=r.$$(this.element).find(".coveo-spinner-down");r.$$(n).on("click",function(){e.setValue(e.getFloatValue()-1)});var o=r.$$(this.element).find("input");r.$$(o).on("input",function(){o.value.match(/[0-9]*/)&&e.onChange(e)})},e.prototype.getSpinnerInput=function(){return r.$$(this.element).find(".coveo-number-input")},e}();t.NumericSpinner=u},186:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(57),i=n(88),r=n(1),a=function(){function e(e,t){this.inputName=e,this.root=t}return e.prototype.reset=function(){this.clear()},e.prototype.build=function(){return this.input=new o.TextInput(this.onChange.bind(this),this.inputName),this.input.getElement()},e.prototype.setValue=function(e){this.input.setValue(e)},e.prototype.getValue=function(){return this.input.getValue()},e.prototype.clear=function(){this.input.setValue("")},e.prototype.updateQuery=function(e){var t=this.getValue();t&&e.advancedExpression.add(t)},e.prototype.onChange=function(){this.root?r.$$(this.root).trigger(i.AdvancedSearchEvents.executeAdvancedSearch):this.input&&r.$$(this.input.getElement()).trigger(i.AdvancedSearchEvents.executeAdvancedSearch)},e}();t.KeywordsInput=a},231:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(88),i=n(1),r=n(99),a=n(0),s=function(){function e(e,t){this.inputName=e,this.root=t,this.buildContent()}return e.prototype.reset=function(){this.radio.reset()},e.prototype.build=function(){return this.element},e.prototype.getElement=function(){return this.element},e.prototype.isSelected=function(){return this.getRadio().checked},e.prototype.updateQuery=function(e){try{var t=this.getValue();t&&e.advancedExpression.add(t),this.removeErrorMessage()}catch(e){this.setErrorMessage(e)}},e.prototype.getRadio=function(){return i.$$(this.element).find("input")},e.prototype.setErrorMessage=function(e){this.removeErrorMessage(),this.error=i.$$("div",{className:"coveo-error coveo-error-date-input"},e).el,i.$$(this.element).append(this.error)},e.prototype.removeErrorMessage=function(){this.error&&i.$$(this.error).remove()},e.prototype.buildContent=function(){var e=this;this.radio=new r.RadioButton(function(){e.deactivateAllInputs(),e.activateSelectedInput()},this.inputName,"coveo-advanced-search-date-input"),this.element=this.radio.getElement(),i.$$(this.element).addClass("coveo-advanced-search-date-input-section"),i.$$(this.radio.getRadio()).addClass("coveo-advanced-search-date"),i.$$(this.radio.getLabel()).addClass("coveo-advanced-search-label")},e.prototype.deactivateAllInputs=function(){var e=i.$$(this.element.parentElement).findAll("fieldset");a.each(e,function(e){e.disabled=!0})},e.prototype.activateSelectedInput=function(){var e=i.$$(this.element).findAll("fieldset");a.each(e,function(e){e.disabled=!1})},e.prototype.onChange=function(){this.root?i.$$(this.root).trigger(o.AdvancedSearchEvents.executeAdvancedSearch):this.element&&i.$$(this.element).trigger(o.AdvancedSearchEvents.executeAdvancedSearch)},e}();t.DateInput=s},232:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(1),i=n(88),r=n(6),a=function(){function e(e,t){this.inputName=e,this.root=t}return e.prototype.reset=function(){},e.prototype.build=function(){var e=o.$$("div",{className:"coveo-advanced-search-document-input-section"}),t=o.$$("span",{className:"coveo-advanced-search-label"});return t.text(r.l(this.inputName)),e.append(t.el),this.element=e.el,this.element},e.prototype.getValue=function(){return""},e.prototype.updateQuery=function(e){this.getValue()&&e.advancedExpression.add(this.getValue())},e.prototype.onChange=function(){this.root?o.$$(this.root).trigger(i.AdvancedSearchEvents.executeAdvancedSearch):this.element&&o.$$(this.element).trigger(i.AdvancedSearchEvents.executeAdvancedSearch)},e}();t.DocumentInput=a},237:function(e,t,n){"use strict";var o=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 o(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}();Object.defineProperty(t,"__esModule",{value:!0});var i=n(7),r=n(8),a=n(11),s=n(88),u=n(56),c=n(2),p=n(6),l=n(1),d=n(590),h=n(10),f=n(520),y=n(0),v=n(3);n(601);var m=n(127),b=n(90),g=n(64),_=n(57),S=n(99),w=n(26),I=n(35),$=n(12),A=n(15),E=n(48),x=function(e){function t(n,o,i,a){void 0===a&&(a=w.ModalBox);var s=e.call(this,n,t.ID,i)||this;return s.element=n,s.options=o,s.ModalBox=a,s.inputs=[],s.inputFactory=new d.AdvancedSearchInputFactory(s.queryController.getEndpoint(),s.root),s.externalSections=[],s.needToPopulateBreadcrumb=!1,s.needToExecuteAdvancedSearch=!0,s.options=r.ComponentOptions.initComponentOptions(n,t,o),s.bindEvents(),s.buildContent(),s}return o(t,e),t.prototype.executeAdvancedSearch=function(){this.needToExecuteAdvancedSearch&&(this.usageAnalytics.logSearchEvent(h.analyticsActionCauseList.advancedSearch,{}),this.queryController.executeQuery({closeModalBox:!1}))},t.prototype.reset=function(){y.each(this.inputs,function(e){e.reset()})},t.prototype.open=function(){null==this.modalbox&&(this.modalbox=this.ModalBox.open(this.content.el,{sizeMod:"big",title:p.l("AdvancedSearch"),className:"coveo-advanced-search-modal",body:this.searchInterface.options.modalContainer}))},t.prototype.close=function(){null!=this.modalbox&&(this.modalbox.close(),this.modalbox=null)},t.prototype.handlePopulateBreadcrumb=function(e){if(this.needToPopulateBreadcrumb){var t=this.buildBreadcrumbElements(e.headingLevel),n=t.container,o=t.title,i=t.clear;n.append(o.el),n.append(i.el),e.breadcrumbs.push({element:n.el})}},t.prototype.buildBreadcrumbElements=function(e){return{container:this.buildBreadcrumbContainer(),title:this.buildBreadcrumbTitle(e),clear:this.buildBreacrumbClear()}},t.prototype.buildBreadcrumbContainer=function(){return l.$$("div",{className:"coveo-advanced-search-breadcrumb"})},t.prototype.buildBreadcrumbTitle=function(e){return l.$$(E.getHeadingTag(e,"span"),{className:"coveo-advanced-search-breadcrumb-title"},p.l("FiltersInAdvancedSearch")+":")},t.prototype.buildBreacrumbClear=function(){var e=this,t=l.$$("span",{className:"coveo-advanced-search-breadcrumb-clear"},$.SVGIcons.icons.mainClear),n=function(){e.handleClearBreadcrumb(),e.usageAnalytics.logSearchEvent(h.analyticsActionCauseList.breadcrumbAdvancedSearch,{}),e.queryController.executeQuery()};return(new A.AccessibleButton).withElement(t).withLabel(p.l("Clear")).withSelectAction(function(){return n()}).build(),t},t.prototype.handleClearBreadcrumb=function(){this.needToPopulateBreadcrumb&&(this.needToExecuteAdvancedSearch=!1,this.reset(),this.needToExecuteAdvancedSearch=!0)},t.prototype.handleQuerySummaryCancelLastAction=function(){this.needToExecuteAdvancedSearch=!1,this.reset(),this.needToExecuteAdvancedSearch=!0},t.prototype.handlePopulateMenu=function(e){var t=this;e.menuData.push({text:p.l("AdvancedSearch"),className:"coveo-advanced-search",onOpen:function(){return t.open()},onClose:function(){return t.close()},svgIcon:$.SVGIcons.icons.dropdownPreferences,svgIconClassName:"coveo-advanced-search-svg"})},t.prototype.handleBuildingQuery=function(e){var t=e.queryBuilder.build();y.each(this.externalSections,function(t){t.updateQuery&&t.updateQuery(t.inputs,e.queryBuilder)}),y.each(this.inputs,function(t){t.updateQuery&&t.updateQuery(e.queryBuilder)});var n=e.queryBuilder.build();this.needToPopulateBreadcrumb=n.aq!=t.aq},t.prototype.buildContent=function(){var e=this,t=l.$$("div"),n=[];this.options.includeKeywords&&n.push(this.getKeywordsSection()),this.options.includeDate&&n.push(this.getDateSection()),this.options.includeDocument&&n.push(this.getDocumentSection()),this.externalSections=[],l.$$(this.root).trigger(s.AdvancedSearchEvents.buildingAdvancedSearch,{sections:this.externalSections,executeQuery:function(t){return t=y.extend({},t,{closeModalBox:!1}),e.queryController.executeQuery(t)}}),y.each(this.externalSections,function(n){t.append(e.buildExternalSection(n))}),y.each(n,function(n){t.append(e.buildInternalSection(n))}),this.content=t},t.prototype.getKeywordsSection=function(){var e=p.l("Keywords"),t=[];return t.push(this.inputFactory.createAllKeywordsInput()),t.push(this.inputFactory.createExactKeywordsInput()),t.push(this.inputFactory.createAnyKeywordsInput()),t.push(this.inputFactory.createNoneKeywordsInput()),{name:e,inputs:t}},t.prototype.getDateSection=function(){var e=p.l("Date"),t=[];return t.push(this.inputFactory.createAnytimeDateInput()),t.push(this.inputFactory.createInTheLastDateInput()),t.push(this.inputFactory.createBetweenDateInput()),{name:e,inputs:t}},t.prototype.getDocumentSection=function(){var e=p.l("Document"),t=[];return t.push(this.inputFactory.createSimpleFieldInput(p.l("FileType"),"@filetype")),t.push(this.inputFactory.createSimpleFieldInput(p.l("Language"),"@language")),t.push(this.inputFactory.createSizeInput()),t.push(this.inputFactory.createAdvancedFieldInput(p.l("Title"),"@title")),t.push(this.inputFactory.createAdvancedFieldInput(p.l("Author"),"@author")),{name:e,inputs:t}},t.prototype.buildExternalSection=function(e){var t=this.buildSectionTitle(e).el;return this.inputs=y.union(this.inputs,e.inputs),t.appendChild(e.content),t},t.prototype.buildInternalSection=function(e){var t=this,n=this.buildSectionTitle(e),o=n.el,i=n.id,r=[];return y.each(e.inputs,function(e){r.push(t.buildDefaultInput(e))}),this.inputs=y.union(this.inputs,r),y.each(r,function(e){var t=e.build(),n=t.querySelector("input");n&&n.setAttribute("aria-labelledby",i),l.$$(o).append(t)}),o},t.prototype.buildSectionTitle=function(e){var t=l.$$("div",{className:"coveo-advanced-search-section"}),n=l.$$("div",{className:"coveo-advanced-search-section-title"});n.text(e.name);var o="coveo-advanced-search-section-"+e.name;return n.el.id=o,t.append(n.el),{el:t.el,id:o}},t.prototype.buildDefaultInput=function(e){return this.isPrebuiltInput(e)?this.inputFactory.create(e.name,e.parameters):e},t.prototype.isPrebuiltInput=function(e){return void 0!==e.name},t.prototype.bindEvents=function(){var e=this;this.bind.onRootElement(I.BreadcrumbEvents.populateBreadcrumb,function(t){return e.handlePopulateBreadcrumb(t)}),this.bind.onRootElement(I.BreadcrumbEvents.clearBreadcrumb,function(t){return e.handleClearBreadcrumb()}),this.bind.onRootElement(u.SettingsEvents.settingsPopulateMenu,function(t){return e.handlePopulateMenu(t)}),this.bind.onRootElement(a.QueryEvents.buildingQuery,function(t){return e.handleBuildingQuery(t)}),this.bind.onRootElement(s.AdvancedSearchEvents.executeAdvancedSearch,function(){return e.executeAdvancedSearch()}),this.bind.onRootElement(f.QuerySummaryEvents.cancelLastAction,function(){return e.handleQuerySummaryCancelLastAction()})},t.ID="AdvancedSearch",t.doExport=function(){v.exportGlobally({AdvancedSearch:t,NumericSpinner:m.NumericSpinner,DatePicker:b.DatePicker,Dropdown:g.Dropdown,TextInput:_.TextInput,RadioButton:S.RadioButton})},t.options={includeKeywords:r.ComponentOptions.buildBooleanOption({defaultValue:!0}),includeDate:r.ComponentOptions.buildBooleanOption({defaultValue:!0}),includeDocument:r.ComponentOptions.buildBooleanOption({defaultValue:!0})},t}(i.Component);t.AdvancedSearch=x,c.Initialization.registerAutoCreateComponent(x)},40:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(22),i=n(21),r=n(121),a=n(33),s=n(4),u=n(1),c=n(0),p=n(6),l=function(){function e(){}return e.getRegexToUseForFacetSearch=function(e,t){return new RegExp(o.StringUtils.stringToRegex(e,t),"i")},e.getDisplayValueFromValueCaption=function(e,t,n){var o=this.tryToGetTranslatedCaption(t,e,!1);return n[e]||o},e.getValuesToUseForSearchInFacet=function(e,t){var n=[e],o=this.getRegexToUseForFacetSearch(e,t.options.facetSearchIgnoreAccents);return t.options.valueCaption?(c.chain(t.options.valueCaption).pairs().filter(function(e){return o.test(e[1])}).each(function(e){n.push(e[0])}),(i.QueryUtils.isStratusAgnosticField(t.options.field,"@objecttype")||i.QueryUtils.isStratusAgnosticField(t.options.field,"@filetype"))&&c.each(r.FileTypes.getFileTypeCaptions(),function(e,i){i in t.options.valueCaption||!o.test(e)||n.push(i)})):i.QueryUtils.isStratusAgnosticField(t.options.field,"@objecttype")||i.QueryUtils.isStratusAgnosticField(t.options.field,"@filetype")?c.each(c.filter(c.pairs(r.FileTypes.getFileTypeCaptions()),function(e){return o.test(e[1])}),function(e){n.push(e[0])}):i.QueryUtils.isStratusAgnosticField(t.options.field,"@month")&&c.each(c.range(1,13),function(e){o.test(a.DateUtils.monthToString(e-1))&&n.push(("0"+e.toString()).substr(-2))}),n},e.buildFacetSearchPattern=function(e){return e=c.map(e,function(e){return s.Utils.escapeRegexCharacter(e)}),e[0]=".*"+e[0]+".*",e.join("|")},e.needAnotherFacetSearch=function(e,t,n,o){return e<t&&e<o&&e>n},e.addNoStateCssClassToFacetValues=function(e,t){if(0!=e.values.getSelected().length){var n=u.$$(t).findAll("li:not(.coveo-selected)");c.each(n,function(e){u.$$(e).addClass("coveo-no-state")})}},e.tryToGetTranslatedCaption=function(t,n,o){void 0===o&&(o=!0);var u;if(i.QueryUtils.isStratusAgnosticField(t.toLowerCase(),"@filetype"))u=r.FileTypes.getFileType(n,o).caption;else if(i.QueryUtils.isStratusAgnosticField(t.toLowerCase(),"@objecttype"))u=r.FileTypes.getObjectType(n,o).caption;else if(e.isMonthFieldValue(t,n)){var c=parseInt(n,10);u=a.DateUtils.monthToString(c-1)}else o&&(u=p.l(n));return void 0!=u&&s.Utils.isNonEmptyString(u)?u:n},e.isMonthFieldValue=function(e,t){if(!i.QueryUtils.isStratusAgnosticField(e.toLowerCase(),"@month"))return!1;var n=parseInt(t,10);return!isNaN(n)&&!(n<1||n>12)},e}();t.FacetUtils=l},520:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(){}return e.cancelLastAction="cancelLastAction",e}();t.QuerySummaryEvents=o},561:function(e,t){},590:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(591),i=n(592),r=n(593),a=n(594),s=n(595),u=n(596),c=n(597),p=n(598),l=n(599),d=n(600),h=function(){function e(e,t){this.endpoint=e,this.root=t}return e.prototype.create=function(e,t){switch(e){case"keywords_all":return this.createAllKeywordsInput();case"keywords_exact":return this.createExactKeywordsInput();case"keywords_any":return this.createAnyKeywordsInput();case"keywords_none":return this.createNoneKeywordsInput();case"date_any":return this.createAnytimeDateInput();case"date_last":return this.createInTheLastDateInput();case"date_between":return this.createBetweenDateInput();case"document_field":return this.createSimpleFieldInput(t.name,t.field);case"document_advanced_field":return this.createAdvancedFieldInput(t.name,t.field);case"document_size":return this.createSizeInput();default:return null}},e.prototype.createAllKeywordsInput=function(){return new o.AllKeywordsInput(this.root)},e.prototype.createExactKeywordsInput=function(){return new i.ExactKeywordsInput(this.root)},e.prototype.createAnyKeywordsInput=function(){return new r.AnyKeywordsInput(this.root)},e.prototype.createNoneKeywordsInput=function(){return new a.NoneKeywordsInput(this.root)},e.prototype.createAnytimeDateInput=function(){return new s.AnytimeDateInput(this.root)},e.prototype.createInTheLastDateInput=function(){return new u.InTheLastDateInput(this.root)},e.prototype.createBetweenDateInput=function(){return new c.BetweenDateInput(this.root)},e.prototype.createSimpleFieldInput=function(e,t){return new p.SimpleFieldInput(e,t,this.endpoint,this.root)},e.prototype.createAdvancedFieldInput=function(e,t){return new l.AdvancedFieldInput(e,t,this.root)},e.prototype.createSizeInput=function(){return new d.SizeInput(this.root)},e}();t.AdvancedSearchInputFactory=h},591:function(e,t,n){"use strict";var o=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 o(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}();Object.defineProperty(t,"__esModule",{value:!0});var i=n(186),r=n(6),a=function(e){function t(t){var n=e.call(this,r.l("AllTheseWords"),t)||this;return n.root=t,n}return o(t,e),t.prototype.getValue=function(){var t=e.prototype.getValue.call(this);return t?"<@-"+t+"-@>":""},t}(i.KeywordsInput);t.AllKeywordsInput=a},592:function(e,t,n){"use strict";var o=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 o(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}();Object.defineProperty(t,"__esModule",{value:!0});var i=n(186),r=n(6),a=function(e){function t(t){var n=e.call(this,r.l("ExactPhrase"),t)||this;return n.root=t,n}return o(t,e),t.prototype.getValue=function(){var t=e.prototype.getValue.call(this);return t?'"<@-'+t+'-@>"':""},t}(i.KeywordsInput);t.ExactKeywordsInput=a},593:function(e,t,n){"use strict";var o=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 o(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}();Object.defineProperty(t,"__esModule",{value:!0});var i=n(186),r=n(6),a=function(e){function t(t){var n=e.call(this,r.l("AnyOfTheseWords"),t)||this;return n.root=t,n}return o(t,e),t.prototype.getValue=function(){return e.prototype.getValue.call(this)?e.prototype.getValue.call(this).replace(/\s+/g," ").split(" ").map(function(e){return'"<@-'+e+'-@>"'}).join(" OR "):""},t}(i.KeywordsInput);t.AnyKeywordsInput=a},594:function(e,t,n){"use strict";var o=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 o(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}();Object.defineProperty(t,"__esModule",{value:!0});var i=n(186),r=n(6),a=function(e){function t(t){var n=e.call(this,r.l("NoneOfTheseWords"),t)||this;return n.root=t,n}return o(t,e),t.prototype.getValue=function(){var t=e.prototype.getValue.call(this);return t?t.replace(/\s+/g," ").split(" ").map(function(e){return'NOT "<@-'+e+'-@>"'}).join(" "):""},t}(i.KeywordsInput);t.NoneKeywordsInput=a},595:function(e,t,n){"use strict";var o=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 o(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}();Object.defineProperty(t,"__esModule",{value:!0});var i=n(231),r=n(6),a=n(1),s=n(88),u=function(e){function t(t){var n=e.call(this,r.l("Anytime"),t)||this;return n.root=t,n}return o(t,e),t.prototype.getValue=function(){return null},t.prototype.build=function(){var t=this;e.prototype.build.call(this);var n=this.getRadio();return n.checked=!0,a.$$(n).on("change",function(){t.root?a.$$(t.root).trigger(s.AdvancedSearchEvents.executeAdvancedSearch):a.$$(t.element).trigger(s.AdvancedSearchEvents.executeAdvancedSearch)}),this.element},t}(i.DateInput);t.AnytimeDateInput=u},596:function(e,t,n){"use strict";var o=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 o(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}();Object.defineProperty(t,"__esModule",{value:!0});var i=n(231),r=n(1),a=n(6),s=n(64),u=n(127),c=n(33),p=function(e){function t(t){var n=e.call(this,a.l("InTheLast"),t)||this;return n.root=t,n}return o(t,e),t.prototype.reset=function(){this.dropdown.reset(),this.spinner.reset()},t.prototype.build=function(){e.prototype.build.call(this);var t=r.$$("fieldset",{className:"coveo-advanced-search-date-input"});return t.el.disabled=!0,this.spinner=new u.NumericSpinner(this.onChange.bind(this),void 0,void 0,a.l("InTheLast")),t.append(this.spinner.getElement()),this.dropdown=new s.Dropdown(this.onChange.bind(this),["Days","Months"],void 0,a.l("InTheLast")),this.dropdown.setId("coveo-advanced-search-in-the-last-select"),t.append(this.dropdown.getElement()),this.element.appendChild(t.el),r.$$(this.getRadio()).on("change",this.onChange.bind(this)),this.element},t.prototype.getValue=function(){var e=new Date,t=this.spinner.getIntValue(),n=this.dropdown.getValue().toLowerCase(),o=new Date;return"months"==n?o.setMonth(e.getMonth()-t):o.setDate(e.getDate()-t),this.isSelected()&&t?"@date>="+c.DateUtils.dateForQuery(o):""},t}(i.DateInput);t.InTheLastDateInput=p},597:function(e,t,n){"use strict";var o=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 o(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}();Object.defineProperty(t,"__esModule",{value:!0});var i=n(231),r=n(90),a=n(6),s=n(1),u=n(33),c=n(73),p=function(e){function t(t){var n=e.call(this,a.l("Between"),t)||this;return n.root=t,n.firstDatePicker=new r.DatePicker(n.onChange.bind(n)),n.secondDatePicker=new r.DatePicker(n.onChange.bind(n)),n}return o(t,e),t.prototype.reset=function(){this.firstDatePicker.reset(),this.secondDatePicker.reset()},t.prototype.build=function(){e.prototype.build.call(this);var t=s.$$("fieldset",{className:"coveo-advanced-search-date-input"});return t.el.disabled=!0,t.append(this.firstDatePicker.getElement()),t.append(this.buildAnd()),t.append(this.secondDatePicker.getElement()),this.element.appendChild(t.el),this.element},t.prototype.getValue=function(){var e=this.firstDatePicker.getDateValue(),t=this.secondDatePicker.getDateValue(),n=this.firstDatePicker.getValue(),o=this.secondDatePicker.getValue(),i="";if(this.isSelected()){if(e&&t){if(c.TimeSpan.fromDates(u.DateUtils.convertFromJsonDateIfNeeded(e),u.DateUtils.convertFromJsonDateIfNeeded(o)).getMilliseconds()<0)throw a.l("QueryExceptionInvalidDate")}n&&(i+="(@date>="+n+")"),o&&(i+="(@date<="+o+")")}return i},t.prototype.buildAnd=function(){var e=s.$$("div",{className:"coveo-advanced-search-and"});return e.text(a.l("And").toLowerCase()),e.el},t}(i.DateInput);t.BetweenDateInput=p},598:function(e,t,n){"use strict";var o=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 o(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}();Object.defineProperty(t,"__esModule",{value:!0});var i=n(0),r=n(40),a=n(1),s=n(49),u=n(64),c=n(232),p=function(e){function t(t,n,o,i){var r=e.call(this,t,i)||this;return r.inputName=t,r.fieldName=n,r.endpoint=o,r.root=i,r}return o(t,e),t.prototype.reset=function(){this.dropDown.reset()},t.prototype.build=function(){var t=this,n=a.$$(e.prototype.build.call(this));return this.buildFieldSelect().then(function(){n.append(t.dropDown.getElement())}),this.element=n.el,this.element},t.prototype.getValue=function(){var e=this.dropDown?this.dropDown.getValue():"",t=new s.QueryBuilder;return e?(t.advancedExpression.addFieldExpression(this.fieldName,"==",[e]),t.build().aq):""},t.prototype.buildFieldSelect=function(){var e=this;return this.endpoint.listFieldValues({field:this.fieldName,maximumNumberOfValues:50}).then(function(t){var n=[""];i.each(t,function(e){n.push(e.value)}),e.dropDown=new u.Dropdown(e.onChange.bind(e),n,function(t){return r.FacetUtils.tryToGetTranslatedCaption(e.fieldName,t)},e.inputName)})},t}(c.DocumentInput);t.SimpleFieldInput=p},599:function(e,t,n){"use strict";var o=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 o(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}();Object.defineProperty(t,"__esModule",{value:!0});var i=n(64),r=n(57),a=n(1),s=n(232),u=n(49),c=function(e){function t(t,n,o){var i=e.call(this,t,o)||this;return i.inputName=t,i.fieldName=n,i.root=o,i}return o(t,e),t.prototype.reset=function(){this.mode.reset(),this.input.reset()},t.prototype.build=function(){var t=a.$$(e.prototype.build.call(this));return this.mode=new i.Dropdown(this.onChange.bind(this),["Contains","DoesNotContain","Matches"],void 0,this.inputName),t.append(this.mode.getElement()),this.input=new r.TextInput(this.onChange.bind(this),this.inputName),t.append(this.input.getElement()),this.element=t.el,this.element},t.prototype.getValue=function(){var e=this.input.getValue(),t=new u.QueryBuilder;if(e)switch(this.mode.getValue()){case"Contains":return t.advancedExpression.addFieldExpression(this.fieldName,"=",[e]),t.build().aq;case"DoesNotContain":return t.advancedExpression.addFieldExpression(this.fieldName,"<>",[e]),t.build().aq;default:return t.advancedExpression.addFieldExpression(this.fieldName,"==",[e]),t.build().aq}return""},t}(s.DocumentInput);t.AdvancedFieldInput=c},600:function(e,t,n){"use strict";var o=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 o(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}();Object.defineProperty(t,"__esModule",{value:!0});var i=n(6),r=n(1),a=n(49),s=n(64),u=n(127),c=n(232),p=function(e){function t(t){var n=e.call(this,"Size",t)||this;return n.root=t,n}return o(t,e),t.prototype.reset=function(){this.modeSelect.reset(),this.sizeInput.reset()},t.prototype.build=function(){var n=r.$$(e.prototype.build.call(this)),o=r.$$("div",{className:"coveo-size-input-mode-section"});return this.modeSelect=new s.Dropdown(this.onChange.bind(this),t.modes,void 0,i.l("Size")),this.modeSelect.setId("coveo-size-input-mode"),o.append(this.modeSelect.getElement()),this.sizeInput=new u.NumericSpinner(this.onChange.bind(this),void 0,void 0,i.l("SizeValue")),o.append(this.sizeInput.getElement()),this.sizeSelect=new s.Dropdown(this.onChange.bind(this),t.sizes,void 0,i.l("UnitMeasurement")),this.sizeSelect.setId("coveo-size-input-select"),o.append(this.sizeSelect.getElement()),n.append(o.el),this.element=n.el,this.element},t.prototype.getValue=function(){var e=this.getSizeInBytes(),t=new a.QueryBuilder;if(e)switch(this.modeSelect.getValue()){case"AtLeast":return t.advancedExpression.addFieldExpression("@size",">=",[this.getSizeInBytes().toString()]),t.build().aq;default:return t.advancedExpression.addFieldExpression("@size","<=",[this.getSizeInBytes().toString()]),t.build().aq}return""},t.prototype.getSizeInBytes=function(){var e=this.sizeInput.getFloatValue();switch(this.sizeSelect.getValue()){case"KB":return 1024*e;case"MB":return e*Math.pow(1024,2);default:return e}},t.modes=["AtLeast","AtMost"],t.sizes=["KB","MB","Bytes"],t}(c.DocumentInput);t.SizeInput=p},601:function(e,t){},64:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(1),i=n(6),r=n(0),a=n(3),s=function(){function e(e,t,n,o){void 0===e&&(e=function(e){}),void 0===n&&(n=i.l),this.onChange=e,this.listOfValues=t,this.getDisplayValue=n,this.label=o,this.optionsElement=[],this.buildContent(),this.select(0,!1),this.bindEvents()}return e.doExport=function(){a.exportGlobally({Dropdown:e})},e.prototype.reset=function(){this.select(0,!1)},e.prototype.setId=function(e){o.$$(this.element).setAttribute("id",e)},e.prototype.getElement=function(){return this.element},e.prototype.getValue=function(){return this.selectElement.value},e.prototype.select=function(e,t){void 0===t&&(t=!0),this.selectOption(this.optionsElement[e],t)},e.prototype.build=function(){return this.element},e.prototype.setValue=function(e){var t=this;r.each(this.optionsElement,function(n){o.$$(n).getAttribute("data-value")==e&&t.selectOption(n)})},e.prototype.selectOption=function(e,t){void 0===t&&(t=!0),this.selectElement.value=e.value,t&&this.onChange(this)},e.prototype.buildContent=function(){var e=this;this.selectElement=o.$$("select",{className:"coveo-dropdown"}).el,this.label&&this.selectElement.setAttribute("aria-label",i.l(this.label));var t=this.buildOptions();r.each(t,function(t){o.$$(e.selectElement).append(t)}),this.element=this.selectElement},e.prototype.buildOptions=function(){var e=this,t=[];return r.each(this.listOfValues,function(n){t.push(e.buildOption(n))}),t},e.prototype.buildOption=function(e){var t=o.$$("option");return t.setAttribute("data-value",e),t.setAttribute("value",e),t.text(this.getDisplayValue(e)),this.optionsElement.push(t.el),t.el},e.prototype.bindEvents=function(){var e=this;o.$$(this.selectElement).on("change",function(){return e.onChange(e)})},e}();t.Dropdown=s},99:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(1);n(561);var i=n(3),r=function(){function e(e,t,n,o){void 0===e&&(e=function(e){}),void 0===o&&(o=t),this.onChange=e,this.label=t,this.name=n,this.id=o,this.buildContent()}return e.doExport=function(){i.exportGlobally({RadioButton:e})},e.prototype.reset=function(){var e=this.isSelected();this.getRadio().checked=!1,e&&this.onChange(this)},e.prototype.select=function(e){void 0===e&&(e=!0);var t=this.isSelected();this.getRadio().checked=!0,!t&&e&&this.onChange(this)},e.prototype.build=function(){return this.element},e.prototype.getElement=function(){return this.element},e.prototype.getValue=function(){return this.label},e.prototype.isSelected=function(){return this.getRadio().checked},e.prototype.getRadio=function(){return o.$$(this.element).find("input")},e.prototype.getLabel=function(){return o.$$(this.element).find("label")},e.prototype.buildContent=function(){var e=this,t=o.$$("div",{className:"coveo-radio"}),n=o.$$("input",{type:"radio",name:this.name,id:this.id}),i=o.$$("label",{className:"coveo-radio-input-label",for:this.id});i.text(this.label),n.on("change",function(){e.onChange(e)}),t.append(n.el),t.append(i.el),this.element=t.el},e}();t.RadioButton=r}});
//# sourceMappingURL=AdvancedSearch.min__cf4c4f4dd6c8a707e936.js.map