PageSourceSearch

https://images.kitcentrum.nl/js/needletail-ui-3.6.0-b.js?v=6.7.49

js kitcentrum.nl collected 2026-09-24 12:03:27 UTC 113,899 bytes, 3 lines download raw bytes

1/*! For license information please see needletail-ui-3.6.0-b.js.LICENSE.txt */
2!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var i=t();for(var s in i)("object"==typeof exports?exports:e)[s]=i[s]}}(self,(()=>(()=>{var e={775:e=>{window,e.exports=function(e){var t={};function i(s){if(t[s])return t[s].exports;var n=t[s]={i:s,l:!1,exports:{}};return e[s].call(n.exports,n,n.exports,i),n.l=!0,n.exports}return i.m=e,i.c=t,i.d=function(e,t,s){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:s})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var s=Object.create(null);if(i.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(s,n,function(t){return e[t]}.bind(null,n));return s},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=6)}([function(e,t,i){"use strict";var s=this&&this.__awaiter||function(e,t,i,s){return new(i||(i=Promise))((function(n,l){function r(e){try{o(s.next(e))}catch(e){l(e)}}function a(e){try{o(s.throw(e))}catch(e){l(e)}}function o(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}o((s=s.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.BaseEndpoint=void 0;const n=i(1);t.BaseEndpoint=class{constructor(e,t){this.apiKey=e,this.baseUrl=t}getApiKey(){return this.apiKey}get(e,t={}){return s(this,void 0,void 0,(function*(){try{const i=yield fetch(this.baseUrl+e,Object.assign({method:"GET"},this.getOptions(t))),s=i;return i.body&&(s.data=yield i.json()),s}catch(e){console.error(e)}}))}post(e,t={}){return s(this,void 0,void 0,(function*(){try{const i=yield fetch(this.baseUrl+e,Object.assign({method:"POST"},this.getOptions(t))),s=i;return i.body&&(s.data=yield i.json()),s}catch(e){console.error(e)}}))}getOptions(e={}){return{headers:Object.assign({"content-type":"application/json; charset=UTF-8",[n.Config.headers.apiKey]:this.getApiKey()},e.headers),body:JSON.stringify(e.data)}}}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Config=void 0;class s{}t.Config=s,s.baseUrl="https://api.needletail.io/3.0/",s.headers={apiKey:"x-needletail-api-key"}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Bucket=void 0;const s=i(4),n=i(3);class l extends n.BaseEntity{setName(e){return this.name=e,this}getName(){return this.name}setShowScore(e){return this.showScore=e,this}isShowScore(){return this.showScore}setDocumentCount(e){return this.documentCount=e,this}getDocumentCount(){return this.documentCount}setSearchableAttributes(e){return this.searchableAttributes=e,this}getSearchableAttributes(){return this.searchableAttributes}setRetrievableAttributes(e){return this.retrievableAttributes=e,this}getRetrievableAttributes(){return this.retrievableAttributes}setGroupBy(e){return this.groupBy=e,this}getGroupBy(){return this.groupBy}setAttributes(e){return this.attributes=e,this}getAttributes(){return this.attributes}setBoosts(e){return this.boosts=e,this}getBoosts(){return this.boosts}synonyms(){return new s.Synonyms(this.getApiKey(),this,this.getBaseUrl())}alternatives(){return new s.Alternatives(this.getApiKey(),this,this.getBaseUrl())}setBaseUrl(e){return this.baseUrl=e,this}getBaseUrl(){return this.baseUrl}}t.Bucket=l},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseEntity=void 0,t.BaseEntity=class{setApiKey(e){return this.apiKey=e,this}getApiKey(){if(!this.apiKey)throw new Error("API key not set");return this.apiKey}}},function(e,t,i){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,i,s){void 0===s&&(s=i),Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[i]}})}:function(e,t,i,s){void 0===s&&(s=i),e[s]=t[i]}),n=this&&this.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||s(t,e,i)};
2Object.defineProperty(t,"__esModule",{value:!0}),n(i(9),t),n(i(12),t),n(i(13),t),n(i(14),t),n(i(15),t)},function(e,t,i){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,i,s){void 0===s&&(s=i),Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[i]}})}:function(e,t,i,s){void 0===s&&(s=i),e[s]=t[i]}),n=this&&this.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||s(t,e,i)};Object.defineProperty(t,"__esModule",{value:!0}),n(i(2),t),n(i(10),t),n(i(11),t)},function(e,t,i){e.exports=i(7)},function(e,t,i){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,i,s){void 0===s&&(s=i),Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[i]}})}:function(e,t,i,s){void 0===s&&(s=i),e[s]=t[i]}),n=this&&this.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||s(t,e,i)};Object.defineProperty(t,"__esModule",{value:!0}),n(i(8),t),n(i(1),t),n(i(16),t),n(i(18),t),n(i(22),t)},function(e,t,i){"use strict";var s=this&&this.__awaiter||function(e,t,i,s){return new(i||(i=Promise))((function(n,l){function r(e){try{o(s.next(e))}catch(e){l(e)}}function a(e){try{o(s.throw(e))}catch(e){l(e)}}function o(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}o((s=s.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.Client=void 0;const n=i(4),l=i(2),r=i(1);t.Client=class{constructor(e,t){this.readKey=e,this.baseUrl=null!=t?t:r.Config.baseUrl}bulk(e){return s(this,void 0,void 0,(function*(){return yield new n.BulkSearch(this.getReadKey(),this.baseUrl).find(e)}))}search(e){return s(this,void 0,void 0,(function*(){return yield new n.Search(this.getReadKey(),this.baseUrl).find(e)}))}buckets(){return new n.Buckets(this.getReadKey(),this.baseUrl)}alternatives(e){const t=new l.Bucket;return t.setApiKey(this.getReadKey()).setName(e),t.alternatives()}synonyms(e){const t=new l.Bucket;return t.setApiKey(this.getReadKey()).setName(e),t.synonyms()}getReadKey(){return this.readKey}}},function(e,t,i){"use strict";var s=this&&this.__awaiter||function(e,t,i,s){return new(i||(i=Promise))((function(n,l){function r(e){try{o(s.next(e))}catch(e){l(e)}}function a(e){try{o(s.throw(e))}catch(e){l(e)}}function o(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}o((s=s.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.Alternatives=void 0;const n=i(0),l=i(5);class r extends n.BaseEndpoint{constructor(e,t,i){super(e,i),this.bucket=t}all(){return s(this,void 0,void 0,(function*(){const e=yield this.get(`buckets/${this.bucket.getName()}/alternatives`),t=[];return e.forEach((e=>{t.push(this.toEntity(e))})),t}))}find(e){return s(this,void 0,void 0,(function*(){const t=yield this.get(`buckets/${this.bucket.getName()}/alternatives/${e}`);return this.toEntity(t)}))}toEntity(e){return(new l.Alternative).setApiKey(this.getApiKey()).setId(e.id).setOriginalWord(e.original_word).setAlternativeWords(e.alternative_words)}}t.Alternatives=r},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Synonym=void 0;const s=i(3);class n extends s.BaseEntity{setBucket(e){return this.bucket=e,this}getBucket(){return this.bucket}setId(e){return this.id=e,this}getId(){return this.id}setWords(e){return this.words=e,this}getWords(){return this.words}}t.Synonym=n},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Alternative=void 0;const s=i(3);class n extends s.BaseEntity{setBucket(e){return this.bucket=e,this}getBucket(){return this.bucket}setId(e){return this.id=e,this}getId(){return this.id}setOriginalWord(e){return this.originalWord=e,this}getOriginalWord(){return this.originalWord}setAlternativeWords(e){return this.alternativeWords=e,this}getAlternativeWords(){return this.alternativeWords}}t.Alternative=n},function(e,t,i){"use strict";var s=this&&this.__awaiter||function(e,t,i,s){return new(i||(i=Promise))((function(n,l){function r(e){try{o(s.next(e))}catch(e){l(e)}}function a(e){try{o(s.throw(e))}catch(e){l(e)}}function o(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}o((s=s.apply(e,t||[])).next())}))};
2Object.defineProperty(t,"__esModule",{value:!0}),t.Buckets=void 0;const n=i(0),l=i(2);class r extends n.BaseEndpoint{all(){return s(this,void 0,void 0,(function*(){const e=yield this.get("buckets"),t=[];return e.forEach((e=>{t.push(this.toEntity(e))})),t}))}find(e){return s(this,void 0,void 0,(function*(){const t=yield this.get("buckets/"+e);return this.toEntity(t)}))}toEntity(e){return(new l.Bucket).setApiKey(this.getApiKey()).setName(e.name).setShowScore(e.show_score).setDocumentCount(e.document_count).setSearchableAttributes(e.searchable_attributes).setRetrievableAttributes(e.retrievable_attributes).setGroupBy(e.group_by).setAttributes(e.attributes).setBoosts(e.boosts)}}t.Buckets=r},function(e,t,i){"use strict";var s=this&&this.__awaiter||function(e,t,i,s){return new(i||(i=Promise))((function(n,l){function r(e){try{o(s.next(e))}catch(e){l(e)}}function a(e){try{o(s.throw(e))}catch(e){l(e)}}function o(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}o((s=s.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.Synonyms=void 0;const n=i(0),l=i(5);class r extends n.BaseEndpoint{constructor(e,t,i){super(e,i),this.bucket=t}all(){return s(this,void 0,void 0,(function*(){const e=yield this.get(`buckets/${this.bucket.getName()}/synonyms`),t=[];return e.forEach((e=>{t.push(this.toEntity(e))})),t}))}find(e){return s(this,void 0,void 0,(function*(){const t=yield this.get(`buckets/${this.bucket.getName()}/synonyms/${e}`);return this.toEntity(t)}))}toEntity(e){return(new l.Synonym).setApiKey(this.getApiKey()).setId(e.id).setWords(e.words)}}t.Synonyms=r},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BulkSearch=void 0;const s=i(0);class n extends s.BaseEndpoint{find(e){return this.post("search/bulk",{data:e})}}t.BulkSearch=n},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Search=void 0;const s=i(0);class n extends s.BaseEndpoint{find(e){return this.post("search",{data:e})}}t.Search=n},function(e,t,i){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,i,s){void 0===s&&(s=i),Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[i]}})}:function(e,t,i,s){void 0===s&&(s=i),e[s]=t[i]}),n=this&&this.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||s(t,e,i)};Object.defineProperty(t,"__esModule",{value:!0}),n(i(17),t)},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.geoPoint=void 0,t.geoPoint=function(e,t,i){return{geo_point:{lat:e,lng:t,distance:i}}}},function(e,t,i){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,i,s){void 0===s&&(s=i),Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[i]}})}:function(e,t,i,s){void 0===s&&(s=i),e[s]=t[i]}),n=this&&this.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||s(t,e,i)};Object.defineProperty(t,"__esModule",{value:!0}),n(i(19),t),n(i(20),t),n(i(21),t)},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.equals=void 0,t.equals=function(e={}){return{equals:e}}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.notEquals=void 0,t.notEquals=function(e={}){return{not_equals:e}}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.should=void 0,t.should=function(e={}){return{should:e}}},function(e,t,i){"use strict";var s=this&&this.__createBinding||(Object.create?function(e,t,i,s){void 0===s&&(s=i),Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[i]}})}:function(e,t,i,s){void 0===s&&(s=i),e[s]=t[i]}),n=this&&this.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||s(t,e,i)};Object.defineProperty(t,"__esModule",{value:!0}),n(i(23),t),n(i(24),t),n(i(25),t),n(i(26),t),n(i(27),t),n(i(28),t),n(i(29),t)},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.field=void 0,t.field=function(e){return{field:{field:e}}}},function(e,t,i){"use strict";
2Object.defineProperty(t,"__esModule",{value:!0}),t.fuzzy=void 0,t.fuzzy=function(e,t){return{fuzzy:{field:e,value:t}}}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.like=void 0,t.like=function(e,t){return{like:{fields:"string"==typeof e?[e]:e,value:t}}}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.match=void 0,t.match=function(e,t){return{match:{field:e,values:"string"==typeof t?[t]:t}}}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.range=void 0,t.range=function(e,t,i){return{range:{field:e,gte:t,lte:i}}}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.regex=void 0,t.regex=function(e,t){return{regex:{field:e,value:t}}}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.startsWith=void 0,t.startsWith=function(e,t){return{starts_with:{field:e,value:t}}}}])},665:(e,t,i)=>{"use strict";i.p},705:(e,t,i)=>{var s=i(639).Symbol;e.exports=s},239:(e,t,i)=>{var s=i(705),n=i(607),l=i(333),r=s?s.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":r&&r in Object(e)?n(e):l(e)}},561:(e,t,i)=>{var s=i(990),n=/^\s+/;e.exports=function(e){return e?e.slice(0,s(e)+1).replace(n,""):e}},957:(e,t,i)=>{var s="object"==typeof i.g&&i.g&&i.g.Object===Object&&i.g;e.exports=s},607:(e,t,i)=>{var s=i(705),n=Object.prototype,l=n.hasOwnProperty,r=n.toString,a=s?s.toStringTag:void 0;e.exports=function(e){var t=l.call(e,a),i=e[a];try{e[a]=void 0;var s=!0}catch(e){}var n=r.call(e);return s&&(t?e[a]=i:delete e[a]),n}},333:e=>{var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},639:(e,t,i)=>{var s=i(957),n="object"==typeof self&&self&&self.Object===Object&&self,l=s||n||Function("return this")();e.exports=l},990:e=>{var t=/\s/;e.exports=function(e){for(var i=e.length;i--&&t.test(e.charAt(i)););return i}},279:(e,t,i)=>{var s=i(218),n=i(771),l=i(841),r=Math.max,a=Math.min;e.exports=function(e,t,i){var o,h,u,c,d,g,p=0,f=!1,v=!1,m=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function y(t){var i=o,s=h;return o=h=void 0,p=t,c=e.apply(s,i)}function b(e){var i=e-g;return void 0===g||i>=t||i<0||v&&e-p>=u}function S(){var e=n();if(b(e))return _(e);d=setTimeout(S,function(e){var i=t-(e-g);return v?a(i,u-(e-p)):i}(e))}function _(e){return d=void 0,m&&o?y(e):(o=h=void 0,c)}function w(){var e=n(),i=b(e);if(o=arguments,h=this,g=e,i){if(void 0===d)return function(e){return p=e,d=setTimeout(S,t),f?y(e):c}(g);if(v)return clearTimeout(d),d=setTimeout(S,t),y(g)}return void 0===d&&(d=setTimeout(S,t)),c}return t=l(t)||0,s(i)&&(f=!!i.leading,u=(v="maxWait"in i)?r(l(i.maxWait)||0,t):u,m="trailing"in i?!!i.trailing:m),w.cancel=function(){void 0!==d&&clearTimeout(d),p=0,o=g=h=d=void 0},w.flush=function(){return void 0===d?c:_(n())},w}},218:e=>{e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},5:e=>{e.exports=function(e){return null!=e&&"object"==typeof e}},448:(e,t,i)=>{var s=i(239),n=i(5);e.exports=function(e){return"symbol"==typeof e||n(e)&&"[object Symbol]"==s(e)}},771:(e,t,i)=>{var s=i(639);e.exports=function(){return s.Date.now()}},841:(e,t,i)=>{var s=i(561),n=i(218),l=i(448),r=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,o=/^0o[0-7]+$/i,h=parseInt;e.exports=function(e){if("number"==typeof e)return e;if(l(e))return NaN;if(n(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=n(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=s(e);var i=a.test(e);return i||o.test(e)?h(e.slice(2),i?2:8):r.test(e)?NaN:+e}},7:(e,t,i)=>{"use strict";i.r(t),i.d(t,{AggregationBar:()=>$,AutocompleteBar:()=>I,Checkbox:()=>E,Client:()=>l,Events:()=>A,GroupedSearchBar:()=>F,Radio:()=>P,Result:()=>N,Slider:()=>D,Switch:()=>L,URIHelper:()=>x});var s=i(775);class n{constructor(e){this.autocompleteBar=[],this.groupedSearchBar=[],this.result=[],this.aggregationBar=[],this.client=e}add(e){switch(e.discriminator){case"AutocompleteBar":this.autocompleteBar.push(e);break;case"GroupedSearchBar":this.groupedSearchBar.push(e);break;case"Result":this.result.push(e);break;case"AggregationBar":this.aggregationBar.push(e);break;default:throw console.error(e),new Error("Unsupported widget: "+e.discriminator)}e.setClient(this.client).build()}
2addMultiple(e){e.forEach((e=>{this.add(e)}))}}class l extends s.Client{constructor(e,t=null){super(e,t),this.widgets=new n(this)}addWidget(e){return this.widgets.add(e),this}addMultipleWidgets(e){return this.widgets.addMultiple(e),this}}var r=Object.prototype.toString,a=Array.isArray||function(e){return"[object Array]"===r.call(e)};function o(e){return"function"==typeof e}function h(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function u(e,t){return null!=e&&"object"==typeof e&&t in e}var c=RegExp.prototype.test,d=/\S/;var g={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;","`":"&#x60;","=":"&#x3D;"},p=/\s*/,f=/\s+/,v=/\s*=/,m=/\s*\}/,y=/#|\^|\/|>|\{|&|=|!/;function b(e){this.string=e,this.tail=e,this.pos=0}function S(e,t){this.view=e,this.cache={".":this.view},this.parent=t}function _(){this.templateCache={_cache:{},set:function(e,t){this._cache[e]=t},get:function(e){return this._cache[e]},clear:function(){this._cache={}}}}b.prototype.eos=function(){return""===this.tail},b.prototype.scan=function(e){var t=this.tail.match(e);if(!t||0!==t.index)return"";var i=t[0];return this.tail=this.tail.substring(i.length),this.pos+=i.length,i},b.prototype.scanUntil=function(e){var t,i=this.tail.search(e);switch(i){case-1:t=this.tail,this.tail="";break;case 0:t="";break;default:t=this.tail.substring(0,i),this.tail=this.tail.substring(i)}return this.pos+=t.length,t},S.prototype.push=function(e){return new S(e,this)},S.prototype.lookup=function(e){var t,i,s,n=this.cache;if(n.hasOwnProperty(e))t=n[e];else{for(var l,r,a,h=this,c=!1;h;){if(e.indexOf(".")>0)for(l=h.view,r=e.split("."),a=0;null!=l&&a<r.length;)a===r.length-1&&(c=u(l,r[a])||(i=l,s=r[a],null!=i&&"object"!=typeof i&&i.hasOwnProperty&&i.hasOwnProperty(s))),l=l[r[a++]];else l=h.view[e],c=u(h.view,e);if(c){t=l;break}h=h.parent}n[e]=t}return o(t)&&(t=t.call(this.view)),t},_.prototype.clearCache=function(){void 0!==this.templateCache&&this.templateCache.clear()},_.prototype.parse=function(e,t){var i=this.templateCache,s=e+":"+(t||w.tags).join(":"),n=void 0!==i,l=n?i.get(s):void 0;return null==l&&(l=function(e,t){if(!e)return[];var i,s,n,l,r=!1,o=[],u=[],g=[],S=!1,_=!1,k="",O=0;function x(){if(S&&!_)for(;g.length;)delete u[g.pop()];else g=[];S=!1,_=!1}function T(e){if("string"==typeof e&&(e=e.split(f,2)),!a(e)||2!==e.length)throw new Error("Invalid tags: "+e);i=new RegExp(h(e[0])+"\\s*"),s=new RegExp("\\s*"+h(e[1])),n=new RegExp("\\s*"+h("}"+e[1]))}T(t||w.tags);for(var C,A,R,M,L,E,P=new b(e);!P.eos();){if(C=P.pos,R=P.scanUntil(i))for(var B=0,q=R.length;B<q;++B)l=M=R.charAt(B),function(e,t){return c.call(e,t)}(d,l)?(_=!0,r=!0,k+=" "):(g.push(u.length),k+=M),u.push(["text",M,C,C+1]),C+=1,"\n"===M&&(x(),k="",O=0,r=!1);if(!P.scan(i))break;if(S=!0,A=P.scan(y)||"name",P.scan(p),"="===A?(R=P.scanUntil(v),P.scan(v),P.scanUntil(s)):"{"===A?(R=P.scanUntil(n),P.scan(m),P.scanUntil(s),A="&"):R=P.scanUntil(s),!P.scan(s))throw new Error("Unclosed tag at "+P.pos);if(L=">"==A?[A,R,C,P.pos,k,O,r]:[A,R,C,P.pos],O++,u.push(L),"#"===A||"^"===A)o.push(L);else if("/"===A){if(!(E=o.pop()))throw new Error('Unopened section "'+R+'" at '+C);if(E[1]!==R)throw new Error('Unclosed section "'+E[1]+'" at '+C)}else"name"===A||"{"===A||"&"===A?_=!0:"="===A&&T(R)}if(x(),E=o.pop())throw new Error('Unclosed section "'+E[1]+'" at '+P.pos);return function(e){for(var t,i=[],s=i,n=[],l=0,r=e.length;l<r;++l)switch((t=e[l])[0]){case"#":case"^":s.push(t),n.push(t),s=t[4]=[];break;case"/":n.pop()[5]=t[2],s=n.length>0?n[n.length-1][4]:i;break;default:s.push(t)}return i}(function(e){for(var t,i,s=[],n=0,l=e.length;n<l;++n)(t=e[n])&&("text"===t[0]&&i&&"text"===i[0]?(i[1]+=t[1],i[3]=t[3]):(s.push(t),i=t));return s}(u))}(e,t),n&&i.set(s,l)),l},_.prototype.render=function(e,t,i,s){var n=this.getConfigTags(s),l=this.parse(e,n),r=t instanceof S?t:new S(t,void 0);return this.renderTokens(l,r,i,e,s)},_.prototype.renderTokens=function(e,t,i,s,n){for(var l,r,a,o="",h=0,u=e.length;h<u;++h)a=void 0,"#"===(r=(l=e[h])[0])?a=this.renderSection(l,t,i,s,n):"^"===r?a=this.renderInverted(l,t,i,s,n):">"===r?a=this.renderPartial(l,t,i,n):"&"===r?a=this.unescapedValue(l,t):"name"===r?a=this.escapedValue(l,t,n):"text"===r&&(a=this.rawValue(l)),void 0!==a&&(o+=a);return o},_.prototype.renderSection=function(e,t,i,s,n){var l=this,r="",h=t.lookup(e[1]);if(h){if(a(h))for(var u=0,c=h.length;u<c;++u)r+=this.renderTokens(e[4],t.push(h[u]),i,s,n);else if("object"==typeof h||"string"==typeof h||"number"==typeof h)r+=this.renderTokens(e[4],t.push(h),i,s,n);
2else if(o(h)){if("string"!=typeof s)throw new Error("Cannot use higher-order sections without the original template");null!=(h=h.call(t.view,s.slice(e[3],e[5]),(function(e){return l.render(e,t,i,n)})))&&(r+=h)}else r+=this.renderTokens(e[4],t,i,s,n);return r}},_.prototype.renderInverted=function(e,t,i,s,n){var l=t.lookup(e[1]);if(!l||a(l)&&0===l.length)return this.renderTokens(e[4],t,i,s,n)},_.prototype.indentPartial=function(e,t,i){for(var s=t.replace(/[^ \t]/g,""),n=e.split("\n"),l=0;l<n.length;l++)n[l].length&&(l>0||!i)&&(n[l]=s+n[l]);return n.join("\n")},_.prototype.renderPartial=function(e,t,i,s){if(i){var n=this.getConfigTags(s),l=o(i)?i(e[1]):i[e[1]];if(null!=l){var r=e[6],a=e[5],h=e[4],u=l;0==a&&h&&(u=this.indentPartial(l,h,r));var c=this.parse(u,n);return this.renderTokens(c,t,i,u,s)}}},_.prototype.unescapedValue=function(e,t){var i=t.lookup(e[1]);if(null!=i)return i},_.prototype.escapedValue=function(e,t,i){var s=this.getConfigEscape(i)||w.escape,n=t.lookup(e[1]);if(null!=n)return"number"==typeof n&&s===w.escape?String(n):s(n)},_.prototype.rawValue=function(e){return e[1]},_.prototype.getConfigTags=function(e){return a(e)?e:e&&"object"==typeof e?e.tags:void 0},_.prototype.getConfigEscape=function(e){return e&&"object"==typeof e&&!a(e)?e.escape:void 0};var w={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(e){k.templateCache=e},get templateCache(){return k.templateCache}},k=new _;w.clearCache=function(){return k.clearCache()},w.parse=function(e,t){return k.parse(e,t)},w.render=function(e,t,i,s){if("string"!=typeof e)throw new TypeError('Invalid template! Template should be a "string" but "'+(a(n=e)?"array":typeof n)+'" was given as the first argument for mustache#render(template, view, partials)');var n;return k.render(e,t,i,s)},w.escape=function(e){return String(e).replace(/[&<>"'`=\/]/g,(function(e){return g[e]}))},w.Scanner=b,w.Context=S,w.Writer=_;const O=w;class x{static addToHistory(e,t,i=!1){const s=new URL(window.location.href);if(i&&s.searchParams.has(e)){const i=s.searchParams.getAll(e),n=i.indexOf(String(t));n>-1?(s.searchParams.delete(e),delete i[n],i.forEach((t=>s.searchParams.append(e,t)))):s.searchParams.append(e,t)}else s.searchParams.delete(e),t&&s.searchParams.append(e,t);let n=s.searchParams.toString();n=n?`?${n}`:s.pathname,history.pushState({},document.title,n)}static getSearchParam(e){return new URL(window.location.href).searchParams.get(e)}static getSearchParams(e){return new URL(window.location.href).searchParams.getAll(e)}}class T{constructor(e){if(this.value=e,"object"==typeof this.value&&null!==this.value)return new Proxy(this.value,{get:(e,t,i)=>Reflect.get(e,t,i)})}}function C(e=null,t=null){return null===t?new T(e):null!==e?t(e):void 0}class A{static emit(e,t={}){const i=new CustomEvent(e,{detail:t});document.dispatchEvent(i)}}A.onSubmitGroupedSearch="onSubmitGroupedSearch",A.onGroupedSearch="onGroupedSearch",A.onBeforeGroupedSearch="onBeforeGroupedSearch",A.onAfterGroupedSearch="onAfterGroupedSearch",A.onArrowMovementGroupedSearch="onArrowMovementGroupedSearch",A.groupedSearchOpened="groupedSearchOpened",A.groupedSearchClosed="groupedSearchClosed",A.onSubmitSearch="onSubmitSearch",A.onSearch="onSearch",A.onBeforeSearch="onBeforeSearch",A.onAfterSearch="onAfterSearch",A.onArrowMovementSearch="onArrowMovementSearch",A.onForceResultBlur="onForceResultBlur",A.searchOpened="searchOpened",A.searchClosed="searchClosed",A.onResultRequest="onResultRequest",A.onBeforeResultRequest="onBeforeResultRequest",A.onAfterResultRequest="onAfterResultRequest",A.onPageChange="onPageChange",A.onClickResult="onClickResult",A.onAggsUpdate="onAggsUpdate",A.onAggregationValueChange="onAggregationValueChange",A.autocompleteBarFinished="autocompleteBarFinished",A.groupedSearchBarFinished="groupedSearchBarFinished",A.resultFinished="resultFinis
2hed",A.aggregationFinished="aggregationFinished",A.initializeSlider="initializeSlider",A.initializeSwitch="initializeSwitch";class R{constructor(e={}){this.template=null,this.values={},this.value={},this.collapsible=!1,this.defaultCollapsed=!1,this.hasActiveAggregation=!0,this.useSkeleton=null,this.setTitle(e.title||""),this.setClassTitle(this.getTitle()||""),this.setTemplate(e.template||""),this.setAttribute(e.attribute||this.getTitle()),this.setCollapsible(e.collapsible||this.getCollapsible()),this.setDefaultCollapsed(e.default_collapsed||this.getDefaultCollapsed()),this.setUseSkeleton(void 0!==C(e).use_skeleton?C(e).use_skeleton:this.getUseSkeleton()),this.setSkeletonTemplate(C(e).skeleton_template||this.getSkeletonTemplate())}getUseSkeleton(){return null===this.useSkeleton&&this.parent?this.parent.getUseSkeleton():this.useSkeleton}setUseSkeleton(e){return this.useSkeleton=e,this}setSkeletonTemplate(e){return this.skeletonTemplate=e,this}getSkeletonTemplate(){return this.skeletonTemplate}renderSkeleton(){return O.render(this.getSkeletonTemplate(),{class_title:this.getClassTitle()})}setClassTitle(e){return this.classTitle=e.replace(/ /g,"-"),this}getClassTitle(){return this.classTitle}setAttribute(e){return this.attribute=e,this.value.field||(this.value={field:this.attribute,value:"",is_aggregation:!0,exclude_from_search:!0}),this}getAttribute(){return this.attribute}setCollapsible(e){return this.collapsible=e,this}getCollapsible(){return this.collapsible}setDefaultCollapsed(e){return this.defaultCollapsed=e,this}getDefaultCollapsed(){return this.defaultCollapsed}setTitle(e){return this.title=e,this.setClassTitle(this.title),this}getTitle(){return this.title}setTemplate(e){return this.template=e,this}getTemplate(){return this.template}render(){return this.getTemplate()}executeJS(){}reset(){}}class M{constructor(e={}){this.setEl(e.el||"")}setEl(e){return this.el=e,this}getEl(){return this.el}getTemplate(){return this.template}setTemplate(e){return this.template=e,this}setClient(e){return this.client=e,this}render(e={}){const t=this.getTemplate();return document.createRange().createContextualFragment(t)}executeJS(){}build(e={}){const t=document.querySelectorAll(this.getEl()),i=this.render(e);t.forEach((e=>{e.innerHTML="",e.appendChild(i.cloneNode(!0))})),this.executeJS()}}class L extends R{constructor(e={}){super(e),this.discriminator="Switch",this.onValue="On",this.offValue="Off",this.setOnValue(e.on_value||this.getOnValue()),this.setOffValue(e.off_value||this.getOffValue()),this.setAttributeValue(e.attribute_value||this.getAttributeValue()),this.value={field:this.getAttribute(),value:"",is_aggregation:!0,exclude_from_search:!0}}setAttributeValue(e){return this.attributeValue=e,this}getAttributeValue(){return this.attributeValue.toString()}setOnValue(e){return this.onValue=e,this}getOnValue(){return this.onValue}setOffValue(e){return this.offValue=e,this}getOffValue(){return this.offValue}getTemplate(){return this.template?this.template:'<div class="needletail-aggregation needletail-aggregation-switch needletail-aggregation-switch-{{ class_title }} {{ collapsible }} {{ collapsed }}"> <div class="needletail-aggregation-switch-title"> {{ title }} </div> <div class="needletail-collapsible-container"> <span class="needletail-aggregation-boolean-label">{{ off_value }}</span> <label class="needletail-aggregation-switch-container"> <input type="checkbox" name="{{ name }}" value="{{ value }}" class="needletail-aggregation-switch-input needletail-aggregation-switch-input-{{ name }}"> <span class="needletail-aggregation-switch-slider"></span> </label> <span class="needletail-aggregation-boolean-label">{{ on_value }}</span> </div> </div>'}getSkeletonTemplate(){return this.skeletonTemplate?this.skeletonTemplate:'<div class="needletail-aggregation needletail-aggregation-switch needletail-aggregation-switch-{{ class_title }}"> <div class="needletail-skeleton needletail-skeleton-spacing needletail-skeleton-spacing--l"> <h3 class="needletail-skeleton-header"> <span class="needletail-skeleton-box" style="width:25%"></span> </h3> <span class="needletail-skeleton-box" style="width:40%"></span> </div> </div> '}renderSkeleton(){return O.render(this.getSkeletonTemplate(),{class_title:this.getClassTitle()})}render(){const e=this.getTemplate();return O.render(e,{title:this.getTitle(),class_title:this.getClassTitle(),name:this.getClassTitle(),on_value:this.getOnValue(),off_value:this.getOffValue(),collapsible:this.getCollapsible()?"needletail-collapsible":"",collapsed:this.getCollapsible()&&this.getDefaultCollapsed()?"needletail-collapsed":""})}executeJS(){this.getUseSkeleton()?document.addEventListener(A.onAfterResultRequest,(e=>{const t=this.render(),i=document.createRange().createContextualFragment(t);document.querySelectorAll(`.needletail-aggregation-switch-${this.getClassTitle()}`).forEach((e=>{e.replaceWith(i),this.initialize(),A.emit(A.initializeSwitch)}))})):(this.initialize(),document.addEventListener("DOMContentLoaded",(()=>{A.emit(A.initializeSwitch)})))}initialize(){const e=this.getTitle(),t=x.getSearchParam(e);document.querySelectorAll(`.needletail-aggregation-switch-input.needletail-aggregation-switch-input-${this.getClassTitle()}`).forEach((t=>{t.checked=x.getSearchParam(e)===this.getAttributeValue(),t.addEventListener("change",(()=>{this.handle(t)})),t.checked&&(this.hasActiveAggregation=!0,A.emit(A.onAggregationValueChange,{name:this.getAttribute(),hasActive:this.hasActiveAggregation}))}
2)),document.querySelectorAll(`.needletail-aggregation.needletail-aggregation-switch.needletail-aggregation-switch-${this.getClassTitle()}`).forEach((e=>{this.getCollapsible()&&e.querySelector(".needletail-aggregation-switch-title").addEventListener("click",(t=>{e.classList.contains("needletail-collapsed")?e.classList.remove("needletail-collapsed"):e.classList.add("needletail-collapsed")}))})),this.values[t]=t,this.value={field:this.getAttribute(),value:t,is_aggregation:!0}}handle(e,t=!1){const i=this.getAttributeValue();t||x.addToHistory(this.getTitle(),i,!0),this.values[i]?delete this.values[i]:this.values[i]=i,this.value={field:this.getAttribute(),value:this.values[i]?i:"",is_aggregation:!0},this.hasActiveAggregation=!0,this.values[i]||(this.value={field:this.getAttribute(),value:"",is_aggregation:!0,exclude_from_search:!0},this.hasActiveAggregation=!1),A.emit(A.onBeforeResultRequest,{}),A.emit(A.onAggregationValueChange,{name:this.getAttribute(),hasActive:this.hasActiveAggregation})}reset(){document.querySelectorAll(`.needletail-aggregation-switch-input.needletail-aggregation-switch-input-${this.getClassTitle()}`).forEach((e=>{e.checked&&(e.checked=!1,this.handle(e))}))}}class E extends R{constructor(e={}){super(e),this.discriminator="Checkbox",this.hideOnEmpty=!0,this.useShowMoreOptions=!0,this.showMoreOptionsText="Show more options",this.showLessOptionsText="Show less options",this.showMoreOptionsLoad=10,this.optionOrder=[],this.filterOptions=[],this.neverHideChecked=!0,this.showSelectedZero=!0,this.skeletonItemCount=10,this.setHideOnEmpty(e.hide_on_empty||this.getHideOnEmpty()),this.setUseShowMoreOptions(void 0!==C(e.show_more_options).use?e.show_more_options.use:this.getUseShowMoreOptions()),this.setShowMoreOptionsText(C(e.show_more_options).text?e.show_more_options.text:this.getShowMoreOptionsText()),this.setShowLessOptionsText(C(e.show_more_options).less_text?e.show_more_options.less_text:this.getShowLessOptionsText()),this.setShowMoreOptionsLoad(C(e.show_more_options).load?e.show_more_options.load:this.getShowMoreOptionsLoad()),this.setSkeletonItemCount(e.skeleton_item_count||this.getSkeletonItemCount()),this.setOptionOrder(e.option_order||this.getOptionOrder()),this.setFilterOptions(e.filter_options||this.getFilterOptions()),this.setNeverHideChecked(C(e.show_more_options).never_hide_checked?e.show_more_options.never_hide_checked:this.getNeverHideChecked()),this.setShowSelectedZero(void 0!==e.show_selected_zero?e.show_selected_zero:this.getShowSelectedZero()),this.value={field:this.getAttribute(),value:"",is_aggregation:!0,exclude_from_search:!0}}setSkeletonItemCount(e){return this.skeletonItemCount=e,this}getSkeletonItemCount(){return this.skeletonItemCount}setOptionOrder(e){return this.optionOrder=e.map((e=>e.toLowerCase())),this}getOptionOrder(){return this.optionOrder}setFilterOptions(e){return this.filterOptions=e.map((e=>e.toLowerCase())),this}getFilterOptions(){return this.filterOptions}setShowSelectedZero(e){return this.showSelectedZero=e,this}getShowSelectedZero(){return this.showSelectedZero}setNeverHideChecked(e){return this.neverHideChecked=e,this}getNeverHideChecked(){return this.neverHideChecked}setUseShowMoreOptions(e){return this.useShowMoreOptions=e,this}getUseShowMoreOptions(){return this.useShowMoreOptions}setShowMoreOptionsText(e){return this.showMoreOptionsText=e,this}getShowMoreOptionsText(){return this.showMoreOptionsText}setShowLessOptionsText(e){return this.showLessOptionsText=e,this}getShowLessOptionsText(){return this.showLessOptionsText}setShowMoreOptionsLoad(e){return this.showMoreOptionsLoad=e,this}getShowMoreOptionsLoad(){return this.showMoreOptionsLoad}getTemplate(){return this.template?this.template:'<div class="needletail-aggregation needletail-aggregation-checkbox needletail-aggregation-checkbox-{{ class_title }} {{ collapsible }} {{ collapsed }}"> <div class="needletail-aggregation-checkbox-title"> {{ title }} </div> <div class="needletail-collapsible-container"> {{#options}} <label class="needletail-aggregation-checkbox-option {{#show_more_options}}needletail-hidden{{/show_more_options}}"> <input type="checkbox" name="{{ name }}" value="{{ value }}" class="needletail-aggregation-checkbox-option-input needletail-aggregation-checkbox-option-input-{{ name }}"> <span class="needletail-aggregation-checkbox-option-checkmark"></span> <span class="needletail-aggregation-checkbox-option-label">{{ value }}</span> <span class="needletail-aggregation-checkbox-option-count">{{ count }}</span> </label> {{/options}} {{#show_more_options}} <div class="needletail-show-more-options">{{{ show_more_options_text }}}</div> <div class="needletail-show-less-options needletail-hidden">{{{ show_less_options_text }}}</div> {{/show_more_options}} </div> </div> '}setHideOnEmpty(e){return this.hideOnEmpty=e,this}getHideOnEmpty(){return this.hideOnEmpty}getSkeletonTemplate(){return this.skeletonTemplate?this.skeletonTemplate:'<div class="needletail-aggregation needletail-aggregation-checkbox needletail-aggregation-checkbox-{{ class_title }} needletail-skeleton needletail-skeleton-spacing needletail-skeleton-spacing--l"> <h3 class="needletail-skeleton-header needletail-skeleton-filter-heading"> <span class="needletail-skeleton-box" style="width:55%"></span> </h3> <div> {{#options}} <div class="needletail-skeleton-filter-item"> <span class="needletail-skeleton-box" style="width:16px"></span> <span class="needletail-skeleton-box" style="width:55%"></span> <span class="needletail-skeleton-box needletail-skeleton-filter-count" style="width:16px"></span> </div> {{/options}} </div> <div class="needletail-show-more-options needletail-hidden"></div> <div class="needletail-show-less-options needletail-hidden"></div> </div>'}renderSkeleton(){return O.render(this.getSkeletonTemplate(),{class_title:this.getClassTitle(),options:new Array(this.getSkeletonItemCount()).fill(null)})}render(e=[]){const t=this.getTemplate();return this.getOptionOrder()&&e.sort(((e,t)=>{let i=this.getOptionOrder().indexOf(e.value.toLowerCase()),s=this.getOptionOrder().indexOf(t.value.toLowerCase());return-1===i&&(i=9999),-1===s&&(s=9999),i-s})),this.getFilterOptions().length>0&&(e=e.filter((e=>this.getFilterOptions().indexOf(e.value.toLowerCase())>-1))),O.render(t,{title:this.getTitle(),class_title:this.getClassTitle(),options:e,collapsible:this.getCollapsible()?"needletail-collapsible":"",collapsed:this.getCollapsible()&&this.getDefaultCollapsed()?"needletail-collapsed":"",show_more_options:this.getUseShowMoreOptions(),show_more_options_text:this.getShowMoreOptionsText(),show_less_options_text:this.getShowLessOptionsText(),checked_count:x.getSearchParams(this.getTitle()).length})}executeJS(){const e=this.getTitle();document.addEventListener(A.onAggsUpdate,(t=>{if(t.detail[this.getAttribute()]){const i=[];
2t.detail[this.getAttribute()].forEach((e=>{i.push(Object.assign({name:this.getClassTitle()},e))}));const s=this.render(i),n=document.createRange().createContextualFragment(s);let l=!1,r=!1;document.querySelectorAll(`.needletail-aggregation.needletail-aggregation-checkbox.needletail-aggregation-checkbox-${this.getClassTitle()}`).forEach((e=>{l=e.classList.contains("needletail-collapsed");const t=e.querySelector(".needletail-show-more-options"),i=e.querySelector(".needletail-show-less-options");this.getUseShowMoreOptions()&&(r=!t.classList.contains("needletail-hidden"),t.classList.contains("needletail-hidden")&&i.classList.contains("needletail-hidden")&&(r=!0)),e.replaceWith(n.cloneNode(!0))})),document.querySelectorAll(`.needletail-aggregation.needletail-aggregation-checkbox.needletail-aggregation-checkbox-${this.getClassTitle()}`).forEach((e=>{if(this.getCollapsible()&&(e.querySelector(".needletail-aggregation-checkbox-title").addEventListener("click",(t=>{e.classList.contains("needletail-collapsed")?e.classList.remove("needletail-collapsed"):e.classList.add("needletail-collapsed")})),l&&e.classList.add("needletail-collapsed")),e.setAttribute("data-option-count",i.length.toString()),this.getHideOnEmpty()&&(0===i.length?e.classList.add("needletail-empty"):e.classList.remove("needletail-empty")),this.getUseShowMoreOptions()){const t=e.querySelector(".needletail-show-more-options"),i=e.querySelector(".needletail-show-less-options"),s=e.querySelectorAll(".needletail-aggregation-checkbox-option");s.length<=this.getShowMoreOptionsLoad()&&t.classList.add("needletail-hidden");const n=this.getShowMoreOptionsLoad()>s.length?s.length:this.getShowMoreOptionsLoad();for(let e=0;e<n;e++)s.item(e).classList.remove("needletail-hidden");t.addEventListener("click",(e=>{t.classList.add("needletail-hidden"),i.classList.remove("needletail-hidden");for(let e=this.getShowMoreOptionsLoad();e<s.length;e++)s.item(e).classList.remove("needletail-hidden")})),i.addEventListener("click",(e=>{i.classList.add("needletail-hidden"),t.classList.remove("needletail-hidden");for(let e=this.getShowMoreOptionsLoad();e<s.length;e++){const t=s.item(e);t.querySelector(".needletail-aggregation-checkbox-option-input").checked&&this.getNeverHideChecked()||t.classList.add("needletail-hidden")}})),!r&&s.length>this.getShowMoreOptionsLoad()&&t.click()}})),document.querySelectorAll(`.needletail-aggregation-checkbox-option-input.needletail-aggregation-checkbox-option-input-${this.getClassTitle()}`).forEach((e=>{e.addEventListener("change",(()=>{this.handle(e)}))}));const a=x.getSearchParams(e);a&&a.forEach((e=>{const t=document.querySelectorAll(`.needletail-aggregation-checkbox-option-input-${this.getClassTitle()}[value='${e}']`);if(0===t.length){if(this.getShowSelectedZero()){const t=e.replace(/(<([^>]+)>)/gi,"");if(t){const e=document.querySelectorAll(`.needletail-aggregation-checkbox-${this.getClassTitle()} .needletail-aggregation-checkbox-option`),i=e[e.length-1],s=i.cloneNode(!0);i.after(s);const n=document.querySelectorAll(`.needletail-aggregation-checkbox-${this.getClassTitle()} .needletail-aggregation-checkbox-option`),l=n[n.length-1],r=l.querySelector(".needletail-aggregation-checkbox-option-label"),a=l.querySelector(".needletail-aggregation-checkbox-option-count"),o=l.querySelector(".needletail-aggregation-checkbox-option-input");r&&(r.innerHTML=t),a&&(a.innerHTML="0"),o&&(o.setAttribute("value",t),o.checked=!0,this.values[t]=t,o.addEventListener("change",(()=>{this.handle(o)})))}}}else t.forEach((e=>{e.checked=!0,e.parentElement.classList.remove("needletail-hidden")}))}))}else this.getHideOnEmpty()&&document.querySelectorAll(`.needletail-aggregation.needletail-aggregation-checkbox.needletail-aggregation-checkbox-${this.getClassTitle()}`).forEach((e=>{e.classList.add("needletail-empty")}))}));const t=x.getSearchParams(e);t&&(t.forEach((e=>{e&&(this.values[e]=e)})),this.value={field:this.getAttribute(),value:Object.keys(this.values),is_aggregation:!0},this.hasActiveAggregation=!0,0===Object.keys(this.values).length&&(this.hasActiveAggregation=!1,this.value={field:this.getAttribute(),value:"",is_aggregation:!0,exclude_from_search:!0}),A.emit(A.onAggregationValueChange,{name:this.getAttribute(),hasActive:this.hasActiveAggregation}))}handle(e,t=!1){t||x.addToHistory(this.getTitle(),e.value,!0),this.values[e.value]?delete this.values[e.value]:this.values[e.value]=e.value,this.value={field:this.getAttribute(),value:Object.keys(this.values),is_aggregation:!0},this.hasActiveAggregation=!0,0===Object.keys(this.values).length&&(this.value={field:this.getAttribute(),value:"",is_aggregation:!0,exclude_from_search:!0},this.hasActiveAggregation=!1),A.emit(A.onBeforeResultRequest,{}),A.emit(A.onAggregationValueChange,{name:this.getAttribute(),hasActive:this.hasActiveAggregation})}reset(){document.querySelectorAll(`.needletail-aggregation-checkbox-option-input.needletail-aggregation-checkbox-option-input-${this.getClassTitle()}`).forEach((e=>{e.checked&&(e.checked=!1,this.handle(e))}))}}class P extends R{constructor(e={}){super(e),this.discriminator="Radio",this.hideOnEmpty=!0,this.useShowMoreOptions=!0,this.showMoreOptionsText="Show more options",this.showLessOptionsText="Show less options",this.showMoreOptionsLoad=10,this.optionOrder=[],this.filterOptions=[],this.skeletonItemCount=10,this.setHideOnEmpty(e.hide_on_empty||this.getHideOnEmpty()),this.setUseShowMoreOptions(void 0!==C(e.show_more_options).use?e.show_more_options.use:this.getUseShowMoreOptions()),this.setShowMoreOptionsText(C(e.show_more_options).text?e.show_more_options.text:this.getShowMoreOptionsText()),this.setShowLessOptionsText(C(e.show_more_options).less_text?e.show_more_options.less_text:this.getShowLessOptionsText()),this.setShowMoreOptionsLoad(C(e.show_more_options).load?e.show_more_options.load:this.getShowMoreOptionsLoad()),this.setSkeletonItemCount(e.skeleton_item_count||this.get
2SkeletonItemCount()),this.setOptionOrder(e.option_order||this.getOptionOrder()),this.setFilterOptions(e.filter_options||this.getFilterOptions()),this.value={field:this.getAttribute(),value:"",is_aggregation:!0,exclude_from_search:!0}}setSkeletonItemCount(e){return this.skeletonItemCount=e,this}getSkeletonItemCount(){return this.skeletonItemCount}setOptionOrder(e){return this.optionOrder=e.map((e=>e.toLowerCase())),this}getOptionOrder(){return this.optionOrder}setFilterOptions(e){return this.filterOptions=e.map((e=>e.toLowerCase())),this}getFilterOptions(){return this.filterOptions}setUseShowMoreOptions(e){return this.useShowMoreOptions=e,this}getUseShowMoreOptions(){return this.useShowMoreOptions}setShowMoreOptionsText(e){return this.showMoreOptionsText=e,this}getShowMoreOptionsText(){return this.showMoreOptionsText}setShowLessOptionsText(e){return this.showLessOptionsText=e,this}getShowLessOptionsText(){return this.showLessOptionsText}setShowMoreOptionsLoad(e){return this.showMoreOptionsLoad=e,this}getShowMoreOptionsLoad(){return this.showMoreOptionsLoad}getTemplate(){return this.template?this.template:'<div class="needletail-aggregation needletail-aggregation-radio needletail-aggregation-radio-{{ class_title }} {{ collapsible }} {{ collapsed }}"> <div class="needletail-aggregation-radio-title"> {{ title }} </div> <div class="needletail-collapsible-container"> {{#options}} <label class="needletail-aggregation-radio-option {{#show_more_options}}needletail-hidden{{/show_more_options}}"> <input type="radio" name="{{ name }}" value="{{ value }}" class="needletail-aggregation-radio-option-input needletail-aggregation-radio-option-input-{{ name }}"> <span class="needletail-aggregation-radio-option-checkmark"></span> <span class="needletail-aggregation-radio-option-label">{{ value }}</span> <span class="needletail-aggregation-radio-option-count">{{ count }}</span> </label> {{/options}} {{#show_more_options}} <div class="needletail-show-more-options">{{{ show_more_options_text }}}</div> <div class="needletail-show-less-options needletail-hidden">{{{ show_less_options_text }}}</div> {{/show_more_options}} </div> </div> '}setHideOnEmpty(e){return this.hideOnEmpty=e,this}getHideOnEmpty(){return this.hideOnEmpty}getSkeletonTemplate(){return this.skeletonTemplate?this.skeletonTemplate:'<div class="needletail-aggregation needletail-aggregation-radio needletail-aggregation-radio-{{ class_title }} needletail-skeleton needletail-skeleton-spacing needletail-skeleton-spacing--l"> <h3 class="needletail-skeleton-header needletail-skeleton-filter-heading"> <span class="needletail-skeleton-box" style="width:55%"></span> </h3> <div> {{#options}} <div class="needletail-skeleton-filter-item"> <span class="needletail-skeleton-box" style="width:16px"></span> <span class="needletail-skeleton-box" style="width:55%"></span> <span class="needletail-skeleton-box needletail-skeleton-filter-count" style="width:16px"></span> </div> {{/options}} </div> <div class="needletail-show-more-options needletail-hidden"></div> <div class="needletail-show-less-options needletail-hidden"></div> </div>'}renderSkeleton(){return O.render(this.getSkeletonTemplate(),{class_title:this.getClassTitle(),options:new Array(this.getSkeletonItemCount()).fill(null)})}render(e=[]){const t=this.getTemplate();return this.getOptionOrder()&&e.sort(((e,t)=>{let i=this.getOptionOrder().indexOf(e.value.toLowerCase()),s=this.getOptionOrder().indexOf(t.value.toLowerCase());return-1===i&&(i=9999),-1===s&&(s=9999),i-s})),this.getFilterOptions().length>0&&(e=e.filter((e=>this.getFilterOptions().indexOf(e.value.toLowerCase())>-1))),O.render(t,{title:this.getTitle(),class_title:this.getClassTitle(),options:e,collapsible:this.getCollapsible()?"needletail-collapsible":"",collapsed:this.getCollapsible()&&this.getDefaultCollapsed()?"needletail-collapsed":"",show_more_options:this.getUseShowMoreOptions(),show_more_options_text:this.getShowMoreOptionsText(),show_less_options_text:this.getShowLessOptionsText()})}executeJS(){const e=this.getTitle(),t=x.getSearchParam(e);document.addEventListener(A.onAggsUpdate,(t=>{if(t.detail[this.getAttribute()]){const i=[];
2t.detail[this.getAttribute()].forEach((e=>{i.push(Object.assign({name:this.getClassTitle()},e))}));const s=this.render(i),n=document.createRange().createContextualFragment(s);let l=!1,r=!1;document.querySelectorAll(`.needletail-aggregation.needletail-aggregation-radio.needletail-aggregation-radio-${this.getClassTitle()}`).forEach((e=>{l=e.classList.contains("needletail-collapsed");const t=e.querySelector(".needletail-show-more-options"),i=e.querySelector(".needletail-show-less-options");this.getUseShowMoreOptions()&&(r=!t.classList.contains("needletail-hidden"),t.classList.contains("needletail-hidden")&&i.classList.contains("needletail-hidden")&&(r=!0)),e.replaceWith(n.cloneNode(!0))})),document.querySelectorAll(`.needletail-aggregation.needletail-aggregation-radio.needletail-aggregation-radio-${this.getClassTitle()}`).forEach((e=>{if(this.getCollapsible()&&(e.querySelector(".needletail-aggregation-radio-title").addEventListener("click",(t=>{e.classList.contains("needletail-collapsed")?e.classList.remove("needletail-collapsed"):e.classList.add("needletail-collapsed")})),l&&e.classList.add("needletail-collapsed")),e.setAttribute("data-option-count",i.length.toString()),this.getHideOnEmpty()&&(0===i.length?e.classList.add("needletail-empty"):e.classList.remove("needletail-empty")),this.getUseShowMoreOptions()){const t=e.querySelector(".needletail-show-more-options"),i=e.querySelector(".needletail-show-less-options"),s=e.querySelectorAll(".needletail-aggregation-radio-option");s.length<=this.getShowMoreOptionsLoad()&&t.classList.add("needletail-hidden");const n=this.getShowMoreOptionsLoad()>s.length?s.length:this.getShowMoreOptionsLoad();for(let e=0;e<n;e++)s.item(e).classList.remove("needletail-hidden");t.addEventListener("click",(e=>{t.classList.add("needletail-hidden"),i.classList.remove("needletail-hidden");for(let e=this.getShowMoreOptionsLoad();e<s.length;e++)s.item(e).classList.remove("needletail-hidden")})),i.addEventListener("click",(e=>{i.classList.add("needletail-hidden"),t.classList.remove("needletail-hidden");for(let e=this.getShowMoreOptionsLoad();e<s.length;e++)s.item(e).classList.add("needletail-hidden")})),!r&&s.length>this.getShowMoreOptionsLoad()&&t.click()}})),document.querySelectorAll(`.needletail-aggregation-radio-option-input.needletail-aggregation-radio-option-input-${this.getClassTitle()}`).forEach((e=>{e.addEventListener("change",(()=>{this.handle(e)}))})),document.querySelectorAll(`.needletail-aggregation-radio-option-input.needletail-aggregation-radio-option-input-${this.getClassTitle()}`).forEach((t=>{t.checked=x.getSearchParam(e)===t.value,t.addEventListener("change",(()=>{this.handle(t)}))}))}})),this.value={field:this.getAttribute(),value:t,is_aggregation:!0}}handle(e,t=!1,i=!1){t||x.addToHistory(this.getTitle(),e.value,i),i&&(e.value=""),this.value={field:this.getAttribute(),value:e.value,is_aggregation:!0},this.hasActiveAggregation=!0,e.value||(this.value={field:this.getAttribute(),value:"",is_aggregation:!0,exclude_from_search:!0},this.hasActiveAggregation=!1),A.emit(A.onBeforeResultRequest,{}),A.emit(A.onAggregationValueChange,{name:this.getAttribute(),hasActive:this.hasActiveAggregation})}reset(){document.querySelectorAll(`.needletail-aggregation-radio-option-input.needletail-aggregation-radio-option-input-${this.getClassTitle()}`).forEach((e=>{e.checked&&(e.checked=!1,this.handle(e,!1,!0))}))}}var B=i(279),q=i.n(B);class D extends R{constructor(e={}){super(e),this.discriminator="Range",this.range=!1,this.type="to",this.allowedTypes=["to","from","from:to"],this.inputs="top",this.allowedInputs=["top","bottom"],this.displayOnly=!1,this.setRange(e.min||0,e.max||10),this.setDefaultValue("number"==typeof e.default_value?e.default_value:5),this.setRangeSlider(void 0!==e.range?e.range:this.getRangeSlider()),this.setDefaultRangeMin(e.default_range_min||this.getMin()),this.setDefaultRangeMax(e.default_range_max||this.getMax()),this.setType(e.type||this.getType()),this.setInputs(e.inputs||this.getInputs()),this.setDisplayOnly(void 0!==e.display_only?e.display_only:this.getDisplayOnly());let t=this.getDefaultValue().toString();this.getRangeSlider()&&(this.setType("from:to"),t=this.getDefaultRangeMin()+":"+this.getDefaultRangeMax()),this.value={field:this.getAttribute(),value:t,type:this.getType(),is_aggregation:!0,exclude_from_search:!0},this.ranges={},this.elements={}}setDisplayOnly(e){return this.displayOnly=e,this}getDisplayOnly(){return this.displayOnly}setType(e){return-1===this.allowedTypes.indexOf(e)?e="to":"from:to"!==e||this.getRangeSlider()||
2(e="to"),this.type=e,this}getType(){return this.type}setInputs(e){return-1===this.allowedInputs.indexOf(e)&&(e="top"),this.inputs=e,this}getInputs(){return this.inputs}setRangeSlider(e){return this.range=e,this}getRangeSlider(){return this.range}setMin(e){return this.min=e,this}getMin(){return this.min}setMax(e){return this.max=e,this}getMax(){return this.max}setDefaultValue(e){return this.defaultValue=e,this}getDefaultValue(){return this.defaultValue}setDefaultRangeMin(e){return this.defaultRangeMin=e,this}getDefaultRangeMin(){return this.defaultRangeMin}setDefaultRangeMax(e){return this.defaultRangeMax=e,this}getDefaultRangeMax(){return this.defaultRangeMax}setRange(e,t){return this.setMin(e),this.setMax(t),this}getTemplate(){return this.template?this.template:this.getRangeSlider()?'<div class="needletail-aggregation needletail-aggregation-slider needletail-aggregation-slider-{{ class_title }} {{ collapsible }} {{ collapsed }}"> <div class="needletail-aggregation-slider-title"> {{ title }} </div> <div class="needletail-collapsible-container"> <div class="needletail-aggregation-slider-container__range"> {{#inputs_top}} <div class="needletail-aggregation-slider-inputs top"> <input type="number" class="needletail-aggregation-slider-input-min {{ display_only }}"> <input type="number" class="needletail-aggregation-slider-input-max {{ display_only }}"> </div> {{/inputs_top}} <div class="needletail-aggregation-slider-range-container"> <div class="needletail-aggregation-slider-range"> <div class="needletail-aggregation-slider-range-left"></div> <div class="needletail-aggregation-slider-range-divider"></div> <div class="needletail-aggregation-slider-range-right"></div> </div> </div> {{#inputs_bottom}} <div class="needletail-aggregation-slider-inputs bottom"> <input type="number" class="needletail-aggregation-slider-input-min {{ display_only }}"> <input type="number" class="needletail-aggregation-slider-input-max {{ display_only }}"> </div> {{/inputs_bottom}} </div> </div> </div>':'<div class="needletail-aggregation needletail-aggregation-slider needletail-aggregation-slider-{{ class_title }} {{ collapsible }} {{ collapsed }}"> <div class="needletail-aggregation-slider-title"> {{ title }} </div> <div class="needletail-collapsible-container"> <div class="needletail-aggregation-slider-container"> <input type="range" name="{{ name }}" min="{{ min }}" max="{{ max }}" value="{{ value }}" class="needletail-aggregation-slider-input needletail-aggregation-slider-input-{{ name }}"> </div> </div> </div>'}getSkeletonTemplate(){return this.skeletonTemplate?this.skeletonTemplate:'<div class="needletail-aggregation needletail-aggregation-slider needletail-aggregation-slider-{{ class_title }}"> <div class="needletail-skeleton needletail-skeleton-spacing needletail-skeleton-spacing--l"> <h3 class="needletail-skeleton-header"> <span class="needletail-skeleton-box" style="width:55%"></span> </h3> <span class="needletail-skeleton-box" style="width:100%"></span> </div> </div> '}renderSkeleton(){return O.render(this.getSkeletonTemplate(),{class_title:this.getClassTitle()})}render(){const e=this.getTemplate();return O.render(e,{title:this.getTitle(),class_title:this.getClassTitle(),name:this.getClassTitle(),min:this.getMin(),max:this.getMax(),value:this.getDefaultValue(),collapsible:this.getCollapsible()?"needletail-collapsible":"",collapsed:this.getCollapsible()&&this.getDefaultCollapsed()?"needletail-collapsed":"",inputs_bottom:"bottom"===this.getInputs(),inputs_top:"top"===this.getInputs(),display_only:this.getDisplayOnly()?"display-only":""})}executeJS(){this.getUseSkeleton()?document.addEventListener(A.onAfterResultRequest,(e=>{const t=this.render(),i=document.createRange().createContextualFragment(t);document.querySelectorAll(`.needletail-aggregation-slider-${this.getClassTitle()}`).forEach((e=>{e.replaceWith(i),this.initialize(),A.emit(A.initializeSlider)}))})):(this.initialize(),document.addEventListener("DOMContentLoaded",(()=>{A.emit(A.initializeSlider)})))}initialize(){const e=this.getTitle(),t=x.getSearchParam(e);
2document.querySelectorAll(`.needletail-aggregation-slider-input.needletail-aggregation-slider-input-${this.getClassTitle()}`).forEach((e=>{e.value=t||this.getDefaultValue().toString(),document.addEventListener(A.initializeSlider,(()=>{this.handle(e,!0)})),e.addEventListener("change",(()=>{this.handle(e)}))})),document.querySelectorAll(".needletail-aggregation-slider-container__range").forEach((t=>{document.addEventListener(A.initializeSlider,(()=>{this.elements[this.getClassTitle()]={slider:t.querySelector(".needletail-aggregation-slider-range"),inputMin:t.querySelector(".needletail-aggregation-slider-input-min"),inputMax:t.querySelector(".needletail-aggregation-slider-input-max"),leftSlider:t.querySelector(".needletail-aggregation-slider-range-left"),rightSlider:t.querySelector(".needletail-aggregation-slider-range-right"),divider:t.querySelector(".needletail-aggregation-slider-range-divider")};const i=this.elements[this.getClassTitle()].slider,s=this.elements[this.getClassTitle()].inputMin,n=this.elements[this.getClassTitle()].inputMax,l=this.elements[this.getClassTitle()].leftSlider,r=this.elements[this.getClassTitle()].rightSlider,a=this.elements[this.getClassTitle()].divider;s.value=x.getSearchParam(e+"[min]")||this.getDefaultRangeMin().toString(),n.value=x.getSearchParam(e+"[max]")||this.getDefaultRangeMax().toString(),[s,n].forEach((e=>{e.min=this.getMin().toString(),e.max=this.getMax().toString()})),this.ranges[this.getClassTitle()]=this.calculatePositions(i,l,r),window.onresize=e=>{this.ranges[this.getClassTitle()]=this.calculatePositions(i,l,r),this.calculateDivider(a,l,r)},s.addEventListener("change",q()((()=>{parseInt(s.value)<this.getMin()?s.value=this.getMin().toString():parseInt(s.value)>parseInt(n.value)&&(s.value=n.value);const e=100/this.getMax()*parseInt(s.value);l.style.left=e+"%",n.min=s.value,this.calculateDivider(a,l,r),this.handleRange(s,n)}),200)),n.addEventListener("change",q()((()=>{parseInt(n.value)>this.getMax()?n.value=this.getMax().toString():parseInt(n.value)<parseInt(s.value)&&(n.value=s.value);const e=100/this.getMax()*parseInt(n.value);r.style.left=`${e}%`,s.max=n.value,this.calculateDivider(a,l,r),this.handleRange(s,n)}),200)),l.addEventListener("mousedown",(e=>{document.onmousemove=e=>{e.preventDefault(),this.moveLeft(e)},document.onmouseup=e=>{document.onmouseup=null,document.onmousemove=null}})),l.addEventListener("touchstart",(e=>{document.ontouchmove=e=>{e.preventDefault(),this.moveLeft(e)},document.ontouchend=e=>{document.ontouchend=null,document.ontouchmove=null}})),r.addEventListener("mousedown",(e=>{document.onmousemove=e=>{e.preventDefault(),this.moveRight(e)},document.onmouseup=e=>{document.onmouseup=null,document.onmousemove=null}})),r.addEventListener("touchstart",(e=>{document.ontouchmove=e=>{e.preventDefault(),this.moveRight(e)},document.ontouchend=e=>{document.ontouchend=null,document.ontouchmove=null}})),x.getSearchParam(e+"[min]")&&(l.style.left=100/this.getMax()*parseInt(s.value)+"%"),x.getSearchParam(e+"[max]")&&(r.style.left=100/this.getMax()*parseInt(n.value)+"%"),this.calculateDivider(a,l,r)}))})),document.querySelectorAll(`.needletail-aggregation.needletail-aggregation-slider.needletail-aggregation-slider-${this.getClassTitle()}`).forEach((e=>{this.getCollapsible()&&e.querySelector(".needletail-aggregation-slider-title").addEventListener("click",(t=>{e.classList.contains("needletail-collapsed")?e.classList.remove("needletail-collapsed"):e.classList.add("needletail-collapsed")}))}))}handle(e,t=!1){t||x.addToHistory(this.getTitle(),e.value),this.value={field:this.getAttribute(),value:e.value,type:this.getType(),is_aggregation:!0},this.hasActiveAggregation=!0,e.value||(this.value={field:this.getAttribute(),value:this.getDefaultValue(),type:this.getType(),is_aggregation:!0,exclude_from_search:!0},this.hasActiveAggregation=!1),A.emit(A.onBeforeResultRequest,{}),A.emit(A.onAggregationValueChange,{name:this.getAttribute(),hasActive:this.hasActiveAggregation})}handleRange(e,t,i=!1){i||(x.addToHistory(this.getTitle()+"[min]",e.value),x.addToHistory(this.getTitle()+"[max]",t.value)),this.value={field:this.getAttribute(),value:e.value+":"+t.value,type:this.getType(),is_aggregation:!0},this.hasActiveAggregation=!0,e.value||t.value||(this.value={field:this.getAttribute(),value:this.getMin()+":"+this.getMax(),type:this.getType(),is_aggregation:!0,exclude_from_search:!0},this.hasActiveAggregation=!1),A.emit(A.onBeforeResultRequest,{}),A.emit(A.onAggregationValueChange,{name:this.getAttribute(),hasActive:this.hasActiveAggregation})}
2reset(){document.querySelectorAll(`.needletail-aggregation-slider-input.needletail-aggregation-slider-input-${this.getClassTitle()}`).forEach((e=>{e.value=this.getDefaultValue().toString(),this.handle(e),x.addToHistory(this.getTitle(),e.value,!0),A.emit(A.onAggregationValueChange,{name:this.getAttribute(),hasActive:!1})})),document.querySelectorAll(".needletail-aggregation-slider-container__range").forEach((e=>{const t=this.elements[this.getClassTitle()].inputMin,i=this.elements[this.getClassTitle()].inputMax,s=this.elements[this.getClassTitle()].leftSlider,n=this.elements[this.getClassTitle()].rightSlider,l=this.elements[this.getClassTitle()].divider;t.value=this.getDefaultRangeMin().toString(),i.value=this.getDefaultRangeMax().toString(),s.style.left=100/this.getMax()*parseInt(t.value)+"%",n.style.left=100/this.getMax()*parseInt(i.value)+"%",this.handleRange(t,i),this.calculateDivider(l,s,n),x.addToHistory(this.getTitle()+"[min]",t.value,!0),x.addToHistory(this.getTitle()+"[max]",i.value,!0),A.emit(A.onAggregationValueChange,{name:this.getAttribute(),hasActive:!1}),this.ranges[this.getClassTitle()].leftPosition=this.ranges[this.getClassTitle()].startLeft,this.ranges[this.getClassTitle()].rightPosition=this.ranges[this.getClassTitle()].startRight}))}calculatePositions(e,t,i){const s=e.getBoundingClientRect().x,n=e.getBoundingClientRect().x+e.offsetWidth;return{startLeft:s,startRight:n,leftPosition:t.getBoundingClientRect().x,rightPosition:i.getBoundingClientRect().x,total:n-s}}calculateDivider(e,t,i){const s=i.offsetLeft-t.offsetLeft;e.style.width=s+"px",e.style.left=`${t.style.left}`}moveRight(e){var t;const i=null!==(t=e.clientX)&&void 0!==t?t:e.touches[0].clientX,s=this.elements[this.getClassTitle()].inputMax,n=this.elements[this.getClassTitle()].leftSlider,l=this.elements[this.getClassTitle()].rightSlider,r=this.elements[this.getClassTitle()].divider;if(!this.ranges[this.getClassTitle()])return;let a=i-l.offsetWidth;a<this.ranges[this.getClassTitle()].leftPosition?a=this.ranges[this.getClassTitle()].leftPosition:a>this.ranges[this.getClassTitle()].startRight&&(a=this.ranges[this.getClassTitle()].startRight),this.ranges[this.getClassTitle()].rightPosition=a;const o=100/this.ranges[this.getClassTitle()].total*(a-this.ranges[this.getClassTitle()].startLeft);l.style.left=`${o}%`,s.value=Math.round(this.getMax()/100*o+this.getMin()).toString(),s.dispatchEvent(new Event("change")),this.calculateDivider(r,n,l)}moveLeft(e){var t;const i=null!==(t=e.clientX)&&void 0!==t?t:e.touches[0].clientX,s=this.elements[this.getClassTitle()].inputMin,n=this.elements[this.getClassTitle()].leftSlider,l=this.elements[this.getClassTitle()].rightSlider,r=this.elements[this.getClassTitle()].divider;if(!this.ranges[this.getClassTitle()])return;let a=i-n.offsetWidth/2;a>this.ranges[this.getClassTitle()].rightPosition?a=this.ranges[this.getClassTitle()].rightPosition:a<this.ranges[this.getClassTitle()].startLeft&&(a=this.ranges[this.getClassTitle()].startLeft),this.ranges[this.getClassTitle()].leftPosition=a;const o=100/this.ranges[this.getClassTitle()].total*(a-this.ranges[this.getClassTitle()].startLeft);n.style.left=o+"%",s.value=Math.round(this.getMax()/100*o+this.getMin()).toString(),s.dispatchEvent(new Event("change")),this.calculateDivider(r,n,l)}}var U=function(e,t,i,s){return new(i||(i=Promise))((function(n,l){function r(e){try{o(s.next(e))}catch(e){l(e)}}function a(e){try{o(s.throw(e))}catch(e){l(e)}}function o(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}o((s=s.apply(e,t||[])).next())}))};class I extends M{constructor(e={}){super(e),this.discriminator="AutocompleteBar",this.debounce=!0,this.debounceWait=200,this.debounceUrlWait=2e3,this.query="autocompleteBar",this.inUrl=!0,this.placeholder="Start typing to search",this.noResultMessage="No results where found",this.selectedResult=-1,this.value={},this.size=10,this.minimumCharacters=3,this.groupBy="",this.sortBy="",this.sortDirection="asc",this.showResults=!0,this.useInResults=!0,this.searchOnContentLoaded=!0,this.liveResults=!1,this.initialInput=!0,this.forceUseOfResult=!1,this.skipForceResults=0,this.fillInputOnClick=!1,this.showBucket=!1,this.sortMode="min",this.allowedDirections=["asc","desc"],this.setUseDebounce(void 0!==C(e.debounce).use?e.debounce.use:this.getUseDebounce()),this.setDebounceWait(C(e.debounce).wait||this.getDebounceWait()),this.setDebounceUrlWait(C(e.debounce).url_wait||this.getDebounceUrlWait()),this.setInUrl(void 0!==e.in_url?e.in_url:this.getInUrl()),this.setQuery(e.query||this.getQuery()),this.setAttribute(C(e.search).attribute||""),this.setAttributes(C(e.search).attributes||""),this.setBuckets(C(e.search).buckets||[]),this.setPlaceholder(e.placeholder||this.getPlaceholder()),this.setNoResultMessage(e.no_result_message||this.getNoResultMessage()),this.setSize(C(e.search).size||this.get
2Size()),this.setGroupBy(C(e.search).group_by||""),this.setSortBy(C(e.search).sort_by||""),this.setSortDirection(C(e.search).sort_direction||this.getSortDirection()),this.setSortMode(C(e.search).sort_mode||this.getSortMode()),this.setMinimumCharacters(void 0!==e.minimum_characters?e.minimum_characters:this.getMinimumCharacters()),this.setShowResults(void 0!==e.show_results?e.show_results:this.getShowResults()),this.setForceUseOfResult(void 0!==e.force_use_of_result?e.force_use_of_result:this.getForceUseOfResult()),this.setUseInResults(void 0!==e.use_in_results?e.use_in_results:this.getUseInResults()),this.setSearchOnContentLoaded(void 0!==e.search_on_content_loaded?e.search_on_content_loaded:this.getSearchOnContentLoaded()),this.setLiveResults(void 0!==e.live_results?e.live_results:this.getLiveResults()),this.setInitialInput(void 0!==e.initial_input?e.initial_input:this.getInitialInput()),this.setFillInputOnClick(void 0!==e.fill_input_on_click?e.fill_input_on_click:this.getFillInputOnClick()),this.setShowBucket(void 0!==C(e.search).show_bucket?e.search.show_bucket:this.getShowBucket()),this.setBucketMapping(C(e.search).bucket_mapping||this.getBucketMapping()),this.getInitialInput()&&(this.skipForceResults=1)}setMinimumCharacters(e){return this.minimumCharacters=e,this}getMinimumCharacters(){return this.minimumCharacters}setSize(e){return this.size=e,this}getSize(){return this.size}setPlaceholder(e){return this.placeholder=e,this}getPlaceholder(){return this.placeholder}setNoResultMessage(e){return this.noResultMessage=e,this}getNoResultMessage(){return this.noResultMessage}setAttribute(e){return this.attribute=e,this}getAttribute(){return this.attribute}setAttributes(e){return""===this.attribute&&(this.attribute=e),this}getAttributes(){return this.attribute}setBuckets(e){return this.buckets=e,this}getBuckets(){return this.buckets}setUseDebounce(e=!0){return this.debounce=e,this}getUseDebounce(){return this.debounce}setDebounceWait(e){return this.debounceWait=e,this}getDebounceWait(){return this.debounceWait}setDebounceUrlWait(e){return this.debounceUrlWait=e,this}getDebounceUrlWait(){return this.debounceUrlWait}getTemplate(){return this.template?this.template:'<div class="needletail-autocomplete-bar needletail-autocomplete-bar-{{ name }}"> <input type="text" class="needletail-autocomplete-bar-input needletail-empty" autocomplete="off" spellcheck="false" placeholder="{{ placeholder }}"> {{{ results }}} </div>'}setResultTemplate(e){return this.resultTemplate=e,this}getResultTemplate(){return this.resultTemplate?this.resultTemplate:'<div class="needletail-autocomplete-bar-results"> {{#initial_input}} <div class="needletail-autocomplete-bar-result needletail-initial-input" data-attribute="{{ initial_input }}"> {{ initial_input }} </div> {{/initial_input}} {{#results}} <div class="needletail-autocomplete-bar-result" data-attribute="{{ raw.title }}"> {{#highlight.title}}{{{ highlight.title }}}{{/highlight.title}}{{^highlight.title}}{{ title }}{{/highlight.title}} </div> {{/results}} {{^results}} <div class="needletail-autocomplete-bar-no-result"> {{{ no_result_message }}} </div> {{/results}} </div>'}setInUrl(e){return this.inUrl=e,this}getInUrl(){return this.inUrl}setShowResults(e){return this.showResults=e,this}getShowResults(){return this.showResults}setDiscriminator(e){return this.discriminator=e,this}getDiscriminator(){return this.discriminator}setSearchOnContentLoaded(e){return this.searchOnContentLoaded=e,this}getSearchOnContentLoaded(){return this.searchOnContentLoaded}setLiveResults(e){return this.liveResults=e,this}getLiveResults(){return this.liveResults}setInitialInput(e){return this.initialInput=e,this}getInitialInput(){return this.initialInput}setFillInputOnClick(e){return this.fillInputOnClick=e,this}getFillInputOnClick(){return this.fillInputOnClick}setForceUseOfResult(e){return this.forceUseOfResult=e,this}getForceUseOfResult(){return this.forceUseOfResult}setUseInResults(e){return this.useInResults=e,this}getUseInResults(){return this.useInResults}setGroupBy(e){return this.groupBy=e,this}getGroupBy(){return this.groupBy}setSortBy(e){return this.sortBy=e,this}getSortBy(){return this.sortBy}setSortMode(e){return this.sortMode=e,this}getSortMode(){return this.sortMode}setSortDirection(e){return-1===this.allowedDirections.indexOf(e)&&(e="asc"),this.sortDirection=e,this}getSortDirection(){return this.sortDirection}setShowBucket(e){return this.showBucket=e,this}getShowBucket(){return this.showBucket}setBucketMapping(e){return this.bucketMapping=e,this}getBucketMapping(){return this.bucketMapping}render(e={}){const t=this.getTemplate();e=Object.assign({name:this.getQuery(),placeholder:this.getPlaceholder(),results:this.renderResults()},e);const i=O.render(t,e);return document.createRange().createContextualFragment(i)}renderResults(e={}){const t=this.getResultTemplate();return e=Object.assign({no_result_message:this.getNoResultMessage()},e),O.render(t,e)}getQuery(){return this.query}setQuery(e){return this.query=e,this}executeJS(){const e=x.getSearchParam(this.getQuery());document.querySelectorAll(`${this.getEl()} .needletail-autocomplete-bar-input`).forEach((t=>{this.getForceUseOfResult()&&t.setAttribute("data-force","on"),t.value=e||"",document.addEventListener("DOMContentLoaded",(()=>
2{this.getSearchOnContentLoaded()&&this.handle(t)})),t.addEventListener("focus",(()=>{t.classList.add("active"),A.emit(A.searchOpened,{query:this.getQuery()})})),t.addEventListener("blur",(()=>{if(setTimeout((()=>{t.classList.remove("active"),A.emit(A.searchClosed,{query:this.getQuery()})}),100),this.getForceUseOfResult()){const e=document.querySelectorAll(`${this.getEl()} .needletail-autocomplete-bar-result`);if(e.length<1)return void A.emit(A.onForceResultBlur,{query:this.getQuery(),value:null});-1===this.selectedResult&&""!==t.value&&(this.selectedResult=0,this.switchActiveClass(e),t.value=e[this.selectedResult].getAttribute("data-attribute"),this.handleUrlChange(t),A.emit(A.onForceResultBlur,{query:this.getQuery(),value:e[this.selectedResult].dataset}))}})),this.getInitialInput()&&t.addEventListener("input",(e=>{document.querySelectorAll(`${this.getEl()} .needletail-autocomplete-bar-result.needletail-initial-input`).forEach((e=>{e.setAttribute("data-attribute",t.value)})),t.setAttribute("data-initial-value",t.value)})),this.getUseDebounce()?(t.addEventListener("input",q()((()=>{const e=document.querySelectorAll(`${this.getEl()} .needletail-autocomplete-bar-result`);this.selectedResult=-1,this.switchActiveClass(e),this.handle(t)}),this.getDebounceWait())),this.getInUrl()&&t.addEventListener("input",q()((()=>{this.handleUrlChange(t)}),this.getDebounceUrlWait()))):t.addEventListener("input",(()=>{const e=document.querySelectorAll(`${this.getEl()} .needletail-autocomplete-bar-result`);this.selectedResult=-1,this.switchActiveClass(e),this.handleUrlChange(t),this.handle(t)})),t.addEventListener("keydown",(e=>{if(t.classList.add("active"),"ArrowUp"===e.key||"ArrowDown"===e.key){e.preventDefault();const i=document.querySelectorAll(`${this.getEl()} .needletail-autocomplete-bar-result`);if(i.length<1)return;"ArrowUp"===e.key?this.selectedResult>0&&this.selectedResult--:"ArrowDown"===e.key&&this.selectedResult<i.length-1&&this.selectedResult++,this.switchActiveClass(i),t.value=i[this.selectedResult].getAttribute("data-attribute"),this.getForceUseOfResult()&&(this.selectedResult<this.skipForceResults?t.setAttribute("data-force","on"):t.setAttribute("data-force","off")),this.handleUrlChange(t),A.emit(A.onArrowMovementSearch,{query:this.getQuery(),value:i[this.selectedResult].dataset})}else if("Enter"===e.key){const e=document.querySelectorAll(`${this.getEl()} .needletail-autocomplete-bar-result`);this.getForceUseOfResult()&&"on"===t.getAttribute("data-force")&&(t.value=e[this.skipForceResults].getAttribute("data-attribute"),this.selectedResult=this.skipForceResults),this.handleUrlChange(t),A.emit(A.onSubmitSearch,{query:this.getQuery(),value:e[this.selectedResult]?e[this.selectedResult].dataset:t.value})}else"Escape"===e.key&&(this.getInitialInput()&&(t.value=t.getAttribute("data-initial-value")),document.querySelectorAll(":focus").forEach((e=>e.blur())))}))})),document.addEventListener(A.onBeforeSearch,(e=>U(this,void 0,void 0,(function*(){e.detail.query===this.getQuery()?e.detail.value.length<this.getMinimumCharacters()?e.preventDefault():(e.detail.extra_search_values={},A.emit(A.onSearch,e.detail)):e.preventDefault()})))),document.addEventListener(A.onSearch,(e=>U(this,void 0,void 0,(function*(){if(e.detail.query!==this.getQuery())return void e.preventDefault();let t=this.getAttributes();"string"==typeof t&&(t=[t]);const i=[];t.forEach((t=>{i.push({field:t,value:e.detail.value})}));const s=yield this.client.search({buckets:this.getBuckets(),search:Object.assign({should:{fuzzy:i}},e.detail.extra_search_values),sort:this.getSortBy(),direction:this.getSortDirection(),size:this.getSize(),group_by:this.getGroupBy(),highlight:!0,show_bucket:this.getShowBucket(),mode:this.getSortMode()});e.detail.status=s.status,s&&s.data.count>0&&(e.detail.search_result=s.data.results.map((e=>{const t=e.bucket?e.bucket.toString():"",i=Object.assign(Object.assign({id:e.id},e.record),{bucket:""!==t&&this.getBucketMapping()[t]?this.getBucketMapping()[t]:"",value:{},raw:{}});e.highlight&&(i.highlight={});let s=this.getAttributes();
2return"string"==typeof s&&(s=[s]),s.forEach((t=>{i.value[t]=e.record[t],i.raw[t]=e.record[t],e.highlight&&(i.highlight[t]=e.highlight[t])})),i}))),A.emit(A.onAfterSearch,e.detail)})))),document.addEventListener(A.onAfterSearch,(e=>U(this,void 0,void 0,(function*(){if(e.detail.query!==this.getQuery())return void e.preventDefault();let t={results:[],initial_input:this.getInitialInput()?e.detail.value:""};e.detail.search_result&&e.detail.search_result.length>0&&e.detail.value&&0!==e.detail.value.length&&(t={results:e.detail.search_result,initial_input:this.getInitialInput()?e.detail.value:""}),this.buildResults(t),A.emit(A.autocompleteBarFinished,{name:this.getDiscriminator()})}))))}buildResults(e={}){if(!this.getShowResults())return;const t=this.renderResults(e),i=document.createRange().createContextualFragment(t);document.querySelectorAll(`.needletail-autocomplete-bar-${this.getQuery()}`).forEach((e=>U(this,void 0,void 0,(function*(){const t=e.querySelector(".needletail-autocomplete-bar-results");yield e.replaceChild(i.cloneNode(!0),t);const s=e.querySelector(".needletail-autocomplete-bar-results").querySelectorAll(".needletail-autocomplete-bar-result");s.forEach((e=>{e.addEventListener("mouseover",(t=>{this.selectedResult=Array.prototype.indexOf.call(s,e),s.forEach((e=>{e.classList.remove("active")})),s[this.selectedResult].classList.add("active")})),e.addEventListener("click",(t=>{this.getFillInputOnClick()&&document.querySelectorAll(`.needletail-autocomplete-bar-${this.getQuery()} .needletail-autocomplete-bar-input`).forEach((t=>{t.value=e.getAttribute("data-attribute"),this.handleUrlChange(t)})),A.emit(A.onSubmitSearch,{query:this.getQuery(),value:e.dataset})}))}));const n=e.querySelector(".needletail-autocomplete-bar-input");n&&n.value.length>0&&n.classList.remove("needletail-empty")}))))}handleUrlChange(e){var t;this.getInUrl()&&x.addToHistory(this.getQuery(),null!==(t=e.getAttribute("data-initial-value"))&&void 0!==t?t:e.value)}handle(e){let t;const i=e.value;i&&i.length<this.getMinimumCharacters()?(t={value:"",search_result:{}},this.value={field:this.getAttribute(),value:""}):(t={value:i,search_result:{}},this.value={field:this.getAttribute(),value:i}),0==i.length&&e.classList.add("needletail-empty"),t.query=this.getQuery(),A.emit(A.onBeforeSearch,t),this.getLiveResults()&&A.emit(A.onBeforeResultRequest,{})}switchActiveClass(e){this.getShowResults()&&(e.forEach((e=>{e.classList.remove("active")})),this.selectedResult>-1&&e[this.selectedResult].classList.add("active"))}}var j=function(e,t,i,s){return new(i||(i=Promise))((function(n,l){function r(e){try{o(s.next(e))}catch(e){l(e)}}function a(e){try{o(s.throw(e))}catch(e){l(e)}}function o(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}o((s=s.apply(e,t||[])).next())}))};class F extends M{constructor(e={}){super(e),this.discriminator="GroupedSearchBar",this.debounce=!0,this.debounceWait=200,this.debounceUrlWait=2e3,this.query="groupedSearchBar",this.inUrl=!0,this.buckets=[],this.placeholder="Start typing to search",this.noResultMessage="No results where found",this.selectedResult=-1,this.value={},this.size=3,this.minimumCharacters=3,this.groupBy="",this.sortBy="",this.sortDirection="asc",this.showResults=!0,this.searchOnContentLoaded=!0,this.initialInput=!0,this.fillInputOnClick=!1,this.sortMode="min",this.allowedDirections=["asc","desc"],this.blurDelay=100,this.setUseDebounce(void 0!==C(e.debounce).use?e.debounce.use:this.getUseDebounce()),this.setDebounceWait(C(e.debounce).wait||this.getDebounceWait()),this.setDebounceUrlWait(C(e.debounce).url_wait||this.getDebounceUrlWait()),this.setInUrl(void 0!==e.in_url?e.in_url:this.getInUrl()),this.setQuery(e.query||this.getQuery()),this.setAttribute(C(e.search).attribute||""),this.setAttributes(C(e.search).attributes||""),this.setBuckets(C(e.search).buckets||[]),this.setPlaceholder(e.placeholder||this.getPlaceholder()),this.setNoResultMessage(e.no_result_message||this.getNoResultMessage()),this.setSize(C(e.search).size||this.getSize()),this.setGroupBy(C(e.search).group_by||""),this.setSortBy(C(e.search).sort_by||""),this.setSortDirection(C(e.search).sort_direction||this.get
2SortDirection()),this.setSortMode(C(e.search).sort_mode||this.getSortMode()),this.setMinimumCharacters(void 0!==e.minimum_characters?e.minimum_characters:this.getMinimumCharacters()),this.setShowResults(void 0!==e.show_results?e.show_results:this.getShowResults()),this.setSearchOnContentLoaded(void 0!==e.search_on_content_loaded?e.search_on_content_loaded:this.getSearchOnContentLoaded()),this.setInitialInput(void 0!==e.initial_input?e.initial_input:this.getInitialInput()),this.setFillInputOnClick(void 0!==e.fill_input_on_click?e.fill_input_on_click:this.getFillInputOnClick()),this.setBlurDelay(void 0!==e.blur_delay?e.blur_delay:this.getBlurDelay()),void 0!==e.template&&this.setTemplate(e.template)}setMinimumCharacters(e){return this.minimumCharacters=e,this}getMinimumCharacters(){return this.minimumCharacters}setSize(e){return this.size=e,this}getSize(){return this.size}setPlaceholder(e){return this.placeholder=e,this}getPlaceholder(){return this.placeholder}setNoResultMessage(e){return this.noResultMessage=e,this}getNoResultMessage(){return this.noResultMessage}setAttribute(e){return this.attribute=e,this}getAttribute(){return this.attribute}setAttributes(e){return""===this.attribute&&(this.attribute=e),this}getAttributes(){return this.attribute}setBuckets(e){return this.buckets=e,this}getBuckets(){return this.buckets}setUseDebounce(e=!0){return this.debounce=e,this}getUseDebounce(){return this.debounce}setDebounceWait(e){return this.debounceWait=e,this}getDebounceWait(){return this.debounceWait}setDebounceUrlWait(e){return this.debounceUrlWait=e,this}getDebounceUrlWait(){return this.debounceUrlWait}getTemplate(){return this.template?this.template:'<div class="needletail-grouped-search-bar needletail-grouped-search-bar-{{ name }}"> <input type="text" class="needletail-grouped-search-bar-input needletail-empty" autocomplete="off" spellcheck="false" placeholder="{{ placeholder }}"> {{{ results }}} </div>'}setTemplate(e){return this.template=e,this}setResultTemplate(e){return this.resultTemplate=e,this}getResultTemplate(){return this.resultTemplate?this.resultTemplate:'<div class="needletail-grouped-search-bar-results"> <div class="needletail-grouped-search-bar-result-results"> {{#initial_input}} <div class="needletail-grouped-search-bar-result needletail-initial-input" data-attribute="{{ initial_input }}"> {{{ initial_input }}} </div> {{/initial_input}} </div> {{#results}} {{{ . }}} {{/results}} {{^results}} <div class="needletail-grouped-search-bar-no-result"> {{{ no_result_message }}} </div> {{/results}} </div>'}setInnerResultTemplate(e){return this.innerResultTemplate=e,this}getInnerResultTemplate(){return this.innerResultTemplate?this.innerResultTemplate:'<div class="needletail-grouped-search-bar-result-title"> {{ key }} </div> <div class="needletail-grouped-search-bar-result-results"> {{#results}} <div class="needletail-grouped-search-bar-result" data-attribute="{{ raw.title }}"> {{#highlight.title}}{{{ highlight.title }}}{{/highlight.title}}{{^highlight.title}}{{ title }}{{/highlight.title}} </div> {{/results}} </div>'}setInUrl(e){return this.inUrl=e,this}getInUrl(){return this.inUrl}setShowResults(e){return this.showResults=e,this}getShowResults(){return this.showResults}setDiscriminator(e){return this.discriminator=e,this}getDiscriminator(){return this.discriminator}setSearchOnContentLoaded(e){return this.searchOnContentLoaded=e,this}getSearchOnContentLoaded(){return this.searchOnContentLoaded}setInitialInput(e){return this.initialInput=e,this}getInitialInput(){return this.initialInput}setGroupBy(e){return this.groupBy=e,this}getGroupBy(){return this.groupBy}setSortBy(e){return this.sortBy=e,this}getSortBy(){return this.sortBy}setSortMode(e){return this.sortMode=e,this}getSortMode(){return this.sortMode}setSortDirection(e){return-1===this.allowedDirections.indexOf(e)&&(e="asc"),this.sortDirection=e,this}getSortDirection(){return this.sortDirection}setFillInputOnClick(e){return this.fillInputOnClick=e,this}getFillInputOnClick(){return this.fillInputOnClick}setBlurDelay(e){return this.blurDelay=e,this}getBlurDelay(){return this.blurDelay}render(e={}){const t=this.getTemplate();e=Object.assign({name:this.getQuery(),placeholder:this.getPlaceholder(),results:this.renderResults()},e);const i=O.render(t,e);return document.createRange().createContextualFragment(i)}renderResults(e={}){const t=this.getResultTemplate();return e=Object.assign({no_result_message:this.getNoResultMessage()},e),O.render(t,e)}renderResultTemplates(e={},t=null){const i=t||this.getInnerResultTemplate();return O.render(i,e)}getQuery(){return this.query}setQuery(e){return this.query=e,this}executeJS(){const e=x.getSearchParam(this.getQuery());document.querySelectorAll(`${this.getEl()} .needletail-grouped-search-bar-input`).forEach((t=>{t.value=e||"",document.addEventListener("DOMContentLoaded",(()=>
2{this.getSearchOnContentLoaded()&&this.handle(t)})),t.addEventListener("focus",(()=>{t.classList.add("active"),A.emit(A.groupedSearchOpened,{query:this.getQuery()})})),t.addEventListener("blur",(()=>{setTimeout((()=>{A.emit(A.groupedSearchClosed,{query:this.getQuery()})}),this.getBlurDelay())})),this.getInitialInput()&&t.addEventListener("input",(e=>{document.querySelectorAll(`${this.getEl()} .needletail-grouped-search-bar-result.needletail-initial-input`).forEach((e=>{const i=e.querySelector(".needletail-initial-input-value");i?i.innerHTML=t.value:e.innerHTML=t.value,e.setAttribute("data-attribute",t.value)})),t.setAttribute("data-initial-value",t.value)})),this.getUseDebounce()?(t.addEventListener("input",q()((()=>{const e=document.querySelectorAll(`${this.getEl()} .needletail-grouped-search-bar-result`);this.selectedResult=-1,this.switchActiveClass(e),this.handle(t)}),this.getDebounceWait())),this.getInUrl()&&t.addEventListener("input",q()((()=>{this.handleUrlChange(t)}),this.getDebounceUrlWait()))):t.addEventListener("input",(()=>{const e=document.querySelectorAll(`${this.getEl()} .needletail-grouped-search-bar-result`);this.selectedResult=-1,this.switchActiveClass(e),this.handleUrlChange(t),this.handle(t)})),t.addEventListener("keydown",(e=>{if(t.classList.add("active"),"ArrowUp"===e.key||"ArrowDown"===e.key){e.preventDefault();const i=document.querySelectorAll(`${this.getEl()} .needletail-grouped-search-bar-result`);if(i.length<1)return;"ArrowUp"===e.key?this.selectedResult>0&&this.selectedResult--:"ArrowDown"===e.key&&this.selectedResult<i.length-1&&this.selectedResult++,this.switchActiveClass(i),t.value=i[this.selectedResult].getAttribute("data-attribute"),A.emit(A.onArrowMovementGroupedSearch,{query:this.getQuery(),value:i[this.selectedResult].dataset})}else if("Enter"===e.key){const e=document.querySelectorAll(`${this.getEl()} .needletail-grouped-search-bar-result`);A.emit(A.onSubmitGroupedSearch,{query:this.getQuery(),value:e[this.selectedResult]?e[this.selectedResult].dataset:t.value})}else"Escape"===e.key&&(this.getInitialInput()&&(t.value=t.getAttribute("data-initial-value")),document.querySelectorAll(":focus").forEach((e=>e.blur())))}))})),document.addEventListener(A.onBeforeGroupedSearch,(e=>j(this,void 0,void 0,(function*(){e.detail.query===this.getQuery()?e.detail.value.length<this.getMinimumCharacters()?e.preventDefault():(e.detail.extra_search_values={},A.emit(A.onGroupedSearch,e.detail)):e.preventDefault()})))),document.addEventListener(A.onGroupedSearch,(e=>j(this,void 0,void 0,(function*(){if(e.detail.query!==this.getQuery())return void e.preventDefault();const t={};this.getBuckets().forEach((i=>{if("object"==typeof i){if(i.name){let s=i.attribute||this.getAttributes();"string"==typeof s&&(s=[s]);const n=[];s.forEach((t=>{n.push({field:t,value:e.detail.value})})),t[i.name]={search:Object.assign({should:{fuzzy:n}},e.detail.extra_search_values),sort:i.sort||this.getSortBy(),direction:i.direction||this.getSortDirection(),size:i.size||this.getSize(),group_by:i.group_by||this.getGroupBy(),highlight:!0,mode:i.sort_mode||this.getSortMode()}}}else{let s=this.getAttributes();"string"==typeof s&&(s=[s]);const n=[];s.forEach((t=>{n.push({field:t,value:e.detail.value})})),t[i]={search:Object.assign({should:{fuzzy:n}},e.detail.extra_search_values),sort:this.getSortBy(),direction:this.getSortDirection(),size:this.getSize(),group_by:this.getGroupBy(),highlight:!0,mode:this.getSortMode()}}}));const i=yield this.client.bulk({buckets:t});e.detail.status=i.status,i&&i.data&&(e.detail.search_result=[],Object.keys(i.data).forEach((t=>{var s;const n=i.data[t],l=this.getBuckets().find((e=>e.name===t||e===t));n.count>0&&e.detail.search_result.push({raw:l,key:null!==(s=l.key)&&void 0!==s?s:t,results:n.results.map((e=>{var t;const i=Object.assign(Object.assign({id:e.id},e.record),{value:{},raw:{}});e.highlight&&(i.highlight={});let s=null!==(t=l.attribute)&&void 0!==t?t:this.getAttributes();return"string"==typeof s&&(s=[s]),s.forEach((t=>{i.value[t]=e.record[t],i.raw[t]=e.record[t],e.highlight&&(i.highlight[t]=e.highlight[t])})),i}))})}))),A.emit(A.onAfterGroupedSearch,e.detail)})))),document.addEventListener(A.onAfterGroupedSearch,(e=>j(this,void 0,void 0,(function*(){if(e.detail.query!==this.getQuery())return void e.preventDefault();let t={initial_input:this.getInitialInput()?e.detail.value:""};e.detail.search_result&&Object.keys(e.detail.search_result).length>0&&(t={results:e.detail.search_result,initial_input:this.getInitialInput()?e.detail.value:""}),this.buildResults(t),A.emit(A.groupedSearchBarFinished,{name:this.getDiscriminator()})}))))}buildResults(e={}){if(!this.getShowResults())return;const t=[];
2e&&e.results&&(e.results.forEach((e=>{const i=this.getBuckets().find((t=>t.key===e.key||t===e.key));i&&i.template?t.push(this.renderResultTemplates(e,i.template)):t.push(this.renderResultTemplates(e))})),e.results=t);const i=this.renderResults(e),s=document.createRange().createContextualFragment(i);document.querySelectorAll(`.needletail-grouped-search-bar-${this.getQuery()}`).forEach((e=>{const t=e.querySelector(".needletail-grouped-search-bar-results");e.replaceChild(s.cloneNode(!0),t);const i=e.querySelector(".needletail-grouped-search-bar-results").querySelectorAll(".needletail-grouped-search-bar-result");i.forEach((e=>{e.addEventListener("mouseover",(t=>{this.selectedResult=Array.prototype.indexOf.call(i,e),i.forEach((e=>{e.classList.remove("active")})),i[this.selectedResult].classList.add("active")})),e.addEventListener("click",(t=>{this.getFillInputOnClick()&&document.querySelectorAll(`.needletail-grouped-search-bar-${this.getQuery()} .needletail-grouped-search-bar-input`).forEach((t=>{t.value=e.getAttribute("data-attribute"),this.handleUrlChange(t)})),A.emit(A.onSubmitGroupedSearch,{query:this.getQuery(),value:e.dataset})}))}));const n=e.querySelector(".needletail-grouped-search-bar-input");n&&n.value.length>0&&n.classList.remove("needletail-empty")}))}handleUrlChange(e){this.getInUrl()&&x.addToHistory(this.getQuery(),e.getAttribute("data-initial-value"))}handle(e){let t;const i=e.value;i&&i.length<this.getMinimumCharacters()?(t={value:"",search_result:{}},this.value={field:this.getAttributes(),value:""}):(t={value:i,search_result:{}},this.value={field:this.getAttributes(),value:i}),0==i.length&&e.classList.add("needletail-empty"),t.query=this.getQuery(),A.emit(A.onBeforeGroupedSearch,t)}switchActiveClass(e){this.getShowResults()&&(e.forEach((e=>{e.classList.remove("active")})),this.selectedResult>-1&&e[this.selectedResult].classList.add("active"))}}class N extends M{constructor(e={}){super(e),this.discriminator="Result",this.perPage=10,this.previous="Previous",this.next="Next",this.last="Last",this.first="First",this.showQuickPagination=!1,this.minifyPages=5,this.groupBy="",this.sortBy="",this.sortSelect={},this.sortDirection="",this.noResultMessage="No results where found",this.initialRequest=!0,this.scrollOffset=100,this.scrollBackToTop=!0,this.buckets=[],this.sortMode="min",this.allowedDirections=["asc","desc"],this.activeClass="active",this.hideOnSinglePage=!0,this.hidePagination=!1,this.query="result",this.infiniteScroll=!1,this.infinityPage=1,this.hardReset=!1,this.totalPages=1,this.bottomScrollOffset=0,this.loader=null,this.allowedLoaders=["round-dots","round-line","straight-bars","straight-dots"],this.totalResults=0,this.totalResultsText=":count total results",this.extraOptions={},this.useSkeleton=!1,this.setQuery(e.query||this.getQuery()),this.setPerPage(e.per_page||this.getPerPage()),this.setPrevious(C(e.pagination).previous||this.getPrevious()),this.setNext(C(e.pagination).next||this.getNext()),this.setMinifyPages(e.minify_pages||this.getMinifyPages()),this.setLast(C(e.pagination).last||this.getLast()),this.setFirst(C(e.pagination).first||this.getFirst()),this.setShowQuickPagination(void 0!==C(e.pagination).show_quick_pagination?e.pagination.show_quick_pagination:this.getShowQuickPagination()),this.setScrollOffset(C(e.pagination).scroll_offset||this.get
2ScrollOffset()),this.setScrollBackToTop(void 0!==C(e.pagination).scroll_back_to_top?e.pagination.scroll_back_to_top:this.getScrollBackToTop()),this.setHideOnSinglePage(void 0!==C(e.pagination).hide_on_single_page?e.pagination.hide_on_single_page:this.getHideOnSinglePage()),this.setResultTemplate(e.result_template),this.setGroupBy(e.group_by||""),this.setSortSelect(e.sort_select||{}),this.setSortSelectDefault(x.getSearchParam("default")||e.sort_select_default||""),this.setSortBy(x.getSearchParam("sort")||e.sort_by||""),this.setSortDirection(x.getSearchParam("direction")||e.sort_direction||this.getSortDirection()),this.setSortMode(e.sort_mode||this.getSortMode()),this.setNoResultMessage(e.no_result_message||this.getNoResultMessage()),this.setBuckets(e.buckets||[]),this.setPaginationActiveClass(C(e.pagination).active_class||this.getPaginationActiveClass()),this.setInfiniteScroll(C(e.pagination).infinite_scroll||this.getInfiniteScroll()),this.setBottomScrollOffset(C(e.pagination).bottom_scroll_offset||this.getBottomScrollOffset()),this.setLoader(e.loader||this.getLoader()),this.setTotalResultsText(e.total_results_text||this.getTotalResultsText()),this.setExtraOptions(e.extra_options||{}),this.setUseSkeleton(void 0!==C(e).use_skeleton?C(e).use_skeleton:this.getUseSkeleton()),this.setResultSkeletonTemplate(C(e).skeleton_template||this.getResultSkeletonTemplate())}getUseSkeleton(){return this.useSkeleton}setUseSkeleton(e){return this.useSkeleton=e,this}getResultSkeletonTemplate(){return this.resultSkeletonTemplate?this.resultSkeletonTemplate:'<div class="needletail-skeleton needletail-result"> <div class="needletail-skeleton needletail-skeleton-spacing needletail-skeleton-spacing--l needletail-total-results"> <h3 class="needletail-skeleton-header"> <span class="needletail-skeleton-box" style="width:55%"></span> </h3> </div> <ul class="needletail-skeleton-spacing needletail-skeleton-spacing--l"> {{#records}} <li class="needletail-skeleton-base"> <div class="needletail-skeleton-media"> <span class="needletail-skeleton-box" style="width:100px;height:100px"></span> </div> <div class="needletail-skeleton-body"> <div class="needletail-skeleton-spacing"> <h3 class="needletail-skeleton-header"> <span class="needletail-skeleton-box" style="width:55%"></span> </h3> <p> <span class="needletail-skeleton-box" style="width:80%"></span> <span class="needletail-skeleton-box" style="width:90%"></span> <span class="needletail-skeleton-box" style="width:83%"></span> <span class="needletail-skeleton-box" style="width:80%"></span> </p> </div> </div> </li> {{/records}} </ul> </div> '}setResultSkeletonTemplate(e){return this.resultSkeletonTemplate=e,this}getQuery(){return this.query}setQuery(e){return this.query=e,this}getTotalResults(){return this.totalResults}setTotalResults(e){return this.totalResults=e,this}getTotalResultsText(){var e;const t=null!==(e=this.getTotalResults())&&void 0!==e?e:0;let i=this.totalResultsText;i=i.replace(/:count/gi,t.toString());const s=i.split("|");if(0===s.length)return i;const n=/^{(\d+)} (.+)/,l=/^\[(\d+),(\d+|\*)] (.+)/;let r=i;return s.forEach((e=>{const i=n.exec(e);i&&t===parseInt(i[1])&&(r=i[2]);const s=l.exec(e);if(s){let e=!1;"*"===s[2]&&(e=!0),t>=parseInt(s[1])&&(t<=parseInt(s[2])||e)&&(r=s[3])}})),r}setTotalResultsText(e){return this.totalResultsText=e,this}getInfiniteScroll(){return this.infiniteScroll}setInfiniteScroll(e){return this.infiniteScroll=e,this}getBottomScrollOffset(){return this.bottomScrollOffset}setBottomScrollOffset(e){return this.bottomScrollOffset=e,this}getLoader(){return this.loader}setLoader(e){return-1!==this.allowedLoaders.indexOf(e)&&(this.loader=e),this}setHideOnSinglePage(e){return this.hideOnSinglePage=e,this}getHideOnSinglePage(){return this.hideOnSinglePage}setPaginationActiveClass(e){return this.activeClass=e,this}getPaginationActiveClass(){return this.activeClass}setBuckets(e){return this.buckets=e,this}getBuckets(){return this.buckets}setScrollBackToTop(e){return this.scrollBackToTop=e,this}getScrollBackToTop(){return this.scrollBackToTop}setScrollOffset(e){return this.scrollOffset=e,this}getScrollOffset(){return this.scrollOffset}setPerPage(e){return this.perPage=e,this}getPerPage(){return this.perPage}setShowQuickPagination(e){return this.showQuickPagination=e,this}getShowQuickPagination(){return this.showQuickPagination}setMinifyPages(e){return this.minifyPages=e,this}getMinifyPages(){return this.minifyPages}setPrevious(e){return this.previous=e,this}getPrevious(){return this.previous}setNext(e){return this.next=e,this}getNext(){return this.next}getTemplate(){return this.template?this.template:'<div class="needletail-result"> <div class="needletail-total-results"> {{ total_results_text }} </div> {{#use_sort_select}} {{{ sort_select }}} {{/use_sort_select}} <div class="needletail-result-results {{ hide_on_initial_request }}"> {{{results}}} </div> {{#infinite_scroll}} <div class="needletail-loader infinity-scroll"></div> {{/infinite_scroll}} <div class="needletail-result-pagination {{ hide_pagination }}"> {{#first_button}} <div class="needletail-result-pagination-page needletail-result-pagination-first {{ disable_first_button }}" data-page="{{ first_page }}">{{{ first_button }}}</div> {{/first_button}} <div class="needletail-result-pagination-page needletail-result-pagination-previous {{ disable_previous_button }}" data-page="{{ previous_page }}">{{{ previous_button }}}</div> {{#pages}} <div class="needletail-result-pagination-page {{active}}" data-offset="{{offset}}" data-page="{{page}}"> {{page}} </div> {{/pages}} <div class="needletail-result-pagination-page needletail-result-pagination-next {{ disable_next_button }}" data-page="{{ next_page }}">{{{ next_button }}}</div> {{#last_button}} <div class="needletail-result-pagination-page needletail-result-pagination-last {{ disable_last_button }}" data-page="{{ last_page }}">{{{ last_button }}}</div> {{/last_button}} </div> </div> '}getResultTemplate(){return this.resultTemplate?this.resultTemplate:'{{#results}} <div class="needletail-result-result"> <div class="needletail-result-title">{{ title }}</div> <div class="needletail-result-body">{{ body }}</div> </div> {{/results}} {{^results}} <div class="needletail-result-no-result"> {{{ no_result_message }}} </div> {{/results}}'}setResultTemplate(e){return this.resultTemplate=e,this}setResultSortSelectTemplate(e){return this.sortSelectTemplate=e,this}getResultSortSelectTemplate(){return this.sortSelectTemplate?this.sortSelectTemplate:'<select class="needletail-sort-select"> {{#options}} <option value="{{ name }}" data-attribute="{{ attribute }}" data-direction="{{ direction }}">{{#display_name}}{{{ display_name }}}{{/display_name}}{{^display_name}}{{ name }}{{/display_name}}</option> {{/options}} </select>'}setFirst(e){return this.first=e,this.setShowQuickPagination(!0),this}getFirst(){return this.first}setLast(e){return this.last=e,this.setShowQuickPagination(!0),this}getLast(){return this.last}setGroupBy(e){return this.groupBy=e,this}getGroupBy(){return this.groupBy}setSortBy(e){if(""===e&&Object.keys(this.getSortSelect()).length>
20)for(const t in this.getSortSelect())this.getSortSelect()[t].name===this.getSortSelectDefault()&&(e=this.getSortSelect()[t].attribute||"");return this.sortBy=e,this}getSortBy(){return this.sortBy}setSortMode(e){return this.sortMode=e,this}getSortMode(){return this.sortMode}setSortDirection(e){if(""===e&&Object.keys(this.getSortSelect()).length>0)for(const t in this.getSortSelect())this.getSortSelect()[t].name===this.getSortSelectDefault()&&(e=this.getSortSelect()[t].direction||"");return-1===this.allowedDirections.indexOf(e)&&(e="asc"),this.sortDirection=e,this}getSortDirection(){return this.sortDirection}setSortSelect(e){return this.sortSelect=e,this}getSortSelect(){return this.sortSelect}setSortSelectDefault(e){return this.sortSelectDefault=e,this}getSortSelectDefault(){return this.sortSelectDefault}setNoResultMessage(e){return this.noResultMessage=e,this}getNoResultMessage(){return this.noResultMessage}setExtraOptions(e){return this.extraOptions=e,this}getExtraOptions(){return this.extraOptions}renderResultSkeleton(){const e={records:new Array(this.getPerPage()).fill(null)},t=O.render(this.getResultSkeletonTemplate(),e);return document.createRange().createContextualFragment(t)}render(e=[],t=[],i=!0){const s=this.getTemplate(),n=[];e&&Object.keys(e).forEach((t=>{n.push(Object.assign({id:e[t].id},e[t].record))}));const l=parseInt(x.getSearchParam("page"))||1,r=t[t.length-1],a={previous_button:this.getPrevious(),next_button:this.getNext(),previous_page:l-1,next_page:l+1,disable_previous_button:0===t.length||1===l?"disabled":"",disable_next_button:0===t.length||r.page===l?"disabled":"",pages:t,results:this.renderResults({results:n,no_result_message:this.getNoResultMessage()}),last_button:"",first_button:"",first_page:0,last_page:0,disable_last_button:0===t.length||r.page===l?"disabled":"",disable_first_button:0===t.length||1===l?"disabled":"",use_sort_select:Object.keys(this.getSortSelect()).length>0,sort_select:this.renderSortSelect({options:this.getSortSelect()}),hide_pagination:this.hidePagination||this.getInfiniteScroll()?"needletail-hidden":"",hide_on_initial_request:i?"needletail-hide-on-initial-request":"",infinite_scroll:this.getInfiniteScroll(),total_results:this.getTotalResults(),total_results_text:this.getTotalResultsText(),extra_options:this.getExtraOptions()};this.getShowQuickPagination()&&(a.last_button=this.getLast(),a.first_button=this.getFirst(),a.first_page=1,a.last_page=C(r).page);const o=O.render(s,a);return document.createRange().createContextualFragment(o)}renderResults(e={}){const t=this.getResultTemplate();return e=Object.assign({},e),O.render(t,e)}renderSortSelect(e={}){const t=this.getResultSortSelectTemplate();return e=Object.assign({},e),O.render(t,e)}executeJS(){document.addEventListener(A.onBeforeResultRequest,q()((e=>{if(e.detail.query||(e.detail.query=this.getQuery()),this.getUseSkeleton()){const e=this.renderResultSkeleton();document.querySelectorAll(this.getEl()).forEach((t=>{const i=t.querySelector(".needletail-result");t.replaceChild(e.cloneNode(!0),i)}))}const t=this.client.widgets.autocompleteBar,i=this.client.widgets.aggregationBar;let s=t.reduce(((e,t)=>t.getUseInResults()?(t.getBuckets().forEach((t=>{e.push(t)})),e):e),[]);s=s.concat(this.getBuckets());const n=t.reduce(((e,t)=>t.getUseInResults()?(Object.keys(t.value).length>0&&("string"==typeof t.value.field?e.push(t.value):t.value.field.forEach((i=>{e.push({field:i,value:t.value.value})}))),e):e),[]),l=i.map((e=>e.getValues()));e.detail.buckets=s,e.detail.search_values={},e.detail.equals_search_values={match:[...[].concat.apply([],l)]},e.detail.extra_search_values={},e.detail.should_search_values={fuzzy:[...[].concat.apply([],n)]},A.emit(A.onResultRequest,e.detail)}),100)),document.addEventListener(A.onResultRequest,q()((e=>{return t=this,i=void 0,n=function*(){let t,i=1,s=this.getPerPage();this.initialRequest&&(this.infinityPage=parseInt(x.getSearchParam("page"))||1),this.getInfiniteScroll()?(i=this.infinityPage,t=(i-1)*this.getPerPage(),this.initialRequest&&(s*=i,t=0)):(i=parseInt(x.getSearchParam("page"))||1,t=(i-1)*this.getPerPage());const n=yield this.client.search({buckets:e.detail.buckets,search:Object.assign({should:Object.assign({},e.detail.should_search_values),equals:Object.assign(Object.assign({},e.detail.search_values),e.detail.equals_search_values)},e.detail.extra_search_values),size:s,mode:this.getSortMode(),group_by:this.getGroupBy(),sort:this.getSortBy(),direction:this.getSortDirection(),offset:t});if(e.detail.status=n.status,n&&n.data){if(e.detail.count=n.data.count,this.setTotalResults(e.detail.count),n.data.results){e.detail.pages=[];for(let t=0;t<Math.ceil(n.data.count/this.getPerPage());t++)e.detail.pages.push({page:t+1,offset:t*this.getPerPage(),active:0===t&&!i||i===t+1?this.getPaginationActiveClass():""});const t=e.detail.pages.length;if(this.totalPages=t,1===t&&this.getHideOnSinglePage()?this.hidePagination=!0:this.hidePagination=!1,t>this.getMinifyPages()){let s=0;const n=[],l=[];let r=Math.ceil(this.getMinifyPages()/2),a=!1;if(t-r>=i){const s=e.detail.pages.pop();t-r!=i&&l.push({page:"...",offset:0,active:"disabled"}),l.push(s)}else a=!0;if(r<i){const l=e.detail.pages.shift();if(n.push(l),this.getMinifyPages()%2==1&&r++,a){let e=this.getMinifyPages();i==t?i--:i==t-2&&(e=r),s=i-e}else s=i-r;s>0&&n.push({page:"...",offset:0,active:"disabled"})}const o=e.detail.pages.splice(s,this.getMinifyPages());e.detail.pages=[...o],n.length>0&&e.detail.pages.unshift(...n),l.length>0&&e.detail.pages.push(...l)}e.detail.search_result=n.data.results}n.data.aggs&&A.emit(A.onAggsUpdate,n.data.aggs)}A.emit(A.onAfterResultRequest,e.detail)}
2,new((s=void 0)||(s=Promise))((function(e,l){function r(e){try{o(n.next(e))}catch(e){l(e)}}function a(e){try{o(n.throw(e))}catch(e){l(e)}}function o(t){var i;t.done?e(t.value):(i=t.value,i instanceof s?i:new s((function(e){e(i)}))).then(r,a)}o((n=n.apply(t,i||[])).next())}));var t,i,s,n}),100)),document.addEventListener(A.onPageChange,(e=>{if(!this.initialRequest&&this.getScrollBackToTop()){const e=document.querySelectorAll(this.getEl());if(1===e.length){const t=e.item(0).offsetTop-this.getScrollOffset();window.scrollTo({top:t,behavior:"smooth"})}}})),document.addEventListener(A.onAfterResultRequest,(e=>{const t=this.render(e.detail.search_result,e.detail.pages,!1);document.querySelectorAll(this.getEl()).forEach((e=>{const i=e.querySelector(".needletail-result");if(this.getInfiniteScroll()){const s=i.querySelectorAll(".needletail-result-result"),n=s[s.length-1];if(n&&!this.hardReset){let e;t.childNodes.forEach((t=>{t.classList&&t.classList.contains("needletail-result")&&!e&&(e=t.querySelector(".needletail-result-results"))})),n.after(...e.childNodes)}else e.replaceChild(t.cloneNode(!0),i),this.hardReset=!1}else e.replaceChild(t.cloneNode(!0),i),e.querySelectorAll(".needletail-result-pagination-page:not(.disabled):not(.active)").forEach((e=>{e.addEventListener("click",(t=>{const i=x.getSearchParam("page"),s=e.getAttribute("data-page");x.addToHistory("page",s),A.emit(A.onPageChange,{current_page:i,new_page:s}),A.emit(A.onBeforeResultRequest,{query:this.getQuery()})}))}))}));const i=document.getElementsByClassName("needletail-sort-select");for(let e=0;e<i.length;e++)i[e].value=this.getSortSelectDefault(),i[e].addEventListener("change",(e=>{this.setSortSelectDefault(e.target.value),this.setSortBy(e.target.options[e.target.selectedIndex].getAttribute("data-attribute")),this.setSortDirection(e.target.options[e.target.selectedIndex].getAttribute("data-direction")||"asc"),x.addToHistory("page","1"),x.addToHistory("direction",this.getSortDirection()),x.addToHistory("sort",this.getSortBy()),x.addToHistory("default",this.getSortSelectDefault()),this.infinityPage=1,this.hardReset=!0,A.emit(A.onBeforeResultRequest,{query:this.getQuery()})}));const s=document.querySelectorAll(".needletail-result-result");if(s.forEach(((e,t)=>{e.addEventListener("click",(e=>{x.addToHistory("index",t.toString())}))})),this.initialRequest&&null!==x.getSearchParam("index")){const e=s.item(parseInt(x.getSearchParam("index")));if(e){const t=e.offsetTop-this.getScrollOffset();window.scrollTo({top:t,behavior:this.getInfiniteScroll()?"smooth":"auto"})}}this.stopLoader("infinity-scroll"),this.initialRequest=!1,A.emit(A.resultFinished,{name:this.discriminator})})),this.getInfiniteScroll()&&window.addEventListener("scroll",q()((()=>{const{scrollTop:e,scrollHeight:t,clientHeight:i}=document.documentElement;e+i>=t-this.getBottomScrollOffset()&&this.totalPages>=this.infinityPage+1&&(this.infinityPage++,x.addToHistory("page",this.infinityPage.toString()),this.startLoader("infinity-scroll"),A.emit(A.onBeforeResultRequest,{query:this.getQuery()}))}),200)),document.addEventListener(A.onAggregationValueChange,(e=>{this.initialRequest||(x.addToHistory("page","1"),this.infinityPage=1,this.hardReset=!0)})),A.emit(A.onBeforeResultRequest,{query:this.getQuery()})}startLoader(e){this.getLoader()&&document.querySelectorAll(`.needletail-loader.${e}`).forEach((e=>{e.classList.add(`needletail-loader-${this.getLoader()}`)}))}stopLoader(e){document.querySelectorAll(`.needletail-loader.${e}`).forEach((e=>{e.classList.remove(`needletail-loader-${this.getLoader()}`)}))}}class $ extends M{constructor(e={}){super(e),this.discriminator="AggregationBar",this.useClearFilters=!1,this.clearFiltersTop=!1,this.clearFiltersBottom=!1,this.clearFiltersText="Clear filters",this.clearFiltersHideOnNoneActive=!0,this.useSkeleton=!1,this.aggregationActives={},this.fields=[],this.setUseClearFilters(C(e.clear_filters).use||this.getUseClearFilters()),this.setClearFiltersTop(C(e.clear_filters).top||this.getClearFiltersTop()),this.setClearFiltersBottom(C(e.clear_filters).bottom||this.getClearFiltersBottom()),this.setClearFiltersText(C(e.clear_filters).text||this.getClearFiltersText()),this.setClearFiltersHideOnNoneActive(C(e.clear_filters).hide_on_none_active||this.getClearFiltersHideOnNoneActive()),this.setUseSkeleton(void 0!==C(e).use_skeleton?C(e).use_skeleton:this.getUseSkeleton())}getUseSkeleton(){return this.useSkeleton}setUseSkeleton(e){return this.useSkeleton=e,this}setUseClearFilters(e){return this.useClearFilters=e,this}getUseClearFilters(){return this.useClearFilters}setClearFiltersTop(e){return this.clearFiltersTop=e,this}getClearFiltersTop(){return this.clearFiltersTop}setClearFiltersBottom(e){return this.clearFiltersBottom=e,this}getClearFiltersBottom(){return this.clearFiltersBottom}setClearFiltersText(e){return this.clearFiltersText=e,this}getClearFiltersText(){return this.clearFiltersText}setClearFiltersHideOnNoneActive(e){return this.clearFiltersHideOnNoneActive=e,this}getClearFiltersHideOnNoneActive(){return this.clearFiltersHideOnNoneActive}addField(e){return e.parent=this,this.fields.push(e),this}addMultipleFields(e){return e.forEach((e=>{e.parent=this,this.fields.push(e)})),this}getTemplate(){return this.template?this.template:'<div class="needletail-aggregation-bar"> {{#show_clear_filters_top}} <div class="needletail-clear-filters-top"> {{{ clear_filters }}} </div> {{/show_clear_filters_top}} {{#fields}} <div class="needletail-aggregation-item"> {{{ . }}} </div> {{/fields}} {{#show_clear_filters_bottom}} <div class="needletail-clear-filters-bottom"> {{{ clear_filters }}} </div> {{/show_clear_filters_bottom}} </div>'}setDiscriminator(e){return this.discriminator=e,this}getDiscriminator(){return this.discriminator}render(){const e=this.getTemplate(),t=[];this.fields.forEach((e=>{let i="";
2i=e.getUseSkeleton()?e.renderSkeleton():e.render(),t.push(i)}));const i=O.render(e,{fields:t,clear_filters:this.renderClearFilters(),show_clear_filters_top:this.getClearFiltersTop(),show_clear_filters_bottom:this.getClearFiltersBottom()});return document.createRange().createContextualFragment(i)}setClearFiltersTemplate(e){return this.clearFiltersTemplate=e,this}getClearFiltersTemplate(){return this.clearFiltersTemplate?this.clearFiltersTemplate:'<span class="needletail-clear-filters {{ hidden }}">{{{ text }}}</span>'}renderClearFilters(){const e=this.getClearFiltersTemplate();return O.render(e,{text:this.getClearFiltersText(),hidden:this.getClearFiltersHideOnNoneActive()?"needletail-hidden":""})}executeJS(){const e=document.getElementsByClassName("needletail-clear-filters");for(let t=0;t<e.length;t++)e[t].addEventListener("click",(()=>{this.fields.forEach((e=>{e.reset()}))}));document.addEventListener("DOMContentLoaded",(()=>{this.fields.forEach((e=>{setTimeout((()=>{e.setDefaultCollapsed(!1)}),1e3)})),A.emit(A.onAggregationValueChange,{})})),document.addEventListener(A.onAggregationValueChange,(e=>{this.aggregationActives[e.detail.name]=e.detail.hasActive;const t=document.getElementsByClassName("needletail-clear-filters");let i=!1;if(this.fields.forEach((e=>{let s=e.getTitle();if("Range"===e.discriminator&&(s=e.getTitle()+"[min]"),!i&&x.getSearchParam(s)){for(let e=0;e<t.length;e++)t[e].classList.remove("needletail-hidden");i=!0}})),!i)for(let e=0;e<t.length;e++)t[e].classList.add("needletail-hidden")})),this.fields.forEach((e=>{e.executeJS()})),A.emit(A.aggregationFinished,{name:this.getDiscriminator()})}getValues(){return this.fields.reduce(((e,t)=>(Object.keys(t.value).length>0&&e.push(t.value),e)),[])}}i(665)}},t={};function i(s){var n=t[s];if(void 0!==n)return n.exports;var l=t[s]={exports:{}};return e[s](l,l.exports,i),l.exports}return i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var s in t)i.o(t,s)&&!i.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;i.g.importScripts&&(e=i.g.location+"");var t=i.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var s=t.getElementsByTagName("script");if(s.length)for(var n=s.length-1;n>-1&&!e;)e=s[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),i.p=e})(),i(665),i(7)})()));
3//# sourceMappingURL=needletail-ui-3.6.0-b.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.