(function webpackUniversalModuleDefinition(root, factory) {
	if(typeof exports === 'object' && typeof module === 'object')
		module.exports = factory(require("coveo-search-ui"));
	else if(typeof define === 'function' && define.amd)
		define(["coveo-search-ui"], factory);
	else if(typeof exports === 'object')
		exports["CoveoForSitecore"] = factory(require("coveo-search-ui"));
	else
		root["CoveoForSitecore"] = factory(root["Coveo"]);
})(window, function(__WEBPACK_EXTERNAL_MODULE_coveo_search_ui__) {
return /******/ (function(modules) { // webpackBootstrap
/******/ 	// The module cache
/******/ 	var installedModules = {};
/******/
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/
/******/ 		// Check if module is in cache
/******/ 		if(installedModules[moduleId]) {
/******/ 			return installedModules[moduleId].exports;
/******/ 		}
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = installedModules[moduleId] = {
/******/ 			i: moduleId,
/******/ 			l: false,
/******/ 			exports: {}
/******/ 		};
/******/
/******/ 		// Execute the module function
/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ 		// Flag the module as loaded
/******/ 		module.l = true;
/******/
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/
/******/
/******/ 	// expose the modules object (__webpack_modules__)
/******/ 	__webpack_require__.m = modules;
/******/
/******/ 	// expose the module cache
/******/ 	__webpack_require__.c = installedModules;
/******/
/******/ 	// define getter function for harmony exports
/******/ 	__webpack_require__.d = function(exports, name, getter) {
/******/ 		if(!__webpack_require__.o(exports, name)) {
/******/ 			Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ 		}
/******/ 	};
/******/
/******/ 	// define __esModule on exports
/******/ 	__webpack_require__.r = function(exports) {
/******/ 		if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ 			Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ 		}
/******/ 		Object.defineProperty(exports, '__esModule', { value: true });
/******/ 	};
/******/
/******/ 	// create a fake namespace object
/******/ 	// mode & 1: value is a module id, require it
/******/ 	// mode & 2: merge all properties of value into the ns
/******/ 	// mode & 4: return value when already ns object
/******/ 	// mode & 8|1: behave like require
/******/ 	__webpack_require__.t = function(value, mode) {
/******/ 		if(mode & 1) value = __webpack_require__(value);
/******/ 		if(mode & 8) return value;
/******/ 		if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ 		var ns = Object.create(null);
/******/ 		__webpack_require__.r(ns);
/******/ 		Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ 		if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ 		return ns;
/******/ 	};
/******/
/******/ 	// getDefaultExport function for compatibility with non-harmony modules
/******/ 	__webpack_require__.n = function(module) {
/******/ 		var getter = module && module.__esModule ?
/******/ 			function getDefault() { return module['default']; } :
/******/ 			function getModuleExports() { return module; };
/******/ 		__webpack_require__.d(getter, 'a', getter);
/******/ 		return getter;
/******/ 	};
/******/
/******/ 	// Object.prototype.hasOwnProperty.call
/******/ 	__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ 	// __webpack_public_path__
/******/ 	__webpack_require__.p = "";
/******/
/******/
/******/ 	// Load entry module and return exports
/******/ 	return __webpack_require__(__webpack_require__.s = "./src/ComponentsEntry.ts");
/******/ })
/************************************************************************/
/******/ ({

/***/ "./node_modules/dateformat/lib/dateformat.js":
/*!***************************************************!*\
  !*** ./node_modules/dateformat/lib/dateformat.js ***!
  \***************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

var __WEBPACK_AMD_DEFINE_RESULT__;/*
 * Date Format 1.2.3
 * (c) 2007-2009 Steven Levithan <stevenlevithan.com>
 * MIT license
 *
 * Includes enhancements by Scott Trenda <scott.trenda.net>
 * and Kris Kowal <cixar.com/~kris.kowal/>
 *
 * Accepts a date, a mask, or a date and a mask.
 * Returns a formatted version of the given date.
 * The date defaults to the current date/time.
 * The mask defaults to dateFormat.masks.default.
 */

(function(global) {
  'use strict';

  var dateFormat = (function() {
      var token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZWN]|'[^']*'|'[^']*'/g;
      var timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g;
      var timezoneClip = /[^-+\dA-Z]/g;
  
      // Regexes and supporting functions are cached through closure
      return function (date, mask, utc, gmt) {
  
        // You can't provide utc if you skip other args (use the 'UTC:' mask prefix)
        if (arguments.length === 1 && kindOf(date) === 'string' && !/\d/.test(date)) {
          mask = date;
          date = undefined;
        }
  
        date = date || new Date;
  
        if(!(date instanceof Date)) {
          date = new Date(date);
        }
  
        if (isNaN(date)) {
          throw TypeError('Invalid date');
        }
  
        mask = String(dateFormat.masks[mask] || mask || dateFormat.masks['default']);
  
        // Allow setting the utc/gmt argument via the mask
        var maskSlice = mask.slice(0, 4);
        if (maskSlice === 'UTC:' || maskSlice === 'GMT:') {
          mask = mask.slice(4);
          utc = true;
          if (maskSlice === 'GMT:') {
            gmt = true;
          }
        }
  
        var _ = utc ? 'getUTC' : 'get';
        var d = date[_ + 'Date']();
        var D = date[_ + 'Day']();
        var m = date[_ + 'Month']();
        var y = date[_ + 'FullYear']();
        var H = date[_ + 'Hours']();
        var M = date[_ + 'Minutes']();
        var s = date[_ + 'Seconds']();
        var L = date[_ + 'Milliseconds']();
        var o = utc ? 0 : date.getTimezoneOffset();
        var W = getWeek(date);
        var N = getDayOfWeek(date);
        var flags = {
          d:    d,
          dd:   pad(d),
          ddd:  dateFormat.i18n.dayNames[D],
          dddd: dateFormat.i18n.dayNames[D + 7],
          m:    m + 1,
          mm:   pad(m + 1),
          mmm:  dateFormat.i18n.monthNames[m],
          mmmm: dateFormat.i18n.monthNames[m + 12],
          yy:   String(y).slice(2),
          yyyy: y,
          h:    H % 12 || 12,
          hh:   pad(H % 12 || 12),
          H:    H,
          HH:   pad(H),
          M:    M,
          MM:   pad(M),
          s:    s,
          ss:   pad(s),
          l:    pad(L, 3),
          L:    pad(Math.round(L / 10)),
          t:    H < 12 ? 'a'  : 'p',
          tt:   H < 12 ? 'am' : 'pm',
          T:    H < 12 ? 'A'  : 'P',
          TT:   H < 12 ? 'AM' : 'PM',
          Z:    gmt ? 'GMT' : utc ? 'UTC' : (String(date).match(timezone) || ['']).pop().replace(timezoneClip, ''),
          o:    (o > 0 ? '-' : '+') + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4),
          S:    ['th', 'st', 'nd', 'rd'][d % 10 > 3 ? 0 : (d % 100 - d % 10 != 10) * d % 10],
          W:    W,
          N:    N
        };
  
        return mask.replace(token, function (match) {
          if (match in flags) {
            return flags[match];
          }
          return match.slice(1, match.length - 1);
        });
      };
    })();

  dateFormat.masks = {
    'default':               'ddd mmm dd yyyy HH:MM:ss',
    'shortDate':             'm/d/yy',
    'mediumDate':            'mmm d, yyyy',
    'longDate':              'mmmm d, yyyy',
    'fullDate':              'dddd, mmmm d, yyyy',
    'shortTime':             'h:MM TT',
    'mediumTime':            'h:MM:ss TT',
    'longTime':              'h:MM:ss TT Z',
    'isoDate':               'yyyy-mm-dd',
    'isoTime':               'HH:MM:ss',
    'isoDateTime':           'yyyy-mm-dd\'T\'HH:MM:sso',
    'isoUtcDateTime':        'UTC:yyyy-mm-dd\'T\'HH:MM:ss\'Z\'',
    'expiresHeaderFormat':   'ddd, dd mmm yyyy HH:MM:ss Z'
  };

  // Internationalization strings
  dateFormat.i18n = {
    dayNames: [
      'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat',
      'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'
    ],
    monthNames: [
      'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec',
      'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'
    ]
  };

function pad(val, len) {
  val = String(val);
  len = len || 2;
  while (val.length < len) {
    val = '0' + val;
  }
  return val;
}

/**
 * Get the ISO 8601 week number
 * Based on comments from
 * http://techblog.procurios.nl/k/n618/news/view/33796/14863/Calculate-ISO-8601-week-and-year-in-javascript.html
 *
 * @param  {Object} `date`
 * @return {Number}
 */
function getWeek(date) {
  // Remove time components of date
  var targetThursday = new Date(date.getFullYear(), date.getMonth(), date.getDate());

  // Change date to Thursday same week
  targetThursday.setDate(targetThursday.getDate() - ((targetThursday.getDay() + 6) % 7) + 3);

  // Take January 4th as it is always in week 1 (see ISO 8601)
  var firstThursday = new Date(targetThursday.getFullYear(), 0, 4);

  // Change date to Thursday same week
  firstThursday.setDate(firstThursday.getDate() - ((firstThursday.getDay() + 6) % 7) + 3);

  // Check if daylight-saving-time-switch occurred and correct for it
  var ds = targetThursday.getTimezoneOffset() - firstThursday.getTimezoneOffset();
  targetThursday.setHours(targetThursday.getHours() - ds);

  // Number of weeks between target Thursday and first Thursday
  var weekDiff = (targetThursday - firstThursday) / (86400000*7);
  return 1 + Math.floor(weekDiff);
}

/**
 * Get ISO-8601 numeric representation of the day of the week
 * 1 (for Monday) through 7 (for Sunday)
 * 
 * @param  {Object} `date`
 * @return {Number}
 */
function getDayOfWeek(date) {
  var dow = date.getDay();
  if(dow === 0) {
    dow = 7;
  }
  return dow;
}

/**
 * kind-of shortcut
 * @param  {*} val
 * @return {String}
 */
function kindOf(val) {
  if (val === null) {
    return 'null';
  }

  if (val === undefined) {
    return 'undefined';
  }

  if (typeof val !== 'object') {
    return typeof val;
  }

  if (Array.isArray(val)) {
    return 'array';
  }

  return {}.toString.call(val)
    .slice(8, -1).toLowerCase();
};



  if (true) {
    !(__WEBPACK_AMD_DEFINE_RESULT__ = (function () {
      return dateFormat;
    }).call(exports, __webpack_require__, exports, module),
				__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  } else {}
})(this);


/***/ }),

/***/ "./src/BaseModules.ts":
/*!****************************!*\
  !*** ./src/BaseModules.ts ***!
  \****************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.SearchEndpoint = exports.Prebinding = exports.Context = void 0;
var Context_1 = __webpack_require__(/*! ./base/Context */ "./src/base/Context.ts");
Object.defineProperty(exports, "Context", { enumerable: true, get: function () { return Context_1.Context; } });
var Prebinding_1 = __webpack_require__(/*! ./base/Prebinding */ "./src/base/Prebinding.ts");
Object.defineProperty(exports, "Prebinding", { enumerable: true, get: function () { return Prebinding_1.Prebinding; } });
var SearchEndpoint_1 = __webpack_require__(/*! ./base/SearchEndpoint */ "./src/base/SearchEndpoint.ts");
Object.defineProperty(exports, "SearchEndpoint", { enumerable: true, get: function () { return SearchEndpoint_1.SearchEndpoint; } });


/***/ }),

/***/ "./src/ComponentsEntry.ts":
/*!********************************!*\
  !*** ./src/ComponentsEntry.ts ***!
  \********************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
    for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.StaticPositionProvider = exports.NavigatorPositionProvider = exports.GoogleApiPositionProvider = exports.CoveoForSitecoreLocalExpression = exports.CoveoForSitecoreFilterExpression = exports.CoveoForSitecoreExternalContent = exports.CoveoForSitecoreRankingExpression = exports.CoveoForSitecoreSyntax = exports.CoveoForSitecoreExpressions = exports.CoveoForSitecoreContext = exports.CoveoForSitecoreBindWithUserContext = exports.ValidateAnalyticsIncluded = exports.SendAnalyticsToSitecore = exports.CoveoForSitecoreConfigureSearchHub = exports.CoveoForSitecoreAnalytics = void 0;
var CoveoForSitecoreAnalytics_1 = __webpack_require__(/*! ./ui/analytics/CoveoForSitecoreAnalytics */ "./src/ui/analytics/CoveoForSitecoreAnalytics.ts");
Object.defineProperty(exports, "CoveoForSitecoreAnalytics", { enumerable: true, get: function () { return CoveoForSitecoreAnalytics_1.CoveoForSitecoreAnalytics; } });
var CoveoForSitecoreConfigureSearchHub_1 = __webpack_require__(/*! ./ui/analytics/CoveoForSitecoreConfigureSearchHub */ "./src/ui/analytics/CoveoForSitecoreConfigureSearchHub.ts");
Object.defineProperty(exports, "CoveoForSitecoreConfigureSearchHub", { enumerable: true, get: function () { return CoveoForSitecoreConfigureSearchHub_1.CoveoForSitecoreConfigureSearchHub; } });
var SendAnalyticsToSitecore_1 = __webpack_require__(/*! ./ui/analytics/SendAnalyticsToSitecore */ "./src/ui/analytics/SendAnalyticsToSitecore.ts");
Object.defineProperty(exports, "SendAnalyticsToSitecore", { enumerable: true, get: function () { return SendAnalyticsToSitecore_1.SendAnalyticsToSitecore; } });
var ValidateAnalyticsIncluded_1 = __webpack_require__(/*! ./ui/analytics/ValidateAnalyticsIncluded */ "./src/ui/analytics/ValidateAnalyticsIncluded.ts");
Object.defineProperty(exports, "ValidateAnalyticsIncluded", { enumerable: true, get: function () { return ValidateAnalyticsIncluded_1.ValidateAnalyticsIncluded; } });
var CoveoForSitecoreBindWithUserContext_1 = __webpack_require__(/*! ./ui/context/CoveoForSitecoreBindWithUserContext */ "./src/ui/context/CoveoForSitecoreBindWithUserContext.ts");
Object.defineProperty(exports, "CoveoForSitecoreBindWithUserContext", { enumerable: true, get: function () { return CoveoForSitecoreBindWithUserContext_1.CoveoForSitecoreBindWithUserContext; } });
var CoveoForSitecoreContext_1 = __webpack_require__(/*! ./ui/context/CoveoForSitecoreContext */ "./src/ui/context/CoveoForSitecoreContext.ts");
Object.defineProperty(exports, "CoveoForSitecoreContext", { enumerable: true, get: function () { return CoveoForSitecoreContext_1.CoveoForSitecoreContext; } });
var CoveoForSitecoreExpressions_1 = __webpack_require__(/*! ./ui/scopes/CoveoForSitecoreExpressions */ "./src/ui/scopes/CoveoForSitecoreExpressions.ts");
Object.defineProperty(exports, "CoveoForSitecoreExpressions", { enumerable: true, get: function () { return CoveoForSitecoreExpressions_1.CoveoForSitecoreExpressions; } });
var CoveoForSitecoreSyntax_1 = __webpack_require__(/*! ./ui/scopes/CoveoForSitecoreSyntax */ "./src/ui/scopes/CoveoForSitecoreSyntax.ts");
Object.defineProperty(exports, "CoveoForSitecoreSyntax", { enumerable: true, get: function () { return CoveoForSitecoreSyntax_1.CoveoForSitecoreSyntax; } });
var CoveoForSitecoreRankingExpression_1 = __webpack_require__(/*! ./ui/scopes/CoveoForSitecoreRankingExpression */ "./src/ui/scopes/CoveoForSitecoreRankingExpression.ts");
Object.defineProperty(exports, "CoveoForSitecoreRankingExpression", { enumerable: true, get: function () { return CoveoForSitecoreRankingExpression_1.CoveoForSitecoreRankingExpression; } });
var CoveoForSitecoreExternalContent_1 = __webpack_require__(/*! ./ui/scopes/CoveoForSitecoreExternalContent */ "./src/ui/scopes/CoveoForSitecoreExternalContent.ts");
Object.defineProperty(exports, "CoveoForSitecoreExternalContent", { enumerable: true, get: function () { return CoveoForSitecoreExternalContent_1.CoveoForSitecoreExternalContent; } });
var CoveoForSitecoreFilterExpression_1 = __webpack_require__(/*! ./ui/scopes/CoveoForSitecoreFilterExpression */ "./src/ui/scopes/CoveoForSitecoreFilterExpression.ts");
Object.defineProperty(exports, "CoveoForSitecoreFilterExpression", { enumerable: true, get: function () { return CoveoForSitecoreFilterExpression_1.CoveoForSitecoreFilterExpression; } });
var CoveoForSitecoreLocalExpression_1 = __webpack_require__(/*! ./ui/scopes/CoveoForSitecoreLocalExpression */ "./src/ui/scopes/CoveoForSitecoreLocalExpression.ts");
Object.defineProperty(exports, "CoveoForSitecoreLocalExpression", { enumerable: true, get: function () { return CoveoForSitecoreLocalExpression_1.CoveoForSitecoreLocalExpression; } });
var GoogleApiPositionProvider_1 = __webpack_require__(/*! ./ui/distance/GoogleApiPositionProvider */ "./src/ui/distance/GoogleApiPositionProvider.ts");
Object.defineProperty(exports, "GoogleApiPositionProvider", { enumerable: true, get: function () { return GoogleApiPositionProvider_1.GoogleApiPositionProvider; } });
var NavigatorPositionProvider_1 = __webpack_require__(/*! ./ui/distance/NavigatorPositionProvider */ "./src/ui/distance/NavigatorPositionProvider.ts");
Object.defineProperty(exports, "NavigatorPositionProvider", { enumerable: true, get: function () { return NavigatorPositionProvider_1.NavigatorPositionProvider; } });
var StaticPositionProvider_1 = __webpack_require__(/*! ./ui/distance/StaticPositionProvider */ "./src/ui/distance/StaticPositionProvider.ts");
Object.defineProperty(exports, "StaticPositionProvider", { enumerable: true, get: function () { return StaticPositionProvider_1.StaticPositionProvider; } });
__exportStar(__webpack_require__(/*! ./EventsModules */ "./src/EventsModules.ts"), exports);
__exportStar(__webpack_require__(/*! ./BaseModules */ "./src/BaseModules.ts"), exports);
__exportStar(__webpack_require__(/*! ./base/Initialization */ "./src/base/Initialization.ts"), exports);


/***/ }),

/***/ "./src/EventsModules.ts":
/*!******************************!*\
  !*** ./src/EventsModules.ts ***!
  \******************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.SitecoreExpressionEvents = exports.SitecoreContextEvents = void 0;
var ContextEvents_1 = __webpack_require__(/*! ./events/ContextEvents */ "./src/events/ContextEvents.ts");
Object.defineProperty(exports, "SitecoreContextEvents", { enumerable: true, get: function () { return ContextEvents_1.SitecoreContextEvents; } });
var ExpressionEvents_1 = __webpack_require__(/*! ./events/ExpressionEvents */ "./src/events/ExpressionEvents.ts");
Object.defineProperty(exports, "SitecoreExpressionEvents", { enumerable: true, get: function () { return ExpressionEvents_1.SitecoreExpressionEvents; } });


/***/ }),

/***/ "./src/base/Context.ts":
/*!*****************************!*\
  !*** ./src/base/Context.ts ***!
  \*****************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.Context = void 0;
var ContextInitializer_1 = __webpack_require__(/*! ./initialization/ContextInitializer */ "./src/base/initialization/ContextInitializer.ts");
var CoveoForSitecoreContext_1 = __webpack_require__(/*! ../ui/context/CoveoForSitecoreContext */ "./src/ui/context/CoveoForSitecoreContext.ts");
var coveo_search_ui_1 = __webpack_require__(/*! coveo-search-ui */ "coveo-search-ui");
var Context = /** @class */ (function () {
    function Context() {
    }
    Context.configureContext = function (contextElement) {
        if (typeof contextElement === 'undefined' || contextElement === null) {
            throw Error('You must execute `configureContext` with an HTML element.');
        }
        var options = coveo_search_ui_1.ComponentOptions.initComponentOptions(contextElement, CoveoForSitecoreContext_1.CoveoForSitecoreContext);
        this.initializeWithContextOptions(contextElement, options);
    };
    Context.initializeWithContextOptions = function (contextElement, contextOptions) {
        var contextInitializer = new ContextInitializer_1.ContextInitializer();
        var fieldsHandler = contextInitializer.createFieldsHandler({
            externalFields: contextOptions.scExternalFields,
            sourceSpecificFields: contextOptions.scSourceSpecificFields,
            preferSourceSpecificFields: contextOptions.scPreferSourceSpecificFields,
            prefix: contextOptions.scFieldPrefix,
            suffix: contextOptions.scFieldSuffix,
        });
        var labels = contextInitializer.createLabelsHandler({
            labels: contextOptions.scLabels,
        });
        var sourceName = contextOptions.scIndexSourceName;
        contextInitializer.initializePrebinding({
            fieldsHandler: fieldsHandler,
            context: contextOptions,
        });
        contextInitializer.initializeUnderscoreFieldsHelpers(fieldsHandler);
        contextInitializer.initializeUnderscoreLabelsHelpers(labels);
        contextInitializer.initializeUnderscoreContextHelpers(sourceName);
        contextInitializer.initializeContextElement(contextElement);
        this.fields = fieldsHandler;
        this.labels = labels;
        this.element = contextElement;
    };
    return Context;
}());
exports.Context = Context;


/***/ }),

