1import{_ as O,b as L,a as T,u as Er}from"./uidQqfIk.js";import{h as Tr,i as Ir,a as le,_ as G,f as ie,j as Hr,b as Ar,n as st}from"./lsjnuTIS.js";import{c2 as Yt,c9 as ct,a0 as Or,az as Cr,ax as Dr,bK as Nr,w as Qr,N as ut,o as Ur,d as Wr,W as $r,b0 as qr}from"./BipNxojO.js";function Lr(n){if(Array.isArray(n))return Tr(n)}function kr(n){if(typeof Symbol<"u"&&n[Symbol.iterator]!=null||n["@@iterator"]!=null)return Array.from(n)}function Mr(){throw new TypeError(`Invalid attempt to spread non-iterable instance. 2In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function re(n){return Lr(n)||kr(n)||Ir(n)||Mr()}function Br(n){return btoa(encodeURIComponent(JSON.stringify(n)))}function Vr(n){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:20,r=[],e=0;e<Math.ceil(n.length/t);e++)r.push(n.slice(e*t,(e+1)*t));return r}function Zt(n){var t=n.helper,r=n.widgetType;n.methodName;var e=n.args,a=n.instantSearchInstance;if(e.length===1&&le(e[0])==="object")return[e[0]];var i=G(e[0].split(":"),2),c=i[0],f=i[1],l=e[1],d=e[2],v=e[3]||{};if(!l)return[];if((c==="click"||c==="conversion")&&!d)return[];var R=Array.isArray(l)?l:[l];if(R.length===0)return[];var h=R[0].__queryID,s=Vr(R),u=s.map(function(x){return x.map(function(o){return o.objectID})}),S=s.map(function(x){return x.map(function(o){return o.__position})});return c==="view"?a.status!=="idle"?[]:s.map(function(x,o){var m;return{insightsMethod:"viewedObjectIDs",widgetType:r,eventType:c,payload:O({eventName:d||"Hits Viewed",index:((m=t.lastResults)===null||m===void 0?void 0:m.index)||t.state.index,objectIDs:u[o]},v),hits:x,eventModifier:f}}):c==="click"?s.map(function(x,o){var m;return{insightsMethod:"clickedObjectIDsAfterSearch",widgetType:r,eventType:c,payload:O({eventName:d||"Hit Clicked",index:((m=t.lastResults)===null||m===void 0?void 0:m.index)||t.state.index,queryID:h,objectIDs:u[o],positions:S[o]},v),hits:x,eventModifier:f}}):c==="conversion"?s.map(function(x,o){var m;return{insightsMethod:"convertedObjectIDsAfterSearch",widgetType:r,eventType:c,payload:O({eventName:d||"Hit Converted",index:((m=t.lastResults)===null||m===void 0?void 0:m.index)||t.state.index,queryID:h,objectIDs:u[o]},v),hits:x,eventModifier:f}}):[]}function Di(n){var t=n.instantSearchInstance,r=n.helper,e=n.widgetType,a={},i=void 0,c=function(){for(var l=arguments.length,d=new Array(l),v=0;v<l;v++)d[v]=arguments[v];var R=Zt({widgetType:e,helper:r,methodName:"sendEvent",args:d,instantSearchInstance:t});R.forEach(function(h){h.eventType==="click"&&h.eventModifier==="internal"&&a[h.eventType]||(a[h.eventType]=!0,t.sendEventToInsights(h))}),clearTimeout(i),i=setTimeout(function(){a={}},0)};return c}function Ni(n){var t=n.helper,r=n.widgetType,e=n.instantSearchInstance,a=function(){for(var c=arguments.length,f=new Array(c),l=0;l<c;l++)f[l]=arguments[l];var d=Zt({widgetType:r,helper:t,methodName:"bindEvent",args:f,instantSearchInstance:e});return d.length?"data-insights-event=".concat(Br(d)):""};return a}function Jr(n,t){if(!Array.isArray(n))return-1;for(var r=0;r<n.length;r++)if(t(n[r]))return r;return-1}function Ge(n,t){return t!=null&&typeof Symbol<"u"&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](n):n instanceof t}function Kr(n){return n.filter(function(t,r,e){return e.indexOf(t)===r})}var zr=function(t,r){r.facets,r.disjunctiveFacets,r.facetsRefinements,r.facetsExcludes,r.disjunctiveFacetsRefinements,r.numericRefinements,r.tagRefinements,r.hierarchicalFacets,r.hierarchicalFacetsRefinements,r.ruleContexts;var e=ie(r,["facets","disjunctiveFacets","facetsRefinements","facetsExcludes","disjunctiveFacetsRefinements","numericRefinements","tagRefinements","hierarchicalFacets","hierarchicalFacetsRefinements","ruleContexts"]);return t.setQueryParameters(e)},Gr=function(t,r){return r.facets.reduce(function(e,a){return e.addFacet(a)},t)},Xr=function(t,r){return r.disjunctiveFacets.reduce(function(e,a){return e.addDisjunctiveFacet(a)},t)},Yr=function(t,r){return t.setQueryParameters({hierarchicalFacets:r.hierarchicalFacets.reduce(function(e,a){var i=Jr(e,function(f){return f.name===a.name});if(i===-1)return e.concat(a);var c=e.slice();return c.splice(i,1,a),c},t.hierarchicalFacets)})},Zr=function(t,r){return r.tagRefinements.reduce(function(e,a){return e.addTagRefinement(a)},t)},en=function(t,r){return t.setQueryParameters({facetsRefinements:O({},t.facetsRefinements,r.facetsRefinements)})},tn=function(t,r){return t.setQueryParameters({facetsExcludes:O({},t.facetsExcludes,r.facetsExcludes)})},rn=function(t,r){return t.setQueryParameters({disjunctiveFacetsRefinements:O({},t.disjunctiveFacetsRefinements,r.disjunctiveFacetsRefinements)})},nn=function(t,r){return t.setQueryParameters({numericRefinements:O({},t.numericRefinements,r.numericRefinements)})},an=function(t,r){return t.setQueryParameters({hierarchicalFacetsRefinements:O({},t.hierarchicalFacetsRefinements,r.hierarchicalFacetsRefinements)})},sn=function(t,r){var e=Kr([].concat(t.ruleContexts).concat(r.ruleContexts).filter(
2Boolean));return e.length>0?t.setQueryParameters({ruleContexts:e}):t},ge=function(){for(var t=arguments.length,r=new Array(t),e=0;e<t;e++)r[e]=arguments[e];return r.reduce(function(a,i){var c=an(a,i),f=Yr(c,i),l=Zr(f,i),d=nn(l,i),v=rn(d,i),R=tn(v,i),h=en(R,i),s=Xr(h,i),u=sn(s,i),S=Gr(u,i);return zr(S,i)})},pe,ot;function Xe(){if(ot)return pe;ot=1;function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}pe=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(i){if(!r(i)||i<0||isNaN(i))throw TypeError("n must be a positive number");return this._maxListeners=i,this},n.prototype.emit=function(i){var c,f,l,d,v,R;if(this._events||(this._events={}),i==="error"&&(!this._events.error||e(this._events.error)&&!this._events.error.length)){if(c=arguments[1],c instanceof Error)throw c;var h=new Error('Uncaught, unspecified "error" event. ('+c+")");throw h.context=c,h}if(f=this._events[i],a(f))return!1;if(t(f))switch(arguments.length){case 1:f.call(this);break;case 2:f.call(this,arguments[1]);break;case 3:f.call(this,arguments[1],arguments[2]);break;default:d=Array.prototype.slice.call(arguments,1),f.apply(this,d)}else if(e(f))for(d=Array.prototype.slice.call(arguments,1),R=f.slice(),l=R.length,v=0;v<l;v++)R[v].apply(this,d);return!0},n.prototype.addListener=function(i,c){var f;if(!t(c))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",i,t(c.listener)?c.listener:c),this._events[i]?e(this._events[i])?this._events[i].push(c):this._events[i]=[this._events[i],c]:this._events[i]=c,e(this._events[i])&&!this._events[i].warned&&(a(this._maxListeners)?f=n.defaultMaxListeners:f=this._maxListeners,f&&f>0&&this._events[i].length>f&&(this._events[i].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[i].length),typeof console.trace=="function"&&console.trace())),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(i,c){if(!t(c))throw TypeError("listener must be a function");var f=!1;function l(){this.removeListener(i,l),f||(f=!0,c.apply(this,arguments))}return l.listener=c,this.on(i,l),this},n.prototype.removeListener=function(i,c){var f,l,d,v;if(!t(c))throw TypeError("listener must be a function");if(!this._events||!this._events[i])return this;if(f=this._events[i],d=f.length,l=-1,f===c||t(f.listener)&&f.listener===c)delete this._events[i],this._events.removeListener&&this.emit("removeListener",i,c);else if(e(f)){for(v=d;v-- >0;)if(f[v]===c||f[v].listener&&f[v].listener===c){l=v;break}if(l<0)return this;f.length===1?(f.length=0,delete this._events[i]):f.splice(l,1),this._events.removeListener&&this.emit("removeListener",i,c)}return this},n.prototype.removeAllListeners=function(i){var c,f;if(!this._events)return this;if(!this._events.removeListener)return arguments.length===0?this._events={}:this._events[i]&&delete this._events[i],this;if(arguments.length===0){for(c in this._events)c!=="removeListener"&&this.removeAllListeners(c);return this.removeAllListeners("removeListener"),this._events={},this}if(f=this._events[i],t(f))this.removeListener(i,f);else if(f)for(;f.length;)this.removeListener(i,f[f.length-1]);return delete this._events[i],this},n.prototype.listeners=function(i){var c;return!this._events||!this._events[i]?c=[]:t(this._events[i])?c=[this._events[i]]:c=this._events[i].slice(),c},n.prototype.listenerCount=function(i){if(this._events){var c=this._events[i];if(t(c))return 1;if(c)return c.length}return 0},n.listenerCount=function(i,c){return i.listenerCount(c)};function t(i){return typeof i=="function"}function r(i){return typeof i=="number"}function e(i){return typeof i=="object"&&i!==null}function a(i){return i===void 0}return pe}var Re,ht;function er(){if(ht)return Re;ht=1;function n(t,r){t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}return Re=n,Re}var ye,ft;function cn(){if(ft)return ye;ft=1;var n=Xe(),t=er();function r(e,a,i){this.main=e,this.fn=a,this.recommendFn=i,this.lastResults=null,this.lastRecommendResults=null}return t(r,n),r.prototype.detach=function(){this.removeAllListeners(),this.main.detachDerivedHelper(this)},r.prototype.getModifiedState=function(e){return this.fn(e)},r.prototype.getModifiedRecommendState=function(e){return this.recommendFn(e)},ye=r,ye}var _e,lt;function Ye(){if(lt)return _e;lt=1;function n(r){return typeof r!="string"?r:String(r).replace(/^-/,"\\-")}function t(r){return typeof r!="string"?r:r.replace(/^\\-/,"-")}return _e={escapeFacetValue:n,unescapeFacetValue:t},_e}var Fe,dt;function Ze(){if(dt)return Fe;dt=1;function n(a){return typeof a=="object"&&a!==null?r(Array.isArray(a)?[]:{},a):a}function t(a){return typeof a=="function"||Array.isArray(a)||Object.prototype.toString.call(a)==="[object Object]"}function r(a,i){if(a===i)return a;for(var c in i)if(!(!Object.prototype.hasOwnProperty.call(i,c)||c==="__proto__"||c==="constructor")){var f=i[c],l=a[c];typeof l<"u"&&typeof f>"u"||(t(l)&&t(f)?a[c]=r(l,f):a[c]=n(f))}return a}function e(a){t(a)||(a={});for(var i=1,c=arguments.length;i<c;i++){var f=arguments[i];t(f)&&r(a,f)}return a}return Fe=e,Fe}var Se,mt;
2function et(){if(mt)return Se;mt=1;function n(t){return t&&Object.keys(t).length>0}return Se=n,Se}var xe,vt;function tt(){if(vt)return xe;vt=1;function n(t,r){if(t===null)return{};var e={},a=Object.keys(t),i,c;for(c=0;c<a.length;c++)i=a[c],!(r.indexOf(i)>=0)&&(e[i]=t[i]);return e}return xe=n,xe}var we,gt;function tr(){if(gt)return we;gt=1;function n(t){t=t||{},this.params=t.params||[]}return n.prototype={constructor:n,addParams:function(t){var r=this.params.slice();return r.push(t),new n({params:r})},removeParams:function(t){return new n({params:this.params.filter(function(r){return r.$$id!==t})})},addFrequentlyBoughtTogether:function(t){return this.addParams(Object.assign({},t,{model:"bought-together"}))},addRelatedProducts:function(t){return this.addParams(Object.assign({},t,{model:"related-products"}))},addTrendingItems:function(t){return this.addParams(Object.assign({},t,{model:"trending-items"}))},addTrendingFacets:function(t){return this.addParams(Object.assign({},t,{model:"trending-facets"}))},addLookingSimilar:function(t){return this.addParams(Object.assign({},t,{model:"looking-similar"}))},_buildQueries:function(t,r){return this.params.filter(function(e){return r[e.$$id]===void 0}).map(function(e){var a=Object.assign({},e,{indexName:t,threshold:e.threshold||0});return delete a.$$id,a})}},we=n,we}var Pe,pt;function rr(){if(pt)return Pe;pt=1;function n(t,r){this._state=t,this._rawResults={};var e=this;t.params.forEach(function(a){var i=a.$$id;e[i]=r[i],e._rawResults[i]=r[i]})}return n.prototype={constructor:n},Pe=n,Pe}var be,Rt;function un(){if(Rt)return be;Rt=1;var n=Ze();function t(e){return Object.keys(e).sort().reduce(function(a,i){return a[i]=e[i],a},{})}var r={_getQueries:function(a,i){var c=[];return c.push({indexName:a,params:r._getHitsSearchParams(i)}),i.getRefinedDisjunctiveFacets().forEach(function(f){c.push({indexName:a,params:r._getDisjunctiveFacetSearchParams(i,f)})}),i.getRefinedHierarchicalFacets().forEach(function(f){var l=i.getHierarchicalFacetByName(f),d=i.getHierarchicalRefinement(f),v=i._getHierarchicalFacetSeparator(l);
2if(d.length>0&&d[0].split(v).length>1){var R=d[0].split(v).slice(0,-1).reduce(function(s,u,S){return s.concat({attribute:l.attributes[S],value:S===0?u:[s[s.length-1].value,u].join(v)})},[]);R.forEach(function(h,s){var u=r._getDisjunctiveFacetSearchParams(i,h.attribute,s===0);function S(m){return l.attributes.some(function(y){return y===m.split(":")[0]})}var x=(u.facetFilters||[]).reduce(function(m,y){if(Array.isArray(y)){var _=y.filter(function(w){return!S(w)});_.length>0&&m.push(_)}return typeof y=="string"&&!S(y)&&m.push(y),m},[]),o=R[s-1];s>0?u.facetFilters=x.concat(o.attribute+":"+o.value):x.length>0?u.facetFilters=x:delete u.facetFilters,c.push({indexName:a,params:u})})}}),c},_getCompositionQueries:function(a){return[{compositionID:a.index,requestBody:{params:r._getCompositionHitsSearchParams(a)}}]},_getHitsSearchParams:function(e){var a=e.facets.concat(e.disjunctiveFacets).concat(r._getHitsHierarchicalFacetsAttributes(e)).sort(),i=r._getFacetFilters(e),c=r._getNumericFilters(e),f=r._getTagFilters(e),l={};return a.length>0&&(l.facets=a.indexOf("*")>-1?["*"]:a),f.length>0&&(l.tagFilters=f),i.length>0&&(l.facetFilters=i),c.length>0&&(l.numericFilters=c),t(n({},e.getQueryParams(),l))},_getCompositionHitsSearchParams:function(e){var a=e.facets.concat(e.disjunctiveFacets.map(function(v){return e.disjunctiveFacetsRefinements&&e.disjunctiveFacetsRefinements[v]&&e.disjunctiveFacetsRefinements[v].length>0?"disjunctive("+v+")":v})).concat(r._getHitsHierarchicalFacetsAttributes(e)).sort(),i=r._getFacetFilters(e),c=r._getNumericFilters(e),f=r._getTagFilters(e),l={};a.length>0&&(l.facets=a.indexOf("*")>-1?["*"]:a),f.length>0&&(l.tagFilters=f),i.length>0&&(l.facetFilters=i),c.length>0&&(l.numericFilters=c);var d=e.getQueryParams();return delete d.highlightPreTag,delete d.highlightPostTag,delete d.index,t(n({},d,l))},_getDisjunctiveFacetSearchParams:function(e,a,i){var c=r._getFacetFilters(e,a,i),f=r._getNumericFilters(e,a),l=r._getTagFilters(e),d={hitsPerPage:0,page:0,analytics:!1,clickAnalytics:!1};l.length>0&&(d.tagFilters=l);var v=e.getHierarchicalFacetByName(a);return v?d.facets=r._getDisjunctiveHierarchicalFacetAttribute(e,v,i):d.facets=a,f.length>0&&(d.numericFilters=f),c.length>0&&(d.facetFilters=c),t(n({},e.getQueryParams(),d))},_getNumericFilters:function(e,a){if(e.numericFilters)return e.numericFilters;var i=[];return Object.keys(e.numericRefinements).forEach(function(c){var f=e.numericRefinements[c]||{};Object.keys(f).forEach(function(l){var d=f[l]||[];a!==c&&d.forEach(function(v){if(Array.isArray(v)){var R=v.map(function(h){return c+l+h});i.push(R)}else i.push(c+l+v)})})}),i},_getTagFilters:function(e){return e.tagFilters?e.tagFilters:e.tagRefinements.join(",")},_getFacetFilters:function(e,a,i){var c=[],f=e.facetsRefinements||{};Object.keys(f).sort().forEach(function(R){var h=f[R]||[];h.slice().sort().forEach(function(s){c.push(R+":"+s)})});var l=e.facetsExcludes||{};Object.keys(l).sort().forEach(function(R){var h=l[R]||[];h.sort().forEach(function(s){c.push(R+":-"+s)})});var d=e.disjunctiveFacetsRefinements||{};Object.keys(d).sort().forEach(function(R){var h=d[R]||[];if(!(R===a||!h||h.length===0)){var s=[];h.slice().sort().forEach(function(u){s.push(R+":"+u)}),c.push(s)}});var v=e.hierarchicalFacetsRefinements||{};return Object.keys(v).sort().forEach(function(R){var h=v[R]||[],s=h[0];if(s!==void 0){var u=e.getHierarchicalFacetByName(R),S=e._getHierarchicalFacetSeparator(u),x=e._getHierarchicalRootPath(u),o,m;if(a===R){if(s.indexOf(S)===-1||!x&&i===!0||x&&x.split(S).length===s.split(S).length)return;x?(m=x.split(S).length-1,s=x):(m=s.split(S).length-2,s=s.slice(0,s.lastIndexOf(S))),o=u.attributes[m]}else m=s.split(S).length-1,o=u.attributes[m];o&&c.push([o+":"+s])}}),c},_getHitsHierarchicalFacetsAttributes:function(e){var a=[];return e.hierarchicalFacets.reduce(function(c,f){var l=e.getHierarchicalRefinement(f.name)[0];if(!l)return c.push(f.attributes[0]),c;var d=e._getHierarchicalFacetSeparator(f),v=l.split(d).length,R=f.attributes.slice(0,v+1);return c.concat(R)},a)},_getDisjunctiveHierarchicalFacetAttribute:function(e,a,i){var c=e._getHierarchicalFacetSeparator(a);if(i===!0){var f=e._getHierarchicalRootPath(a),l=0;return f&&(l=f.split(c).length),[a.attributes[l]]}var d=e.getHierarchicalRefinement(a.name)[0]||"",v=d.split(c).length-1;return a.attributes.slice(0,v+1)},getSearchForFacetQuery:function(e,a,i,c){var f=c.isDisjunctiveFacet(e)?c.clearRefinements(e):c,l={facetQuery:a,facetName:e};return typeof i=="number"&&(l.maxFacetHits=i),t(n({},r._getHitsSearchParams(f),l))}};return be=r,be}var je,yt;function rt(){return yt||(yt=1,je=function(){var t=Array.prototype.slice.call(arguments);return t.reduceRight(function(r,e){return Object.keys(Object(e)).forEac
2h(function(a){e[a]!==void 0&&(r[a]!==void 0&&delete r[a],r[a]=e[a])}),r},{})}),je}var Ee,_t;function oe(){return _t||(_t=1,Ee=function(t,r){if(Array.isArray(t)){for(var e=0;e<t.length;e++)if(r(t[e]))return t[e]}}),Ee}var Te,Ft;function on(){if(Ft)return Te;Ft=1;function n(t,r){return t.filter(function(e,a){return r.indexOf(e)>-1&&t.indexOf(e)===a})}return Te=n,Te}var Ie,St;function hn(){if(St)return Ie;St=1;function n(t){if(typeof t=="number")return t;if(typeof t=="string")return parseFloat(t);if(Array.isArray(t))return t.map(n);throw new Error("The value should be a number, a parsable string or an array of those.")}return Ie=n,Ie}var He,xt;function fn(){return xt||(xt=1,He=function(t){return t===null?!1:/^[a-zA-Z0-9_-]{1,64}$/.test(t)}),He}var Ae,wt;function ln(){if(wt)return Ae;wt=1;var n=rt(),t=et(),r=tt(),e={addRefinement:function(i,c,f){if(e.isRefined(i,c,f))return i;var l=""+f,d=i[c]?i[c].concat(l):[l],v={};return v[c]=d,n(v,i)},removeRefinement:function(i,c,f){if(f===void 0)return e.clearRefinement(i,function(d,v){return c===v});var l=""+f;return e.clearRefinement(i,function(d,v){return c===v&&l===d})},toggleRefinement:function(i,c,f){if(f===void 0)throw new Error("toggleRefinement should be used with a value");return e.isRefined(i,c,f)?e.removeRefinement(i,c,f):e.addRefinement(i,c,f)},clearRefinement:function(i,c,f){if(c===void 0)return t(i)?{}:i;if(typeof c=="string")return r(i,[c]);if(typeof c=="function"){var l=!1,d=Object.keys(i).reduce(function(v,R){var h=i[R]||[],s=h.filter(function(u){return!c(u,R,f)});return s.length!==h.length&&(l=!0),v[R]=s,v},{});return l?d:i}},isRefined:function(i,c,f){var l=!!i[c]&&i[c].length>0;if(f===void 0||!l)return l;var d=""+f;return i[c].indexOf(d)!==-1}};return Ae=e,Ae}var Oe,Pt;function nr(){if(Pt)return Oe;Pt=1;var n=rt(),t=oe(),r=on(),e=Ze(),a=et(),i=tt(),c=hn(),f=fn(),l=ln();function d(h,s){return Array.isArray(h)&&Array.isArray(s)?h.length===s.length&&h.every(function(u,S){return d(s[S],u)}):h===s}function v(h,s){return t(h,function(u){return d(u,s)})}function R(h){var s=h?R._parseNumbers(h):{};s.userToken!==void 0&&!f(s.userToken)&&console.warn("[algoliasearch-helper] The `userToken` parameter is invalid. This can lead to wrong analytics.\n - Format: [a-zA-Z0-9_-]{1,64}"),this.facets=s.facets||[],this.disjunctiveFacets=s.disjunctiveFacets||[],this.hierarchicalFacets=s.hierarchicalFacets||[],this.facetsRefinements=s.facetsRefinements||{},this.facetsExcludes=s.facetsExcludes||{},this.disjunctiveFacetsRefinements=s.disjunctiveFacetsRefinements||{},this.numericRefinements=s.numericRefinements||{},this.tagRefinements=s.tagRefinements||[],this.hierarchicalFacetsRefinements=s.hierarchicalFacetsRefinements||{};var u=this;Object.keys(s).forEach(function(S){var x=R.PARAMETERS.indexOf(S)!==-1,o=s[S]!==void 0;!x&&o&&(u[S]=s[S])})}return R.PARAMETERS=Object.keys(new R),R._parseNumbers=function(h){if(h instanceof R)return h;var s={},u=["aroundPrecision","aroundRadius","getRankingInfo","minWordSizefor2Typos","minWordSizefor1Typo","page","maxValuesPerFacet","distinct","minimumAroundRadius","hitsPerPage","minProximity"];if(u.forEach(function(x){var o=h[x];if(typeof o=="string"){var m=parseFloat(o);s[x]=isNaN(m)?o:m}}),Array.isArray(h.insideBoundingBox)&&(s.insideBoundingBox=h.insideBoundingBox.map(function(x){return Array.isArray(x)?x.map(function(o){return parseFloat(o)}):x})),h.numericRefinements){var S={};Object.keys(h.numericRefinements).forEach(function(x){var o=h.numericRefinements[x]||{};S[x]={},Object.keys(o).forEach(function(m){var y=o[m],_=y.map(function(w){return Array.isArray(w)?w.map(function(b){return typeof b=="string"?parseFloat(b):b}):typeof w=="string"?parseFloat(w):w});S[x][m]=_})}),s.numericRefinements=S}return e(h,s)},R.make=function(s){var u=new R(s),S=s.hierarchicalFacets||[];return S.forEach(function(x){if(x.rootPath){var o=u.getHierarchicalRefinement(x.name);o.length>0&&o[0].indexOf(x.rootPath)!==0&&(u=u.clearRefinements(x.name)),o=u.getHierarchicalRefinement(x.name),o.length===0&&(u=u.toggleHierarchicalFacetRefinement(x.name,x.rootPath))}}),u},R.validate=function(h,s){var u=s||{};return h.tagFilters&&u.tagRefinements&&u.tagRefinements.length>0?new Error("[Tags] Cannot switch from the managed tag API to the advanced API. It is probably an error, if it is really what you want, you should first clear the tags with clearTags method."):h.tagRefinements.length>0&&u.tagFilters?new Error("[Tags] Cannot switch from the advanced tag API to the managed API. It is probably an error, if it is not, you should first clear the tags with clearTags method."):h.numericFilters&&u.numericRefinements&&a(u.numericRefinements)?new Error("[Numeric filters] Can't switch from the advanced to the managed API. It is probably an error, if this is really what you want, you have to first clear the numeric filters."):a(h.numericRefinements)&&u.numericFilters?new Error("[Numeric filters] Can't switch from the managed API to the advanced. It is probably an error, if this is really what you want, you have to first clear the numeric filters."):null},R.prototype={constructor:R,clearRefinements:function(s){var u={numericRefinements:this._clearNumericRefinements(s),facetsRefinements:l.clearRefinement(this.facetsRefinements,s,"conjunctiveFacet"),facetsExcludes:l.clearRefinement(this.facetsExcludes,s,"exclude"),disjunctiveFacetsRefinements:l.clearRefinement(this.disjunctiveFacetsRefinements,s,"disjunctiveFacet"),hierarchicalFacetsRefinements:l.clearRefinement(this.hierarchicalFacetsRefinements,s,"hierarchicalFacet")};return u.numericRefinements===this.numericRefinements&&u.facetsRefinements===this.facetsRefinements&&u.facetsExcludes===this.facetsExcludes&&u.disjunctiveFacetsRefinements===this.disjunctiveFacetsRefinements&&u.hierarchicalFacetsRefinements===this.hierarchicalFacetsRefinements?this:this.setQueryParameters(u)},clearTags:function(){return this.tagFilters===void 0&&this.tagRefinements.length===0?this:this.setQueryParameters({tagFilters:void 0,tagRefinements:[]})},setIndex:function(s){return s===this.index?this:this.setQueryParameters({index:s})},setQuery:function(s){return s===this.query?this:this.setQueryParameters({query:s})},setPage:function(s){return s===this.page?this:this.setQueryParameters({page:s})},setFacets:function(s){return this.setQueryParameters({facets:s})},setDisjunctiveFacets:function(s){return this.setQueryParameters({disjunctiveFacets:s})},setHitsPerPage:function(s){return this.hitsPerPage===s?this:this.setQueryParameters({hitsPerPage:s})},setTypoTolerance:function(s){return this.typoTolerance===s?this:this.setQueryParameters({typoTolerance:s})},addNumericRefinement:function(h,s,u){var S=c(u);if(this.isNumericRefined(h,s,S))return this;var x=e({},this.numericRefinements);return x[h]=e({},x[h]),x[h][s]?(x[h][s]=x[h][s].slice(),x[h][s].push(S)):x[h][s]=[S],this.setQueryParameters({numericRefinements:x})},getConjunctiveRefinements:function(h){return this.isConjunctiveFacet(h)?this.facetsRefinements[h]||[]:[]},getDisjunctiveRefinements:function(h){return this.isDisjunctiveFacet(h)?this.disjunctiveFacetsRefinements[h]||[]:[]},getHierarchicalRefinement:function(h){return this.hierarchicalFacetsRefinements[h]||[]},getExcludeRefinements:function(h){return this.isConjunctiveFacet(h)?this.facetsExcludes[h]||[]:[]},removeNumericRefinement:function(h,s,u){var S=u;return S!==void 0?this.isNumericRefined(h,s,S)?this.setQueryParameters({numericRefinements:this._clearNumericRefinements(function(x,o){return o===h&&x.op===s&&d(x.val,c(S))})}):this:s!==void 0?this.isNumericRefined(h,s)?this.setQueryParameters({numericRefinements:this._clearNumericRefinements(function(x,o){return o===h&&x.op===s})}):this:this.isNumericRefined(h)?this.setQueryParameters({numericRefinements:this._clearNumericRefinements(function(x,o){return o===h})}):this},getNumericRefinements:function(h){return this.numericRefinements[h]||{}},getNumericRefinement:function(h,s){return this.numericRefinements[h]&&this.numericRefinements[h][s]},_clearNumericRefinements:function(s){if(s===void 0)return a(this.numericRefinements)?{}:this.numericRefinements;if(typeof s=="string")return i(this.numericRefinements,[s]);if(typeof s=="function"){var u=!1,S=this.numericRefinements,x=Object.keys(S).reduce(function(o,m){var y=S[m],_={};return y=y||{}
2,Object.keys(y).forEach(function(w){var b=y[w]||[],j=[];b.forEach(function(g){var p=s({val:g,op:w},m,"numeric");p||j.push(g)}),j.length!==b.length&&(u=!0),_[w]=j}),o[m]=_,o},{});return u?x:this.numericRefinements}},addFacet:function(s){return this.isConjunctiveFacet(s)?this:this.setQueryParameters({facets:this.facets.concat([s])})},addDisjunctiveFacet:function(s){return this.isDisjunctiveFacet(s)?this:this.setQueryParameters({disjunctiveFacets:this.disjunctiveFacets.concat([s])})},addHierarchicalFacet:function(s){if(this.isHierarchicalFacet(s.name))throw new Error("Cannot declare two hierarchical facets with the same name: `"+s.name+"`");return this.setQueryParameters({hierarchicalFacets:this.hierarchicalFacets.concat([s])})},addFacetRefinement:function(s,u){if(!this.isConjunctiveFacet(s))throw new Error(s+" is not defined in the facets attribute of the helper configuration");return l.isRefined(this.facetsRefinements,s,u)?this:this.setQueryParameters({facetsRefinements:l.addRefinement(this.facetsRefinements,s,u)})},addExcludeRefinement:function(s,u){if(!this.isConjunctiveFacet(s))throw new Error(s+" is not defined in the facets attribute of the helper configuration");return l.isRefined(this.facetsExcludes,s,u)?this:this.setQueryParameters({facetsExcludes:l.addRefinement(this.facetsExcludes,s,u)})},addDisjunctiveFacetRefinement:function(s,u){if(!this.isDisjunctiveFacet(s))throw new Error(s+" is not defined in the disjunctiveFacets attribute of the helper configuration");return l.isRefined(this.disjunctiveFacetsRefinements,s,u)?this:this.setQueryParameters({disjunctiveFacetsRefinements:l.addRefinement(this.disjunctiveFacetsRefinements,s,u)})},addTagRefinement:function(s){if(this.isTagRefined(s))return this;var u={tagRefinements:this.tagRefinements.concat(s)};return this.setQueryParameters(u)},removeFacet:function(s){return this.isConjunctiveFacet(s)?this.clearRefinements(s).setQueryParameters({facets:this.facets.filter(function(u){return u!==s})}):this},removeDisjunctiveFacet:function(s){return this.isDisjunctiveFacet(s)?this.clearRefinements(s).setQueryParameters({disjunctiveFacets:this.disjunctiveFacets.filter(function(u){return u!==s})}):this},removeHierarchicalFacet:function(s){return this.isHierarchicalFacet(s)?this.clearRefinements(s).setQueryParameters({hierarchicalFacets:this.hierarchicalFacets.filter(function(u){return u.name!==s})}):this},removeFacetRefinement:function(s,u){if(!this.isConjunctiveFacet(s))throw new Error(s+" is not defined in the facets attribute of the helper configuration");return l.isRefined(this.facetsRefinements,s,u)?this.setQueryParameters({facetsRefinements:l.removeRefinement(this.facetsRefinements,s,u)}):this},removeExcludeRefinement:function(s,u){if(!this.isConjunctiveFacet(s))throw new Error(s+" is not defined in the facets attribute of the helper configuration");return l.isRefined(this.facetsExcludes,s,u)?this.setQueryParameters({facetsExcludes:l.removeRefinement(this.facetsExcludes,s,u)}):this},removeDisjunctiveFacetRefinement:function(s,u){if(!this.isDisjunctiveFacet(s))throw new Error(s+" is not defined in the disjunctiveFacets attribute of the helper configuration");return l.isRefined(this.disjunctiveFacetsRefinements,s,u)?this.setQueryParameters({disjunctiveFacetsRefinements:l.removeRefinement(this.disjunctiveFacetsRefinements,s,u)}):this},removeTagRefinement:function(s){if(!this.isTagRefined(s))return this;var u={tagRefinements:this.tagRefinements.filter(function(S){return S!==s})};return this.setQueryParameters(u)},toggleRefinement:function(s,u){return this.toggleFacetRefinement(s,u)},toggleFacetRefinement:function(s,u){if(this.isHierarchicalFacet(s))return this.toggleHierarchicalFacetRefinement(s,u);if(this.isConjunctiveFacet(s))return this.toggleConjunctiveFacetRefinement(s,u);if(this.isDisjunctiveFacet(s))return this.toggleDisjunctiveFacetRefinement(s,u);throw new Error("Cannot refine the undeclared facet "+s+"; it should be added to the helper options facets, disjunctiveFacets or hierarchicalFacets")},toggleConjunctiveFacetRefinement:function(s,u){if(!this.isConjunctiveFacet(s))throw new Error(s+" is not defined in the facets attribute of the helper configuration");return this.setQueryParameters({facetsRefinements:l.toggleRefinement(this.facetsRefinements,s,u)})},toggleExcludeFacetRefinement:function(s,u){if(!this.isConjunctiveFacet(s))throw new Error(s+" is not defined in the facets attribute of the helper configuration");return this.setQueryParameters({facetsExcludes:l.toggleRefinement(this.facetsExcludes,s,u)})},toggleDisjunctiveFacetRefinement:function(s,u){if(!this.isDisjunctiveFacet(s))throw new Error(s+" is not defined in the disjunctiveFacets attribute of the helper configuration");return this.setQueryParameters({disjunctiveFacetsRefinements:l.toggleRefinement(this.disjunctiveFacetsRefinements,s,u)})},toggleHierarchicalFacetRefinement:function(s,u){if(!this.isHierarchicalFacet(s))throw new Error(s+" is not defined in the hierarchicalFacets attribute of the helper configuration");var S=this._getHierarchicalFacetSeparator(this.getHierarchicalFacetByName(s)),x={},o=this.hierarchicalFacetsRefinements[s]!==void 0&&this.hierarchicalFacetsRefinements[s].length>0&&(this.hierarchicalFacetsRefinements[s][0]===u||this.hierarchicalFacetsRefinements[s][0].indexOf(u+S)===0);return o?u.indexOf(S)===-1?x[s]=[]:x[s]=[u.slice(0,u.lastIndexOf(S))]:x[s]=[u],this.setQueryParameters({hierarchicalFacetsRefinements:n(x,this.hierarchicalFacetsRefinements)})},addHierarchicalFacetRefinement:function(h,s){if(this.isHierarchicalFacetRefined(h))throw new Error(h+" is already refined.");
2if(!this.isHierarchicalFacet(h))throw new Error(h+" is not defined in the hierarchicalFacets attribute of the helper configuration.");var u={};return u[h]=[s],this.setQueryParameters({hierarchicalFacetsRefinements:n(u,this.hierarchicalFacetsRefinements)})},removeHierarchicalFacetRefinement:function(h){if(!this.isHierarchicalFacetRefined(h))return this;var s={};return s[h]=[],this.setQueryParameters({hierarchicalFacetsRefinements:n(s,this.hierarchicalFacetsRefinements)})},toggleTagRefinement:function(s){return this.isTagRefined(s)?this.removeTagRefinement(s):this.addTagRefinement(s)},isDisjunctiveFacet:function(h){return this.disjunctiveFacets.indexOf(h)>-1},isHierarchicalFacet:function(h){return this.getHierarchicalFacetByName(h)!==void 0},isConjunctiveFacet:function(h){return this.facets.indexOf(h)>-1},isFacetRefined:function(s,u){return this.isConjunctiveFacet(s)?l.isRefined(this.facetsRefinements,s,u):!1},isExcludeRefined:function(s,u){return this.isConjunctiveFacet(s)?l.isRefined(this.facetsExcludes,s,u):!1},isDisjunctiveFacetRefined:function(s,u){return this.isDisjunctiveFacet(s)?l.isRefined(this.disjunctiveFacetsRefinements,s,u):!1},isHierarchicalFacetRefined:function(s,u){if(!this.isHierarchicalFacet(s))return!1;var S=this.getHierarchicalRefinement(s);return u?S.indexOf(u)!==-1:S.length>0},isNumericRefined:function(s,u,S){if(S===void 0&&u===void 0)return!!this.numericRefinements[s];var x=this.numericRefinements[s]&&this.numericRefinements[s][u]!==void 0;if(S===void 0||!x)return x;var o=c(S),m=v(this.numericRefinements[s][u],o)!==void 0;return x&&m},isTagRefined:function(s){return this.tagRefinements.indexOf(s)!==-1},getRefinedDisjunctiveFacets:function(){var s=this,u=r(Object.keys(this.numericRefinements).filter(function(S){return Object.keys(s.numericRefinements[S]).length>0}),this.disjunctiveFacets);return Object.keys(this.disjunctiveFacetsRefinements).filter(function(S){return s.disjunctiveFacetsRefinements[S].length>0}).concat(u).concat(this.getRefinedHierarchicalFacets()).sort()},getRefinedHierarchicalFacets:function(){var s=this;return r(this.hierarchicalFacets.map(function(u){return u.name}),Object.keys(this.hierarchicalFacetsRefinements).filter(function(u){return s.hierarchicalFacetsRefinements[u].length>0})).sort()},getUnrefinedDisjunctiveFacets:function(){var h=this.getRefinedDisjunctiveFacets();return this.disjunctiveFacets.filter(function(s){return h.indexOf(s)===-1})},managedParameters:["index","facets","disjunctiveFacets","facetsRefinements","hierarchicalFacets","facetsExcludes","disjunctiveFacetsRefinements","numericRefinements","tagRefinements","hierarchicalFacetsRefinements"],getQueryParams:function(){var s=this.managedParameters,u={},S=this;return Object.keys(this).forEach(function(x){var o=S[x];s.indexOf(x)===-1&&o!==void 0&&(u[x]=o)}),u},setQueryParameter:function(s,u){if(this[s]===u)return this;var S={};return S[s]=u,this.setQueryParameters(S)},setQueryParameters:function(s){if(!s)return this;var u=R.validate(this,s);if(u)throw u;var S=this,x=R._parseNumbers(s),o=Object.keys(this).reduce(function(y,_){return y[_]=S[_],y},{}),m=Object.keys(x).reduce(function(y,_){var w=y[_]!==void 0,b=x[_]!==void 0;return w&&!b?i(y,[_]):(b&&(y[_]=x[_]),y)},o);return new this.constructor(m)},resetPage:function(){return this.page===void 0?this:this.setPage(0)},_getHierarchicalFacetSortBy:function(h){return h.sortBy||["isRefined:desc","name:asc"]},_getHierarchicalFacetSeparator:function(h){return h.separator||" > "},_getHierarchicalRootPath:function(h){return h.rootPath||null},_getHierarchicalShowParentLevel:function(h){return typeof h.showParentLevel=="boolean"?h.showParentLevel:!0},getHierarchicalFacetByName:function(h){return t(this.hierarchicalFacets,function(s){return s.name===h})},getHierarchicalFacetBreadcrumb:function(h){if(!this.isHierarchicalFacet(h))return[];var s=this.getHierarchicalRefinement(h)[0];if(!s)return[];var u=this._getHierarchicalFacetSeparator(this.getHierarchicalFacetByName(h)),S=s.split(u);return S.map(function(x){return x.trim()})},toString:function(){return JSON.stringify(this,null,2)}},Oe=R,Oe}var Ce,bt;function dn(){return bt||(bt=1,Ce=function(t){return Array.isArray(t)?t.filter(Boolean):[]}),Ce}var De,jt;function mn(){return jt||(jt=1,De=function(t,r){if(!Array.isArray(t))return-1;for(var e=0;e<t.length;e++)if(r(t[e]))return e;return-1}),De}var Ne,Et;function ir(){if(Et)return Ne;Et=1;var n=oe();return Ne=function(r,e){var a=(e||[]).map(function(i){return i.split(":")});return r.reduce(function(c,f){var l=f.split(":"),d=n(a,function(v){return v[0]===l[0]});return l.length>1||!d?(c[0].push(l[0]),c[1].push(l[1]),c):(c[0].push(d[0]),c[1].push(d[1]),c)},[[],[]])},Ne}var Qe,Tt;function vn(){if(Tt)return Qe;Tt=1;function n(){var t=Array.prototype.slice.call(arguments);return t.reduceRight(function(r,e){return Object.keys(Object(e)).forEac
2h(function(a){var i=typeof r[a]=="number"?r[a]:0,c=e[a];c!==void 0&&c>=i&&(r[a]!==void 0&&delete r[a],r[a]=c)}),r},{})}return Qe=n,Qe}var Ue,It;function ar(){if(It)return Ue;It=1;function n(r,e){if(r!==e){var a=r!==void 0,i=r===null,c=e!==void 0,f=e===null;if(!f&&r>e||i&&c||!a)return 1;if(!i&&r<e||f&&a||!c)return-1}return 0}function t(r,e,a){if(!Array.isArray(r))return[];Array.isArray(a)||(a=[]);var i=r.map(function(c,f){return{criteria:e.map(function(l){return c[l]}),index:f,value:c}});return i.sort(function(f,l){for(var d=-1;++d<f.criteria.length;){var v=n(f.criteria[d],l.criteria[d]);if(v)return d>=a.length?v:a[d]==="desc"?-v:v}return f.index-l.index}),i.map(function(c){return c.value})}return Ue=t,Ue}var We,Ht;function gn(){if(Ht)return We;Ht=1,We=c;var n=Ye(),t=oe(),r=ir(),e=ar(),a=n.escapeFacetValue,i=n.unescapeFacetValue;function c(v){return function(h,s){var u=v.hierarchicalFacets[s],S=v.hierarchicalFacetsRefinements[u.name]&&v.hierarchicalFacetsRefinements[u.name][0]||"",x=v._getHierarchicalFacetSeparator(u),o=v._getHierarchicalRootPath(u),m=v._getHierarchicalShowParentLevel(u),y=r(v._getHierarchicalFacetSortBy(u)),_=h.every(function(j){return j.exhaustive}),w=f(y,x,o,m,S),b=h;return o&&(b=h.slice(o.split(x).length)),b.reduce(w,{name:v.hierarchicalFacets[s].name,count:null,isRefined:!0,path:null,escapedValue:null,exhaustive:_,data:null})}}function f(v,R,h,s,u){return function(x,o,m){var y=x;if(m>0){var _=0;for(y=x;_<m;){var w=y&&Array.isArray(y.data)?y.data:[];y=t(w,function(j){return j.isRefined}),_++}}if(y){var b=Object.keys(o.data).map(function(j){return[j,o.data[j]]}).filter(function(j){var g=j[0];return l(g,y.path||h,u,R,h,s)});y.data=e(b.map(function(j){var g=j[0],p=j[1];return d(p,g,R,i(u),o.exhaustive)}),v[0],v[1])}return x}}function l(v,R,h,s,u,S){return u&&(v.indexOf(u)!==0||u===v)?!1:!u&&v.indexOf(s)===-1||u&&v.split(s).length-u.split(s).length===1||v.indexOf(s)===-1&&h.indexOf(s)===-1||h.indexOf(v)===0||v.indexOf(R+s)===0&&(S||v.indexOf(h)===0)}function d(v,R,h,s,u){var S=R.split(h);return{name:S[S.length-1].trim(),path:R,escapedValue:a(R),count:v,isRefined:s===R||s.indexOf(R+h)===0,exhaustive:u,data:null}}return We}var $e,At;function sr(){if(At)return $e;At=1;var n=dn(),t=rt(),r=Ye(),e=oe(),a=mn(),i=ir(),c=vn(),f=ar(),l=r.escapeFacetValue,d=r.unescapeFacetValue,v=gn();function R(g){var p={};return g.forEach(function(F,P){p[F]=P}),p}function h(g,p,F){p&&p[F]&&(g.stats=p[F])}function s(g,p){return e(g,function(P){var E=P.attributes||[];return E.indexOf(p)>-1})}function u(g,p,F){var P=p[0]||{};this._rawResults=p;var E=this;Object.keys(P).forEach(function(H){E[H]=P[H]});var I=t(F,{persistHierarchicalRootCount:!1});Object.keys(I).forEach(function(H){E[H]=I[H]}),this.processingTimeMS=p.reduce(function(H,W){return W.processingTimeMS===void 0?H:H+W.processingTimeMS},0),this.disjunctiveFacets=[],this.hierarchicalFacets=g.hierarchicalFacets.map(function(){return[]}),this.facets=[];var N=g.getRefinedDisjunctiveFacets(),q=R(g.facets),A=R(g.disjunctiveFacets),C=1,Q=P.facets||{};Object.keys(Q).forEach(function(H){var W=Q[H],D=s(g.hierarchicalFacets,H);if(D){var U=D.attributes.indexOf(H),$=a(g.hierarchicalFacets,function(Y){return Y.name===D.name});E.hierarchicalFacets[$][U]={attribute:H,data:W,exhaustive:P.exhaustiveFacetsCount}}else{var M=g.disjunctiveFacets.indexOf(H)!==-1,k=g.facets.indexOf(H)!==-1,B;M&&(B=A[H],E.disjunctiveFacets[B]={name:H,data:W,exhaustive:P.exhaustiveFacetsCount},h(E.disjunctiveFacets[B],P.facets_stats,H)),k&&(B=q[H],E.facets[B]={name:H,data:W,exhaustive:P.exhaustiveFacetsCount},h(E.facets[B],P.facets_stats,H))}}),this.hierarchicalFacets=n(this.hierarchicalFacets),N.forEach(function(H){var W=p[C],D=W&&W.facets?W.facets:{},U=g.getHierarchicalFacetByName(H);Object.keys(D).forEach(function($){var M=D[$],k;if(U){k=a(g.hierarchicalFacets,function(J){return J.name===U.name});var B=a(E.hierarchicalFacets[k],function(J){return J.attribute===$});if(B===-1)return;E.hierarchicalFacets[k][B].data=E.persistHierarchicalRootCount?c(E.hierarchicalFacets[k][B].data,M):t(M,E.hierarchicalFacets[k][B].data)}else{k=A[$];var Y=P.facets&&P.facets[$]||{};E.disjunctiveFacets[k]={name:$,data:c(Y,M),exhaustive:W.exhaustiveFacetsCount},h(E.disjunctiveFacets[k],W.facets_stats,$),g.disjunctiveFacetsRefinements[$]&&g.disjunctiveFacetsRefinements[$].forEach(function(J){!E.disjunctiveFacets[k].data[J]&&g.disjunctiveFacetsRefinements[$].indexOf(d(J))>-1&&(E.disjunctiveFacets[k].data[J]=0)})}}),C++}
2),g.getRefinedHierarchicalFacets().forEach(function(H){var W=g.getHierarchicalFacetByName(H),D=g._getHierarchicalFacetSeparator(W),U=g.getHierarchicalRefinement(H);U.length===0||U[0].split(D).length<2||p.slice(C).forEach(function($){var M=$&&$.facets?$.facets:{};Object.keys(M).forEach(function(k){var B=M[k],Y=a(g.hierarchicalFacets,function(ve){return ve.name===W.name}),J=a(E.hierarchicalFacets[Y],function(ve){return ve.attribute===k});if(J!==-1){var it={};if(U.length>0&&!E.persistHierarchicalRootCount){var at=U[0].split(D)[0];it[at]=E.hierarchicalFacets[Y][J].data[at]}E.hierarchicalFacets[Y][J].data=t(it,B,E.hierarchicalFacets[Y][J].data)}}),C++})}),Object.keys(g.facetsExcludes).forEach(function(H){var W=g.facetsExcludes[H],D=q[H];E.facets[D]={name:H,data:Q[H],exhaustive:P.exhaustiveFacetsCount},W.forEach(function(U){E.facets[D]=E.facets[D]||{name:H},E.facets[D].data=E.facets[D].data||{},E.facets[D].data[U]=0})}),this.hierarchicalFacets=this.hierarchicalFacets.map(v(g)),this.facets=n(this.facets),this.disjunctiveFacets=n(this.disjunctiveFacets),this._state=g}u.prototype.getFacetByName=function(g){function p(F){return F.name===g}return e(this.facets,p)||e(this.disjunctiveFacets,p)||e(this.hierarchicalFacets,p)};function S(g,p){function F(Q){return Q.name===p}if(g._state.isConjunctiveFacet(p)){var P=e(g.facets,F);return P?Object.keys(P.data).map(function(Q){var H=l(Q);return{name:Q,escapedValue:H,count:P.data[Q],isRefined:g._state.isFacetRefined(p,H),isExcluded:g._state.isExcludeRefined(p,Q)}}):[]}else if(g._state.isDisjunctiveFacet(p)){var E=e(g.disjunctiveFacets,F);return E?Object.keys(E.data).map(function(Q){var H=l(Q);return{name:Q,escapedValue:H,count:E.data[Q],isRefined:g._state.isDisjunctiveFacetRefined(p,H)}}):[]}else if(g._state.isHierarchicalFacet(p)){var I=e(g.hierarchicalFacets,F);if(!I)return I;var N=g._state.getHierarchicalFacetByName(p),q=g._state._getHierarchicalFacetSeparator(N),A=d(g._state.getHierarchicalRefinement(p)[0]||"");A.indexOf(N.rootPath)===0&&(A=A.replace(N.rootPath+q,""));var C=A.split(q);return C.unshift(p),x(I,C,0),I}}function x(g,p,F){g.isRefined=g.name===(p[F]&&p[F].trim()),g.data&&g.data.forEach(function(P){x(P,p,F+1)})}function o(g,p,F,P){if(P=P||0,Array.isArray(p))return g(p,F[P]);if(!p.data||p.data.length===0)return p;var E=p.data.map(function(q){return o(g,q,F,P+1)}),I=g(E,F[P]),N=t({data:I},p);return N}u.DEFAULT_SORT=["isRefined:desc","count:desc","name:asc"];function m(g,p){return p.sort(g)}function y(g,p){var F=[],P=[],E=p.hide||[],I=p.order||[],N=I.reduce(function(C,Q,H){return C[Q]=H,C},{});g.forEach(function(C){var Q=C.path||C.name,H=E.indexOf(Q)>-1;!H&&N[Q]!==void 0?F[N[Q]]=C:H||P.push(C)}),F=F.filter(function(C){return C});var q=p.sortRemainingBy,A;return q==="hidden"?F:(q==="alpha"?A=[["path","name"],["asc","asc"]]:A=[["count"],["desc"]],F.concat(f(P,A[0],A[1])))}function _(g,p){return g.renderingContent&&g.renderingContent.facetOrdering&&g.renderingContent.facetOrdering.values&&g.renderingContent.facetOrdering.values[p]}u.prototype.getFacetValues=function(g,p){var F=S(this,g);if(F){var P=t(p,{sortBy:u.DEFAULT_SORT,facetOrdering:!(p&&p.sortBy)}),E=this,I;if(Array.isArray(F))I=[g];else{var N=E._state.getHierarchicalFacetByName(F.name);I=N.attributes}return o(function(q,A){var C=_(E,A);if(P.facetOrdering&&C)return y(q,C);if(Array.isArray(P.sortBy)){var Q=i(P.sortBy,u.DEFAULT_SORT),H=f(q,Q[0],Q[1]),W=C&&C.hide?C.hide:[];if(W.length>0){var D=[];return H.forEach(function(U){var $=U.path||U.name;W.indexOf($)===-1&&D.push(U)}),D}return H}else if(typeof P.sortBy=="function")return m(P.sortBy,q);throw new Error("options.sortBy is optional but if defined it must be either an array of string (predicates) or a sorting function")},F,I)}},u.prototype.getFacetStats=function(g){if(this._state.isConjunctiveFacet(g))return w(this.facets,g);if(this._state.isDisjunctiveFacet(g))return w(this.disjunctiveFacets,g)};function w(g,p){var F=e(g,function(P){return P.name===p});return F&&F.stats}u.prototype.getRefinements=function(){var g=this._state,p=this,F=[];
2return Object.keys(g.facetsRefinements).forEach(function(P){g.facetsRefinements[P].forEach(function(E){F.push(b(g,"facet",P,E,p.facets))})}),Object.keys(g.facetsExcludes).forEach(function(P){g.facetsExcludes[P].forEach(function(E){F.push(b(g,"exclude",P,E,p.facets))})}),Object.keys(g.disjunctiveFacetsRefinements).forEach(function(P){g.disjunctiveFacetsRefinements[P].forEach(function(E){F.push(b(g,"disjunctive",P,E,p.disjunctiveFacets))})}),Object.keys(g.hierarchicalFacetsRefinements).forEach(function(P){g.hierarchicalFacetsRefinements[P].forEach(function(E){F.push(j(g,P,E,p.hierarchicalFacets))})}),Object.keys(g.numericRefinements).forEach(function(P){var E=g.numericRefinements[P];Object.keys(E).forEach(function(I){E[I].forEach(function(N){F.push({type:"numeric",attributeName:P,name:N,numericValue:N,operator:I})})})}),g.tagRefinements.forEach(function(P){F.push({type:"tag",attributeName:"_tags",name:P})}),F};function b(g,p,F,P,E){var I=e(E,function(A){return A.name===F}),N=I&&I.data&&I.data[P]?I.data[P]:0,q=I&&I.exhaustive||!1;return{type:p,attributeName:F,name:P,count:N,exhaustive:q}}function j(g,p,F,P){var E=g.getHierarchicalFacetByName(p),I=g._getHierarchicalFacetSeparator(E),N=F.split(I),q=e(P,function(W){return W.name===p}),A=N.reduce(function(W,D){var U=W&&e(W.data,function($){return $.name===D});return U!==void 0?U:W},q),C=A&&A.count||0,Q=A&&A.exhaustive||!1,H=A&&A.path||"";return{type:"hierarchical",attributeName:p,name:H,count:C,exhaustive:Q}}return $e=u,$e}var qe,Ot;function pn(){return Ot||(Ot=1,qe=function(t){return t.reduce(function(r,e){return r.concat(e)},[])}),qe}var Le,Ct;function Rn(){if(Ct)return Le;Ct=1;var n=oe(),t=pn();function r(a,i){var c=[];return Object.keys(a).forEach(function(f){a[f].count<2&&(a[f].indexSum+=100),c.push({objectID:f,avgOfIndices:a[f].indexSum/i})}),c.sort(function(f,l){return f.avgOfIndices>l.avgOfIndices?1:-1})}function e(a,i){var c={};i.forEach(function(d){d.forEach(function(v,R){a.includes(v.objectID)||(c[v.objectID]?c[v.objectID]={indexSum:c[v.objectID].indexSum+R,count:c[v.objectID].count+1}:c[v.objectID]={indexSum:R,count:1})})});var f=r(c,i.length),l=f.reduce(function(d,v){var R=n(t(i),function(h){return h.objectID===v.objectID});return R?d.concat(R):d},[]);return l}return Le=e,Le}var ke,Dt;function cr(){return Dt||(Dt=1,ke="3.28.1"),ke}var Me,Nt;function yn(){if(Nt)return Me;Nt=1;var n=Xe(),t=cn(),r=Ye().escapeFacetValue,e=er(),a=Ze(),i=et(),c=tt(),f=tr(),l=rr(),d=un(),v=nr(),R=sr(),h=Rn(),s=cr();function u(o,m,y,_){typeof o.addAlgoliaAgent=="function"&&o.addAlgoliaAgent("JS Helper ("+s+")"),this.setClient(o);var w=y||{};w.index=m,this.state=v.make(w),this.recommendState=new f({params:w.recommendState}),this.lastResults=null,this.lastRecommendResults=null,this._queryId=0,this._recommendQueryId=0,this._lastQueryIdReceived=-1,this._lastRecommendQueryIdReceived=-1,this.derivedHelpers=[],this._currentNbQueries=0,this._currentNbRecommendQueries=0,this._searchResultsOptions=_,this._recommendCache={}}e(u,n),u.prototype.search=function(){return this._search({onlyWithDerivedHelpers:!1}),this},u.prototype.searchOnlyWithDerivedHelpers=function(){return this._search({onlyWithDerivedHelpers:!0}),this},u.prototype.searchWithComposition=function(){return this._runComposition({onlyWithDerivedHelpers:!0}),this},u.prototype.recommend=function(){return this._recommend(),this},u.prototype.getQuery=function(){var o=this.state;return d._getHitsSearchParams(o)},u.prototype.searchOnce=function(o,m){var y=o?this.state.setQueryParameters(o):this.state,_=d._getQueries(y.index,y),w=this;if(this._currentNbQueries++,this.emit("searchOnce",{state:y}),m){this.client.search(_).then(function(b){w._currentNbQueries--,w._currentNbQueries===0&&w.emit("searchQueueEmpty"),m(null,new R(y,b.results),y)}).catch(function(b){w._currentNbQueries--,w._currentNbQueries===0&&w.emit("searchQueueEmpty"),m(b,null,y)});return}return this.client.search(_).then(function(b){return w._currentNbQueries--,w._currentNbQueries===0&&w.emit("searchQueueEmpty"),{content:new R(y,b.results),state:y,_originalResponse:b}},function(b){throw w._currentNbQueries--,w._currentNbQueries===0&&w.emit("searchQueueEmpty"),b})},u.prototype.findAnswers=function(o){console.warn("[algoliasearch-helper] answers is no longer supported");var m=this.state,y=this.derivedHelpers[0];if(!y)return Promise.resolve([]);var _=y.getModifiedState(m),w=a({attributesForPrediction:o.attributesForPrediction,nbHits:o.nbHits},{params:c(d._getHitsSearchParams(_),["attributesToSnippet","hitsPerPage","restrictSearchableAttributes","snippetEllipsisText"])}),b="search for answers was called, but this client does not have a function client.initIndex(index).findAnswers";if(typeof this.client.initIndex!="function")throw new Error(b);var j=this.client.initIndex(_.index);if(typeof j.findAnswers!="function")throw new Error(b);return j.findAnswers(_.query,o.queryLanguages,w)},u.prototype.searchForFacetValues=function(o,m,y,_){var w=typeof this.client.searchForFacetValues=="function"&&typeof this.client.searchForFacets!="function",b=typeof this.client.initIndex=="function";if(!w&&!b&&typeof this.client.search!="function")throw new Error("search for facet values (searchable) was called, but this client does not have a function client.searchForFacetValues or client.initIndex(index).searchForFacetValues");var j=this.state.setQueryParameters(_||{}),g=j.isDisjunctiveFacet(o),p=d.getSearchForFacetQuery(o,m,y,j);this._currentNbQueries++;var F=this,P;w?P=this.client.searchForFacetValues([{indexName:j.index,params:p}]):b?P=this.client.initIndex(j.index).searchForFacetValues(p):(delete p.facetName,P=this.client.search([{type:"facet",facet:o,indexName:j.index,params:p}]).then(function(N){return N.results[0]}
2)),this.emit("searchForFacetValues",{state:j,facet:o,query:m});var E=this.lastResults&&this.lastResults.index===j.index&&this.lastResults.renderingContent&&this.lastResults.renderingContent.facetOrdering&&this.lastResults.renderingContent.facetOrdering.values&&this.lastResults.renderingContent.facetOrdering.values[o]&&this.lastResults.renderingContent.facetOrdering.values[o].hide||[];return P.then(function(N){return F._currentNbQueries--,F._currentNbQueries===0&&F.emit("searchQueueEmpty"),N=Array.isArray(N)?N[0]:N,N.facetHits=N.facetHits.reduce(function(q,A){return E.indexOf(A.value)>-1||(A.escapedValue=r(A.value),A.isRefined=g?j.isDisjunctiveFacetRefined(o,A.escapedValue):j.isFacetRefined(o,A.escapedValue),q.push(A)),q},[]),N},function(I){throw F._currentNbQueries--,F._currentNbQueries===0&&F.emit("searchQueueEmpty"),I})},u.prototype.searchForCompositionFacetValues=function(o,m,y,_){if(typeof this.client.searchForFacetValues!="function")throw new Error("search for facet values (searchable) was called, but this client does not have a function client.searchForFacetValues");var w=this.state.setQueryParameters(_||{}),b=w.isDisjunctiveFacet(o);this._currentNbQueries++;var j=this,g;return g=this.client.searchForFacetValues({compositionID:w.index,facetName:o,searchForFacetValuesRequest:{params:{query:m,maxFacetHits:y,searchQuery:d._getCompositionHitsSearchParams(w)}}}),this.emit("searchForFacetValues",{state:w,facet:o,query:m}),g.then(function(F){return j._currentNbQueries--,j._currentNbQueries===0&&j.emit("searchQueueEmpty"),F=F.results[0],F.facetHits.forEach(function(P){P.escapedValue=r(P.value),P.isRefined=b?w.isDisjunctiveFacetRefined(o,P.escapedValue):w.isFacetRefined(o,P.escapedValue)}),F},function(p){throw j._currentNbQueries--,j._currentNbQueries===0&&j.emit("searchQueueEmpty"),p})},u.prototype.setQuery=function(o){return this._change({state:this.state.resetPage().setQuery(o),isPageReset:!0}),this},u.prototype.clearRefinements=function(o){return this._change({state:this.state.resetPage().clearRefinements(o),isPageReset:!0}),this},u.prototype.clearTags=function(){return this._change({state:this.state.resetPage().clearTags(),isPageReset:!0}),this},u.prototype.addDisjunctiveFacetRefinement=function(o,m){return this._change({state:this.state.resetPage().addDisjunctiveFacetRefinement(o,m),isPageReset:!0}),this},u.prototype.addDisjunctiveRefine=function(){return this.addDisjunctiveFacetRefinement.apply(this,arguments)},u.prototype.addHierarchicalFacetRefinement=function(o,m){return this._change({state:this.state.resetPage().addHierarchicalFacetRefinement(o,m),isPageReset:!0}),this},u.prototype.addNumericRefinement=function(o,m,y){return this._change({state:this.state.resetPage().addNumericRefinement(o,m,y),isPageReset:!0}),this},u.prototype.addFacetRefinement=function(o,m){return this._change({state:this.state.resetPage().addFacetRefinement(o,m),isPageReset:!0}),this},u.prototype.addRefine=function(){return this.addFacetRefinement.apply(this,arguments)},u.prototype.addFacetExclusion=function(o,m){return this._change({state:this.state.resetPage().addExcludeRefinement(o,m),isPageReset:!0}),this},u.prototype.addExclude=function(){return this.addFacetExclusion.apply(this,arguments)},u.prototype.addTag=function(o){return this._change({state:this.state.resetPage().addTagRefinement(o),isPageReset:!0}),this},u.prototype.addFrequentlyBoughtTogether=function(o){return this._recommendChange({state:this.recommendState.addFrequentlyBoughtTogether(o)}),this},u.prototype.addRelatedProducts=function(o){return this._recommendChange({state:this.recommendState.addRelatedProducts(o)}),this},u.prototype.addTrendingItems=function(o){return this._recommendChange({state:this.recommendState.addTrendingItems(o)}),this},u.prototype.addTrendingFacets=function(o){return this._recommendChange({state:this.recommendState.addTrendingFacets(o)}),this},u.prototype.addLookingSimilar=function(o){return this._recommendChange({state:this.recommendState.addLookingSimilar(o)}),this},u.prototype.removeNumericRefinement=function(o,m,y){return this._change({state:this.state.resetPage().removeNumericRefinement(o,m,y),isPageReset:!0}),this},u.prototype.removeDisjunctiveFacetRefinement=function(o,m){return this._change({state:this.state.resetPage().removeDisjunctiveFacetRefinement(o,m),isPageReset:!0}),this},u.prototype.removeDisjunctiveRefine=function(){return this.removeDisjunctiveFacetRefinement.apply(this,arguments)},u.prototype.removeHierarchicalFacetRefinement=function(o){return this._change({state:this.state.resetPage().removeHierarchicalFacetRefinement(o),isPageReset:!0}),this},u.prototype.removeFacetRefinement=function(o,m){return this._change({state:this.state.resetPage().removeFacetRefinement(o,m),isPageReset:!0}),this},u.prototype.removeRefine=function(){return this.removeFacetRefinement.apply(this,arguments)},u.prototype.removeFacetExclusion=function(o,m){return this._change({state:this.state.resetPage().removeExcludeRefinement(o,m),isPageReset:!0}),this},u.prototype.removeExclude=function(){return this.removeFacetExclusion.apply(this,arguments)},u.prototype.removeTag=function(o){return this._change({state:this.state.resetPage().removeTagRefinement(o),isPageReset:!0}),this},u.prototype.removeFrequentlyBoughtTogether=function(o){return this._recommendChange({state:this.recommendState.removeParam
2s(o)}),this},u.prototype.removeRelatedProducts=function(o){return this._recommendChange({state:this.recommendState.removeParams(o)}),this},u.prototype.removeTrendingItems=function(o){return this._recommendChange({state:this.recommendState.removeParams(o)}),this},u.prototype.removeTrendingFacets=function(o){return this._recommendChange({state:this.recommendState.removeParams(o)}),this},u.prototype.removeLookingSimilar=function(o){return this._recommendChange({state:this.recommendState.removeParams(o)}),this},u.prototype.toggleFacetExclusion=function(o,m){return this._change({state:this.state.resetPage().toggleExcludeFacetRefinement(o,m),isPageReset:!0}),this},u.prototype.toggleExclude=function(){return this.toggleFacetExclusion.apply(this,arguments)},u.prototype.toggleRefinement=function(o,m){return this.toggleFacetRefinement(o,m)},u.prototype.toggleFacetRefinement=function(o,m){return this._change({state:this.state.resetPage().toggleFacetRefinement(o,m),isPageReset:!0}),this},u.prototype.toggleRefine=function(){return this.toggleFacetRefinement.apply(this,arguments)},u.prototype.toggleTag=function(o){return this._change({state:this.state.resetPage().toggleTagRefinement(o),isPageReset:!0}),this},u.prototype.nextPage=function(){var o=this.state.page||0;return this.setPage(o+1)},u.prototype.previousPage=function(){var o=this.state.page||0;return this.setPage(o-1)};function S(o){if(o<0)throw new Error("Page requested below 0.");return this._change({state:this.state.setPage(o),isPageReset:!1}),this}u.prototype.setCurrentPage=S,u.prototype.setPage=S,u.prototype.setIndex=function(o){return this._change({state:this.state.resetPage().setIndex(o),isPageReset:!0}),this},u.prototype.setQueryParameter=function(o,m){return this._change({state:this.state.resetPage().setQueryParameter(o,m),isPageReset:!0}),this},u.prototype.setState=function(o){return this._change({state:v.make(o),isPageReset:!1}),this},u.prototype.overrideStateWithoutTriggeringChangeEvent=function(o){return this.state=new v(o),this},u.prototype.hasRefinements=function(o){return i(this.state.getNumericRefinements(o))?!0:this.state.isConjunctiveFacet(o)?this.state.isFacetRefined(o):this.state.isDisjunctiveFacet(o)?this.state.isDisjunctiveFacetRefined(o):this.state.isHierarchicalFacet(o)?this.state.isHierarchicalFacetRefined(o):!1},u.prototype.isExcluded=function(o,m){return this.state.isExcludeRefined(o,m)},u.prototype.isDisjunctiveRefined=function(o,m){return this.state.isDisjunctiveFacetRefined(o,m)},u.prototype.hasTag=function(o){return this.state.isTagRefined(o)},u.prototype.isTagRefined=function(){return this.hasTagRefinements.apply(this,arguments)},u.prototype.getIndex=function(){return this.state.index};function x(){return this.state.page}return u.prototype.getCurrentPage=x,u.prototype.getPage=x,u.prototype.getTags=function(){return this.state.tagRefinements},u.prototype.getRefinements=function(o){var m=[];if(this.state.isConjunctiveFacet(o)){var y=this.state.getConjunctiveRefinements(o);y.forEach(function(j){m.push({value:j,type:"conjunctive"})});var _=this.state.getExcludeRefinements(o);_.forEach(function(j){m.push({value:j,type:"exclude"})})}else if(this.state.isDisjunctiveFacet(o)){var w=this.state.getDisjunctiveRefinements(o);w.forEach(function(j){m.push({value:j,type:"disjunctive"})})}var b=this.state.getNumericRefinements(o);return Object.keys(b).forEach(function(j){var g=b[j];m.push({value:g,operator:j,type:"numeric"})}),m},u.prototype.getNumericRefinement=function(o,m){return this.state.getNumericRefinement(o,m)},u.prototype.getHierarchicalFacetBreadcrumb=function(o){return this.state.getHierarchicalFacetBreadcrumb(o)},u.prototype._search=function(o){var m=this.state,y=[],_=[];o.onlyWithDerivedHelpers||(_=d._getQueries(m.index,m),y.push({state:m,queriesCount:_.length,helper:this}),this.emit("search",{state:m,results:this.lastResults}));var w=this.derivedHelpers.map(function(g){var p=g.getModifiedState(m),F=p.index?d._getQueries(p.index,p):[];return y.push({state:p,queriesCount:F.length,helper:g}),g.emit("search",{state:p,results:g.lastResults}),F}),b=Array.prototype.concat.apply(_,w),j=this._queryId++;if(this._currentNbQueries++,!b.length)return Promise.resolve({results:[]}
2).then(this._dispatchAlgoliaResponse.bind(this,y,j));try{this.client.search(b).then(this._dispatchAlgoliaResponse.bind(this,y,j)).catch(this._dispatchAlgoliaError.bind(this,j))}catch(g){this.emit("error",{error:g})}},u.prototype._runComposition=function(){var o=this.state,m=[],y=[],_=this.derivedHelpers.map(function(g){var p=g.getModifiedState(o),F=d._getCompositionQueries(p);return m.push({state:p,queriesCount:F.length,helper:g}),g.emit("search",{state:p,results:g.lastResults}),F}),w=Array.prototype.concat.apply(y,_),b=this._queryId++;if(this._currentNbQueries++,!w.length)return Promise.resolve({results:[]}).then(this._dispatchAlgoliaResponse.bind(this,m,b));if(w.length>1)throw new Error("Only one query is allowed when using a composition.");var j=w[0];try{this.client.search(j).then(this._dispatchAlgoliaResponse.bind(this,m,b)).catch(this._dispatchAlgoliaError.bind(this,b))}catch(g){this.emit("error",{error:g})}},u.prototype._recommend=function(){var o=this.state,m=this.recommendState,y=this.getIndex(),_=[{state:m,index:y,helper:this}],w=m.params.map(function(F){return F.$$id});this.emit("fetch",{recommend:{state:m,results:this.lastRecommendResults}});var b=this._recommendCache,j=this.derivedHelpers.map(function(F){var P=F.getModifiedState(o).index;if(!P)return[];var E=F.getModifiedRecommendState(new f);return _.push({state:E,index:P,helper:F}),w=Array.prototype.concat.apply(w,E.params.map(function(I){return I.$$id})),F.emit("fetch",{recommend:{state:E,results:F.lastRecommendResults}}),E._buildQueries(P,b)}),g=Array.prototype.concat.apply(this.recommendState._buildQueries(y,b),j);if(g.length!==0){if(g.length>0&&typeof this.client.getRecommendations>"u"){console.warn("Please update algoliasearch/lite to the latest version in order to use recommend widgets.");return}var p=this._recommendQueryId++;this._currentNbRecommendQueries++;try{this.client.getRecommendations(g).then(this._dispatchRecommendResponse.bind(this,p,_,w)).catch(this._dispatchRecommendError.bind(this,p))}catch(F){this.emit("error",{error:F})}}},u.prototype._dispatchAlgoliaResponse=function(o,m,y){var _=this;if(!(m<this._lastQueryIdReceived)){this._currentNbQueries-=m-this._lastQueryIdReceived,this._lastQueryIdReceived=m,this._currentNbQueries===0&&this.emit("searchQueueEmpty");var w=y.results.slice(),b=Object.keys(y).reduce(function(j,g){return g!=="results"&&(j[g]=y[g]),j},{});Object.keys(b).length<=0&&(b=void 0),o.forEach(function(j){var g=j.state,p=j.queriesCount,F=j.helper,P=w.splice(0,p);if(!g.index){F.emit("result",{results:null,state:g});return}F.lastResults=new R(g,P,_._searchResultsOptions),b!==void 0&&(F.lastResults._rawContent=b),F.emit("result",{results:F.lastResults,state:g})})}},u.prototype._dispatchRecommendResponse=function(o,m,y,_){if(!(o<this._lastRecommendQueryIdReceived)){this._currentNbRecommendQueries-=o-this._lastRecommendQueryIdReceived,this._lastRecommendQueryIdReceived=o,this._currentNbRecommendQueries===0&&this.emit("recommendQueueEmpty");var w=this._recommendCache,b={};y.filter(function(g){return w[g]===void 0}).forEach(function(g,p){b[g]||(b[g]=[]),b[g].push(p)}),Object.keys(b).forEach(function(g){var p=b[g],F=_.results[p[0]];if(p.length===1){w[g]=F;return}w[g]=Object.assign({},F,{hits:h(y,p.map(function(P){return _.results[P].hits}))})});var j={};y.forEach(function(g){j[g]=w[g]}),m.forEach(function(g){var p=g.state,F=g.helper;if(!g.index){F.emit("recommend:result",{results:null,state:p});return}F.lastRecommendResults=new l(p,j),F.emit("recommend:result",{recommend:{results:F.lastRecommendResults,state:p}})})}},u.prototype._dispatchAlgoliaError=function(o,m){o<this._lastQueryIdReceived||(this._currentNbQueries-=o-this._lastQueryIdReceived,this._lastQueryIdReceived=o,this.emit("error",{error:m}),this._currentNbQueries===0&&this.emit("searchQueueEmpty"))},u.prototype._dispatchRecommendError=function(o,m){o<this._lastRecommendQueryIdReceived||(this._currentNbRecommendQueries-=o-this._lastRecommendQueryIdReceived,this._lastRecommendQueryIdReceived=o,this.emit("error",{error:m}),this._currentNbRecommendQueries===0&&this.emit("recommendQueueEmpty"))},u.prototype.containsRefinement=function(o,m,y,_){return o||m.length!==0||y.length!==0||_.length!==0},u.prototype._hasDisjunctiveRefinements=function(o){return this.state.disjunctiveRefinements[o]&&this.state.disjunctiveRefinements[o].length>0},u.prototype._change=function(o){var m=o.state,y=o.isPageReset;
2m!==this.state&&(this.state=m,this.emit("change",{state:this.state,results:this.lastResults,isPageReset:y}))},u.prototype._recommendChange=function(o){var m=o.state;m!==this.recommendState&&(this.recommendState=m,this.emit("recommend:change",{search:{results:this.lastResults,state:this.state},recommend:{results:this.lastRecommendResults,state:this.recommendState}}))},u.prototype.clearCache=function(){return this.client.clearCache&&this.client.clearCache(),this},u.prototype.setClient=function(o){return this.client===o?this:(typeof o.addAlgoliaAgent=="function"&&o.addAlgoliaAgent("JS Helper ("+s+")"),this.client=o,this)},u.prototype.getClient=function(){return this.client},u.prototype.derive=function(o,m){var y=new t(this,o,m);return this.derivedHelpers.push(y),y},u.prototype.detachDerivedHelper=function(o){var m=this.derivedHelpers.indexOf(o);if(m===-1)throw new Error("Derived helper already detached");this.derivedHelpers.splice(m,1)},u.prototype.hasPendingRequests=function(){return this._currentNbQueries>0},Me=u,Me}var Be,Qt;function _n(){if(Qt)return Be;Qt=1;var n=yn(),t=tr(),r=rr(),e=nr(),a=sr();function i(c,f,l,d){return new n(c,f,l,d)}return i.version=cr(),i.AlgoliaSearchHelper=n,i.SearchParameters=e,i.RecommendParameters=t,i.SearchResults=a,i.RecommendResults=r,Be=i,Be}var Fn=_n();const V=Yt(Fn);var Sn=Ar({name:"configure",connector:!0});function Ut(n,t){return n.setQueryParameters(Object.keys(t.searchParameters).reduce(function(r,e){return L(O({},r),T({},e,void 0))},{}))}var xn=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:st,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:st;return function(e){if(!e||!Hr(e.searchParameters))throw new Error(Sn("The `searchParameters` option expects an object."));var a={};function i(c){return function(f){var l=Ut(c.state,e),d=ge(l,new V.SearchParameters(f));e.searchParameters=f,c.setState(d).search()}}return{$$type:"ais.configure",init:function(f){var l=f.instantSearchInstance;t(L(O({},this.getWidgetRenderState(f)),{instantSearchInstance:l}),!0)},render:function(f){var l=f.instantSearchInstance;t(L(O({},this.getWidgetRenderState(f)),{instantSearchInstance:l}),!1)},dispose:function(f){var l=f.state;return r(),Ut(l,e)},getRenderState:function(f,l){var d,v=this.getWidgetRenderState(l);return L(O({},f),{configure:L(O({},v),{widgetParams:L(O({},v.widgetParams),{searchParameters:ge(new V.SearchParameters((d=f.configure)===null||d===void 0?void 0:d.widgetParams.searchParameters),new V.SearchParameters(v.widgetParams.searchParameters)).getQueryParams()})})})},getWidgetRenderState:function(f){var l=f.helper;return a.refine||(a.refine=i(l)),{refine:a.refine,widgetParams:e}},getWidgetSearchParameters:function(f,l){var d=l.uiState;return ge(f,new V.SearchParameters(O({},d.configure,e.searchParameters)))},getWidgetUiState:function(f){return L(O({},f),{configure:O({},f.configure,e.searchParameters)})}}}};function ur(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function")}function wn(n,t){for(var r=0;r<t.length;r++){var e=t[r];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(n,e.key,e)}}function or(n,t,r){return t&&wn(n.prototype,t),n}function fe(n){return fe=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},fe(n)}function hr(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(hr=function(){return!!n})()}function Pn(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function bn(n,t){return t&&(le(t)==="object"||typeof t=="function")?t:Pn(n)}function jn(n,t,r){return t=fe(t),bn(n,hr()?Reflect.construct(t,[],fe(n).constructor):t.apply(n,r))}function Ke(n,t){return Ke=Object.setPrototypeOf||function(e,a){return e.__proto__=a,e},Ke(n,t)}function En(n,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");n.prototype=Object.create(t&&t.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),t&&Ke(n,t)}const Qi=n=>({...xn((e,a)=>()=>{})(n),$$widgetParams:n});var Tn="ais",de=function(t){return function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=r.descendantName,a=r.modifierName,i=e?"-".concat(e):"",c=a?"--".concat(a):"";
2return"".concat(Tn,"-").concat(t).concat(i).concat(c)}},K={highlightPreTag:"<mark>",highlightPostTag:"</mark>"},In=Promise.resolve();function ne(n){var t=null,r=!1,e=function(){for(var i=arguments.length,c=new Array(i),f=0;f<i;f++)c[f]=arguments[f];t===null&&(t=In.then(function(){if(t=null,r){r=!1;return}n.apply(void 0,re(c))}))};return e.wait=function(){if(t===null)throw new Error("The deferred function should be called before calling `wait()`");return t},e.cancel=function(){t!==null&&(r=!0)},e}function me(n,t){var r=Array.isArray(t)?t:t.split(".");return r.reduce(function(e,a){return e&&e[a]},n)}var Hn=de("Highlight");function fr(n){var t=n.attribute,r=n.highlightedTagName,e=r===void 0?"mark":r,a=n.hit,i=n.cssClasses,c=i===void 0?{}:i,f=me(a._highlightResult,t),l=f||{},d=l.value,v=d===void 0?"":d,R=Hn({descendantName:"highlighted"})+(c.highlighted?" ".concat(c.highlighted):"");return v.replace(new RegExp(K.highlightPreTag,"g"),"<".concat(e,' class="').concat(R,'">')).replace(new RegExp(K.highlightPostTag,"g"),"</".concat(e,">"))}function lr(n){var t=K.highlightPreTag,r=K.highlightPostTag;return n.map(function(e){return e.isHighlighted?t+e.value+r:e.value}).join("")}function dr(n){var t=K.highlightPostTag,r=K.highlightPreTag,e=n.split(r),a=e.shift(),i=a?[{value:a,isHighlighted:!1}]:[];return e.forEach(function(c){var f=c.split(t);i.push({value:f[0],isHighlighted:!0}),f[1]!==""&&i.push({value:f[1],isHighlighted:!1})}),i}var An={"&":"&","<":"<",">":">",""":'"',"'":"'"},mr=/&(amp|quot|lt|gt|#39);/g,On=RegExp(mr.source);function Cn(n){return n&&On.test(n)?n.replace(mr,function(t){return An[t]}):n}var Dn=new RegExp(/\w/i);function Nn(n,t){var r,e,a=n[t],i=((r=n[t+1])===null||r===void 0?void 0:r.isHighlighted)||!0,c=((e=n[t-1])===null||e===void 0?void 0:e.isHighlighted)||!0;return!Dn.test(Cn(a.value))&&c===i?c:a.isHighlighted}function vr(n){return n.some(function(t){return t.isHighlighted})?n.map(function(t,r){return L(O({},t),{isHighlighted:!Nn(n,r)})}):n.map(function(t){return L(O({},t),{isHighlighted:!1})})}var Qn=de("ReverseHighlight");function gr(n){var t=n.attribute,r=n.highlightedTagName,e=r===void 0?"mark":r,a=n.hit,i=n.cssClasses,c=i===void 0?{}:i,f=me(a._highlightResult,t),l=f||{},d=l.value,v=d===void 0?"":d,R=Qn({descendantName:"highlighted"})+(c.highlighted?" ".concat(c.highlighted):""),h=lr(vr(dr(v)));return h.replace(new RegExp(K.highlightPreTag,"g"),"<".concat(e,' class="').concat(R,'">')).replace(new RegExp(K.highlightPostTag,"g"),"</".concat(e,">"))}var Un=de("Snippet");function pr(n){var t=n.attribute,r=n.highlightedTagName,e=r===void 0?"mark":r,a=n.hit,i=n.cssClasses,c=i===void 0?{}:i,f=me(a._snippetResult,t),l=f||{},d=l.value,v=d===void 0?"":d,R=Un({descendantName:"highlighted"})+(c.highlighted?" ".concat(c.highlighted):"");return v.replace(new RegExp(K.highlightPreTag,"g"),"<".concat(e,' class="').concat(R,'">')).replace(new RegExp(K.highlightPostTag,"g"),"</".concat(e,">"))}var Wn=de("ReverseSnippet");function Rr(n){var t=n.attribute,r=n.highlightedTagName,e=r===void 0?"mark":r,a=n.hit,i=n.cssClasses,c=i===void 0?{}:i,f=me(a._snippetResult,t),l=f||{},d=l.value,v=d===void 0?"":d,R=Wn({descendantName:"highlighted"})+(c.highlighted?" ".concat(c.highlighted):""),h=lr(vr(dr(v)));return h.replace(new RegExp(K.highlightPreTag,"g"),"<".concat(e,' class="').concat(R,'">')).replace(new RegExp(K.highlightPostTag,"g"),"</".concat(e,">"))}function $n(n){return btoa(encodeURIComponent(JSON.stringify(n)))}function qn(n){var t=n.method,r=n.payload;if((typeof r>"u"?"undefined":le(r))!=="object")throw new Error("The insights helper expects the payload to be an object.");var e;try{e=$n(r)}catch{throw new Error("Could not JSON serialize the payload object.")}return'data-insights-method="'.concat(t,'" data-insights-payload="').concat(e,'"')}function yr(n,t){return qn({method:n,payload:t})}var Ln="_ALGOLIA";function kn(n){if(!((typeof document>"u"?"undefined":le(document))!=="object"||typeof document.cookie!="string"))for(var t="".concat(n,"="),r=document.cookie.split(";"),e=0;e<r.length;e++){for(var a=r[e];a.charAt(0)===" ";)a=a.substring(1);if(a.indexOf(t)===0)return a.substring(t.length,a.length)}}function _r(){return kn(Ln)}function Mn(){return _r()}function Wt(n){return n!==Object(n)}function nt(n,t){if(n===t)return!0;
2if(Wt(n)||Wt(t)||typeof n=="function"||typeof t=="function")return n===t;if(Object.keys(n).length!==Object.keys(t).length)return!1;var r=!0,e=!1,a=void 0;try{for(var i=Object.keys(n)[Symbol.iterator](),c;!(r=(c=i.next()).done);r=!0){var f=c.value;if(!(f in t)||!nt(n[f],t[f]))return!1}}catch(l){e=!0,a=l}finally{try{!r&&i.return!=null&&i.return()}finally{if(e)throw a}}return!0}function Z(n){var t=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{fallback:function(){}}).fallback;return typeof window>"u"?t():n({window})}function $t(n){var t=n||{};t.page;var r=ie(t,["page"]);return r}function Bn(){var n=(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}).key,t=["ais.infiniteHits",n].filter(Boolean).join(":");return{read:function(e){var a=e.state,i=Z(function(f){var l=f.window;return l.sessionStorage});if(!i)return null;try{var c=JSON.parse(i.getItem(t));return c&&nt(c.state,$t(a))?c.hits:null}catch(f){if(Ge(f,SyntaxError))try{i.removeItem(t)}catch{}return null}},write:function(e){var a=e.state,i=e.hits,c=Z(function(f){var l=f.window;return l.sessionStorage});if(c)try{c.setItem(t,JSON.stringify({state:$t(a),hits:i}))}catch{}}}}var Vn=Xe();const Jn=Yt(Vn);function te(){for(var n=arguments.length,t=new Array(n),r=0;r<n;r++)t[r]=arguments[r]}function qt(n,t){for(var r,e=0;e<n.length;e++)if(r=n[e],t(r,e,n))return r}function Lt(n){if(n.appId&&n.apiKey)return[n.appId,n.apiKey];if(n.transporter){var t=n.transporter,r=t.headers||t.baseHeaders,e=t.queryParameters||t.baseQueryParameters,a="x-algolia-application-id",i="x-algolia-api-key",c=r[a]||e[a],f=r[i]||e[i];return[c,f]}else return[n.applicationID,n.apiKey]}function Kn(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(n){var t=Math.random()*16|0,r=n==="x"?t:t&3|8;return r.toString(16)})}var Fr="2.17.2",zn="https://cdn.jsdelivr.net/npm/search-insights@".concat(Fr,"/dist/search-insights.min.js");function kt(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=n.insightsClient,r=n.insightsInitParams,e=n.onEvent,a=n.$$internal,i=a===void 0?!1:a,c=n.$$automatic,f=c===void 0?!1:c,l=t;!t&&t!==null&&Z(function(v){var R=v.window,h=R.AlgoliaAnalyticsObject||"aa";typeof h=="string"&&(l=R[h]),l||(R.AlgoliaAnalyticsObject=h,R[h]||(R[h]=function(){for(var s=arguments.length,u=new Array(s),S=0;S<s;S++)u[S]=arguments[S];R[h].queue||(R[h].queue=[]),R[h].queue.push(u)},R[h].version=Fr,R[h].shouldAddScript=!0),l=R[h])});var d=l||te;return function(v){var R=v.instantSearchInstance,h,s=R.middleware.filter(function(g){return g.instance.$$type==="ais.insights"&&g.instance.$$internal}).map(function(g){return g.creator});(h=R).unuse.apply(h,re(s));var u=G(Lt(R.client),2),S=u[0],x=u[1],o=void 0,m=void 0,y=void 0,_=d.queue;if(Array.isArray(_)){var w;w=G(["setUserToken","init"].map(function(g){var p=G(qt(_.slice().reverse(),function(P){var E=G(P,1),I=E[0];return I===g})||[],2),F=p[1];return F}),2),m=w[0],o=w[1]}d("getUserToken",null,function(g,p){y=Bt(p)}),(r||!Mt(d))&&d("init",O({appId:S,apiKey:x,partial:!0},r));var b,j;return{$$type:"ais.insights",$$internal:i,$$automatic:f,onStateChange:function(){},subscribe:function(){if(d.shouldAddScript){var p="[insights middleware]: could not load search-insights.js. Please load it manually following https://alg.li/insights-init";try{var F=document.createElement("script");F.async=!0,F.src=zn,F.onerror=function(){R.emit("error",new Error(p))},document.body.appendChild(F),d.shouldAddScript=!1}catch{d.shouldAddScript=!1,R.emit("error",new Error(p))}}},started:function(){d("addAlgoliaAgent","insights-middleware"),j=R.mainHelper;var p=d.queue;if(Array.isArray(p)){var F;F=G(["setUserToken","init"].map(function(D){var U=G(qt(p.slice().reverse(),function(M){var k=G(M,1),B=k[0];return B===D})||[],2),$=U[1];return $}),2),m=F[0],o=F[1]}b=Gn(R),f||j.overrideStateWithoutTriggeringChangeEvent(L(O({},j.state),{clickAnalytics:!0})),i||R.scheduleSearch();var P=function(U){var $=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,M=Bt(U);if(!M)return;var k=j.state.userToken;function B(){j.overrideStateWithoutTriggeringChangeEvent(L(O({},j.state),{userToken:M})),k&&k!==U&&R.scheduleSearch()}$?B():setTimeout(B,0)};function E(D){P(D,!0),d("setUserToken",D)}var I=void 0,N=_r();if(N)I=N;else{var q="anonymous-".concat(Kn());I=q}var A,C=b.userToken;r?.userToken&&(A=r.userToken),A?E(A):C?E(C):y?E(y):m?E(m):I&&(E(I),(r?.useCookie||o?.useCookie)&&Xn(I,r?.cookieDuration||o?.cookieDuration)),d("onUserTokenChange",function(D){return P(D,!0)},{immediate:!0});var Q=d;Mt(d)&&(Q=function(U,$){var M=G(Lt(R.client),2),k=M[0],B=M[1],Y={headers:{"X-Algolia-Application-Id":k,"X-Algolia-API-Key":B}};return d(U,$,Y)});var H=new Set,W;R.mainHelper.derivedHelpers[0].on("result",function(D){var U=D.results;U&&(!U.queryID||U.queryID!==W)&&(W=U.queryID,H.clear())}),R.sendEventToInsights=function(D){if(e)e(D,Q);else if(D.insightsMethod){if(D.insightsMethod==="viewedObjectIDs"){var U=D.payload,$=U.objectIDs.filter(function(M){return!H.has(M)});if($.length===0)return;$.forEach(function(M){return H.add(M)}),U.objectIDs=$}D.payload.algoliaSource=["instantsearch"],f&&D.payload.algoliaSource.pu
2sh("instantsearch-automatic"),D.eventModifier==="internal"&&D.payload.algoliaSource.push("instantsearch-internal"),Q(D.insightsMethod,D.payload)}}},unsubscribe:function(){d("onUserTokenChange",void 0),R.sendEventToInsights=te,j&&b&&(j.overrideStateWithoutTriggeringChangeEvent(O({},j.state,b)),R.scheduleSearch())}}}}function Gn(n){var t,r,e=((r=n._initialResults)===null||r===void 0||(t=r[n.indexName])===null||t===void 0?void 0:t.state)||{},a=n.mainHelper.state;return{userToken:e.userToken||a.userToken,clickAnalytics:e.clickAnalytics||a.clickAnalytics}}function Xn(n,t){var r=2592e6,e=new Date;e.setTime(e.getTime()+(t||r*6));var a="expires=".concat(e.toUTCString());document.cookie="_ALGOLIA=".concat(n,";").concat(a,";path=/")}function Mt(n){var t=G((n.version||"").split(".").map(Number),2),r=t[0],e=t[1],a=r>=3,i=r===2&&e>=6,c=r===1&&e>=10;return a||i||c}function Bt(n){if(n)return typeof n=="number"?n.toString():n}function Yn(n){var t=n;return t.transporter&&t.transporter.userAgent?t.transporter.userAgent.value:t._ua}function ue(n,t,r){var e=t.getHelper();return{uiState:r,helper:e,parent:t,instantSearchInstance:n,state:e.state,renderState:n.renderState,templatesConfig:n.templatesConfig,createURL:t.createURL,scopedResults:[],searchMetadata:{isSearchStalled:n.status==="stalled"},status:n.status,error:n.error}}function Vt(n,t,r){var e=t.getResultsForWidget(r),a=t.getHelper();return{helper:a,parent:t,instantSearchInstance:n,results:e,scopedResults:t.getScopedResults(),state:e&&"_state"in e?e._state:a.state,renderState:n.renderState,templatesConfig:n.templatesConfig,createURL:t.createURL,searchMetadata:{isSearchStalled:n.status==="stalled"},status:n.status,error:n.error}}function Sr(n,t,r){var e=ue(t,t.mainIndex,t._initialUiState);n.forEach(function(a){var i={};if(a.getWidgetRenderState){var c=a.getWidgetRenderState(e);c&&c.widgetParams&&(i=c.widgetParams)}var f=Object.keys(i).filter(function(l){return i[l]!==void 0});r.widgets.push({type:a.$$type,widgetType:a.$$widgetType,params:f}),a.$$type==="ais.index"&&Sr(a.getWidgets(),t,r)})}function Zn(){return Z(function(n){var t=n.window,r,e;return((e=t.navigator)===null||e===void 0||(r=e.userAgent)===null||r===void 0?void 0:r.indexOf("Algolia Crawler"))>-1},{fallback:function(){return!1}})}function ei(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=n.$$internal,r=t===void 0?!1:t;return function(e){var a=e.instantSearchInstance,i={widgets:[]},c=document.createElement("meta"),f=document.querySelector("head");return c.name="instantsearch:widgets",{$$type:"ais.metadata",$$internal:r,onStateChange:function(){},subscribe:function(){setTimeout(function(){i.ua=Yn(a.client),Sr(a.mainIndex.getWidgets(),a,i),a.middleware.forEach(function(d){return i.widgets.push({middleware:!0,type:d.instance.$$type,internal:d.instance.$$internal})}),c.content=JSON.stringify(i),f.appendChild(c)},0)},started:function(){},unsubscribe:function(){c.remove()}}}}var Jt=function(t){t&&(window.document.title=t)},ti=(function(){function n(t){var r=this,e=t.windowTitle,a=t.writeDelay,i=a===void 0?400:a,c=t.createURL,f=t.parseURL,l=t.getLocation,d=t.start,v=t.dispose,R=t.push,h=t.cleanUrlOnDispose;ur(this,n),T(this,"$$type","ais.browser"),T(this,"windowTitle",void 0),T(this,"writeDelay",void 0),T(this,"_createURL",void 0),T(this,"parseURL",void 0),T(this,"getLocation",void 0),T(this,"writeTimer",void 0),T(this,"_onPopState",void 0),T(this,"inPopState",!1),T(this,"isDisposed",!1),T(this,"latestAcknowledgedHistory",0),T(this,"_start",void 0),T(this,"_dispose",void 0),T(this,"_push",void 0),T(this,"_cleanUrlOnDispose",void 0),this.windowTitle=e,this.writeTimer=void 0,this.writeDelay=i,this._createURL=c,this.parseURL=f,this.getLocation=l,this._start=d,this._dispose=v,this._push=R,this._cleanUrlOnDispose=typeof h>"u"?!0:h,Z(function(s){var u=s.window,S=r.windowTitle&&r.windowTitle(r.read());Jt(S),r.latestAcknowledgedHistory=u.history.length})}return or(n,[{key:"read",value:function(){return this.parseURL({qsModule:ct,location:this.getLocation()})}},{key:"write",value:function(r){var e=this;Z(function(a){var i=a.window,c=e.createURL(r),f=e.windowTitle&&e.windowTitle(r);e.writeTimer&&clearTimeout(e.writeTimer),e.writeTimer=setTimeout(function(){Jt(f),e.shouldWrite(c)&&(e._push?e._push(c):i.history.pushState(r,f||"",c),e.latestAcknowledgedHistory=i.history.length),e.inPopState=!1,e.writeTimer=void 0},e.writeDelay)})}}
2,{key:"onUpdate",value:function(r){var e=this;this._start&&this._start(function(){r(e.read())}),this._onPopState=function(){e.writeTimer&&(clearTimeout(e.writeTimer),e.writeTimer=void 0),e.inPopState=!0,r(e.read())},Z(function(a){var i=a.window;i.addEventListener("popstate",e._onPopState)})}},{key:"createURL",value:function(r){var e=this._createURL({qsModule:ct,routeState:r,location:this.getLocation()});return e}},{key:"dispose",value:function(){var r=this;this._dispose&&this._dispose(),this.isDisposed=!0,Z(function(e){var a=e.window;r._onPopState&&a.removeEventListener("popstate",r._onPopState)}),this.writeTimer&&clearTimeout(this.writeTimer),this._cleanUrlOnDispose&&this.write({})}},{key:"start",value:function(){this.isDisposed=!1}},{key:"shouldWrite",value:function(r){var e=this;return Z(function(a){var i=a.window;if(e.isDisposed&&!e._cleanUrlOnDispose)return!1;var c=!(e.isDisposed&&e.latestAcknowledgedHistory!==i.history.length);return!e.inPopState&&c&&r!==i.location.href})}}]),n})();function ri(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=n.createURL,r=t===void 0?function(u){var S=u.qsModule,x=u.routeState,o=u.location,m=o.protocol,y=o.hostname,_=o.port,w=_===void 0?"":_,b=o.pathname,j=o.hash,g=S.stringify(x),p=w===""?"":":".concat(w);return g?"".concat(m,"//").concat(y).concat(p).concat(b,"?").concat(g).concat(j):"".concat(m,"//").concat(y).concat(p).concat(b).concat(j)}:t,e=n.parseURL,a=e===void 0?function(u){var S=u.qsModule,x=u.location;return S.parse(x.search.slice(1),{arrayLimit:99})}:e,i=n.writeDelay,c=i===void 0?400:i,f=n.windowTitle,l=n.getLocation,d=l===void 0?function(){return Z(function(u){var S=u.window;return S.location},{fallback:function(){throw new Error("You need to provide `getLocation` to the `history` router in environments where `window` does not exist.")}})}:l,v=n.start,R=n.dispose,h=n.push,s=n.cleanUrlOnDispose;return new ti({createURL:r,parseURL:a,writeDelay:c,windowTitle:f,getLocation:d,start:v,dispose:R,push:h,cleanUrlOnDispose:s})}function Kt(n){n.configure;var t=ie(n,["configure"]);return t}function ni(){return{$$type:"ais.simple",stateToRoute:function(t){return Object.keys(t).reduce(function(r,e){return L(O({},r),T({},e,Kt(t[e])))},{})},routeToState:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return Object.keys(t).reduce(function(r,e){return L(O({},r),T({},e,Kt(t[e])))},{})}}}var ii=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=t.router,e=r===void 0?ri():r,a=t.stateMapping,i=a===void 0?ni():a,c=t.$$internal,f=c===void 0?!1:c;return function(l){var d=l.instantSearchInstance;function v(s){var u=d.mainIndex.getWidgets().length===0?d._initialUiState:d.mainIndex.getWidgetUiState({}),S=Object.keys(s).reduce(function(o,m){return L(O({},o),T({},m,s[m]))},u),x=i.stateToRoute(S);return e.createURL(x)}d._createURL=v;var R=void 0,h=d._initialUiState;return{$$type:"ais.router({router:".concat(e.$$type||"__unknown__",", stateMapping:").concat(i.$$type||"__unknown__","})"),$$internal:f,onStateChange:function(u){var S=u.uiState,x=i.stateToRoute(S);(R===void 0||!nt(R,x))&&(e.write(x),R=x)},subscribe:function(){d._initialUiState=O({},h,i.routeToState(e.read())),e.onUpdate(function(u){d.mainIndex.getWidgets().length>0&&d.setUiState(i.routeToState(u))})},started:function(){var u;(u=e.start)===null||u===void 0||u.call(e)},unsubscribe:function(){e.dispose()}}}},ai=0;function si(n){n.dependsOn==="recommend"&&(n.$$id=ai++)}function X(n){return n.$$type==="ais.index"}function ci(n){var t=n.name,r=n.connector,e=r===void 0?!1:r;return["https://www.algolia.com/doc/api-reference/widgets/",t,"/js/",e?"#connector":""].join("")}function xr(){for(var n=arguments.length,t=new Array(n),r=0;r<n;r++)t[r]=arguments[r];var e=t.map(function(a){return ci(a)}).join(", ");return function(a){return[a,"See documentation: ".concat(e)].filter(Boolean).join(` 3 4`)}}function ui(n,t){if(!Array.isArray(n))return-1;for(var r=0;r<n.length;r++)if(t(n[r]))return r;return-1}function oi(n){return n.filter(function(t,r,e){return e.indexOf(t)===r})}var hi=function(t,r){r.facets,r.disjunctiveFacets,r.facetsRefinements,r.facetsExcludes,r.disjunctiveFacetsRefinements,r.numericRefinements,r.tagRefinements,r.hierarchicalFacets,r.hierarchicalFacetsRefinements,r.ruleContexts;var e=ie(r,["facets","disjunctiveFacets","facetsRefinements","facetsExcludes","disjunctiveFacetsRefinements","numericRefinements","tagRefinements","hierarchicalFacets","hierarchicalFacetsRefinements","ruleContexts"]);return t.setQueryParameters(e)},fi=function(t,r){return r.facets.reduce(function(e,a){return e.addFacet(a)},t)},li=function(t,r){return r.disjunctiveFacets.reduce(function(e,a){return e.addDisjunctiveFacet(a)},t)},di=function(t,r){return t.setQueryParameters({hierarchicalFacets:r.hierarchicalFacets.reduce(function(e,a){var i=ui(e,function(f){return f.name===a.name});if(i===-1)return e.concat(a);var c=e.slice();return c.splice(i,1,a),c},t.hierarchicalFacets)})},mi=function(t,r){return r.tagRefinements.reduce(function(e,a){return e.addTagRefinement(a)},t)},vi=function(t,r){return t.setQueryParameters({facetsRefinements:O({},t.facetsRefinements,r.facetsRefinements)})},gi=function(t,r){return t.setQueryParameters({facetsExcludes:O({},t.facetsExcludes,r.facetsExcludes)})},pi=function(t,r){return t.setQueryParameters({disjunctiveFacetsRefinements:O({},t.disjunctiveFacetsRefinements,r.disjunctiveFacetsRefinements)})},Ri=function(t,r){return t.setQueryParameters({numericRefinements:O({},t.numericRefinements,r.numericRefinements)})},yi=function(t,r){return t.setQueryParameters({hierarchicalFacetsRefinements:O({},t.hierarchicalFacetsRefinements,r.hierarchicalFacetsRefinements)})},_i=function(t,r){var e=oi([].concat(t.ruleContexts).concat(r.ruleContexts).filter(
4Boolean));return e.length>0?t.setQueryParameters({ruleContexts:e}):t},zt=function(){for(var t=arguments.length,r=new Array(t),e=0;e<t;e++)r[e]=arguments[e];return r.reduce(function(a,i){var c=yi(a,i),f=di(c,i),l=mi(f,i),d=Ri(l,i),v=pi(d,i),R=gi(v,i),h=vi(R,i),s=li(h,i),u=_i(s,i),S=fi(u,i);return hi(S,i)})};function Gt(n){for(var t=n.getParent(),r=[n.getHelper().state];t!==null;)r=[t.getHelper().state].concat(r),t=t.getParent();return r}var ae=xr({name:"index-widget"});function wr(n,t){var r=t.state,e=t.recommendState,a=t.isPageReset,i=t._uiState;r!==n.state&&(n.state=r,n.emit("change",{state:n.state,results:n.lastResults,isPageReset:a,_uiState:i})),e!==n.recommendState&&(n.recommendState=e)}function se(n,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return n.reduce(function(e,a){return X(a)||!a.getWidgetUiState&&!a.getWidgetState?e:a.getWidgetUiState?a.getWidgetUiState(e,t):a.getWidgetState(e,t)},r)}function ce(n,t){var r=t.initialSearchParameters,e=ie(t,["initialSearchParameters"]);return n.reduce(function(a,i){return!i.getWidgetSearchParameters||X(i)?a:i.dependsOn==="search"&&i.getWidgetParameters?i.getWidgetParameters(a,e):i.getWidgetSearchParameters(a,e)},r)}function Xt(n,t){var r=t.initialRecommendParameters,e=ie(t,["initialRecommendParameters"]);return n.reduce(function(a,i){return!X(i)&&i.dependsOn==="recommend"&&i.getWidgetParameters?i.getWidgetParameters(a,e):a},r)}function Pr(n){var t=n.filter(X);t.length!==0&&t.forEach(function(r){var e=r.getHelper();wr(e,{state:e.state.resetPage(),recommendState:e.recommendState,isPageReset:!0}),Pr(r.getWidgets())})}function br(n){var t=n.filter(X);return t.reduce(function(r,e){var a;return(a=r).concat.apply(a,[{indexId:e.getIndexId(),results:e.getResults(),helper:e.getHelper()}].concat(re(br(e.getWidgets()))))},[])}var Fi=function(t){if(t===void 0||t.indexName===void 0&&!t.EXPERIMENTAL_isolated)throw new Error(ae("The `indexName` option is required."));var r=t.indexName,e=r===void 0?"":r,a=t.indexId,i=a===void 0?e:a,c=t.EXPERIMENTAL_isolated,f=c===void 0?!1:c,l=[],d={},v=null,R=null,h=null,s=null,u=null,S=!1,x=!1;return{$$type:"ais.index",$$widgetType:"ais.index",_isolated:f,getIndexName:function(){return e},getIndexId:function(){return i},getHelper:function(){return h},getResults:function(){return s?.lastResults?(s.lastResults._state=h.state,s.lastResults):null},getResultsForWidget:function(m){return m.dependsOn!=="recommend"||X(m)||m.$$id===void 0?this.getResults():h?.lastRecommendResults?h.lastRecommendResults[m.$$id]:null},getPreviousState:function(){return u},getScopedResults:function(){var m=this.getParent(),y;return m?y=m.getWidgets():e.length===0?y=this.getWidgets():y=[this],br(y)},getParent:function(){return f?null:R},createURL:function(m){return typeof m=="function"?v._createURL(T({},i,m(d))):v._createURL(T({},i,se(l,{searchParameters:m,helper:h})))},scheduleLocalSearch:ne(function(){f&&h?.search()}),getWidgets:function(){return l},addWidgets:function(m){var y=this;if(!Array.isArray(m))throw new Error(ae("The `addWidgets` method expects an array of widgets."));var _=m.reduce(function(w,b){return w.concat(Array.isArray(b)?b:[b])},[]);if(_.some(function(w){return typeof w.init!="function"&&typeof w.render!="function"}))throw new Error(ae("The widget definition expects a `render` and/or an `init` method."));return _.forEach(function(w){w.parent=y,!X(w)&&(v&&w.dependsOn==="recommend"?v._hasRecommendWidget=!0:v?v._hasSearchWidget=!0:w.dependsOn==="recommend"?S=!0:x=!0,si(w))}),l=l.concat(_),v&&_.length&&(wr(h,{state:ce(l,{uiState:d,initialSearchParameters:h.state}),recommendState:Xt(l,{uiState:d,initialRecommendParameters:h.recommendState}),_uiState:d}),_.forEach(function(w){if(w.getRenderState){var b=w.getRenderState(v.renderState[y.getIndexId()]||{},ue(v,y,v._initialUiState));Ve({renderState:b,instantSearchInstance:v,parent:y})}}),_.forEach(function(w){w.init&&w.init(ue(v,y,v._initialUiState))}
4),f?this.scheduleLocalSearch():v.scheduleSearch()),this},removeWidgets:function(m){var y=this;if(!Array.isArray(m))throw new Error(ae("The `removeWidgets` method expects an array of widgets."));var _=m.reduce(function(p,F){return p.concat(Array.isArray(F)?F:[F])},[]);if(_.some(function(p){return typeof p.dispose!="function"}))throw new Error(ae("The widget definition expects a `dispose` method."));if(l=l.filter(function(p){return _.indexOf(p)===-1}),l.forEach(function(p){p.parent=void 0,!X(p)&&(v&&p.dependsOn==="recommend"?v._hasRecommendWidget=!0:v?v._hasSearchWidget=!0:p.dependsOn==="recommend"?S=!0:x=!0)}),v&&_.length){var w=_.reduce(function(p,F){var P=F.dispose({helper:h,state:p.cleanedSearchState,recommendState:p.cleanedRecommendState,parent:y});return Ge(P,V.RecommendParameters)?p.cleanedRecommendState=P:P&&(p.cleanedSearchState=P),p},{cleanedSearchState:h.state,cleanedRecommendState:h.recommendState}),b=w.cleanedSearchState,j=w.cleanedRecommendState,g=v.future.preserveSharedStateOnUnmount?ce(l,{uiState:d,initialSearchParameters:new V.SearchParameters({index:this.getIndexName()})}):ce(l,{uiState:se(l,{searchParameters:b,helper:h}),initialSearchParameters:b});d=se(l,{searchParameters:g,helper:h}),h.setState(g),h.recommendState=j,l.length&&(f?this.scheduleLocalSearch():v.sc
4heduleSearch())}return this},init:function(m){var y=this,_=m.instantSearchInstance,w=m.parent,b=m.uiState,j;if(h===null){v=_,R=w,d=b[i]||{};var g=_.mainHelper,p=ce(l,{uiState:d,initialSearchParameters:new V.SearchParameters({index:e})}),F=Xt(l,{uiState:d,initialRecommendParameters:new V.RecommendParameters});h=V(g.getClient(),p.index,p),h.recommendState=F,h.search=function(){return f?(_.status="loading",y.render({instantSearchInstance:_}),_.compositionID?h.searchWithComposition():h.searchOnlyWithDerivedHelpers()):_.onStateChange?(_.onStateChange({uiState:_.mainIndex.getWidgetUiState({}),setUiState:function(C){return _.setUiState(C,!1)}}),g):g.search()},h.searchWithoutTriggeringOnStateChange=function(){return g.search()},h.searchForFacetValues=function(A,C,Q,H){var W=zt.apply(void 0,[g.state].concat(re(Gt(y)))).setQueryParameters(H);return g.searchForFacetValues(A,C,Q,W)};var P=e?h:V({},"__empty_index__",{}),E=f?P:Si(w,g);s=E.derive(function(){return zt.apply(void 0,[g.state].concat(re(Gt(y))))},function(){return y.getHelper().recommendState});var I=(j=_._initialResults)===null||j===void 0?void 0:j[this.getIndexId()];if(I?.results){var N=new V.SearchResults(new V.SearchParameters(I.state),I.results);s.lastResults=N,h.lastResults=N}if(I?.recommendResults){var q=new V.RecommendResults(new V.RecommendParameters({params:I.recommendResults.params}),I.recommendResults.results);s.lastRecommendResults=q,h.lastRecommendResults=q}h.on("change",function(A){var C=A.isPageReset;C&&Pr(l)}),s.on("search",function(){_.scheduleStalledRender()}),s.on("result",function(A){var C=A.results;_.scheduleRender(),h.lastResults=C,u=C?._state}),s.on("recommend:result",function(A){var C=A.recommend;_.scheduleRender(),h.lastRecommendResults=C.results}),l.forEach(function(A){if(A.getRenderState){var C=A.getRenderState(_.renderState[y.getIndexId()]||{},ue(_,y,b));Ve({renderState:C,instantSearchInstance:_,parent:y})}}),l.forEach(function(A){A.init&&A.init(ue(_,y,b))}),h.on("change",function(A){var C=A.state,Q=A._uiState;d=se(l,{searchParameters:C,helper:h},Q||{}),_.onStateChange||_.onInternalStateChange()}),I&&_.scheduleRender(),S&&(_._hasRecommendWidget=!0),x&&(_._hasSearchWidget=!0)}},render:function(m){var y=this,_=m.instantSearchInstance;_.status==="error"&&!_.mainHelper.hasPendingRequests()&&u&&h.setState(u);var w=this.getResults()||s?.lastRecommendResults||f&&!e?l:l.filter(function(b){return b.shouldRender});w=w.filter(function(b){return b.shouldRender?b.shouldRender({instantSearchInstance:_}):!0}),w.forEach(function(b){if(b.getRenderState){var j=b.getRenderState(_.renderState[y.getIndexId()]||{},Vt(_,y,b));Ve({renderState:j,instantSearchInstance:_,parent:y})}}
4),w.forEach(function(b){b.render&&b.render(Vt(_,y,b))})},dispose:function(){var m=this;l.forEach(function(y){y.dispose&&h&&y.dispose({helper:h,state:h.state,recommendState:h.recommendState,parent:m})}),v=null,R=null,h?.removeAllListeners(),h=null,s?.detach(),s=null},getWidgetUiState:function(m){return l.filter(X).filter(function(y){return!y._isolated}).reduce(function(y,_){return _.getWidgetUiState(y)},L(O({},m),T({},i,O({},m[i],d))))},getWidgetState:function(m){return this.getWidgetUiState(m)},getWidgetSearchParameters:function(m,y){var _=y.uiState;return ce(l,{uiState:_,initialSearchParameters:m})},shouldRender:function(){return!0},refreshUiState:function(){d=se(l,{searchParameters:this.getHelper().state,helper:this.getHelper()},d)},setIndexUiState:function(m){var y=typeof m=="function"?m(d):m;v.setUiState(function(_){return L(O({},_),T({},i,y))})}}};function Ve(n){var t=n.renderState,r=n.instantSearchInstance,e=n.parent,a=e?e.getIndexId():r.mainIndex.getIndexId();r.renderState=L(O({},r.renderState),T({},a,O({},r.renderState[a],t)))}function Si(n,t){for(;n;){if(n._isolated)return n.getHelper();n=n.getParent()}return t}function xi(n,t){return n.toLocaleString(t)}function wi(n){var t=n.numberLocale;return{formatNumber:function(e,a){return xi(Number(a(e)),t)},highlight:function(e,a){try{var i=JSON.parse(e);return a(fr(L(O({},i),{hit:this})))}catch{throw new Error(` 5The highlight helper expects a JSON object of the format: 6{ "attribute": "name", "highlightedTagName": "mark" }`)}},reverseHighlight:function(e,a){try{var i=JSON.parse(e);return a(gr(L(O({},i),{hit:this})))}catch{throw new Error(` 7 The reverseHighlight helper expects a JSON object of the format: 8 { "attribute": "name", "highlightedTagName": "mark" }`)}},snippet:function(e,a){try{var i=JSON.parse(e);return a(pr(L(O({},i),{hit:this})))}catch{throw new Error(` 9The snippet helper expects a JSON object of the format: 10{ "attribute": "name", "highlightedTagName": "mark" }`)}},reverseSnippet:function(e,a){try{var i=JSON.parse(e);return a(Rr(L(O({},i),{hit:this})))}catch{throw new Error(` 11 The reverseSnippet helper expects a JSON object of the format: 12 { "attribute": "name", "highlightedTagName": "mark" }`)}},insights:function(e,a){try{var i=JSON.parse(e),c=i.method,f=i.payload;return a(yr(c,O({objectIDs:[this.objectID]},f)))}catch{throw new Error(` 13The insights helper expects a JSON object of the format: 14{ "method": "method-name", "payload": { "eventName": "name of the event" } }`)}}}}function ze(n,t){var r=n[t.getIndexId()]||{};t.getHelper().setState(t.getWidgetSearchParameters(t.getHelper().state,{uiState:r})),t.getWidgets().filter(X).forEach(function(e){return ze(n,e)})}function Pi(n,t){var r=Object.keys(t).reduce(function(e,a){var i=t[a];return i.recommendResults?O({},e,i.recommendResults.results):e},{});n._recommendCache=r}function bi(n,t){if(t&&!((!("transporter"in n)||n._cacheHydrated)&&(!n._useCache||typeof n.addAlgoliaAgent!="function"))){var r=[Object.keys(t).reduce(function(c,f){var l=t[f],d=l.state,v=l.requestParams,R=l.results,h=R&&d?R.map(function(s,u){return O({indexName:d.index||s.index},v?.[u]||s.params?{params:Je(v?.[u]||ji(s.params))}:{})}):[];return c.concat(h)},[])],e=Object.keys(t).reduce(function(c,f){var l=t[f].results;return l?c.concat(l):c},[]);if("transporter"in n&&!n._cacheHydrated){n._cacheHydrated=!0;var a=n.search.bind(n);n.search=function(c){for(var f=arguments.length,l=new Array(f>1?f-1:0),d=1;d<f;d++)l[d-1]=arguments[d];var v=Array.isArray(c)?c.map(function(R){return L(O({},R),{params:Je(R.params)})}):Je(c.requestBody.params);return n.transporter.responsesCache.get({method:"search",args:[v].concat(re(l))},function(){return a.apply(void 0,[c].concat(re(l)))})},n.transporter.responsesCache.set({method:"search",args:r},{results:e})}if(!("transporter"in n)){var i="/1/indexes/*/queries_body_".concat(JSON.stringify({requests:r}));n.cache=L(O({},n.cache),T({},i,JSON.stringify({results:Object.keys(t).map(function(c){return t[c].results})})))}}}function ji(n){return n.split("&").reduce(function(t,r){var e=G(r.split("="),2),a=e[0],i=e[1];
14return t[a]=i?decodeURIComponent(i):"",t},{})}function Je(n){var t=function(a){return Object.prototype.toString.call(a)==="[object Object]"||Object.prototype.toString.call(a)==="[object Array]"},r=function(a){for(var i=arguments.length,c=new Array(i>1?i-1:0),f=1;f<i;f++)c[f-1]=arguments[f];var l=0;return a.replace(/%s/g,function(){return encodeURIComponent(c[l++])})};return Object.keys(n).map(function(e){return r("%s=%s",e,t(n[e])?JSON.stringify(n[e]):n[e])}).join("&")}var jr="4.92.1",ee=xr({name:"instantsearch"});function Ei(){return"#"}var Ti={preserveSharedStateOnUnmount:!1,persistHierarchicalRootCount:!1},Ii=(function(n){En(t,n);function t(r){ur(this,t);var e;e=jn(this,t),T(e,"client",void 0),T(e,"indexName",void 0),T(e,"compositionID",void 0),T(e,"insightsClient",void 0),T(e,"onStateChange",null),T(e,"future",void 0),T(e,"helper",void 0),T(e,"mainHelper",void 0),T(e,"mainIndex",void 0),T(e,"started",void 0),T(e,"templatesConfig",void 0),T(e,"renderState",{}),T(e,"_stalledSearchDelay",void 0),T(e,"_searchStalledTimer",void 0),T(e,"_initialUiState",void 0),T(e,"_initialResults",void 0),T(e,"_manuallyResetScheduleSearch",!1),T(e,"_resetScheduleSearch",void 0),T(e,"_createURL",void 0),T(e,"_searchFunction",void 0),T(e,"_mainHelperSearch",void 0),T(e,"_hasSearchWidget",!1),T(e,"_hasRecommendWidget",!1),T(e,"_insights",void 0),T(e,"middleware",[]),T(e,"sendEventToInsights",void 0),T(e,"status","idle"),T(e,"error",void 0),T(e,"scheduleSearch",ne(function(){e.started&&e.mainHelper.search()})),T(e,"scheduleRender",ne(function(){var P=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,E;!((E=e.mainHelper)===null||E===void 0)&&E.hasPendingRequests()||(clearTimeout(e._searchStalledTimer),e._searchStalledTimer=null,P&&(e.status="idle",e.error=void 0)),e.mainIndex.render({instantSearchInstance:e}),e.emit("render")})),T(e,"onInternalStateChange",ne(function(){var P=e.mainIndex.getWidgetUiState({});e.middleware.forEach(function(E){var I=E.instance;I.onStateChange({uiState:P})})})),e.setMaxListeners(100);var a=r.indexName,i=a===void 0?"":a,c=r.compositionID,f=r.numberLocale,l=r.initialUiState,d=l===void 0?{}:l,v=r.routing,R=v===void 0?null:v,h=r.insights,s=h===void 0?void 0:h,u=r.searchFunction,S=r.stalledSearchDelay,x=S===void 0?200:S,o=r.searchClient,m=o===void 0?null:o,y=r.insightsClient,_=y===void 0?null:y,w=r.onStateChange,b=w===void 0?null:w,j=r.future,g=j===void 0?O({},Ti,r.future||{}):j;if(m===null)throw new Error(ee("The `searchClient` option is required."));if(typeof m.search!="function")throw new Error("The `searchClient` must implement a `search` method.\n\nSee: https://www.algolia.com/doc/guides/building-search-ui/going-further/backend-search/in-depth/backend-instantsearch/js/");if(typeof m.addAlgoliaAgent=="function"&&m.addAlgoliaAgent("instantsearch.js (".concat(jr,")")),_&&typeof _!="function")throw new Error(ee("The `insightsClient` option should be a function."));if(e.client=m,e.future=g,e.insightsClient=_,e.indexName=i,e.compositionID=c,e.helper=null,e.mainHelper=null,e.mainIndex=Fi({indexName:e.compositionID||e.indexName}),e.onStateChange=b,e.started=!1,e.templatesConfig={helpers:wi({numberLocale:f}),compileOptions:{}},e._stalledSearchDelay=x,e._searchStalledTimer=null,e._createURL=Ei,e._initialUiState=d,e._initialResults=null,e._insights=s,u&&(e._searchFunction=u),e.sendEventToInsights=te,R){var p=typeof R=="boolean"?{}:R;p.$$internal=!0,e.use(ii(p))}if(s){var F=typeof s=="boolean"?{}:s;F.$$internal=!0,e.use(kt(F))}return Zn()&&e.use(ei({$$internal:!0})),e}return or(t,[{key:"_isSearchStalled",get:function(){return this.status==="stalled"}},{key:"use",value:function(){for(var e=this,a=arguments.length,i=new Array(a),c=0;c<a;c++)i[c]=arguments[c];var f=i.map(function(l){var d=O({$$type:"__unknown__",$$internal:!1,subscribe:te,started:te,unsubscribe:te,onStateChange:te},l({instantSearchInstance:e}));return e.middleware.push({creator:l,instance:d}),d});return this.started&&f.forEach(function(l){l.subscribe(),l.started()}),this}},{key:"unuse",value:function(){for(var e=arguments.length,a=new Array(e),i=0;i<e;i++)a[i]=arguments[i];return this.middleware.filter(function(c){return a.includes(c.creator)}
14).forEach(function(c){return c.instance.unsubscribe()}),this.middleware=this.middleware.filter(function(c){return!a.includes(c.creator)}),this}},{key:"EXPERIMENTAL_use",value:function(){for(var e=arguments.length,a=new Array(e),i=0;i<e;i++)a[i]=arguments[i];return this.use.apply(this,re(a))}},{key:"addWidget",value:function(e){return this.addWidgets([e])}},{key:"addWidgets",value:function(e){if(!Array.isArray(e))throw new Error(ee("The `addWidgets` method expects an array of widgets. Please use `addWidget`."));if(this.compositionID&&e.some(function(a){return!Array.isArray(a)&&X(a)&&!a._isolated}))throw new Error(ee("The `index` widget cannot be used with a composition-based InstantSearch implementation."));return this.mainIndex.addWidgets(e),this}},{key:"removeWidget",value:function(e){return this.removeWidgets([e])}},{key:"removeWidgets",value:function(e){if(!Array.isArray(e))throw new Error(ee("The `removeWidgets` method expects an array of widgets. Please use `removeWidget`."));return this.mainIndex.removeWidgets(e),this}},{key:"start",value:function(){var e=this;if(this.started)throw new Error(ee("The `start` method has already been called once."));var a=this.mainHelper||V(this.client,this.indexName,void 0,{persistHierarchicalRootCount:this.future.persistHierarchicalRootCount});if(this.compositionID&&(a.searchForFacetValues=a.searchForCompositionFacetValues.bind(a)),a.search=function(){return e.status="loading",e.scheduleRender(!1),e._hasSearchWidget&&(e.compositionID?a.searchWithComposition():a.searchOnlyWithDerivedHelpers()),e._hasRecommendWidget&&a.recommend(),a},this._searchFunction){var i={search:function(){return new Promise(te)}};this._mainHelperSearch=a.search.bind(a),a.search=function(){var f=e.mainIndex.getHelper(),l=V(i,f.state.index,f.state);return l.once("search",function(d){var v=d.state;f.overrideStateWithoutTriggeringChangeEvent(v),e._mainHelperSearch()}),l.on("change",function(d){var v=d.state;f.setState(v)}),e._searchFunction(l),a}}if(a.on("error",function(f){var l=f.error;if(!Ge(l,Error)){var d=l;l=Object.keys(d).reduce(function(v,R){return v[R]=d[R],v},new Error(d.message))}l.error=l,e.error=l,e.status="error",e.scheduleRender(!1),e.emit("error",l)}),this.mainHelper=a,this.middleware.forEach(function(f){var l=f.instance;l.subscribe()}),this.mainIndex.init({instantSearchInstance:this,parent:null,uiState:this._initialUiState}),this._initialResults){bi(this.client,this._initialResults),Pi(this.mainHelper,this._initialResults);var c=this.scheduleSearch;this.scheduleSearch=ne(te),this._manuallyResetScheduleSearch?this._resetScheduleSearch=function(){e.scheduleSearch=c}:ne(function(){e.scheduleSearch=c})()}else this.mainIndex.getWidgets().length>0&&this.scheduleSearch();this.helper=this.mainIndex.getHelper(),this.started=!0,this.middleware.forEach(function(f){var l=f.instance;l.started()}),typeof this._insights>"u"&&a.derivedHelpers[0].once("result",function(){var f=e.mainIndex.getScopedResults().some(function(l){var d=l.results;return d?._automaticInsights});f&&e.use(kt({$$internal:!0,$$automatic:!0}))})}},{key:"dispose",value:function(){var e;this.scheduleSearch.cancel(),this.scheduleRender.cancel(),clearTimeout(this._searchStalledTimer),this.removeWidgets(this.mainIndex.getWidgets()),this.mainIndex.dispose(),this.started=!1,this.removeAllListeners(),(e=this.mainHelper)===null||e===void 0||e.removeAllListeners(),this.mainHelper=null,this.helper=null,this.middleware.forEach(function(a){var i=a.instance;i.unsubscribe()})}},{key:"scheduleStalledRender",value:function(){var e=this;this._searchStalledTimer||(this._searchStalledTimer=setTimeout(function(){e.status="stalled",e.scheduleRender()},this._stalledSearchDelay))}},{key:"setUiState",value:function(e){var a=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(!this.mainHelper)throw new Error(ee("The `start` method needs to be called before `setUiState`."));this.mainIndex.refreshUiState();var c=typeof e=="function"?e(this.mainIndex.getWidgetUiState({})):e;this.onStateChange&&i?this.onStateChange({uiState:c,setUiState:function(l){ze(typeof l=="function"?l(c):l,a.mainIndex),a.scheduleSearch(),a.onInternalStateChange()}}):(ze(c,this.mainIndex),this.scheduleSearch(),this.onInternalStateChange())}},{key:"getUiState",value:function(){return this.started&&this.mainIndex.refreshUiState(),this.mainIndex.getWidgetUiState({})}},{key:"createURL",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!this.started)throw new Error(ee("The `start` method needs to be called before `createURL`."));return this._createURL(e)}},{key:"refresh",value:function(){if(!this.mainHelper)throw new Error(ee("The `start` method needs to be called before `refresh`."));this.mainHelper.clearCache().search()}}]),t})(Jn),he=function(t,r){return t},z=function(t){return new Ii(t)};z.version=jr;z.createInfiniteHitsSessionStorageCache=he(Bn);z.highlight=he(fr);z.reverseHighlight=he(gr);z.snippet=he(pr);z.reverseSnippet=he(Rr);z.insights=yr;z.getInsightsAnonymousUserToken=Mn;Object.defineProperty(z,"widgets",{get:function(){throw new ReferenceError(`"instantsearch.widgets" are not available from the ES build. 15 16To import the widgets: 17 18import { searchBox } from 'instantsearch.js/es/widgets/index.js'`)}});Object.defineProperty(z,"connectors",{get:function(){throw new ReferenceError(`"instantsearch.connectors" are not available from the ES build. 19 20To import the connectors: 21 22import { connectSearchBox } from 'instantsearch.js/es/connectors/index.js'`)}});Object.defineProperty(z,"templates",{get:function(){throw new ReferenceError(`"instantsearch.templates" are not available from the ES build. 23 24To import the templates: 25 26import { carousel } from 'instantsearch.js/es/templates/index.js'`)}});const Hi={class:"ais-InstantSearch"},Ui=Or({__name:"InstantSearch",props:{configuration:{},widgets:{},instanceKey:{},middlewares:{}},async setup(n){let t,r;const e=n,{widgets:a,middlewares:i}=Cr(e),c=Dr(`instant_search_instance-${e.instanceKey??""}`,()=>Nr(z(e.configuration)));qr("searchInstance",c);const{setup:f}=Er(c);return[t,r]=Qr(()=>
26f(e.widgets,e.instanceKey)),await t,r(),ut(a,async()=>{await f(e.widgets,e.instanceKey)}),ut(i,(l,d)=>{(d||[]).filter(v=>(l||[]).indexOf(v)===-1).forEach(v=>{c.value.unuse(v)}),(l||[]).filter(v=>(d||[]).indexOf(v)===-1).forEach(v=>{c.value.use(v)})},{immediate:!0}),(l,d)=>(Ur(),Wr("div",Hi,[$r(l.$slots,"default")]))}});export{re as _,Ni as a,Qi as b,Di as c,Ui as d,ge as m,Kr as u};
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.