"use strict";
/*
 * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
 * This devtool is neither made for production nor for readable output files.
 * It uses "eval()" calls to create a separate source file in the browser devtools.
 * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
 * or disable the default devtool with "devtool: false".
 * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
 */
(self["webpackChunkdoctrine_website"] = self["webpackChunkdoctrine_website"] || []).push([["search"],{

/***/ "./source/js/search.js":
/*!*****************************!*\
  !*** ./source/js/search.js ***!
  \*****************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"default\": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var instantsearch_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! instantsearch.js */ \"./node_modules/instantsearch.js/es/index.js\");\n/* harmony import */ var algoliasearch__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! algoliasearch */ \"./node_modules/algoliasearch/dist/algoliasearch.umd.js\");\n/* harmony import */ var algoliasearch__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(algoliasearch__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var instantsearch_js_es_widgets__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! instantsearch.js/es/widgets */ \"./node_modules/instantsearch.js/es/widgets/configure/configure.js\");\n/* harmony import */ var instantsearch_js_es_widgets__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! instantsearch.js/es/widgets */ \"./node_modules/instantsearch.js/es/widgets/search-box/search-box.js\");\n/* harmony import */ var instantsearch_js_es_widgets__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! instantsearch.js/es/widgets */ \"./node_modules/instantsearch.js/es/widgets/hits/hits.js\");\n/* provided dependency */ var $ = __webpack_require__(/*! jquery */ \"./node_modules/jquery/dist/jquery.js\");\n\n\n\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(projectSlug, versionSlug, searchBoxSettings) {\n  var searchParameters = {\n    tagFilters: [],\n    hitsPerPage: 5,\n  };\n\n  if (projectSlug) {\n    searchParameters.tagFilters.push(projectSlug);\n  }\n\n  if (versionSlug) {\n    searchParameters.tagFilters.push(versionSlug);\n  }\n\n  var search = (0,instantsearch_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])({\n    indexName: 'pages',\n    autofocus: false,\n    poweredBy: false,\n    reset: false,\n    searchClient: algoliasearch__WEBPACK_IMPORTED_MODULE_1___default()(\n        'YVYTFT9XMW',\n        'a6dada5f33f148586b92cc3afefeaaf6'\n    ),\n    searchFunction: function (helper) {\n      if (helper.state.query === '') {\n        $('.search-results').hide();\n        $('.container-wrapper').css('opacity', '1');\n\n        return;\n      }\n\n      helper.search();\n\n      $('.container-wrapper').css('opacity', '.25');\n      $('.search-results').show();\n    },\n  });\n\n  search.addWidget((0,instantsearch_js_es_widgets__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(searchParameters));\n\n  search.addWidget((0,instantsearch_js_es_widgets__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(searchBoxSettings));\n\n  search.addWidget(\n    (0,instantsearch_js_es_widgets__WEBPACK_IMPORTED_MODULE_4__[\"default\"])({\n      container: '#hits',\n      templates: {\n        empty: 'No results',\n        item: $('#instantsearch-template').html(),\n      },\n    }),\n  );\n\n  search.start();\n\n  function getParameterByName(name, url) {\n    if (!url) url = window.location.href;\n    name = name.replace(/[\\[\\]]/g, '\\\\$&');\n    var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),\n      results = regex.exec(url);\n    if (!results) return null;\n    if (!results[2]) return '';\n    return decodeURIComponent(results[2].replace(/\\+/g, ' '));\n  }\n\n  $('#search-box input').on('blur', function () {\n    setTimeout(function () {\n      $('.container-wrapper').css('opacity', '1');\n      $('.search-results').hide();\n    }, 200);\n  });\n\n  $(function () {\n    var q = getParameterByName('q', window.location.href);\n\n    if (q) {\n      $('#search-box input').val(q);\n      search.helper.setQuery(q).search();\n    }\n  });\n}\n\n\n//# sourceURL=webpack://doctrine-website/./source/js/search.js?");

/***/ })

}]);