/***/ "./src/base/Initialization.ts":
/*!************************************!*\
  !*** ./src/base/Initialization.ts ***!
  \************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.initHostedSearchPageInitializer = exports.initExternalComponentsSectionForExperienceEditor = exports.initExternalComponentsSection = exports.initContextOnElement = exports.initSearchboxIfStandalone = exports.initializeSearchInterfaceForExperienceEditor = exports.initSearchInterface = exports.hostedSearchPageInitializer = exports.externalComponentInitializer = exports.searchboxInitializer = exports.searchInterfaceInitializer = void 0;
var ExternalComponentInitializer_1 = __webpack_require__(/*! ./initialization/ExternalComponentInitializer */ "./src/base/initialization/ExternalComponentInitializer.ts");
var SearchboxInitializer_1 = __webpack_require__(/*! ./initialization/SearchboxInitializer */ "./src/base/initialization/SearchboxInitializer.ts");
var SearchInterfaceInitializer_1 = __webpack_require__(/*! ./initialization/SearchInterfaceInitializer */ "./src/base/initialization/SearchInterfaceInitializer.ts");
var ElementWithContextInitializer_1 = __webpack_require__(/*! ./initialization/ElementWithContextInitializer */ "./src/base/initialization/ElementWithContextInitializer.ts");
var HostedSearchPageInitializer_1 = __webpack_require__(/*! ./initialization/HostedSearchPageInitializer */ "./src/base/initialization/HostedSearchPageInitializer.ts");
exports.searchInterfaceInitializer = new SearchInterfaceInitializer_1.SearchInterfaceInitializer();
exports.searchboxInitializer = new SearchboxInitializer_1.SearchboxInitializer();
exports.externalComponentInitializer = new ExternalComponentInitializer_1.ExternalComponentInitializer();
exports.hostedSearchPageInitializer = new HostedSearchPageInitializer_1.HostedSearchPageInitializer();
function initSearchInterface(searchInterfaceElement) {
    return exports.searchInterfaceInitializer.initSearchInterface(searchInterfaceElement);
}
exports.initSearchInterface = initSearchInterface;
function initializeSearchInterfaceForExperienceEditor(searchInterfaceElement) {
    exports.searchInterfaceInitializer.initializeExperienceEditorHooksForSearchInterface(searchInterfaceElement);
    return initSearchInterface(searchInterfaceElement);
}
exports.initializeSearchInterfaceForExperienceEditor = initializeSearchInterfaceForExperienceEditor;
function initSearchboxIfStandalone(searchBoxElement, searchPageUri, options) {
    return exports.searchboxInitializer.initSearchboxIfStandalone(searchBoxElement, searchPageUri, options);
}
exports.initSearchboxIfStandalone = initSearchboxIfStandalone;
function initContextOnElement(element) {
    ElementWithContextInitializer_1.ElementWithContextInitializer.initializeContextWithinElement(element);
}
exports.initContextOnElement = initContextOnElement;
function initExternalComponentsSection(element) {
    exports.externalComponentInitializer.initializeExternalComponentSection(element);
}
exports.initExternalComponentsSection = initExternalComponentsSection;
function initExternalComponentsSectionForExperienceEditor(element) {
    exports.externalComponentInitializer.initializeExperienceEditorHooksForExternalComponentsSection(element);
    initExternalComponentsSection(element);
}
exports.initExternalComponentsSectionForExperienceEditor = initExternalComponentsSectionForExperienceEditor;
function initHostedSearchPageInitializer(element) {
    exports.hostedSearchPageInitializer.initializeSearchPage(element);
}
exports.initHostedSearchPageInitializer = initHostedSearchPageInitializer;


/***/ }),

/***/ "./src/base/Prebinding.ts":
/*!********************************!*\
  !*** ./src/base/Prebinding.ts ***!
  \********************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.Prebinding = void 0;
var PrebindResolver_1 = __webpack_require__(/*! ../resolvers/prebinding/PrebindResolver */ "./src/resolvers/prebinding/PrebindResolver.ts");
var SortCriteriaPreprocessor = __webpack_require__(/*! ../resolvers/sortCriteria/SortCriteriaPreprocessor */ "./src/resolvers/sortCriteria/SortCriteriaPreprocessor.ts");
var Prebinding = exports.Prebinding = /** @class */ (function () {
    function Prebinding() {
    }
    Prebinding.registerPrebindHelper = function (helperName, handler) {
        this.processor.registerPrebindHelper(helperName, handler);
    };
    Prebinding.getHelper = function (helperName) {
        return this.processor.getHelper(helperName);
    };
    Prebinding.applyPrebindingOnElement = function (rootElement) {
        if (this.processor.canApplyPrebind(rootElement) && this.processor.hasNotAppliedPrebind(rootElement)) {
            this.processor.applyToElement(rootElement);
        }
    };
    Prebinding.applyPreprocessingToElements = function (rootElement) {
        SortCriteriaPreprocessor.adjustDOMElements(rootElement);
        return rootElement.querySelectorAll('*');
    };
    Prebinding.applyPrebindingOnChildren = function (rootElement) {
        var _this = this;
        var processedElements = this.applyPreprocessingToElements(rootElement);
        this.nodeListToArray(processedElements)
            .map(function (element) { return element; })
            .filter(function (element) { return _this.processor.canApplyPrebind(element); })
            .filter(function (element) { return _this.processor.hasNotAppliedPrebind(element); })
            .forEach(function (element) { return _this.processor.applyToElement(element); });
    };
    Prebinding.nodeListToArray = function (elements) {
        var array = [];
        for (var i = 0, length = elements.length; i < length; i++) {
            array.push(elements[i]);
        }
        return array;
    };
    Prebinding.processor = new PrebindResolver_1.PrebindResolver();
    return Prebinding;
}());


/***/ }),

/***/ "./src/base/SearchEndpoint.ts":
/*!************************************!*\
  !*** ./src/base/SearchEndpoint.ts ***!
  \************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.SearchEndpoint = void 0;
var coveo_search_ui_1 = __webpack_require__(/*! coveo-search-ui */ "coveo-search-ui");
var SearchEndpoint = /** @class */ (function () {
    function SearchEndpoint() {
    }
    SearchEndpoint.configureSitecoreEndpoint = function (options) {
        if (typeof options === 'undefined') {
            throw Error("You must define endpoint options when calling 'configureSitecoreEndpoint'.");
        }
        SearchEndpoint.getAccessToken().then(function (accessToken) {
            SearchEndpoint.initializeEndPoint(options, accessToken);
            SearchEndpoint.dispatchInitializationEvent();
        });
    };
    SearchEndpoint.initializeEndPoint = function (options, accessToken) {
        var endpoint = SearchEndpoint.createNewEndpoint(options, accessToken);
        coveo_search_ui_1.SearchEndpoint.endpoints['default'] = endpoint;
    };
    SearchEndpoint.dispatchInitializationEvent = function () {
        var customEvent = document.createEvent('CustomEvent');
        customEvent.initEvent('CoveoSearchEndpointInitialized', false, true);
        if (document.readyState !== 'loading') {
            document.dispatchEvent(customEvent);
        }
        else {
            document.addEventListener('DOMContentLoaded', function () {
                document.dispatchEvent(customEvent);
            });
        }
    };
    SearchEndpoint.getAccessToken = function () {
        return SearchEndpoint.fetchAccessToken()
            .then(function (response) {
            if (response.ok) {
                return response.json();
            }
        })
            .then(function (data) { return data.token; })
            .catch(function () {
            // Returning an empty token delegates error handling of invalid access token to the Coveo Search UI.
            return '';
        });
    };
    SearchEndpoint.fetchAccessToken = function () {
        return fetch("/coveo/rest/token?t=".concat(Date.now()));
    };
    SearchEndpoint.createNewEndpoint = function (options, accessToken) {
        return new coveo_search_ui_1.SearchEndpoint({
            restUri: options.restEndpointUri ? "".concat(options.restEndpointUri, "/search") : '/coveo/rest/search',
            queryStringArguments: {
                sitecoreItemUri: options.itemUri,
                siteName: options.siteName,
            },
            accessToken: accessToken,
            renewAccessToken: SearchEndpoint.getAccessToken,
        });
    };
    return SearchEndpoint;
}());
exports.SearchEndpoint = SearchEndpoint;


/***/ }),

/***/ "./src/base/initialization/ContextInitializer.ts":
/*!*******************************************************!*\
  !*** ./src/base/initialization/ContextInitializer.ts ***!
  \*******************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.ContextInitializer = void 0;
var CoveoFieldsHandler_1 = __webpack_require__(/*! ../../handlers/CoveoFieldsHandler */ "./src/handlers/CoveoFieldsHandler.ts");
var SourceSpecificFieldResolver_1 = __webpack_require__(/*! ../../handlers/SourceSpecificFieldResolver */ "./src/handlers/SourceSpecificFieldResolver.ts");
var CoveoLabelsHandler_1 = __webpack_require__(/*! ../../handlers/CoveoLabelsHandler */ "./src/handlers/CoveoLabelsHandler.ts");
var Prebinding_1 = __webpack_require__(/*! ../Prebinding */ "./src/base/Prebinding.ts");
var PrebindHelpers_1 = __webpack_require__(/*! ../../resolvers/prebinding/PrebindHelpers */ "./src/resolvers/prebinding/PrebindHelpers.ts");
var coveo_search_ui_1 = __webpack_require__(/*! coveo-search-ui */ "coveo-search-ui");
var LegacyFieldTypeResolver_1 = __webpack_require__(/*! ../../handlers/LegacyFieldTypeResolver */ "./src/handlers/LegacyFieldTypeResolver.ts");
var ContextInitializer = /** @class */ (function () {
    function ContextInitializer() {
    }
    ContextInitializer.prototype.createFieldsHandler = function (options) {
        var externalFields = options.externalFields || [];
        var sourceSpecificFields = options.sourceSpecificFields || [];
        var fieldTypeResolver = options.preferSourceSpecificFields
            ? new LegacyFieldTypeResolver_1.LegacyFieldTypeResolver(externalFields)
            : new SourceSpecificFieldResolver_1.SourceSpecificFieldResolver(sourceSpecificFields, externalFields);
        return new CoveoFieldsHandler_1.CoveoFieldsHandler(fieldTypeResolver, options.prefix, options.suffix);
    };
    ContextInitializer.prototype.createLabelsHandler = function (options) {
        var labels = options.labels || {};
        return new CoveoLabelsHandler_1.CoveoLabelsHandler(labels);
    };
    ContextInitializer.prototype.initializePrebinding = function (args) {
        PrebindHelpers_1.PrebindHelpers.getAllPrebindHelpers().forEach(function (helper) {
            Prebinding_1.Prebinding.registerPrebindHelper(helper.name, helper.getPrebind(args));
        });
    };
    ContextInitializer.prototype.initializeUnderscoreFieldsHelpers = function (fieldsHandler) {
        coveo_search_ui_1.TemplateHelpers.registerTemplateHelper('coveoFieldValue', function (fieldName) {
            return this.raw[fieldsHandler.toCoveo(fieldName)];
        });
        coveo_search_ui_1.TemplateHelpers.registerTemplateHelper('coveoFieldName', function (fieldName) {
            return fieldsHandler.toCoveo(fieldName);
        });
    };
    ContextInitializer.prototype.initializeUnderscoreLabelsHelpers = function (labels) {
        coveo_search_ui_1.TemplateHelpers.registerTemplateHelper('translateLabel', function (labelKey) {
            return labels.translate(labelKey);
        });
    };
    ContextInitializer.prototype.initializeUnderscoreContextHelpers = function (sourceName) {
        coveo_search_ui_1.TemplateHelpers.registerTemplateHelper('currentSourceName', function () {
            return sourceName;
        });
    };
    ContextInitializer.prototype.initializeContextElement = function (contextElement) {
        Prebinding_1.Prebinding.applyPrebindingOnElement(contextElement);
    };
    return ContextInitializer;
}());
exports.ContextInitializer = ContextInitializer;


/***/ }),

/***/ "./src/base/initialization/ElementWithContextInitializer.ts":
/*!******************************************************************!*\
  !*** ./src/base/initialization/ElementWithContextInitializer.ts ***!
  \******************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.ElementWithContextInitializer = void 0;
var Prebinding_1 = __webpack_require__(/*! ../Prebinding */ "./src/base/Prebinding.ts");
var Context_1 = __webpack_require__(/*! ../Context */ "./src/base/Context.ts");
var HTMLUtils_1 = __webpack_require__(/*! ../../utils/HTMLUtils */ "./src/utils/HTMLUtils.ts");
var ElementWithContextInitializer = /** @class */ (function () {
    function ElementWithContextInitializer() {
    }
    ElementWithContextInitializer.initializeContextWithinElement = function (element) {
        if (!!Context_1.Context.element) {
            element.appendChild((0, HTMLUtils_1.cloneElementSafelyForAccessibility)(Context_1.Context.element));
        }
        Prebinding_1.Prebinding.applyPrebindingOnElement(element);
        Prebinding_1.Prebinding.applyPrebindingOnChildren(element);
    };
    return ElementWithContextInitializer;
}());
exports.ElementWithContextInitializer = ElementWithContextInitializer;


/***/ }),

/***/ "./src/base/initialization/ExternalComponentInitializer.ts":
/*!*****************************************************************!*\
  !*** ./src/base/initialization/ExternalComponentInitializer.ts ***!
  \*****************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.ExternalComponentInitializer = void 0;
var SearchInterfaceComponentInitializer_1 = __webpack_require__(/*! ../../resolvers/components/SearchInterfaceComponentInitializer */ "./src/resolvers/components/SearchInterfaceComponentInitializer.ts");
var SitecoreExperienceEditor_1 = __webpack_require__(/*! ./SitecoreExperienceEditor */ "./src/base/initialization/SitecoreExperienceEditor.ts");
var SearchInterfaceProvider_1 = __webpack_require__(/*! ../../utils/SearchInterfaceProvider */ "./src/utils/SearchInterfaceProvider.ts");
var coveo_search_ui_1 = __webpack_require__(/*! coveo-search-ui */ "coveo-search-ui");
var ExternalComponentInitializer = /** @class */ (function () {
    function ExternalComponentInitializer(experienceEditor, searchInterfaceComponentInitializer) {
        if (experienceEditor === void 0) { experienceEditor = (0, SitecoreExperienceEditor_1.getExperienceEditorInstance)(); }
        if (searchInterfaceComponentInitializer === void 0) { searchInterfaceComponentInitializer = (0, SearchInterfaceComponentInitializer_1.getInitializerInstance)(); }
        this.experienceEditor = experienceEditor;
        this.searchInterfaceComponentInitializer = searchInterfaceComponentInitializer;
        this.searchInterfacesProvider = new SearchInterfaceProvider_1.SearchInterfacesProvider();
    }
    ExternalComponentInitializer.prototype.initializeExternalComponentSection = function (externalComponentsSection) {
        var searchInterface = this.findSearchInterfaceForSection(externalComponentsSection);
        if (!!searchInterface) {
            this.searchInterfaceComponentInitializer.loadComponentsWithSearchInterfaceInitialization(searchInterface, externalComponentsSection);
        }
        else {
            var getAllSearchInterfaceIds = this.getAllSearchInterfaceIdsInPage();
            if (getAllSearchInterfaceIds.length > 0) {
                console.error("Could not find the search interface element with the following ID: ".concat(this.getSearchInterfaceId(externalComponentsSection), ". The following IDs were found: ").concat(getAllSearchInterfaceIds.join(','), "."), externalComponentsSection);
            }
        }
    };
    ExternalComponentInitializer.prototype.initializeExperienceEditorHooksForExternalComponentsSection = function (externalComponentsSection) {
        var _this = this;
        var searchInterface = this.findSearchInterfaceForSection(externalComponentsSection);
        if (!!searchInterface) {
            this.experienceEditor.registerOnLoadRenderingFromUrl(function (callbackData) {
                var component = _this.experienceEditor.getComponentFromLoadRenderingFromUrlCallbackData(callbackData);
                if (externalComponentsSection.contains(component)) {
                    _this.searchInterfaceComponentInitializer.loadComponentsForSearchInterface((0, coveo_search_ui_1.get)(searchInterface, coveo_search_ui_1.SearchInterface), component);
                }
            });
        }
    };
    ExternalComponentInitializer.prototype.findSearchInterfaceForSection = function (externalComponentsSection) {
        var searchInterfaceId = this.getSearchInterfaceId(externalComponentsSection);
        var searchInterfaceElement = document.getElementById(searchInterfaceId);
        if (!!searchInterfaceElement) {
            return searchInterfaceElement;
        }
    };
    ExternalComponentInitializer.prototype.getSearchInterfaceId = function (externalComponentsSection) {
        return externalComponentsSection.dataset.searchInterfaceId;
    };
    ExternalComponentInitializer.prototype.getAllSearchInterfaceIdsInPage = function () {
        return this.searchInterfacesProvider
            .getSearchInterfacesInPage(['SearchInterface'])
            .map(function (element) { return element.id; })
            .filter(function (id) { return !!id; });
    };
    return ExternalComponentInitializer;
}());
exports.ExternalComponentInitializer = ExternalComponentInitializer;


/***/ }),

/***/ "./src/base/initialization/HostedSearchPageInitializer.ts":
/*!****************************************************************!*\
  !*** ./src/base/initialization/HostedSearchPageInitializer.ts ***!
  \****************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
var __generator = (this && this.__generator) || function (thisArg, body) {
    var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
    return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
    function verb(n) { return function (v) { return step([n, v]); }; }
    function step(op) {
        if (f) throw new TypeError("Generator is already executing.");
        while (g && (g = 0, op[0] && (_ = 0)), _) try {
            if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
            if (y = 0, t) op = [op[0] & 2, t.value];
            switch (op[0]) {
                case 0: case 1: t = op; break;
                case 4: _.label++; return { value: op[1], done: false };
                case 5: _.label++; y = op[1]; op = [0]; continue;
                case 7: op = _.ops.pop(); _.trys.pop(); continue;
                default:
                    if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
                    if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
                    if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
                    if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
                    if (t[2]) _.ops.pop();
                    _.trys.pop(); continue;
            }
            op = body.call(thisArg, _);
        } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
        if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
    }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.HostedSearchPageInitializer = void 0;
var HostedSearchPageInitializer = /** @class */ (function () {
    function HostedSearchPageInitializer() {
        this.UNABLE_TO_RETRIEVE_ACCESS_TOKEN = 'Unable to retrieve access token.';
    }
    HostedSearchPageInitializer.prototype.initializeSearchPage = function (element) {
        var _this = this;
        this.searchPageElement = element;
        this.searchEndpointUri = element.dataset.searchEndpointUri;
        this.analyticsEndpointUri = element.dataset.analyticsEndpointUri;
        this.organizationId = element.dataset.organizationId;
        this.searchHub = element.dataset.searchHub;
        this.isInExperienceEditor = element.dataset.isInExperienceEditor === 'true';
        this.getAccessToken = this.getAccessToken.bind(this);
        this.getAccessToken()
            .then(function (accessToken) {
            _this.initializeCoveo(element, accessToken);
        })
            .catch(function (err) {
            if (_this.isInExperienceEditor) {
                _this.displayErrorMessageInExperienceEditor(err.message);
            }
        });
    };
    HostedSearchPageInitializer.prototype.getAccessToken = function () {
        return __awaiter(this, void 0, void 0, function () {
            var _this = this;
            return __generator(this, function (_a) {
                return [2 /*return*/, this.fetchAccessToken()
                        .then(function (response) {
                        if (response.ok) {
                            return response.json();
                        }
                        throw Error(_this.UNABLE_TO_RETRIEVE_ACCESS_TOKEN);
                    })
                        .then(function (data) { return data.token; })
                        .catch(function (err) {
                        if (_this.isInExperienceEditor) {
                            _this.displayErrorMessageInExperienceEditor(err.message);
                        }
                        return '';
                    })];
            });
        });
    };
    HostedSearchPageInitializer.prototype.initializeCoveo = function (element, accessToken) {
        var searchPageRoot = element.querySelector('.CoveoSearchInterface');
        if (searchPageRoot && typeof Coveo !== 'undefined') {
            Coveo.SearchEndpoint.endpoints['default'] = new Coveo.SearchEndpoint({
                restUri: "".concat(this.searchEndpointUri, "/rest/search/"),
                accessToken: accessToken,
                queryStringArguments: {
                    organizationId: this.organizationId,
                },
                renewAccessToken: this.getAccessToken,
            });
            Coveo.Analytics.options.searchHub['defaultValue'] = this.searchHub;
            Coveo.Analytics.options.organization['defaultValue'] = this.organizationId;
            Coveo.Analytics.options.endpoint['defaultValue'] = "".concat(this.analyticsEndpointUri, "/rest/ua/");
            Coveo.init(searchPageRoot);
        }
    };
    HostedSearchPageInitializer.prototype.fetchAccessToken = function () {
        return __awaiter(this, void 0, void 0, function () {
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0: return [4 /*yield*/, fetch("/coveo/rest/token?t=".concat(Date.now()))];
                    case 1: return [2 /*return*/, _a.sent()];
                }
            });
        });
    };
    HostedSearchPageInitializer.prototype.displayErrorMessageInExperienceEditor = function (message) {
        var errorMessageElement = "\n            <span class='errorMessage'>".concat(message, "</span>\n        ");
        this.searchPageElement.insertAdjacentHTML('afterbegin', errorMessageElement);
    };
    return HostedSearchPageInitializer;
}());
exports.HostedSearchPageInitializer = HostedSearchPageInitializer;


/***/ }),

