@abi-software/map-side-bar 2.11.0 → 2.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/map-side-bar.js
CHANGED
|
@@ -22564,7 +22564,7 @@ const Ta = function(e) {
|
|
|
22564
22564
|
label: "Filters",
|
|
22565
22565
|
disabled: !0
|
|
22566
22566
|
}), this.createChildrenCascaderValue(e[n].children, t, [t.label]);
|
|
22567
|
-
}), this.options
|
|
22567
|
+
}), Object.assign(this.options, e);
|
|
22568
22568
|
},
|
|
22569
22569
|
populateCascader: function() {
|
|
22570
22570
|
return this.entry.options ? new Promise((e) => {
|
|
@@ -23149,7 +23149,7 @@ function t9(e, t, n, r, o, a) {
|
|
|
23149
23149
|
])
|
|
23150
23150
|
]);
|
|
23151
23151
|
}
|
|
23152
|
-
const cl = /* @__PURE__ */ Nn(M6, [["render", t9], ["__scopeId", "data-v-
|
|
23152
|
+
const cl = /* @__PURE__ */ Nn(M6, [["render", t9], ["__scopeId", "data-v-5ccdbcd9"]]);
|
|
23153
23153
|
var n9 = async function(e) {
|
|
23154
23154
|
if (!e.ok) {
|
|
23155
23155
|
let t = await e.json();
|
|
@@ -461,7 +461,7 @@ usage: app.provide(ZINDEX_INJECTION_KEY, { current: 0 })`),{initialZIndex:r,curr
|
|
|
461
461
|
</g>
|
|
462
462
|
</svg>`,g0=(e,t,o,r)=>{const a=["title","desc","defs","style"],i=["width","height"],s=r||[];let l=document.createElement("div");l.innerHTML=e,a.map(d=>{const u=l.querySelector(d);u&&u.remove()}),i.map(d=>{l.querySelector("svg").removeAttribute(d)}),r&&s.map(d=>{Object.values(l.querySelectorAll(`[${d}]`)).map(u=>{u.removeAttribute(d)})});const c=l.innerHTML;return l=null,c},y0=e=>[[/<\?xml[\s\S]*?>/gi,""],[/<!doctype[\s\S]*?>/gi,""],[/<!--.*-->/gi,""],[/\<([A-Za-z]+)([^\>]*)\/\>/g,"<$1$2></$1>"],[/\s+/g," "],[/\> \</g,"><"]].reduce((t,o)=>"".replace.apply(t,o),e).trim(),t8=!0,n8=!0,o8=["fill"],Yc=Object.assign({"/assets/icons/2horpanel.svg":Ly,"/assets/icons/2vertpanel.svg":Vy,"/assets/icons/3panel.svg":Dy,"/assets/icons/4panel.svg":My,"/assets/icons/5panel.svg":jy,"/assets/icons/6panel.svg":zy,"/assets/icons/6panelVertical.svg":Uy,"/assets/icons/changeBckgd.svg":Hy,"/assets/icons/close-no-bk.svg":qy,"/assets/icons/close.svg":Ky,"/assets/icons/closeFullScreen.svg":Wy,"/assets/icons/comment.svg":Gy,"/assets/icons/connection.svg":Jy,"/assets/icons/dock.svg":Zy,"/assets/icons/drawLine.svg":Yy,"/assets/icons/drawPoint.svg":Xy,"/assets/icons/drawPolygon.svg":Qy,"/assets/icons/drawTrash.svg":e0,"/assets/icons/fitWindow.svg":t0,"/assets/icons/fullScreen.svg":n0,"/assets/icons/help.svg":o0,"/assets/icons/magnifyingGlass.svg":r0,"/assets/icons/noun-filter.svg":a0,"/assets/icons/openMap.svg":i0,"/assets/icons/pause.svg":s0,"/assets/icons/permalink.svg":l0,"/assets/icons/play.svg":c0,"/assets/icons/resetZoom.svg":d0,"/assets/icons/singlepanel.svg":u0,"/assets/icons/tooltips.svg":f0,"/assets/icons/undock.svg":p0,"/assets/icons/zoomIn.svg":h0,"/assets/icons/zoomOut.svg":m0});Object.keys(Yc).map(e=>{const t=g0(Yc[e],t8,n8,o8),o=e.replace(/^.+\/(\w+).svg$/,"$1");return y0(t).replace("<svg",`<symbol id="${o}"`).replace("svg>","symbol>")}).join(`
|
|
463
463
|
`);const Xc=Object.assign({"/assets/icons/2horpanel.svg":Ly,"/assets/icons/2vertpanel.svg":Vy,"/assets/icons/3panel.svg":Dy,"/assets/icons/4panel.svg":My,"/assets/icons/5panel.svg":jy,"/assets/icons/6panel.svg":zy,"/assets/icons/6panelVertical.svg":Uy,"/assets/icons/changeBckgd.svg":Hy,"/assets/icons/close-no-bk.svg":qy,"/assets/icons/close.svg":Ky,"/assets/icons/closeFullScreen.svg":Wy,"/assets/icons/comment.svg":Gy,"/assets/icons/connection.svg":Jy,"/assets/icons/dock.svg":Zy,"/assets/icons/drawLine.svg":Yy,"/assets/icons/drawPoint.svg":Xy,"/assets/icons/drawPolygon.svg":Qy,"/assets/icons/drawTrash.svg":e0,"/assets/icons/fitWindow.svg":t0,"/assets/icons/fullScreen.svg":n0,"/assets/icons/help.svg":o0,"/assets/icons/magnifyingGlass.svg":r0,"/assets/icons/noun-filter.svg":a0,"/assets/icons/openMap.svg":i0,"/assets/icons/pause.svg":s0,"/assets/icons/permalink.svg":l0,"/assets/icons/play.svg":c0,"/assets/icons/resetZoom.svg":d0,"/assets/icons/singlepanel.svg":u0,"/assets/icons/tooltips.svg":f0,"/assets/icons/undock.svg":p0,"/assets/icons/zoomIn.svg":h0,"/assets/icons/zoomOut.svg":m0}),r8=Object.keys(Xc).map(e=>{const t=g0(Xc[e]),o=e.replace(/^.+\/(\w+).svg$/,"$1");return y0(t).replace("<svg",`<symbol id="${o}"`).replace("svg>","symbol>")}),a8={name:"MapSvgSpriteColor",svgContext:Xc,svgSprite:r8.join(`
|
|
464
|
-
`)},i8=["innerHTML"];function s8(e,t,o,r,a,i){return n.openBlock(),n.createElementBlock("svg",{width:"0",height:"0",style:{display:"none"},innerHTML:e.$options.svgSprite},null,8,i8)}const b0=Ry(a8,[["render",s8]]);var w0={exports:{}};/*! algoliasearch.umd.js | 4.23.2 | © Algolia, inc. | https://github.com/algolia/algoliasearch-client-javascript */(function(e,t){(function(o,r){e.exports=r()})(JE,function(){function o(w,C,k){return C in w?Object.defineProperty(w,C,{value:k,enumerable:!0,configurable:!0,writable:!0}):w[C]=k,w}function r(w,C){var k=Object.keys(w);if(Object.getOwnPropertySymbols){var _=Object.getOwnPropertySymbols(w);C&&(_=_.filter(function(I){return Object.getOwnPropertyDescriptor(w,I).enumerable})),k.push.apply(k,_)}return k}function a(w){for(var C=1;C<arguments.length;C++){var k=arguments[C]!=null?arguments[C]:{};C%2?r(Object(k),!0).forEach(function(_){o(w,_,k[_])}):Object.getOwnPropertyDescriptors?Object.defineProperties(w,Object.getOwnPropertyDescriptors(k)):r(Object(k)).forEach(function(_){Object.defineProperty(w,_,Object.getOwnPropertyDescriptor(k,_))})}return w}function i(w,C){if(w==null)return{};var k,_,I=function(W,z){if(W==null)return{};var K,te,Y={},ce=Object.keys(W);for(te=0;te<ce.length;te++)K=ce[te],z.indexOf(K)>=0||(Y[K]=W[K]);return Y}(w,C);if(Object.getOwnPropertySymbols){var H=Object.getOwnPropertySymbols(w);for(_=0;_<H.length;_++)k=H[_],C.indexOf(k)>=0||Object.prototype.propertyIsEnumerable.call(w,k)&&(I[k]=w[k])}return I}function s(w,C){return function(k){if(Array.isArray(k))return k}(w)||function(k,_){if(Symbol.iterator in Object(k)||Object.prototype.toString.call(k)==="[object Arguments]"){var I=[],H=!0,W=!1,z=void 0;try{for(var K,te=k[Symbol.iterator]();!(H=(K=te.next()).done)&&(I.push(K.value),!_||I.length!==_);H=!0);}catch(Y){W=!0,z=Y}finally{try{H||te.return==null||te.return()}finally{if(W)throw z}}return I}}(w,C)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function l(w){return function(C){if(Array.isArray(C)){for(var k=0,_=new Array(C.length);k<C.length;k++)_[k]=C[k];return _}}(w)||function(C){if(Symbol.iterator in Object(C)||Object.prototype.toString.call(C)==="[object Arguments]")return Array.from(C)}(w)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function c(w){var C,k="algoliasearch-client-js-".concat(w.key),_=function(){return C===void 0&&(C=w.localStorage||window.localStorage),C},I=function(){return JSON.parse(_().getItem(k)||"{}")},H=function(z){_().setItem(k,JSON.stringify(z))},W=function(){var z=w.timeToLive?1e3*w.timeToLive:null,K=I(),te=Object.fromEntries(Object.entries(K).filter(function(ce){return s(ce,2)[1].timestamp!==void 0}));if(H(te),z){var Y=Object.fromEntries(Object.entries(te).filter(function(ce){var se=s(ce,2)[1],we=new Date().getTime();return!(se.timestamp+z<we)}));H(Y)}};return{get:function(z,K){var te=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{miss:function(){return Promise.resolve()}};return Promise.resolve().then(function(){W();var Y=JSON.stringify(z);return I()[Y]}).then(function(Y){return Promise.all([Y?Y.value:K(),Y!==void 0])}).then(function(Y){var ce=s(Y,2),se=ce[0],we=ce[1];return Promise.all([se,we||te.miss(se)])}).then(function(Y){return s(Y,1)[0]})},set:function(z,K){return Promise.resolve().then(function(){var te=I();return te[JSON.stringify(z)]={timestamp:new Date().getTime(),value:K},_().setItem(k,JSON.stringify(te)),K})},delete:function(z){return Promise.resolve().then(function(){var K=I();delete K[JSON.stringify(z)],_().setItem(k,JSON.stringify(K))})},clear:function(){return Promise.resolve().then(function(){_().removeItem(k)})}}}function d(w){var C=l(w.caches),k=C.shift();return k===void 0?{get:function(_,I){var H=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{miss:function(){return Promise.resolve()}},W=I();return W.then(function(z){return Promise.all([z,H.miss(z)])}).then(function(z){return s(z,1)[0]})},set:function(_,I){return Promise.resolve(I)},delete:function(_){return Promise.resolve()},clear:function(){return Promise.resolve()}}:{get:function(_,I){var H=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{miss:function(){return Promise.resolve()}};return k.get(_,I,H).catch(function(){return d({caches:C}).get(_,I,H)})},set:function(_,I){return k.set(_,I).catch(function(){return d({caches:C}).set(_,I)})},delete:function(_){return k.delete(_).catch(function(){return d({caches:C}).delete(_)})},clear:function(){return k.clear().catch(function(){return d({caches:C}).clear()})}}}function u(){var w=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{serializable:!0},C={};return{get:function(k,_){var I=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{miss:function(){return Promise.resolve()}},H=JSON.stringify(k);if(H in C)return Promise.resolve(w.serializable?JSON.parse(C[H]):C[H]);var W=_(),z=I&&I.miss||function(){return Promise.resolve()};return W.then(function(K){return z(K)}).then(function(){return W})},set:function(k,_){return C[JSON.stringify(k)]=w.serializable?JSON.stringify(_):_,Promise.resolve(_)},delete:function(k){return delete C[JSON.stringify(k)],Promise.resolve()},clear:function(){return C={},Promise.resolve()}}}function p(w,C,k){var _={"x-algolia-api-key":k,"x-algolia-application-id":C};return{headers:function(){return w===b.WithinHeaders?_:{}},queryParameters:function(){return w===b.WithinQueryParameters?_:{}}}}function g(w){var C=0;return w(function k(){return C++,new Promise(function(_){setTimeout(function(){_(w(k))},Math.min(100*C,1e3))})})}function m(w){var C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(k,_){return Promise.resolve()};return Object.assign(w,{wait:function(k){return m(w.then(function(_){return Promise.all([C(_,k),_])}).then(function(_){return _[1]}))}})}function f(w){for(var C=w.length-1;C>0;C--){var k=Math.floor(Math.random()*(C+1)),_=w[C];w[C]=w[k],w[k]=_}return w}function h(w,C){return C&&Object.keys(C).forEach(function(k){w[k]=C[k](w)}),w}function y(w){for(var C=arguments.length,k=new Array(C>1?C-1:0),_=1;_<C;_++)k[_-1]=arguments[_];var I=0;return w.replace(/%s/g,function(){return encodeURIComponent(k[I++])})}var b={WithinQueryParameters:0,WithinHeaders:1};function E(w,C){var k=w||{},_=k.data||{};return Object.keys(k).forEach(function(I){["timeout","headers","queryParameters","data","cacheable"].indexOf(I)===-1&&(_[I]=k[I])}),{data:Object.entries(_).length>0?_:void 0,timeout:k.timeout||C,headers:k.headers||{},queryParameters:k.queryParameters||{},cacheable:k.cacheable}}var O={Read:1,Write:2,Any:3},v=1,S=2,x=3;function T(w){var C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:v;return a(a({},w),{},{status:C,lastUpdate:Date.now()})}function B(w){return typeof w=="string"?{protocol:"https",url:w,accept:O.Any}:{protocol:w.protocol||"https",url:w.url,accept:w.accept||O.Any}}var A="DELETE",V="GET",P="POST",$="PUT";function j(w,C){return Promise.all(C.map(function(k){return w.get(k,function(){return Promise.resolve(T(k))})})).then(function(k){var _=k.filter(function(W){return function(z){return z.status===v||Date.now()-z.lastUpdate>12e4}(W)}),I=k.filter(function(W){return function(z){return z.status===x&&Date.now()-z.lastUpdate<=12e4}(W)}),H=[].concat(l(_),l(I));return{getTimeout:function(W,z){return(I.length===0&&W===0?1:I.length+3+W)*z},statelessHosts:H.length>0?H.map(function(W){return B(W)}):C}})}function Z(w,C,k,_){var I=[],H=function(se,we){if(!(se.method===V||se.data===void 0&&we.data===void 0)){var he=Array.isArray(se.data)?se.data:a(a({},se.data),we.data);return JSON.stringify(he)}}(k,_),W=function(se,we){var he=a(a({},se.headers),we.headers),Ie={};return Object.keys(he).forEach(function(Ve){var Nt=he[Ve];Ie[Ve.toLowerCase()]=Nt}),Ie}(w,_),z=k.method,K=k.method!==V?{}:a(a({},k.data),_.data),te=a(a(a({"x-algolia-agent":w.userAgent.value},w.queryParameters),K),_.queryParameters),Y=0,ce=function se(we,he){var Ie=we.pop();if(Ie===void 0)throw{name:"RetryError",message:"Unreachable hosts - your application id may be incorrect. If the error persists, contact support@algolia.com.",transporterStackTrace:ne(I)};var Ve={data:H,headers:W,method:z,url:D(Ie,k.path,te),connectTimeout:he(Y,w.timeouts.connect),responseTimeout:he(Y,_.timeout)},Nt=function(It){var ut={request:Ve,response:It,host:Ie,triesLeft:we.length};return I.push(ut),ut},Ta={onSuccess:function(It){return function(ut){try{return JSON.parse(ut.content)}catch($o){throw function(so,Cr){return{name:"DeserializationError",message:so,response:Cr}}($o.message,ut)}}(It)},onRetry:function(It){var ut=Nt(It);return It.isTimedOut&&Y++,Promise.all([w.logger.info("Retryable failure",ge(ut)),w.hostsCache.set(Ie,T(Ie,It.isTimedOut?x:S))]).then(function(){return se(we,he)})},onFail:function(It){throw Nt(It),function(ut,$o){var so=ut.content,Cr=ut.status,Oa=so;try{Oa=JSON.parse(so).message}catch{}return function(ys,pd,Q4){return{name:"ApiError",message:ys,status:pd,transporterStackTrace:Q4}}(Oa,Cr,$o)}(It,ne(I))}};return w.requester.send(Ve).then(function(It){return function(ut,$o){return function(so){var Cr=so.status;return so.isTimedOut||function(Oa){var ys=Oa.isTimedOut,pd=Oa.status;return!ys&&~~pd==0}(so)||~~(Cr/100)!=2&&~~(Cr/100)!=4}(ut)?$o.onRetry(ut):~~(ut.status/100)==2?$o.onSuccess(ut):$o.onFail(ut)}(It,Ta)})};return j(w.hostsCache,C).then(function(se){return ce(l(se.statelessHosts).reverse(),se.getTimeout)})}function q(w){var C=w.hostsCache,k=w.logger,_=w.requester,I=w.requestsCache,H=w.responsesCache,W=w.timeouts,z=w.userAgent,K=w.hosts,te=w.queryParameters,Y={hostsCache:C,logger:k,requester:_,requestsCache:I,responsesCache:H,timeouts:W,userAgent:z,headers:w.headers,queryParameters:te,hosts:K.map(function(ce){return B(ce)}),read:function(ce,se){var we=E(se,Y.timeouts.read),he=function(){return Z(Y,Y.hosts.filter(function(Ve){return(Ve.accept&O.Read)!=0}),ce,we)};if((we.cacheable!==void 0?we.cacheable:ce.cacheable)!==!0)return he();var Ie={request:ce,mappedRequestOptions:we,transporter:{queryParameters:Y.queryParameters,headers:Y.headers}};return Y.responsesCache.get(Ie,function(){return Y.requestsCache.get(Ie,function(){return Y.requestsCache.set(Ie,he()).then(function(Ve){return Promise.all([Y.requestsCache.delete(Ie),Ve])},function(Ve){return Promise.all([Y.requestsCache.delete(Ie),Promise.reject(Ve)])}).then(function(Ve){var Nt=s(Ve,2);return Nt[0],Nt[1]})})},{miss:function(Ve){return Y.responsesCache.set(Ie,Ve)}})},write:function(ce,se){return Z(Y,Y.hosts.filter(function(we){return(we.accept&O.Write)!=0}),ce,E(se,Y.timeouts.write))}};return Y}function N(w){var C={value:"Algolia for JavaScript (".concat(w,")"),add:function(k){var _="; ".concat(k.segment).concat(k.version!==void 0?" (".concat(k.version,")"):"");return C.value.indexOf(_)===-1&&(C.value="".concat(C.value).concat(_)),C}};return C}function D(w,C,k){var _=ee(k),I="".concat(w.protocol,"://").concat(w.url,"/").concat(C.charAt(0)==="/"?C.substr(1):C);return _.length&&(I+="?".concat(_)),I}function ee(w){return Object.keys(w).map(function(C){return y("%s=%s",C,(k=w[C],Object.prototype.toString.call(k)==="[object Object]"||Object.prototype.toString.call(k)==="[object Array]"?JSON.stringify(w[C]):w[C]));var k}).join("&")}function ne(w){return w.map(function(C){return ge(C)})}function ge(w){var C=w.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return a(a({},w),{},{request:a(a({},w.request),{},{headers:a(a({},w.request.headers),C)})})}var le=function(w){return function(C,k){return w.transporter.write({method:P,path:"2/abtests",data:C},k)}},Se=function(w){return function(C,k){return w.transporter.write({method:A,path:y("2/abtests/%s",C)},k)}},Pe=function(w){return function(C,k){return w.transporter.read({method:V,path:y("2/abtests/%s",C)},k)}},xe=function(w){return function(C){return w.transporter.read({method:V,path:"2/abtests"},C)}},ye=function(w){return function(C,k){return w.transporter.write({method:P,path:y("2/abtests/%s/stop",C)},k)}},Ee=function(w){return function(C){return w.transporter.read({method:V,path:"1/strategies/personalization"},C)}},Fe=function(w){return function(C,k){return w.transporter.write({method:P,path:"1/strategies/personalization",data:C},k)}};function je(w){return function C(k){return w.request(k).then(function(_){if(w.batch!==void 0&&w.batch(_.hits),!w.shouldStop(_))return _.cursor?C({cursor:_.cursor}):C({page:(k.page||0)+1})})}({})}var tn=function(w){return function(C,k){var _=k||{},I=_.queryParameters,H=i(_,["queryParameters"]),W=a({acl:C},I!==void 0?{queryParameters:I}:{});return m(w.transporter.write({method:P,path:"1/keys",data:W},H),function(z,K){return g(function(te){return _e(w)(z.key,K).catch(function(Y){if(Y.status!==404)throw Y;return te()})})})}},ct=function(w){return function(C,k,_){var I=E(_);return I.queryParameters["X-Algolia-User-ID"]=C,w.transporter.write({method:P,path:"1/clusters/mapping",data:{cluster:k}},I)}},Xe=function(w){return function(C,k,_){return w.transporter.write({method:P,path:"1/clusters/mapping/batch",data:{users:C,cluster:k}},_)}},Re=function(w){return function(C,k){return m(w.transporter.write({method:P,path:y("/1/dictionaries/%s/batch",C),data:{clearExistingDictionaryEntries:!0,requests:{action:"addEntry",body:[]}}},k),function(_,I){return ao(w)(_.taskID,I)})}},He=function(w){return function(C,k,_){return m(w.transporter.write({method:P,path:y("1/indexes/%s/operation",C),data:{operation:"copy",destination:k}},_),function(I,H){return Le(w)(C,{methods:{waitTask:Ge}}).waitTask(I.taskID,H)})}},_t=function(w){return function(C,k,_){return He(w)(C,k,a(a({},_),{},{scope:[fd.Rules]}))}},Tt=function(w){return function(C,k,_){return He(w)(C,k,a(a({},_),{},{scope:[fd.Settings]}))}},Ze=function(w){return function(C,k,_){return He(w)(C,k,a(a({},_),{},{scope:[fd.Synonyms]}))}},Ot=function(w){return function(C,k){return C.method===V?w.transporter.read(C,k):w.transporter.write(C,k)}},dt=function(w){return function(C,k){return m(w.transporter.write({method:A,path:y("1/keys/%s",C)},k),function(_,I){return g(function(H){return _e(w)(C,I).then(H).catch(function(W){if(W.status!==404)throw W})})})}},nn=function(w){return function(C,k,_){var I=k.map(function(H){return{action:"deleteEntry",body:{objectID:H}}});return m(w.transporter.write({method:P,path:y("/1/dictionaries/%s/batch",C),data:{clearExistingDictionaryEntries:!1,requests:I}},_),function(H,W){return ao(w)(H.taskID,W)})}},_e=function(w){return function(C,k){return w.transporter.read({method:V,path:y("1/keys/%s",C)},k)}},Qe=function(w){return function(C,k){return w.transporter.read({method:V,path:y("1/task/%s",C.toString())},k)}},mt=function(w){return function(C){return w.transporter.read({method:V,path:"/1/dictionaries/*/settings"},C)}},Dt=function(w){return function(C){return w.transporter.read({method:V,path:"1/logs"},C)}},et=function(w){return function(C){return w.transporter.read({method:V,path:"1/clusters/mapping/top"},C)}},U=function(w){return function(C,k){return w.transporter.read({method:V,path:y("1/clusters/mapping/%s",C)},k)}},me=function(w){return function(C){var k=C||{},_=k.retrieveMappings,I=i(k,["retrieveMappings"]);return _===!0&&(I.getClusters=!0),w.transporter.read({method:V,path:"1/clusters/mapping/pending"},I)}},Le=function(w){return function(C){var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},_={transporter:w.transporter,appId:w.appId,indexName:C};return h(_,k.methods)}},gt=function(w){return function(C){return w.transporter.read({method:V,path:"1/keys"},C)}},Mt=function(w){return function(C){return w.transporter.read({method:V,path:"1/clusters"},C)}},gr=function(w){return function(C){return w.transporter.read({method:V,path:"1/indexes"},C)}},Sa=function(w){return function(C){return w.transporter.read({method:V,path:"1/clusters/mapping"},C)}},Po=function(w){return function(C,k,_){return m(w.transporter.write({method:P,path:y("1/indexes/%s/operation",C),data:{operation:"move",destination:k}},_),function(I,H){return Le(w)(C,{methods:{waitTask:Ge}}).waitTask(I.taskID,H)})}},Ro=function(w){return function(C,k){return m(w.transporter.write({method:P,path:"1/indexes/*/batch",data:{requests:C}},k),function(_,I){return Promise.all(Object.keys(_.taskID).map(function(H){return Le(w)(H,{methods:{waitTask:Ge}}).waitTask(_.taskID[H],I)}))})}},M=function(w){return function(C,k){return w.transporter.read({method:P,path:"1/indexes/*/objects",data:{requests:C}},k)}},X=function(w){return function(C,k){var _=C.map(function(I){return a(a({},I),{},{params:ee(I.params||{})})});return w.transporter.read({method:P,path:"1/indexes/*/queries",data:{requests:_},cacheable:!0},k)}},Q=function(w){return function(C,k){return Promise.all(C.map(function(_){var I=_.params,H=I.facetName,W=I.facetQuery,z=i(I,["facetName","facetQuery"]);return Le(w)(_.indexName,{methods:{searchForFacetValues:P0}}).searchForFacetValues(H,W,a(a({},k),z))}))}},Te=function(w){return function(C,k){var _=E(k);return _.queryParameters["X-Algolia-User-ID"]=C,w.transporter.write({method:A,path:"1/clusters/mapping"},_)}},jt=function(w){return function(C,k,_){var I=k.map(function(H){return{action:"addEntry",body:H}});return m(w.transporter.write({method:P,path:y("/1/dictionaries/%s/batch",C),data:{clearExistingDictionaryEntries:!0,requests:I}},_),function(H,W){return ao(w)(H.taskID,W)})}},Bt=function(w){return function(C,k){return m(w.transporter.write({method:P,path:y("1/keys/%s/restore",C)},k),function(_,I){return g(function(H){return _e(w)(C,I).catch(function(W){if(W.status!==404)throw W;return H()})})})}},zt=function(w){return function(C,k,_){var I=k.map(function(H){return{action:"addEntry",body:H}});return m(w.transporter.write({method:P,path:y("/1/dictionaries/%s/batch",C),data:{clearExistingDictionaryEntries:!1,requests:I}},_),function(H,W){return ao(w)(H.taskID,W)})}},yr=function(w){return function(C,k,_){return w.transporter.read({method:P,path:y("/1/dictionaries/%s/search",C),data:{query:k},cacheable:!0},_)}},ps=function(w){return function(C,k){return w.transporter.read({method:P,path:"1/clusters/mapping/search",data:{query:C}},k)}},ed=function(w){return function(C,k){return m(w.transporter.write({method:$,path:"/1/dictionaries/*/settings",data:C},k),function(_,I){return ao(w)(_.taskID,I)})}},td=function(w){return function(C,k){var _=Object.assign({},k),I=k||{},H=I.queryParameters,W=i(I,["queryParameters"]),z=H?{queryParameters:H}:{},K=["acl","indexes","referers","restrictSources","queryParameters","description","maxQueriesPerIPPerHour","maxHitsPerQuery"];return m(w.transporter.write({method:$,path:y("1/keys/%s",C),data:z},W),function(te,Y){return g(function(ce){return _e(w)(C,Y).then(function(se){return function(we){return Object.keys(_).filter(function(he){return K.indexOf(he)!==-1}).every(function(he){if(Array.isArray(we[he])&&Array.isArray(_[he])){var Ie=we[he];return Ie.length===_[he].length&&Ie.every(function(Ve,Nt){return Ve===_[he][Nt]})}return we[he]===_[he]})}(se)?Promise.resolve():ce()})})})}},ao=function(w){return function(C,k){return g(function(_){return Qe(w)(C,k).then(function(I){return I.status!=="published"?_():void 0})})}},Ea=function(w){return function(C,k){return m(w.transporter.write({method:P,path:y("1/indexes/%s/batch",w.indexName),data:{requests:C}},k),function(_,I){return Ge(w)(_.taskID,I)})}},nd=function(w){return function(C){return je(a(a({shouldStop:function(k){return k.cursor===void 0}},C),{},{request:function(k){return w.transporter.read({method:P,path:y("1/indexes/%s/browse",w.indexName),data:k},C)}}))}},xa=function(w){return function(C){var k=a({hitsPerPage:1e3},C);return je(a(a({shouldStop:function(_){return _.hits.length<k.hitsPerPage}},k),{},{request:function(_){return R0(w)("",a(a({},k),_)).then(function(I){return a(a({},I),{},{hits:I.hits.map(function(H){return delete H._highlightResult,H})})})}}))}},od=function(w){return function(C){var k=a({hitsPerPage:1e3},C);return je(a(a({shouldStop:function(_){return _.hits.length<k.hitsPerPage}},k),{},{request:function(_){return $0(w)("",a(a({},k),_)).then(function(I){return a(a({},I),{},{hits:I.hits.map(function(H){return delete H._highlightResult,H})})})}}))}},_a=function(w){return function(C,k,_){var I=_||{},H=I.batchSize,W=i(I,["batchSize"]),z={taskIDs:[],objectIDs:[]};return m(function K(){var te,Y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,ce=[];for(te=Y;te<C.length&&(ce.push(C[te]),ce.length!==(H||1e3));te++);return ce.length===0?Promise.resolve(z):Ea(w)(ce.map(function(se){return{action:k,body:se}}),W).then(function(se){return z.objectIDs=z.objectIDs.concat(se.objectIDs),z.taskIDs.push(se.taskID),te++,K(te)})}(),function(K,te){return Promise.all(K.taskIDs.map(function(Y){return Ge(w)(Y,te)}))})}},rd=function(w){return function(C){return m(w.transporter.write({method:P,path:y("1/indexes/%s/clear",w.indexName)},C),function(k,_){return Ge(w)(k.taskID,_)})}},hs=function(w){return function(C){var k=C||{},_=k.forwardToReplicas,I=E(i(k,["forwardToReplicas"]));return _&&(I.queryParameters.forwardToReplicas=1),m(w.transporter.write({method:P,path:y("1/indexes/%s/rules/clear",w.indexName)},I),function(H,W){return Ge(w)(H.taskID,W)})}},ad=function(w){return function(C){var k=C||{},_=k.forwardToReplicas,I=E(i(k,["forwardToReplicas"]));return _&&(I.queryParameters.forwardToReplicas=1),m(w.transporter.write({method:P,path:y("1/indexes/%s/synonyms/clear",w.indexName)},I),function(H,W){return Ge(w)(H.taskID,W)})}},id=function(w){return function(C,k){return m(w.transporter.write({method:P,path:y("1/indexes/%s/deleteByQuery",w.indexName),data:C},k),function(_,I){return Ge(w)(_.taskID,I)})}},sd=function(w){return function(C){return m(w.transporter.write({method:A,path:y("1/indexes/%s",w.indexName)},C),function(k,_){return Ge(w)(k.taskID,_)})}},ld=function(w){return function(C,k){return m(L(w)([C],k).then(function(_){return{taskID:_.taskIDs[0]}}),function(_,I){return Ge(w)(_.taskID,I)})}},L=function(w){return function(C,k){var _=C.map(function(I){return{objectID:I}});return _a(w)(_,wr.DeleteObject,k)}},G=function(w){return function(C,k){var _=k||{},I=_.forwardToReplicas,H=E(i(_,["forwardToReplicas"]));return I&&(H.queryParameters.forwardToReplicas=1),m(w.transporter.write({method:A,path:y("1/indexes/%s/rules/%s",w.indexName,C)},H),function(W,z){return Ge(w)(W.taskID,z)})}},pe=function(w){return function(C,k){var _=k||{},I=_.forwardToReplicas,H=E(i(_,["forwardToReplicas"]));return I&&(H.queryParameters.forwardToReplicas=1),m(w.transporter.write({method:A,path:y("1/indexes/%s/synonyms/%s",w.indexName,C)},H),function(W,z){return Ge(w)(W.taskID,z)})}},Oe=function(w){return function(C){return I0(w)(C).then(function(){return!0}).catch(function(k){if(k.status!==404)throw k;return!1})}},Bn=function(w){return function(C,k,_){return w.transporter.read({method:P,path:y("1/answers/%s/prediction",w.indexName),data:{query:C,queryLanguages:k},cacheable:!0},_)}},io=function(w){return function(C,k){var _=k||{},I=_.query,H=_.paginate,W=i(_,["query","paginate"]),z=0;return function K(){return F0(w)(I||"",a(a({},W),{},{page:z})).then(function(te){for(var Y=0,ce=Object.entries(te.hits);Y<ce.length;Y++){var se=s(ce[Y],2),we=se[0],he=se[1];if(C(he))return{object:he,position:parseInt(we,10),page:z}}if(z++,H===!1||z>=te.nbPages)throw{name:"ObjectNotFoundError",message:"Object not found."};return K()})}()}},br=function(w){return function(C,k){return w.transporter.read({method:V,path:y("1/indexes/%s/%s",w.indexName,C)},k)}},Hn=function(){return function(w,C){for(var k=0,_=Object.entries(w.hits);k<_.length;k++){var I=s(_[k],2),H=I[0];if(I[1].objectID===C)return parseInt(H,10)}return-1}},on=function(w){return function(C,k){var _=k||{},I=_.attributesToRetrieve,H=i(_,["attributesToRetrieve"]),W=C.map(function(z){return a({indexName:w.indexName,objectID:z},I?{attributesToRetrieve:I}:{})});return w.transporter.read({method:P,path:"1/indexes/*/objects",data:{requests:W}},H)}},ms=function(w){return function(C,k){return w.transporter.read({method:V,path:y("1/indexes/%s/rules/%s",w.indexName,C)},k)}},I0=function(w){return function(C){return w.transporter.read({method:V,path:y("1/indexes/%s/settings",w.indexName),data:{getVersion:2}},C)}},R4=function(w){return function(C,k){return w.transporter.read({method:V,path:y("1/indexes/%s/synonyms/%s",w.indexName,C)},k)}},$4=function(w){return function(C,k){return m(A0(w)([C],k).then(function(_){return{objectID:_.objectIDs[0],taskID:_.taskIDs[0]}}),function(_,I){return Ge(w)(_.taskID,I)})}},A0=function(w){return function(C,k){var _=k||{},I=_.createIfNotExists,H=i(_,["createIfNotExists"]),W=I?wr.PartialUpdateObject:wr.PartialUpdateObjectNoCreate;return _a(w)(C,W,H)}},L4=function(w){return function(C,k){var _=k||{},I=_.safe,H=_.autoGenerateObjectIDIfNotExist,W=_.batchSize,z=i(_,["safe","autoGenerateObjectIDIfNotExist","batchSize"]),K=function(he,Ie,Ve,Nt){return m(w.transporter.write({method:P,path:y("1/indexes/%s/operation",he),data:{operation:Ve,destination:Ie}},Nt),function(Ta,It){return Ge(w)(Ta.taskID,It)})},te=Math.random().toString(36).substring(7),Y="".concat(w.indexName,"_tmp_").concat(te),ce=cd({appId:w.appId,transporter:w.transporter,indexName:Y}),se=[],we=K(w.indexName,Y,"copy",a(a({},z),{},{scope:["settings","synonyms","rules"]}));return se.push(we),m((I?we.wait(z):we).then(function(){var he=ce(C,a(a({},z),{},{autoGenerateObjectIDIfNotExist:H,batchSize:W}));return se.push(he),I?he.wait(z):he}).then(function(){var he=K(Y,w.indexName,"move",z);return se.push(he),I?he.wait(z):he}).then(function(){return Promise.all(se)}).then(function(he){var Ie=s(he,3),Ve=Ie[0],Nt=Ie[1],Ta=Ie[2];return{objectIDs:Nt.objectIDs,taskIDs:[Ve.taskID].concat(l(Nt.taskIDs),[Ta.taskID])}}),function(he,Ie){return Promise.all(se.map(function(Ve){return Ve.wait(Ie)}))})}},V4=function(w){return function(C,k){return dd(w)(C,a(a({},k),{},{clearExistingRules:!0}))}},D4=function(w){return function(C,k){return ud(w)(C,a(a({},k),{},{clearExistingSynonyms:!0}))}},M4=function(w){return function(C,k){return m(cd(w)([C],k).then(function(_){return{objectID:_.objectIDs[0],taskID:_.taskIDs[0]}}),function(_,I){return Ge(w)(_.taskID,I)})}},cd=function(w){return function(C,k){var _=k||{},I=_.autoGenerateObjectIDIfNotExist,H=i(_,["autoGenerateObjectIDIfNotExist"]),W=I?wr.AddObject:wr.UpdateObject;if(W===wr.UpdateObject){var z=!0,K=!1,te=void 0;try{for(var Y,ce=C[Symbol.iterator]();!(z=(Y=ce.next()).done);z=!0)if(Y.value.objectID===void 0)return m(Promise.reject({name:"MissingObjectIDError",message:"All objects must have an unique objectID (like a primary key) to be valid. Algolia is also able to generate objectIDs automatically but *it's not recommended*. To do it, use the `{'autoGenerateObjectIDIfNotExist': true}` option."}))}catch(se){K=!0,te=se}finally{try{z||ce.return==null||ce.return()}finally{if(K)throw te}}}return _a(w)(C,W,H)}},j4=function(w){return function(C,k){return dd(w)([C],k)}},dd=function(w){return function(C,k){var _=k||{},I=_.forwardToReplicas,H=_.clearExistingRules,W=E(i(_,["forwardToReplicas","clearExistingRules"]));return I&&(W.queryParameters.forwardToReplicas=1),H&&(W.queryParameters.clearExistingRules=1),m(w.transporter.write({method:P,path:y("1/indexes/%s/rules/batch",w.indexName),data:C},W),function(z,K){return Ge(w)(z.taskID,K)})}},z4=function(w){return function(C,k){return ud(w)([C],k)}},ud=function(w){return function(C,k){var _=k||{},I=_.forwardToReplicas,H=_.clearExistingSynonyms,W=_.replaceExistingSynonyms,z=E(i(_,["forwardToReplicas","clearExistingSynonyms","replaceExistingSynonyms"]));return I&&(z.queryParameters.forwardToReplicas=1),(W||H)&&(z.queryParameters.replaceExistingSynonyms=1),m(w.transporter.write({method:P,path:y("1/indexes/%s/synonyms/batch",w.indexName),data:C},z),function(K,te){return Ge(w)(K.taskID,te)})}},F0=function(w){return function(C,k){return w.transporter.read({method:P,path:y("1/indexes/%s/query",w.indexName),data:{query:C},cacheable:!0},k)}},P0=function(w){return function(C,k,_){return w.transporter.read({method:P,path:y("1/indexes/%s/facets/%s/query",w.indexName,C),data:{facetQuery:k},cacheable:!0},_)}},R0=function(w){return function(C,k){return w.transporter.read({method:P,path:y("1/indexes/%s/rules/search",w.indexName),data:{query:C}},k)}},$0=function(w){return function(C,k){return w.transporter.read({method:P,path:y("1/indexes/%s/synonyms/search",w.indexName),data:{query:C}},k)}},U4=function(w){return function(C,k){var _=k||{},I=_.forwardToReplicas,H=E(i(_,["forwardToReplicas"]));return I&&(H.queryParameters.forwardToReplicas=1),m(w.transporter.write({method:$,path:y("1/indexes/%s/settings",w.indexName),data:C},H),function(W,z){return Ge(w)(W.taskID,z)})}},Ge=function(w){return function(C,k){return g(function(_){return function(I){return function(H,W){return I.transporter.read({method:V,path:y("1/indexes/%s/task/%s",I.indexName,H.toString())},W)}}(w)(C,k).then(function(I){return I.status!=="published"?_():void 0})})}},wr={AddObject:"addObject",UpdateObject:"updateObject",PartialUpdateObject:"partialUpdateObject",PartialUpdateObjectNoCreate:"partialUpdateObjectNoCreate",DeleteObject:"deleteObject",DeleteIndex:"delete",ClearIndex:"clear"},fd={Settings:"settings",Synonyms:"synonyms",Rules:"rules"},H4=1,q4=2,K4=3,gs=function(w){return function(C,k){var _=C.map(function(I){return a(a({},I),{},{threshold:I.threshold||0})});return w.transporter.read({method:P,path:"1/indexes/*/recommendations",data:{requests:_},cacheable:!0},k)}},W4=function(w){return function(C,k){return gs(w)(C.map(function(_){return a(a({},_),{},{fallbackParameters:{},model:"bought-together"})}),k)}},G4=function(w){return function(C,k){return gs(w)(C.map(function(_){return a(a({},_),{},{model:"related-products"})}),k)}},J4=function(w){return function(C,k){var _=C.map(function(I){return a(a({},I),{},{model:"trending-facets",threshold:I.threshold||0})});return w.transporter.read({method:P,path:"1/indexes/*/recommendations",data:{requests:_},cacheable:!0},k)}},Z4=function(w){return function(C,k){var _=C.map(function(I){return a(a({},I),{},{model:"trending-items",threshold:I.threshold||0})});return w.transporter.read({method:P,path:"1/indexes/*/recommendations",data:{requests:_},cacheable:!0},k)}},Y4=function(w){return function(C,k){return gs(w)(C.map(function(_){return a(a({},_),{},{model:"looking-similar"})}),k)}},X4=function(w){return function(C,k){var _=C.map(function(I){return a(a({},I),{},{model:"recommended-for-you",threshold:I.threshold||0})});return w.transporter.read({method:P,path:"1/indexes/*/recommendations",data:{requests:_},cacheable:!0},k)}};function L0(w,C,k){var _,I={appId:w,apiKey:C,timeouts:{connect:1,read:2,write:30},requester:{send:function(z){return new Promise(function(K){var te=new XMLHttpRequest;te.open(z.method,z.url,!0),Object.keys(z.headers).forEach(function(we){return te.setRequestHeader(we,z.headers[we])});var Y,ce=function(we,he){return setTimeout(function(){te.abort(),K({status:0,content:he,isTimedOut:!0})},1e3*we)},se=ce(z.connectTimeout,"Connection timeout");te.onreadystatechange=function(){te.readyState>te.OPENED&&Y===void 0&&(clearTimeout(se),Y=ce(z.responseTimeout,"Socket timeout"))},te.onerror=function(){te.status===0&&(clearTimeout(se),clearTimeout(Y),K({content:te.responseText||"Network request failed",status:te.status,isTimedOut:!1}))},te.onload=function(){clearTimeout(se),clearTimeout(Y),K({content:te.responseText,status:te.status,isTimedOut:!1})},te.send(z.data)})}},logger:(_=K4,{debug:function(z,K){return H4>=_&&console.debug(z,K),Promise.resolve()},info:function(z,K){return q4>=_&&console.info(z,K),Promise.resolve()},error:function(z,K){return console.error(z,K),Promise.resolve()}}),responsesCache:u(),requestsCache:u({serializable:!1}),hostsCache:d({caches:[c({key:"".concat("4.23.2","-").concat(w)}),u()]}),userAgent:N("4.23.2").add({segment:"Browser"})},H=a(a({},I),k),W=function(){return function(z){return function(K){var te=K.region||"us",Y=p(b.WithinHeaders,K.appId,K.apiKey),ce=q(a(a({hosts:[{url:"personalization.".concat(te,".algolia.com")}]},K),{},{headers:a(a(a({},Y.headers()),{"content-type":"application/json"}),K.headers),queryParameters:a(a({},Y.queryParameters()),K.queryParameters)}));return h({appId:K.appId,transporter:ce},K.methods)}(a(a(a({},I),z),{},{methods:{getPersonalizationStrategy:Ee,setPersonalizationStrategy:Fe}}))}};return function(z){var K=z.appId,te=p(z.authMode!==void 0?z.authMode:b.WithinHeaders,K,z.apiKey),Y=q(a(a({hosts:[{url:"".concat(K,"-dsn.algolia.net"),accept:O.Read},{url:"".concat(K,".algolia.net"),accept:O.Write}].concat(f([{url:"".concat(K,"-1.algolianet.com")},{url:"".concat(K,"-2.algolianet.com")},{url:"".concat(K,"-3.algolianet.com")}]))},z),{},{headers:a(a(a({},te.headers()),{"content-type":"application/x-www-form-urlencoded"}),z.headers),queryParameters:a(a({},te.queryParameters()),z.queryParameters)}));return h({transporter:Y,appId:K,addAlgoliaAgent:function(ce,se){Y.userAgent.add({segment:ce,version:se})},clearCache:function(){return Promise.all([Y.requestsCache.clear(),Y.responsesCache.clear()]).then(function(){})}},z.methods)}(a(a({},H),{},{methods:{search:X,searchForFacetValues:Q,multipleBatch:Ro,multipleGetObjects:M,multipleQueries:X,copyIndex:He,copySettings:Tt,copySynonyms:Ze,copyRules:_t,moveIndex:Po,listIndices:gr,getLogs:Dt,listClusters:Mt,multipleSearchForFacetValues:Q,getApiKey:_e,addApiKey:tn,listApiKeys:gt,updateApiKey:td,deleteApiKey:dt,restoreApiKey:Bt,assignUserID:ct,assignUserIDs:Xe,getUserID:U,searchUserIDs:ps,listUserIDs:Sa,getTopUserIDs:et,removeUserID:Te,hasPendingMappings:me,clearDictionaryEntries:Re,deleteDictionaryEntries:nn,getDictionarySettings:mt,getAppTask:Qe,replaceDictionaryEntries:jt,saveDictionaryEntries:zt,searchDictionaryEntries:yr,setDictionarySettings:ed,waitAppTask:ao,customRequest:Ot,initIndex:function(z){return function(K){return Le(z)(K,{methods:{batch:Ea,delete:sd,findAnswers:Bn,getObject:br,getObjects:on,saveObject:M4,saveObjects:cd,search:F0,searchForFacetValues:P0,waitTask:Ge,setSettings:U4,getSettings:I0,partialUpdateObject:$4,partialUpdateObjects:A0,deleteObject:ld,deleteObjects:L,deleteBy:id,clearObjects:rd,browseObjects:nd,getObjectPosition:Hn,findObject:io,exists:Oe,saveSynonym:z4,saveSynonyms:ud,getSynonym:R4,searchSynonyms:$0,browseSynonyms:od,deleteSynonym:pe,clearSynonyms:ad,replaceAllObjects:L4,replaceAllSynonyms:D4,searchRules:R0,getRule:ms,deleteRule:G,saveRule:j4,saveRules:dd,replaceAllRules:V4,browseRules:xa,clearRules:hs}})}},initAnalytics:function(){return function(z){return function(K){var te=K.region||"us",Y=p(b.WithinHeaders,K.appId,K.apiKey),ce=q(a(a({hosts:[{url:"analytics.".concat(te,".algolia.com")}]},K),{},{headers:a(a(a({},Y.headers()),{"content-type":"application/json"}),K.headers),queryParameters:a(a({},Y.queryParameters()),K.queryParameters)}));return h({appId:K.appId,transporter:ce},K.methods)}(a(a(a({},I),z),{},{methods:{addABTest:le,getABTest:Pe,getABTests:xe,stopABTest:ye,deleteABTest:Se}}))}},initPersonalization:W,initRecommendation:function(){return function(z){return H.logger.info("The `initRecommendation` method is deprecated. Use `initPersonalization` instead."),W()(z)}},getRecommendations:gs,getFrequentlyBoughtTogether:W4,getLookingSimilar:Y4,getRecommendedForYou:X4,getRelatedProducts:G4,getTrendingFacets:J4,getTrendingItems:Z4}}))}return L0.version="4.23.2",L0})})(w0);var l8=w0.exports;const c8=ZE(l8),C0=(e,t)=>{const o={};return e.forEach(r=>{const a=r.split(".");if(a.length!==t)return;const i=r.substring(0,r.lastIndexOf(".")),s=a[a.length-1];Object.keys(o).includes(i)?o[i].push(s):o[i]=[s]}),o};class v0{constructor(t,o,r="https://api.pennsieve.io"){this.client=c8(t,o),this.PENNSIEVE_API_LOCATION=r}initIndex(t){this.index=this.client.initIndex(t)}getAlgoliaFacets(t){const o=t.map(i=>i.facetPropPath),r=t.map(i=>i.facetSubpropPath),a=t.map(i=>i.facetSubsubpropPath).filter(i=>i!==void 0);return this.index.search("",{sortFacetValuesBy:"alpha",facets:o.concat(r).concat(a)}).then(i=>{let s=[],l=0;return o.map(c=>{const d=t.find(b=>b.facetPropPath==c);var u=[];const p=i.facets;if(p===void 0)return;const g=p[c]==null?{}:p[c],m=d&&p[d.facetSubpropPath]?Object.keys(p[d.facetSubpropPath]):[],f=d&&d.facetSubsubpropPath&&p[d.facetSubsubpropPath]?Object.keys(p[d.facetSubsubpropPath]):[],h=C0(m,2),y=C0(f,3);Object.keys(g).map(b=>{const E=[];Object.keys(h).includes(b)&&h[b].forEach(v=>{const S=`${b}.${v}`,x=[];Object.keys(y).includes(S)&&(y[S].forEach(T=>{x.push({label:T,id:l++,facetPropPath:`${d?d.facetSubsubpropPath:void 0}`})}),S==="nerves and ganglia.dorsal root ganglion"&&x.push({label:"Non specific",id:l++,facetPropPath:`${d?d.facetSubsubpropPath:void 0}`})),E.push({label:v,id:l++,facetPropPath:`${d?d.facetSubpropPath:void 0}`,children:x.length?x:void 0})});let O={label:b,id:l++,facetPropPath:c};E.length>0&&(O.children=E),u.push(O)}),u.length>0&&s.push({label:d?d.label:"",id:l++,children:u,key:c})}),s})}_discoverAllDois(t,o="https://api.pennsieve.io"){return new Promise(r=>{fetch(`${o}/discover/datasets/${t}/versions`).then(a=>a.json()).then(a=>{r(a.map(i=>i.doi))})})}_expandDois(t,o="https://api.pennsieve.io"){return new Promise(r=>{let a=t.map(i=>this._discoverAllDois(i,o));Promise.all(a).then(i=>{r(i.flat())})})}_processResultsForCards(t){let o=[],r={};for(let a of t)r={...a},r={anatomy:a.anatomy?a.anatomy.organ.map(i=>i.curie):void 0,doi:a.item.curie.split(":")[1],name:a.item.name,description:a.item.description,updated:a.pennsieve?a.pennsieve.updatedAt:void 0,publishDate:a.pennsieve?a.pennsieve.publishDate:void 0,datasetId:a.objectID,detailsReady:!1},o.push(r);return o}_processAnatomy(t){const o={};t.forEach(r=>{r.anatomy&&r.anatomy.organ&&r.anatomy.organ.forEach(a=>{a.curie&&(o[a.curie]=a.name)}),localStorage.setItem("available-name-curie-mapping",JSON.stringify(o))})}_processUberonURL(t){return t.split("/").pop().replace("_",":")}search(t,o="",r=10,a=1){return new Promise(i=>{this.index.search(o,{facets:["*"],hitsPerPage:r,page:a-1,filters:t,attributesToHighlight:[],attributesToRetrieve:["pennsieve.publishDate","pennsieve.updatedAt","item.curie","item.name","item.description","objectID","anatomy.organ.curie"]}).then(s=>{let l={items:this._processResultsForCards(s.hits),total:s.nbHits,discoverIds:s.hits.map(c=>c.pennsieve?c.pennsieve.identifier:c.objectID),dois:s.hits.map(c=>c.item.curie.split(":")[1])};i(l)})})}anatomyInSearch(t,o="",r=999999,a=1){return new Promise(i=>{this.index.search(o,{facets:["*"],hitsPerPage:r,page:a-1,filters:t,attributesToHighlight:[],attributesToRetrieve:["objectID","item.keywords.keyword","anatomy.organ.name","anatomy.organ.curie","anatomy.organ.subsubcategory.name"]}).then(s=>{i({forFlatmap:this.processResultsForFlatmap(s.facets,s.hits),forScaffold:this.processResultsForScaffold(s.hits)})})})}setLocalStorageForTermMapping(){return new Promise(t=>{this.index.search("",{facets:["*"],hitsPerPage:999999,page:0,attributesToHighlight:[],attributesToRetrieve:["objectID","item.keywords.keyword","anatomy.organ.name","anatomy.organ.curie"]}).then(o=>{this._processAnatomy(o.hits)})})}processResultsForFlatmap(t,o){const r=this.filterAvailableAnatomies(t);return o.map(i=>({id:i.objectID,terms:i.anatomy?i.anatomy.organ.map(l=>{if(r.includes(l.name.toLowerCase()))return l.curie}).filter(Boolean):[]}))}filterAvailableAnatomies(t){const o=t["anatomy.organ.name"],r=t["anatomy.organ.category.name"],a=t["anatomy.organ.subcategory.name"],i=t["anatomy.organ.subsubcategory.name"],s=o?Object.keys(o):[],l=r?Object.keys(r):[],c=a?Object.keys(a):[],d=i?Object.keys(i):[],u=[];return l.forEach(p=>{const g=p.toLowerCase();s.forEach(m=>{const f=m.toLowerCase(),h=`${g}.${f}`;c.some(b=>{const E=b.toLowerCase();return E===h?!0:d.find(O=>`${E}.${f}`===O)})&&u.push(f)})}),u}processResultsForScaffold(t){let o={};return t.forEach(r=>{r.anatomy&&r.anatomy.organ&&r.anatomy.organ.forEach(a=>{a.name&&(o[a.name]?o[a.name]++:o[a.name]=1)})}),o}}const Qc=[{label:"Data Type",id:"item.types",facetPropPath:"item.types.name",facetSubpropPath:"item.types.subcategory.name"},{label:"Anatomical Structure",id:"anatomy.organ.category",facetPropPath:"anatomy.organ.category.name",facetSubpropPath:"anatomy.organ.subcategory.name",facetSubsubpropPath:"anatomy.organ.subsubcategory.name",facetFilterPath:"anatomy.organ.name"},{label:"Species",id:"organisms.primary.species",facetPropPath:"organisms.primary.species.name",facetSubpropPath:"organisms.primary.species.subcategory.name"},{label:"Experimental Approach",id:"item.modalities",facetPropPath:"item.modalities.keyword",facetSubpropPath:"item.modalities.subcategory.name"},{label:"Sex",id:"attributes.subject.sex",facetPropPath:"attributes.subject.sex.value",facetSubpropPath:"attributes.subject.sex.subcategory.name"},{label:"Age Categories",id:"attributes.subject.ageCategory",facetPropPath:"attributes.subject.ageCategory.value",facetSubpropPath:"attributes.subject.ageCategory.subcategory.name"},{label:"Consortia",id:"supportingAwards.consortium",facetPropPath:"supportingAwards.consortium.name",facetSubpropPath:"supportingAwards.consortium.subcategory.name"}];function k0(e=void 0){if(e===void 0)return"NOT item.published.status:embargo";e.forEach(a=>{a.label=a.facet3?a.facet3:a.facet2?a.facet2:a.facet});let t=S0(e);t.forEach(a=>{a.facet3&&a.facet3==="Non specific"&&(a.label=a.facet2)});let o="NOT item.published.status:embargo";return o=`(${o}) AND `,Qc.map(a=>[a.facetPropPath,a.facetFilterPath]).map(([a,i])=>{let s=t.filter(d=>d.facetPropPath==a),l="",c="";s.map(d=>{let u=d.facetSubPropPath?d.facetSubPropPath:i||a;d.AND?c+=`AND "${u}":"${d.label}"`:l+=`"${u}":"${d.label}" OR `}),!(l==""&&c=="")&&(l=`(${l.substring(0,l.lastIndexOf(" OR "))})`,o+=`${l+c} AND `,o=o.split("()AND ").join(""))}),o.substring(0,o.lastIndexOf(" AND "))}function S0(e){return e.filter(t=>t.label!=="Show all")}const va=function(e){return e.charAt(0).toUpperCase()+e.slice(1)},E0=function(e){const t=e.toLowerCase();return ds[t]?va(ds[t]):e===e.toUpperCase()?e:va(t)},d8={name:"SearchFilters",components:{MapSvgIcon:$y,MapSvgSpriteColor:b0,Option:Fl,Select:fi,Popover:Kr,Cascader:Tp},props:{entry:Object,envVars:{type:Object,default:()=>{}}},data:function(){return{algoliaClient:void 0,cascaderIsReady:!1,previousShowAllChecked:{species:!1,gender:!1,organ:!1,datasets:!1},showFiltersText:!0,cascadeSelected:[],cascadeSelectedWithBoolean:[],filterTimeout:null,numberShown:10,filters:[],facets:["Species","Gender","Organ","Datasets"],numberDatasetsShown:["10","20","50"],cascaderProps:{multiple:!0},options:[{value:"Species",label:"Species",children:[{}]}],presentTags:[],searchInputs:{}}},setup(){const e=n.markRaw({}),t=n.markRaw({term:new Set,facet:new Set,facet2:new Set,facet3:new Set});return{cascaderTags:e,correctnessCheck:t}},computed:{numberOfResultsText:function(){return`${this.entry.numberOfHits} results | Showing`},showFilters:function(){return this.entry.showFilters}},watch:{entry:{deep:!0,immediate:!0,handler:function(e,t){JSON.stringify(e==null?void 0:e.options)!==JSON.stringify(t==null?void 0:t.options)&&(this.options=[],this.filters=[],this.cascaderIsReady=!1,this.populateCascader().then(()=>{this.cascaderIsReady=!0,this.options.length&&(this.checkShowAllBoxes(),this.cssMods(),this.$emit("cascaderReady"))}))}}},methods:{createCascaderItemValue:function(e){let t;if(e!=null&&e.length){t=e[0];for(let o=1;e.length>o;o++)t=`${t}>${e[o]}`;t.includes("undefined")&&console.warn("Warning: One or more of the facets is undefined, this will not be shown in the cascader")}return t},createChildrenCascaderValue:function(e,t,o){if(e!=null&&e.length)for(let r=0;r<e.length;r++){const a=e[r];if(e[r].facetPropPath!=="supportingAwards.consortium.name"&&(e[r].label=E0(a.label)),a.key&&t.key.includes("flatmap.connectivity.source.")){const i=a.key,s=t.key,l=i.replace(`${s}.`,"");e[r].value=this.createCascaderItemValue([t.label,l])}else{const i=o.slice();i.push(a.label),e[r].value=this.createCascaderItemValue(i),this.createChildrenCascaderValue(a.children,t,i)}}},getNodeKey:function(e){return e?e.split(">")[1]:""},isFlatmapConnectionsNode:function(e){return e.pathValues[0].includes("flatmap.connectivity.source")&&e.isLeaf},isFlatmapConnectionsFilterNode:function(e){return e.pathValues[0].includes("flatmap.connectivity.source")&&e.pathLabels.includes("Filters")&&e.isDisabled&&e.isLeaf},processOptions:function(){const e=JSON.parse(JSON.stringify(this.options));e.forEach((t,o)=>{e[o].total=this.countTotalFacet(t),e[o].label=E0(t.label),e[o].value=this.createCascaderItemValue([t.key]),e[o].children.find(r=>r.label==="Show all")||e[o].children.unshift({value:this.createCascaderItemValue(["Show all"]),label:"Show all"}),t.key.includes("flatmap.connectivity.source")&&e[o].children.unshift({value:this.createCascaderItemValue(["ConnectivityFilters"]),label:"Filters",disabled:!0}),this.createChildrenCascaderValue(e[o].children,t,[t.label])}),this.options=e},populateCascader:function(){return this.entry.options?new Promise(e=>{this.facets=this.entry.options,this.options=this.entry.options,this.processOptions(),e()}):new Promise(e=>{this.algoliaClient.getAlgoliaFacets(Qc).then(t=>{this.facets=t,fe.emit("available-facets",t),this.options=t,this.processOptions()}).finally(()=>{e()})})},isConnectivityTag:function(e){return/^[A-Za-z]:/.test(e)},getConnectivityTag:function(e){const t=e.indexOf(":");return t!==-1?e.substring(t+1):e},modifyCascaderTagStyle:function(e){return this.isConnectivityTag(e)?"connectivity-tag":""},flattenToEvents:function(e,t,o,r=void 0){const a=[];for(const[i,s]of Object.entries(t)){const l=o.find(c=>c.label===i);if(Object.entries(s).length){const c=l.key||r,d=this.flattenToEvents(e,s,l.children,c);a.push(...d)}else i!==e&&a.push([r,l.value])}return a},cascadeTagClose:function(e){const t=this.isConnectivityTag(e)?this.getConnectivityTag(e):e,o=this.flattenToEvents(t,this.cascaderTags,this.options);this.cascadeEvent(o)},flattenToTags:function(e){const t=[];for(const[o,r]of Object.entries(e))if(Object.entries(r).length){const a=this.flattenToTags(r);t.push(...a)}else o!=="Show all"&&t.push(o);return t},tagsChangedCallback:function(e){this.correctnessCheck.term&&this.correctnessCheck.facet&&this.correctnessCheck.facet2&&this.correctnessCheck.facet3&&this.options.map(t=>{var o;this.correctnessCheck.term.add(t.label),(o=t.children)==null||o.map(r=>{var a;this.correctnessCheck.facet.add(r.label),(a=r.children)==null||a.map(i=>{var s;this.correctnessCheck.facet2.add(i.label),(s=i.children)==null||s.map(l=>{this.correctnessCheck.facet3.add(l.label)})})})}),this.cascaderTags={},this.cascaderTagsClone={},this.presentTags=[],e.map(t=>{const{facet:o,facet2:r,facet3:a,term:i,tagLabel:s,facetPropPath:l}=t;let c=o,d="";l&&l.includes("flatmap.connectivity.source.")&&s&&(c=s,d=i.charAt(0)),i&&this.correctnessCheck.term.has(i)&&(i in this.cascaderTags||(this.cascaderTags[i]={},this.cascaderTagsClone[i]={}),c&&this.correctnessCheck.facet.has(c)&&(c in this.cascaderTags[i]||(this.cascaderTags[i][c]={},d?this.cascaderTagsClone[i][d+":"+c]={}:this.cascaderTagsClone[i][c]={}),r&&this.correctnessCheck.facet2.has(r)&&(r in this.cascaderTags[i][c]||(this.cascaderTags[i][c][r]={},this.cascaderTagsClone[i][c][r]={}),a&&this.correctnessCheck.facet3.has(a)&&(a in this.cascaderTags[i][c][r]||(this.cascaderTags[i][c][r][a]={},this.cascaderTagsClone[i][c][r][a]={})))))}),this.presentTags=[...this.presentTags,...this.flattenToTags(this.cascaderTagsClone)],this.presentTags=[...new Set(this.presentTags)].sort(),this.presentTags.length>0?this.showFiltersText=!1:this.showFiltersText=!0},countTotalFacet:function(e){return["anatomy.organ.category.name"].includes(e.key)?e.children.reduce((o,r)=>(o=typeof o=="number"?o:o.children.length,o+r.children.length)):e.children.length},showAllEventModifierForAutoCheckAll:function(e){const t={};return e.map(o=>{const r=o[0];r in t?t[r]+=1:t[r]=1}),this.options.map(o=>{const r=o.key,a=o.children.filter(s=>s.label==="Show all")[0].value,i=o.total;t[r]===i&&(e=e.filter(s=>s[0]!==o.key),delete t[r]),r in t||e.unshift([r,a])}),e},cascadeEvent:function(e){let t=[...e];if(t){t=this.showAllEventModifier(t),t=this.showAllEventModifierForAutoCheckAll(t);const o=this.$refs.cascader,a=(o==null?void 0:o.getCheckedNodes(!0)).filter(l=>l.checked&&l.label!=="Show all");if(this.__expandItem__){let l=0;this.__expandItem__.length>1&&(l=1);const c=t.filter(u=>u[l]==this.__expandItem__[l]),d=t.filter(u=>u[l]!==this.__expandItem__[l]);t=[...c,...d]}let i=t.filter(l=>l!==void 0).map(l=>{let{hString:c,bString:d}=this.findHierarachyStringAndBooleanString(l),{facet:u,facet2:p,facet3:g,term:m}=this.getFacetsFromHierarchyString(c);const f=a.find(y=>l.join()===y.pathValues.join()),h=f?f.label:void 0;return{facetPropPath:l[0],facet:u,facet2:p,facet3:g,term:m,AND:d,tagLabel:h}}),s=t.filter(l=>l!==void 0).map(l=>{let c=l[0].includes("duplicate")?l[0].split("duplicate")[0]:l[0],{hString:d,bString:u}=this.findHierarachyStringAndBooleanString(l),{facet:p,facet2:g,facet3:m,term:f}=this.getFacetsFromHierarchyString(d);m?m==="Non specific"?p=g:p=m:g&&(p=g);const h=a.find(b=>l.join()===b.pathValues.join()),y=h?h.label:void 0;return{facetPropPath:c,facet:p,term:f,AND:u,tagLabel:y}});this.filterTimeout&&clearTimeout(this.filterTimeout),this.$emit("loading",!0),this.setCascader(i),this.filterTimeout=setTimeout(()=>{this.$emit("filterResults",s),this.cssMods()},600)}},findHierarachyStringAndBooleanString(e){let t,o;const r=e.length;return r>=3?e[r-1]&&(typeof e[r-1]=="string"||e[r-1]instanceof String)&&e[r-1].split(">").length>2?t=e[r-1]:t=e[r-2]:t=e[1],r>=3&&typeof e[r-1]=="boolean"&&(o=e[r-1]),{hString:t,bString:o}},getFacetsFromHierarchyString(e){let t=e.split(">");return{term:t[0],facet:t[1],facet2:t[2],facet3:t[3]}},showAllEventModifier:function(e){if(e.map(o=>o?o[1].toLowerCase().includes("show all"):!1).includes(!0)){let o=[],r={};for(const a in e)r[e[a][0]]===void 0&&(r[e[a][0]]=[]),r[e[a][0]].push(e[a]);for(const a in r){let i;for(let s=r[a].length-1;s>=0;s--)if(r[a][s][1].toLowerCase().includes("show all")){i=r[a].splice(s,1)[0];break}i?this.previousShowAllChecked[a]&&r[a].length>0?o.push(...r[a]):o.push(i):o.push(...r[a])}return o.sort((a,i)=>this.__expandItem__?a[0]==this.__expandItem__?i[0]==this.__expandItem__?0:-1:i[0]==this.__expandItem__?a[0]==this.__expandItem__?0:1:0:0)}return e},cascadeExpandChange:function(e){this.__expandItem__=e,this.__expandItem__&&this.updateListFilters(this.__expandItem__[0]),this.updateListStyleOrder(),this.cssMods()},updateListStyleOrder:function(){this.$nextTick(()=>{const e=this.$refs.cascader,t=e==null?void 0:e.contentRef;if(t){const o=t.querySelectorAll(".el-cascader-menu__list");o&&o.forEach(r=>{r.querySelector(".sidebar-cascader-search")?r.classList.add("cascader-menu-with-search"):r.classList.remove("cascader-menu-with-search")})}})},searchInputChange:function(e,t){e.preventDefault();const{target:o}=e;if(o){const r=o.value,a=t.pathValues[0];this.searchInputs[a]=r,this.updateListFilters(a)}},searchInputFocusToggle:function(e,t){const{target:o}=e;if(!o)return;const r=o.closest(".el-input__wrapper");t===!0?r.classList.add("is-focus"):r.classList.remove("is-focus")},updateListFilters:function(e){const t=this.searchInputs[e]||"";this.$nextTick(()=>{const o=this.$refs["searchInput_"+e];if(!o)return;o.closest(".el-cascader-menu__list").querySelectorAll(".el-cascader-node").forEach((a,i)=>{i>1&&(a.querySelector(".el-cascader-node__label").textContent.toLowerCase().includes(t.toLowerCase())?a.classList.remove("hide"):a.classList.add("hide"))}),t&&o.focus()})},numberShownChanged:function(e){this.$emit("numberPerPage",parseInt(e))},updatePreviousShowAllChecked:function(e){for(const t in this.previousShowAllChecked)this.previousShowAllChecked[t]=!1;e.forEach(t=>{t[1].toLowerCase().includes("show all")&&(this.previousShowAllChecked[t[0]]=!0)})},setCascader:function(e){if(this.cascaderIsReady&&e&&e.length!=0){const t=o=>{let r=[o.facetPropPath,this.createCascaderItemValue([va(o.term),o.facet])];return o.facet2&&(r.push(this.createCascaderItemValue([va(o.term),o.facet,o.facet2])),o.facet3&&r.push(this.createCascaderItemValue([va(o.term),o.facet,o.facet2,o.facet3]))),r};this.cascadeSelected=e.map(o=>t(o)),this.cascadeSelectedWithBoolean=e.map(o=>{let r=t(o);return r.push(o.AND),r}),this.updatePreviousShowAllChecked(this.cascadeSelected)}this.tagsChangedCallback(e)},addFilter:function(e){if(this.cascaderIsReady&&e){let t=this.validateAndConvertFilterToHierarchical(e);if(t&&t.length)return t.forEach(o=>{this.cascadeSelected.filter(a=>a.term!=o.term);const r=[o.facetPropPath,this.createCascaderItemValue([o.term,o.facet]),this.createCascaderItemValue([o.term,o.facet,o.facet2])];o.facet3&&r.push(this.createCascaderItemValue([o.term,o.facet,o.facet2,o.facet3])),this.cascadeSelected.push([...r]),this.cascadeSelectedWithBoolean.push([...r,o.AND])}),!0}},addFilters:function(e){let t=!1;return this.cascaderIsReady&&e.forEach(o=>{t=t||this.addFilter(o)}),t},initiateSearch:function(){this.cascadeEvent(this.cascadeSelectedWithBoolean)},checkShowAllBoxes:function(){this.setCascader(this.options.map(e=>({facetPropPath:e.value,term:e.label,facet:"Show all"})))},makeCascadeLabelsClickable:function(){this.$nextTick(()=>{document.querySelectorAll(".sidebar-cascader-popper .el-cascader-node__label").forEach(e=>{e.onclick=function(){const t=this.previousElementSibling;t&&(t.parentElement.attributes["aria-owns"]||this.previousElementSibling.click())}})})},cssMods:function(){this.makeCascadeLabelsClickable()},flattenToFilters:function(e,t,o=!1){let r=[];if(t){const a=e.facet.toLowerCase();let i=!1;for(const s of t){const l=e.facetPropPath.includes("flatmap.connectivity.source.")&&s.key,c=l?s.key.replace(`${e.facetPropPath}.`,"").toLowerCase()===a:s.label.toLowerCase()===a;if(s.children&&s.children.length){const d=c||o,u=this.flattenToFilters(e,s.children,d);r.push(...u)}else if(s.facetPropPath||s.key){const[d,u,p,g]=s.value.split(">");g==="Non specific"&&(i=!0);const m={term:d,facet:u,facetPropPath:e.facetPropPath,...p&&{facet2:p},...g&&{facet3:g}};"AND"in e&&(m.AND=e.AND),(o||c)&&(l?r.push(e):r.push(m))}}o&&i&&(r=r.filter(s=>!s.facet3||s.facet3==="Non specific"))}return r},validateAndConvertFilterToHierarchical:function(e){if(e&&e.facet&&e.term){if(e.facet2||e.facet3)return[e];{const t=this.options.find(o=>o.label===e.term);if(t)return this.flattenToFilters(e,t.children)}}},getHierarchicalValidatedFilters:function(e){const t=[],o=[],r=[];if(e){if(!this.cascaderIsReady)return{result:e,notFound:r};e.forEach(a=>{const i=this.validateAndConvertFilterToHierarchical(a);i&&i.length?i.forEach(s=>{t.push(s),o.push(s.term)}):this.options.find(l=>l.key===a.facetPropPath)&&r.push(a)}),this.options.forEach(a=>{o.includes(a.label)||t.push({facet:"Show all",facetPropPath:a.key,label:"Show all",term:a.label})})}return{result:t,notFound:r}},hasLineStyles:function(e){return"colour"in e&&e.colourStyle==="line"},getLineStyles:function(e){return"colour"in e&&e.colourStyle==="line"?"dashed"in e&&e.dashed===!0?{background:`repeating-linear-gradient(90deg,${e.colour},${e.colour} 6px,transparent 0,transparent 9px)`}:{background:e.colour}:{display:"None"}},getBackgroundStyles:function(e){return"colour"in e&&e.colourStyle==="background"?{background:e.colour}:{}}},mounted:function(){this.entry.options||(this.algoliaClient=n.markRaw(new v0(this.envVars.ALGOLIA_ID,this.envVars.ALGOLIA_KEY,this.envVars.PENNSIEVE_API_LOCATION)),this.algoliaClient.initIndex(this.envVars.ALGOLIA_INDEX),this.algoliaClient.setLocalStorageForTermMapping()),this.populateCascader().then(()=>{this.cascaderIsReady=!0,this.checkShowAllBoxes(),this.setCascader(this.entry.filterFacets),this.cssMods(),this.$emit("cascaderReady")})}},u8={class:"filters"},f8={key:0},p8={key:0,class:"cascader-tag"},h8={class:"el-tags-container"},m8={class:"el-tags-container"},g8={class:"search-filters transition-box"},y8={key:0},b8={class:"sidebar-cascader-search el-input"},w8={class:"el-input__wrapper"},C8=["value","onInput"],v8={key:1},k8={key:0,class:"sr-only"},S8={key:0,class:"filter-default-value"},E8={class:"dataset-shown"},x8={class:"dataset-results-feedback"};function _8(e,t,o,r,a,i){const s=n.resolveComponent("MapSvgSpriteColor"),l=bo,c=Kr,d=Tl,u=_l,p=Tp,g=n.resolveComponent("MapSvgIcon"),m=Fl,f=fi,h=Yo;return n.openBlock(),n.createElementBlock("div",u8,[n.createVNode(s),i.showFilters&&e.options.length>0?(n.openBlock(),n.createElementBlock("div",f8,[e.presentTags.length>0?(n.openBlock(),n.createElementBlock("div",p8,[n.createVNode(l,{class:"ml-2",type:"info",closable:"",onClose:t[0]||(t[0]=y=>i.cascadeTagClose(e.presentTags[0]))},{default:n.withCtx(()=>[n.createElementVNode("span",{class:n.normalizeClass(["tag-text",i.modifyCascaderTagStyle(e.presentTags[0])])},n.toDisplayString(e.presentTags[0]),3)]),_:1}),e.presentTags.length>1?(n.openBlock(),n.createBlock(c,{key:0,placement:"bottom-start",width:250,trigger:"hover","popper-class":"cascade-tags-popover"},{default:n.withCtx(()=>[n.createElementVNode("div",h8,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.presentTags.slice(1),(y,b)=>(n.openBlock(),n.createBlock(l,{key:b,class:n.normalizeClass(["ml-2",i.modifyCascaderTagStyle(y)]),type:"info",closable:"",onClose:E=>i.cascadeTagClose(y)},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(y),1)]),_:2},1032,["class","onClose"]))),128))])]),reference:n.withCtx(()=>[n.createElementVNode("div",m8,[e.presentTags.length>1?(n.openBlock(),n.createBlock(l,{key:0,class:"ml-2",type:"info"},{default:n.withCtx(()=>[n.createTextVNode(" +"+n.toDisplayString(e.presentTags.length-1),1)]),_:1})):n.createCommentVNode("",!0)])]),_:1})):n.createCommentVNode("",!0)])):n.createCommentVNode("",!0),n.createVNode(n.Transition,{name:"el-zoom-in-top"},{default:n.withCtx(()=>[n.withDirectives((n.openBlock(),n.createElementBlock("span",g8,[n.createVNode(p,{class:"cascader",ref:"cascader",modelValue:e.cascadeSelected,"onUpdate:modelValue":t[3]||(t[3]=y=>e.cascadeSelected=y),size:"large",placeholder:" ","collapse-tags":!0,"collapse-tags-tooltip":"",options:e.options,props:e.cascaderProps,onChange:t[4]||(t[4]=y=>i.cascadeEvent(y)),onExpandChange:i.cascadeExpandChange,"show-all-levels":!0,"popper-class":"sidebar-cascader-popper"},{default:n.withCtx(({node:y,data:b})=>[i.isFlatmapConnectionsFilterNode(y)?(n.openBlock(),n.createElementBlock("div",y8,[n.createElementVNode("div",b8,[n.createElementVNode("div",w8,[n.createElementVNode("input",{class:"el-input__inner",ref:"searchInput_"+y.pathValues[0],value:e.searchInputs[y.pathValues[0]],onInput:E=>i.searchInputChange(E,y),onFocus:t[1]||(t[1]=E=>i.searchInputFocusToggle(E,!0)),onBlur:t[2]||(t[2]=E=>i.searchInputFocusToggle(E,!1)),style:{width:"100%"},autocomplete:"off",placeholder:"Search"},null,40,C8)])])])):(n.openBlock(),n.createElementBlock("div",v8,[n.createVNode(u,null,{default:n.withCtx(()=>[i.hasLineStyles(b)?(n.openBlock(),n.createBlock(d,{key:0,span:4},{default:n.withCtx(()=>[n.createElementVNode("div",{class:"path-visual",style:n.normalizeStyle(i.getLineStyles(b))},null,4)]),_:2},1024)):n.createCommentVNode("",!0),n.createVNode(d,{span:20},{default:n.withCtx(()=>[i.isFlatmapConnectionsNode(y)?(n.openBlock(),n.createElementBlock("span",k8,n.toDisplayString(i.getNodeKey(y.value)),1)):n.createCommentVNode("",!0),n.createElementVNode("div",{style:n.normalizeStyle(i.getBackgroundStyles(b))},n.toDisplayString(b.label),5)]),_:2},1024)]),_:2},1024)]))]),_:1},8,["modelValue","options","props","onExpandChange"]),e.showFiltersText?(n.openBlock(),n.createElementBlock("div",S8,"Filters")):n.createCommentVNode("",!0),n.createVNode(c,{title:"How do filters work?",width:"250",trigger:"hover","popper-class":"filter-help-popover"},{reference:n.withCtx(()=>[n.createVNode(g,{icon:"help",class:"help"})]),default:n.withCtx(()=>[n.createElementVNode("div",null,[t[7]||(t[7]=n.createElementVNode("strong",null,"Within categories:",-1)),t[8]||(t[8]=n.createTextVNode(" OR ")),t[9]||(t[9]=n.createElementVNode("br",null,null,-1)),n.createTextVNode(" example: "+n.toDisplayString(o.entry.helper.within)+" ",1),t[10]||(t[10]=n.createElementVNode("br",null,null,-1)),t[11]||(t[11]=n.createElementVNode("br",null,null,-1)),t[12]||(t[12]=n.createElementVNode("strong",null,"Between categories:",-1)),t[13]||(t[13]=n.createTextVNode(" AND ")),t[14]||(t[14]=n.createElementVNode("br",null,null,-1)),n.createTextVNode(" example: "+n.toDisplayString(o.entry.helper.between),1)])]),_:1})])),[[h,!e.cascaderIsReady]])]),_:1})])):n.createCommentVNode("",!0),n.createElementVNode("div",E8,[n.createElementVNode("span",x8,n.toDisplayString(i.numberOfResultsText),1),n.createVNode(f,{class:"number-shown-select",modelValue:e.numberShown,"onUpdate:modelValue":t[5]||(t[5]=y=>e.numberShown=y),placeholder:"10",onChange:t[6]||(t[6]=y=>i.numberShownChanged(y))},{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.numberDatasetsShown,y=>(n.openBlock(),n.createBlock(m,{key:y,label:y,value:y},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])])])}const fs=Jt(d8,[["render",_8],["__scopeId","data-v-cf5f00a6"]]);var T8=async function(e){if(!e.ok){let t=await e.json();throw t?new Error(t.message):new Error(e)}return e},O8={searchInput:"",lastSearch:"",results:[],numberOfHits:0,filter:[],loadingCards:!1,numberPerPage:10,page:1,pageModel:1,start:0,hasSearched:!1,contextCardEnabled:!1};const B8={components:{SearchFilters:fs,DatasetCard:Ay,SearchHistory:us,Button:pt,Card:li,Drawer:Ol,Icon:ke,Input:Ko,Pagination:pi},name:"DatasetExplorer",props:{visible:{type:Boolean,default:!1},isDrawer:{type:Boolean,default:!0},entry:{type:Object,default:()=>O8},envVars:{type:Object,default:()=>{}}},data:function(){return{...this.entry,algoliaClient:void 0,bodyStyle:{flex:"1 1 auto","flex-flow":"column",display:"flex"},cascaderIsReady:!1}},computed:{filterEntry:function(){return{numberOfHits:this.numberOfHits,filterFacets:this.filter,showFilters:!0,helper:{within:"'heart' OR 'colon'",between:"'rat' AND 'lung'"}}}},methods:{hoverChanged:function(e){const t=e?{...e,tabType:"dataset"}:{tabType:"dataset"};this.$emit("hover-changed",t)},resetSearch:function(){this.numberOfHits=0,this.discoverIds=[],this._dois=[],this.results=[],this.loadingCards=!1},openSearch:function(e,t=""){if(this.searchInput=t,this.resetPageNavigation(),this.cascaderIsReady){const o=this.$refs.filtersRef.getHierarchicalValidatedFilters(e),r=o.notFound?o.notFound.filter(a=>a.facet.toLowerCase()!=="show all"):[];this.filter=o.result,r.forEach(a=>{Qp({message:`${a.facet} cannot be found in ${a.term}!`,appendTo:this.$el,showClose:!0,offset:113})}),e&&e.length>0&&this.filter&&this.filter.length===0?(this.$refs.filtersRef.checkShowAllBoxes(),this.resetSearch()):this.filter&&(this.searchAlgolia(this.filter,t),this.$refs.filtersRef.setCascader(this.filter),this.searchHistoryUpdate(this.filter,t))}else this.filter=e,(!e||e.length==0)&&(this.searchAlgolia(this.filter,t),this.searchHistoryUpdate(this.filter,t))},addFilter:function(e){this.cascaderIsReady?(this.resetPageNavigation(),e&&this.$refs.filtersRef.addFilters(e)&&this.$refs.filtersRef.initiateSearch()):Array.isArray(this.filter)?this.filter.push(...e):this.filter=[...e]},cascaderReady:function(){this.cascaderIsReady=!0,this.openSearch(this.filter,this.searchInput)},clearSearchClicked:function(){this.searchInput="",this.searchAndFilterUpdate()},onResetClick:function(){this.openSearch([],""),this.$emit("search-changed",{value:this.searchInput,tabType:"dataset",type:"reset-update"}),fe.emit("trackEvent",{event_name:"portal_maps_action_filter",category:"reset",location:"map_sidebar_dataset"})},searchEvent:function(e=!1){(e.keyCode===13||e instanceof MouseEvent)&&(this.searchInput=this.searchInput.trim(),this.searchAndFilterUpdate())},filterUpdate:function(e){this.filter=[...e],this.searchAndFilterUpdate(),this.$emit("search-changed",{value:e,tabType:"dataset",type:"filter-update"})},searchAndFilterUpdate:function(){this.resetPageNavigation(),this.searchAlgolia(this.filter,this.searchInput),this.searchHistoryUpdate(this.filter,this.searchInput)},searchHistoryUpdate:function(e,t){this.$refs.searchHistory.selectValue="Search history",(e.length||t!=null&&t.trim())&&this.$refs.searchHistory.addSearchToHistory(e,t)},searchAlgolia(e,t=""){this.loadingCards=!0,this.algoliaClient.anatomyInSearch(k0(e),t).then(o=>{fe.emit("anatomy-in-datasets",o.forFlatmap),fe.emit("number-of-datasets-for-anatomies",o.forScaffold)}),this.algoliaClient.search(k0(e),t,this.numberPerPage,this.page).then(o=>{this.numberOfHits=o.total,this.discoverIds=o.discoverIds,this._dois=o.dois,this.results=o.items,this.loadingCards=!1,this.scrollToTop(),this.$emit("search-changed",{value:this.searchInput,tabType:"dataset",type:"query-update"}),this._abortController&&this._abortController.abort(),this._abortController=new AbortController;const r=this._abortController.signal;this.perItemSearch(r,{count:0})})},filtersLoading:function(e){this.loadingCards=e},numberPerPageUpdate:function(e){this.numberPerPage=e,fe.emit("trackEvent",{event_name:"portal_maps_dataset_perPage",category:e+"",location:"map_sidebar_dataset"});const t=this.page===1;this.pageChange(1,t)},pageChange:function(e,t=!1){this.start=(e-1)*this.numberPerPage,this.page=e,this.searchAlgolia(this.filter,this.searchInput,this.numberPerPage,this.page),t||fe.emit("trackEvent",{event_name:"portal_maps_dataset_pagination",category:`page_${this.page}`,location:"map_sidebar_dataset"})},handleMissingData:function(e){let t=this.results.findIndex(o=>o.doi===e);this.results[t]&&(this.results[t].detailsReady=!0)},perItemSearch:function(e,t){if(10>t.count){const r=this._dois.shift();r&&(t.count++,this.callSciCrunch(this.envVars.API_LOCATION,{dois:[r]},e).then(a=>{a.numberOfHits===0?this.handleMissingData(r):this.resultsProcessing(a),this.$refs.content.style["overflow-y"]="scroll",t.count--,this.perItemSearch(e,t)}).catch(a=>{a.name!=="AbortError"&&(this.handleMissingData(r),t.count--,this.perItemSearch(e,t))}),this.perItemSearch(e,t))}},scrollToTop:function(){this.$refs.content&&this.$refs.content.scroll({top:0,behavior:"smooth"})},resetPageNavigation:function(){this.start=0,this.page=1},resultsProcessing:function(e){this.lastSearch=this.searchInput,e.results.length!==0&&e.results.forEach(t=>{let o=this.results.findIndex(r=>t.doi?t.doi.includes(r.doi):!1);Object.assign(this.results[o],t),Object.assign(this.results[o],{numberSamples:t.sampleSize?parseInt(t.sampleSize):0,numberSubjects:t.subjectSize?parseInt(t.subjectSize):0,updated:(t.updated&&t.updated.length)>0?t.updated[0].timestamp.split("T")[0]:"",url:t.uri[0],datasetId:t.dataset_identifier,datasetRevision:t.dataset_revision,datasetVersion:t.dataset_version,organs:t.organs&&t.organs.length>0?[...new Set(t.organs.map(r=>r.name))]:void 0,species:t.organisms&&t.organisms[0].species?[...new Set(t.organisms.map(r=>r.species?r.species.name:null))]:void 0,scaffolds:t["abi-scaffold-metadata-file"],thumbnails:t["abi-thumbnail"]?t["abi-thumbnail"]:t["abi-scaffold-thumbnail"],scaffoldViews:t["abi-scaffold-view-file"],videos:t.video,plots:t["abi-plot"],images:t["common-images"],contextualInformation:t["abi-contextual-information"].length>0?t["abi-contextual-information"]:void 0,segmentation:t["mbf-segmentation"],simulation:t["abi-simulation-omex-file"]?t["abi-simulation-omex-file"]:t["abi-simulation-file"],flatmaps:t["abi-flatmap-file"],additionalLinks:t.additionalLinks,detailsReady:!0}),this.results[o]=this.results[o]})},createfilterParams:function(e){let t=new URLSearchParams;for(const o in e)Array.isArray(e[o])?e[o].forEach(r=>{t.append(o,r)}):t.append(o,e[o]);return t.toString()},callSciCrunch:function(e,t={},o){return new Promise((r,a)=>{let i=this.envVars.API_LOCATION+this.searchEndpoint+"?"+this.createfilterParams(t);fetch(i,{signal:o}).then(T8).then(s=>s.json()).then(s=>r(s)).catch(s=>a(s))})},getAlgoliaFacets:async function(){return await this.algoliaClient.getAlgoliaFacets(Qc)},searchHistorySearch:function(e){this.searchInput=e.search,this.filter=e.filters,this.openSearch([...e.filters],e.search)},getSearch:function(){return this.searchInput},getFilters:function(){return this.filter.some(t=>t.facet.toLowerCase()!=="show all")?this.filter:[]}},mounted:function(){this.algoliaClient=n.markRaw(new v0(this.envVars.ALGOLIA_ID,this.envVars.ALGOLIA_KEY,this.envVars.PENNSIEVE_API_LOCATION)),this.algoliaClient.initIndex(this.envVars.ALGOLIA_INDEX),this.openSearch(this.filter,this.searchInput)},created:function(){this.searchEndpoint="dataset_info/using_multiple_dois/"}},N8={class:"header"},I8={class:"content scrollbar",ref:"content"},A8={key:0,class:"error-feedback"};function F8(e,t,o,r,a,i){const s=Ko,l=pt,c=fs,d=us,u=Ay,p=pi,g=li,m=Yo;return n.openBlock(),n.createBlock(g,{"body-style":e.bodyStyle,class:"content-card"},{header:n.withCtx(()=>[n.createElementVNode("div",N8,[n.createVNode(s,{class:"search-input",placeholder:"Search",modelValue:e.searchInput,"onUpdate:modelValue":t[0]||(t[0]=f=>e.searchInput=f),onKeyup:i.searchEvent,clearable:"",onClear:i.clearSearchClicked},null,8,["modelValue","onKeyup","onClear"]),n.createVNode(l,{type:"primary",class:"button",onClick:i.searchEvent,size:"large"},{default:n.withCtx(()=>t[3]||(t[3]=[n.createTextVNode(" Search ")])),_:1},8,["onClick"]),n.createVNode(l,{link:"",class:"el-button-link",onClick:i.onResetClick,size:"large"},{default:n.withCtx(()=>t[4]||(t[4]=[n.createTextVNode(" Reset ")])),_:1},8,["onClick"])])]),default:n.withCtx(()=>[n.createVNode(c,{class:"filters",ref:"filtersRef",entry:i.filterEntry,envVars:o.envVars,onFilterResults:i.filterUpdate,onNumberPerPage:i.numberPerPageUpdate,onLoading:i.filtersLoading,onCascaderReady:i.cascaderReady},null,8,["entry","envVars","onFilterResults","onNumberPerPage","onLoading","onCascaderReady"]),n.createVNode(d,{ref:"searchHistory",localStorageKey:"sparc.science-dataset-search-history",onSearch:i.searchHistorySearch},null,8,["onSearch"]),n.withDirectives((n.openBlock(),n.createElementBlock("div",I8,[e.results.length===0&&!e.loadingCards?(n.openBlock(),n.createElementBlock("div",A8," No results found - Please change your search / filter criteria. ")):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.results,f=>(n.openBlock(),n.createElementBlock("div",{key:f.doi,class:"step-item"},[n.createVNode(u,{class:"dataset-card",entry:f,envVars:o.envVars,onMouseenter:h=>i.hoverChanged(f),onMouseleave:t[1]||(t[1]=h=>i.hoverChanged(void 0))},null,8,["entry","envVars","onMouseenter"])]))),128)),n.createVNode(p,{class:"pagination","current-page":e.page,"onUpdate:currentPage":t[2]||(t[2]=f=>e.page=f),"hide-on-single-page":"",large:"",layout:"prev, pager, next","page-size":e.numberPerPage,total:e.numberOfHits,onCurrentChange:i.pageChange},null,8,["current-page","page-size","total","onCurrentChange"])])),[[m,e.loadingCards]])]),_:1},8,["body-style"])}const x0=Jt(B8,[["render",F8],["__scopeId","data-v-9c8b75be"]]),P8=e=>e.replace(/\w\S*/g,t=>t.charAt(0).toUpperCase()+t.substr(1).toLowerCase()),ka=function(e){return e?e.charAt(0).toUpperCase()+e.slice(1):""},R8={name:"ConnectivityInfo",components:{Button:pt,Container:y_,Icon:ke,ElIconWarning:re.Warning,ElIconLocation:re.Location,ElIconSearch:re.Search,ExternalResourceCard:lo.ExternalResourceCard,CopyToClipboard:lo.CopyToClipboard,ConnectivityGraph:lo.ConnectivityGraph,ConnectivityList:lo.ConnectivityList},props:{connectivityEntry:{type:Array,default:[]},entryId:{type:String,default:""},envVars:{type:Object,default:()=>{}},availableAnatomyFacets:{type:Array,default:()=>[]},withCloseButton:{type:Boolean,default:!1}},data:function(){return{updatedCopyContent:"",activeView:"listView",connectivityLoading:!1,connectivitySource:"map",noMapConnectivity:!1,connectivityError:{},graphViewLoaded:!1,connectivityFromMap:null}},computed:{entry:function(){return this.connectivityEntry.find(e=>e.featureId[0]===this.entryId)},hasProvenanceTaxonomyLabel:function(){return this.entry.provenanceTaxonomyLabel&&this.entry.provenanceTaxonomyLabel.length>0},provSpeciesDescription:function(){let e="Studied in";return this.entry.provenanceTaxonomyLabel.forEach(t=>{e+=` ${t},`}),e=e.slice(0,-1),e+=" species",e},connectivityKey:function(){return this.entry.featureId[0]+this.entry.connectivitySource},origins:function(){return this.entry.origins},components:function(){return this.entry.components},destinations:function(){return this.entry.destinations},originsWithDatasets:function(){return this.entry.originsWithDatasets},componentsWithDatasets:function(){return this.entry.componentsWithDatasets},destinationsWithDatasets:function(){return this.entry.destinationsWithDatasets},resources:function(){return this.entry.hyperlinks||[]},sckanVersion:function(){return this.entry.knowledgeSource},flatmapApi:function(){return this.envVars.FLATMAPAPI_LOCATION}},watch:{entry:{deep:!0,immediate:!0,handler:function(e,t){e&&e!==t&&(this.connectivityLoading=!0,this.activeView=localStorage.getItem("connectivity-active-view")||this.activeView,this.activeView==="graphView"&&(this.graphViewLoaded=!0),this.connectivitySource=this.entry.connectivitySource,this.noMapConnectivity=this.entry.noMapConnectivity,this.updateGraphConnectivity(),this.connectivityLoading=!1,(!t||(e==null?void 0:e.featureId[0])!==(t==null?void 0:t.featureId[0]))&&this.$emit("loaded"))}}},methods:{titleCase:function(e){return P8(e)},capitalise:function(e){return ka(e)},showConnectivity:function(){const e=this.entry.featureId||[];this.$emit("show-connectivity",e),fe.emit("trackEvent",{event_name:"portal_maps_show_connectivity_on_map",category:this.entry.id||"",location:"map_sidebar_connectivity"})},onCopied:function(){fe.emit("trackEvent",{event_name:"portal_maps_connectivity_copy",category:this.entry.id||"",location:"map_sidebar_connectivity"})},switchConnectivityView:function(e){this.activeView=e,localStorage.setItem("connectivity-active-view",this.activeView),e==="graphView"&&!this.graphViewLoaded&&this.$nextTick(()=>{this.graphViewLoaded=!0}),fe.emit("trackEvent",{event_name:"portal_maps_connectivity_switch_view",category:e,location:"map_sidebar_connectivity"})},onTapNode:function(e){const t=e.map(o=>o.label).join(", ");this.onConnectivityHovered(t)},onShowReferenceConnectivities:function(e){this.$emit("show-reference-connectivities",e)},onReferencesLoaded:function(e){this.updatedCopyContent=this.getUpdateCopyContent(e)},getUpdateCopyContent:function(e){var s,l,c,d,u;if(!this.entry)return"";const t=[];let o=this.entry.title,r=this.entry.featureId;const a=[];o&&a.push(`<strong>${ka(this.entry.title)}</strong>`),r!=null&&r.length&&(typeof r=="object"?a.push(`(${r[0]})`):a.push(`(${r})`)),t.push(`<div>${a.join(" ")}</div>`),(s=this.entry.provenanceTaxonomyLabel)!=null&&s.length&&t.push(`<div>${this.provSpeciesDescription}</div>`),this.entry.paths&&t.push(`<div>${this.entry.paths}</div>`);function i(p,g,m=[]){let f=`<div><strong>${p}</strong></div>`;const h=[];g.forEach(b=>{let E=[];b.split(",").forEach(O=>{const v=m.find(S=>S.name===O.trim());v?E.push(`${ka(O)} (${v.id})`):E.push(`${ka(O)}`)}),h.push(E.join(","))});const y=h.map(b=>`<li>${b}</li>`).join(`
|
|
464
|
+
`)},i8=["innerHTML"];function s8(e,t,o,r,a,i){return n.openBlock(),n.createElementBlock("svg",{width:"0",height:"0",style:{display:"none"},innerHTML:e.$options.svgSprite},null,8,i8)}const b0=Ry(a8,[["render",s8]]);var w0={exports:{}};/*! algoliasearch.umd.js | 4.23.2 | © Algolia, inc. | https://github.com/algolia/algoliasearch-client-javascript */(function(e,t){(function(o,r){e.exports=r()})(JE,function(){function o(w,C,k){return C in w?Object.defineProperty(w,C,{value:k,enumerable:!0,configurable:!0,writable:!0}):w[C]=k,w}function r(w,C){var k=Object.keys(w);if(Object.getOwnPropertySymbols){var _=Object.getOwnPropertySymbols(w);C&&(_=_.filter(function(I){return Object.getOwnPropertyDescriptor(w,I).enumerable})),k.push.apply(k,_)}return k}function a(w){for(var C=1;C<arguments.length;C++){var k=arguments[C]!=null?arguments[C]:{};C%2?r(Object(k),!0).forEach(function(_){o(w,_,k[_])}):Object.getOwnPropertyDescriptors?Object.defineProperties(w,Object.getOwnPropertyDescriptors(k)):r(Object(k)).forEach(function(_){Object.defineProperty(w,_,Object.getOwnPropertyDescriptor(k,_))})}return w}function i(w,C){if(w==null)return{};var k,_,I=function(W,z){if(W==null)return{};var K,te,Y={},ce=Object.keys(W);for(te=0;te<ce.length;te++)K=ce[te],z.indexOf(K)>=0||(Y[K]=W[K]);return Y}(w,C);if(Object.getOwnPropertySymbols){var H=Object.getOwnPropertySymbols(w);for(_=0;_<H.length;_++)k=H[_],C.indexOf(k)>=0||Object.prototype.propertyIsEnumerable.call(w,k)&&(I[k]=w[k])}return I}function s(w,C){return function(k){if(Array.isArray(k))return k}(w)||function(k,_){if(Symbol.iterator in Object(k)||Object.prototype.toString.call(k)==="[object Arguments]"){var I=[],H=!0,W=!1,z=void 0;try{for(var K,te=k[Symbol.iterator]();!(H=(K=te.next()).done)&&(I.push(K.value),!_||I.length!==_);H=!0);}catch(Y){W=!0,z=Y}finally{try{H||te.return==null||te.return()}finally{if(W)throw z}}return I}}(w,C)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function l(w){return function(C){if(Array.isArray(C)){for(var k=0,_=new Array(C.length);k<C.length;k++)_[k]=C[k];return _}}(w)||function(C){if(Symbol.iterator in Object(C)||Object.prototype.toString.call(C)==="[object Arguments]")return Array.from(C)}(w)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function c(w){var C,k="algoliasearch-client-js-".concat(w.key),_=function(){return C===void 0&&(C=w.localStorage||window.localStorage),C},I=function(){return JSON.parse(_().getItem(k)||"{}")},H=function(z){_().setItem(k,JSON.stringify(z))},W=function(){var z=w.timeToLive?1e3*w.timeToLive:null,K=I(),te=Object.fromEntries(Object.entries(K).filter(function(ce){return s(ce,2)[1].timestamp!==void 0}));if(H(te),z){var Y=Object.fromEntries(Object.entries(te).filter(function(ce){var se=s(ce,2)[1],we=new Date().getTime();return!(se.timestamp+z<we)}));H(Y)}};return{get:function(z,K){var te=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{miss:function(){return Promise.resolve()}};return Promise.resolve().then(function(){W();var Y=JSON.stringify(z);return I()[Y]}).then(function(Y){return Promise.all([Y?Y.value:K(),Y!==void 0])}).then(function(Y){var ce=s(Y,2),se=ce[0],we=ce[1];return Promise.all([se,we||te.miss(se)])}).then(function(Y){return s(Y,1)[0]})},set:function(z,K){return Promise.resolve().then(function(){var te=I();return te[JSON.stringify(z)]={timestamp:new Date().getTime(),value:K},_().setItem(k,JSON.stringify(te)),K})},delete:function(z){return Promise.resolve().then(function(){var K=I();delete K[JSON.stringify(z)],_().setItem(k,JSON.stringify(K))})},clear:function(){return Promise.resolve().then(function(){_().removeItem(k)})}}}function d(w){var C=l(w.caches),k=C.shift();return k===void 0?{get:function(_,I){var H=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{miss:function(){return Promise.resolve()}},W=I();return W.then(function(z){return Promise.all([z,H.miss(z)])}).then(function(z){return s(z,1)[0]})},set:function(_,I){return Promise.resolve(I)},delete:function(_){return Promise.resolve()},clear:function(){return Promise.resolve()}}:{get:function(_,I){var H=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{miss:function(){return Promise.resolve()}};return k.get(_,I,H).catch(function(){return d({caches:C}).get(_,I,H)})},set:function(_,I){return k.set(_,I).catch(function(){return d({caches:C}).set(_,I)})},delete:function(_){return k.delete(_).catch(function(){return d({caches:C}).delete(_)})},clear:function(){return k.clear().catch(function(){return d({caches:C}).clear()})}}}function u(){var w=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{serializable:!0},C={};return{get:function(k,_){var I=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{miss:function(){return Promise.resolve()}},H=JSON.stringify(k);if(H in C)return Promise.resolve(w.serializable?JSON.parse(C[H]):C[H]);var W=_(),z=I&&I.miss||function(){return Promise.resolve()};return W.then(function(K){return z(K)}).then(function(){return W})},set:function(k,_){return C[JSON.stringify(k)]=w.serializable?JSON.stringify(_):_,Promise.resolve(_)},delete:function(k){return delete C[JSON.stringify(k)],Promise.resolve()},clear:function(){return C={},Promise.resolve()}}}function p(w,C,k){var _={"x-algolia-api-key":k,"x-algolia-application-id":C};return{headers:function(){return w===b.WithinHeaders?_:{}},queryParameters:function(){return w===b.WithinQueryParameters?_:{}}}}function g(w){var C=0;return w(function k(){return C++,new Promise(function(_){setTimeout(function(){_(w(k))},Math.min(100*C,1e3))})})}function m(w){var C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(k,_){return Promise.resolve()};return Object.assign(w,{wait:function(k){return m(w.then(function(_){return Promise.all([C(_,k),_])}).then(function(_){return _[1]}))}})}function f(w){for(var C=w.length-1;C>0;C--){var k=Math.floor(Math.random()*(C+1)),_=w[C];w[C]=w[k],w[k]=_}return w}function h(w,C){return C&&Object.keys(C).forEach(function(k){w[k]=C[k](w)}),w}function y(w){for(var C=arguments.length,k=new Array(C>1?C-1:0),_=1;_<C;_++)k[_-1]=arguments[_];var I=0;return w.replace(/%s/g,function(){return encodeURIComponent(k[I++])})}var b={WithinQueryParameters:0,WithinHeaders:1};function E(w,C){var k=w||{},_=k.data||{};return Object.keys(k).forEach(function(I){["timeout","headers","queryParameters","data","cacheable"].indexOf(I)===-1&&(_[I]=k[I])}),{data:Object.entries(_).length>0?_:void 0,timeout:k.timeout||C,headers:k.headers||{},queryParameters:k.queryParameters||{},cacheable:k.cacheable}}var O={Read:1,Write:2,Any:3},v=1,S=2,x=3;function T(w){var C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:v;return a(a({},w),{},{status:C,lastUpdate:Date.now()})}function B(w){return typeof w=="string"?{protocol:"https",url:w,accept:O.Any}:{protocol:w.protocol||"https",url:w.url,accept:w.accept||O.Any}}var A="DELETE",V="GET",P="POST",$="PUT";function j(w,C){return Promise.all(C.map(function(k){return w.get(k,function(){return Promise.resolve(T(k))})})).then(function(k){var _=k.filter(function(W){return function(z){return z.status===v||Date.now()-z.lastUpdate>12e4}(W)}),I=k.filter(function(W){return function(z){return z.status===x&&Date.now()-z.lastUpdate<=12e4}(W)}),H=[].concat(l(_),l(I));return{getTimeout:function(W,z){return(I.length===0&&W===0?1:I.length+3+W)*z},statelessHosts:H.length>0?H.map(function(W){return B(W)}):C}})}function Z(w,C,k,_){var I=[],H=function(se,we){if(!(se.method===V||se.data===void 0&&we.data===void 0)){var he=Array.isArray(se.data)?se.data:a(a({},se.data),we.data);return JSON.stringify(he)}}(k,_),W=function(se,we){var he=a(a({},se.headers),we.headers),Ie={};return Object.keys(he).forEach(function(Ve){var Nt=he[Ve];Ie[Ve.toLowerCase()]=Nt}),Ie}(w,_),z=k.method,K=k.method!==V?{}:a(a({},k.data),_.data),te=a(a(a({"x-algolia-agent":w.userAgent.value},w.queryParameters),K),_.queryParameters),Y=0,ce=function se(we,he){var Ie=we.pop();if(Ie===void 0)throw{name:"RetryError",message:"Unreachable hosts - your application id may be incorrect. If the error persists, contact support@algolia.com.",transporterStackTrace:ne(I)};var Ve={data:H,headers:W,method:z,url:D(Ie,k.path,te),connectTimeout:he(Y,w.timeouts.connect),responseTimeout:he(Y,_.timeout)},Nt=function(It){var ut={request:Ve,response:It,host:Ie,triesLeft:we.length};return I.push(ut),ut},Ta={onSuccess:function(It){return function(ut){try{return JSON.parse(ut.content)}catch($o){throw function(so,Cr){return{name:"DeserializationError",message:so,response:Cr}}($o.message,ut)}}(It)},onRetry:function(It){var ut=Nt(It);return It.isTimedOut&&Y++,Promise.all([w.logger.info("Retryable failure",ge(ut)),w.hostsCache.set(Ie,T(Ie,It.isTimedOut?x:S))]).then(function(){return se(we,he)})},onFail:function(It){throw Nt(It),function(ut,$o){var so=ut.content,Cr=ut.status,Oa=so;try{Oa=JSON.parse(so).message}catch{}return function(ys,pd,Q4){return{name:"ApiError",message:ys,status:pd,transporterStackTrace:Q4}}(Oa,Cr,$o)}(It,ne(I))}};return w.requester.send(Ve).then(function(It){return function(ut,$o){return function(so){var Cr=so.status;return so.isTimedOut||function(Oa){var ys=Oa.isTimedOut,pd=Oa.status;return!ys&&~~pd==0}(so)||~~(Cr/100)!=2&&~~(Cr/100)!=4}(ut)?$o.onRetry(ut):~~(ut.status/100)==2?$o.onSuccess(ut):$o.onFail(ut)}(It,Ta)})};return j(w.hostsCache,C).then(function(se){return ce(l(se.statelessHosts).reverse(),se.getTimeout)})}function q(w){var C=w.hostsCache,k=w.logger,_=w.requester,I=w.requestsCache,H=w.responsesCache,W=w.timeouts,z=w.userAgent,K=w.hosts,te=w.queryParameters,Y={hostsCache:C,logger:k,requester:_,requestsCache:I,responsesCache:H,timeouts:W,userAgent:z,headers:w.headers,queryParameters:te,hosts:K.map(function(ce){return B(ce)}),read:function(ce,se){var we=E(se,Y.timeouts.read),he=function(){return Z(Y,Y.hosts.filter(function(Ve){return(Ve.accept&O.Read)!=0}),ce,we)};if((we.cacheable!==void 0?we.cacheable:ce.cacheable)!==!0)return he();var Ie={request:ce,mappedRequestOptions:we,transporter:{queryParameters:Y.queryParameters,headers:Y.headers}};return Y.responsesCache.get(Ie,function(){return Y.requestsCache.get(Ie,function(){return Y.requestsCache.set(Ie,he()).then(function(Ve){return Promise.all([Y.requestsCache.delete(Ie),Ve])},function(Ve){return Promise.all([Y.requestsCache.delete(Ie),Promise.reject(Ve)])}).then(function(Ve){var Nt=s(Ve,2);return Nt[0],Nt[1]})})},{miss:function(Ve){return Y.responsesCache.set(Ie,Ve)}})},write:function(ce,se){return Z(Y,Y.hosts.filter(function(we){return(we.accept&O.Write)!=0}),ce,E(se,Y.timeouts.write))}};return Y}function N(w){var C={value:"Algolia for JavaScript (".concat(w,")"),add:function(k){var _="; ".concat(k.segment).concat(k.version!==void 0?" (".concat(k.version,")"):"");return C.value.indexOf(_)===-1&&(C.value="".concat(C.value).concat(_)),C}};return C}function D(w,C,k){var _=ee(k),I="".concat(w.protocol,"://").concat(w.url,"/").concat(C.charAt(0)==="/"?C.substr(1):C);return _.length&&(I+="?".concat(_)),I}function ee(w){return Object.keys(w).map(function(C){return y("%s=%s",C,(k=w[C],Object.prototype.toString.call(k)==="[object Object]"||Object.prototype.toString.call(k)==="[object Array]"?JSON.stringify(w[C]):w[C]));var k}).join("&")}function ne(w){return w.map(function(C){return ge(C)})}function ge(w){var C=w.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return a(a({},w),{},{request:a(a({},w.request),{},{headers:a(a({},w.request.headers),C)})})}var le=function(w){return function(C,k){return w.transporter.write({method:P,path:"2/abtests",data:C},k)}},Se=function(w){return function(C,k){return w.transporter.write({method:A,path:y("2/abtests/%s",C)},k)}},Pe=function(w){return function(C,k){return w.transporter.read({method:V,path:y("2/abtests/%s",C)},k)}},xe=function(w){return function(C){return w.transporter.read({method:V,path:"2/abtests"},C)}},ye=function(w){return function(C,k){return w.transporter.write({method:P,path:y("2/abtests/%s/stop",C)},k)}},Ee=function(w){return function(C){return w.transporter.read({method:V,path:"1/strategies/personalization"},C)}},Fe=function(w){return function(C,k){return w.transporter.write({method:P,path:"1/strategies/personalization",data:C},k)}};function je(w){return function C(k){return w.request(k).then(function(_){if(w.batch!==void 0&&w.batch(_.hits),!w.shouldStop(_))return _.cursor?C({cursor:_.cursor}):C({page:(k.page||0)+1})})}({})}var tn=function(w){return function(C,k){var _=k||{},I=_.queryParameters,H=i(_,["queryParameters"]),W=a({acl:C},I!==void 0?{queryParameters:I}:{});return m(w.transporter.write({method:P,path:"1/keys",data:W},H),function(z,K){return g(function(te){return _e(w)(z.key,K).catch(function(Y){if(Y.status!==404)throw Y;return te()})})})}},ct=function(w){return function(C,k,_){var I=E(_);return I.queryParameters["X-Algolia-User-ID"]=C,w.transporter.write({method:P,path:"1/clusters/mapping",data:{cluster:k}},I)}},Xe=function(w){return function(C,k,_){return w.transporter.write({method:P,path:"1/clusters/mapping/batch",data:{users:C,cluster:k}},_)}},Re=function(w){return function(C,k){return m(w.transporter.write({method:P,path:y("/1/dictionaries/%s/batch",C),data:{clearExistingDictionaryEntries:!0,requests:{action:"addEntry",body:[]}}},k),function(_,I){return ao(w)(_.taskID,I)})}},He=function(w){return function(C,k,_){return m(w.transporter.write({method:P,path:y("1/indexes/%s/operation",C),data:{operation:"copy",destination:k}},_),function(I,H){return Le(w)(C,{methods:{waitTask:Ge}}).waitTask(I.taskID,H)})}},_t=function(w){return function(C,k,_){return He(w)(C,k,a(a({},_),{},{scope:[fd.Rules]}))}},Tt=function(w){return function(C,k,_){return He(w)(C,k,a(a({},_),{},{scope:[fd.Settings]}))}},Ze=function(w){return function(C,k,_){return He(w)(C,k,a(a({},_),{},{scope:[fd.Synonyms]}))}},Ot=function(w){return function(C,k){return C.method===V?w.transporter.read(C,k):w.transporter.write(C,k)}},dt=function(w){return function(C,k){return m(w.transporter.write({method:A,path:y("1/keys/%s",C)},k),function(_,I){return g(function(H){return _e(w)(C,I).then(H).catch(function(W){if(W.status!==404)throw W})})})}},nn=function(w){return function(C,k,_){var I=k.map(function(H){return{action:"deleteEntry",body:{objectID:H}}});return m(w.transporter.write({method:P,path:y("/1/dictionaries/%s/batch",C),data:{clearExistingDictionaryEntries:!1,requests:I}},_),function(H,W){return ao(w)(H.taskID,W)})}},_e=function(w){return function(C,k){return w.transporter.read({method:V,path:y("1/keys/%s",C)},k)}},Qe=function(w){return function(C,k){return w.transporter.read({method:V,path:y("1/task/%s",C.toString())},k)}},mt=function(w){return function(C){return w.transporter.read({method:V,path:"/1/dictionaries/*/settings"},C)}},Dt=function(w){return function(C){return w.transporter.read({method:V,path:"1/logs"},C)}},et=function(w){return function(C){return w.transporter.read({method:V,path:"1/clusters/mapping/top"},C)}},U=function(w){return function(C,k){return w.transporter.read({method:V,path:y("1/clusters/mapping/%s",C)},k)}},me=function(w){return function(C){var k=C||{},_=k.retrieveMappings,I=i(k,["retrieveMappings"]);return _===!0&&(I.getClusters=!0),w.transporter.read({method:V,path:"1/clusters/mapping/pending"},I)}},Le=function(w){return function(C){var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},_={transporter:w.transporter,appId:w.appId,indexName:C};return h(_,k.methods)}},gt=function(w){return function(C){return w.transporter.read({method:V,path:"1/keys"},C)}},Mt=function(w){return function(C){return w.transporter.read({method:V,path:"1/clusters"},C)}},gr=function(w){return function(C){return w.transporter.read({method:V,path:"1/indexes"},C)}},Sa=function(w){return function(C){return w.transporter.read({method:V,path:"1/clusters/mapping"},C)}},Po=function(w){return function(C,k,_){return m(w.transporter.write({method:P,path:y("1/indexes/%s/operation",C),data:{operation:"move",destination:k}},_),function(I,H){return Le(w)(C,{methods:{waitTask:Ge}}).waitTask(I.taskID,H)})}},Ro=function(w){return function(C,k){return m(w.transporter.write({method:P,path:"1/indexes/*/batch",data:{requests:C}},k),function(_,I){return Promise.all(Object.keys(_.taskID).map(function(H){return Le(w)(H,{methods:{waitTask:Ge}}).waitTask(_.taskID[H],I)}))})}},M=function(w){return function(C,k){return w.transporter.read({method:P,path:"1/indexes/*/objects",data:{requests:C}},k)}},X=function(w){return function(C,k){var _=C.map(function(I){return a(a({},I),{},{params:ee(I.params||{})})});return w.transporter.read({method:P,path:"1/indexes/*/queries",data:{requests:_},cacheable:!0},k)}},Q=function(w){return function(C,k){return Promise.all(C.map(function(_){var I=_.params,H=I.facetName,W=I.facetQuery,z=i(I,["facetName","facetQuery"]);return Le(w)(_.indexName,{methods:{searchForFacetValues:P0}}).searchForFacetValues(H,W,a(a({},k),z))}))}},Te=function(w){return function(C,k){var _=E(k);return _.queryParameters["X-Algolia-User-ID"]=C,w.transporter.write({method:A,path:"1/clusters/mapping"},_)}},jt=function(w){return function(C,k,_){var I=k.map(function(H){return{action:"addEntry",body:H}});return m(w.transporter.write({method:P,path:y("/1/dictionaries/%s/batch",C),data:{clearExistingDictionaryEntries:!0,requests:I}},_),function(H,W){return ao(w)(H.taskID,W)})}},Bt=function(w){return function(C,k){return m(w.transporter.write({method:P,path:y("1/keys/%s/restore",C)},k),function(_,I){return g(function(H){return _e(w)(C,I).catch(function(W){if(W.status!==404)throw W;return H()})})})}},zt=function(w){return function(C,k,_){var I=k.map(function(H){return{action:"addEntry",body:H}});return m(w.transporter.write({method:P,path:y("/1/dictionaries/%s/batch",C),data:{clearExistingDictionaryEntries:!1,requests:I}},_),function(H,W){return ao(w)(H.taskID,W)})}},yr=function(w){return function(C,k,_){return w.transporter.read({method:P,path:y("/1/dictionaries/%s/search",C),data:{query:k},cacheable:!0},_)}},ps=function(w){return function(C,k){return w.transporter.read({method:P,path:"1/clusters/mapping/search",data:{query:C}},k)}},ed=function(w){return function(C,k){return m(w.transporter.write({method:$,path:"/1/dictionaries/*/settings",data:C},k),function(_,I){return ao(w)(_.taskID,I)})}},td=function(w){return function(C,k){var _=Object.assign({},k),I=k||{},H=I.queryParameters,W=i(I,["queryParameters"]),z=H?{queryParameters:H}:{},K=["acl","indexes","referers","restrictSources","queryParameters","description","maxQueriesPerIPPerHour","maxHitsPerQuery"];return m(w.transporter.write({method:$,path:y("1/keys/%s",C),data:z},W),function(te,Y){return g(function(ce){return _e(w)(C,Y).then(function(se){return function(we){return Object.keys(_).filter(function(he){return K.indexOf(he)!==-1}).every(function(he){if(Array.isArray(we[he])&&Array.isArray(_[he])){var Ie=we[he];return Ie.length===_[he].length&&Ie.every(function(Ve,Nt){return Ve===_[he][Nt]})}return we[he]===_[he]})}(se)?Promise.resolve():ce()})})})}},ao=function(w){return function(C,k){return g(function(_){return Qe(w)(C,k).then(function(I){return I.status!=="published"?_():void 0})})}},Ea=function(w){return function(C,k){return m(w.transporter.write({method:P,path:y("1/indexes/%s/batch",w.indexName),data:{requests:C}},k),function(_,I){return Ge(w)(_.taskID,I)})}},nd=function(w){return function(C){return je(a(a({shouldStop:function(k){return k.cursor===void 0}},C),{},{request:function(k){return w.transporter.read({method:P,path:y("1/indexes/%s/browse",w.indexName),data:k},C)}}))}},xa=function(w){return function(C){var k=a({hitsPerPage:1e3},C);return je(a(a({shouldStop:function(_){return _.hits.length<k.hitsPerPage}},k),{},{request:function(_){return R0(w)("",a(a({},k),_)).then(function(I){return a(a({},I),{},{hits:I.hits.map(function(H){return delete H._highlightResult,H})})})}}))}},od=function(w){return function(C){var k=a({hitsPerPage:1e3},C);return je(a(a({shouldStop:function(_){return _.hits.length<k.hitsPerPage}},k),{},{request:function(_){return $0(w)("",a(a({},k),_)).then(function(I){return a(a({},I),{},{hits:I.hits.map(function(H){return delete H._highlightResult,H})})})}}))}},_a=function(w){return function(C,k,_){var I=_||{},H=I.batchSize,W=i(I,["batchSize"]),z={taskIDs:[],objectIDs:[]};return m(function K(){var te,Y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,ce=[];for(te=Y;te<C.length&&(ce.push(C[te]),ce.length!==(H||1e3));te++);return ce.length===0?Promise.resolve(z):Ea(w)(ce.map(function(se){return{action:k,body:se}}),W).then(function(se){return z.objectIDs=z.objectIDs.concat(se.objectIDs),z.taskIDs.push(se.taskID),te++,K(te)})}(),function(K,te){return Promise.all(K.taskIDs.map(function(Y){return Ge(w)(Y,te)}))})}},rd=function(w){return function(C){return m(w.transporter.write({method:P,path:y("1/indexes/%s/clear",w.indexName)},C),function(k,_){return Ge(w)(k.taskID,_)})}},hs=function(w){return function(C){var k=C||{},_=k.forwardToReplicas,I=E(i(k,["forwardToReplicas"]));return _&&(I.queryParameters.forwardToReplicas=1),m(w.transporter.write({method:P,path:y("1/indexes/%s/rules/clear",w.indexName)},I),function(H,W){return Ge(w)(H.taskID,W)})}},ad=function(w){return function(C){var k=C||{},_=k.forwardToReplicas,I=E(i(k,["forwardToReplicas"]));return _&&(I.queryParameters.forwardToReplicas=1),m(w.transporter.write({method:P,path:y("1/indexes/%s/synonyms/clear",w.indexName)},I),function(H,W){return Ge(w)(H.taskID,W)})}},id=function(w){return function(C,k){return m(w.transporter.write({method:P,path:y("1/indexes/%s/deleteByQuery",w.indexName),data:C},k),function(_,I){return Ge(w)(_.taskID,I)})}},sd=function(w){return function(C){return m(w.transporter.write({method:A,path:y("1/indexes/%s",w.indexName)},C),function(k,_){return Ge(w)(k.taskID,_)})}},ld=function(w){return function(C,k){return m(L(w)([C],k).then(function(_){return{taskID:_.taskIDs[0]}}),function(_,I){return Ge(w)(_.taskID,I)})}},L=function(w){return function(C,k){var _=C.map(function(I){return{objectID:I}});return _a(w)(_,wr.DeleteObject,k)}},G=function(w){return function(C,k){var _=k||{},I=_.forwardToReplicas,H=E(i(_,["forwardToReplicas"]));return I&&(H.queryParameters.forwardToReplicas=1),m(w.transporter.write({method:A,path:y("1/indexes/%s/rules/%s",w.indexName,C)},H),function(W,z){return Ge(w)(W.taskID,z)})}},pe=function(w){return function(C,k){var _=k||{},I=_.forwardToReplicas,H=E(i(_,["forwardToReplicas"]));return I&&(H.queryParameters.forwardToReplicas=1),m(w.transporter.write({method:A,path:y("1/indexes/%s/synonyms/%s",w.indexName,C)},H),function(W,z){return Ge(w)(W.taskID,z)})}},Oe=function(w){return function(C){return I0(w)(C).then(function(){return!0}).catch(function(k){if(k.status!==404)throw k;return!1})}},Bn=function(w){return function(C,k,_){return w.transporter.read({method:P,path:y("1/answers/%s/prediction",w.indexName),data:{query:C,queryLanguages:k},cacheable:!0},_)}},io=function(w){return function(C,k){var _=k||{},I=_.query,H=_.paginate,W=i(_,["query","paginate"]),z=0;return function K(){return F0(w)(I||"",a(a({},W),{},{page:z})).then(function(te){for(var Y=0,ce=Object.entries(te.hits);Y<ce.length;Y++){var se=s(ce[Y],2),we=se[0],he=se[1];if(C(he))return{object:he,position:parseInt(we,10),page:z}}if(z++,H===!1||z>=te.nbPages)throw{name:"ObjectNotFoundError",message:"Object not found."};return K()})}()}},br=function(w){return function(C,k){return w.transporter.read({method:V,path:y("1/indexes/%s/%s",w.indexName,C)},k)}},Hn=function(){return function(w,C){for(var k=0,_=Object.entries(w.hits);k<_.length;k++){var I=s(_[k],2),H=I[0];if(I[1].objectID===C)return parseInt(H,10)}return-1}},on=function(w){return function(C,k){var _=k||{},I=_.attributesToRetrieve,H=i(_,["attributesToRetrieve"]),W=C.map(function(z){return a({indexName:w.indexName,objectID:z},I?{attributesToRetrieve:I}:{})});return w.transporter.read({method:P,path:"1/indexes/*/objects",data:{requests:W}},H)}},ms=function(w){return function(C,k){return w.transporter.read({method:V,path:y("1/indexes/%s/rules/%s",w.indexName,C)},k)}},I0=function(w){return function(C){return w.transporter.read({method:V,path:y("1/indexes/%s/settings",w.indexName),data:{getVersion:2}},C)}},R4=function(w){return function(C,k){return w.transporter.read({method:V,path:y("1/indexes/%s/synonyms/%s",w.indexName,C)},k)}},$4=function(w){return function(C,k){return m(A0(w)([C],k).then(function(_){return{objectID:_.objectIDs[0],taskID:_.taskIDs[0]}}),function(_,I){return Ge(w)(_.taskID,I)})}},A0=function(w){return function(C,k){var _=k||{},I=_.createIfNotExists,H=i(_,["createIfNotExists"]),W=I?wr.PartialUpdateObject:wr.PartialUpdateObjectNoCreate;return _a(w)(C,W,H)}},L4=function(w){return function(C,k){var _=k||{},I=_.safe,H=_.autoGenerateObjectIDIfNotExist,W=_.batchSize,z=i(_,["safe","autoGenerateObjectIDIfNotExist","batchSize"]),K=function(he,Ie,Ve,Nt){return m(w.transporter.write({method:P,path:y("1/indexes/%s/operation",he),data:{operation:Ve,destination:Ie}},Nt),function(Ta,It){return Ge(w)(Ta.taskID,It)})},te=Math.random().toString(36).substring(7),Y="".concat(w.indexName,"_tmp_").concat(te),ce=cd({appId:w.appId,transporter:w.transporter,indexName:Y}),se=[],we=K(w.indexName,Y,"copy",a(a({},z),{},{scope:["settings","synonyms","rules"]}));return se.push(we),m((I?we.wait(z):we).then(function(){var he=ce(C,a(a({},z),{},{autoGenerateObjectIDIfNotExist:H,batchSize:W}));return se.push(he),I?he.wait(z):he}).then(function(){var he=K(Y,w.indexName,"move",z);return se.push(he),I?he.wait(z):he}).then(function(){return Promise.all(se)}).then(function(he){var Ie=s(he,3),Ve=Ie[0],Nt=Ie[1],Ta=Ie[2];return{objectIDs:Nt.objectIDs,taskIDs:[Ve.taskID].concat(l(Nt.taskIDs),[Ta.taskID])}}),function(he,Ie){return Promise.all(se.map(function(Ve){return Ve.wait(Ie)}))})}},V4=function(w){return function(C,k){return dd(w)(C,a(a({},k),{},{clearExistingRules:!0}))}},D4=function(w){return function(C,k){return ud(w)(C,a(a({},k),{},{clearExistingSynonyms:!0}))}},M4=function(w){return function(C,k){return m(cd(w)([C],k).then(function(_){return{objectID:_.objectIDs[0],taskID:_.taskIDs[0]}}),function(_,I){return Ge(w)(_.taskID,I)})}},cd=function(w){return function(C,k){var _=k||{},I=_.autoGenerateObjectIDIfNotExist,H=i(_,["autoGenerateObjectIDIfNotExist"]),W=I?wr.AddObject:wr.UpdateObject;if(W===wr.UpdateObject){var z=!0,K=!1,te=void 0;try{for(var Y,ce=C[Symbol.iterator]();!(z=(Y=ce.next()).done);z=!0)if(Y.value.objectID===void 0)return m(Promise.reject({name:"MissingObjectIDError",message:"All objects must have an unique objectID (like a primary key) to be valid. Algolia is also able to generate objectIDs automatically but *it's not recommended*. To do it, use the `{'autoGenerateObjectIDIfNotExist': true}` option."}))}catch(se){K=!0,te=se}finally{try{z||ce.return==null||ce.return()}finally{if(K)throw te}}}return _a(w)(C,W,H)}},j4=function(w){return function(C,k){return dd(w)([C],k)}},dd=function(w){return function(C,k){var _=k||{},I=_.forwardToReplicas,H=_.clearExistingRules,W=E(i(_,["forwardToReplicas","clearExistingRules"]));return I&&(W.queryParameters.forwardToReplicas=1),H&&(W.queryParameters.clearExistingRules=1),m(w.transporter.write({method:P,path:y("1/indexes/%s/rules/batch",w.indexName),data:C},W),function(z,K){return Ge(w)(z.taskID,K)})}},z4=function(w){return function(C,k){return ud(w)([C],k)}},ud=function(w){return function(C,k){var _=k||{},I=_.forwardToReplicas,H=_.clearExistingSynonyms,W=_.replaceExistingSynonyms,z=E(i(_,["forwardToReplicas","clearExistingSynonyms","replaceExistingSynonyms"]));return I&&(z.queryParameters.forwardToReplicas=1),(W||H)&&(z.queryParameters.replaceExistingSynonyms=1),m(w.transporter.write({method:P,path:y("1/indexes/%s/synonyms/batch",w.indexName),data:C},z),function(K,te){return Ge(w)(K.taskID,te)})}},F0=function(w){return function(C,k){return w.transporter.read({method:P,path:y("1/indexes/%s/query",w.indexName),data:{query:C},cacheable:!0},k)}},P0=function(w){return function(C,k,_){return w.transporter.read({method:P,path:y("1/indexes/%s/facets/%s/query",w.indexName,C),data:{facetQuery:k},cacheable:!0},_)}},R0=function(w){return function(C,k){return w.transporter.read({method:P,path:y("1/indexes/%s/rules/search",w.indexName),data:{query:C}},k)}},$0=function(w){return function(C,k){return w.transporter.read({method:P,path:y("1/indexes/%s/synonyms/search",w.indexName),data:{query:C}},k)}},U4=function(w){return function(C,k){var _=k||{},I=_.forwardToReplicas,H=E(i(_,["forwardToReplicas"]));return I&&(H.queryParameters.forwardToReplicas=1),m(w.transporter.write({method:$,path:y("1/indexes/%s/settings",w.indexName),data:C},H),function(W,z){return Ge(w)(W.taskID,z)})}},Ge=function(w){return function(C,k){return g(function(_){return function(I){return function(H,W){return I.transporter.read({method:V,path:y("1/indexes/%s/task/%s",I.indexName,H.toString())},W)}}(w)(C,k).then(function(I){return I.status!=="published"?_():void 0})})}},wr={AddObject:"addObject",UpdateObject:"updateObject",PartialUpdateObject:"partialUpdateObject",PartialUpdateObjectNoCreate:"partialUpdateObjectNoCreate",DeleteObject:"deleteObject",DeleteIndex:"delete",ClearIndex:"clear"},fd={Settings:"settings",Synonyms:"synonyms",Rules:"rules"},H4=1,q4=2,K4=3,gs=function(w){return function(C,k){var _=C.map(function(I){return a(a({},I),{},{threshold:I.threshold||0})});return w.transporter.read({method:P,path:"1/indexes/*/recommendations",data:{requests:_},cacheable:!0},k)}},W4=function(w){return function(C,k){return gs(w)(C.map(function(_){return a(a({},_),{},{fallbackParameters:{},model:"bought-together"})}),k)}},G4=function(w){return function(C,k){return gs(w)(C.map(function(_){return a(a({},_),{},{model:"related-products"})}),k)}},J4=function(w){return function(C,k){var _=C.map(function(I){return a(a({},I),{},{model:"trending-facets",threshold:I.threshold||0})});return w.transporter.read({method:P,path:"1/indexes/*/recommendations",data:{requests:_},cacheable:!0},k)}},Z4=function(w){return function(C,k){var _=C.map(function(I){return a(a({},I),{},{model:"trending-items",threshold:I.threshold||0})});return w.transporter.read({method:P,path:"1/indexes/*/recommendations",data:{requests:_},cacheable:!0},k)}},Y4=function(w){return function(C,k){return gs(w)(C.map(function(_){return a(a({},_),{},{model:"looking-similar"})}),k)}},X4=function(w){return function(C,k){var _=C.map(function(I){return a(a({},I),{},{model:"recommended-for-you",threshold:I.threshold||0})});return w.transporter.read({method:P,path:"1/indexes/*/recommendations",data:{requests:_},cacheable:!0},k)}};function L0(w,C,k){var _,I={appId:w,apiKey:C,timeouts:{connect:1,read:2,write:30},requester:{send:function(z){return new Promise(function(K){var te=new XMLHttpRequest;te.open(z.method,z.url,!0),Object.keys(z.headers).forEach(function(we){return te.setRequestHeader(we,z.headers[we])});var Y,ce=function(we,he){return setTimeout(function(){te.abort(),K({status:0,content:he,isTimedOut:!0})},1e3*we)},se=ce(z.connectTimeout,"Connection timeout");te.onreadystatechange=function(){te.readyState>te.OPENED&&Y===void 0&&(clearTimeout(se),Y=ce(z.responseTimeout,"Socket timeout"))},te.onerror=function(){te.status===0&&(clearTimeout(se),clearTimeout(Y),K({content:te.responseText||"Network request failed",status:te.status,isTimedOut:!1}))},te.onload=function(){clearTimeout(se),clearTimeout(Y),K({content:te.responseText,status:te.status,isTimedOut:!1})},te.send(z.data)})}},logger:(_=K4,{debug:function(z,K){return H4>=_&&console.debug(z,K),Promise.resolve()},info:function(z,K){return q4>=_&&console.info(z,K),Promise.resolve()},error:function(z,K){return console.error(z,K),Promise.resolve()}}),responsesCache:u(),requestsCache:u({serializable:!1}),hostsCache:d({caches:[c({key:"".concat("4.23.2","-").concat(w)}),u()]}),userAgent:N("4.23.2").add({segment:"Browser"})},H=a(a({},I),k),W=function(){return function(z){return function(K){var te=K.region||"us",Y=p(b.WithinHeaders,K.appId,K.apiKey),ce=q(a(a({hosts:[{url:"personalization.".concat(te,".algolia.com")}]},K),{},{headers:a(a(a({},Y.headers()),{"content-type":"application/json"}),K.headers),queryParameters:a(a({},Y.queryParameters()),K.queryParameters)}));return h({appId:K.appId,transporter:ce},K.methods)}(a(a(a({},I),z),{},{methods:{getPersonalizationStrategy:Ee,setPersonalizationStrategy:Fe}}))}};return function(z){var K=z.appId,te=p(z.authMode!==void 0?z.authMode:b.WithinHeaders,K,z.apiKey),Y=q(a(a({hosts:[{url:"".concat(K,"-dsn.algolia.net"),accept:O.Read},{url:"".concat(K,".algolia.net"),accept:O.Write}].concat(f([{url:"".concat(K,"-1.algolianet.com")},{url:"".concat(K,"-2.algolianet.com")},{url:"".concat(K,"-3.algolianet.com")}]))},z),{},{headers:a(a(a({},te.headers()),{"content-type":"application/x-www-form-urlencoded"}),z.headers),queryParameters:a(a({},te.queryParameters()),z.queryParameters)}));return h({transporter:Y,appId:K,addAlgoliaAgent:function(ce,se){Y.userAgent.add({segment:ce,version:se})},clearCache:function(){return Promise.all([Y.requestsCache.clear(),Y.responsesCache.clear()]).then(function(){})}},z.methods)}(a(a({},H),{},{methods:{search:X,searchForFacetValues:Q,multipleBatch:Ro,multipleGetObjects:M,multipleQueries:X,copyIndex:He,copySettings:Tt,copySynonyms:Ze,copyRules:_t,moveIndex:Po,listIndices:gr,getLogs:Dt,listClusters:Mt,multipleSearchForFacetValues:Q,getApiKey:_e,addApiKey:tn,listApiKeys:gt,updateApiKey:td,deleteApiKey:dt,restoreApiKey:Bt,assignUserID:ct,assignUserIDs:Xe,getUserID:U,searchUserIDs:ps,listUserIDs:Sa,getTopUserIDs:et,removeUserID:Te,hasPendingMappings:me,clearDictionaryEntries:Re,deleteDictionaryEntries:nn,getDictionarySettings:mt,getAppTask:Qe,replaceDictionaryEntries:jt,saveDictionaryEntries:zt,searchDictionaryEntries:yr,setDictionarySettings:ed,waitAppTask:ao,customRequest:Ot,initIndex:function(z){return function(K){return Le(z)(K,{methods:{batch:Ea,delete:sd,findAnswers:Bn,getObject:br,getObjects:on,saveObject:M4,saveObjects:cd,search:F0,searchForFacetValues:P0,waitTask:Ge,setSettings:U4,getSettings:I0,partialUpdateObject:$4,partialUpdateObjects:A0,deleteObject:ld,deleteObjects:L,deleteBy:id,clearObjects:rd,browseObjects:nd,getObjectPosition:Hn,findObject:io,exists:Oe,saveSynonym:z4,saveSynonyms:ud,getSynonym:R4,searchSynonyms:$0,browseSynonyms:od,deleteSynonym:pe,clearSynonyms:ad,replaceAllObjects:L4,replaceAllSynonyms:D4,searchRules:R0,getRule:ms,deleteRule:G,saveRule:j4,saveRules:dd,replaceAllRules:V4,browseRules:xa,clearRules:hs}})}},initAnalytics:function(){return function(z){return function(K){var te=K.region||"us",Y=p(b.WithinHeaders,K.appId,K.apiKey),ce=q(a(a({hosts:[{url:"analytics.".concat(te,".algolia.com")}]},K),{},{headers:a(a(a({},Y.headers()),{"content-type":"application/json"}),K.headers),queryParameters:a(a({},Y.queryParameters()),K.queryParameters)}));return h({appId:K.appId,transporter:ce},K.methods)}(a(a(a({},I),z),{},{methods:{addABTest:le,getABTest:Pe,getABTests:xe,stopABTest:ye,deleteABTest:Se}}))}},initPersonalization:W,initRecommendation:function(){return function(z){return H.logger.info("The `initRecommendation` method is deprecated. Use `initPersonalization` instead."),W()(z)}},getRecommendations:gs,getFrequentlyBoughtTogether:W4,getLookingSimilar:Y4,getRecommendedForYou:X4,getRelatedProducts:G4,getTrendingFacets:J4,getTrendingItems:Z4}}))}return L0.version="4.23.2",L0})})(w0);var l8=w0.exports;const c8=ZE(l8),C0=(e,t)=>{const o={};return e.forEach(r=>{const a=r.split(".");if(a.length!==t)return;const i=r.substring(0,r.lastIndexOf(".")),s=a[a.length-1];Object.keys(o).includes(i)?o[i].push(s):o[i]=[s]}),o};class v0{constructor(t,o,r="https://api.pennsieve.io"){this.client=c8(t,o),this.PENNSIEVE_API_LOCATION=r}initIndex(t){this.index=this.client.initIndex(t)}getAlgoliaFacets(t){const o=t.map(i=>i.facetPropPath),r=t.map(i=>i.facetSubpropPath),a=t.map(i=>i.facetSubsubpropPath).filter(i=>i!==void 0);return this.index.search("",{sortFacetValuesBy:"alpha",facets:o.concat(r).concat(a)}).then(i=>{let s=[],l=0;return o.map(c=>{const d=t.find(b=>b.facetPropPath==c);var u=[];const p=i.facets;if(p===void 0)return;const g=p[c]==null?{}:p[c],m=d&&p[d.facetSubpropPath]?Object.keys(p[d.facetSubpropPath]):[],f=d&&d.facetSubsubpropPath&&p[d.facetSubsubpropPath]?Object.keys(p[d.facetSubsubpropPath]):[],h=C0(m,2),y=C0(f,3);Object.keys(g).map(b=>{const E=[];Object.keys(h).includes(b)&&h[b].forEach(v=>{const S=`${b}.${v}`,x=[];Object.keys(y).includes(S)&&(y[S].forEach(T=>{x.push({label:T,id:l++,facetPropPath:`${d?d.facetSubsubpropPath:void 0}`})}),S==="nerves and ganglia.dorsal root ganglion"&&x.push({label:"Non specific",id:l++,facetPropPath:`${d?d.facetSubsubpropPath:void 0}`})),E.push({label:v,id:l++,facetPropPath:`${d?d.facetSubpropPath:void 0}`,children:x.length?x:void 0})});let O={label:b,id:l++,facetPropPath:c};E.length>0&&(O.children=E),u.push(O)}),u.length>0&&s.push({label:d?d.label:"",id:l++,children:u,key:c})}),s})}_discoverAllDois(t,o="https://api.pennsieve.io"){return new Promise(r=>{fetch(`${o}/discover/datasets/${t}/versions`).then(a=>a.json()).then(a=>{r(a.map(i=>i.doi))})})}_expandDois(t,o="https://api.pennsieve.io"){return new Promise(r=>{let a=t.map(i=>this._discoverAllDois(i,o));Promise.all(a).then(i=>{r(i.flat())})})}_processResultsForCards(t){let o=[],r={};for(let a of t)r={...a},r={anatomy:a.anatomy?a.anatomy.organ.map(i=>i.curie):void 0,doi:a.item.curie.split(":")[1],name:a.item.name,description:a.item.description,updated:a.pennsieve?a.pennsieve.updatedAt:void 0,publishDate:a.pennsieve?a.pennsieve.publishDate:void 0,datasetId:a.objectID,detailsReady:!1},o.push(r);return o}_processAnatomy(t){const o={};t.forEach(r=>{r.anatomy&&r.anatomy.organ&&r.anatomy.organ.forEach(a=>{a.curie&&(o[a.curie]=a.name)}),localStorage.setItem("available-name-curie-mapping",JSON.stringify(o))})}_processUberonURL(t){return t.split("/").pop().replace("_",":")}search(t,o="",r=10,a=1){return new Promise(i=>{this.index.search(o,{facets:["*"],hitsPerPage:r,page:a-1,filters:t,attributesToHighlight:[],attributesToRetrieve:["pennsieve.publishDate","pennsieve.updatedAt","item.curie","item.name","item.description","objectID","anatomy.organ.curie"]}).then(s=>{let l={items:this._processResultsForCards(s.hits),total:s.nbHits,discoverIds:s.hits.map(c=>c.pennsieve?c.pennsieve.identifier:c.objectID),dois:s.hits.map(c=>c.item.curie.split(":")[1])};i(l)})})}anatomyInSearch(t,o="",r=999999,a=1){return new Promise(i=>{this.index.search(o,{facets:["*"],hitsPerPage:r,page:a-1,filters:t,attributesToHighlight:[],attributesToRetrieve:["objectID","item.keywords.keyword","anatomy.organ.name","anatomy.organ.curie","anatomy.organ.subsubcategory.name"]}).then(s=>{i({forFlatmap:this.processResultsForFlatmap(s.facets,s.hits),forScaffold:this.processResultsForScaffold(s.hits)})})})}setLocalStorageForTermMapping(){return new Promise(t=>{this.index.search("",{facets:["*"],hitsPerPage:999999,page:0,attributesToHighlight:[],attributesToRetrieve:["objectID","item.keywords.keyword","anatomy.organ.name","anatomy.organ.curie"]}).then(o=>{this._processAnatomy(o.hits)})})}processResultsForFlatmap(t,o){const r=this.filterAvailableAnatomies(t);return o.map(i=>({id:i.objectID,terms:i.anatomy?i.anatomy.organ.map(l=>{if(r.includes(l.name.toLowerCase()))return l.curie}).filter(Boolean):[]}))}filterAvailableAnatomies(t){const o=t["anatomy.organ.name"],r=t["anatomy.organ.category.name"],a=t["anatomy.organ.subcategory.name"],i=t["anatomy.organ.subsubcategory.name"],s=o?Object.keys(o):[],l=r?Object.keys(r):[],c=a?Object.keys(a):[],d=i?Object.keys(i):[],u=[];return l.forEach(p=>{const g=p.toLowerCase();s.forEach(m=>{const f=m.toLowerCase(),h=`${g}.${f}`;c.some(b=>{const E=b.toLowerCase();return E===h?!0:d.find(O=>`${E}.${f}`===O)})&&u.push(f)})}),u}processResultsForScaffold(t){let o={};return t.forEach(r=>{r.anatomy&&r.anatomy.organ&&r.anatomy.organ.forEach(a=>{a.name&&(o[a.name]?o[a.name]++:o[a.name]=1)})}),o}}const Qc=[{label:"Data Type",id:"item.types",facetPropPath:"item.types.name",facetSubpropPath:"item.types.subcategory.name"},{label:"Anatomical Structure",id:"anatomy.organ.category",facetPropPath:"anatomy.organ.category.name",facetSubpropPath:"anatomy.organ.subcategory.name",facetSubsubpropPath:"anatomy.organ.subsubcategory.name",facetFilterPath:"anatomy.organ.name"},{label:"Species",id:"organisms.primary.species",facetPropPath:"organisms.primary.species.name",facetSubpropPath:"organisms.primary.species.subcategory.name"},{label:"Experimental Approach",id:"item.modalities",facetPropPath:"item.modalities.keyword",facetSubpropPath:"item.modalities.subcategory.name"},{label:"Sex",id:"attributes.subject.sex",facetPropPath:"attributes.subject.sex.value",facetSubpropPath:"attributes.subject.sex.subcategory.name"},{label:"Age Categories",id:"attributes.subject.ageCategory",facetPropPath:"attributes.subject.ageCategory.value",facetSubpropPath:"attributes.subject.ageCategory.subcategory.name"},{label:"Consortia",id:"supportingAwards.consortium",facetPropPath:"supportingAwards.consortium.name",facetSubpropPath:"supportingAwards.consortium.subcategory.name"}];function k0(e=void 0){if(e===void 0)return"NOT item.published.status:embargo";e.forEach(a=>{a.label=a.facet3?a.facet3:a.facet2?a.facet2:a.facet});let t=S0(e);t.forEach(a=>{a.facet3&&a.facet3==="Non specific"&&(a.label=a.facet2)});let o="NOT item.published.status:embargo";return o=`(${o}) AND `,Qc.map(a=>[a.facetPropPath,a.facetFilterPath]).map(([a,i])=>{let s=t.filter(d=>d.facetPropPath==a),l="",c="";s.map(d=>{let u=d.facetSubPropPath?d.facetSubPropPath:i||a;d.AND?c+=`AND "${u}":"${d.label}"`:l+=`"${u}":"${d.label}" OR `}),!(l==""&&c=="")&&(l=`(${l.substring(0,l.lastIndexOf(" OR "))})`,o+=`${l+c} AND `,o=o.split("()AND ").join(""))}),o.substring(0,o.lastIndexOf(" AND "))}function S0(e){return e.filter(t=>t.label!=="Show all")}const va=function(e){return e.charAt(0).toUpperCase()+e.slice(1)},E0=function(e){const t=e.toLowerCase();return ds[t]?va(ds[t]):e===e.toUpperCase()?e:va(t)},d8={name:"SearchFilters",components:{MapSvgIcon:$y,MapSvgSpriteColor:b0,Option:Fl,Select:fi,Popover:Kr,Cascader:Tp},props:{entry:Object,envVars:{type:Object,default:()=>{}}},data:function(){return{algoliaClient:void 0,cascaderIsReady:!1,previousShowAllChecked:{species:!1,gender:!1,organ:!1,datasets:!1},showFiltersText:!0,cascadeSelected:[],cascadeSelectedWithBoolean:[],filterTimeout:null,numberShown:10,filters:[],facets:["Species","Gender","Organ","Datasets"],numberDatasetsShown:["10","20","50"],cascaderProps:{multiple:!0},options:[{value:"Species",label:"Species",children:[{}]}],presentTags:[],searchInputs:{}}},setup(){const e=n.markRaw({}),t=n.markRaw({term:new Set,facet:new Set,facet2:new Set,facet3:new Set});return{cascaderTags:e,correctnessCheck:t}},computed:{numberOfResultsText:function(){return`${this.entry.numberOfHits} results | Showing`},showFilters:function(){return this.entry.showFilters}},watch:{entry:{deep:!0,immediate:!0,handler:function(e,t){JSON.stringify(e==null?void 0:e.options)!==JSON.stringify(t==null?void 0:t.options)&&(this.options=[],this.filters=[],this.cascaderIsReady=!1,this.populateCascader().then(()=>{this.cascaderIsReady=!0,this.options.length&&(this.checkShowAllBoxes(),this.cssMods(),this.$emit("cascaderReady"))}))}}},methods:{createCascaderItemValue:function(e){let t;if(e!=null&&e.length){t=e[0];for(let o=1;e.length>o;o++)t=`${t}>${e[o]}`;t.includes("undefined")&&console.warn("Warning: One or more of the facets is undefined, this will not be shown in the cascader")}return t},createChildrenCascaderValue:function(e,t,o){if(e!=null&&e.length)for(let r=0;r<e.length;r++){const a=e[r];if(e[r].facetPropPath!=="supportingAwards.consortium.name"&&(e[r].label=E0(a.label)),a.key&&t.key.includes("flatmap.connectivity.source.")){const i=a.key,s=t.key,l=i.replace(`${s}.`,"");e[r].value=this.createCascaderItemValue([t.label,l])}else{const i=o.slice();i.push(a.label),e[r].value=this.createCascaderItemValue(i),this.createChildrenCascaderValue(a.children,t,i)}}},getNodeKey:function(e){return e?e.split(">")[1]:""},isFlatmapConnectionsNode:function(e){return e.pathValues[0].includes("flatmap.connectivity.source")&&e.isLeaf},isFlatmapConnectionsFilterNode:function(e){return e.pathValues[0].includes("flatmap.connectivity.source")&&e.pathLabels.includes("Filters")&&e.isDisabled&&e.isLeaf},processOptions:function(){const e=JSON.parse(JSON.stringify(this.options));e.forEach((t,o)=>{e[o].total=this.countTotalFacet(t),e[o].label=E0(t.label),e[o].value=this.createCascaderItemValue([t.key]),e[o].children.find(r=>r.label==="Show all")||e[o].children.unshift({value:this.createCascaderItemValue(["Show all"]),label:"Show all"}),t.key.includes("flatmap.connectivity.source")&&e[o].children.unshift({value:this.createCascaderItemValue(["ConnectivityFilters"]),label:"Filters",disabled:!0}),this.createChildrenCascaderValue(e[o].children,t,[t.label])}),Object.assign(this.options,e)},populateCascader:function(){return this.entry.options?new Promise(e=>{this.facets=this.entry.options,this.options=this.entry.options,this.processOptions(),e()}):new Promise(e=>{this.algoliaClient.getAlgoliaFacets(Qc).then(t=>{this.facets=t,fe.emit("available-facets",t),this.options=t,this.processOptions()}).finally(()=>{e()})})},isConnectivityTag:function(e){return/^[A-Za-z]:/.test(e)},getConnectivityTag:function(e){const t=e.indexOf(":");return t!==-1?e.substring(t+1):e},modifyCascaderTagStyle:function(e){return this.isConnectivityTag(e)?"connectivity-tag":""},flattenToEvents:function(e,t,o,r=void 0){const a=[];for(const[i,s]of Object.entries(t)){const l=o.find(c=>c.label===i);if(Object.entries(s).length){const c=l.key||r,d=this.flattenToEvents(e,s,l.children,c);a.push(...d)}else i!==e&&a.push([r,l.value])}return a},cascadeTagClose:function(e){const t=this.isConnectivityTag(e)?this.getConnectivityTag(e):e,o=this.flattenToEvents(t,this.cascaderTags,this.options);this.cascadeEvent(o)},flattenToTags:function(e){const t=[];for(const[o,r]of Object.entries(e))if(Object.entries(r).length){const a=this.flattenToTags(r);t.push(...a)}else o!=="Show all"&&t.push(o);return t},tagsChangedCallback:function(e){this.correctnessCheck.term&&this.correctnessCheck.facet&&this.correctnessCheck.facet2&&this.correctnessCheck.facet3&&this.options.map(t=>{var o;this.correctnessCheck.term.add(t.label),(o=t.children)==null||o.map(r=>{var a;this.correctnessCheck.facet.add(r.label),(a=r.children)==null||a.map(i=>{var s;this.correctnessCheck.facet2.add(i.label),(s=i.children)==null||s.map(l=>{this.correctnessCheck.facet3.add(l.label)})})})}),this.cascaderTags={},this.cascaderTagsClone={},this.presentTags=[],e.map(t=>{const{facet:o,facet2:r,facet3:a,term:i,tagLabel:s,facetPropPath:l}=t;let c=o,d="";l&&l.includes("flatmap.connectivity.source.")&&s&&(c=s,d=i.charAt(0)),i&&this.correctnessCheck.term.has(i)&&(i in this.cascaderTags||(this.cascaderTags[i]={},this.cascaderTagsClone[i]={}),c&&this.correctnessCheck.facet.has(c)&&(c in this.cascaderTags[i]||(this.cascaderTags[i][c]={},d?this.cascaderTagsClone[i][d+":"+c]={}:this.cascaderTagsClone[i][c]={}),r&&this.correctnessCheck.facet2.has(r)&&(r in this.cascaderTags[i][c]||(this.cascaderTags[i][c][r]={},this.cascaderTagsClone[i][c][r]={}),a&&this.correctnessCheck.facet3.has(a)&&(a in this.cascaderTags[i][c][r]||(this.cascaderTags[i][c][r][a]={},this.cascaderTagsClone[i][c][r][a]={})))))}),this.presentTags=[...this.presentTags,...this.flattenToTags(this.cascaderTagsClone)],this.presentTags=[...new Set(this.presentTags)].sort(),this.presentTags.length>0?this.showFiltersText=!1:this.showFiltersText=!0},countTotalFacet:function(e){return["anatomy.organ.category.name"].includes(e.key)?e.children.reduce((o,r)=>(o=typeof o=="number"?o:o.children.length,o+r.children.length)):e.children.length},showAllEventModifierForAutoCheckAll:function(e){const t={};return e.map(o=>{const r=o[0];r in t?t[r]+=1:t[r]=1}),this.options.map(o=>{const r=o.key,a=o.children.filter(s=>s.label==="Show all")[0].value,i=o.total;t[r]===i&&(e=e.filter(s=>s[0]!==o.key),delete t[r]),r in t||e.unshift([r,a])}),e},cascadeEvent:function(e){let t=[...e];if(t){t=this.showAllEventModifier(t),t=this.showAllEventModifierForAutoCheckAll(t);const o=this.$refs.cascader,a=(o==null?void 0:o.getCheckedNodes(!0)).filter(l=>l.checked&&l.label!=="Show all");if(this.__expandItem__){let l=0;this.__expandItem__.length>1&&(l=1);const c=t.filter(u=>u[l]==this.__expandItem__[l]),d=t.filter(u=>u[l]!==this.__expandItem__[l]);t=[...c,...d]}let i=t.filter(l=>l!==void 0).map(l=>{let{hString:c,bString:d}=this.findHierarachyStringAndBooleanString(l),{facet:u,facet2:p,facet3:g,term:m}=this.getFacetsFromHierarchyString(c);const f=a.find(y=>l.join()===y.pathValues.join()),h=f?f.label:void 0;return{facetPropPath:l[0],facet:u,facet2:p,facet3:g,term:m,AND:d,tagLabel:h}}),s=t.filter(l=>l!==void 0).map(l=>{let c=l[0].includes("duplicate")?l[0].split("duplicate")[0]:l[0],{hString:d,bString:u}=this.findHierarachyStringAndBooleanString(l),{facet:p,facet2:g,facet3:m,term:f}=this.getFacetsFromHierarchyString(d);m?m==="Non specific"?p=g:p=m:g&&(p=g);const h=a.find(b=>l.join()===b.pathValues.join()),y=h?h.label:void 0;return{facetPropPath:c,facet:p,term:f,AND:u,tagLabel:y}});this.filterTimeout&&clearTimeout(this.filterTimeout),this.$emit("loading",!0),this.setCascader(i),this.filterTimeout=setTimeout(()=>{this.$emit("filterResults",s),this.cssMods()},600)}},findHierarachyStringAndBooleanString(e){let t,o;const r=e.length;return r>=3?e[r-1]&&(typeof e[r-1]=="string"||e[r-1]instanceof String)&&e[r-1].split(">").length>2?t=e[r-1]:t=e[r-2]:t=e[1],r>=3&&typeof e[r-1]=="boolean"&&(o=e[r-1]),{hString:t,bString:o}},getFacetsFromHierarchyString(e){let t=e.split(">");return{term:t[0],facet:t[1],facet2:t[2],facet3:t[3]}},showAllEventModifier:function(e){if(e.map(o=>o?o[1].toLowerCase().includes("show all"):!1).includes(!0)){let o=[],r={};for(const a in e)r[e[a][0]]===void 0&&(r[e[a][0]]=[]),r[e[a][0]].push(e[a]);for(const a in r){let i;for(let s=r[a].length-1;s>=0;s--)if(r[a][s][1].toLowerCase().includes("show all")){i=r[a].splice(s,1)[0];break}i?this.previousShowAllChecked[a]&&r[a].length>0?o.push(...r[a]):o.push(i):o.push(...r[a])}return o.sort((a,i)=>this.__expandItem__?a[0]==this.__expandItem__?i[0]==this.__expandItem__?0:-1:i[0]==this.__expandItem__?a[0]==this.__expandItem__?0:1:0:0)}return e},cascadeExpandChange:function(e){this.__expandItem__=e,this.__expandItem__&&this.updateListFilters(this.__expandItem__[0]),this.updateListStyleOrder(),this.cssMods()},updateListStyleOrder:function(){this.$nextTick(()=>{const e=this.$refs.cascader,t=e==null?void 0:e.contentRef;if(t){const o=t.querySelectorAll(".el-cascader-menu__list");o&&o.forEach(r=>{r.querySelector(".sidebar-cascader-search")?r.classList.add("cascader-menu-with-search"):r.classList.remove("cascader-menu-with-search")})}})},searchInputChange:function(e,t){e.preventDefault();const{target:o}=e;if(o){const r=o.value,a=t.pathValues[0];this.searchInputs[a]=r,this.updateListFilters(a)}},searchInputFocusToggle:function(e,t){const{target:o}=e;if(!o)return;const r=o.closest(".el-input__wrapper");t===!0?r.classList.add("is-focus"):r.classList.remove("is-focus")},updateListFilters:function(e){const t=this.searchInputs[e]||"";this.$nextTick(()=>{const o=this.$refs["searchInput_"+e];if(!o)return;o.closest(".el-cascader-menu__list").querySelectorAll(".el-cascader-node").forEach((a,i)=>{i>1&&(a.querySelector(".el-cascader-node__label").textContent.toLowerCase().includes(t.toLowerCase())?a.classList.remove("hide"):a.classList.add("hide"))}),t&&o.focus()})},numberShownChanged:function(e){this.$emit("numberPerPage",parseInt(e))},updatePreviousShowAllChecked:function(e){for(const t in this.previousShowAllChecked)this.previousShowAllChecked[t]=!1;e.forEach(t=>{t[1].toLowerCase().includes("show all")&&(this.previousShowAllChecked[t[0]]=!0)})},setCascader:function(e){if(this.cascaderIsReady&&e&&e.length!=0){const t=o=>{let r=[o.facetPropPath,this.createCascaderItemValue([va(o.term),o.facet])];return o.facet2&&(r.push(this.createCascaderItemValue([va(o.term),o.facet,o.facet2])),o.facet3&&r.push(this.createCascaderItemValue([va(o.term),o.facet,o.facet2,o.facet3]))),r};this.cascadeSelected=e.map(o=>t(o)),this.cascadeSelectedWithBoolean=e.map(o=>{let r=t(o);return r.push(o.AND),r}),this.updatePreviousShowAllChecked(this.cascadeSelected)}this.tagsChangedCallback(e)},addFilter:function(e){if(this.cascaderIsReady&&e){let t=this.validateAndConvertFilterToHierarchical(e);if(t&&t.length)return t.forEach(o=>{this.cascadeSelected.filter(a=>a.term!=o.term);const r=[o.facetPropPath,this.createCascaderItemValue([o.term,o.facet]),this.createCascaderItemValue([o.term,o.facet,o.facet2])];o.facet3&&r.push(this.createCascaderItemValue([o.term,o.facet,o.facet2,o.facet3])),this.cascadeSelected.push([...r]),this.cascadeSelectedWithBoolean.push([...r,o.AND])}),!0}},addFilters:function(e){let t=!1;return this.cascaderIsReady&&e.forEach(o=>{t=t||this.addFilter(o)}),t},initiateSearch:function(){this.cascadeEvent(this.cascadeSelectedWithBoolean)},checkShowAllBoxes:function(){this.setCascader(this.options.map(e=>({facetPropPath:e.value,term:e.label,facet:"Show all"})))},makeCascadeLabelsClickable:function(){this.$nextTick(()=>{document.querySelectorAll(".sidebar-cascader-popper .el-cascader-node__label").forEach(e=>{e.onclick=function(){const t=this.previousElementSibling;t&&(t.parentElement.attributes["aria-owns"]||this.previousElementSibling.click())}})})},cssMods:function(){this.makeCascadeLabelsClickable()},flattenToFilters:function(e,t,o=!1){let r=[];if(t){const a=e.facet.toLowerCase();let i=!1;for(const s of t){const l=e.facetPropPath.includes("flatmap.connectivity.source.")&&s.key,c=l?s.key.replace(`${e.facetPropPath}.`,"").toLowerCase()===a:s.label.toLowerCase()===a;if(s.children&&s.children.length){const d=c||o,u=this.flattenToFilters(e,s.children,d);r.push(...u)}else if(s.facetPropPath||s.key){const[d,u,p,g]=s.value.split(">");g==="Non specific"&&(i=!0);const m={term:d,facet:u,facetPropPath:e.facetPropPath,...p&&{facet2:p},...g&&{facet3:g}};"AND"in e&&(m.AND=e.AND),(o||c)&&(l?r.push(e):r.push(m))}}o&&i&&(r=r.filter(s=>!s.facet3||s.facet3==="Non specific"))}return r},validateAndConvertFilterToHierarchical:function(e){if(e&&e.facet&&e.term){if(e.facet2||e.facet3)return[e];{const t=this.options.find(o=>o.label===e.term);if(t)return this.flattenToFilters(e,t.children)}}},getHierarchicalValidatedFilters:function(e){const t=[],o=[],r=[];if(e){if(!this.cascaderIsReady)return{result:e,notFound:r};e.forEach(a=>{const i=this.validateAndConvertFilterToHierarchical(a);i&&i.length?i.forEach(s=>{t.push(s),o.push(s.term)}):this.options.find(l=>l.key===a.facetPropPath)&&r.push(a)}),this.options.forEach(a=>{o.includes(a.label)||t.push({facet:"Show all",facetPropPath:a.key,label:"Show all",term:a.label})})}return{result:t,notFound:r}},hasLineStyles:function(e){return"colour"in e&&e.colourStyle==="line"},getLineStyles:function(e){return"colour"in e&&e.colourStyle==="line"?"dashed"in e&&e.dashed===!0?{background:`repeating-linear-gradient(90deg,${e.colour},${e.colour} 6px,transparent 0,transparent 9px)`}:{background:e.colour}:{display:"None"}},getBackgroundStyles:function(e){return"colour"in e&&e.colourStyle==="background"?{background:e.colour}:{}}},mounted:function(){this.entry.options||(this.algoliaClient=n.markRaw(new v0(this.envVars.ALGOLIA_ID,this.envVars.ALGOLIA_KEY,this.envVars.PENNSIEVE_API_LOCATION)),this.algoliaClient.initIndex(this.envVars.ALGOLIA_INDEX),this.algoliaClient.setLocalStorageForTermMapping()),this.populateCascader().then(()=>{this.cascaderIsReady=!0,this.checkShowAllBoxes(),this.setCascader(this.entry.filterFacets),this.cssMods(),this.$emit("cascaderReady")})}},u8={class:"filters"},f8={key:0},p8={key:0,class:"cascader-tag"},h8={class:"el-tags-container"},m8={class:"el-tags-container"},g8={class:"search-filters transition-box"},y8={key:0},b8={class:"sidebar-cascader-search el-input"},w8={class:"el-input__wrapper"},C8=["value","onInput"],v8={key:1},k8={key:0,class:"sr-only"},S8={key:0,class:"filter-default-value"},E8={class:"dataset-shown"},x8={class:"dataset-results-feedback"};function _8(e,t,o,r,a,i){const s=n.resolveComponent("MapSvgSpriteColor"),l=bo,c=Kr,d=Tl,u=_l,p=Tp,g=n.resolveComponent("MapSvgIcon"),m=Fl,f=fi,h=Yo;return n.openBlock(),n.createElementBlock("div",u8,[n.createVNode(s),i.showFilters&&e.options.length>0?(n.openBlock(),n.createElementBlock("div",f8,[e.presentTags.length>0?(n.openBlock(),n.createElementBlock("div",p8,[n.createVNode(l,{class:"ml-2",type:"info",closable:"",onClose:t[0]||(t[0]=y=>i.cascadeTagClose(e.presentTags[0]))},{default:n.withCtx(()=>[n.createElementVNode("span",{class:n.normalizeClass(["tag-text",i.modifyCascaderTagStyle(e.presentTags[0])])},n.toDisplayString(e.presentTags[0]),3)]),_:1}),e.presentTags.length>1?(n.openBlock(),n.createBlock(c,{key:0,placement:"bottom-start",width:250,trigger:"hover","popper-class":"cascade-tags-popover"},{default:n.withCtx(()=>[n.createElementVNode("div",h8,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.presentTags.slice(1),(y,b)=>(n.openBlock(),n.createBlock(l,{key:b,class:n.normalizeClass(["ml-2",i.modifyCascaderTagStyle(y)]),type:"info",closable:"",onClose:E=>i.cascadeTagClose(y)},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(y),1)]),_:2},1032,["class","onClose"]))),128))])]),reference:n.withCtx(()=>[n.createElementVNode("div",m8,[e.presentTags.length>1?(n.openBlock(),n.createBlock(l,{key:0,class:"ml-2",type:"info"},{default:n.withCtx(()=>[n.createTextVNode(" +"+n.toDisplayString(e.presentTags.length-1),1)]),_:1})):n.createCommentVNode("",!0)])]),_:1})):n.createCommentVNode("",!0)])):n.createCommentVNode("",!0),n.createVNode(n.Transition,{name:"el-zoom-in-top"},{default:n.withCtx(()=>[n.withDirectives((n.openBlock(),n.createElementBlock("span",g8,[n.createVNode(p,{class:"cascader",ref:"cascader",modelValue:e.cascadeSelected,"onUpdate:modelValue":t[3]||(t[3]=y=>e.cascadeSelected=y),size:"large",placeholder:" ","collapse-tags":!0,"collapse-tags-tooltip":"",options:e.options,props:e.cascaderProps,onChange:t[4]||(t[4]=y=>i.cascadeEvent(y)),onExpandChange:i.cascadeExpandChange,"show-all-levels":!0,"popper-class":"sidebar-cascader-popper"},{default:n.withCtx(({node:y,data:b})=>[i.isFlatmapConnectionsFilterNode(y)?(n.openBlock(),n.createElementBlock("div",y8,[n.createElementVNode("div",b8,[n.createElementVNode("div",w8,[n.createElementVNode("input",{class:"el-input__inner",ref:"searchInput_"+y.pathValues[0],value:e.searchInputs[y.pathValues[0]],onInput:E=>i.searchInputChange(E,y),onFocus:t[1]||(t[1]=E=>i.searchInputFocusToggle(E,!0)),onBlur:t[2]||(t[2]=E=>i.searchInputFocusToggle(E,!1)),style:{width:"100%"},autocomplete:"off",placeholder:"Search"},null,40,C8)])])])):(n.openBlock(),n.createElementBlock("div",v8,[n.createVNode(u,null,{default:n.withCtx(()=>[i.hasLineStyles(b)?(n.openBlock(),n.createBlock(d,{key:0,span:4},{default:n.withCtx(()=>[n.createElementVNode("div",{class:"path-visual",style:n.normalizeStyle(i.getLineStyles(b))},null,4)]),_:2},1024)):n.createCommentVNode("",!0),n.createVNode(d,{span:20},{default:n.withCtx(()=>[i.isFlatmapConnectionsNode(y)?(n.openBlock(),n.createElementBlock("span",k8,n.toDisplayString(i.getNodeKey(y.value)),1)):n.createCommentVNode("",!0),n.createElementVNode("div",{style:n.normalizeStyle(i.getBackgroundStyles(b))},n.toDisplayString(b.label),5)]),_:2},1024)]),_:2},1024)]))]),_:1},8,["modelValue","options","props","onExpandChange"]),e.showFiltersText?(n.openBlock(),n.createElementBlock("div",S8,"Filters")):n.createCommentVNode("",!0),n.createVNode(c,{title:"How do filters work?",width:"250",trigger:"hover","popper-class":"filter-help-popover"},{reference:n.withCtx(()=>[n.createVNode(g,{icon:"help",class:"help"})]),default:n.withCtx(()=>[n.createElementVNode("div",null,[t[7]||(t[7]=n.createElementVNode("strong",null,"Within categories:",-1)),t[8]||(t[8]=n.createTextVNode(" OR ")),t[9]||(t[9]=n.createElementVNode("br",null,null,-1)),n.createTextVNode(" example: "+n.toDisplayString(o.entry.helper.within)+" ",1),t[10]||(t[10]=n.createElementVNode("br",null,null,-1)),t[11]||(t[11]=n.createElementVNode("br",null,null,-1)),t[12]||(t[12]=n.createElementVNode("strong",null,"Between categories:",-1)),t[13]||(t[13]=n.createTextVNode(" AND ")),t[14]||(t[14]=n.createElementVNode("br",null,null,-1)),n.createTextVNode(" example: "+n.toDisplayString(o.entry.helper.between),1)])]),_:1})])),[[h,!e.cascaderIsReady]])]),_:1})])):n.createCommentVNode("",!0),n.createElementVNode("div",E8,[n.createElementVNode("span",x8,n.toDisplayString(i.numberOfResultsText),1),n.createVNode(f,{class:"number-shown-select",modelValue:e.numberShown,"onUpdate:modelValue":t[5]||(t[5]=y=>e.numberShown=y),placeholder:"10",onChange:t[6]||(t[6]=y=>i.numberShownChanged(y))},{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.numberDatasetsShown,y=>(n.openBlock(),n.createBlock(m,{key:y,label:y,value:y},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])])])}const fs=Jt(d8,[["render",_8],["__scopeId","data-v-5ccdbcd9"]]);var T8=async function(e){if(!e.ok){let t=await e.json();throw t?new Error(t.message):new Error(e)}return e},O8={searchInput:"",lastSearch:"",results:[],numberOfHits:0,filter:[],loadingCards:!1,numberPerPage:10,page:1,pageModel:1,start:0,hasSearched:!1,contextCardEnabled:!1};const B8={components:{SearchFilters:fs,DatasetCard:Ay,SearchHistory:us,Button:pt,Card:li,Drawer:Ol,Icon:ke,Input:Ko,Pagination:pi},name:"DatasetExplorer",props:{visible:{type:Boolean,default:!1},isDrawer:{type:Boolean,default:!0},entry:{type:Object,default:()=>O8},envVars:{type:Object,default:()=>{}}},data:function(){return{...this.entry,algoliaClient:void 0,bodyStyle:{flex:"1 1 auto","flex-flow":"column",display:"flex"},cascaderIsReady:!1}},computed:{filterEntry:function(){return{numberOfHits:this.numberOfHits,filterFacets:this.filter,showFilters:!0,helper:{within:"'heart' OR 'colon'",between:"'rat' AND 'lung'"}}}},methods:{hoverChanged:function(e){const t=e?{...e,tabType:"dataset"}:{tabType:"dataset"};this.$emit("hover-changed",t)},resetSearch:function(){this.numberOfHits=0,this.discoverIds=[],this._dois=[],this.results=[],this.loadingCards=!1},openSearch:function(e,t=""){if(this.searchInput=t,this.resetPageNavigation(),this.cascaderIsReady){const o=this.$refs.filtersRef.getHierarchicalValidatedFilters(e),r=o.notFound?o.notFound.filter(a=>a.facet.toLowerCase()!=="show all"):[];this.filter=o.result,r.forEach(a=>{Qp({message:`${a.facet} cannot be found in ${a.term}!`,appendTo:this.$el,showClose:!0,offset:113})}),e&&e.length>0&&this.filter&&this.filter.length===0?(this.$refs.filtersRef.checkShowAllBoxes(),this.resetSearch()):this.filter&&(this.searchAlgolia(this.filter,t),this.$refs.filtersRef.setCascader(this.filter),this.searchHistoryUpdate(this.filter,t))}else this.filter=e,(!e||e.length==0)&&(this.searchAlgolia(this.filter,t),this.searchHistoryUpdate(this.filter,t))},addFilter:function(e){this.cascaderIsReady?(this.resetPageNavigation(),e&&this.$refs.filtersRef.addFilters(e)&&this.$refs.filtersRef.initiateSearch()):Array.isArray(this.filter)?this.filter.push(...e):this.filter=[...e]},cascaderReady:function(){this.cascaderIsReady=!0,this.openSearch(this.filter,this.searchInput)},clearSearchClicked:function(){this.searchInput="",this.searchAndFilterUpdate()},onResetClick:function(){this.openSearch([],""),this.$emit("search-changed",{value:this.searchInput,tabType:"dataset",type:"reset-update"}),fe.emit("trackEvent",{event_name:"portal_maps_action_filter",category:"reset",location:"map_sidebar_dataset"})},searchEvent:function(e=!1){(e.keyCode===13||e instanceof MouseEvent)&&(this.searchInput=this.searchInput.trim(),this.searchAndFilterUpdate())},filterUpdate:function(e){this.filter=[...e],this.searchAndFilterUpdate(),this.$emit("search-changed",{value:e,tabType:"dataset",type:"filter-update"})},searchAndFilterUpdate:function(){this.resetPageNavigation(),this.searchAlgolia(this.filter,this.searchInput),this.searchHistoryUpdate(this.filter,this.searchInput)},searchHistoryUpdate:function(e,t){this.$refs.searchHistory.selectValue="Search history",(e.length||t!=null&&t.trim())&&this.$refs.searchHistory.addSearchToHistory(e,t)},searchAlgolia(e,t=""){this.loadingCards=!0,this.algoliaClient.anatomyInSearch(k0(e),t).then(o=>{fe.emit("anatomy-in-datasets",o.forFlatmap),fe.emit("number-of-datasets-for-anatomies",o.forScaffold)}),this.algoliaClient.search(k0(e),t,this.numberPerPage,this.page).then(o=>{this.numberOfHits=o.total,this.discoverIds=o.discoverIds,this._dois=o.dois,this.results=o.items,this.loadingCards=!1,this.scrollToTop(),this.$emit("search-changed",{value:this.searchInput,tabType:"dataset",type:"query-update"}),this._abortController&&this._abortController.abort(),this._abortController=new AbortController;const r=this._abortController.signal;this.perItemSearch(r,{count:0})})},filtersLoading:function(e){this.loadingCards=e},numberPerPageUpdate:function(e){this.numberPerPage=e,fe.emit("trackEvent",{event_name:"portal_maps_dataset_perPage",category:e+"",location:"map_sidebar_dataset"});const t=this.page===1;this.pageChange(1,t)},pageChange:function(e,t=!1){this.start=(e-1)*this.numberPerPage,this.page=e,this.searchAlgolia(this.filter,this.searchInput,this.numberPerPage,this.page),t||fe.emit("trackEvent",{event_name:"portal_maps_dataset_pagination",category:`page_${this.page}`,location:"map_sidebar_dataset"})},handleMissingData:function(e){let t=this.results.findIndex(o=>o.doi===e);this.results[t]&&(this.results[t].detailsReady=!0)},perItemSearch:function(e,t){if(10>t.count){const r=this._dois.shift();r&&(t.count++,this.callSciCrunch(this.envVars.API_LOCATION,{dois:[r]},e).then(a=>{a.numberOfHits===0?this.handleMissingData(r):this.resultsProcessing(a),this.$refs.content.style["overflow-y"]="scroll",t.count--,this.perItemSearch(e,t)}).catch(a=>{a.name!=="AbortError"&&(this.handleMissingData(r),t.count--,this.perItemSearch(e,t))}),this.perItemSearch(e,t))}},scrollToTop:function(){this.$refs.content&&this.$refs.content.scroll({top:0,behavior:"smooth"})},resetPageNavigation:function(){this.start=0,this.page=1},resultsProcessing:function(e){this.lastSearch=this.searchInput,e.results.length!==0&&e.results.forEach(t=>{let o=this.results.findIndex(r=>t.doi?t.doi.includes(r.doi):!1);Object.assign(this.results[o],t),Object.assign(this.results[o],{numberSamples:t.sampleSize?parseInt(t.sampleSize):0,numberSubjects:t.subjectSize?parseInt(t.subjectSize):0,updated:(t.updated&&t.updated.length)>0?t.updated[0].timestamp.split("T")[0]:"",url:t.uri[0],datasetId:t.dataset_identifier,datasetRevision:t.dataset_revision,datasetVersion:t.dataset_version,organs:t.organs&&t.organs.length>0?[...new Set(t.organs.map(r=>r.name))]:void 0,species:t.organisms&&t.organisms[0].species?[...new Set(t.organisms.map(r=>r.species?r.species.name:null))]:void 0,scaffolds:t["abi-scaffold-metadata-file"],thumbnails:t["abi-thumbnail"]?t["abi-thumbnail"]:t["abi-scaffold-thumbnail"],scaffoldViews:t["abi-scaffold-view-file"],videos:t.video,plots:t["abi-plot"],images:t["common-images"],contextualInformation:t["abi-contextual-information"].length>0?t["abi-contextual-information"]:void 0,segmentation:t["mbf-segmentation"],simulation:t["abi-simulation-omex-file"]?t["abi-simulation-omex-file"]:t["abi-simulation-file"],flatmaps:t["abi-flatmap-file"],additionalLinks:t.additionalLinks,detailsReady:!0}),this.results[o]=this.results[o]})},createfilterParams:function(e){let t=new URLSearchParams;for(const o in e)Array.isArray(e[o])?e[o].forEach(r=>{t.append(o,r)}):t.append(o,e[o]);return t.toString()},callSciCrunch:function(e,t={},o){return new Promise((r,a)=>{let i=this.envVars.API_LOCATION+this.searchEndpoint+"?"+this.createfilterParams(t);fetch(i,{signal:o}).then(T8).then(s=>s.json()).then(s=>r(s)).catch(s=>a(s))})},getAlgoliaFacets:async function(){return await this.algoliaClient.getAlgoliaFacets(Qc)},searchHistorySearch:function(e){this.searchInput=e.search,this.filter=e.filters,this.openSearch([...e.filters],e.search)},getSearch:function(){return this.searchInput},getFilters:function(){return this.filter.some(t=>t.facet.toLowerCase()!=="show all")?this.filter:[]}},mounted:function(){this.algoliaClient=n.markRaw(new v0(this.envVars.ALGOLIA_ID,this.envVars.ALGOLIA_KEY,this.envVars.PENNSIEVE_API_LOCATION)),this.algoliaClient.initIndex(this.envVars.ALGOLIA_INDEX),this.openSearch(this.filter,this.searchInput)},created:function(){this.searchEndpoint="dataset_info/using_multiple_dois/"}},N8={class:"header"},I8={class:"content scrollbar",ref:"content"},A8={key:0,class:"error-feedback"};function F8(e,t,o,r,a,i){const s=Ko,l=pt,c=fs,d=us,u=Ay,p=pi,g=li,m=Yo;return n.openBlock(),n.createBlock(g,{"body-style":e.bodyStyle,class:"content-card"},{header:n.withCtx(()=>[n.createElementVNode("div",N8,[n.createVNode(s,{class:"search-input",placeholder:"Search",modelValue:e.searchInput,"onUpdate:modelValue":t[0]||(t[0]=f=>e.searchInput=f),onKeyup:i.searchEvent,clearable:"",onClear:i.clearSearchClicked},null,8,["modelValue","onKeyup","onClear"]),n.createVNode(l,{type:"primary",class:"button",onClick:i.searchEvent,size:"large"},{default:n.withCtx(()=>t[3]||(t[3]=[n.createTextVNode(" Search ")])),_:1},8,["onClick"]),n.createVNode(l,{link:"",class:"el-button-link",onClick:i.onResetClick,size:"large"},{default:n.withCtx(()=>t[4]||(t[4]=[n.createTextVNode(" Reset ")])),_:1},8,["onClick"])])]),default:n.withCtx(()=>[n.createVNode(c,{class:"filters",ref:"filtersRef",entry:i.filterEntry,envVars:o.envVars,onFilterResults:i.filterUpdate,onNumberPerPage:i.numberPerPageUpdate,onLoading:i.filtersLoading,onCascaderReady:i.cascaderReady},null,8,["entry","envVars","onFilterResults","onNumberPerPage","onLoading","onCascaderReady"]),n.createVNode(d,{ref:"searchHistory",localStorageKey:"sparc.science-dataset-search-history",onSearch:i.searchHistorySearch},null,8,["onSearch"]),n.withDirectives((n.openBlock(),n.createElementBlock("div",I8,[e.results.length===0&&!e.loadingCards?(n.openBlock(),n.createElementBlock("div",A8," No results found - Please change your search / filter criteria. ")):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.results,f=>(n.openBlock(),n.createElementBlock("div",{key:f.doi,class:"step-item"},[n.createVNode(u,{class:"dataset-card",entry:f,envVars:o.envVars,onMouseenter:h=>i.hoverChanged(f),onMouseleave:t[1]||(t[1]=h=>i.hoverChanged(void 0))},null,8,["entry","envVars","onMouseenter"])]))),128)),n.createVNode(p,{class:"pagination","current-page":e.page,"onUpdate:currentPage":t[2]||(t[2]=f=>e.page=f),"hide-on-single-page":"",large:"",layout:"prev, pager, next","page-size":e.numberPerPage,total:e.numberOfHits,onCurrentChange:i.pageChange},null,8,["current-page","page-size","total","onCurrentChange"])])),[[m,e.loadingCards]])]),_:1},8,["body-style"])}const x0=Jt(B8,[["render",F8],["__scopeId","data-v-9c8b75be"]]),P8=e=>e.replace(/\w\S*/g,t=>t.charAt(0).toUpperCase()+t.substr(1).toLowerCase()),ka=function(e){return e?e.charAt(0).toUpperCase()+e.slice(1):""},R8={name:"ConnectivityInfo",components:{Button:pt,Container:y_,Icon:ke,ElIconWarning:re.Warning,ElIconLocation:re.Location,ElIconSearch:re.Search,ExternalResourceCard:lo.ExternalResourceCard,CopyToClipboard:lo.CopyToClipboard,ConnectivityGraph:lo.ConnectivityGraph,ConnectivityList:lo.ConnectivityList},props:{connectivityEntry:{type:Array,default:[]},entryId:{type:String,default:""},envVars:{type:Object,default:()=>{}},availableAnatomyFacets:{type:Array,default:()=>[]},withCloseButton:{type:Boolean,default:!1}},data:function(){return{updatedCopyContent:"",activeView:"listView",connectivityLoading:!1,connectivitySource:"map",noMapConnectivity:!1,connectivityError:{},graphViewLoaded:!1,connectivityFromMap:null}},computed:{entry:function(){return this.connectivityEntry.find(e=>e.featureId[0]===this.entryId)},hasProvenanceTaxonomyLabel:function(){return this.entry.provenanceTaxonomyLabel&&this.entry.provenanceTaxonomyLabel.length>0},provSpeciesDescription:function(){let e="Studied in";return this.entry.provenanceTaxonomyLabel.forEach(t=>{e+=` ${t},`}),e=e.slice(0,-1),e+=" species",e},connectivityKey:function(){return this.entry.featureId[0]+this.entry.connectivitySource},origins:function(){return this.entry.origins},components:function(){return this.entry.components},destinations:function(){return this.entry.destinations},originsWithDatasets:function(){return this.entry.originsWithDatasets},componentsWithDatasets:function(){return this.entry.componentsWithDatasets},destinationsWithDatasets:function(){return this.entry.destinationsWithDatasets},resources:function(){return this.entry.hyperlinks||[]},sckanVersion:function(){return this.entry.knowledgeSource},flatmapApi:function(){return this.envVars.FLATMAPAPI_LOCATION}},watch:{entry:{deep:!0,immediate:!0,handler:function(e,t){e&&e!==t&&(this.connectivityLoading=!0,this.activeView=localStorage.getItem("connectivity-active-view")||this.activeView,this.activeView==="graphView"&&(this.graphViewLoaded=!0),this.connectivitySource=this.entry.connectivitySource,this.noMapConnectivity=this.entry.noMapConnectivity,this.updateGraphConnectivity(),this.connectivityLoading=!1,(!t||(e==null?void 0:e.featureId[0])!==(t==null?void 0:t.featureId[0]))&&this.$emit("loaded"))}}},methods:{titleCase:function(e){return P8(e)},capitalise:function(e){return ka(e)},showConnectivity:function(){const e=this.entry.featureId||[];this.$emit("show-connectivity",e),fe.emit("trackEvent",{event_name:"portal_maps_show_connectivity_on_map",category:this.entry.id||"",location:"map_sidebar_connectivity"})},onCopied:function(){fe.emit("trackEvent",{event_name:"portal_maps_connectivity_copy",category:this.entry.id||"",location:"map_sidebar_connectivity"})},switchConnectivityView:function(e){this.activeView=e,localStorage.setItem("connectivity-active-view",this.activeView),e==="graphView"&&!this.graphViewLoaded&&this.$nextTick(()=>{this.graphViewLoaded=!0}),fe.emit("trackEvent",{event_name:"portal_maps_connectivity_switch_view",category:e,location:"map_sidebar_connectivity"})},onTapNode:function(e){const t=e.map(o=>o.label).join(", ");this.onConnectivityHovered(t)},onShowReferenceConnectivities:function(e){this.$emit("show-reference-connectivities",e)},onReferencesLoaded:function(e){this.updatedCopyContent=this.getUpdateCopyContent(e)},getUpdateCopyContent:function(e){var s,l,c,d,u;if(!this.entry)return"";const t=[];let o=this.entry.title,r=this.entry.featureId;const a=[];o&&a.push(`<strong>${ka(this.entry.title)}</strong>`),r!=null&&r.length&&(typeof r=="object"?a.push(`(${r[0]})`):a.push(`(${r})`)),t.push(`<div>${a.join(" ")}</div>`),(s=this.entry.provenanceTaxonomyLabel)!=null&&s.length&&t.push(`<div>${this.provSpeciesDescription}</div>`),this.entry.paths&&t.push(`<div>${this.entry.paths}</div>`);function i(p,g,m=[]){let f=`<div><strong>${p}</strong></div>`;const h=[];g.forEach(b=>{let E=[];b.split(",").forEach(O=>{const v=m.find(S=>S.name===O.trim());v?E.push(`${ka(O)} (${v.id})`):E.push(`${ka(O)}`)}),h.push(E.join(","))});const y=h.map(b=>`<li>${b}</li>`).join(`
|
|
465
465
|
`);return f+=`
|
|
466
466
|
`,f+=`<ul>${y}</ul>`,f}if((l=this.entry["nerve-label"])!=null&&l.length){const p="Nerves",m=this.entry["nerve-label"].map(h=>Object.values(h)).flat(1/0),f=i(p,m);t.push(f)}if((c=this.origins)!=null&&c.length){const p="Origin",g=this.origins,m=this.originsWithDatasets,f=i(p,g,m);t.push(f)}if((d=this.components)!=null&&d.length){const p="Components",g=this.components,m=this.componentsWithDatasets,f=i(p,g,m);t.push(f)}if((u=this.destinations)!=null&&u.length){const p="Destination",g=this.destinations,m=this.destinationsWithDatasets,f=i(p,g,m);t.push(f)}if(e){let p="<div><strong>References</strong></div>";p+=`
|
|
467
467
|
`;const g=e.list.map(m=>`<li>${m}</li>`).join(`
|