/***/ "./src/base/initialization/SearchInterfaceInitializer.ts":
/*!***************************************************************!*\
  !*** ./src/base/initialization/SearchInterfaceInitializer.ts ***!
  \***************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.SearchInterfaceInitializer = void 0;
var Initialization_1 = __webpack_require__(/*! ../Initialization */ "./src/base/Initialization.ts");
var SearchInterfaceComponentInitializer_1 = __webpack_require__(/*! ../../resolvers/components/SearchInterfaceComponentInitializer */ "./src/resolvers/components/SearchInterfaceComponentInitializer.ts");
var SitecoreExperienceEditor_1 = __webpack_require__(/*! ./SitecoreExperienceEditor */ "./src/base/initialization/SitecoreExperienceEditor.ts");
var coveo_search_ui_1 = __webpack_require__(/*! coveo-search-ui */ "coveo-search-ui");
var SearchInterfaceInitializer = /** @class */ (function () {
    function SearchInterfaceInitializer(experienceEditor, searchInterfaceComponentInitializer) {
        if (experienceEditor === void 0) { experienceEditor = (0, SitecoreExperienceEditor_1.getExperienceEditorInstance)(); }
        if (searchInterfaceComponentInitializer === void 0) { searchInterfaceComponentInitializer = (0, SearchInterfaceComponentInitializer_1.getInitializerInstance)(); }
        this.experienceEditor = experienceEditor;
        this.searchInterfaceComponentInitializer = searchInterfaceComponentInitializer;
    }
    SearchInterfaceInitializer.prototype.initSearchInterface = function (searchInterface) {
        if (!this.experienceEditor.isInBackgroundRendering()) {
            this.experienceEditor.registerShowDebugInformationCallback();
            (0, Initialization_1.initContextOnElement)(searchInterface);
            var searchInterfacePromise = (0, coveo_search_ui_1.init)(searchInterface);
            searchInterfacePromise.then(function () {
                var event = document.createEvent('CustomEvent');
                event.initEvent('SearchInterfaceInitialized', false, true);
                searchInterface.dispatchEvent(event);
            });
            return searchInterfacePromise;
        }
    };
    SearchInterfaceInitializer.prototype.initializeExperienceEditorHooksForSearchInterface = function (searchInterface) {
        var _this = this;
        this.experienceEditor.registerOnLoadRenderingFromUrl(function (callbackData) {
            var component = _this.experienceEditor.getComponentFromLoadRenderingFromUrlCallbackData(callbackData);
            // Since multiple search interfaces can register event handlers, this ensures that the component is initializing for the correct search interface.
            if (searchInterface.contains(component)) {
                var searchInterfaceComponent = Coveo.get(searchInterface, Coveo.SearchInterface);
                _this.searchInterfaceComponentInitializer.loadComponentsForSearchInterface(searchInterfaceComponent, component);
            }
        });
        this.experienceEditor.registerOnAfterPersonalizationChanged(function (element) {
            if (searchInterface.contains(element)) {
                var searchInterfaceComponent = Coveo.get(searchInterface, Coveo.SearchInterface);
                _this.searchInterfaceComponentInitializer.loadComponentsForSearchInterface(searchInterfaceComponent, element);
            }
        });
        this.experienceEditor.registerBeforeUnloadingChrome(function (element) {
            if (searchInterface.contains(element)) {
                var searchInterfaceComponent = Coveo.get(searchInterface, Coveo.SearchInterface);
                _this.searchInterfaceComponentInitializer.tryUnloadComponentsForSearchInterface(searchInterfaceComponent, element);
            }
        });
    };
    return SearchInterfaceInitializer;
}());
exports.SearchInterfaceInitializer = SearchInterfaceInitializer;


/***/ }),

/***/ "./src/base/initialization/SearchboxInitializer.ts":
/*!*********************************************************!*\
  !*** ./src/base/initialization/SearchboxInitializer.ts ***!
  \*********************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
var __generator = (this && this.__generator) || function (thisArg, body) {
    var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
    return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
    function verb(n) { return function (v) { return step([n, v]); }; }
    function step(op) {
        if (f) throw new TypeError("Generator is already executing.");
        while (g && (g = 0, op[0] && (_ = 0)), _) try {
            if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
            if (y = 0, t) op = [op[0] & 2, t.value];
            switch (op[0]) {
                case 0: case 1: t = op; break;
                case 4: _.label++; return { value: op[1], done: false };
                case 5: _.label++; y = op[1]; op = [0]; continue;
                case 7: op = _.ops.pop(); _.trys.pop(); continue;
                default:
                    if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
                    if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
                    if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
                    if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
                    if (t[2]) _.ops.pop();
                    _.trys.pop(); continue;
            }
            op = body.call(thisArg, _);
        } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
        if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
    }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.SearchboxInitializer = void 0;
var SearchInterfaceProvider_1 = __webpack_require__(/*! ../../utils/SearchInterfaceProvider */ "./src/utils/SearchInterfaceProvider.ts");
var ElementWithContextInitializer_1 = __webpack_require__(/*! ./ElementWithContextInitializer */ "./src/base/initialization/ElementWithContextInitializer.ts");
var coveo_search_ui_1 = __webpack_require__(/*! coveo-search-ui */ "coveo-search-ui");
var SearchboxInitializer = /** @class */ (function () {
    function SearchboxInitializer() {
        this.searchInterfacesProvider = new SearchInterfaceProvider_1.SearchInterfacesProvider();
    }
    SearchboxInitializer.prototype.initSearchboxIfStandalone = function (searchboxElement, searchPageUri, options) {
        return __awaiter(this, void 0, void 0, function () {
            var searchInterfaces;
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0:
                        searchInterfaces = this.searchInterfacesProvider.getSearchInterfacesInPage([
                            'Recommendation',
                            'SearchInterface',
                        ]);
                        return [4 /*yield*/, this.waitForSearchInterfacesInitialization(searchInterfaces)];
                    case 1:
                        _a.sent();
                        if (this.searchboxElementIsNotInitialized(searchboxElement)) {
                            if (!!searchPageUri) {
                                ElementWithContextInitializer_1.ElementWithContextInitializer.initializeContextWithinElement(searchboxElement.parentElement);
                                // coveo-search-ui doesn't like an initSearchbox directly on the searchbox.
                                (0, coveo_search_ui_1.initSearchbox)(searchboxElement.parentElement, searchPageUri, options);
                            }
                            else {
                                console.warn("The search box is not included in any search interface and the \"searchPageUri\" parameters is not specified. Consider using a Global Searchbox instead.", searchboxElement);
                            }
                        }
                        return [2 /*return*/];
                }
            });
        });
    };
    SearchboxInitializer.prototype.searchboxElementIsNotInitialized = function (searchBoxElement) {
        return typeof (0, coveo_search_ui_1.get)(searchBoxElement, Coveo.Searchbox) === 'undefined';
    };
    SearchboxInitializer.prototype.waitForSearchInterfacesInitialization = function (searchInterfaces) {
        return __awaiter(this, void 0, void 0, function () {
            return __generator(this, function (_a) {
                switch (_a.label) {
                    case 0: return [4 /*yield*/, Promise.all(this.getAllSearchInterfacesAfterComponentInitialization(searchInterfaces))];
                    case 1:
                        _a.sent();
                        return [2 /*return*/];
                }
            });
        });
    };
    SearchboxInitializer.prototype.getAllSearchInterfacesAfterComponentInitialization = function (searchInterfaces) {
        var _this = this;
        return searchInterfaces
            .map(function (searchInterface) { return (0, coveo_search_ui_1.$$)(searchInterface); })
            .map(function (searchInterface) { return _this.waitForSearchInterfaceInitialization(searchInterface); });
    };
    SearchboxInitializer.prototype.waitForSearchInterfaceInitialization = function (searchInterface) {
        return new Promise(function (resolve, reject) {
            if (searchInterface.hasClass('coveo-after-initialization')) {
                return resolve();
            }
            searchInterface.on(coveo_search_ui_1.InitializationEvents.afterComponentsInitialization, function () { return resolve(); });
        });
    };
    return SearchboxInitializer;
}());
exports.SearchboxInitializer = SearchboxInitializer;


/***/ }),

/***/ "./src/base/initialization/SitecoreExperienceEditor.ts":
/*!*************************************************************!*\
  !*** ./src/base/initialization/SitecoreExperienceEditor.ts ***!
  \*************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.getExperienceEditorInstance = exports.SitecoreExperienceEditor = void 0;
var HTMLUtils_1 = __webpack_require__(/*! ../../utils/HTMLUtils */ "./src/utils/HTMLUtils.ts");
var SitecoreExperienceEditor = exports.SitecoreExperienceEditor = /** @class */ (function () {
    function SitecoreExperienceEditor() {
        this.isAfterFrameLoadedOverriden = false;
        this.isAfterPersonalizationChangedOverriden = false;
        this.isBeforeUnloadingChromeOverriden = false;
        this.onAfterFrameLoadedCallbacks = [];
        this.onAfterPersonalizationChanged = [];
        this.onBeforeUnloadingChrome = [];
    }
    SitecoreExperienceEditor.prototype.registerOnLoadRenderingFromUrl = function (onAfterFrameLoadedCallback) {
        this.tryOverrideSitecoreLoadRenderingFromUrl();
        this.onAfterFrameLoadedCallbacks.push(onAfterFrameLoadedCallback);
    };
    SitecoreExperienceEditor.prototype.registerBeforeUnloadingChrome = function (onBeforeUnloadingChromeCallback) {
        this.tryOverrideOnUnloadingChrome();
        this.onBeforeUnloadingChrome.push(onBeforeUnloadingChromeCallback);
    };
    SitecoreExperienceEditor.prototype.registerOnAfterPersonalizationChanged = function (onAfterPersonalizationChanged) {
        this.tryOverrideSitecoreChromeTypesRenderingChangeCondition();
        this.onAfterPersonalizationChanged.push(onAfterPersonalizationChanged);
    };
    SitecoreExperienceEditor.prototype.isInBackgroundRendering = function () {
        return window.location.search.indexOf(SitecoreExperienceEditor.isInBackgroundRenderingParameterName) !== -1;
    };
    SitecoreExperienceEditor.prototype.getComponentFromLoadRenderingFromUrlCallbackData = function (callbackData) {
        var chromeRendering = document.getElementById(callbackData.opening[0].id);
        return chromeRendering.nextElementSibling;
    };
    SitecoreExperienceEditor.prototype.tryOverrideSitecoreLoadRenderingFromUrl = function () {
        if (!this.isAfterFrameLoadedOverriden && typeof Sitecore !== 'undefined') {
            this.overrideSitecoreLoadRenderingFromUrl();
        }
    };
    SitecoreExperienceEditor.prototype.overrideSitecoreLoadRenderingFromUrl = function () {
        var _this = this;
        var originalLoad = Sitecore.PageModes.ChromeTypes.Placeholder.prototype.insertRendering;
        var onAfterFrameLoadedCallback = function (callbackData) {
            _this.onAfterFrameLoadedCallbacks.forEach(function (callback) { return callback(callbackData); });
        };
        Sitecore.PageModes.ChromeTypes.Placeholder.prototype.insertRendering = function (frameLoadedCallback) {
            originalLoad.call(this, frameLoadedCallback);
            onAfterFrameLoadedCallback(frameLoadedCallback);
        };
        this.isAfterFrameLoadedOverriden = true;
    };
    SitecoreExperienceEditor.prototype.tryOverrideOnUnloadingChrome = function () {
        if (!this.isBeforeUnloadingChromeOverriden && typeof Sitecore !== 'undefined') {
            this.overrideSitecoreChromeChangeCondition();
            this.isBeforeUnloadingChromeOverriden = true;
        }
    };
    SitecoreExperienceEditor.prototype.overrideSitecoreChromeChangeCondition = function () {
        var _this = this;
        var originalChangeCondition = Sitecore.PageModes.ChromeTypes.Rendering.prototype.changeCondition;
        var onBeforeChangeCondition = function (changedElement) {
            _this.onBeforeUnloadingChrome.forEach(function (callback) { return callback(changedElement); });
        };
        Sitecore.PageModes.ChromeTypes.Rendering.prototype.changeCondition = function (id, sender, preserveCacheUpdating) {
            onBeforeChangeCondition(this.chrome.element[0]);
            originalChangeCondition.apply(this, arguments);
        };
    };
    SitecoreExperienceEditor.prototype.tryOverrideSitecoreChromeTypesRenderingChangeCondition = function () {
        if (!this.isAfterPersonalizationChangedOverriden && typeof Sitecore !== 'undefined') {
            this.overrideSitecoreChromeTypesRenderingChangeCondition();
        }
    };
    SitecoreExperienceEditor.prototype.overrideSitecoreChromeTypesRenderingChangeCondition = function () {
        var _this = this;
        var originalStartActivation = Sitecore.PageModes.ChromeTypes.Rendering.prototype._startActivation;
        var originalEndActivation = Sitecore.PageModes.ChromeTypes.Rendering.prototype._endActivation;
        var elementToProcessWhenFinished;
        var onAfterPersonalizationChanged = function (changedElement) {
            _this.onAfterPersonalizationChanged.forEach(function (callback) { return callback(changedElement); });
        };
        var getValidMarker = function (markersAndElements) {
            return _this.isDifferentFirstLoadMarker(markersAndElements) ? markersAndElements[2] : markersAndElements[1];
        };
        Sitecore.PageModes.ChromeTypes.Rendering.prototype._startActivation = function (markersAndElements, fieldId) {
            elementToProcessWhenFinished = getValidMarker(markersAndElements);
            originalStartActivation.apply(this, arguments);
        };
        Sitecore.PageModes.ChromeTypes.Rendering.prototype._endActivation = function (reason) {
            originalEndActivation.apply(this, arguments);
            if (elementToProcessWhenFinished) {
                onAfterPersonalizationChanged(elementToProcessWhenFinished);
            }
        };
        this.isAfterPersonalizationChangedOverriden = true;
    };
    // In Sitecore 8.0, for some reason, there are two additionnal text nodes *only on the first load*.
    // The cached version does not have those.
    SitecoreExperienceEditor.prototype.isDifferentFirstLoadMarker = function (markersAndElements) {
        return markersAndElements[1].nodeType === Node.TEXT_NODE;
    };
    SitecoreExperienceEditor.prototype.registerShowDebugInformationCallback = function () {
        if (!window['scCoveoShowDebugInformation']) {
            window['scCoveoShowDebugInformation'] = function (debugModeEnabled) {
                var debugInfoElements = (0, HTMLUtils_1.nodeListToArray)(document.getElementsByClassName('coveo-debug-information'));
                if (debugModeEnabled) {
                    debugInfoElements.forEach(function (element) { return element.classList.remove('coveo-debug-hidden'); });
                }
                else {
                    debugInfoElements.forEach(function (element) { return element.classList.add('coveo-debug-hidden'); });
                }
                // Chromes are not updated correctly until an event refreshes them. This forces the update.
                Sitecore.PageModes.ChromeManager.resetChromes();
            };
        }
    };
    SitecoreExperienceEditor.isInBackgroundRenderingParameterName = 'sc_phk';
    return SitecoreExperienceEditor;
}());
var staticInstance = new SitecoreExperienceEditor();
function getExperienceEditorInstance() {
    return staticInstance;
}
exports.getExperienceEditorInstance = getExperienceEditorInstance;


/***/ }),

/***/ "./src/events/ContextEvents.ts":
/*!*************************************!*\
  !*** ./src/events/ContextEvents.ts ***!
  \*************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.SitecoreContextEvents = void 0;
var SitecoreContextEvents = exports.SitecoreContextEvents = /** @class */ (function () {
    function SitecoreContextEvents() {
    }
    SitecoreContextEvents.onSitecoreContextInitialization = 'onSitecoreContextInitialization';
    return SitecoreContextEvents;
}());


/***/ }),

/***/ "./src/events/ExpressionEvents.ts":
/*!****************************************!*\
  !*** ./src/events/ExpressionEvents.ts ***!
  \****************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.SitecoreExpressionEvents = void 0;
var SitecoreExpressionEvents = exports.SitecoreExpressionEvents = /** @class */ (function () {
    function SitecoreExpressionEvents() {
    }
    SitecoreExpressionEvents.onBuildingSitecoreExternalContent = 'onBuildingSitecoreExternalContent';
    SitecoreExpressionEvents.onBuildingLocalSitecoreInstanceExpression = 'onBuildingLocalSitecoreInstanceExpression';
    return SitecoreExpressionEvents;
}());


/***/ }),

/***/ "./src/handlers/CoveoFieldsHandler.ts":
/*!********************************************!*\
  !*** ./src/handlers/CoveoFieldsHandler.ts ***!
  \********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.CoveoFieldsHandler = void 0;
var LegacyFieldTypeResolver_1 = __webpack_require__(/*! ./LegacyFieldTypeResolver */ "./src/handlers/LegacyFieldTypeResolver.ts");
var CoveoFieldsHandler = exports.CoveoFieldsHandler = /** @class */ (function () {
    function CoveoFieldsHandler(resolver, prefix, suffix) {
        this.prefix = prefix;
        this.suffix = suffix;
        if (resolver.shouldDecorate !== undefined) {
            this.resolver = resolver;
        }
        else {
            // Handle legacy constructor case.
            this.resolver = new LegacyFieldTypeResolver_1.LegacyFieldTypeResolver(resolver);
        }
    }
    CoveoFieldsHandler.prototype.toCoveo = function (fieldName) {
        if (!this.isValidFieldName(fieldName)) {
            console.error("Could not translate the '".concat(fieldName, "' field to a Coveo field. Returning as is."));
            return fieldName;
        }
        var lowerCaseFieldName = fieldName.toLowerCase();
        var fieldWithoutDelimiter = this.stripCoveoFieldDelimiter(lowerCaseFieldName);
        if (CoveoFieldsHandler.escapedCharacterRegex.test(fieldWithoutDelimiter)) {
            console.warn("Field name ".concat(fieldName, " contains the z\\d{2,3}x pattern. Ensure you avoid using this pattern in field names."));
            console.trace();
        }
        var translatedFieldWithoutDelimiter = this.translateFieldName(fieldWithoutDelimiter);
        return this.startsWithAt(fieldName)
            ? this.addCoveoFieldDelimiter(translatedFieldWithoutDelimiter)
            : translatedFieldWithoutDelimiter;
    };
    CoveoFieldsHandler.prototype.addCoveoFieldDelimiter = function (fieldName) {
        var fieldNameWithDelimiter = fieldName;
        if (!this.startsWithAt(fieldName)) {
            fieldNameWithDelimiter = "".concat(CoveoFieldsHandler.coveoFieldDelimiter).concat(fieldName).toLowerCase();
        }
        return fieldNameWithDelimiter;
    };
    CoveoFieldsHandler.prototype.isCoveoFieldName = function (fieldName) {
        var strippedFieldName = this.stripCoveoFieldDelimiter(fieldName);
        return this.resolver.isExternalField(strippedFieldName) || this.isDecorated(strippedFieldName);
    };
    CoveoFieldsHandler.prototype.isDecorated = function (fieldName) {
        var regexString = this.prefix + '[\\w]+' + this.suffix;
        var coveoFieldNameRegex = new RegExp(regexString);
        return coveoFieldNameRegex.test(fieldName);
    };
    CoveoFieldsHandler.prototype.isValidFieldName = function (fieldName) {
        return fieldName && fieldName !== CoveoFieldsHandler.coveoFieldDelimiter;
    };
    CoveoFieldsHandler.prototype.startsWithAt = function (fieldName) {
        return fieldName[0] === CoveoFieldsHandler.coveoFieldDelimiter;
    };
    CoveoFieldsHandler.prototype.stripCoveoFieldDelimiter = function (fieldName) {
        var field = fieldName;
        if (this.startsWithAt(fieldName)) {
            field = field.substr(1);
        }
        return field;
    };
    CoveoFieldsHandler.prototype.translateFieldName = function (fieldName) {
        var field = fieldName;
        if (this.resolver.shouldEscapeSpecialCharacters(fieldName) && !this.isFieldAlreadyTranslated(fieldName)) {
            field = this.replaceSpecialCharacters(field);
        }
        if (this.resolver.shouldDecorate(fieldName)) {
            field = this.prefix + field + this.suffix;
        }
        if (this.resolver.shouldEscapeFirstCharacter(field)) {
            field = this.replaceFirstCharacter(field);
        }
        return field;
    };
    // This check was added to avoid fields from being double translated. See SC-4266.
    CoveoFieldsHandler.prototype.isFieldAlreadyTranslated = function (fieldName) {
        return (CoveoFieldsHandler.fieldNameRegex.test(fieldName) &&
            CoveoFieldsHandler.escapedCharacterRegex.test(fieldName));
    };
    CoveoFieldsHandler.prototype.replaceFirstCharacter = function (fieldName) {
        var characters = fieldName.split('');
        var firstCharacter = characters.shift();
        characters.unshift(this.escapeSpecialCharacter(firstCharacter));
        return characters.join('');
    };
    CoveoFieldsHandler.prototype.replaceSpecialCharacters = function (fieldName) {
        return fieldName.split('').map(this.replaceSpecialCharacter.bind(this)).join('');
    };
    CoveoFieldsHandler.prototype.replaceSpecialCharacter = function (character) {
        if (character.match(CoveoFieldsHandler.nonSpecialCharacters)) {
            return character;
        }
        else {
            return this.escapeSpecialCharacter(character);
        }
    };
    CoveoFieldsHandler.prototype.escapeSpecialCharacter = function (character) {
        return "z".concat(character.charCodeAt(0), "x");
    };
    // 'z' and 'x' are also considered as special characters because
    // they are used in the escaping logic. So we have to remove them
    // from the regular expression pattern.
    CoveoFieldsHandler.nonSpecialCharactersString = '[a-wyA-WY0-9]';
    CoveoFieldsHandler.nonSpecialCharacters = new RegExp(CoveoFieldsHandler.nonSpecialCharactersString);
    CoveoFieldsHandler.coveoFieldDelimiter = '@';
    CoveoFieldsHandler.fieldNameRegex = new RegExp('^[^\\W_]*$');
    CoveoFieldsHandler.escapedCharacterRegex = new RegExp('z\\d{2,3}x');
    return CoveoFieldsHandler;
}());


/***/ }),

/***/ "./src/handlers/CoveoLabelsHandler.ts":
/*!********************************************!*\
  !*** ./src/handlers/CoveoLabelsHandler.ts ***!
  \********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.CoveoLabelsHandler = void 0;
var CoveoLabelsHandler = /** @class */ (function () {
    function CoveoLabelsHandler(labels) {
        this.labels = labels;
    }
    CoveoLabelsHandler.prototype.translate = function (key) {
        return this.labels[key] || key;
    };
    return CoveoLabelsHandler;
}());
exports.CoveoLabelsHandler = CoveoLabelsHandler;


/***/ }),

/***/ "./src/handlers/LegacyFieldTypeResolver.ts":
/*!*************************************************!*\
  !*** ./src/handlers/LegacyFieldTypeResolver.ts ***!
  \*************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.LegacyFieldTypeResolver = void 0;
var LegacyFieldTypeResolver = /** @class */ (function () {
    function LegacyFieldTypeResolver(externalFields) {
        this.externalFields = this.parseExternalFields(externalFields);
    }
    LegacyFieldTypeResolver.prototype.parseExternalFields = function (externalFields) {
        var _this = this;
        return externalFields.map(function (externalField) {
            if (typeof externalField === 'string') {
                return {
                    fieldName: externalField.toLowerCase(),
                    shouldEscape: false,
                };
            }
            else if (_this.isExternalFieldConfig(externalField)) {
                return {
                    fieldName: externalField.fieldName.toLowerCase(),
                    shouldEscape: externalField.shouldEscape,
                };
            }
            else {
                console.error("Invalid external field '".concat(externalField, "'."));
            }
        });
    };
    LegacyFieldTypeResolver.prototype.shouldEscapeFirstCharacter = function (fieldName) {
        return false;
    };
    LegacyFieldTypeResolver.prototype.shouldEscapeSpecialCharacters = function (fieldName) {
        var fields = this.externalFields.filter(function (field) { return field.fieldName.toLowerCase() === fieldName.toLowerCase(); });
        return fields.length > 0 ? fields[0].shouldEscape : true;
    };
    LegacyFieldTypeResolver.prototype.shouldDecorate = function (fieldName) {
        return !this.externalFields.some(function (field) { return field.fieldName.toLowerCase() === fieldName.toLowerCase(); });
    };
    LegacyFieldTypeResolver.prototype.isExternalField = function (fieldName) {
        return this.externalFields.some(function (field) { return field.fieldName.toLowerCase() === fieldName.toLowerCase(); });
    };
    LegacyFieldTypeResolver.prototype.isExternalFieldConfig = function (obj) {
        return (typeof obj !== 'undefined' &&
            typeof obj.fieldName !== 'undefined' &&
            typeof obj.shouldEscape !== 'undefined');
    };
    return LegacyFieldTypeResolver;
}());
exports.LegacyFieldTypeResolver = LegacyFieldTypeResolver;


/***/ }),

/***/ "./src/handlers/SourceSpecificFieldResolver.ts":
/*!*****************************************************!*\
  !*** ./src/handlers/SourceSpecificFieldResolver.ts ***!
  \*****************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.SourceSpecificFieldResolver = void 0;
var SourceSpecificFieldResolver = exports.SourceSpecificFieldResolver = /** @class */ (function () {
    function SourceSpecificFieldResolver(sourceSpecificFields, externalFields) {
        this.sourceSpecificFields = sourceSpecificFields;
        this.externalFields = externalFields;
    }
    SourceSpecificFieldResolver.prototype.shouldEscapeFirstCharacter = function (fieldName) {
        return !fieldName[0].match(SourceSpecificFieldResolver.validFirstCharacters);
    };
    SourceSpecificFieldResolver.prototype.shouldEscapeSpecialCharacters = function (fieldName) {
        return !this.externalFields.some(function (field) { return field.fieldName.toLowerCase() === fieldName.toLowerCase(); });
    };
    SourceSpecificFieldResolver.prototype.shouldDecorate = function (fieldName) {
        return this.sourceSpecificFields.some(function (field) { return field.fieldName.toLowerCase() === fieldName.toLowerCase(); });
    };
    SourceSpecificFieldResolver.prototype.isExternalField = function (fieldName) {
        return this.externalFields.some(function (field) { return field.fieldName.toLowerCase() === fieldName.toLowerCase(); });
    };
    SourceSpecificFieldResolver.validFirstCharacters = new RegExp('[a-zA-Z_]');
    return SourceSpecificFieldResolver;
}());


/***/ }),

/***/ "./src/resolvers/components/SearchInterfaceComponentInitializer.ts":
/*!*************************************************************************!*\
  !*** ./src/resolvers/components/SearchInterfaceComponentInitializer.ts ***!
  \*************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.getInitializerInstance = exports.SearchInterfaceComponentInitializer = void 0;
var Prebinding_1 = __webpack_require__(/*! ../../base/Prebinding */ "./src/base/Prebinding.ts");
var HTMLUtils_1 = __webpack_require__(/*! ../../utils/HTMLUtils */ "./src/utils/HTMLUtils.ts");
var coveo_search_ui_1 = __webpack_require__(/*! coveo-search-ui */ "coveo-search-ui");
var duringInitializationClass = 'coveo-during-initialization';
var SearchInterfaceComponentInitializer = /** @class */ (function () {
    function SearchInterfaceComponentInitializer() {
    }
    SearchInterfaceComponentInitializer.prototype.loadComponentsForSearchInterface = function (searchInterface, newComponent) {
        var _this = this;
        Prebinding_1.Prebinding.applyPrebindingOnElement(newComponent);
        Prebinding_1.Prebinding.applyPrebindingOnChildren(newComponent);
        var result = coveo_search_ui_1.Initialization.automaticallyCreateComponentsInside(newComponent, {
            bindings: searchInterface.getBindings(),
            options: {},
        });
        return result.initResult.then(function () {
            _this.removeAllPlaceholdersWithinElement(newComponent);
            searchInterface.queryController.executeQuery({
                ignoreWarningSearchEvent: true,
            });
        });
    };
    SearchInterfaceComponentInitializer.prototype.tryUnloadComponentsForSearchInterface = function (searchInterface, newComponent) {
        var _this = this;
        var facets = (0, HTMLUtils_1.nodeListToArray)(newComponent.getElementsByClassName('CoveoFacet'));
        facets.forEach(function (facet) {
            var facetComponent = (0, coveo_search_ui_1.get)(facet, 'CoveoFacet');
            if (facetComponent) {
                searchInterface.detachComponent('Facet', facetComponent);
            }
            _this.removeAllChildren(facet);
        });
        var tabs = (0, HTMLUtils_1.nodeListToArray)(newComponent.getElementsByClassName('CoveoTab'));
        tabs.forEach(function (tab) {
            var tabComponent = (0, coveo_search_ui_1.get)(tab, 'CoveoTab');
            if (tabComponent) {
                searchInterface.detachComponent('Tab', tabComponent);
            }
            _this.removeAllChildren(tab);
        });
    };
    SearchInterfaceComponentInitializer.prototype.removeAllPlaceholdersWithinElement = function (element) {
        var _this = this;
        var elementsWithInitializationClass = (0, HTMLUtils_1.nodeListToArray)(element.getElementsByClassName(duringInitializationClass));
        elementsWithInitializationClass.forEach(function (element) { return _this.removePlaceholders(element); });
    };
    SearchInterfaceComponentInitializer.prototype.removePlaceholders = function (element) {
        element.classList.remove(duringInitializationClass);
        if (element.classList.contains('CoveoFacet')) {
            this.removeFacetsPlaceholders(element);
        }
    };
    SearchInterfaceComponentInitializer.prototype.removeFacetsPlaceholders = function (element) {
        element.classList.remove('coveo-with-placeholder');
        // Since a Facet reinserts DOM as children when initializing, we have to remove all its children,
        // else new content will be appended each time the facet is initialized.
        this.removeAllChildren(element);
    };
    SearchInterfaceComponentInitializer.prototype.removeAllChildren = function (element) {
        while (element.firstChild) {
            element.removeChild(element.firstChild);
        }
    };
    SearchInterfaceComponentInitializer.prototype.loadComponentsWithSearchInterfaceInitialization = function (searchInterfaceElement, componentsContainer) {
        Prebinding_1.Prebinding.applyPrebindingOnElement(componentsContainer);
        Prebinding_1.Prebinding.applyPrebindingOnChildren(componentsContainer);
        Coveo.options(searchInterfaceElement, {
            externalComponents: [componentsContainer],
        });
    };
    return SearchInterfaceComponentInitializer;
}());
exports.SearchInterfaceComponentInitializer = SearchInterfaceComponentInitializer;
var initializer = new SearchInterfaceComponentInitializer();
function getInitializerInstance() {
    return initializer;
}
exports.getInitializerInstance = getInitializerInstance;


/***/ }),

/***/ "./src/resolvers/nodes/QueryFilterNodeExpressionResolver.ts":
/*!******************************************************************!*\
  !*** ./src/resolvers/nodes/QueryFilterNodeExpressionResolver.ts ***!
  \******************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.QueryFilterNodeExpressionResolverFactory = exports.QueryFilterNodeExpressionResolver = void 0;
var QueryNodeTreeParserFactory_1 = __webpack_require__(/*! ./queryNodes/QueryNodeTreeParserFactory */ "./src/resolvers/nodes/queryNodes/QueryNodeTreeParserFactory.ts");
var coveo_search_ui_1 = __webpack_require__(/*! coveo-search-ui */ "coveo-search-ui");
var QueryFilterNodeExpressionResolver = /** @class */ (function () {
    function QueryFilterNodeExpressionResolver(parser) {
        this.parser = parser;
    }
    QueryFilterNodeExpressionResolver.prototype.parseQueryFilterNode = function (queryFilterNode) {
        coveo_search_ui_1.Assert.isNotNull(queryFilterNode);
        var queryBuilder = new coveo_search_ui_1.QueryBuilder();
        queryBuilder.advancedExpression.add(this.parser.parse(queryFilterNode.advanced));
        return queryBuilder;
    };
    return QueryFilterNodeExpressionResolver;
}());
exports.QueryFilterNodeExpressionResolver = QueryFilterNodeExpressionResolver;
var QueryFilterNodeExpressionResolverFactory = /** @class */ (function () {
    function QueryFilterNodeExpressionResolverFactory() {
    }
    QueryFilterNodeExpressionResolverFactory.prototype.createQueryFilterNodeExpression = function (logger) {
        var parserFactory = new QueryNodeTreeParserFactory_1.QueryNodeTreeParserFactory();
        var parser = parserFactory.createParser(logger);
        return new QueryFilterNodeExpressionResolver(parser);
    };
    return QueryFilterNodeExpressionResolverFactory;
}());
exports.QueryFilterNodeExpressionResolverFactory = QueryFilterNodeExpressionResolverFactory;


/***/ }),

/***/ "./src/resolvers/nodes/QueryRankingNodeExpressionResolver.ts":
/*!*******************************************************************!*\
  !*** ./src/resolvers/nodes/QueryRankingNodeExpressionResolver.ts ***!
  \*******************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.QueryRankingNodeExpressionResolverFactory = exports.QueryRankingNodeExpressionResolver = void 0;
var QueryNodeTreeParserFactory_1 = __webpack_require__(/*! ./queryNodes/QueryNodeTreeParserFactory */ "./src/resolvers/nodes/queryNodes/QueryNodeTreeParserFactory.ts");
var Context_1 = __webpack_require__(/*! ../../base/Context */ "./src/base/Context.ts");
var coveo_search_ui_1 = __webpack_require__(/*! coveo-search-ui */ "coveo-search-ui");
/*
    Matches "@[x]"" and return x as matching group.
    Examples:
        * @[blublu] gives "blublu".
        * @[[blublu]] gives "[blublu]"
        * @[blublu]] gives "blublu]"
*/
var rankingExpressionFieldsRegex = /@\[(.*?\]*)\]/g;
var QueryRankingNodeExpressionResolver = /** @class */ (function () {
    function QueryRankingNodeExpressionResolver(parser, fieldsHandler) {
        this.parser = parser;
        this.fieldsHandler = fieldsHandler;
    }
    QueryRankingNodeExpressionResolver.prototype.parseQueryRankingNode = function (queryRankingNode) {
        var _this = this;
        var queryBuilder = new coveo_search_ui_1.QueryBuilder();
        queryRankingNode.rankingExpressions.map(function (ranking) {
            var parsedExpression = _this.parser.parse(ranking.expression);
            if (parsedExpression !== '') {
                queryBuilder.advancedExpression.add("$qre(expression:'".concat(parsedExpression, "', modifier:").concat(ranking.modifier, ")"));
            }
        });
        queryRankingNode.rankingFunctions.forEach(function (rankingFunction) {
            rankingFunction.expression = _this.translateRankingExpressionFieldNames(rankingFunction.expression);
            queryBuilder.rankingFunctions.push(rankingFunction);
        });
        queryRankingNode.textualRankingExpressions
            .filter(function (rankingExpression) { return rankingExpression.expression !== ''; })
            .forEach(function (rankingExpression) {
            queryBuilder.advancedExpression.add(rankingExpression.expression);
        });
        return queryBuilder;
    };
    QueryRankingNodeExpressionResolver.prototype.translateRankingExpressionFieldNames = function (expression) {
        var _this = this;
        expression.replace(rankingExpressionFieldsRegex, function (matchingExpression, matchingGroup) {
            return _this.fieldsHandler.toCoveo(matchingGroup);
        });
        return expression;
    };
    return QueryRankingNodeExpressionResolver;
}());
exports.QueryRankingNodeExpressionResolver = QueryRankingNodeExpressionResolver;
var QueryRankingNodeExpressionResolverFactory = /** @class */ (function () {
    function QueryRankingNodeExpressionResolverFactory() {
    }
    QueryRankingNodeExpressionResolverFactory.prototype.createQueryFilterNodeExpression = function (logger) {
        var parserFactory = new QueryNodeTreeParserFactory_1.QueryNodeTreeParserFactory();
        var parser = parserFactory.createParser(logger);
        return new QueryRankingNodeExpressionResolver(parser, Context_1.Context.fields);
    };
    return QueryRankingNodeExpressionResolverFactory;
}());
exports.QueryRankingNodeExpressionResolverFactory = QueryRankingNodeExpressionResolverFactory;


/***/ }),

/***/ "./src/resolvers/nodes/queryNodes/QueryNodeTreeParser.ts":
/*!***************************************************************!*\
  !*** ./src/resolvers/nodes/queryNodes/QueryNodeTreeParser.ts ***!
  \***************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.QueryNodeTreeParser = void 0;
var QueryNodeTreeParser = /** @class */ (function () {
    function QueryNodeTreeParser(logger) {
        this.logger = logger;
        this.parsers = {};
    }
    QueryNodeTreeParser.prototype.registerParser = function (queryNodeParser) {
        this.parsers[queryNodeParser.type] = function (node) { return queryNodeParser.parse(node); };
    };
    QueryNodeTreeParser.prototype.parse = function (node) {
        try {
            return this.parsers[node.type](node);
        }
        catch (exception) {
            this.logger.error('Error when parsing a query node:', node, exception);
            return '';
        }
    };
    return QueryNodeTreeParser;
}());
exports.QueryNodeTreeParser = QueryNodeTreeParser;


/***/ }),

/***/ "./src/resolvers/nodes/queryNodes/QueryNodeTreeParserFactory.ts":
/*!**********************************************************************!*\
  !*** ./src/resolvers/nodes/queryNodes/QueryNodeTreeParserFactory.ts ***!
  \**********************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.QueryNodeTreeParserFactory = void 0;
var AndNodeParser_1 = __webpack_require__(/*! ./parsers/AndNodeParser */ "./src/resolvers/nodes/queryNodes/parsers/AndNodeParser.ts");
var FalseNodeParser_1 = __webpack_require__(/*! ./parsers/FalseNodeParser */ "./src/resolvers/nodes/queryNodes/parsers/FalseNodeParser.ts");
var FieldNodeParser_1 = __webpack_require__(/*! ./parsers/FieldNodeParser */ "./src/resolvers/nodes/queryNodes/parsers/FieldNodeParser.ts");
var NotNodeParser_1 = __webpack_require__(/*! ./parsers/NotNodeParser */ "./src/resolvers/nodes/queryNodes/parsers/NotNodeParser.ts");
var OrNodeParser_1 = __webpack_require__(/*! ./parsers/OrNodeParser */ "./src/resolvers/nodes/queryNodes/parsers/OrNodeParser.ts");
var TrueNodeParser_1 = __webpack_require__(/*! ./parsers/TrueNodeParser */ "./src/resolvers/nodes/queryNodes/parsers/TrueNodeParser.ts");
var QueryNodeTreeParser_1 = __webpack_require__(/*! ./QueryNodeTreeParser */ "./src/resolvers/nodes/queryNodes/QueryNodeTreeParser.ts");
var Context_1 = __webpack_require__(/*! ../../../base/Context */ "./src/base/Context.ts");
var QueryNodeTreeParserFactory = /** @class */ (function () {
    function QueryNodeTreeParserFactory() {
    }
    QueryNodeTreeParserFactory.prototype.createParser = function (logger) {
        var parser = new QueryNodeTreeParser_1.QueryNodeTreeParser(logger);
        parser.registerParser(new AndNodeParser_1.AndNodeParser(parser));
        parser.registerParser(new FalseNodeParser_1.FalseNodeParser());
        parser.registerParser(new FieldNodeParser_1.FieldNodeParser(Context_1.Context.fields));
        parser.registerParser(new NotNodeParser_1.NotNodeParser(parser));
        parser.registerParser(new OrNodeParser_1.OrNodeParser(parser));
        parser.registerParser(new TrueNodeParser_1.TrueNodeParser());
        return parser;
    };
    return QueryNodeTreeParserFactory;
}());
exports.QueryNodeTreeParserFactory = QueryNodeTreeParserFactory;


/***/ }),

/***/ "./src/resolvers/nodes/queryNodes/parsers/AndNodeParser.ts":
/*!*****************************************************************!*\
  !*** ./src/resolvers/nodes/queryNodes/parsers/AndNodeParser.ts ***!
  \*****************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.AndNodeParser = void 0;
var AndNodeParser = /** @class */ (function () {
    function AndNodeParser(nodeParser) {
        this.nodeParser = nodeParser;
        this.type = 'and';
    }
    AndNodeParser.prototype.parse = function (node) {
        return "(".concat(this.nodeParser.parse(node.left), " ").concat(this.nodeParser.parse(node.right), ")");
    };
    return AndNodeParser;
}());
exports.AndNodeParser = AndNodeParser;


/***/ }),

/***/ "./src/resolvers/nodes/queryNodes/parsers/FalseNodeParser.ts":
/*!*******************************************************************!*\
  !*** ./src/resolvers/nodes/queryNodes/parsers/FalseNodeParser.ts ***!
  \*******************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.FalseNodeParser = void 0;
var FalseNodeParser = /** @class */ (function () {
    function FalseNodeParser() {
        this.type = 'false';
    }
    FalseNodeParser.prototype.parse = function (node) {
        return "(NOT @uri)";
    };
    return FalseNodeParser;
}());
exports.FalseNodeParser = FalseNodeParser;


/***/ }),

/***/ "./src/resolvers/nodes/queryNodes/parsers/FieldNodeParser.ts":
/*!*******************************************************************!*\
  !*** ./src/resolvers/nodes/queryNodes/parsers/FieldNodeParser.ts ***!
  \*******************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.FieldNodeParser = void 0;
var coveo_search_ui_1 = __webpack_require__(/*! coveo-search-ui */ "coveo-search-ui");
var dateformat = __webpack_require__(/*! dateformat */ "./node_modules/dateformat/lib/dateformat.js");
var FieldNodeParser = /** @class */ (function () {
    function FieldNodeParser(fieldHandler) {
        this.fieldHandler = fieldHandler;
        this.indexDateFormat = 'yyyy/mm/dd@HH:MM:ss';
        this.type = 'field';
    }
    FieldNodeParser.prototype.parse = function (node) {
        if (node.fieldValueType.name === 'string') {
            return this.parseString(this.fieldHandler.toCoveo("@".concat(node.fieldName)), node.operator.name, node.fieldValues);
        }
        else {
            return coveo_search_ui_1.QueryUtils.buildFieldExpression(this.fieldHandler.toCoveo("@".concat(node.fieldName)), node.operator.name, this.parseFieldValuesFromType(node.fieldValueType.name, node.fieldValues));
        }
    };
    FieldNodeParser.prototype.parseFieldValuesFromType = function (type, values) {
        var _this = this;
        switch (type) {
            case 'boolean':
                return values.map(function (value) { return _this.parseBoolean(value); });
            case 'date':
                return values.map(function (value) { return _this.parseDate(value); });
            case 'number':
                return values.map(function (value) { return _this.parseNumber(value); });
            default:
                return values;
        }
    };
    FieldNodeParser.prototype.parseBoolean = function (value) {
        return !!value ? '1' : '0';
    };
    FieldNodeParser.prototype.parseDate = function (value) {
        var date = new Date(parseInt(value.replace('/Date(', '')));
        return dateformat(date, this.indexDateFormat);
    };
    FieldNodeParser.prototype.parseNumber = function (value) {
        return value.toString();
    };
    FieldNodeParser.prototype.parseString = function (fieldName, operator, values) {
        if (values.some(function (value) { return value !== ''; })) {
            return coveo_search_ui_1.QueryUtils.buildFieldExpression("".concat(fieldName), operator, values.filter(function (value) { return value !== ''; }));
        }
        else {
            return this.parseEmptyField(fieldName, operator);
        }
    };
    FieldNodeParser.prototype.parseEmptyField = function (fieldName, operator) {
        switch (operator) {
            case '=':
            case '==':
                return fieldName;
            case '!=':
            case '<>':
                return "(NOT ".concat(fieldName, ")");
            default:
                throw "Operator \"".concat(operator, "\" for field \"").concat(fieldName, "\" requires a non-empty value.");
        }
    };
    return FieldNodeParser;
}());
exports.FieldNodeParser = FieldNodeParser;


/***/ }),

/***/ "./src/resolvers/nodes/queryNodes/parsers/NotNodeParser.ts":
/*!*****************************************************************!*\
  !*** ./src/resolvers/nodes/queryNodes/parsers/NotNodeParser.ts ***!
  \*****************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.NotNodeParser = void 0;
var NotNodeParser = /** @class */ (function () {
    function NotNodeParser(nodeParser) {
        this.nodeParser = nodeParser;
        this.type = 'not';
    }
    NotNodeParser.prototype.parse = function (node) {
        return "NOT ".concat(this.nodeParser.parse(node.operand));
    };
    return NotNodeParser;
}());
exports.NotNodeParser = NotNodeParser;


/***/ }),

/***/ "./src/resolvers/nodes/queryNodes/parsers/OrNodeParser.ts":
/*!****************************************************************!*\
  !*** ./src/resolvers/nodes/queryNodes/parsers/OrNodeParser.ts ***!
  \****************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.OrNodeParser = void 0;
var OrNodeParser = /** @class */ (function () {
    function OrNodeParser(nodeParser) {
        this.nodeParser = nodeParser;
        this.type = 'or';
    }
    OrNodeParser.prototype.parse = function (node) {
        return "(".concat(this.nodeParser.parse(node.left), " OR ").concat(this.nodeParser.parse(node.right), ")");
    };
    return OrNodeParser;
}());
exports.OrNodeParser = OrNodeParser;


/***/ }),

/***/ "./src/resolvers/nodes/queryNodes/parsers/TrueNodeParser.ts":
/*!******************************************************************!*\
  !*** ./src/resolvers/nodes/queryNodes/parsers/TrueNodeParser.ts ***!
  \******************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.TrueNodeParser = void 0;
var TrueNodeParser = /** @class */ (function () {
    function TrueNodeParser() {
        this.type = 'true';
    }
    TrueNodeParser.prototype.parse = function (node) {
        return '@uri';
    };
    return TrueNodeParser;
}());
exports.TrueNodeParser = TrueNodeParser;


/***/ }),

/***/ "./src/resolvers/prebinding/PrebindHelpers.ts":
/*!****************************************************!*\
  !*** ./src/resolvers/prebinding/PrebindHelpers.ts ***!
  \****************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.PrebindHelpers = void 0;
var AnalyticsEnabled_1 = __webpack_require__(/*! ./prebindHelpers/AnalyticsEnabled */ "./src/resolvers/prebinding/prebindHelpers/AnalyticsEnabled.ts");
var CoveoForSitecoreAnalyticsEndpoint_1 = __webpack_require__(/*! ./prebindHelpers/CoveoForSitecoreAnalyticsEndpoint */ "./src/resolvers/prebinding/prebindHelpers/CoveoForSitecoreAnalyticsEndpoint.ts");
var CurrentMaximumAge_1 = __webpack_require__(/*! ./prebindHelpers/CurrentMaximumAge */ "./src/resolvers/prebinding/prebindHelpers/CurrentMaximumAge.ts");
var CurrentPageName_1 = __webpack_require__(/*! ./prebindHelpers/CurrentPageName */ "./src/resolvers/prebinding/prebindHelpers/CurrentPageName.ts");
var FieldTranslator_1 = __webpack_require__(/*! ./prebindHelpers/FieldTranslator */ "./src/resolvers/prebinding/prebindHelpers/FieldTranslator.ts");
var IsAnonymous_1 = __webpack_require__(/*! ./prebindHelpers/IsAnonymous */ "./src/resolvers/prebinding/prebindHelpers/IsAnonymous.ts");
var MainSearchInterfaceSelector_1 = __webpack_require__(/*! ./prebindHelpers/MainSearchInterfaceSelector */ "./src/resolvers/prebinding/prebindHelpers/MainSearchInterfaceSelector.ts");
var ItemIdSelector_1 = __webpack_require__(/*! ./prebindHelpers/ItemIdSelector */ "./src/resolvers/prebinding/prebindHelpers/ItemIdSelector.ts");
var SortCriteria_1 = __webpack_require__(/*! ./prebindHelpers/SortCriteria */ "./src/resolvers/prebinding/prebindHelpers/SortCriteria.ts");
var UnfoldDictionaryToAttributes_1 = __webpack_require__(/*! ./prebindHelpers/UnfoldDictionaryToAttributes */ "./src/resolvers/prebinding/prebindHelpers/UnfoldDictionaryToAttributes.ts");
var PrebindHelpers = /** @class */ (function () {
    function PrebindHelpers() {
    }
    PrebindHelpers.getAllPrebindHelpers = function () {
        return [
            new AnalyticsEnabled_1.AnalyticsEnabledPrebind(),
            new CoveoForSitecoreAnalyticsEndpoint_1.CoveoForSitecoreAnalyticsEndpointPrebind(),
            new CurrentMaximumAge_1.CurrentMaximumAge(),
            new CurrentPageName_1.CurrentPageNamePrebind(),
            new FieldTranslator_1.FieldTranslatorPrebind(),
            new IsAnonymous_1.IsAnonymousPrebind(),
            new MainSearchInterfaceSelector_1.MainSearchInterfaceSelectorPrebind(),
            new ItemIdSelector_1.ItemIdSelectorPrebind(),
            new SortCriteria_1.SortCriteriaPrebind(),
            new UnfoldDictionaryToAttributes_1.UnfoldDictionaryToAttributesPrebind(),
        ];
    };
    return PrebindHelpers;
}());
exports.PrebindHelpers = PrebindHelpers;


/***/ }),

/***/ "./src/resolvers/prebinding/PrebindResolver.ts":
/*!*****************************************************!*\
  !*** ./src/resolvers/prebinding/PrebindResolver.ts ***!
  \*****************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.PrebindResolver = void 0;
var PrebindResolver = exports.PrebindResolver = /** @class */ (function () {
    function PrebindResolver() {
        this.prebindAppliedValue = 'appliedPrebind';
        this.helpers = {};
    }
    PrebindResolver.prototype.registerPrebindHelper = function (helperName, handler) {
        if (typeof helperName !== 'string' || helperName === '') {
            throw 'You must define a name for the prebind helper.';
        }
        if (typeof handler === 'undefined' || handler === null) {
            throw 'You must define a handler for the prebind helper.';
        }
        if (this.hasHelper(helperName)) {
            console.warn("A prebind handler already exists for '".concat(helperName, "'. It will be ignored"));
            return;
        }
        this.helpers[helperName] = handler;
    };
    PrebindResolver.prototype.hasHelper = function (helperName) {
        return this.helpers.hasOwnProperty(helperName);
    };
    PrebindResolver.prototype.getHelper = function (helperName) {
        if (!this.hasHelper(helperName)) {
            throw "'".concat(helperName, "' has no registered helper.");
        }
        return this.helpers[helperName];
    };
    PrebindResolver.prototype.canApplyPrebind = function (element) {
        return !!element.dataset;
    };
    PrebindResolver.prototype.hasNotAppliedPrebind = function (element) {
        return element.dataset[this.prebindAppliedValue] !== 'true';
    };
    PrebindResolver.prototype.applyToElement = function (element) {
        var _this = this;
        try {
            var attributes = this.getPrebindingAttributesForElement(element);
            if (attributes.length > 0) {
                element.dataset[this.prebindAppliedValue] = 'true';
            }
            attributes.forEach(function (attributes) { return _this.applyPrebindToElement(attributes, element); });
        }
        catch (exception) {
            console.warn('(CoveoForSitecore) prebinding failed on element.', element, exception);
        }
    };
    PrebindResolver.prototype.getPrebindingAttributesForElement = function (element) {
        var _this = this;
        return this.getAllPrebindingAttributesNames(element).map(function (key) {
            var methodName = element.dataset[key];
            var attribute = _this.lowerCaseFirstCharacter(_this.removePrebindPrefix(key));
            return {
                attribute: attribute,
                attributeValue: element.dataset[attribute] || '',
                method: _this.getHelper(methodName),
            };
        });
    };
    PrebindResolver.prototype.getAllPrebindingAttributesNames = function (element) {
        var _this = this;
        return Object.keys(element.dataset)
            .filter(function (key) { return _this.stringStartsWithPrebindingString(key); })
            .filter(function (key) {
            var helperName = element.dataset[key];
            return _this.filterAndWarnNonExistingHelperName(helperName, element);
        });
    };
    PrebindResolver.prototype.stringStartsWithPrebindingString = function (value) {
        return value.lastIndexOf(PrebindResolver.prebindString) === 0;
    };
    PrebindResolver.prototype.filterAndWarnNonExistingHelperName = function (helperName, element) {
        var hasHelperWithName = this.hasHelper(helperName);
        if (!hasHelperWithName) {
            console.warn("(CoveoForSitecore) an unregistered prebinding '".concat(helperName, "' was set on the element. Register this method using Prebinding.registerPrebindHelper(\"").concat(helperName, "\", handler)."), element);
        }
        return hasHelperWithName;
    };
    PrebindResolver.prototype.removePrebindPrefix = function (attributeName) {
        return attributeName.substring(PrebindResolver.prebindString.length);
    };
    PrebindResolver.prototype.lowerCaseFirstCharacter = function (value) {
        return value.charAt(0).toLowerCase() + value.slice(1);
    };
    PrebindResolver.prototype.applyPrebindToElement = function (prebind, element) {
        element.dataset[prebind.attribute] = prebind.method(prebind.attributeValue, element);
    };
    PrebindResolver.prebindString = 'prebind';
    return PrebindResolver;
}());


/***/ }),

/***/ "./src/resolvers/prebinding/prebindHelpers/AnalyticsEnabled.ts":
/*!*********************************************************************!*\
  !*** ./src/resolvers/prebinding/prebindHelpers/AnalyticsEnabled.ts ***!
  \*********************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.AnalyticsEnabledPrebind = void 0;
var AnalyticsEnabledPrebind = /** @class */ (function () {
    function AnalyticsEnabledPrebind() {
        this.name = 'analyticsEnabled';
    }
    AnalyticsEnabledPrebind.prototype.getPrebind = function (args) {
        return function (currentValue, element) {
            return args.context.scAnalyticsEnabled ? 'true' : 'false';
        };
    };
    return AnalyticsEnabledPrebind;
}());
exports.AnalyticsEnabledPrebind = AnalyticsEnabledPrebind;


/***/ }),

/***/ "./src/resolvers/prebinding/prebindHelpers/CoveoForSitecoreAnalyticsEndpoint.ts":
/*!**************************************************************************************!*\
  !*** ./src/resolvers/prebinding/prebindHelpers/CoveoForSitecoreAnalyticsEndpoint.ts ***!
  \**************************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.CoveoForSitecoreAnalyticsEndpointPrebind = void 0;
var CoveoForSitecoreAnalyticsEndpointPrebind = /** @class */ (function () {
    function CoveoForSitecoreAnalyticsEndpointPrebind() {
        this.name = 'coveoForSitecoreAnalyticsEndpoint';
    }
    CoveoForSitecoreAnalyticsEndpointPrebind.prototype.getPrebind = function (args) {
        return function (currentValue, element) {
            return currentValue || "".concat(args.context.scAnalyticsEndpointUri);
        };
    };
    return CoveoForSitecoreAnalyticsEndpointPrebind;
}());
exports.CoveoForSitecoreAnalyticsEndpointPrebind = CoveoForSitecoreAnalyticsEndpointPrebind;


/***/ }),

/***/ "./src/resolvers/prebinding/prebindHelpers/CurrentMaximumAge.ts":
/*!**********************************************************************!*\
  !*** ./src/resolvers/prebinding/prebindHelpers/CurrentMaximumAge.ts ***!
  \**********************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.CurrentMaximumAge = void 0;
var CurrentMaximumAge = /** @class */ (function () {
    function CurrentMaximumAge() {
        this.name = 'currentMaximumAge';
    }
    CurrentMaximumAge.prototype.getPrebind = function (args) {
        return function (value, element) {
            return value || args.context.scMaximumAge.toString();
        };
    };
    return CurrentMaximumAge;
}());
exports.CurrentMaximumAge = CurrentMaximumAge;


/***/ }),

/***/ "./src/resolvers/prebinding/prebindHelpers/CurrentPageName.ts":
/*!********************************************************************!*\
  !*** ./src/resolvers/prebinding/prebindHelpers/CurrentPageName.ts ***!
  \********************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.CurrentPageNamePrebind = void 0;
var CurrentPageNamePrebind = /** @class */ (function () {
    function CurrentPageNamePrebind() {
        this.name = 'currentPageName';
    }
    CurrentPageNamePrebind.prototype.getPrebind = function (args) {
        return function (pageName, element) {
            return pageName || args.context.scPageName;
        };
    };
    return CurrentPageNamePrebind;
}());
exports.CurrentPageNamePrebind = CurrentPageNamePrebind;


/***/ }),

/***/ "./src/resolvers/prebinding/prebindHelpers/FieldTranslator.ts":
/*!********************************************************************!*\
  !*** ./src/resolvers/prebinding/prebindHelpers/FieldTranslator.ts ***!
  \********************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.FieldTranslatorPrebind = void 0;
var FieldTranslatorPrebind = /** @class */ (function () {
    function FieldTranslatorPrebind() {
        this.name = 'fieldTranslator';
    }
    FieldTranslatorPrebind.prototype.getPrebind = function (args) {
        return function (name, element) {
            return args.fieldsHandler.toCoveo(name);
        };
    };
    return FieldTranslatorPrebind;
}());
exports.FieldTranslatorPrebind = FieldTranslatorPrebind;


/***/ }),

/***/ "./src/resolvers/prebinding/prebindHelpers/IsAnonymous.ts":
/*!****************************************************************!*\
  !*** ./src/resolvers/prebinding/prebindHelpers/IsAnonymous.ts ***!
  \****************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.IsAnonymousPrebind = void 0;
var IsAnonymousPrebind = /** @class */ (function () {
    function IsAnonymousPrebind() {
        this.name = 'isAnonymous';
    }
    IsAnonymousPrebind.prototype.getPrebind = function (args) {
        return function (isAnonymous, element) {
            return args.context.scIsUserAnonymous ? 'true' : 'false';
        };
    };
    return IsAnonymousPrebind;
}());
exports.IsAnonymousPrebind = IsAnonymousPrebind;


/***/ }),

/***/ "./src/resolvers/prebinding/prebindHelpers/ItemIdSelector.ts":
/*!*******************************************************************!*\
  !*** ./src/resolvers/prebinding/prebindHelpers/ItemIdSelector.ts ***!
  \*******************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.UseItemIdSelectorAsIs = exports.ResolveIfSelector = exports.ResolveIfItemIdInPage = exports.ItemIdSelectorPrebind = void 0;
var ItemIdSelectorPrebind = /** @class */ (function () {
    function ItemIdSelectorPrebind() {
        this.name = 'itemIdSelector';
        this.resolvers = [
            new ResolveIfSelector(),
            new ResolveIfItemIdInPage(),
            new UseItemIdSelectorAsIs(),
        ];
    }
    ItemIdSelectorPrebind.prototype.getPrebind = function (args) {
        var _this = this;
        return function (itemId, element) {
            var resolver = _this.getFirstValidResolver(itemId, element);
            return resolver.getValue(itemId, element);
        };
    };
    ItemIdSelectorPrebind.prototype.getFirstValidResolver = function (itemId, element) {
        var resolver;
        do {
            if (this.resolvers.length === 0) {
                var message = 'Could not resolve the element using the current resolver. Ensure that a valid value is set.';
                console.error(message, {
                    itemId: itemId,
                    element: element,
                });
                throw message;
            }
            resolver = this.resolvers.shift();
        } while (!resolver.canResolve(itemId, element));
        return resolver;
    };
    return ItemIdSelectorPrebind;
}());
exports.ItemIdSelectorPrebind = ItemIdSelectorPrebind;
var ResolveIfItemIdInPage = /** @class */ (function () {
    function ResolveIfItemIdInPage() {
    }
    ResolveIfItemIdInPage.prototype.canResolve = function (itemId) {
        return this.isItemDefined(itemId) && this.isIdSelectorValid("#".concat(itemId));
    };
    ResolveIfItemIdInPage.prototype.getValue = function (itemId) {
        return "#".concat(itemId);
    };
    ResolveIfItemIdInPage.prototype.isItemDefined = function (itemId) {
        return !!itemId;
    };
    ResolveIfItemIdInPage.prototype.isIdSelectorValid = function (selector) {
        return document.querySelector(selector) !== null;
    };
    return ResolveIfItemIdInPage;
}());
exports.ResolveIfItemIdInPage = ResolveIfItemIdInPage;
var ResolveIfSelector = /** @class */ (function () {
    function ResolveIfSelector() {
    }
    ResolveIfSelector.prototype.canResolve = function (itemId, element) {
        return !!itemId && this.isStartingWithSelectorCharacter(itemId);
    };
    ResolveIfSelector.prototype.getValue = function (itemId, element) {
        return itemId;
    };
    ResolveIfSelector.prototype.isStartingWithSelectorCharacter = function (itemId) {
        var firstCharacter = itemId[0];
        return ['.', '#'].indexOf(firstCharacter) !== -1;
    };
    return ResolveIfSelector;
}());
exports.ResolveIfSelector = ResolveIfSelector;
var UseItemIdSelectorAsIs = /** @class */ (function () {
    function UseItemIdSelectorAsIs() {
    }
    UseItemIdSelectorAsIs.prototype.canResolve = function (itemId, element) {
        return true;
    };
    UseItemIdSelectorAsIs.prototype.getValue = function (itemId, element) {
        return itemId;
    };
    return UseItemIdSelectorAsIs;
}());
exports.UseItemIdSelectorAsIs = UseItemIdSelectorAsIs;


/***/ }),

/***/ "./src/resolvers/prebinding/prebindHelpers/MainSearchInterfaceSelector.ts":
/*!********************************************************************************!*\
  !*** ./src/resolvers/prebinding/prebindHelpers/MainSearchInterfaceSelector.ts ***!
  \********************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.MainSearchInterfaceSelectorPrebind = void 0;
var ItemIdSelector_1 = __webpack_require__(/*! ./ItemIdSelector */ "./src/resolvers/prebinding/prebindHelpers/ItemIdSelector.ts");
var coveo_search_ui_1 = __webpack_require__(/*! coveo-search-ui */ "coveo-search-ui");
var MainSearchInterfaceSelectorPrebind = /** @class */ (function () {
    function MainSearchInterfaceSelectorPrebind() {
        this.name = 'mainSearchInterfaceSelector';
        this.resolvers = [
            new ItemIdSelector_1.ResolveIfSelector(),
            new ItemIdSelector_1.ResolveIfItemIdInPage(),
            new ResolveParentSearchInterfaceId(),
            new ItemIdSelector_1.UseItemIdSelectorAsIs(),
        ];
    }
    MainSearchInterfaceSelectorPrebind.prototype.getPrebind = function (args) {
        var _this = this;
        return function (mainSearchInterfaceId, element) {
            var resolver = _this.getFirstValidResolver(mainSearchInterfaceId, element);
            return resolver.getValue(mainSearchInterfaceId, element);
        };
    };
    MainSearchInterfaceSelectorPrebind.prototype.getFirstValidResolver = function (mainSearchInterfaceId, element) {
        var resolver;
        do {
            if (this.resolvers.length === 0) {
                var message = 'Could not resolve the search interface element using the current resolver. Ensure that a valid value is set.';
                console.error(message, {
                    mainSearchInterfaceId: mainSearchInterfaceId,
                    element: element,
                });
                throw message;
            }
            resolver = this.resolvers.shift();
        } while (!resolver.canResolve(mainSearchInterfaceId, element));
        return resolver;
    };
    return MainSearchInterfaceSelectorPrebind;
}());
exports.MainSearchInterfaceSelectorPrebind = MainSearchInterfaceSelectorPrebind;
var ResolveParentSearchInterfaceId = /** @class */ (function () {
    function ResolveParentSearchInterfaceId() {
    }
    ResolveParentSearchInterfaceId.prototype.canResolve = function (mainSearchInterfaceId, element) {
        return this.getValue(mainSearchInterfaceId, element) !== null;
    };
    ResolveParentSearchInterfaceId.prototype.getValue = function (mainSearchInterfaceId, element) {
        if (typeof this.foundId === 'undefined') {
            this.foundId = this.tryFindParentSearchInterfaceFromElement(element);
        }
        return this.foundId;
    };
    ResolveParentSearchInterfaceId.prototype.tryFindParentSearchInterfaceFromElement = function (element) {
        var parentSearchInterface = this.findParentWithClass(element, "Coveo".concat(coveo_search_ui_1.SearchInterface.ID));
        return !!parentSearchInterface ? "#".concat(parentSearchInterface.id) : null;
    };
    ResolveParentSearchInterfaceId.prototype.findParentWithClass = function (element, className) {
        var parent = element.parentElement;
        while ((parent = parent.parentElement) && !parent.classList.contains(className)) { }
        return parent;
    };
    return ResolveParentSearchInterfaceId;
}());


/***/ }),

/***/ "./src/resolvers/prebinding/prebindHelpers/SortCriteria.ts":
/*!*****************************************************************!*\
  !*** ./src/resolvers/prebinding/prebindHelpers/SortCriteria.ts ***!
  \*****************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.SortCriteriaPrebind = void 0;
var SortCriteriaResolver_1 = __webpack_require__(/*! ../../sortCriteria/SortCriteriaResolver */ "./src/resolvers/sortCriteria/SortCriteriaResolver.ts");
var SortCriteriaPrebind = /** @class */ (function () {
    function SortCriteriaPrebind() {
        this.name = 'sortCriteriaResolver';
    }
    SortCriteriaPrebind.prototype.getPrebind = function (args) {
        var criteriaResolver = new SortCriteriaResolver_1.SortCriteriaResolver(args.fieldsHandler);
        return function (sortCriteriaRawValue, element) {
            var sortCriteria = JSON.parse(sortCriteriaRawValue);
            if (Object.keys(sortCriteria).length === 0) {
                return null;
            }
            var sortType = (sortCriteria.type || 'relevancy').toLowerCase();
            var sortDirection = (sortCriteria.direction || 'ascending').toLowerCase();
            var enableBothSortDirections = (element.dataset['scEnableBothSortDirections'] || 'false').toLowerCase() === 'true';
            var sortDropdownElement = document.querySelector('.coveo-sort-section .CoveoSortDropdown');
            var enableSortDropdown = document.body.contains(sortDropdownElement);
            if (sortType === 'relevancy') {
                return criteriaResolver.resolveRelevancyCriteria();
            }
            else if (sortType === 'date') {
                return criteriaResolver.resolveDateCriteria(sortDirection, enableBothSortDirections, enableSortDropdown);
            }
            else {
                var sortField = sortCriteria.field;
                return criteriaResolver.resolveFieldCriteria(sortField, sortDirection, enableBothSortDirections, enableSortDropdown);
            }
        };
    };
    return SortCriteriaPrebind;
}());
exports.SortCriteriaPrebind = SortCriteriaPrebind;


/***/ }),

/***/ "./src/resolvers/prebinding/prebindHelpers/UnfoldDictionaryToAttributes.ts":
/*!*********************************************************************************!*\
  !*** ./src/resolvers/prebinding/prebindHelpers/UnfoldDictionaryToAttributes.ts ***!
  \*********************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.UnfoldDictionaryToAttributesPrebind = void 0;
var UnfoldDictionaryToAttributesPrebind = /** @class */ (function () {
    function UnfoldDictionaryToAttributesPrebind() {
        this.name = 'unfoldDictionaryToAttributesPrebind';
    }
    UnfoldDictionaryToAttributesPrebind.prototype.getPrebind = function (args) {
        return function (rawDictionary, element) {
            var parsedDictionary = JSON.parse(rawDictionary);
            Object.keys(parsedDictionary).forEach(function (key) {
                var translatedField = args.fieldsHandler.toCoveo(key);
                var dataKey = 'field' + translatedField.charAt(0).toUpperCase() + translatedField.slice(1);
                element.dataset[dataKey] = parsedDictionary[key];
            });
            return rawDictionary;
        };
    };
    return UnfoldDictionaryToAttributesPrebind;
}());
exports.UnfoldDictionaryToAttributesPrebind = UnfoldDictionaryToAttributesPrebind;


/***/ }),

/***/ "./src/resolvers/sortCriteria/SortCriteriaPreprocessor.ts":
/*!****************************************************************!*\
  !*** ./src/resolvers/sortCriteria/SortCriteriaPreprocessor.ts ***!
  \****************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.adjustDOMElements = void 0;
var Context_1 = __webpack_require__(/*! ../../base/Context */ "./src/base/Context.ts");
var CSS_SORT_BOTH_DIRECTIONS = '.CoveoSort[data-sc-enable-both-sort-directions="true"]';
var CSS_DROPDOWN_SELECTOR = '.CoveoSortDropdown';
var DESCENDING_CRITERIA = 'Descending';
var ASCENDING_CRITERIA = 'Ascending';
var createReversedSortElement = function (sortElement) {
    var sortElementReverse = sortElement.cloneNode(false);
    var sortCriteria = JSON.parse(sortElementReverse.dataset.sortCriteria);
    sortCriteria.direction = sortCriteria.direction === DESCENDING_CRITERIA ? ASCENDING_CRITERIA : DESCENDING_CRITERIA;
    sortElementReverse.dataset.sortCriteria = JSON.stringify(sortCriteria);
    return sortElementReverse;
};
var addDirectionToCaption = function (element) {
    var sortCriteria = JSON.parse(element.dataset.sortCriteria);
    element.dataset.caption =
        sortCriteria.direction === DESCENDING_CRITERIA
            ? "".concat(element.dataset.caption, " ").concat(Context_1.Context.labels.translate('Descending'))
            : "".concat(element.dataset.caption, " ").concat(Context_1.Context.labels.translate('Ascending'));
};
var adjustSortDropdown = function (rootElement) {
    var dropdownElement = rootElement.querySelector(CSS_DROPDOWN_SELECTOR);
    if (dropdownElement) {
        for (var _i = 0, _a = rootElement.querySelectorAll(CSS_SORT_BOTH_DIRECTIONS); _i < _a.length; _i++) {
            var sortElement = _a[_i];
            var sortElementReverse = createReversedSortElement(sortElement);
            sortElement.insertAdjacentElement('afterend', sortElementReverse);
            addDirectionToCaption(sortElement);
            addDirectionToCaption(sortElementReverse);
        }
    }
};
var adjustDOMElements = function (rootElement) {
    adjustSortDropdown(rootElement);
};
exports.adjustDOMElements = adjustDOMElements;


/***/ }),

/***/ "./src/resolvers/sortCriteria/SortCriteriaResolver.ts":
/*!************************************************************!*\
  !*** ./src/resolvers/sortCriteria/SortCriteriaResolver.ts ***!
  \************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.SortCriteriaResolver = void 0;
var SortCriteriaResolver = /** @class */ (function () {
    function SortCriteriaResolver(fieldsHandler) {
        this.fieldsHandler = fieldsHandler;
    }
    SortCriteriaResolver.prototype.resolveFieldCriteria = function (fieldCriteria, sortDirection, enableBothSortDirections, enableSortDropdown) {
        var field = fieldCriteria.charAt(0) !== '@' ? "@".concat(fieldCriteria) : fieldCriteria;
        return this.getFieldCriteria(this.fieldsHandler.toCoveo(field), sortDirection, enableBothSortDirections, enableSortDropdown);
    };
    SortCriteriaResolver.prototype.resolveDateCriteria = function (sortDirection, enableBothSortDirections, enableSortDropdown) {
        return this.getFieldCriteria('date', sortDirection, enableBothSortDirections, enableSortDropdown);
    };
    SortCriteriaResolver.prototype.resolveRelevancyCriteria = function () {
        return 'relevancy';
    };
    SortCriteriaResolver.prototype.getFieldCriteria = function (fieldCriteria, sortDirection, enableBothSortDirections, enableSortDropdown) {
        if (enableBothSortDirections && !enableSortDropdown) {
            return "".concat(this.getFieldWithDirection(fieldCriteria, sortDirection), ", ").concat(this.getFieldWithDirection(fieldCriteria, this.getInvertedDirection(sortDirection)));
        }
        else {
            return this.getFieldWithDirection(fieldCriteria, sortDirection);
        }
    };
    SortCriteriaResolver.prototype.getFieldWithDirection = function (fieldCriteria, sortDirection) {
        return "".concat(fieldCriteria, " ").concat(sortDirection);
    };
    SortCriteriaResolver.prototype.getInvertedDirection = function (sortDirection) {
        return sortDirection === 'descending' ? 'ascending' : 'descending';
    };
    return SortCriteriaResolver;
}());
exports.SortCriteriaResolver = SortCriteriaResolver;


/***/ }),

/***/ "./src/rest/EndpointCaller.ts":
/*!************************************!*\
  !*** ./src/rest/EndpointCaller.ts ***!
  \************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.EndpointCallerWrapper = void 0;
var coveo_search_ui_1 = __webpack_require__(/*! coveo-search-ui */ "coveo-search-ui");
var EndpointCallerWrapper = /** @class */ (function () {
    function EndpointCallerWrapper(endpointCaller) {
        this.endpointCaller = endpointCaller || new coveo_search_ui_1.EndpointCaller();
    }
    EndpointCallerWrapper.prototype.sendPost = function (url, postData) {
        var callOptions = {
            errorsAsSuccess: false,
            method: 'POST',
            queryString: [],
            requestData: postData,
            url: url,
            responseType: 'text',
            requestDataType: 'application/json',
        };
        return this.endpointCaller.call(callOptions);
    };
    return EndpointCallerWrapper;
}());
exports.EndpointCallerWrapper = EndpointCallerWrapper;


/***/ }),

/***/ "./src/ui/analytics/CoveoForSitecoreAnalytics.ts":
/*!*******************************************************!*\
  !*** ./src/ui/analytics/CoveoForSitecoreAnalytics.ts ***!
  \*******************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        if (typeof b !== "function" && b !== null)
            throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.CoveoForSitecoreAnalytics = void 0;
var coveo_search_ui_1 = __webpack_require__(/*! coveo-search-ui */ "coveo-search-ui");
var ContextEvents_1 = __webpack_require__(/*! ../../events/ContextEvents */ "./src/events/ContextEvents.ts");
var CoveoForSitecoreAnalytics = exports.CoveoForSitecoreAnalytics = /** @class */ (function (_super) {
    __extends(CoveoForSitecoreAnalytics, _super);
    function CoveoForSitecoreAnalytics(element, options, bindings) {
        var _this = _super.call(this, element, CoveoForSitecoreAnalytics.ID, bindings) || this;
        _this.element = element;
        _this.options = options;
        _this.bindings = bindings;
        _this.options = coveo_search_ui_1.ComponentOptions.initComponentOptions(element, CoveoForSitecoreAnalytics, options);
        _this.bind.onRootElement(coveo_search_ui_1.InitializationEvents.afterInitialization, function () { return _this.onAfterInitialization(); });
        _this.bind.onRootElement(ContextEvents_1.SitecoreContextEvents.onSitecoreContextInitialization, function (args) { return _this.onSitecoreContextInitialization(args); });
        return _this;
    }
    CoveoForSitecoreAnalytics.prototype.onAfterInitialization = function () {
        if (this.bindings.usageAnalytics && this.options.scOriginContext) {
            this.bindings.usageAnalytics.setOriginContext(this.options.scOriginContext);
        }
    };
    CoveoForSitecoreAnalytics.prototype.onSitecoreContextInitialization = function (sitecoreContext) {
        this.completeAnalyticsCustomDataWithSitecoreContext(sitecoreContext);
        this.setUsageAnalyticsEnpointServiceUrl(sitecoreContext);
    };
    CoveoForSitecoreAnalytics.prototype.completeAnalyticsCustomDataWithSitecoreContext = function (sitecoreContext) {
        var _this = this;
        this.bind.onRootElement(coveo_search_ui_1.AnalyticsEvents.changeAnalyticsCustomData, function (args) {
            var _a;
            var options = _this.options;
            if (options) {
                if (options.scOverrideCurrentLanguage && !!sitecoreContext.currentLanguage) {
                    args.language = sitecoreContext.currentLanguage;
                }
                if (options.scOverrideOriginWithPageName && !!sitecoreContext.sitecorePageName) {
                    args.originLevel1 = sitecoreContext.sitecorePageName;
                }
                var customMetadata = {
                    pageFullPath: sitecoreContext.sitecorePageFullPath,
                    sitename: sitecoreContext.siteName,
                    siteName: sitecoreContext.siteName,
                };
                var userContext = window['CoveoForSitecoreUserContext'];
                if (!!userContext && !!userContext.handler) {
                    var context = userContext.handler.getContext();
                    if (!!context) {
                        for (var key in context) {
                            _.extend(customMetadata, (_a = {},
                                _a['context_' + key] = context[key],
                                _a));
                        }
                    }
                }
                if (options.scAnalyticsCustomMetadata) {
                    _.extend(customMetadata, options.scAnalyticsCustomMetadata);
                }
                _.extend(args.metaObject, customMetadata);
            }
        });
    };
    CoveoForSitecoreAnalytics.prototype.setUsageAnalyticsEnpointServiceUrl = function (sitecoreContext) {
        if (this.bindings.usageAnalytics &&
            this.bindings.usageAnalytics.endpoint &&
            this.bindings.usageAnalytics.endpoint.options) {
            this.bindings.usageAnalytics.endpoint.options.serviceUrl =
                this.options.endpoint || sitecoreContext.analyticsEndpointUri;
        }
    };
    CoveoForSitecoreAnalytics.ID = 'ForSitecoreAnalytics';
    CoveoForSitecoreAnalytics.options = {
        scAnalyticsCustomMetadata: coveo_search_ui_1.ComponentOptions.buildJsonOption(),
        scOriginContext: coveo_search_ui_1.ComponentOptions.buildStringOption({
            defaultValue: 'WebsiteSearch',
        }),
        scOverrideOriginWithPageName: coveo_search_ui_1.ComponentOptions.buildBooleanOption({
            defaultValue: false,
        }),
        scOverrideCurrentLanguage: coveo_search_ui_1.ComponentOptions.buildBooleanOption({
            defaultValue: true,
        }),
        endpoint: coveo_search_ui_1.ComponentOptions.buildStringOption(),
    };
    return CoveoForSitecoreAnalytics;
}(coveo_search_ui_1.Component));
coveo_search_ui_1.Initialization.registerAutoCreateComponent(CoveoForSitecoreAnalytics);


/***/ }),

/***/ "./src/ui/analytics/CoveoForSitecoreConfigureSearchHub.ts":
/*!****************************************************************!*\
  !*** ./src/ui/analytics/CoveoForSitecoreConfigureSearchHub.ts ***!
  \****************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        if (typeof b !== "function" && b !== null)
            throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.CoveoForSitecoreConfigureSearchHub = void 0;
var coveo_search_ui_1 = __webpack_require__(/*! coveo-search-ui */ "coveo-search-ui");
var searchHubAttribute = 'searchHub';
var CoveoForSitecoreConfigureSearchHub = exports.CoveoForSitecoreConfigureSearchHub = /** @class */ (function (_super) {
    __extends(CoveoForSitecoreConfigureSearchHub, _super);
    function CoveoForSitecoreConfigureSearchHub(element, options, bindings) {
        var _this = _super.call(this, element, CoveoForSitecoreConfigureSearchHub.ID, bindings) || this;
        _this.element = element;
        _this.options = options;
        _this.bindings = bindings;
        _this.options = coveo_search_ui_1.ComponentOptions.initComponentOptions(element, CoveoForSitecoreConfigureSearchHub, options);
        if (!!_this.options.scSearchHub) {
            _this.bind.oneRootElement(coveo_search_ui_1.InitializationEvents.afterComponentsInitialization, _this.onAfterComponentsInitialization);
        }
        return _this;
    }
    CoveoForSitecoreConfigureSearchHub.prototype.onAfterComponentsInitialization = function () {
        var currentSearchHub = this.componentOptionsModel.get(searchHubAttribute);
        if (!currentSearchHub) {
            this.componentOptionsModel.set(searchHubAttribute, this.options.scSearchHub);
        }
    };
    CoveoForSitecoreConfigureSearchHub.ID = 'ForSitecoreConfigureSearchHub';
    CoveoForSitecoreConfigureSearchHub.options = {
        scSearchHub: coveo_search_ui_1.ComponentOptions.buildStringOption(),
    };
    return CoveoForSitecoreConfigureSearchHub;
}(coveo_search_ui_1.Component));
coveo_search_ui_1.Initialization.registerAutoCreateComponent(CoveoForSitecoreConfigureSearchHub);


/***/ }),

/***/ "./src/ui/analytics/SendAnalyticsToSitecore.ts":
/*!*****************************************************!*\
  !*** ./src/ui/analytics/SendAnalyticsToSitecore.ts ***!
  \*****************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        if (typeof b !== "function" && b !== null)
            throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.SendAnalyticsToSitecore = void 0;
var EndpointCaller_1 = __webpack_require__(/*! ../../rest/EndpointCaller */ "./src/rest/EndpointCaller.ts");
var ContextEvents_1 = __webpack_require__(/*! ../../events/ContextEvents */ "./src/events/ContextEvents.ts");
var coveo_search_ui_1 = __webpack_require__(/*! coveo-search-ui */ "coveo-search-ui");
var SendAnalyticsToSitecore = exports.SendAnalyticsToSitecore = /** @class */ (function (_super) {
    __extends(SendAnalyticsToSitecore, _super);
    function SendAnalyticsToSitecore(element, options, bindings) {
        var _this = _super.call(this, element, SendAnalyticsToSitecore.ID, bindings) || this;
        _this.element = element;
        _this.options = options;
        _this.bindings = bindings;
        _this.options = coveo_search_ui_1.ComponentOptions.initComponentOptions(element, SendAnalyticsToSitecore, options);
        _this.endpointCaller = new EndpointCaller_1.EndpointCallerWrapper();
        _this.bind.onRootElement(ContextEvents_1.SitecoreContextEvents.onSitecoreContextInitialization, _this.onSitecoreContextInitialization);
        return _this;
    }
    SendAnalyticsToSitecore.prototype.onSitecoreContextInitialization = function (sitecoreContext) {
        var _this = this;
        if (sitecoreContext.analyticsEnabled) {
            this.bind.onRootElement(coveo_search_ui_1.AnalyticsEvents.searchEvent, function (args) {
                _this.postAnalytics('searches', 'searchEvents', args.searchEvents, sitecoreContext);
            });
            this.bind.onRootElement(coveo_search_ui_1.AnalyticsEvents.documentViewEvent, function (args) {
                _this.postAnalytics('documentViews', 'documentViewEvents', args.documentViewEvent, sitecoreContext);
            });
            this.bind.onRootElement(coveo_search_ui_1.AnalyticsEvents.customEvent, function (args) {
                _this.postAnalytics('custom', 'customEvents', args.customEvent, sitecoreContext);
            });
        }
    };
    SendAnalyticsToSitecore.prototype.postAnalytics = function (eventAction, eventType, eventData, sitecoreContext) {
        var parsedEventData = [];
        if (typeof eventData !== 'undefined') {
            parsedEventData = parsedEventData.concat(eventData);
        }
        parsedEventData
            .filter(function (data) {
            return typeof data !== 'undefined';
        })
            .forEach(function (data) {
            data.sitecoreItemId = sitecoreContext.sitecoreItemId;
        });
        var postData = {};
        postData[eventType] = JSON.stringify(parsedEventData);
        this.endpointCaller.sendPost("".concat(this.options.scAnalyticsEndpointUri, "/").concat(eventAction), postData);
    };
    SendAnalyticsToSitecore.ID = 'SendAnalyticsToSitecore';
    SendAnalyticsToSitecore.options = {
        scAnalyticsEndpointUri: coveo_search_ui_1.ComponentOptions.buildStringOption({
            required: true,
            postProcessing: function (value) {
                return typeof value !== 'undefined' && value[value.length - 1] === '/'
                    ? value.slice(0, value.length - 1)
                    : value;
            },
        }),
    };
    return SendAnalyticsToSitecore;
}(coveo_search_ui_1.Component));
coveo_search_ui_1.Initialization.registerAutoCreateComponent(SendAnalyticsToSitecore);


/***/ }),

/***/ "./src/ui/analytics/ValidateAnalyticsIncluded.ts":
/*!*******************************************************!*\
  !*** ./src/ui/analytics/ValidateAnalyticsIncluded.ts ***!
  \*******************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        if (typeof b !== "function" && b !== null)
            throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.ValidateAnalyticsIncluded = void 0;
var coveo_search_ui_1 = __webpack_require__(/*! coveo-search-ui */ "coveo-search-ui");
var ContextEvents_1 = __webpack_require__(/*! ../../events/ContextEvents */ "./src/events/ContextEvents.ts");
var ValidateAnalyticsIncluded = exports.ValidateAnalyticsIncluded = /** @class */ (function (_super) {
    __extends(ValidateAnalyticsIncluded, _super);
    function ValidateAnalyticsIncluded(element, options, bindings) {
        var _this = _super.call(this, element, ValidateAnalyticsIncluded.ID, bindings) || this;
        _this.element = element;
        _this.options = options;
        _this.bindings = bindings;
        _this.options = coveo_search_ui_1.ComponentOptions.initComponentOptions(element, ValidateAnalyticsIncluded, options);
        _this.bind.onRootElement(ContextEvents_1.SitecoreContextEvents.onSitecoreContextInitialization, _this.onSitecoreContextInitialization);
        return _this;
    }
    ValidateAnalyticsIncluded.prototype.onSitecoreContextInitialization = function (sitecoreContextArgs) {
        if (sitecoreContextArgs.shouldHaveAnalyticsComponent && this.searchInterfaceHasNoBoundAnalyticsComponent()) {
            if (sitecoreContextArgs.isInExperienceEditor) {
                var errorMessage = getErrorMessage(this.options.componentName || 'Search Interface');
                if (!this.checkIfErrorInErrorMessage(errorMessage)) {
                    console.warn(errorMessage);
                    this.element.appendChild(this.createErrorMessageElement(errorMessage));
                }
            }
        }
    };
    ValidateAnalyticsIncluded.prototype.checkIfErrorInErrorMessage = function (errorMessage) {
        for (var index = 0; index < this.element.children.length; index++) {
            var element = this.element.children[index];
            if (element.textContent.indexOf(errorMessage, 0) !== -1) {
                return true;
            }
        }
        return false;
    };
    ValidateAnalyticsIncluded.prototype.searchInterfaceHasNoBoundAnalyticsComponent = function () {
        return (this.searchInterface.getComponents('Analytics').length === 0 &&
            this.searchInterface.getComponents('ForSitecoreAnalytics').length === 0);
    };
    ValidateAnalyticsIncluded.prototype.createErrorMessageElement = function (errorMessage) {
        var errorSpan = document.createElement('span');
        errorSpan.classList.add('errorMessage');
        errorSpan.textContent = errorMessage;
        return errorSpan;
    };
    ValidateAnalyticsIncluded.ID = 'ValidateAnalyticsIncluded';
    ValidateAnalyticsIncluded.options = {
        componentName: coveo_search_ui_1.ComponentOptions.buildStringOption({
            defaultValue: '',
            attrName: 'data-component-name',
        }),
    };
    return ValidateAnalyticsIncluded;
}(coveo_search_ui_1.Component));
function getErrorMessage(component) {
    return "The Coveo Analytics are not enabled for this ".concat(component, ". Insert a Coveo For Sitecore Analytics component to record Coveo Usage Analytics data.");
}
coveo_search_ui_1.Initialization.registerAutoCreateComponent(ValidateAnalyticsIncluded);


/***/ }),

/***/ "./src/ui/context/CoveoForSitecoreBindWithUserContext.ts":
/*!***************************************************************!*\
  !*** ./src/ui/context/CoveoForSitecoreBindWithUserContext.ts ***!
  \***************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        if (typeof b !== "function" && b !== null)
            throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.CoveoForSitecoreBindWithUserContext = void 0;
var coveo_search_ui_1 = __webpack_require__(/*! coveo-search-ui */ "coveo-search-ui");
var CoveoForSitecoreBindWithUserContext = exports.CoveoForSitecoreBindWithUserContext = /** @class */ (function (_super) {
    __extends(CoveoForSitecoreBindWithUserContext, _super);
    function CoveoForSitecoreBindWithUserContext(element, options, bindings) {
        var _this = _super.call(this, element, CoveoForSitecoreBindWithUserContext.ID, bindings) || this;
        _this.element = element;
        _this.options = options;
        _this.bindings = bindings;
        _this.options = coveo_search_ui_1.ComponentOptions.initComponentOptions(element, CoveoForSitecoreBindWithUserContext, options);
        _this.bind.onRootElement(coveo_search_ui_1.QueryEvents.doneBuildingQuery, _this.doneBuildingQuery);
        _this.bind.onRootElement(coveo_search_ui_1.OmniboxEvents.buildingQuerySuggest, _this.buildingQuerySuggest);
        return _this;
    }
    CoveoForSitecoreBindWithUserContext.prototype.doneBuildingQuery = function (args) {
        var context = window['CoveoForSitecoreUserContext'];
        if (!!context && !!context.handler) {
            args.queryBuilder.addContext(context.handler.getContext());
        }
    };
    CoveoForSitecoreBindWithUserContext.prototype.buildingQuerySuggest = function (args) {
        var context = window['CoveoForSitecoreUserContext'];
        if (!!context && !!context.handler) {
            args.payload.context = context.handler.getContext();
        }
    };
    CoveoForSitecoreBindWithUserContext.ID = 'ForSitecoreBindWithUserContext';
    CoveoForSitecoreBindWithUserContext.options = {};
    return CoveoForSitecoreBindWithUserContext;
}(coveo_search_ui_1.Component));
coveo_search_ui_1.Initialization.registerAutoCreateComponent(CoveoForSitecoreBindWithUserContext);


/***/ }),

/***/ "./src/ui/context/CoveoForSitecoreContext.ts":
/*!***************************************************!*\
  !*** ./src/ui/context/CoveoForSitecoreContext.ts ***!
  \***************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        if (typeof b !== "function" && b !== null)
            throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.CoveoForSitecoreContext = void 0;
var coveo_search_ui_1 = __webpack_require__(/*! coveo-search-ui */ "coveo-search-ui");
var ContextEvents_1 = __webpack_require__(/*! ../../events/ContextEvents */ "./src/events/ContextEvents.ts");
var CoveoForSitecoreContext = exports.CoveoForSitecoreContext = /** @class */ (function (_super) {
    __extends(CoveoForSitecoreContext, _super);
    function CoveoForSitecoreContext(element, options, bindings) {
        var _this = _super.call(this, element, CoveoForSitecoreContext.ID, bindings) || this;
        _this.element = element;
        _this.options = options;
        _this.bindings = bindings;
        _this.options = coveo_search_ui_1.ComponentOptions.initComponentOptions(element, CoveoForSitecoreContext, options);
        _this.bind.onRootElement(coveo_search_ui_1.InitializationEvents.afterComponentsInitialization, _this.afterComponentsInitialization);
        _this.bind.onRootElement(coveo_search_ui_1.QueryEvents.doneBuildingQuery, _this.doneBuildingQuery);
        _this.bind.onRootElement(coveo_search_ui_1.OmniboxEvents.buildingQuerySuggest, _this.buildingQuerySuggest);
        return _this;
    }
    CoveoForSitecoreContext.prototype.doneBuildingQuery = function (args) {
        if (this.hasDefaultPipelineNameSet() && this.queryBuilderUsesDefaultPipeline(args.queryBuilder)) {
            args.queryBuilder.pipeline = this.options.scDefaultPipelineName;
        }
    };
    CoveoForSitecoreContext.prototype.buildingQuerySuggest = function (args) {
        if (this.hasDefaultPipelineNameSet() && this.querySuggestUsesDefaultPipeline(args.payload)) {
            args.payload.pipeline = this.options.scDefaultPipelineName;
        }
    };
    CoveoForSitecoreContext.prototype.hasDefaultPipelineNameSet = function () {
        return this.options.scDefaultPipelineName !== '';
    };
    CoveoForSitecoreContext.prototype.queryBuilderUsesDefaultPipeline = function (queryBuilder) {
        return typeof queryBuilder.pipeline === 'undefined';
    };
    CoveoForSitecoreContext.prototype.querySuggestUsesDefaultPipeline = function (querySuggestRequest) {
        return typeof querySuggestRequest.pipeline === 'undefined';
    };
    CoveoForSitecoreContext.prototype.afterComponentsInitialization = function () {
        var contextArgs = {
            sitecoreItemId: this.options.scItemId,
            sitecoreItemUri: this.options.scItemUri,
            sitecorePageName: this.options.scPageName,
            shouldHaveAnalyticsComponent: this.options.scShouldHaveAnalyticsComponent,
            analyticsEnabled: this.options.scAnalyticsEnabled,
            indexSourceName: this.options.scIndexSourceName,
            currentLanguage: this.options.scCurrentLanguage,
            languageFieldName: this.options.scLanguageFieldName,
            latestVersionFieldName: this.options.scLatestVersionFieldName,
            isInExperienceEditor: this.options.scIsInExperienceEditor,
            sitecorePageFullPath: this.options.scPageNameFullPath,
            siteName: this.options.scSiteName,
            restEndpointUri: this.options.scRestEndpointUri,
            analyticsEndpointUri: this.options.scAnalyticsEndpointUri,
        };
        this.bind.trigger(this.element, ContextEvents_1.SitecoreContextEvents.onSitecoreContextInitialization, contextArgs);
    };
    CoveoForSitecoreContext.ID = 'ForSitecoreContext';
    CoveoForSitecoreContext.options = {
        scItemId: coveo_search_ui_1.ComponentOptions.buildStringOption(),
        scItemUri: coveo_search_ui_1.ComponentOptions.buildStringOption(),
        scLanguageFieldName: coveo_search_ui_1.ComponentOptions.buildStringOption(),
        scLatestVersionFieldName: coveo_search_ui_1.ComponentOptions.buildStringOption(),
        scCurrentLanguage: coveo_search_ui_1.ComponentOptions.buildStringOption(),
        scRestEndpointUri: coveo_search_ui_1.ComponentOptions.buildStringOption(),
        scAnalyticsEndpointUri: coveo_search_ui_1.ComponentOptions.buildStringOption(),
        scLabels: coveo_search_ui_1.ComponentOptions.buildJsonOption(),
        scPageName: coveo_search_ui_1.ComponentOptions.buildStringOption(),
        scDefaultPipelineName: coveo_search_ui_1.ComponentOptions.buildStringOption(),
        scShouldHaveAnalyticsComponent: coveo_search_ui_1.ComponentOptions.buildBooleanOption(),
        scAnalyticsEnabled: coveo_search_ui_1.ComponentOptions.buildBooleanOption(),
        scIsUserAnonymous: coveo_search_ui_1.ComponentOptions.buildBooleanOption(),
        scFieldPrefix: coveo_search_ui_1.ComponentOptions.buildStringOption(),
        scFieldSuffix: coveo_search_ui_1.ComponentOptions.buildStringOption(),
        scExternalFields: coveo_search_ui_1.ComponentOptions.buildJsonOption(),
        scSourceSpecificFields: coveo_search_ui_1.ComponentOptions.buildJsonOption(),
        scPreferSourceSpecificFields: coveo_search_ui_1.ComponentOptions.buildBooleanOption(),
        scIndexSourceName: coveo_search_ui_1.ComponentOptions.buildStringOption(),
        scIsInExperienceEditor: coveo_search_ui_1.ComponentOptions.buildBooleanOption(),
        scMaximumAge: coveo_search_ui_1.ComponentOptions.buildNumberOption(),
        scPageNameFullPath: coveo_search_ui_1.ComponentOptions.buildStringOption(),
        scSiteName: coveo_search_ui_1.ComponentOptions.buildStringOption(),
    };
    return CoveoForSitecoreContext;
}(coveo_search_ui_1.Component));
coveo_search_ui_1.Initialization.registerAutoCreateComponent(CoveoForSitecoreContext);


/***/ }),

/***/ "./src/ui/distance/GoogleApiPositionProvider.ts":
/*!******************************************************!*\
  !*** ./src/ui/distance/GoogleApiPositionProvider.ts ***!
  \******************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        if (typeof b !== "function" && b !== null)
            throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.GoogleApiPositionProvider = void 0;
var coveo_search_ui_1 = __webpack_require__(/*! coveo-search-ui */ "coveo-search-ui");
var EndpointCaller_1 = __webpack_require__(/*! ../../rest/EndpointCaller */ "./src/rest/EndpointCaller.ts");
var GOOGLE_MAP_BASE_URL = 'https://www.googleapis.com/geolocation/v1/geolocate';
var GoogleApiPositionProvider = exports.GoogleApiPositionProvider = /** @class */ (function (_super) {
    __extends(GoogleApiPositionProvider, _super);
    function GoogleApiPositionProvider(element, options, bindings) {
        var _this = _super.call(this, element, GoogleApiPositionProvider.ID, bindings) || this;
        _this.element = element;
        _this.options = options;
        _this.bindings = bindings;
        _this.options = coveo_search_ui_1.ComponentOptions.initComponentOptions(element, GoogleApiPositionProvider, options);
        _this.endpointCaller = new EndpointCaller_1.EndpointCallerWrapper();
        _this.bind.onRootElement(coveo_search_ui_1.DistanceEvents.onResolvingPosition, _this.onResolvingPosition);
        _this.validateProperties();
        return _this;
    }
    GoogleApiPositionProvider.prototype.onResolvingPosition = function (args) {
        var _this = this;
        if (this.canProvideDistance()) {
            args.providers.push({
                getPosition: function () { return _this.getPosition(); },
            });
        }
    };
    GoogleApiPositionProvider.prototype.canProvideDistance = function () {
        return !!this.options.googleApiKey;
    };
    GoogleApiPositionProvider.prototype.getPosition = function () {
        return this.endpointCaller
            .sendPost("".concat(GOOGLE_MAP_BASE_URL, "?key=").concat(this.options.googleApiKey), {})
            .then(function (positionData) {
            var location = positionData.data.location;
            return {
                latitude: location.lat,
                longitude: location.lng,
            };
        });
    };
    GoogleApiPositionProvider.prototype.validateProperties = function () {
        if (!this.options.googleApiKey) {
            this.logger.error("You must set the \"googleApiKey\" property for this component to work properly. It will be disabled.");
        }
    };
    GoogleApiPositionProvider.ID = 'GoogleApiPositionProvider';
    GoogleApiPositionProvider.options = {
        googleApiKey: coveo_search_ui_1.ComponentOptions.buildStringOption({
            required: true,
        }),
    };
    return GoogleApiPositionProvider;
}(coveo_search_ui_1.Component));
coveo_search_ui_1.Initialization.registerAutoCreateComponent(GoogleApiPositionProvider);


/***/ }),

/***/ "./src/ui/distance/NavigatorPositionProvider.ts":
/*!******************************************************!*\
  !*** ./src/ui/distance/NavigatorPositionProvider.ts ***!
  \******************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        if (typeof b !== "function" && b !== null)
            throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.NavigatorPositionProvider = void 0;
var coveo_search_ui_1 = __webpack_require__(/*! coveo-search-ui */ "coveo-search-ui");
var NavigatorPositionProvider = exports.NavigatorPositionProvider = /** @class */ (function (_super) {
    __extends(NavigatorPositionProvider, _super);
    function NavigatorPositionProvider(element, options, bindings) {
        var _this = _super.call(this, element, NavigatorPositionProvider.ID, bindings) || this;
        _this.element = element;
        _this.options = options;
        _this.bindings = bindings;
        _this.options = coveo_search_ui_1.ComponentOptions.initComponentOptions(element, NavigatorPositionProvider, options);
        _this.bind.onRootElement(coveo_search_ui_1.DistanceEvents.onResolvingPosition, _this.onResolvingPosition);
        return _this;
    }
    NavigatorPositionProvider.prototype.onResolvingPosition = function (args) {
        var _this = this;
        args.providers.push({
            getPosition: function () { return _this.getPosition(); },
        });
    };
    NavigatorPositionProvider.prototype.getPosition = function () {
        return new Promise(function (resolve, reject) {
            navigator.geolocation.getCurrentPosition(function (position) {
                resolve({
                    latitude: position.coords.latitude,
                    longitude: position.coords.longitude,
                });
            }, function (error) {
                reject(error);
            });
        });
    };
    NavigatorPositionProvider.ID = 'NavigatorPositionProvider';
    NavigatorPositionProvider.options = {};
    return NavigatorPositionProvider;
}(coveo_search_ui_1.Component));
coveo_search_ui_1.Initialization.registerAutoCreateComponent(NavigatorPositionProvider);


/***/ }),

/***/ "./src/ui/distance/StaticPositionProvider.ts":
/*!***************************************************!*\
  !*** ./src/ui/distance/StaticPositionProvider.ts ***!
  \***************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        if (typeof b !== "function" && b !== null)
            throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.StaticPositionProvider = void 0;
var coveo_search_ui_1 = __webpack_require__(/*! coveo-search-ui */ "coveo-search-ui");
var StaticPositionProvider = exports.StaticPositionProvider = /** @class */ (function (_super) {
    __extends(StaticPositionProvider, _super);
    function StaticPositionProvider(element, options, bindings) {
        var _this = _super.call(this, element, StaticPositionProvider.ID, bindings) || this;
        _this.element = element;
        _this.options = options;
        _this.bindings = bindings;
        _this.options = coveo_search_ui_1.ComponentOptions.initComponentOptions(element, StaticPositionProvider, options);
        _this.bind.onRootElement(coveo_search_ui_1.DistanceEvents.onResolvingPosition, _this.onResolvingPosition);
        return _this;
    }
    StaticPositionProvider.prototype.onResolvingPosition = function (args) {
        var _this = this;
        if (this.canGetPosition()) {
            args.providers.push({
                getPosition: function () { return _this.getPosition(); },
            });
        }
    };
    StaticPositionProvider.prototype.canGetPosition = function () {
        return !!this.options.latitude && !!this.options.longitude;
    };
    StaticPositionProvider.prototype.getPosition = function () {
        return Promise.resolve({
            longitude: this.options.longitude,
            latitude: this.options.latitude,
        });
    };
    StaticPositionProvider.ID = 'StaticPositionProvider';
    StaticPositionProvider.options = {
        latitude: coveo_search_ui_1.ComponentOptions.buildNumberOption({
            required: true,
            float: true,
        }),
        longitude: coveo_search_ui_1.ComponentOptions.buildNumberOption({
            required: true,
            float: true,
        }),
    };
    return StaticPositionProvider;
}(coveo_search_ui_1.Component));
coveo_search_ui_1.Initialization.registerAutoCreateComponent(StaticPositionProvider);


/***/ }),

/***/ "./src/ui/scopes/CoveoForSitecoreExpressions.ts":
/*!******************************************************!*\
  !*** ./src/ui/scopes/CoveoForSitecoreExpressions.ts ***!
  \******************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        if (typeof b !== "function" && b !== null)
            throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.CoveoForSitecoreExpressions = void 0;
var coveo_search_ui_1 = __webpack_require__(/*! coveo-search-ui */ "coveo-search-ui");
var ContextEvents_1 = __webpack_require__(/*! ../../events/ContextEvents */ "./src/events/ContextEvents.ts");
var ExpressionEvents_1 = __webpack_require__(/*! ../../events/ExpressionEvents */ "./src/events/ExpressionEvents.ts");
var IS_COVEO_FOR_SITECORE_EXPRESSIONS_EVENT_REGISTERED = 'coveoForSitecoreEventRegistered';
var CoveoForSitecoreExpressions = exports.CoveoForSitecoreExpressions = /** @class */ (function (_super) {
    __extends(CoveoForSitecoreExpressions, _super);
    function CoveoForSitecoreExpressions(element, options, bindings) {
        var _this = _super.call(this, element, CoveoForSitecoreExpressions.ID, bindings) || this;
        _this.element = element;
        _this.options = options;
        _this.bindings = bindings;
        _this.options = coveo_search_ui_1.ComponentOptions.initComponentOptions(element, CoveoForSitecoreExpressions, options);
        _this.bind.onRootElement(ContextEvents_1.SitecoreContextEvents.onSitecoreContextInitialization, _this.afterComponentsInitialization);
        return _this;
    }
    CoveoForSitecoreExpressions.prototype.afterComponentsInitialization = function (contextArgs) {
        var _this = this;
        if (!this.root.dataset[IS_COVEO_FOR_SITECORE_EXPRESSIONS_EVENT_REGISTERED]) {
            this.root.dataset[IS_COVEO_FOR_SITECORE_EXPRESSIONS_EVENT_REGISTERED] = 'true';
            this.bind.onRootElement(coveo_search_ui_1.QueryEvents.buildingQuery, function (buildingQueryArgs) {
                _this.onBuildingQuery(buildingQueryArgs, contextArgs);
            });
        }
    };
    CoveoForSitecoreExpressions.prototype.onBuildingQuery = function (buildingQueryArgs, contextArgs) {
        buildingQueryArgs.queryBuilder.fieldsToInclude = null;
        var externalContentArgs = this.triggerBuildingSitecoreExternalContent();
        var localSitecoreInstanceArgs = this.triggerBuildingLocalSitecoreInstanceEvent(externalContentArgs.sources);
        if (!localSitecoreInstanceArgs.expression.isEmpty()) {
            buildingQueryArgs.queryBuilder.constantExpression.add(localSitecoreInstanceArgs.expression.build(' OR '));
        }
    };
    CoveoForSitecoreExpressions.prototype.triggerBuildingSitecoreExternalContent = function () {
        var externalContentArgs = {
            sources: [],
        };
        this.bind.trigger(this.element, ExpressionEvents_1.SitecoreExpressionEvents.onBuildingSitecoreExternalContent, externalContentArgs);
        return {
            sources: this.filterUnique(externalContentArgs.sources),
        };
    };
    CoveoForSitecoreExpressions.prototype.triggerBuildingLocalSitecoreInstanceEvent = function (externalSources) {
        var localSitecoreInstanceArgs = {
            expression: new coveo_search_ui_1.ExpressionBuilder(),
            externalSources: externalSources,
            buildingQueryAlreadyProcessed: false,
        };
        this.bind.trigger(this.element, ExpressionEvents_1.SitecoreExpressionEvents.onBuildingLocalSitecoreInstanceExpression, localSitecoreInstanceArgs);
        return localSitecoreInstanceArgs;
    };
    CoveoForSitecoreExpressions.prototype.filterUnique = function (array) {
        return array.filter(function (value, index, self) { return self.indexOf(value) === index; });
    };
    CoveoForSitecoreExpressions.ID = 'ForSitecoreExpressions';
    CoveoForSitecoreExpressions.options = {};
    return CoveoForSitecoreExpressions;
}(coveo_search_ui_1.Component));
coveo_search_ui_1.Initialization.registerAutoCreateComponent(CoveoForSitecoreExpressions);


/***/ }),

/***/ "./src/ui/scopes/CoveoForSitecoreExternalContent.ts":
/*!**********************************************************!*\
  !*** ./src/ui/scopes/CoveoForSitecoreExternalContent.ts ***!
  \**********************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        if (typeof b !== "function" && b !== null)
            throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.CoveoForSitecoreExternalContent = void 0;
var coveo_search_ui_1 = __webpack_require__(/*! coveo-search-ui */ "coveo-search-ui");
var TabUtils_1 = __webpack_require__(/*! ../../utils/TabUtils */ "./src/utils/TabUtils.ts");
var ExpressionEvents_1 = __webpack_require__(/*! ../../events/ExpressionEvents */ "./src/events/ExpressionEvents.ts");
var CoveoForSitecoreExternalContent = exports.CoveoForSitecoreExternalContent = /** @class */ (function (_super) {
    __extends(CoveoForSitecoreExternalContent, _super);
    function CoveoForSitecoreExternalContent(element, options, bindings) {
        var _this = _super.call(this, element, CoveoForSitecoreExternalContent.ID, bindings) || this;
        _this.element = element;
        _this.options = options;
        _this.bindings = bindings;
        _this.options = coveo_search_ui_1.ComponentOptions.initComponentOptions(element, CoveoForSitecoreExternalContent, options);
        _this.bind.onRootElement(ExpressionEvents_1.SitecoreExpressionEvents.onBuildingSitecoreExternalContent, _this.onBuildingSitecoreExternalContent);
        return _this;
    }
    CoveoForSitecoreExternalContent.prototype.onBuildingSitecoreExternalContent = function (buildingExternalContentEventArgs) {
        var _a;
        if (this.shouldAddExternalContent()) {
            (_a = buildingExternalContentEventArgs.sources).push.apply(_a, this.options.scSources);
        }
    };
    CoveoForSitecoreExternalContent.prototype.shouldAddExternalContent = function () {
        return (0, TabUtils_1.isTabCurrentlySelected)(this.options.scScopeToTab, this.searchInterface);
    };
    CoveoForSitecoreExternalContent.ID = 'ForSitecoreExternalContent';
    CoveoForSitecoreExternalContent.options = {
        scSources: coveo_search_ui_1.ComponentOptions.buildListOption(),
        scScopeToTab: coveo_search_ui_1.ComponentOptions.buildStringOption(),
    };
    return CoveoForSitecoreExternalContent;
}(coveo_search_ui_1.Component));
coveo_search_ui_1.Initialization.registerAutoCreateComponent(CoveoForSitecoreExternalContent);


/***/ }),

/***/ "./src/ui/scopes/CoveoForSitecoreFilterExpression.ts":
/*!***********************************************************!*\
  !*** ./src/ui/scopes/CoveoForSitecoreFilterExpression.ts ***!
  \***********************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        if (typeof b !== "function" && b !== null)
            throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.CoveoForSitecoreFilterExpression = exports.QueryFilterNodeOptions = void 0;
var coveo_search_ui_1 = __webpack_require__(/*! coveo-search-ui */ "coveo-search-ui");
var TabUtils_1 = __webpack_require__(/*! ../../utils/TabUtils */ "./src/utils/TabUtils.ts");
var QueryFilterNodeExpressionResolver_1 = __webpack_require__(/*! ../../resolvers/nodes/QueryFilterNodeExpressionResolver */ "./src/resolvers/nodes/QueryFilterNodeExpressionResolver.ts");
var QueryFilterNodeOptions = /** @class */ (function () {
    function QueryFilterNodeOptions() {
    }
    QueryFilterNodeOptions.parseQueryFilterNode = function (rawValue) {
        return JSON.parse(this.unescapeAttributeValue(rawValue));
    };
    QueryFilterNodeOptions.unescapeAttributeValue = function (value) {
        return value
            .replace(/&lt;/g, '<')
            .replace(/&g‌​t;/g, '>')
            .replace(/&quot;/g, '"')
            .replace(/&amp;/g, '&');
    };
    return QueryFilterNodeOptions;
}());
exports.QueryFilterNodeOptions = QueryFilterNodeOptions;
var CoveoForSitecoreFilterExpression = exports.CoveoForSitecoreFilterExpression = /** @class */ (function (_super) {
    __extends(CoveoForSitecoreFilterExpression, _super);
    function CoveoForSitecoreFilterExpression(element, options, bindings, queryFilterNodeFactory) {
        if (queryFilterNodeFactory === void 0) { queryFilterNodeFactory = new QueryFilterNodeExpressionResolver_1.QueryFilterNodeExpressionResolverFactory(); }
        var _this = _super.call(this, element, CoveoForSitecoreFilterExpression.ID, bindings) || this;
        _this.element = element;
        _this.options = options;
        _this.bindings = bindings;
        _this.queryFilterNodeFactory = queryFilterNodeFactory;
        _this.options = coveo_search_ui_1.ComponentOptions.initComponentOptions(element, CoveoForSitecoreFilterExpression, options);
        _this.bind.onRootElement(coveo_search_ui_1.QueryEvents.buildingQuery, _this.onBuildingQuery);
        return _this;
    }
    CoveoForSitecoreFilterExpression.prototype.onBuildingQuery = function (buildingQuery) {
        if (this.shouldAddFilterExpression()) {
            if (!!this.options.scAdvancedFilter) {
                buildingQuery.queryBuilder.advancedExpression.add(this.options.scAdvancedFilter.trim());
            }
            if (!!this.options.scFilterScopeNode) {
                try {
                    var resolver = this.getQueryFilterNodeExpressionResolver();
                    var resultingBuilder = resolver.parseQueryFilterNode(this.options.scFilterScopeNode);
                    buildingQuery.queryBuilder.advancedExpression.fromExpressionBuilder(resultingBuilder.advancedExpression);
                }
                catch (exception) {
                    this.logger.error('Could not parse the query filter node.', exception);
                }
            }
        }
    };
    CoveoForSitecoreFilterExpression.prototype.getQueryFilterNodeExpressionResolver = function () {
        return (this.queryFilterNodeResolver ||
            (this.queryFilterNodeResolver = this.queryFilterNodeFactory.createQueryFilterNodeExpression(this.logger)));
    };
    CoveoForSitecoreFilterExpression.prototype.shouldAddFilterExpression = function () {
        return (0, TabUtils_1.isTabCurrentlySelected)(this.options.scScopeToTab, this.searchInterface);
    };
    CoveoForSitecoreFilterExpression.ID = 'ForSitecoreFilterExpression';
    CoveoForSitecoreFilterExpression.options = {
        scScopeToTab: coveo_search_ui_1.ComponentOptions.buildStringOption(),
        scAdvancedFilter: coveo_search_ui_1.ComponentOptions.buildStringOption(),
        scFilterScopeNode: coveo_search_ui_1.ComponentOptions.buildCustomOption(function (value) {
            return QueryFilterNodeOptions.parseQueryFilterNode(value);
        }),
    };
    return CoveoForSitecoreFilterExpression;
}(coveo_search_ui_1.Component));
coveo_search_ui_1.Initialization.registerAutoCreateComponent(CoveoForSitecoreFilterExpression);


/***/ }),

/***/ "./src/ui/scopes/CoveoForSitecoreLocalExpression.ts":
/*!**********************************************************!*\
  !*** ./src/ui/scopes/CoveoForSitecoreLocalExpression.ts ***!
  \**********************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        if (typeof b !== "function" && b !== null)
            throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.CoveoForSitecoreLocalExpression = void 0;
var coveo_search_ui_1 = __webpack_require__(/*! coveo-search-ui */ "coveo-search-ui");
var ContextEvents_1 = __webpack_require__(/*! ../../events/ContextEvents */ "./src/events/ContextEvents.ts");
var ExpressionEvents_1 = __webpack_require__(/*! ../../events/ExpressionEvents */ "./src/events/ExpressionEvents.ts");
var CoveoForSitecoreLocalExpression = exports.CoveoForSitecoreLocalExpression = /** @class */ (function (_super) {
    __extends(CoveoForSitecoreLocalExpression, _super);
    function CoveoForSitecoreLocalExpression(element, options, bindings) {
        var _this = _super.call(this, element, CoveoForSitecoreLocalExpression.ID, bindings) || this;
        _this.element = element;
        _this.options = options;
        _this.bindings = bindings;
        _this.options = coveo_search_ui_1.ComponentOptions.initComponentOptions(element, CoveoForSitecoreLocalExpression, options);
        _this.bind.onRootElement(ContextEvents_1.SitecoreContextEvents.onSitecoreContextInitialization, _this.onContextInitialization);
        return _this;
    }
    CoveoForSitecoreLocalExpression.prototype.onContextInitialization = function (context) {
        var _this = this;
        this.bind.onRootElement(ExpressionEvents_1.SitecoreExpressionEvents.onBuildingLocalSitecoreInstanceExpression, function (builderFilterExpression) {
            return _this.onBuildingFilterExpression(builderFilterExpression, context);
        });
    };
    CoveoForSitecoreLocalExpression.prototype.onBuildingFilterExpression = function (buildingFilterExpressionEventArgs, context) {
        if (!buildingFilterExpressionEventArgs.buildingQueryAlreadyProcessed) {
            buildingFilterExpressionEventArgs.buildingQueryAlreadyProcessed = true;
            var expression = new coveo_search_ui_1.ExpressionBuilder();
            if (this.options.scFilterOnCurrentLanguage) {
                expression.addFieldExpression("@".concat(context.languageFieldName), '==', [context.currentLanguage]);
            }
            if (this.options.scFilterOnLatestVersion) {
                expression.addFieldExpression("@".concat(context.latestVersionFieldName), '==', ['1']);
            }
            if (this.options.scFilterOnSitecoreContextDatabase) {
                expression.addFieldExpression('@source', '==', [context.indexSourceName]);
            }
            if (!expression.isEmpty()) {
                buildingFilterExpressionEventArgs.expression.add(expression.build());
            }
            if (buildingFilterExpressionEventArgs.externalSources &&
                buildingFilterExpressionEventArgs.externalSources.length > 0) {
                var sourceExpression = new coveo_search_ui_1.ExpressionBuilder();
                sourceExpression.addFieldExpression('@source', '==', buildingFilterExpressionEventArgs.externalSources);
                if (!sourceExpression.isEmpty()) {
                    buildingFilterExpressionEventArgs.expression.add(sourceExpression.build(' OR '));
                }
            }
        }
    };
    CoveoForSitecoreLocalExpression.ID = 'ForSitecoreLocalExpression';
    CoveoForSitecoreLocalExpression.options = {
        scFilterOnSitecoreContextDatabase: coveo_search_ui_1.ComponentOptions.buildBooleanOption(),
        scFilterOnCurrentLanguage: coveo_search_ui_1.ComponentOptions.buildBooleanOption(),
        scFilterOnLatestVersion: coveo_search_ui_1.ComponentOptions.buildBooleanOption(),
    };
    return CoveoForSitecoreLocalExpression;
}(coveo_search_ui_1.Component));
coveo_search_ui_1.Initialization.registerAutoCreateComponent(CoveoForSitecoreLocalExpression);


/***/ }),

/***/ "./src/ui/scopes/CoveoForSitecoreRankingExpression.ts":
/*!************************************************************!*\
  !*** ./src/ui/scopes/CoveoForSitecoreRankingExpression.ts ***!
  \************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        if (typeof b !== "function" && b !== null)
            throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.CoveoForSitecoreRankingExpression = void 0;
var coveo_search_ui_1 = __webpack_require__(/*! coveo-search-ui */ "coveo-search-ui");
var TabUtils_1 = __webpack_require__(/*! ../../utils/TabUtils */ "./src/utils/TabUtils.ts");
var QueryRankingNodeExpressionResolver_1 = __webpack_require__(/*! ../../resolvers/nodes/QueryRankingNodeExpressionResolver */ "./src/resolvers/nodes/QueryRankingNodeExpressionResolver.ts");
var CoveoForSitecoreRankingExpression = exports.CoveoForSitecoreRankingExpression = /** @class */ (function (_super) {
    __extends(CoveoForSitecoreRankingExpression, _super);
    function CoveoForSitecoreRankingExpression(element, options, bindings) {
        var _this = _super.call(this, element, CoveoForSitecoreRankingExpression.ID, bindings) || this;
        _this.element = element;
        _this.options = options;
        _this.bindings = bindings;
        _this.options = coveo_search_ui_1.ComponentOptions.initComponentOptions(element, CoveoForSitecoreRankingExpression, options);
        _this.bind.onRootElement(coveo_search_ui_1.QueryEvents.buildingQuery, _this.onBuildingQuery);
        return _this;
    }
    CoveoForSitecoreRankingExpression.prototype.onBuildingQuery = function (buildingQuery) {
        if (this.shouldAddRankingExpression()) {
            if (!!this.options.scRankingExpression) {
                buildingQuery.queryBuilder.advancedExpression.add(this.options.scRankingExpression.trim());
            }
            if (!!this.options.scRankingScopeNode) {
                var resolver = this.getNodeResolver();
                var builder = resolver.parseQueryRankingNode(this.options.scRankingScopeNode);
                builder.rankingFunctions.forEach(function (rankingFunction) {
                    return buildingQuery.queryBuilder.rankingFunctions.push(rankingFunction);
                });
                this.copyQueryBuilderAttributes(builder, buildingQuery.queryBuilder);
            }
        }
    };
    CoveoForSitecoreRankingExpression.prototype.copyQueryBuilderAttributes = function (from, to) {
        from.rankingFunctions.forEach(function (rankingFunction) { return to.rankingFunctions.push(rankingFunction); });
        to.advancedExpression.fromExpressionBuilder(from.advancedExpression);
    };
    CoveoForSitecoreRankingExpression.prototype.getNodeResolver = function () {
        return (this.nodeResolver ||
            (this.nodeResolver = new QueryRankingNodeExpressionResolver_1.QueryRankingNodeExpressionResolverFactory().createQueryFilterNodeExpression(this.logger)));
    };
    CoveoForSitecoreRankingExpression.prototype.shouldAddRankingExpression = function () {
        return (0, TabUtils_1.isTabCurrentlySelected)(this.options.scScopeToTab, this.searchInterface);
    };
    CoveoForSitecoreRankingExpression.ID = 'ForSitecoreRankingExpression';
    CoveoForSitecoreRankingExpression.options = {
        scScopeToTab: coveo_search_ui_1.ComponentOptions.buildStringOption(),
        scRankingExpression: coveo_search_ui_1.ComponentOptions.buildStringOption(),
        scRankingScopeNode: coveo_search_ui_1.ComponentOptions.buildCustomOption(function (value) {
            return JSON.parse(value);
        }),
    };
    return CoveoForSitecoreRankingExpression;
}(coveo_search_ui_1.Component));
coveo_search_ui_1.Initialization.registerAutoCreateComponent(CoveoForSitecoreRankingExpression);


/***/ }),

/***/ "./src/ui/scopes/CoveoForSitecoreSyntax.ts":
/*!*************************************************!*\
  !*** ./src/ui/scopes/CoveoForSitecoreSyntax.ts ***!
  \*************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        if (typeof b !== "function" && b !== null)
            throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.CoveoForSitecoreSyntax = void 0;
var coveo_search_ui_1 = __webpack_require__(/*! coveo-search-ui */ "coveo-search-ui");
var Context_1 = __webpack_require__(/*! ../../base/Context */ "./src/base/Context.ts");
var CoveoForSitecoreSyntax = exports.CoveoForSitecoreSyntax = /** @class */ (function (_super) {
    __extends(CoveoForSitecoreSyntax, _super);
    function CoveoForSitecoreSyntax(element, options, bindings) {
        var _this = _super.call(this, element, CoveoForSitecoreSyntax.ID, bindings) || this;
        _this.element = element;
        _this.options = options;
        _this.bindings = bindings;
        _this.fieldHandler = Context_1.Context.fields;
        _this.options = coveo_search_ui_1.ComponentOptions.initComponentOptions(element, CoveoForSitecoreSyntax, options);
        if (!_this.root.dataset[CoveoForSitecoreSyntax.IS_COVEO_FOR_SITECORE_SYNTAX_EVENT_REGISTERED]) {
            _this.root.dataset[CoveoForSitecoreSyntax.IS_COVEO_FOR_SITECORE_SYNTAX_EVENT_REGISTERED] = 'true';
            _this.bind.onRootElement(coveo_search_ui_1.QueryEvents.doneBuildingQuery, _this.onDoneBuildingQuery);
        }
        return _this;
    }
    CoveoForSitecoreSyntax.prototype.setFieldHandler = function (fieldHandler) {
        this.fieldHandler = fieldHandler;
    };
    CoveoForSitecoreSyntax.prototype.onDoneBuildingQuery = function (buildingQueryArgs) {
        this.replaceSitecoreFieldExpressionsByCoveoFieldExpressions(buildingQueryArgs.queryBuilder.expression);
    };
    CoveoForSitecoreSyntax.prototype.replaceSitecoreFieldExpressionsByCoveoFieldExpressions = function (expressionBuilder) {
        var _this = this;
        var expressionParts = expressionBuilder.getParts();
        expressionParts.forEach(function (expression) {
            var originalExpression = expression;
            expression = _this.replaceSitecoreFieldNamesByCoveoFieldNames(expression);
            expressionBuilder.remove(originalExpression);
            expressionBuilder.add(expression);
        });
    };
    CoveoForSitecoreSyntax.prototype.replaceSitecoreFieldNamesByCoveoFieldNames = function (expression) {
        var _this = this;
        var sitecoreFieldNamesMatched = this.extractSitecoreFieldNames(expression);
        if (sitecoreFieldNamesMatched) {
            sitecoreFieldNamesMatched.forEach(function (sitecoreFieldName) {
                var coveoFieldName = _this.convertUnaryFieldExpressionToCoveoUnaryFieldExpression(sitecoreFieldName);
                expression = expression.replace(sitecoreFieldName, coveoFieldName);
            });
        }
        return expression;
    };
    CoveoForSitecoreSyntax.prototype.extractSitecoreFieldNames = function (expression) {
        return expression.match(CoveoForSitecoreSyntax.SITECORE_FIELD_NAME_REGEX);
    };
    CoveoForSitecoreSyntax.prototype.convertUnaryFieldExpressionToCoveoUnaryFieldExpression = function (unaryFieldExpression) {
        if (!this.fieldHandler.isCoveoFieldName(unaryFieldExpression)) {
            return this.fieldHandler.toCoveo(unaryFieldExpression);
        }
        else {
            return unaryFieldExpression;
        }
    };
    CoveoForSitecoreSyntax.ID = 'ForSitecoreSyntax';
    CoveoForSitecoreSyntax.options = {};
    CoveoForSitecoreSyntax.IS_COVEO_FOR_SITECORE_SYNTAX_EVENT_REGISTERED = 'coveoForSitecoreSyntaxEventRegistered';
    CoveoForSitecoreSyntax.SITECORE_FIELD_NAME_REGEX = /@[\w\_]*(?=\=|\=\=|\<\>|\s|$)/gi;
    return CoveoForSitecoreSyntax;
}(coveo_search_ui_1.Component));
coveo_search_ui_1.Initialization.registerAutoCreateComponent(CoveoForSitecoreSyntax);


/***/ }),

/***/ "./src/utils/HTMLUtils.ts":
/*!********************************!*\
  !*** ./src/utils/HTMLUtils.ts ***!
  \********************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.removeAllIDAttributes = exports.cloneElementSafelyForAccessibility = exports.nodeListToArray = void 0;
function nodeListToArray(elements) {
    var array = [];
    for (var i = 0, length = elements.length; i < length; i++) {
        array.push(elements.item(i));
    }
    return array;
}
exports.nodeListToArray = nodeListToArray;
function cloneElementSafelyForAccessibility(element) {
    var clone = element.cloneNode(true);
    return removeAllIDAttributes(clone);
}
exports.cloneElementSafelyForAccessibility = cloneElementSafelyForAccessibility;
function removeAllIDAttributes(element) {
    element.removeAttribute('id');
    var children = element.querySelectorAll('*[id]');
    var length = children.length;
    for (var i = 0; i < length; i++) {
        children.item(i).removeAttribute('id');
    }
    return element;
}
exports.removeAllIDAttributes = removeAllIDAttributes;


/***/ }),

/***/ "./src/utils/SearchInterfaceProvider.ts":
/*!**********************************************!*\
  !*** ./src/utils/SearchInterfaceProvider.ts ***!
  \**********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.SearchInterfacesProvider = void 0;
var coveo_search_ui_1 = __webpack_require__(/*! coveo-search-ui */ "coveo-search-ui");
var HTMLUtils_1 = __webpack_require__(/*! ./HTMLUtils */ "./src/utils/HTMLUtils.ts");
var SearchInterfacesProvider = /** @class */ (function () {
    function SearchInterfacesProvider() {
    }
    SearchInterfacesProvider.prototype.getSearchInterfacesInPage = function (componentsIds) {
        var searchInterfacesSelector = this.getSearchInterfacesSelectorFromComponentIds(componentsIds);
        var searchInterfaces = document.querySelectorAll(searchInterfacesSelector);
        return (0, HTMLUtils_1.nodeListToArray)(searchInterfaces);
    };
    SearchInterfacesProvider.prototype.getSearchInterfacesSelectorFromComponentIds = function (componentIds) {
        return componentIds.map(function (componentId) { return coveo_search_ui_1.Component.computeSelectorForType(componentId); }).join(', ');
    };
    return SearchInterfacesProvider;
}());
exports.SearchInterfacesProvider = SearchInterfacesProvider;


/***/ }),

/***/ "./src/utils/TabUtils.ts":
/*!*******************************!*\
  !*** ./src/utils/TabUtils.ts ***!
  \*******************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.isTabCurrentlySelected = void 0;
var coveo_search_ui_1 = __webpack_require__(/*! coveo-search-ui */ "coveo-search-ui");
function isTabCurrentlySelected(selected, searchInterface) {
    return !(!!selected && selected !== searchInterface.queryStateModel.get(coveo_search_ui_1.QueryStateModel.attributesEnum.t));
}
exports.isTabCurrentlySelected = isTabCurrentlySelected;


/***/ }),

/***/ "coveo-search-ui":
/*!********************************************************************************************************************!*\
  !*** external {"root":"Coveo","commonjs":"coveo-search-ui","commonjs2":"coveo-search-ui","amd":"coveo-search-ui"} ***!
  \********************************************************************************************************************/
/*! no static exports found */
/***/ (function(module, exports) {

module.exports = __WEBPACK_EXTERNAL_MODULE_coveo_search_ui__;

/***/ })

/******/ });
});
//# sourceMappingURL=CoveoForSitecore.js.map