@abi-software/map-side-bar 2.2.1-alpha-2 → 2.2.1-alpha-3

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.
@@ -19843,7 +19843,7 @@ class Vg {
19843
19843
  ]
19844
19844
  }).then((s) => {
19845
19845
  a({
19846
- forFlamap: this.processResultsForFlatmap(s.hits),
19846
+ forFlatmap: this.processResultsForFlatmap(s.hits),
19847
19847
  forScaffold: this.processResultsForScaffold(s.hits)
19848
19848
  });
19849
19849
  });
@@ -406,4 +406,4 @@ usage: app.provide(ID_INJECTION_KEY, {
406
406
  </g>
407
407
  </svg>`,Og=(e,t,r,o)=>{const a=["title","desc","defs","style"],s=["width","height"],i=o||[];let l=document.createElement("div");l.innerHTML=e,t&&a.map(d=>{const u=l.querySelector(d);u&&u.remove()}),r&&s.map(d=>{l.querySelector("svg").removeAttribute(d)}),o&&i.map(d=>{Object.values(l.querySelectorAll(`[${d}]`)).map(u=>{u.removeAttribute(d)})});const c=l.innerHTML;return l=null,c},_g=e=>[[/<\?xml[\s\S]*?>/gi,""],[/<!doctype[\s\S]*?>/gi,""],[/<!--.*-->/gi,""],[/\<([A-Za-z]+)([^\>]*)\/\>/g,"<$1$2></$1>"],[/\s+/g," "],[/\> \</g,"><"]].reduce((t,r)=>"".replace.apply(t,r),e).trim(),VA=!0,MA=!0,jA=["fill"],fc=Object.assign({"/assets/icons/2horpanel.svg":Qm,"/assets/icons/2vertpanel.svg":eg,"/assets/icons/3panel.svg":tg,"/assets/icons/4panel.svg":ng,"/assets/icons/5panel.svg":rg,"/assets/icons/6panel.svg":og,"/assets/icons/6panelVertical.svg":ag,"/assets/icons/changeBckgd.svg":sg,"/assets/icons/close-no-bk.svg":ig,"/assets/icons/close.svg":lg,"/assets/icons/closeFullScreen.svg":cg,"/assets/icons/dock.svg":dg,"/assets/icons/fitWindow.svg":ug,"/assets/icons/fullScreen.svg":fg,"/assets/icons/help.svg":pg,"/assets/icons/magnifyingGlass.svg":hg,"/assets/icons/noun-filter.svg":mg,"/assets/icons/openMap.svg":gg,"/assets/icons/pause.svg":yg,"/assets/icons/permalink.svg":bg,"/assets/icons/play.svg":wg,"/assets/icons/resetZoom.svg":Cg,"/assets/icons/singlepanel.svg":vg,"/assets/icons/tooltips.svg":kg,"/assets/icons/undock.svg":Sg,"/assets/icons/zoomIn.svg":xg,"/assets/icons/zoomOut.svg":Eg});Object.keys(fc).map(e=>{const t=Og(fc[e],VA,MA,jA),r=e.replace(/^.+\/(\w+).svg$/,"$1");return _g(t).replace("<svg",`<symbol id="${r}"`).replace("svg>","symbol>")}).join(`
408
408
  `);const zA=!0,UA=!0,pc=Object.assign({"/assets/icons/2horpanel.svg":Qm,"/assets/icons/2vertpanel.svg":eg,"/assets/icons/3panel.svg":tg,"/assets/icons/4panel.svg":ng,"/assets/icons/5panel.svg":rg,"/assets/icons/6panel.svg":og,"/assets/icons/6panelVertical.svg":ag,"/assets/icons/changeBckgd.svg":sg,"/assets/icons/close-no-bk.svg":ig,"/assets/icons/close.svg":lg,"/assets/icons/closeFullScreen.svg":cg,"/assets/icons/dock.svg":dg,"/assets/icons/fitWindow.svg":ug,"/assets/icons/fullScreen.svg":fg,"/assets/icons/help.svg":pg,"/assets/icons/magnifyingGlass.svg":hg,"/assets/icons/noun-filter.svg":mg,"/assets/icons/openMap.svg":gg,"/assets/icons/pause.svg":yg,"/assets/icons/permalink.svg":bg,"/assets/icons/play.svg":wg,"/assets/icons/resetZoom.svg":Cg,"/assets/icons/singlepanel.svg":vg,"/assets/icons/tooltips.svg":kg,"/assets/icons/undock.svg":Sg,"/assets/icons/zoomIn.svg":xg,"/assets/icons/zoomOut.svg":Eg}),HA=Object.keys(pc).map(e=>{const t=Og(pc[e],zA,UA),r=e.replace(/^.+\/(\w+).svg$/,"$1");return _g(t).replace("<svg",`<symbol id="${r}"`).replace("svg>","symbol>")}),qA={name:"MapSvgSpriteColor",svgContext:pc,svgSprite:HA.join(`
409
- `)},WA=["innerHTML"];function KA(e,t,r,o,a,s){return n.openBlock(),n.createElementBlock("svg",{width:"0",height:"0",style:{display:"none"},innerHTML:e.$options.svgSprite},null,8,WA)}const GA=Xm(qA,[["render",KA]]);var Tg={exports:{}};/*! algoliasearch.umd.js | 4.22.1 | © Algolia, inc. | https://github.com/algolia/algoliasearch-client-javascript */(function(e,t){(function(r,o){e.exports=o()})(PS,function(){function r(w,C,v){return C in w?Object.defineProperty(w,C,{value:v,enumerable:!0,configurable:!0,writable:!0}):w[C]=v,w}function o(w,C){var v=Object.keys(w);if(Object.getOwnPropertySymbols){var x=Object.getOwnPropertySymbols(w);C&&(x=x.filter(function(N){return Object.getOwnPropertyDescriptor(w,N).enumerable})),v.push.apply(v,x)}return v}function a(w){for(var C=1;C<arguments.length;C++){var v=arguments[C]!=null?arguments[C]:{};C%2?o(Object(v),!0).forEach(function(x){r(w,x,v[x])}):Object.getOwnPropertyDescriptors?Object.defineProperties(w,Object.getOwnPropertyDescriptors(v)):o(Object(v)).forEach(function(x){Object.defineProperty(w,x,Object.getOwnPropertyDescriptor(v,x))})}return w}function s(w,C){if(w==null)return{};var v,x,N=function(J,V){if(J==null)return{};var G,Q,Y={},ae=Object.keys(J);for(Q=0;Q<ae.length;Q++)G=ae[Q],V.indexOf(G)>=0||(Y[G]=J[G]);return Y}(w,C);if(Object.getOwnPropertySymbols){var z=Object.getOwnPropertySymbols(w);for(x=0;x<z.length;x++)v=z[x],C.indexOf(v)>=0||Object.prototype.propertyIsEnumerable.call(w,v)&&(N[v]=w[v])}return N}function i(w,C){return function(v){if(Array.isArray(v))return v}(w)||function(v,x){if(Symbol.iterator in Object(v)||Object.prototype.toString.call(v)==="[object Arguments]"){var N=[],z=!0,J=!1,V=void 0;try{for(var G,Q=v[Symbol.iterator]();!(z=(G=Q.next()).done)&&(N.push(G.value),!x||N.length!==x);z=!0);}catch(Y){J=!0,V=Y}finally{try{z||Q.return==null||Q.return()}finally{if(J)throw V}}return N}}(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 v=0,x=new Array(C.length);v<C.length;v++)x[v]=C[v];return x}}(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,v="algoliasearch-client-js-".concat(w.key),x=function(){return C===void 0&&(C=w.localStorage||window.localStorage),C},N=function(){return JSON.parse(x().getItem(v)||"{}")},z=function(V){x().setItem(v,JSON.stringify(V))},J=function(){var V=w.timeToLive?1e3*w.timeToLive:null,G=N(),Q=Object.fromEntries(Object.entries(G).filter(function(ae){return i(ae,2)[1].timestamp!==void 0}));if(z(Q),V){var Y=Object.fromEntries(Object.entries(Q).filter(function(ae){var oe=i(ae,2)[1],me=new Date().getTime();return!(oe.timestamp+V<me)}));z(Y)}};return{get:function(V,G){var Q=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{miss:function(){return Promise.resolve()}};return Promise.resolve().then(function(){J();var Y=JSON.stringify(V);return N()[Y]}).then(function(Y){return Promise.all([Y?Y.value:G(),Y!==void 0])}).then(function(Y){var ae=i(Y,2),oe=ae[0],me=ae[1];return Promise.all([oe,me||Q.miss(oe)])}).then(function(Y){return i(Y,1)[0]})},set:function(V,G){return Promise.resolve().then(function(){var Q=N();return Q[JSON.stringify(V)]={timestamp:new Date().getTime(),value:G},x().setItem(v,JSON.stringify(Q)),G})},delete:function(V){return Promise.resolve().then(function(){var G=N();delete G[JSON.stringify(V)],x().setItem(v,JSON.stringify(G))})},clear:function(){return Promise.resolve().then(function(){x().removeItem(v)})}}}function d(w){var C=l(w.caches),v=C.shift();return v===void 0?{get:function(x,N){var z=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{miss:function(){return Promise.resolve()}},J=N();return J.then(function(V){return Promise.all([V,z.miss(V)])}).then(function(V){return i(V,1)[0]})},set:function(x,N){return Promise.resolve(N)},delete:function(x){return Promise.resolve()},clear:function(){return Promise.resolve()}}:{get:function(x,N){var z=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{miss:function(){return Promise.resolve()}};return v.get(x,N,z).catch(function(){return d({caches:C}).get(x,N,z)})},set:function(x,N){return v.set(x,N).catch(function(){return d({caches:C}).set(x,N)})},delete:function(x){return v.delete(x).catch(function(){return d({caches:C}).delete(x)})},clear:function(){return v.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(v,x){var N=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{miss:function(){return Promise.resolve()}},z=JSON.stringify(v);if(z in C)return Promise.resolve(w.serializable?JSON.parse(C[z]):C[z]);var J=x(),V=N&&N.miss||function(){return Promise.resolve()};return J.then(function(G){return V(G)}).then(function(){return J})},set:function(v,x){return C[JSON.stringify(v)]=w.serializable?JSON.stringify(x):x,Promise.resolve(x)},delete:function(v){return delete C[JSON.stringify(v)],Promise.resolve()},clear:function(){return C={},Promise.resolve()}}}function f(w,C,v){var x={"x-algolia-api-key":v,"x-algolia-application-id":C};return{headers:function(){return w===b.WithinHeaders?x:{}},queryParameters:function(){return w===b.WithinQueryParameters?x:{}}}}function g(w){var C=0;return w(function v(){return C++,new Promise(function(x){setTimeout(function(){x(w(v))},Math.min(100*C,1e3))})})}function h(w){var C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(v,x){return Promise.resolve()};return Object.assign(w,{wait:function(v){return h(w.then(function(x){return Promise.all([C(x,v),x])}).then(function(x){return x[1]}))}})}function p(w){for(var C=w.length-1;C>0;C--){var v=Math.floor(Math.random()*(C+1)),x=w[C];w[C]=w[v],w[v]=x}return w}function m(w,C){return C&&Object.keys(C).forEach(function(v){w[v]=C[v](w)}),w}function y(w){for(var C=arguments.length,v=new Array(C>1?C-1:0),x=1;x<C;x++)v[x-1]=arguments[x];var N=0;return w.replace(/%s/g,function(){return encodeURIComponent(v[N++])})}var b={WithinQueryParameters:0,WithinHeaders:1};function k(w,C){var v=w||{},x=v.data||{};return Object.keys(v).forEach(function(N){["timeout","headers","queryParameters","data","cacheable"].indexOf(N)===-1&&(x[N]=v[N])}),{data:Object.entries(x).length>0?x:void 0,timeout:v.timeout||C,headers:v.headers||{},queryParameters:v.queryParameters||{},cacheable:v.cacheable}}var E={Read:1,Write:2,Any:3},S=1,T=2,_=3;function O(w){var C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:S;return a(a({},w),{},{status:C,lastUpdate:Date.now()})}function B(w){return typeof w=="string"?{protocol:"https",url:w,accept:E.Any}:{protocol:w.protocol||"https",url:w.url,accept:w.accept||E.Any}}var U="DELETE",$="GET",P="POST",F="PUT";function j(w,C){return Promise.all(C.map(function(v){return w.get(v,function(){return Promise.resolve(O(v))})})).then(function(v){var x=v.filter(function(J){return function(V){return V.status===S||Date.now()-V.lastUpdate>12e4}(J)}),N=v.filter(function(J){return function(V){return V.status===_&&Date.now()-V.lastUpdate<=12e4}(J)}),z=[].concat(l(x),l(N));return{getTimeout:function(J,V){return(N.length===0&&J===0?1:N.length+3+J)*V},statelessHosts:z.length>0?z.map(function(J){return B(J)}):C}})}function Z(w,C,v,x){var N=[],z=function(oe,me){if(!(oe.method===$||oe.data===void 0&&me.data===void 0)){var ce=Array.isArray(oe.data)?oe.data:a(a({},oe.data),me.data);return JSON.stringify(ce)}}(v,x),J=function(oe,me){var ce=a(a({},oe.headers),me.headers),Ee={};return Object.keys(ce).forEach(function(Ie){var bt=ce[Ie];Ee[Ie.toLowerCase()]=bt}),Ee}(w,x),V=v.method,G=v.method!==$?{}:a(a({},v.data),x.data),Q=a(a(a({"x-algolia-agent":w.userAgent.value},w.queryParameters),G),x.queryParameters),Y=0,ae=function oe(me,ce){var Ee=me.pop();if(Ee===void 0)throw{name:"RetryError",message:"Unreachable hosts - your application id may be incorrect. If the error persists, contact support@algolia.com.",transporterStackTrace:te(N)};var Ie={data:z,headers:J,method:V,url:A(Ee,v.path,Q),connectTimeout:ce(Y,w.timeouts.connect),responseTimeout:ce(Y,x.timeout)},bt=function(wt){var rt={request:Ie,response:wt,host:Ee,triesLeft:me.length};return N.push(rt),rt},Wo={onSuccess:function(wt){return function(rt){try{return JSON.parse(rt.content)}catch(fr){throw function(Gn,Zr){return{name:"DeserializationError",message:Gn,response:Zr}}(fr.message,rt)}}(wt)},onRetry:function(wt){var rt=bt(wt);return wt.isTimedOut&&Y++,Promise.all([w.logger.info("Retryable failure",Ce(rt)),w.hostsCache.set(Ee,O(Ee,wt.isTimedOut?_:T))]).then(function(){return oe(me,ce)})},onFail:function(wt){throw bt(wt),function(rt,fr){var Gn=rt.content,Zr=rt.status,Ko=Gn;try{Ko=JSON.parse(Gn).message}catch{}return function(As,Nc,z6){return{name:"ApiError",message:As,status:Nc,transporterStackTrace:z6}}(Ko,Zr,fr)}(wt,te(N))}};return w.requester.send(Ie).then(function(wt){return function(rt,fr){return function(Gn){var Zr=Gn.status;return Gn.isTimedOut||function(Ko){var As=Ko.isTimedOut,Nc=Ko.status;return!As&&~~Nc==0}(Gn)||~~(Zr/100)!=2&&~~(Zr/100)!=4}(rt)?fr.onRetry(rt):~~(rt.status/100)==2?fr.onSuccess(rt):fr.onFail(rt)}(wt,Wo)})};return j(w.hostsCache,C).then(function(oe){return ae(l(oe.statelessHosts).reverse(),oe.getTimeout)})}function W(w){var C=w.hostsCache,v=w.logger,x=w.requester,N=w.requestsCache,z=w.responsesCache,J=w.timeouts,V=w.userAgent,G=w.hosts,Q=w.queryParameters,Y={hostsCache:C,logger:v,requester:x,requestsCache:N,responsesCache:z,timeouts:J,userAgent:V,headers:w.headers,queryParameters:Q,hosts:G.map(function(ae){return B(ae)}),read:function(ae,oe){var me=k(oe,Y.timeouts.read),ce=function(){return Z(Y,Y.hosts.filter(function(Ie){return(Ie.accept&E.Read)!=0}),ae,me)};if((me.cacheable!==void 0?me.cacheable:ae.cacheable)!==!0)return ce();var Ee={request:ae,mappedRequestOptions:me,transporter:{queryParameters:Y.queryParameters,headers:Y.headers}};return Y.responsesCache.get(Ee,function(){return Y.requestsCache.get(Ee,function(){return Y.requestsCache.set(Ee,ce()).then(function(Ie){return Promise.all([Y.requestsCache.delete(Ee),Ie])},function(Ie){return Promise.all([Y.requestsCache.delete(Ee),Promise.reject(Ie)])}).then(function(Ie){var bt=i(Ie,2);return bt[0],bt[1]})})},{miss:function(Ie){return Y.responsesCache.set(Ee,Ie)}})},write:function(ae,oe){return Z(Y,Y.hosts.filter(function(me){return(me.accept&E.Write)!=0}),ae,k(oe,Y.timeouts.write))}};return Y}function H(w){var C={value:"Algolia for JavaScript (".concat(w,")"),add:function(v){var x="; ".concat(v.segment).concat(v.version!==void 0?" (".concat(v.version,")"):"");return C.value.indexOf(x)===-1&&(C.value="".concat(C.value).concat(x)),C}};return C}function A(w,C,v){var x=ee(v),N="".concat(w.protocol,"://").concat(w.url,"/").concat(C.charAt(0)==="/"?C.substr(1):C);return x.length&&(N+="?".concat(x)),N}function ee(w){return Object.keys(w).map(function(C){return y("%s=%s",C,(v=w[C],Object.prototype.toString.call(v)==="[object Object]"||Object.prototype.toString.call(v)==="[object Array]"?JSON.stringify(w[C]):w[C]));var v}).join("&")}function te(w){return w.map(function(C){return Ce(C)})}function Ce(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 pe=function(w){return function(C,v){return w.transporter.write({method:P,path:"2/abtests",data:C},v)}},de=function(w){return function(C,v){return w.transporter.write({method:U,path:y("2/abtests/%s",C)},v)}},Re=function(w){return function(C,v){return w.transporter.read({method:$,path:y("2/abtests/%s",C)},v)}},_e=function(w){return function(C){return w.transporter.read({method:$,path:"2/abtests"},C)}},ve=function(w){return function(C,v){return w.transporter.write({method:P,path:y("2/abtests/%s/stop",C)},v)}},We=function(w){return function(C){return w.transporter.read({method:$,path:"1/strategies/personalization"},C)}},Ue=function(w){return function(C,v){return w.transporter.write({method:P,path:"1/strategies/personalization",data:C},v)}};function ke(w){return function C(v){return w.request(v).then(function(x){if(w.batch!==void 0&&w.batch(x.hits),!w.shouldStop(x))return x.cursor?C({cursor:x.cursor}):C({page:(v.page||0)+1})})}({})}var Fe=function(w){return function(C,v){var x=v||{},N=x.queryParameters,z=s(x,["queryParameters"]),J=a({acl:C},N!==void 0?{queryParameters:N}:{});return h(w.transporter.write({method:P,path:"1/keys",data:J},z),function(V,G){return g(function(Q){return ye(w)(V.key,G).catch(function(Y){if(Y.status!==404)throw Y;return Q()})})})}},it=function(w){return function(C,v,x){var N=k(x);return N.queryParameters["X-Algolia-User-ID"]=C,w.transporter.write({method:P,path:"1/clusters/mapping",data:{cluster:v}},N)}},Ne=function(w){return function(C,v,x){return w.transporter.write({method:P,path:"1/clusters/mapping/batch",data:{users:C,cluster:v}},x)}},et=function(w){return function(C,v){return h(w.transporter.write({method:P,path:y("/1/dictionaries/%s/batch",C),data:{clearExistingDictionaryEntries:!0,requests:{action:"addEntry",body:[]}}},v),function(x,N){return qn(w)(x.taskID,N)})}},$e=function(w){return function(C,v,x){return h(w.transporter.write({method:P,path:y("1/indexes/%s/operation",C),data:{operation:"copy",destination:v}},x),function(N,z){return he(w)(C,{methods:{waitTask:Me}}).waitTask(N.taskID,z)})}},kt=function(w){return function(C,v,x){return $e(w)(C,v,a(a({},x),{},{scope:[Bc.Rules]}))}},St=function(w){return function(C,v,x){return $e(w)(C,v,a(a({},x),{},{scope:[Bc.Settings]}))}},mt=function(w){return function(C,v,x){return $e(w)(C,v,a(a({},x),{},{scope:[Bc.Synonyms]}))}},tt=function(w){return function(C,v){return C.method===$?w.transporter.read(C,v):w.transporter.write(C,v)}},Mt=function(w){return function(C,v){return h(w.transporter.write({method:U,path:y("1/keys/%s",C)},v),function(x,N){return g(function(z){return ye(w)(C,N).then(z).catch(function(J){if(J.status!==404)throw J})})})}},xt=function(w){return function(C,v,x){var N=v.map(function(z){return{action:"deleteEntry",body:{objectID:z}}});return h(w.transporter.write({method:P,path:y("/1/dictionaries/%s/batch",C),data:{clearExistingDictionaryEntries:!1,requests:N}},x),function(z,J){return qn(w)(z.taskID,J)})}},ye=function(w){return function(C,v){return w.transporter.read({method:$,path:y("1/keys/%s",C)},v)}},He=function(w){return function(C,v){return w.transporter.read({method:$,path:y("1/task/%s",C.toString())},v)}},lt=function(w){return function(C){return w.transporter.read({method:$,path:"/1/dictionaries/*/settings"},C)}},nt=function(w){return function(C){return w.transporter.read({method:$,path:"1/logs"},C)}},Ve=function(w){return function(C){return w.transporter.read({method:$,path:"1/clusters/mapping/top"},C)}},M=function(w){return function(C,v){return w.transporter.read({method:$,path:y("1/clusters/mapping/%s",C)},v)}},re=function(w){return function(C){var v=C||{},x=v.retrieveMappings,N=s(v,["retrieveMappings"]);return x===!0&&(N.getClusters=!0),w.transporter.read({method:$,path:"1/clusters/mapping/pending"},N)}},he=function(w){return function(C){var v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},x={transporter:w.transporter,appId:w.appId,indexName:C};return m(x,v.methods)}},Ke=function(w){return function(C){return w.transporter.read({method:$,path:"1/keys"},C)}},xn=function(w){return function(C){return w.transporter.read({method:$,path:"1/clusters"},C)}},Hn=function(w){return function(C){return w.transporter.read({method:$,path:"1/indexes"},C)}},En=function(w){return function(C){return w.transporter.read({method:$,path:"1/clusters/mapping"},C)}},D=function(w){return function(C,v,x){return h(w.transporter.write({method:P,path:y("1/indexes/%s/operation",C),data:{operation:"move",destination:v}},x),function(N,z){return he(w)(C,{methods:{waitTask:Me}}).waitTask(N.taskID,z)})}},q=function(w){return function(C,v){return h(w.transporter.write({method:P,path:"1/indexes/*/batch",data:{requests:C}},v),function(x,N){return Promise.all(Object.keys(x.taskID).map(function(z){return he(w)(z,{methods:{waitTask:Me}}).waitTask(x.taskID[z],N)}))})}},X=function(w){return function(C,v){return w.transporter.read({method:P,path:"1/indexes/*/objects",data:{requests:C}},v)}},be=function(w){return function(C,v){var x=C.map(function(N){return a(a({},N),{},{params:ee(N.params||{})})});return w.transporter.read({method:P,path:"1/indexes/*/queries",data:{requests:x},cacheable:!0},v)}},gt=function(w){return function(C,v){return Promise.all(C.map(function(x){var N=x.params,z=N.facetName,J=N.facetQuery,V=s(N,["facetName","facetQuery"]);return he(w)(x.indexName,{methods:{searchForFacetValues:Lg}}).searchForFacetValues(z,J,a(a({},v),V))}))}},yt=function(w){return function(C,v){var x=k(v);return x.queryParameters["X-Algolia-User-ID"]=C,w.transporter.write({method:U,path:"1/clusters/mapping"},x)}},Et=function(w){return function(C,v,x){var N=v.map(function(z){return{action:"addEntry",body:z}});return h(w.transporter.write({method:P,path:y("/1/dictionaries/%s/batch",C),data:{clearExistingDictionaryEntries:!0,requests:N}},x),function(z,J){return qn(w)(z.taskID,J)})}},Wr=function(w){return function(C,v){return h(w.transporter.write({method:P,path:y("1/keys/%s/restore",C)},v),function(x,N){return g(function(z){return ye(w)(C,N).catch(function(J){if(J.status!==404)throw J;return z()})})})}},gc=function(w){return function(C,v,x){var N=v.map(function(z){return{action:"addEntry",body:z}});return h(w.transporter.write({method:P,path:y("/1/dictionaries/%s/batch",C),data:{clearExistingDictionaryEntries:!1,requests:N}},x),function(z,J){return qn(w)(z.taskID,J)})}},yc=function(w){return function(C,v,x){return w.transporter.read({method:P,path:y("/1/dictionaries/%s/search",C),data:{query:v},cacheable:!0},x)}},Ts=function(w){return function(C,v){return w.transporter.read({method:P,path:"1/clusters/mapping/search",data:{query:C}},v)}},bc=function(w){return function(C,v){return h(w.transporter.write({method:F,path:"/1/dictionaries/*/settings",data:C},v),function(x,N){return qn(w)(x.taskID,N)})}},Bs=function(w){return function(C,v){var x=Object.assign({},v),N=v||{},z=N.queryParameters,J=s(N,["queryParameters"]),V=z?{queryParameters:z}:{},G=["acl","indexes","referers","restrictSources","queryParameters","description","maxQueriesPerIPPerHour","maxHitsPerQuery"];return h(w.transporter.write({method:F,path:y("1/keys/%s",C),data:V},J),function(Q,Y){return g(function(ae){return ye(w)(C,Y).then(function(oe){return function(me){return Object.keys(x).filter(function(ce){return G.indexOf(ce)!==-1}).every(function(ce){if(Array.isArray(me[ce])&&Array.isArray(x[ce])){var Ee=me[ce];return Ee.length===x[ce].length&&Ee.every(function(Ie,bt){return Ie===x[ce][bt]})}return me[ce]===x[ce]})}(oe)?Promise.resolve():ae()})})})}},qn=function(w){return function(C,v){return g(function(x){return He(w)(C,v).then(function(N){return N.status!=="published"?x():void 0})})}},Wn=function(w){return function(C,v){return h(w.transporter.write({method:P,path:y("1/indexes/%s/batch",w.indexName),data:{requests:C}},v),function(x,N){return Me(w)(x.taskID,N)})}},wc=function(w){return function(C){return ke(a(a({shouldStop:function(v){return v.cursor===void 0}},C),{},{request:function(v){return w.transporter.read({method:P,path:y("1/indexes/%s/browse",w.indexName),data:v},C)}}))}},Cc=function(w){return function(C){var v=a({hitsPerPage:1e3},C);return ke(a(a({shouldStop:function(x){return x.hits.length<v.hitsPerPage}},v),{},{request:function(x){return Dg(w)("",a(a({},v),x)).then(function(N){return a(a({},N),{},{hits:N.hits.map(function(z){return delete z._highlightResult,z})})})}}))}},vc=function(w){return function(C){var v=a({hitsPerPage:1e3},C);return ke(a(a({shouldStop:function(x){return x.hits.length<v.hitsPerPage}},v),{},{request:function(x){return Vg(w)("",a(a({},v),x)).then(function(N){return a(a({},N),{},{hits:N.hits.map(function(z){return delete z._highlightResult,z})})})}}))}},Kr=function(w){return function(C,v,x){var N=x||{},z=N.batchSize,J=s(N,["batchSize"]),V={taskIDs:[],objectIDs:[]};return h(function G(){var Q,Y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,ae=[];for(Q=Y;Q<C.length&&(ae.push(C[Q]),ae.length!==(z||1e3));Q++);return ae.length===0?Promise.resolve(V):Wn(w)(ae.map(function(oe){return{action:v,body:oe}}),J).then(function(oe){return V.objectIDs=V.objectIDs.concat(oe.objectIDs),V.taskIDs.push(oe.taskID),Q++,G(Q)})}(),function(G,Q){return Promise.all(G.taskIDs.map(function(Y){return Me(w)(Y,Q)}))})}},kc=function(w){return function(C){return h(w.transporter.write({method:P,path:y("1/indexes/%s/clear",w.indexName)},C),function(v,x){return Me(w)(v.taskID,x)})}},Sc=function(w){return function(C){var v=C||{},x=v.forwardToReplicas,N=k(s(v,["forwardToReplicas"]));return x&&(N.queryParameters.forwardToReplicas=1),h(w.transporter.write({method:P,path:y("1/indexes/%s/rules/clear",w.indexName)},N),function(z,J){return Me(w)(z.taskID,J)})}},xc=function(w){return function(C){var v=C||{},x=v.forwardToReplicas,N=k(s(v,["forwardToReplicas"]));return x&&(N.queryParameters.forwardToReplicas=1),h(w.transporter.write({method:P,path:y("1/indexes/%s/synonyms/clear",w.indexName)},N),function(z,J){return Me(w)(z.taskID,J)})}},Ec=function(w){return function(C,v){return h(w.transporter.write({method:P,path:y("1/indexes/%s/deleteByQuery",w.indexName),data:C},v),function(x,N){return Me(w)(x.taskID,N)})}},I=function(w){return function(C){return h(w.transporter.write({method:U,path:y("1/indexes/%s",w.indexName)},C),function(v,x){return Me(w)(v.taskID,x)})}},K=function(w){return function(C,v){return h(we(w)([C],v).then(function(x){return{taskID:x.taskIDs[0]}}),function(x,N){return Me(w)(x.taskID,N)})}},we=function(w){return function(C,v){var x=C.map(function(N){return{objectID:N}});return Kr(w)(x,Jr.DeleteObject,v)}},Ae=function(w){return function(C,v){var x=v||{},N=x.forwardToReplicas,z=k(s(x,["forwardToReplicas"]));return N&&(z.queryParameters.forwardToReplicas=1),h(w.transporter.write({method:U,path:y("1/indexes/%s/rules/%s",w.indexName,C)},z),function(J,V){return Me(w)(J.taskID,V)})}},fn=function(w){return function(C,v){var x=v||{},N=x.forwardToReplicas,z=k(s(x,["forwardToReplicas"]));return N&&(z.queryParameters.forwardToReplicas=1),h(w.transporter.write({method:U,path:y("1/indexes/%s/synonyms/%s",w.indexName,C)},z),function(J,V){return Me(w)(J.taskID,V)})}},Kn=function(w){return function(C){return Fg(w)(C).then(function(){return!0}).catch(function(v){if(v.status!==404)throw v;return!1})}},Gr=function(w){return function(C,v,x){return w.transporter.read({method:P,path:y("1/answers/%s/prediction",w.indexName),data:{query:C,queryLanguages:v},cacheable:!0},x)}},On=function(w){return function(C,v){var x=v||{},N=x.query,z=x.paginate,J=s(x,["query","paginate"]),V=0;return function G(){return Rg(w)(N||"",a(a({},J),{},{page:V})).then(function(Q){for(var Y=0,ae=Object.entries(Q.hits);Y<ae.length;Y++){var oe=i(ae[Y],2),me=oe[0],ce=oe[1];if(C(ce))return{object:ce,position:parseInt(me,10),page:V}}if(V++,z===!1||V>=Q.nbPages)throw{name:"ObjectNotFoundError",message:"Object not found."};return G()})}()}},jt=function(w){return function(C,v){return w.transporter.read({method:$,path:y("1/indexes/%s/%s",w.indexName,C)},v)}},Ns=function(){return function(w,C){for(var v=0,x=Object.entries(w.hits);v<x.length;v++){var N=i(x[v],2),z=N[0];if(N[1].objectID===C)return parseInt(z,10)}return-1}},T6=function(w){return function(C,v){var x=v||{},N=x.attributesToRetrieve,z=s(x,["attributesToRetrieve"]),J=C.map(function(V){return a({indexName:w.indexName,objectID:V},N?{attributesToRetrieve:N}:{})});return w.transporter.read({method:P,path:"1/indexes/*/objects",data:{requests:J}},z)}},B6=function(w){return function(C,v){return w.transporter.read({method:$,path:y("1/indexes/%s/rules/%s",w.indexName,C)},v)}},Fg=function(w){return function(C){return w.transporter.read({method:$,path:y("1/indexes/%s/settings",w.indexName),data:{getVersion:2}},C)}},N6=function(w){return function(C,v){return w.transporter.read({method:$,path:y("1/indexes/%s/synonyms/%s",w.indexName,C)},v)}},A6=function(w){return function(C,v){return h($g(w)([C],v).then(function(x){return{objectID:x.objectIDs[0],taskID:x.taskIDs[0]}}),function(x,N){return Me(w)(x.taskID,N)})}},$g=function(w){return function(C,v){var x=v||{},N=x.createIfNotExists,z=s(x,["createIfNotExists"]),J=N?Jr.PartialUpdateObject:Jr.PartialUpdateObjectNoCreate;return Kr(w)(C,J,z)}},I6=function(w){return function(C,v){var x=v||{},N=x.safe,z=x.autoGenerateObjectIDIfNotExist,J=x.batchSize,V=s(x,["safe","autoGenerateObjectIDIfNotExist","batchSize"]),G=function(ce,Ee,Ie,bt){return h(w.transporter.write({method:P,path:y("1/indexes/%s/operation",ce),data:{operation:Ie,destination:Ee}},bt),function(Wo,wt){return Me(w)(Wo.taskID,wt)})},Q=Math.random().toString(36).substring(7),Y="".concat(w.indexName,"_tmp_").concat(Q),ae=Oc({appId:w.appId,transporter:w.transporter,indexName:Y}),oe=[],me=G(w.indexName,Y,"copy",a(a({},V),{},{scope:["settings","synonyms","rules"]}));return oe.push(me),h((N?me.wait(V):me).then(function(){var ce=ae(C,a(a({},V),{},{autoGenerateObjectIDIfNotExist:z,batchSize:J}));return oe.push(ce),N?ce.wait(V):ce}).then(function(){var ce=G(Y,w.indexName,"move",V);return oe.push(ce),N?ce.wait(V):ce}).then(function(){return Promise.all(oe)}).then(function(ce){var Ee=i(ce,3),Ie=Ee[0],bt=Ee[1],Wo=Ee[2];return{objectIDs:bt.objectIDs,taskIDs:[Ie.taskID].concat(l(bt.taskIDs),[Wo.taskID])}}),function(ce,Ee){return Promise.all(oe.map(function(Ie){return Ie.wait(Ee)}))})}},P6=function(w){return function(C,v){return _c(w)(C,a(a({},v),{},{clearExistingRules:!0}))}},F6=function(w){return function(C,v){return Tc(w)(C,a(a({},v),{},{clearExistingSynonyms:!0}))}},$6=function(w){return function(C,v){return h(Oc(w)([C],v).then(function(x){return{objectID:x.objectIDs[0],taskID:x.taskIDs[0]}}),function(x,N){return Me(w)(x.taskID,N)})}},Oc=function(w){return function(C,v){var x=v||{},N=x.autoGenerateObjectIDIfNotExist,z=s(x,["autoGenerateObjectIDIfNotExist"]),J=N?Jr.AddObject:Jr.UpdateObject;if(J===Jr.UpdateObject){var V=!0,G=!1,Q=void 0;try{for(var Y,ae=C[Symbol.iterator]();!(V=(Y=ae.next()).done);V=!0)if(Y.value.objectID===void 0)return h(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(oe){G=!0,Q=oe}finally{try{V||ae.return==null||ae.return()}finally{if(G)throw Q}}}return Kr(w)(C,J,z)}},R6=function(w){return function(C,v){return _c(w)([C],v)}},_c=function(w){return function(C,v){var x=v||{},N=x.forwardToReplicas,z=x.clearExistingRules,J=k(s(x,["forwardToReplicas","clearExistingRules"]));return N&&(J.queryParameters.forwardToReplicas=1),z&&(J.queryParameters.clearExistingRules=1),h(w.transporter.write({method:P,path:y("1/indexes/%s/rules/batch",w.indexName),data:C},J),function(V,G){return Me(w)(V.taskID,G)})}},L6=function(w){return function(C,v){return Tc(w)([C],v)}},Tc=function(w){return function(C,v){var x=v||{},N=x.forwardToReplicas,z=x.clearExistingSynonyms,J=x.replaceExistingSynonyms,V=k(s(x,["forwardToReplicas","clearExistingSynonyms","replaceExistingSynonyms"]));return N&&(V.queryParameters.forwardToReplicas=1),(J||z)&&(V.queryParameters.replaceExistingSynonyms=1),h(w.transporter.write({method:P,path:y("1/indexes/%s/synonyms/batch",w.indexName),data:C},V),function(G,Q){return Me(w)(G.taskID,Q)})}},Rg=function(w){return function(C,v){return w.transporter.read({method:P,path:y("1/indexes/%s/query",w.indexName),data:{query:C},cacheable:!0},v)}},Lg=function(w){return function(C,v,x){return w.transporter.read({method:P,path:y("1/indexes/%s/facets/%s/query",w.indexName,C),data:{facetQuery:v},cacheable:!0},x)}},Dg=function(w){return function(C,v){return w.transporter.read({method:P,path:y("1/indexes/%s/rules/search",w.indexName),data:{query:C}},v)}},Vg=function(w){return function(C,v){return w.transporter.read({method:P,path:y("1/indexes/%s/synonyms/search",w.indexName),data:{query:C}},v)}},D6=function(w){return function(C,v){var x=v||{},N=x.forwardToReplicas,z=k(s(x,["forwardToReplicas"]));return N&&(z.queryParameters.forwardToReplicas=1),h(w.transporter.write({method:F,path:y("1/indexes/%s/settings",w.indexName),data:C},z),function(J,V){return Me(w)(J.taskID,V)})}},Me=function(w){return function(C,v){return g(function(x){return function(N){return function(z,J){return N.transporter.read({method:$,path:y("1/indexes/%s/task/%s",N.indexName,z.toString())},J)}}(w)(C,v).then(function(N){return N.status!=="published"?x():void 0})})}},Jr={AddObject:"addObject",UpdateObject:"updateObject",PartialUpdateObject:"partialUpdateObject",PartialUpdateObjectNoCreate:"partialUpdateObjectNoCreate",DeleteObject:"deleteObject",DeleteIndex:"delete",ClearIndex:"clear"},Bc={Settings:"settings",Synonyms:"synonyms",Rules:"rules"},V6=1,M6=2,j6=3;function Mg(w,C,v){var x,N={appId:w,apiKey:C,timeouts:{connect:1,read:2,write:30},requester:{send:function(V){return new Promise(function(G){var Q=new XMLHttpRequest;Q.open(V.method,V.url,!0),Object.keys(V.headers).forEach(function(me){return Q.setRequestHeader(me,V.headers[me])});var Y,ae=function(me,ce){return setTimeout(function(){Q.abort(),G({status:0,content:ce,isTimedOut:!0})},1e3*me)},oe=ae(V.connectTimeout,"Connection timeout");Q.onreadystatechange=function(){Q.readyState>Q.OPENED&&Y===void 0&&(clearTimeout(oe),Y=ae(V.responseTimeout,"Socket timeout"))},Q.onerror=function(){Q.status===0&&(clearTimeout(oe),clearTimeout(Y),G({content:Q.responseText||"Network request failed",status:Q.status,isTimedOut:!1}))},Q.onload=function(){clearTimeout(oe),clearTimeout(Y),G({content:Q.responseText,status:Q.status,isTimedOut:!1})},Q.send(V.data)})}},logger:(x=j6,{debug:function(V,G){return V6>=x&&console.debug(V,G),Promise.resolve()},info:function(V,G){return M6>=x&&console.info(V,G),Promise.resolve()},error:function(V,G){return console.error(V,G),Promise.resolve()}}),responsesCache:u(),requestsCache:u({serializable:!1}),hostsCache:d({caches:[c({key:"".concat("4.22.1","-").concat(w)}),u()]}),userAgent:H("4.22.1").add({segment:"Browser"})},z=a(a({},N),v),J=function(){return function(V){return function(G){var Q=G.region||"us",Y=f(b.WithinHeaders,G.appId,G.apiKey),ae=W(a(a({hosts:[{url:"personalization.".concat(Q,".algolia.com")}]},G),{},{headers:a(a(a({},Y.headers()),{"content-type":"application/json"}),G.headers),queryParameters:a(a({},Y.queryParameters()),G.queryParameters)}));return m({appId:G.appId,transporter:ae},G.methods)}(a(a(a({},N),V),{},{methods:{getPersonalizationStrategy:We,setPersonalizationStrategy:Ue}}))}};return function(V){var G=V.appId,Q=f(V.authMode!==void 0?V.authMode:b.WithinHeaders,G,V.apiKey),Y=W(a(a({hosts:[{url:"".concat(G,"-dsn.algolia.net"),accept:E.Read},{url:"".concat(G,".algolia.net"),accept:E.Write}].concat(p([{url:"".concat(G,"-1.algolianet.com")},{url:"".concat(G,"-2.algolianet.com")},{url:"".concat(G,"-3.algolianet.com")}]))},V),{},{headers:a(a(a({},Q.headers()),{"content-type":"application/x-www-form-urlencoded"}),V.headers),queryParameters:a(a({},Q.queryParameters()),V.queryParameters)}));return m({transporter:Y,appId:G,addAlgoliaAgent:function(ae,oe){Y.userAgent.add({segment:ae,version:oe})},clearCache:function(){return Promise.all([Y.requestsCache.clear(),Y.responsesCache.clear()]).then(function(){})}},V.methods)}(a(a({},z),{},{methods:{search:be,searchForFacetValues:gt,multipleBatch:q,multipleGetObjects:X,multipleQueries:be,copyIndex:$e,copySettings:St,copySynonyms:mt,copyRules:kt,moveIndex:D,listIndices:Hn,getLogs:nt,listClusters:xn,multipleSearchForFacetValues:gt,getApiKey:ye,addApiKey:Fe,listApiKeys:Ke,updateApiKey:Bs,deleteApiKey:Mt,restoreApiKey:Wr,assignUserID:it,assignUserIDs:Ne,getUserID:M,searchUserIDs:Ts,listUserIDs:En,getTopUserIDs:Ve,removeUserID:yt,hasPendingMappings:re,clearDictionaryEntries:et,deleteDictionaryEntries:xt,getDictionarySettings:lt,getAppTask:He,replaceDictionaryEntries:Et,saveDictionaryEntries:gc,searchDictionaryEntries:yc,setDictionarySettings:bc,waitAppTask:qn,customRequest:tt,initIndex:function(V){return function(G){return he(V)(G,{methods:{batch:Wn,delete:I,findAnswers:Gr,getObject:jt,getObjects:T6,saveObject:$6,saveObjects:Oc,search:Rg,searchForFacetValues:Lg,waitTask:Me,setSettings:D6,getSettings:Fg,partialUpdateObject:A6,partialUpdateObjects:$g,deleteObject:K,deleteObjects:we,deleteBy:Ec,clearObjects:kc,browseObjects:wc,getObjectPosition:Ns,findObject:On,exists:Kn,saveSynonym:L6,saveSynonyms:Tc,getSynonym:N6,searchSynonyms:Vg,browseSynonyms:vc,deleteSynonym:fn,clearSynonyms:xc,replaceAllObjects:I6,replaceAllSynonyms:F6,searchRules:Dg,getRule:B6,deleteRule:Ae,saveRule:R6,saveRules:_c,replaceAllRules:P6,browseRules:Cc,clearRules:Sc}})}},initAnalytics:function(){return function(V){return function(G){var Q=G.region||"us",Y=f(b.WithinHeaders,G.appId,G.apiKey),ae=W(a(a({hosts:[{url:"analytics.".concat(Q,".algolia.com")}]},G),{},{headers:a(a(a({},Y.headers()),{"content-type":"application/json"}),G.headers),queryParameters:a(a({},Y.queryParameters()),G.queryParameters)}));return m({appId:G.appId,transporter:ae},G.methods)}(a(a(a({},N),V),{},{methods:{addABTest:pe,getABTest:Re,getABTests:_e,stopABTest:ve,deleteABTest:de}}))}},initPersonalization:J,initRecommendation:function(){return function(V){return z.logger.info("The `initRecommendation` method is deprecated. Use `initPersonalization` instead."),J()(V)}}}}))}return Mg.version="4.22.1",Mg})})(Tg);var JA=Tg.exports;const ZA=FS(JA);class Bg{constructor(t,r,o="https://api.pennsieve.io"){this.client=ZA(t,r),this.PENNSIEVE_API_LOCATION=o,this.anatomyFacetLabels=[]}initIndex(t){this.index=this.client.initIndex(t)}getAlgoliaFacets(t){const r=t.map(i=>i.facetPropPath),o=t.map(i=>i.facetSubpropPath);let a=[],s=0;return this.index.search("",{sortFacetValuesBy:"alpha",facets:r.concat(o)}).then(i=>(r.map(l=>{const c=t.find(h=>h.facetPropPath==l);var d=[];const u=i.facets;if(u===void 0)return;const f=u[l]==null?{}:u[l],g=c&&u[c.facetSubpropPath]?Object.keys(u[c.facetSubpropPath]):[];Object.keys(f).map(h=>{const p=g.reduce((y,b)=>{const k=b.split(".");return k.length!==2||h===k[0]&&y.push({label:k[1],id:s++,facetPropPath:`${c?c.facetSubpropPath:void 0}`}),y},[]);let m={label:h,id:s++,facetPropPath:l};p.length>0&&(m.children=p),d.push(m)}),d.length>0&&a.push({label:c?c.label:"",id:s++,children:d,key:l})}),a))}_discoverAllDois(t,r="https://api.pennsieve.io"){return new Promise(o=>{fetch(`${r}/discover/datasets/${t}/versions`).then(a=>a.json()).then(a=>{o(a.map(s=>s.doi))})})}_expandDois(t,r="https://api.pennsieve.io"){return new Promise(o=>{let a=t.map(s=>this._discoverAllDois(s,r));Promise.all(a).then(s=>{o(s.flat())})})}_processResultsForCards(t){let r=[],o={};for(let a of t)o={...a},o={anatomy:a.anatomy?a.anatomy.organ.map(s=>s.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},r.push(o);return r}_processAnatomy(t){let r=[],o=[],a=[],s=[];return t.forEach(i=>{i.item&&i.item.keywords&&i.item.keywords.forEach(l=>{let c=l.keyword.toUpperCase();(c.includes("UBERON")||c.includes("ILX"))&&r.push(this._processUberonURL(c))}),i.anatomy&&i.anatomy.organ&&i.anatomy.organ.forEach(l=>{l.curie&&(r.push(l.curie),o.push(l.name))})}),s=[...new Set(r)],a=[...new Set(o)],this.anatomyFacetLabels=a,s}_processUberonURL(t){return t.split("/").pop().replace("_",":")}search(t,r="",o=10,a=1){return new Promise(s=>{this.index.search(r,{facets:["*"],hitsPerPage:o,page:a-1,filters:t,attributesToHighlight:[],attributesToRetrieve:["pennsieve.publishDate","pennsieve.updatedAt","item.curie","item.name","item.description","objectID","anatomy.organ.curie"]}).then(i=>{let l={items:this._processResultsForCards(i.hits),total:i.nbHits,discoverIds:i.hits.map(c=>c.pennsieve?c.pennsieve.identifier:c.objectID),dois:i.hits.map(c=>c.item.curie.split(":")[1])};s(l)})})}anatomyInSearch(t,r="",o=999999,a=1){return new Promise(s=>{this.index.search(r,{facets:["*"],hitsPerPage:o,page:a-1,filters:t,attributesToHighlight:[],attributesToRetrieve:["objectID","item.keywords.keyword","anatomy.organ.name","anatomy.organ.curie"]}).then(i=>{s({forFlamap:this.processResultsForFlatmap(i.hits),forScaffold:this.processResultsForScaffold(i.hits)})})})}processResultsForFlatmap(t){return t.map(o=>({id:o.objectID,terms:o.anatomy?o.anatomy.organ.map(a=>a.curie):[]}))}processResultsForScaffold(t){let r={};return t.forEach(o=>{o.anatomy&&o.anatomy.organ&&o.anatomy.organ.forEach(a=>{a.name&&(r[a.name]?r[a.name]++:r[a.name]=1)})}),r}}const hc=[{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",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"}];function Ng(e=void 0){if(e===void 0)return"NOT item.published.status:embargo";e.forEach(a=>a.label=a.facet);let t=YA(e),r="NOT item.published.status:embargo";return r=`(${r}) AND `,hc.map(a=>a.facetPropPath).map(a=>{let s=t.filter(c=>c.facetPropPath==a),i="",l="";s.map(c=>{let d=c.facetSubPropPath?c.facetSubPropPath:a;c.AND?l+=`AND "${d}":"${c.label}"`:i+=`"${d}":"${c.label}" OR `}),!(i==""&&l=="")&&(i=`(${i.substring(0,i.lastIndexOf(" OR "))})`,r+=`${i+l} AND `,r=r.split("()AND ").join(""))}),console.log("filters about to be applied:",r),r.substring(0,r.lastIndexOf(" AND "))}function YA(e){return e.filter(t=>t.label!=="Show all")}const _s=function(e){return e.charAt(0).toUpperCase()+e.slice(1)},mc=function(e){const t=e.toLowerCase();return Os[t]?_s(Os[t]):_s(t)},XA={name:"SearchFilters",components:{MapSvgIcon:DA,MapSvgSpriteColor:GA,Option:$a,Select:So,Popover:Xf,Cascader:Hf},props:{entry:Object,envVars:{type:Object,default:()=>{}}},data:function(){return{cascaderIsReady:!1,previousShowAllChecked:{species:!1,gender:!1,organ:!1,datasets:!1},showFilters:!0,showFiltersText:!0,cascadeSelected:[],cascadeSelectedWithBoolean:[],numberShown:10,filters:[],facets:["Species","Gender","Organ","Datasets"],numberDatasetsShown:["10","20","50"],props:{multiple:!0},options:[{value:"Species",label:"Species",children:[{}]}],presentTags:[]}},setup(){const e=n.markRaw({}),t=n.markRaw({term:new Set,facet:new Set,facet2:new Set});return{cascaderTags:e,correctnessCheck:t}},computed:{numberOfResultsText:function(){return`${this.entry.numberOfHits} results | Showing`}},methods:{createCascaderItemValue:function(e,t=void 0,r=void 0){let o=e;return t&&(o=`${e}>${t}`),t&&r&&(o=`${e}>${t}>${r}`),!t&&r&&console.warn(`Warning: ${r} provided without its parent, this will not be shown in the cascader`),o},populateCascader:function(){return new Promise(e=>{this.algoliaClient.getAlgoliaFacets(hc).then(t=>{this.facets=t,this.options=t,this.options.forEach((r,o)=>{this.options[o].total=this.countTotalFacet(r),this.options[o].label=mc(r.label),this.options[o].value=this.createCascaderItemValue(r.key,void 0),this.options[o].children.unshift({value:this.createCascaderItemValue("Show all"),label:"Show all"}),this.options[o].children.forEach((a,s)=>{this.options[o].children[s].label=mc(a.label),this.options[o].children[s].value=this.createCascaderItemValue(r.label,a.label),this.options[o].children[s].children&&this.options[o].children[s].children.length>0&&this.options[o].children[s].children.forEach((i,l)=>{this.options[o].children[s].children[l].label=mc(i.label),this.options[o].children[s].children[l].value=this.createCascaderItemValue(r.label,a.label,i.label)})})})}).finally(()=>{e()})})},cascadeTagClose:function(e){let t=[];Object.entries(this.cascaderTags).map(r=>{const o=r[0],a=r[1],s=this.options.filter(l=>l.label==o)[0],i=s.key;for(let l=0;l<s.children.length;l++){const c=s.children[l],d=c.label,u=c.value;if(Array.isArray(a))if(a.length===0&&d.toLowerCase()==="show all"){t.push([i,u]);break}else d!==e&&a.includes(d)&&t.push([i,u]);else Object.entries(a).map(f=>{const g=f[0],h=f[1];g===d&&c.children.map(p=>{const m=p.label,y=p.value;m!==e&&h.includes(m)&&t.push([i,y])})})}}),this.cascadeEvent(t)},tagsChangedCallback:function(e){this.correctnessCheck.term&&this.correctnessCheck.facet&&this.correctnessCheck.facet2&&this.options.map(t=>{this.correctnessCheck.term.add(t.label),t.children.map(r=>{this.correctnessCheck.facet.add(r.label),t.label==="Anatomical structure"&&r.label!=="Show all"&&r.children.map(o=>{this.correctnessCheck.facet2.add(o.label)})})}),this.cascaderTags={},this.presentTags=[],e.map(t=>{const{facet:r,facet2:o,term:a}=t;this.correctnessCheck.term.has(a)&&this.correctnessCheck.facet.has(r)&&(o?this.correctnessCheck.facet2.has(o)&&(a in this.cascaderTags?r in this.cascaderTags[a]?this.cascaderTags[a][r].push(o):this.cascaderTags[a][r]=[o]:(this.cascaderTags[a]={},this.cascaderTags[a][r]=[o])):a in this.cascaderTags&&a!=="Anatomical structure"?this.cascaderTags[a].push(r):r.toLowerCase()!=="show all"?this.cascaderTags[a]=[r]:this.cascaderTags[a]=[])}),Object.values(this.cascaderTags).map(t=>{const r=Array.isArray(t)?t:Object.values(t).flat(1);this.presentTags=[...this.presentTags,...r]}),this.presentTags=[...new Set(this.presentTags)],this.presentTags.length>0?this.showFiltersText=!1:this.showFiltersText=!0},countTotalFacet:function(e){return["anatomy.organ.category.name"].includes(e.key)?e.children.reduce((r,o)=>(r=typeof r=="number"?r:r.children.length,r+o.children.length)):e.children.length},showAllEventModifierForAutoCheckAll:function(e){const t={};return e.map(r=>{const o=r[0];o in t?t[o]+=1:t[o]=1}),this.options.map(r=>{const o=r.key,a=r.children.filter(i=>i.label==="Show all")[0].value,s=r.total;t[o]===s&&(e=e.filter(i=>i[0]!==r.key),delete t[o]),o in t||e.unshift([o,a])}),e},cascadeEvent:function(e){let t=[...e];if(t){if(t=this.showAllEventModifier(t),t=this.showAllEventModifierForAutoCheckAll(t),this.__expandItem__){let a=0;this.__expandItem__.length>1&&(a=1);const s=t.filter(l=>l[a]==this.__expandItem__[a]),i=t.filter(l=>l[a]!==this.__expandItem__[a]);t=[...s,...i]}let r=t.filter(a=>a!==void 0).map(a=>{let{hString:s,bString:i}=this.findHierarachyStringAndBooleanString(a),{facet:l,facet2:c,term:d}=this.getFacetsFromHierarchyString(s);return{facetPropPath:a[0],facet:l,facet2:c,term:d,AND:i}}),o=t.filter(a=>a!==void 0).map(a=>{let s,i=a[0].includes("duplicate")?a[0].split("duplicate")[0]:a[0],{hString:l,bString:c}=this.findHierarachyStringAndBooleanString(a),{facet:d,facet2:u,term:f}=this.getFacetsFromHierarchyString(l);return u&&(d=u,s="anatomy.organ.name"),{facetPropPath:i,facet:d,term:f,AND:c,facetSubPropPath:s}});this.$emit("loading",!0),this.$emit("filterResults",o),this.setCascader(r),this.cssMods()}},findHierarachyStringAndBooleanString(e){let t,r;return e.length>=3?e[2]&&(typeof e[2]=="string"||e[2]instanceof String)&&e[2].split(">").length>2?(t=e[2],r=e.length==4?e[3]:void 0):(t=e[1],r=e[2]):(t=e[1],r=void 0),{hString:t,bString:r}},getFacetsFromHierarchyString(e){let t,r,o,a=e.split(">");return a.length==3?(o=a[2],t=a[1],r=a[0]):(t=a[1],r=a[0]),{facet:t,facet2:o,term:r}},showAllEventModifier:function(e){if(e.map(r=>r?r[1].toLowerCase().includes("show all"):!1).includes(!0)){let r=[],o={};for(const a in e)o[e[a][0]]===void 0&&(o[e[a][0]]=[]),o[e[a][0]].push(e[a]);for(const a in o){let s;for(let i=o[a].length-1;i>=0;i--)if(o[a][i][1].toLowerCase().includes("show all")){s=o[a].splice(i,1)[0];break}s?this.previousShowAllChecked[a]&&o[a].length>0?r.push(...o[a]):r.push(s):r.push(...o[a])}return r.sort((a,s)=>this.__expandItem__?a[0]==this.__expandItem__?s[0]==this.__expandItem__?0:-1:s[0]==this.__expandItem__?a[0]==this.__expandItem__?0:1:0:0)}return e},cascadeExpandChange:function(e){this.__expandItem__=e,this.cssMods()},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=r=>{let o=[r.facetPropPath,this.createCascaderItemValue(_s(r.term),r.facet)];return r.facet2&&o.push(this.createCascaderItemValue(_s(r.term),r.facet,r.facet2)),o};this.cascadeSelected=e.map(r=>t(r)),this.cascadeSelectedWithBoolean=e.map(r=>{let o=t(r);return o.push(r.AND),o}),this.updatePreviousShowAllChecked(this.cascadeSelected)}this.tagsChangedCallback(e)},addFilter:function(e){if(this.cascaderIsReady&&e){let t=this.validateAndConvertFilterToHierarchical(e);if(t)return this.cascadeSelected.filter(r=>r.term!=t.term),this.cascadeSelected.push([t.facetPropPath,this.createCascaderItemValue(t.term,t.facet),this.createCascaderItemValue(t.term,t.facet,t.facet2)]),this.cascadeSelectedWithBoolean.push([t.facetPropPath,this.createCascaderItemValue(t.term,t.facet),this.createCascaderItemValue(t.term,t.facet,t.facet2),t.AND]),!0}},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(),this.removeTopLevelCascaderCheckboxes()},removeTopLevelCascaderCheckboxes:function(){this.$nextTick(()=>{document.querySelectorAll(".sidebar-cascader-popper .el-cascader-menu__list")[0].querySelectorAll(".el-checkbox__input").forEach(t=>t.style.display="none")})},validateAndConvertFilterToHierarchical:function(e){if(e&&e.facet&&e.term){if(e.facet2)return e;for(const t of this.options)if(t.value===e.facetPropPath)for(const r of t.children){if(r.label===e.facet)return e;if(r.children&&r.children.length>0){for(const o of r.children)if(o.label===e.facet)return e.facet2=o.label,e.facet=r.label,e}}}return!1},getHierarchicalValidatedFilters:function(e){if(e)if(this.cascaderIsReady){const t=[];return e.forEach(r=>{const o=this.validateAndConvertFilterToHierarchical(r);o&&t.push(o)}),t}else return e;return[]}},mounted:function(){this.algoliaClient=new Bg(this.envVars.ALGOLIA_ID,this.envVars.ALGOLIA_KEY,this.envVars.PENNSIEVE_API_LOCATION),this.algoliaClient.initIndex(this.envVars.ALGOLIA_INDEX),this.populateCascader().then(()=>{this.cascaderIsReady=!0,this.checkShowAllBoxes(),this.setCascader(this.entry.filterFacets),this.cssMods(),this.$emit("cascaderReady")})}},QA=e=>(n.pushScopeId("data-v-6eb85be8"),e=e(),n.popScopeId(),e),e6={class:"filters"},t6={key:0,class:"cascader-tag"},n6={class:"el-tags-container"},r6={class:"el-tags-container"},o6={class:"search-filters transition-box"},a6={key:0,class:"filter-default-value"},s6=QA(()=>n.createElementVNode("div",null,[n.createElementVNode("strong",null,"Within categories:"),n.createTextVNode(" OR "),n.createElementVNode("br"),n.createTextVNode(" example: 'heart' OR 'colon' "),n.createElementVNode("br"),n.createElementVNode("br"),n.createElementVNode("strong",null,"Between categories:"),n.createTextVNode(" AND "),n.createElementVNode("br"),n.createTextVNode(" example: 'rat' AND 'lung' ")],-1)),i6={class:"dataset-shown"},l6={class:"dataset-results-feedback"};function c6(e,t,r,o,a,s){const i=n.resolveComponent("MapSvgSpriteColor"),l=Br,c=Xf,d=Hf,u=n.resolveComponent("MapSvgIcon"),f=$a,g=So,h=Zi;return n.openBlock(),n.createElementBlock("div",e6,[n.createVNode(i),e.presentTags.length>0?(n.openBlock(),n.createElementBlock("div",t6,[n.createVNode(l,{class:"ml-2",type:"info",closable:"",onClose:t[0]||(t[0]=p=>s.cascadeTagClose(e.presentTags[0]))},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(e.presentTags[0]),1)]),_:1}),e.presentTags.length>1?(n.openBlock(),n.createBlock(c,{key:0,placement:"bottom-start",width:200,trigger:"hover"},{default:n.withCtx(()=>[n.createElementVNode("div",n6,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.presentTags.slice(1),(p,m)=>(n.openBlock(),n.createBlock(l,{key:m,class:"ml-2",type:"info",closable:"",onClose:y=>s.cascadeTagClose(p)},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(p),1)]),_:2},1032,["onClose"]))),128))])]),reference:n.withCtx(()=>[n.createElementVNode("div",r6,[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",o6,[n.createVNode(d,{class:"cascader",ref:"cascader",modelValue:e.cascadeSelected,"onUpdate:modelValue":t[1]||(t[1]=p=>e.cascadeSelected=p),size:"large",placeholder:" ","collapse-tags":!0,"collapse-tags-tooltip":"",options:e.options,props:e.props,onChange:t[2]||(t[2]=p=>s.cascadeEvent(p)),onExpandChange:s.cascadeExpandChange,"show-all-levels":!0,"popper-class":"sidebar-cascader-popper"},null,8,["modelValue","options","props","onExpandChange"]),e.showFiltersText?(n.openBlock(),n.createElementBlock("div",a6,"Filters")):n.createCommentVNode("",!0),n.createVNode(c,{title:"How do filters work?",width:"250",trigger:"hover","append-to-body":!1,"popper-class":"popover"},{reference:n.withCtx(()=>[n.createVNode(u,{icon:"help",class:"help"})]),default:n.withCtx(()=>[s6]),_:1})])),[[n.vShow,e.showFilters],[h,!e.cascaderIsReady]])]),_:1}),n.createElementVNode("div",i6,[n.createElementVNode("span",l6,n.toDisplayString(s.numberOfResultsText),1),n.createVNode(g,{class:"number-shown-select",modelValue:e.numberShown,"onUpdate:modelValue":t[3]||(t[3]=p=>e.numberShown=p),placeholder:"10",onChange:t[4]||(t[4]=p=>s.numberShownChanged(p))},{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.numberDatasetsShown,p=>(n.openBlock(),n.createBlock(f,{key:p,label:p,value:p},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])])])}const Ag=Ln(XA,[["render",c6],["__scopeId","data-v-6eb85be8"]]);var d6=async function(e){if(!e.ok){let t=await e.json();throw t?new Error(t.message):new Error(e)}return e},u6={searchInput:"",lastSearch:"",results:[],numberOfHits:0,filter:[],loadingCards:!1,numberPerPage:10,page:1,pageModel:1,start:0,hasSearched:!1,contextCardEnabled:!1};const f6={components:{SearchFilters:Ag,DatasetCard:Jm,SearchHistory:Ym,Button:Or,Card:Bf,Drawer:Wi,Icon:Pe,Input:vo,Pagination:Zf},name:"SideBarContent",props:{visible:{type:Boolean,default:!1},isDrawer:{type:Boolean,default:!0},entry:{type:Object,default:()=>u6},envVars:{type:Object,default:()=>{}}},data:function(){return{...this.entry,bodyStyle:{flex:"1 1 auto","flex-flow":"column",display:"flex"},cascaderIsReady:!1}},computed:{filterEntry:function(){return{numberOfHits:this.numberOfHits,filterFacets:this.filter}}},methods:{hoverChanged:function(e){this.$emit("hover-changed",e)},resetSearch:function(){this.numberOfHits=0,this.discoverIds=[],this._dois=[],this.results=[],this.loadingCards=!1},openSearch:function(e,t=""){this.searchInput=t,this.resetPageNavigation(),this.cascaderIsReady?(this.filter=this.$refs.filtersRef.getHierarchicalValidatedFilters(e),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.filter=e,(!e||e.length==0)&&this.searchAlgolia(this.filter,t))},addFilter:function(e){this.cascaderIsReady?(this.resetPageNavigation(),e&&this.$refs.filtersRef.addFilter(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.resetPageNavigation(),this.searchAlgolia(this.filters,this.searchInput),this.$refs.searchHistory.selectValue="Full search history"},searchEvent:function(e=!1){(e.keyCode===13||e instanceof MouseEvent)&&(this.resetPageNavigation(),this.searchAlgolia(this.filters,this.searchInput),this.$refs.searchHistory.selectValue="Full search history",this.$refs.searchHistory.addSearchToHistory(this.filters,this.searchInput))},filterUpdate:function(e){this.filters=[...e],this.resetPageNavigation(),this.searchAlgolia(e,this.searchInput),this.$emit("search-changed",{value:e,type:"filter-update"})},searchAlgolia(e,t=""){this.loadingCards=!0,this.algoliaClient.anatomyInSearch(Ng(e),t).then(r=>{Yt.emit("anatomy-in-datasets",r.forFlatmap),Yt.emit("number-of-datasets-for-anatomies",r.forScaffold)}),this.algoliaClient.search(Ng(e),t,this.numberPerPage,this.page).then(r=>{this.numberOfHits=r.total,this.discoverIds=r.discoverIds,this._dois=r.dois,this.results=r.items,this.loadingCards=!1,this.scrollToTop(),this.$emit("search-changed",{value:this.searchInput,type:"query-update"}),this._abortController&&this._abortController.abort(),this._abortController=new AbortController;const o=this._abortController.signal;this.perItemSearch(o,{count:0})})},filtersLoading:function(e){this.loadingCards=e},numberPerPageUpdate:function(e){this.numberPerPage=e,this.pageChange(1)},pageChange:function(e){this.start=(e-1)*this.numberPerPage,this.page=e,this.searchAlgolia(this.filters,this.searchInput,this.numberPerPage,this.page)},handleMissingData:function(e){let t=this.results.findIndex(r=>r.doi===e);this.results[t]&&(this.results[t].detailsReady=!0)},perItemSearch:function(e,t){if(10>t.count){const o=this._dois.shift();o&&(t.count++,this.callSciCrunch(this.envVars.API_LOCATION,{dois:[o]},e).then(a=>{a.numberOfHits===0?this.handleMissingData(o):this.resultsProcessing(a),this.$refs.content.style["overflow-y"]="scroll",t.count--,this.perItemSearch(e,t)}).catch(a=>{a.name!=="AbortError"&&(this.handleMissingData(o),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 r=this.results.findIndex(o=>t.doi?t.doi.includes(o.doi):!1);Object.assign(this.results[r],t),Object.assign(this.results[r],{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(o=>o.name))]:void 0,species:t.organisms&&t.organisms[0].species?[...new Set(t.organisms.map(o=>o.species?o.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-file"],additionalLinks:t.additionalLinks,detailsReady:!0}),this.results[r]=this.results[r]})},createfilterParams:function(e){let t=new URLSearchParams;for(const r in e)Array.isArray(e[r])?e[r].forEach(o=>{t.append(r,o)}):t.append(r,e[r]);return t.toString()},callSciCrunch:function(e,t={},r){return new Promise((o,a)=>{let s=this.envVars.API_LOCATION+this.searchEndpoint+"?"+this.createfilterParams(t);fetch(s,{signal:r}).then(d6).then(i=>i.json()).then(i=>o(i)).catch(i=>a(i))})},getAlgoliaFacets:async function(){return await this.algoliaClient.getAlgoliaFacets(hc)},searchHistorySearch:function(e){this.searchInput=e.search,this.filters=e.filters,this.openSearch(e.filters,e.search)}},mounted:function(){this.algoliaClient=new Bg(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/"}},p6={class:"header"},h6={class:"content scrollbar",ref:"content"},m6={key:0,class:"error-feedback"};function g6(e,t,r,o,a,s){const i=vo,l=Or,c=Ag,d=Ym,u=Jm,f=Zf,g=Bf,h=Zi;return n.openBlock(),n.createBlock(g,{"body-style":e.bodyStyle,class:"content-card"},{header:n.withCtx(()=>[n.createElementVNode("div",p6,[n.createVNode(i,{class:"search-input",placeholder:"Search",modelValue:e.searchInput,"onUpdate:modelValue":t[0]||(t[0]=p=>e.searchInput=p),onKeyup:s.searchEvent,clearable:"",onClear:s.clearSearchClicked},null,8,["modelValue","onKeyup","onClear"]),n.createVNode(l,{type:"primary",class:"button",onClick:s.searchEvent,size:"large"},{default:n.withCtx(()=>[n.createTextVNode(" Search ")]),_:1},8,["onClick"])])]),default:n.withCtx(()=>[n.createVNode(c,{class:"filters",ref:"filtersRef",entry:s.filterEntry,envVars:r.envVars,onFilterResults:s.filterUpdate,onNumberPerPage:s.numberPerPageUpdate,onLoading:s.filtersLoading,onCascaderReady:s.cascaderReady},null,8,["entry","envVars","onFilterResults","onNumberPerPage","onLoading","onCascaderReady"]),n.createVNode(d,{ref:"searchHistory",onSearch:s.searchHistorySearch},null,8,["onSearch"]),n.withDirectives((n.openBlock(),n.createElementBlock("div",h6,[e.results.length===0&&!e.loadingCards?(n.openBlock(),n.createElementBlock("div",m6," No results found - Please change your search / filter criteria. ")):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.results,p=>(n.openBlock(),n.createElementBlock("div",{key:p.doi,class:"step-item"},[n.createVNode(u,{class:"dataset-card",entry:p,envVars:r.envVars,onMouseenter:m=>s.hoverChanged(p),onMouseleave:t[1]||(t[1]=m=>s.hoverChanged(void 0))},null,8,["entry","envVars","onMouseenter"])]))),128)),n.createVNode(f,{class:"pagination","current-page":e.page,"onUpdate:currentPage":t[2]||(t[2]=p=>e.page=p),"hide-on-single-page":"",large:"",layout:"prev, pager, next","page-size":e.numberPerPage,total:e.numberOfHits,onCurrentChange:s.pageChange},null,8,["current-page","page-size","total","onCurrentChange"])])),[[h,e.loadingCards]])]),_:1},8,["body-style"])}const Ig=Ln(f6,[["render",g6],["__scopeId","data-v-aa5467f3"]]),y6={name:"Tabs",props:{tabTitles:{type:Array,default:()=>[]},activeId:{type:Number,default:1}},methods:{titleClicked:function(e){this.$emit("titleClicked",e)}}},b6={class:"tab-container"},w6=["onClick"],C6={class:"title-text"};function v6(e,t,r,o,a,s){return n.openBlock(),n.createElementBlock("div",b6,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(r.tabTitles,i=>(n.openBlock(),n.createElementBlock("div",{class:"title",key:i.id},[n.createElementVNode("div",{class:n.normalizeClass(["title-text-table",{highlightText:i.id==r.activeId}]),onClick:l=>s.titleClicked(i.id)},[n.createElementVNode("div",C6,n.toDisplayString(i.title),1)],10,w6)]))),128))])}const Pg=Ln(y6,[["render",v6],["__scopeId","data-v-9d874017"]]),k6={components:{SidebarContent:Ig,Tabs:Pg,ElIconArrowLeft:ii,ElIconArrowRight:da,Drawer:Wi,Icon:Pe},name:"SideBar",props:{visible:{type:Boolean,default:!1},envVars:{type:Object,default:()=>{}},tabs:{type:Array,default:()=>[{title:"flatmap",id:1}]},activeId:{type:Number,default:1},openAtStart:{type:Boolean,default:!1}},data:function(){return{drawerOpen:!1}},methods:{hoverChanged:function(e){this.$emit("hover-changed",e)},searchChanged:function(e,t){this.$emit("search-changed",{...t,id:e})},close:function(){this.drawerOpen=!1},toggleDrawer:function(){this.drawerOpen=!this.drawerOpen},openSearch:function(e,t){this.drawerOpen=!0,this.$nextTick(()=>{this.$refs[this.activeId][0].openSearch(e,t)})},addFilter:function(e){this.drawerOpen=!0,e.AND=!0,this.$nextTick(()=>{this.$refs[this.activeId][0].addFilter(e)})},openNeuronSearch:function(e){this.drawerOpen=!0,this.$nextTick(()=>{this.$refs[this.activeId][0].openSearch("",void 0,"scicrunch-query-string/",{field:"*organ.curie",curie:e})})},getAlgoliaFacets:async function(){return await this.$refs[this.activeId][0].getAlgoliaFacets()},setDrawerOpen:function(e=!0){this.drawerOpen=e},tabClicked:function(e){this.$emit("tabClicked",e)}},created:function(){this.drawerOpen=this.openAtStart},mounted:function(){Yt.on("PopoverActionClick",e=>{this.$emit("actionClick",e)}),Yt.on("number-of-datasets-for-anatomies",e=>{this.$emit("number-of-datasets-for-anatomies",e)}),Yt.on("anatomy-in-datasets",e=>{this.$emit("anatomy-in-datasets",e)}),Yt.on("contextUpdate",e=>{this.$emit("contextUpdate",e)}),Yt.on("datalink-clicked",e=>{this.$emit("datalink-clicked",e)})}},S6={ref:"container"},x6={class:"box-card"},E6={class:"sidebar-container"};function O6(e,t,r,o,a,s){const i=ii,l=Pe,c=da,d=Pg,u=Ig,f=Wi;return n.openBlock(),n.createElementBlock("div",S6,[e.drawerOpen?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("div",{key:0,onClick:t[0]||(t[0]=(...g)=>s.toggleDrawer&&s.toggleDrawer(...g)),class:"open-tab"},[n.createVNode(l,null,{default:n.withCtx(()=>[n.createVNode(i)]),_:1})])),n.createVNode(f,{class:"side-bar my-drawer",modelValue:e.drawerOpen,"onUpdate:modelValue":t[3]||(t[3]=g=>e.drawerOpen=g),teleported:!1,"modal-append-to-body":!1,size:"584","with-header":!1,wrapperClosable:!1,modal:!1,"modal-class":"sidebar-body","z-index":10,"lock-scroll":!1},{default:n.withCtx(()=>[n.createElementVNode("div",x6,[e.drawerOpen?(n.openBlock(),n.createElementBlock("div",{key:0,onClick:t[1]||(t[1]=(...g)=>s.close&&s.close(...g)),class:"close-tab"},[n.createVNode(l,null,{default:n.withCtx(()=>[n.createVNode(c)]),_:1})])):n.createCommentVNode("",!0),n.createElementVNode("div",E6,[r.tabs.length>1?(n.openBlock(),n.createBlock(d,{key:0,tabTitles:r.tabs,activeId:r.activeId,onTitleClicked:s.tabClicked},null,8,["tabTitles","activeId","onTitleClicked"])):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(r.tabs,g=>n.withDirectives((n.openBlock(),n.createBlock(u,{key:"tab.id",class:"sidebar-content-container",contextCardEntry:g.contextCard,envVars:r.envVars,ref_for:!0,ref:g.id,onSearchChanged:h=>s.searchChanged(g.id,h),onHoverChanged:t[2]||(t[2]=h=>s.hoverChanged(h))},null,8,["contextCardEntry","envVars","onSearchChanged"])),[[n.vShow,g.id===r.activeId]])),128))])])]),_:1},8,["modelValue"])],512)}const _6=Ln(k6,[["render",O6],["__scopeId","data-v-b57d4d14"]]);je.SideBar=_6,Object.defineProperty(je,Symbol.toStringTag,{value:"Module"})});
409
+ `)},WA=["innerHTML"];function KA(e,t,r,o,a,s){return n.openBlock(),n.createElementBlock("svg",{width:"0",height:"0",style:{display:"none"},innerHTML:e.$options.svgSprite},null,8,WA)}const GA=Xm(qA,[["render",KA]]);var Tg={exports:{}};/*! algoliasearch.umd.js | 4.22.1 | © Algolia, inc. | https://github.com/algolia/algoliasearch-client-javascript */(function(e,t){(function(r,o){e.exports=o()})(PS,function(){function r(w,C,v){return C in w?Object.defineProperty(w,C,{value:v,enumerable:!0,configurable:!0,writable:!0}):w[C]=v,w}function o(w,C){var v=Object.keys(w);if(Object.getOwnPropertySymbols){var x=Object.getOwnPropertySymbols(w);C&&(x=x.filter(function(N){return Object.getOwnPropertyDescriptor(w,N).enumerable})),v.push.apply(v,x)}return v}function a(w){for(var C=1;C<arguments.length;C++){var v=arguments[C]!=null?arguments[C]:{};C%2?o(Object(v),!0).forEach(function(x){r(w,x,v[x])}):Object.getOwnPropertyDescriptors?Object.defineProperties(w,Object.getOwnPropertyDescriptors(v)):o(Object(v)).forEach(function(x){Object.defineProperty(w,x,Object.getOwnPropertyDescriptor(v,x))})}return w}function s(w,C){if(w==null)return{};var v,x,N=function(J,V){if(J==null)return{};var G,Q,Y={},ae=Object.keys(J);for(Q=0;Q<ae.length;Q++)G=ae[Q],V.indexOf(G)>=0||(Y[G]=J[G]);return Y}(w,C);if(Object.getOwnPropertySymbols){var z=Object.getOwnPropertySymbols(w);for(x=0;x<z.length;x++)v=z[x],C.indexOf(v)>=0||Object.prototype.propertyIsEnumerable.call(w,v)&&(N[v]=w[v])}return N}function i(w,C){return function(v){if(Array.isArray(v))return v}(w)||function(v,x){if(Symbol.iterator in Object(v)||Object.prototype.toString.call(v)==="[object Arguments]"){var N=[],z=!0,J=!1,V=void 0;try{for(var G,Q=v[Symbol.iterator]();!(z=(G=Q.next()).done)&&(N.push(G.value),!x||N.length!==x);z=!0);}catch(Y){J=!0,V=Y}finally{try{z||Q.return==null||Q.return()}finally{if(J)throw V}}return N}}(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 v=0,x=new Array(C.length);v<C.length;v++)x[v]=C[v];return x}}(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,v="algoliasearch-client-js-".concat(w.key),x=function(){return C===void 0&&(C=w.localStorage||window.localStorage),C},N=function(){return JSON.parse(x().getItem(v)||"{}")},z=function(V){x().setItem(v,JSON.stringify(V))},J=function(){var V=w.timeToLive?1e3*w.timeToLive:null,G=N(),Q=Object.fromEntries(Object.entries(G).filter(function(ae){return i(ae,2)[1].timestamp!==void 0}));if(z(Q),V){var Y=Object.fromEntries(Object.entries(Q).filter(function(ae){var oe=i(ae,2)[1],me=new Date().getTime();return!(oe.timestamp+V<me)}));z(Y)}};return{get:function(V,G){var Q=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{miss:function(){return Promise.resolve()}};return Promise.resolve().then(function(){J();var Y=JSON.stringify(V);return N()[Y]}).then(function(Y){return Promise.all([Y?Y.value:G(),Y!==void 0])}).then(function(Y){var ae=i(Y,2),oe=ae[0],me=ae[1];return Promise.all([oe,me||Q.miss(oe)])}).then(function(Y){return i(Y,1)[0]})},set:function(V,G){return Promise.resolve().then(function(){var Q=N();return Q[JSON.stringify(V)]={timestamp:new Date().getTime(),value:G},x().setItem(v,JSON.stringify(Q)),G})},delete:function(V){return Promise.resolve().then(function(){var G=N();delete G[JSON.stringify(V)],x().setItem(v,JSON.stringify(G))})},clear:function(){return Promise.resolve().then(function(){x().removeItem(v)})}}}function d(w){var C=l(w.caches),v=C.shift();return v===void 0?{get:function(x,N){var z=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{miss:function(){return Promise.resolve()}},J=N();return J.then(function(V){return Promise.all([V,z.miss(V)])}).then(function(V){return i(V,1)[0]})},set:function(x,N){return Promise.resolve(N)},delete:function(x){return Promise.resolve()},clear:function(){return Promise.resolve()}}:{get:function(x,N){var z=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{miss:function(){return Promise.resolve()}};return v.get(x,N,z).catch(function(){return d({caches:C}).get(x,N,z)})},set:function(x,N){return v.set(x,N).catch(function(){return d({caches:C}).set(x,N)})},delete:function(x){return v.delete(x).catch(function(){return d({caches:C}).delete(x)})},clear:function(){return v.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(v,x){var N=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{miss:function(){return Promise.resolve()}},z=JSON.stringify(v);if(z in C)return Promise.resolve(w.serializable?JSON.parse(C[z]):C[z]);var J=x(),V=N&&N.miss||function(){return Promise.resolve()};return J.then(function(G){return V(G)}).then(function(){return J})},set:function(v,x){return C[JSON.stringify(v)]=w.serializable?JSON.stringify(x):x,Promise.resolve(x)},delete:function(v){return delete C[JSON.stringify(v)],Promise.resolve()},clear:function(){return C={},Promise.resolve()}}}function f(w,C,v){var x={"x-algolia-api-key":v,"x-algolia-application-id":C};return{headers:function(){return w===b.WithinHeaders?x:{}},queryParameters:function(){return w===b.WithinQueryParameters?x:{}}}}function g(w){var C=0;return w(function v(){return C++,new Promise(function(x){setTimeout(function(){x(w(v))},Math.min(100*C,1e3))})})}function h(w){var C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(v,x){return Promise.resolve()};return Object.assign(w,{wait:function(v){return h(w.then(function(x){return Promise.all([C(x,v),x])}).then(function(x){return x[1]}))}})}function p(w){for(var C=w.length-1;C>0;C--){var v=Math.floor(Math.random()*(C+1)),x=w[C];w[C]=w[v],w[v]=x}return w}function m(w,C){return C&&Object.keys(C).forEach(function(v){w[v]=C[v](w)}),w}function y(w){for(var C=arguments.length,v=new Array(C>1?C-1:0),x=1;x<C;x++)v[x-1]=arguments[x];var N=0;return w.replace(/%s/g,function(){return encodeURIComponent(v[N++])})}var b={WithinQueryParameters:0,WithinHeaders:1};function k(w,C){var v=w||{},x=v.data||{};return Object.keys(v).forEach(function(N){["timeout","headers","queryParameters","data","cacheable"].indexOf(N)===-1&&(x[N]=v[N])}),{data:Object.entries(x).length>0?x:void 0,timeout:v.timeout||C,headers:v.headers||{},queryParameters:v.queryParameters||{},cacheable:v.cacheable}}var E={Read:1,Write:2,Any:3},S=1,T=2,_=3;function O(w){var C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:S;return a(a({},w),{},{status:C,lastUpdate:Date.now()})}function B(w){return typeof w=="string"?{protocol:"https",url:w,accept:E.Any}:{protocol:w.protocol||"https",url:w.url,accept:w.accept||E.Any}}var U="DELETE",$="GET",P="POST",F="PUT";function j(w,C){return Promise.all(C.map(function(v){return w.get(v,function(){return Promise.resolve(O(v))})})).then(function(v){var x=v.filter(function(J){return function(V){return V.status===S||Date.now()-V.lastUpdate>12e4}(J)}),N=v.filter(function(J){return function(V){return V.status===_&&Date.now()-V.lastUpdate<=12e4}(J)}),z=[].concat(l(x),l(N));return{getTimeout:function(J,V){return(N.length===0&&J===0?1:N.length+3+J)*V},statelessHosts:z.length>0?z.map(function(J){return B(J)}):C}})}function Z(w,C,v,x){var N=[],z=function(oe,me){if(!(oe.method===$||oe.data===void 0&&me.data===void 0)){var ce=Array.isArray(oe.data)?oe.data:a(a({},oe.data),me.data);return JSON.stringify(ce)}}(v,x),J=function(oe,me){var ce=a(a({},oe.headers),me.headers),Ee={};return Object.keys(ce).forEach(function(Ie){var bt=ce[Ie];Ee[Ie.toLowerCase()]=bt}),Ee}(w,x),V=v.method,G=v.method!==$?{}:a(a({},v.data),x.data),Q=a(a(a({"x-algolia-agent":w.userAgent.value},w.queryParameters),G),x.queryParameters),Y=0,ae=function oe(me,ce){var Ee=me.pop();if(Ee===void 0)throw{name:"RetryError",message:"Unreachable hosts - your application id may be incorrect. If the error persists, contact support@algolia.com.",transporterStackTrace:te(N)};var Ie={data:z,headers:J,method:V,url:A(Ee,v.path,Q),connectTimeout:ce(Y,w.timeouts.connect),responseTimeout:ce(Y,x.timeout)},bt=function(wt){var rt={request:Ie,response:wt,host:Ee,triesLeft:me.length};return N.push(rt),rt},Wo={onSuccess:function(wt){return function(rt){try{return JSON.parse(rt.content)}catch(fr){throw function(Gn,Zr){return{name:"DeserializationError",message:Gn,response:Zr}}(fr.message,rt)}}(wt)},onRetry:function(wt){var rt=bt(wt);return wt.isTimedOut&&Y++,Promise.all([w.logger.info("Retryable failure",Ce(rt)),w.hostsCache.set(Ee,O(Ee,wt.isTimedOut?_:T))]).then(function(){return oe(me,ce)})},onFail:function(wt){throw bt(wt),function(rt,fr){var Gn=rt.content,Zr=rt.status,Ko=Gn;try{Ko=JSON.parse(Gn).message}catch{}return function(As,Nc,z6){return{name:"ApiError",message:As,status:Nc,transporterStackTrace:z6}}(Ko,Zr,fr)}(wt,te(N))}};return w.requester.send(Ie).then(function(wt){return function(rt,fr){return function(Gn){var Zr=Gn.status;return Gn.isTimedOut||function(Ko){var As=Ko.isTimedOut,Nc=Ko.status;return!As&&~~Nc==0}(Gn)||~~(Zr/100)!=2&&~~(Zr/100)!=4}(rt)?fr.onRetry(rt):~~(rt.status/100)==2?fr.onSuccess(rt):fr.onFail(rt)}(wt,Wo)})};return j(w.hostsCache,C).then(function(oe){return ae(l(oe.statelessHosts).reverse(),oe.getTimeout)})}function W(w){var C=w.hostsCache,v=w.logger,x=w.requester,N=w.requestsCache,z=w.responsesCache,J=w.timeouts,V=w.userAgent,G=w.hosts,Q=w.queryParameters,Y={hostsCache:C,logger:v,requester:x,requestsCache:N,responsesCache:z,timeouts:J,userAgent:V,headers:w.headers,queryParameters:Q,hosts:G.map(function(ae){return B(ae)}),read:function(ae,oe){var me=k(oe,Y.timeouts.read),ce=function(){return Z(Y,Y.hosts.filter(function(Ie){return(Ie.accept&E.Read)!=0}),ae,me)};if((me.cacheable!==void 0?me.cacheable:ae.cacheable)!==!0)return ce();var Ee={request:ae,mappedRequestOptions:me,transporter:{queryParameters:Y.queryParameters,headers:Y.headers}};return Y.responsesCache.get(Ee,function(){return Y.requestsCache.get(Ee,function(){return Y.requestsCache.set(Ee,ce()).then(function(Ie){return Promise.all([Y.requestsCache.delete(Ee),Ie])},function(Ie){return Promise.all([Y.requestsCache.delete(Ee),Promise.reject(Ie)])}).then(function(Ie){var bt=i(Ie,2);return bt[0],bt[1]})})},{miss:function(Ie){return Y.responsesCache.set(Ee,Ie)}})},write:function(ae,oe){return Z(Y,Y.hosts.filter(function(me){return(me.accept&E.Write)!=0}),ae,k(oe,Y.timeouts.write))}};return Y}function H(w){var C={value:"Algolia for JavaScript (".concat(w,")"),add:function(v){var x="; ".concat(v.segment).concat(v.version!==void 0?" (".concat(v.version,")"):"");return C.value.indexOf(x)===-1&&(C.value="".concat(C.value).concat(x)),C}};return C}function A(w,C,v){var x=ee(v),N="".concat(w.protocol,"://").concat(w.url,"/").concat(C.charAt(0)==="/"?C.substr(1):C);return x.length&&(N+="?".concat(x)),N}function ee(w){return Object.keys(w).map(function(C){return y("%s=%s",C,(v=w[C],Object.prototype.toString.call(v)==="[object Object]"||Object.prototype.toString.call(v)==="[object Array]"?JSON.stringify(w[C]):w[C]));var v}).join("&")}function te(w){return w.map(function(C){return Ce(C)})}function Ce(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 pe=function(w){return function(C,v){return w.transporter.write({method:P,path:"2/abtests",data:C},v)}},de=function(w){return function(C,v){return w.transporter.write({method:U,path:y("2/abtests/%s",C)},v)}},Re=function(w){return function(C,v){return w.transporter.read({method:$,path:y("2/abtests/%s",C)},v)}},_e=function(w){return function(C){return w.transporter.read({method:$,path:"2/abtests"},C)}},ve=function(w){return function(C,v){return w.transporter.write({method:P,path:y("2/abtests/%s/stop",C)},v)}},We=function(w){return function(C){return w.transporter.read({method:$,path:"1/strategies/personalization"},C)}},Ue=function(w){return function(C,v){return w.transporter.write({method:P,path:"1/strategies/personalization",data:C},v)}};function ke(w){return function C(v){return w.request(v).then(function(x){if(w.batch!==void 0&&w.batch(x.hits),!w.shouldStop(x))return x.cursor?C({cursor:x.cursor}):C({page:(v.page||0)+1})})}({})}var Fe=function(w){return function(C,v){var x=v||{},N=x.queryParameters,z=s(x,["queryParameters"]),J=a({acl:C},N!==void 0?{queryParameters:N}:{});return h(w.transporter.write({method:P,path:"1/keys",data:J},z),function(V,G){return g(function(Q){return ye(w)(V.key,G).catch(function(Y){if(Y.status!==404)throw Y;return Q()})})})}},it=function(w){return function(C,v,x){var N=k(x);return N.queryParameters["X-Algolia-User-ID"]=C,w.transporter.write({method:P,path:"1/clusters/mapping",data:{cluster:v}},N)}},Ne=function(w){return function(C,v,x){return w.transporter.write({method:P,path:"1/clusters/mapping/batch",data:{users:C,cluster:v}},x)}},et=function(w){return function(C,v){return h(w.transporter.write({method:P,path:y("/1/dictionaries/%s/batch",C),data:{clearExistingDictionaryEntries:!0,requests:{action:"addEntry",body:[]}}},v),function(x,N){return qn(w)(x.taskID,N)})}},$e=function(w){return function(C,v,x){return h(w.transporter.write({method:P,path:y("1/indexes/%s/operation",C),data:{operation:"copy",destination:v}},x),function(N,z){return he(w)(C,{methods:{waitTask:Me}}).waitTask(N.taskID,z)})}},kt=function(w){return function(C,v,x){return $e(w)(C,v,a(a({},x),{},{scope:[Bc.Rules]}))}},St=function(w){return function(C,v,x){return $e(w)(C,v,a(a({},x),{},{scope:[Bc.Settings]}))}},mt=function(w){return function(C,v,x){return $e(w)(C,v,a(a({},x),{},{scope:[Bc.Synonyms]}))}},tt=function(w){return function(C,v){return C.method===$?w.transporter.read(C,v):w.transporter.write(C,v)}},Mt=function(w){return function(C,v){return h(w.transporter.write({method:U,path:y("1/keys/%s",C)},v),function(x,N){return g(function(z){return ye(w)(C,N).then(z).catch(function(J){if(J.status!==404)throw J})})})}},xt=function(w){return function(C,v,x){var N=v.map(function(z){return{action:"deleteEntry",body:{objectID:z}}});return h(w.transporter.write({method:P,path:y("/1/dictionaries/%s/batch",C),data:{clearExistingDictionaryEntries:!1,requests:N}},x),function(z,J){return qn(w)(z.taskID,J)})}},ye=function(w){return function(C,v){return w.transporter.read({method:$,path:y("1/keys/%s",C)},v)}},He=function(w){return function(C,v){return w.transporter.read({method:$,path:y("1/task/%s",C.toString())},v)}},lt=function(w){return function(C){return w.transporter.read({method:$,path:"/1/dictionaries/*/settings"},C)}},nt=function(w){return function(C){return w.transporter.read({method:$,path:"1/logs"},C)}},Ve=function(w){return function(C){return w.transporter.read({method:$,path:"1/clusters/mapping/top"},C)}},M=function(w){return function(C,v){return w.transporter.read({method:$,path:y("1/clusters/mapping/%s",C)},v)}},re=function(w){return function(C){var v=C||{},x=v.retrieveMappings,N=s(v,["retrieveMappings"]);return x===!0&&(N.getClusters=!0),w.transporter.read({method:$,path:"1/clusters/mapping/pending"},N)}},he=function(w){return function(C){var v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},x={transporter:w.transporter,appId:w.appId,indexName:C};return m(x,v.methods)}},Ke=function(w){return function(C){return w.transporter.read({method:$,path:"1/keys"},C)}},xn=function(w){return function(C){return w.transporter.read({method:$,path:"1/clusters"},C)}},Hn=function(w){return function(C){return w.transporter.read({method:$,path:"1/indexes"},C)}},En=function(w){return function(C){return w.transporter.read({method:$,path:"1/clusters/mapping"},C)}},D=function(w){return function(C,v,x){return h(w.transporter.write({method:P,path:y("1/indexes/%s/operation",C),data:{operation:"move",destination:v}},x),function(N,z){return he(w)(C,{methods:{waitTask:Me}}).waitTask(N.taskID,z)})}},q=function(w){return function(C,v){return h(w.transporter.write({method:P,path:"1/indexes/*/batch",data:{requests:C}},v),function(x,N){return Promise.all(Object.keys(x.taskID).map(function(z){return he(w)(z,{methods:{waitTask:Me}}).waitTask(x.taskID[z],N)}))})}},X=function(w){return function(C,v){return w.transporter.read({method:P,path:"1/indexes/*/objects",data:{requests:C}},v)}},be=function(w){return function(C,v){var x=C.map(function(N){return a(a({},N),{},{params:ee(N.params||{})})});return w.transporter.read({method:P,path:"1/indexes/*/queries",data:{requests:x},cacheable:!0},v)}},gt=function(w){return function(C,v){return Promise.all(C.map(function(x){var N=x.params,z=N.facetName,J=N.facetQuery,V=s(N,["facetName","facetQuery"]);return he(w)(x.indexName,{methods:{searchForFacetValues:Lg}}).searchForFacetValues(z,J,a(a({},v),V))}))}},yt=function(w){return function(C,v){var x=k(v);return x.queryParameters["X-Algolia-User-ID"]=C,w.transporter.write({method:U,path:"1/clusters/mapping"},x)}},Et=function(w){return function(C,v,x){var N=v.map(function(z){return{action:"addEntry",body:z}});return h(w.transporter.write({method:P,path:y("/1/dictionaries/%s/batch",C),data:{clearExistingDictionaryEntries:!0,requests:N}},x),function(z,J){return qn(w)(z.taskID,J)})}},Wr=function(w){return function(C,v){return h(w.transporter.write({method:P,path:y("1/keys/%s/restore",C)},v),function(x,N){return g(function(z){return ye(w)(C,N).catch(function(J){if(J.status!==404)throw J;return z()})})})}},gc=function(w){return function(C,v,x){var N=v.map(function(z){return{action:"addEntry",body:z}});return h(w.transporter.write({method:P,path:y("/1/dictionaries/%s/batch",C),data:{clearExistingDictionaryEntries:!1,requests:N}},x),function(z,J){return qn(w)(z.taskID,J)})}},yc=function(w){return function(C,v,x){return w.transporter.read({method:P,path:y("/1/dictionaries/%s/search",C),data:{query:v},cacheable:!0},x)}},Ts=function(w){return function(C,v){return w.transporter.read({method:P,path:"1/clusters/mapping/search",data:{query:C}},v)}},bc=function(w){return function(C,v){return h(w.transporter.write({method:F,path:"/1/dictionaries/*/settings",data:C},v),function(x,N){return qn(w)(x.taskID,N)})}},Bs=function(w){return function(C,v){var x=Object.assign({},v),N=v||{},z=N.queryParameters,J=s(N,["queryParameters"]),V=z?{queryParameters:z}:{},G=["acl","indexes","referers","restrictSources","queryParameters","description","maxQueriesPerIPPerHour","maxHitsPerQuery"];return h(w.transporter.write({method:F,path:y("1/keys/%s",C),data:V},J),function(Q,Y){return g(function(ae){return ye(w)(C,Y).then(function(oe){return function(me){return Object.keys(x).filter(function(ce){return G.indexOf(ce)!==-1}).every(function(ce){if(Array.isArray(me[ce])&&Array.isArray(x[ce])){var Ee=me[ce];return Ee.length===x[ce].length&&Ee.every(function(Ie,bt){return Ie===x[ce][bt]})}return me[ce]===x[ce]})}(oe)?Promise.resolve():ae()})})})}},qn=function(w){return function(C,v){return g(function(x){return He(w)(C,v).then(function(N){return N.status!=="published"?x():void 0})})}},Wn=function(w){return function(C,v){return h(w.transporter.write({method:P,path:y("1/indexes/%s/batch",w.indexName),data:{requests:C}},v),function(x,N){return Me(w)(x.taskID,N)})}},wc=function(w){return function(C){return ke(a(a({shouldStop:function(v){return v.cursor===void 0}},C),{},{request:function(v){return w.transporter.read({method:P,path:y("1/indexes/%s/browse",w.indexName),data:v},C)}}))}},Cc=function(w){return function(C){var v=a({hitsPerPage:1e3},C);return ke(a(a({shouldStop:function(x){return x.hits.length<v.hitsPerPage}},v),{},{request:function(x){return Dg(w)("",a(a({},v),x)).then(function(N){return a(a({},N),{},{hits:N.hits.map(function(z){return delete z._highlightResult,z})})})}}))}},vc=function(w){return function(C){var v=a({hitsPerPage:1e3},C);return ke(a(a({shouldStop:function(x){return x.hits.length<v.hitsPerPage}},v),{},{request:function(x){return Vg(w)("",a(a({},v),x)).then(function(N){return a(a({},N),{},{hits:N.hits.map(function(z){return delete z._highlightResult,z})})})}}))}},Kr=function(w){return function(C,v,x){var N=x||{},z=N.batchSize,J=s(N,["batchSize"]),V={taskIDs:[],objectIDs:[]};return h(function G(){var Q,Y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,ae=[];for(Q=Y;Q<C.length&&(ae.push(C[Q]),ae.length!==(z||1e3));Q++);return ae.length===0?Promise.resolve(V):Wn(w)(ae.map(function(oe){return{action:v,body:oe}}),J).then(function(oe){return V.objectIDs=V.objectIDs.concat(oe.objectIDs),V.taskIDs.push(oe.taskID),Q++,G(Q)})}(),function(G,Q){return Promise.all(G.taskIDs.map(function(Y){return Me(w)(Y,Q)}))})}},kc=function(w){return function(C){return h(w.transporter.write({method:P,path:y("1/indexes/%s/clear",w.indexName)},C),function(v,x){return Me(w)(v.taskID,x)})}},Sc=function(w){return function(C){var v=C||{},x=v.forwardToReplicas,N=k(s(v,["forwardToReplicas"]));return x&&(N.queryParameters.forwardToReplicas=1),h(w.transporter.write({method:P,path:y("1/indexes/%s/rules/clear",w.indexName)},N),function(z,J){return Me(w)(z.taskID,J)})}},xc=function(w){return function(C){var v=C||{},x=v.forwardToReplicas,N=k(s(v,["forwardToReplicas"]));return x&&(N.queryParameters.forwardToReplicas=1),h(w.transporter.write({method:P,path:y("1/indexes/%s/synonyms/clear",w.indexName)},N),function(z,J){return Me(w)(z.taskID,J)})}},Ec=function(w){return function(C,v){return h(w.transporter.write({method:P,path:y("1/indexes/%s/deleteByQuery",w.indexName),data:C},v),function(x,N){return Me(w)(x.taskID,N)})}},I=function(w){return function(C){return h(w.transporter.write({method:U,path:y("1/indexes/%s",w.indexName)},C),function(v,x){return Me(w)(v.taskID,x)})}},K=function(w){return function(C,v){return h(we(w)([C],v).then(function(x){return{taskID:x.taskIDs[0]}}),function(x,N){return Me(w)(x.taskID,N)})}},we=function(w){return function(C,v){var x=C.map(function(N){return{objectID:N}});return Kr(w)(x,Jr.DeleteObject,v)}},Ae=function(w){return function(C,v){var x=v||{},N=x.forwardToReplicas,z=k(s(x,["forwardToReplicas"]));return N&&(z.queryParameters.forwardToReplicas=1),h(w.transporter.write({method:U,path:y("1/indexes/%s/rules/%s",w.indexName,C)},z),function(J,V){return Me(w)(J.taskID,V)})}},fn=function(w){return function(C,v){var x=v||{},N=x.forwardToReplicas,z=k(s(x,["forwardToReplicas"]));return N&&(z.queryParameters.forwardToReplicas=1),h(w.transporter.write({method:U,path:y("1/indexes/%s/synonyms/%s",w.indexName,C)},z),function(J,V){return Me(w)(J.taskID,V)})}},Kn=function(w){return function(C){return Fg(w)(C).then(function(){return!0}).catch(function(v){if(v.status!==404)throw v;return!1})}},Gr=function(w){return function(C,v,x){return w.transporter.read({method:P,path:y("1/answers/%s/prediction",w.indexName),data:{query:C,queryLanguages:v},cacheable:!0},x)}},On=function(w){return function(C,v){var x=v||{},N=x.query,z=x.paginate,J=s(x,["query","paginate"]),V=0;return function G(){return Rg(w)(N||"",a(a({},J),{},{page:V})).then(function(Q){for(var Y=0,ae=Object.entries(Q.hits);Y<ae.length;Y++){var oe=i(ae[Y],2),me=oe[0],ce=oe[1];if(C(ce))return{object:ce,position:parseInt(me,10),page:V}}if(V++,z===!1||V>=Q.nbPages)throw{name:"ObjectNotFoundError",message:"Object not found."};return G()})}()}},jt=function(w){return function(C,v){return w.transporter.read({method:$,path:y("1/indexes/%s/%s",w.indexName,C)},v)}},Ns=function(){return function(w,C){for(var v=0,x=Object.entries(w.hits);v<x.length;v++){var N=i(x[v],2),z=N[0];if(N[1].objectID===C)return parseInt(z,10)}return-1}},T6=function(w){return function(C,v){var x=v||{},N=x.attributesToRetrieve,z=s(x,["attributesToRetrieve"]),J=C.map(function(V){return a({indexName:w.indexName,objectID:V},N?{attributesToRetrieve:N}:{})});return w.transporter.read({method:P,path:"1/indexes/*/objects",data:{requests:J}},z)}},B6=function(w){return function(C,v){return w.transporter.read({method:$,path:y("1/indexes/%s/rules/%s",w.indexName,C)},v)}},Fg=function(w){return function(C){return w.transporter.read({method:$,path:y("1/indexes/%s/settings",w.indexName),data:{getVersion:2}},C)}},N6=function(w){return function(C,v){return w.transporter.read({method:$,path:y("1/indexes/%s/synonyms/%s",w.indexName,C)},v)}},A6=function(w){return function(C,v){return h($g(w)([C],v).then(function(x){return{objectID:x.objectIDs[0],taskID:x.taskIDs[0]}}),function(x,N){return Me(w)(x.taskID,N)})}},$g=function(w){return function(C,v){var x=v||{},N=x.createIfNotExists,z=s(x,["createIfNotExists"]),J=N?Jr.PartialUpdateObject:Jr.PartialUpdateObjectNoCreate;return Kr(w)(C,J,z)}},I6=function(w){return function(C,v){var x=v||{},N=x.safe,z=x.autoGenerateObjectIDIfNotExist,J=x.batchSize,V=s(x,["safe","autoGenerateObjectIDIfNotExist","batchSize"]),G=function(ce,Ee,Ie,bt){return h(w.transporter.write({method:P,path:y("1/indexes/%s/operation",ce),data:{operation:Ie,destination:Ee}},bt),function(Wo,wt){return Me(w)(Wo.taskID,wt)})},Q=Math.random().toString(36).substring(7),Y="".concat(w.indexName,"_tmp_").concat(Q),ae=Oc({appId:w.appId,transporter:w.transporter,indexName:Y}),oe=[],me=G(w.indexName,Y,"copy",a(a({},V),{},{scope:["settings","synonyms","rules"]}));return oe.push(me),h((N?me.wait(V):me).then(function(){var ce=ae(C,a(a({},V),{},{autoGenerateObjectIDIfNotExist:z,batchSize:J}));return oe.push(ce),N?ce.wait(V):ce}).then(function(){var ce=G(Y,w.indexName,"move",V);return oe.push(ce),N?ce.wait(V):ce}).then(function(){return Promise.all(oe)}).then(function(ce){var Ee=i(ce,3),Ie=Ee[0],bt=Ee[1],Wo=Ee[2];return{objectIDs:bt.objectIDs,taskIDs:[Ie.taskID].concat(l(bt.taskIDs),[Wo.taskID])}}),function(ce,Ee){return Promise.all(oe.map(function(Ie){return Ie.wait(Ee)}))})}},P6=function(w){return function(C,v){return _c(w)(C,a(a({},v),{},{clearExistingRules:!0}))}},F6=function(w){return function(C,v){return Tc(w)(C,a(a({},v),{},{clearExistingSynonyms:!0}))}},$6=function(w){return function(C,v){return h(Oc(w)([C],v).then(function(x){return{objectID:x.objectIDs[0],taskID:x.taskIDs[0]}}),function(x,N){return Me(w)(x.taskID,N)})}},Oc=function(w){return function(C,v){var x=v||{},N=x.autoGenerateObjectIDIfNotExist,z=s(x,["autoGenerateObjectIDIfNotExist"]),J=N?Jr.AddObject:Jr.UpdateObject;if(J===Jr.UpdateObject){var V=!0,G=!1,Q=void 0;try{for(var Y,ae=C[Symbol.iterator]();!(V=(Y=ae.next()).done);V=!0)if(Y.value.objectID===void 0)return h(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(oe){G=!0,Q=oe}finally{try{V||ae.return==null||ae.return()}finally{if(G)throw Q}}}return Kr(w)(C,J,z)}},R6=function(w){return function(C,v){return _c(w)([C],v)}},_c=function(w){return function(C,v){var x=v||{},N=x.forwardToReplicas,z=x.clearExistingRules,J=k(s(x,["forwardToReplicas","clearExistingRules"]));return N&&(J.queryParameters.forwardToReplicas=1),z&&(J.queryParameters.clearExistingRules=1),h(w.transporter.write({method:P,path:y("1/indexes/%s/rules/batch",w.indexName),data:C},J),function(V,G){return Me(w)(V.taskID,G)})}},L6=function(w){return function(C,v){return Tc(w)([C],v)}},Tc=function(w){return function(C,v){var x=v||{},N=x.forwardToReplicas,z=x.clearExistingSynonyms,J=x.replaceExistingSynonyms,V=k(s(x,["forwardToReplicas","clearExistingSynonyms","replaceExistingSynonyms"]));return N&&(V.queryParameters.forwardToReplicas=1),(J||z)&&(V.queryParameters.replaceExistingSynonyms=1),h(w.transporter.write({method:P,path:y("1/indexes/%s/synonyms/batch",w.indexName),data:C},V),function(G,Q){return Me(w)(G.taskID,Q)})}},Rg=function(w){return function(C,v){return w.transporter.read({method:P,path:y("1/indexes/%s/query",w.indexName),data:{query:C},cacheable:!0},v)}},Lg=function(w){return function(C,v,x){return w.transporter.read({method:P,path:y("1/indexes/%s/facets/%s/query",w.indexName,C),data:{facetQuery:v},cacheable:!0},x)}},Dg=function(w){return function(C,v){return w.transporter.read({method:P,path:y("1/indexes/%s/rules/search",w.indexName),data:{query:C}},v)}},Vg=function(w){return function(C,v){return w.transporter.read({method:P,path:y("1/indexes/%s/synonyms/search",w.indexName),data:{query:C}},v)}},D6=function(w){return function(C,v){var x=v||{},N=x.forwardToReplicas,z=k(s(x,["forwardToReplicas"]));return N&&(z.queryParameters.forwardToReplicas=1),h(w.transporter.write({method:F,path:y("1/indexes/%s/settings",w.indexName),data:C},z),function(J,V){return Me(w)(J.taskID,V)})}},Me=function(w){return function(C,v){return g(function(x){return function(N){return function(z,J){return N.transporter.read({method:$,path:y("1/indexes/%s/task/%s",N.indexName,z.toString())},J)}}(w)(C,v).then(function(N){return N.status!=="published"?x():void 0})})}},Jr={AddObject:"addObject",UpdateObject:"updateObject",PartialUpdateObject:"partialUpdateObject",PartialUpdateObjectNoCreate:"partialUpdateObjectNoCreate",DeleteObject:"deleteObject",DeleteIndex:"delete",ClearIndex:"clear"},Bc={Settings:"settings",Synonyms:"synonyms",Rules:"rules"},V6=1,M6=2,j6=3;function Mg(w,C,v){var x,N={appId:w,apiKey:C,timeouts:{connect:1,read:2,write:30},requester:{send:function(V){return new Promise(function(G){var Q=new XMLHttpRequest;Q.open(V.method,V.url,!0),Object.keys(V.headers).forEach(function(me){return Q.setRequestHeader(me,V.headers[me])});var Y,ae=function(me,ce){return setTimeout(function(){Q.abort(),G({status:0,content:ce,isTimedOut:!0})},1e3*me)},oe=ae(V.connectTimeout,"Connection timeout");Q.onreadystatechange=function(){Q.readyState>Q.OPENED&&Y===void 0&&(clearTimeout(oe),Y=ae(V.responseTimeout,"Socket timeout"))},Q.onerror=function(){Q.status===0&&(clearTimeout(oe),clearTimeout(Y),G({content:Q.responseText||"Network request failed",status:Q.status,isTimedOut:!1}))},Q.onload=function(){clearTimeout(oe),clearTimeout(Y),G({content:Q.responseText,status:Q.status,isTimedOut:!1})},Q.send(V.data)})}},logger:(x=j6,{debug:function(V,G){return V6>=x&&console.debug(V,G),Promise.resolve()},info:function(V,G){return M6>=x&&console.info(V,G),Promise.resolve()},error:function(V,G){return console.error(V,G),Promise.resolve()}}),responsesCache:u(),requestsCache:u({serializable:!1}),hostsCache:d({caches:[c({key:"".concat("4.22.1","-").concat(w)}),u()]}),userAgent:H("4.22.1").add({segment:"Browser"})},z=a(a({},N),v),J=function(){return function(V){return function(G){var Q=G.region||"us",Y=f(b.WithinHeaders,G.appId,G.apiKey),ae=W(a(a({hosts:[{url:"personalization.".concat(Q,".algolia.com")}]},G),{},{headers:a(a(a({},Y.headers()),{"content-type":"application/json"}),G.headers),queryParameters:a(a({},Y.queryParameters()),G.queryParameters)}));return m({appId:G.appId,transporter:ae},G.methods)}(a(a(a({},N),V),{},{methods:{getPersonalizationStrategy:We,setPersonalizationStrategy:Ue}}))}};return function(V){var G=V.appId,Q=f(V.authMode!==void 0?V.authMode:b.WithinHeaders,G,V.apiKey),Y=W(a(a({hosts:[{url:"".concat(G,"-dsn.algolia.net"),accept:E.Read},{url:"".concat(G,".algolia.net"),accept:E.Write}].concat(p([{url:"".concat(G,"-1.algolianet.com")},{url:"".concat(G,"-2.algolianet.com")},{url:"".concat(G,"-3.algolianet.com")}]))},V),{},{headers:a(a(a({},Q.headers()),{"content-type":"application/x-www-form-urlencoded"}),V.headers),queryParameters:a(a({},Q.queryParameters()),V.queryParameters)}));return m({transporter:Y,appId:G,addAlgoliaAgent:function(ae,oe){Y.userAgent.add({segment:ae,version:oe})},clearCache:function(){return Promise.all([Y.requestsCache.clear(),Y.responsesCache.clear()]).then(function(){})}},V.methods)}(a(a({},z),{},{methods:{search:be,searchForFacetValues:gt,multipleBatch:q,multipleGetObjects:X,multipleQueries:be,copyIndex:$e,copySettings:St,copySynonyms:mt,copyRules:kt,moveIndex:D,listIndices:Hn,getLogs:nt,listClusters:xn,multipleSearchForFacetValues:gt,getApiKey:ye,addApiKey:Fe,listApiKeys:Ke,updateApiKey:Bs,deleteApiKey:Mt,restoreApiKey:Wr,assignUserID:it,assignUserIDs:Ne,getUserID:M,searchUserIDs:Ts,listUserIDs:En,getTopUserIDs:Ve,removeUserID:yt,hasPendingMappings:re,clearDictionaryEntries:et,deleteDictionaryEntries:xt,getDictionarySettings:lt,getAppTask:He,replaceDictionaryEntries:Et,saveDictionaryEntries:gc,searchDictionaryEntries:yc,setDictionarySettings:bc,waitAppTask:qn,customRequest:tt,initIndex:function(V){return function(G){return he(V)(G,{methods:{batch:Wn,delete:I,findAnswers:Gr,getObject:jt,getObjects:T6,saveObject:$6,saveObjects:Oc,search:Rg,searchForFacetValues:Lg,waitTask:Me,setSettings:D6,getSettings:Fg,partialUpdateObject:A6,partialUpdateObjects:$g,deleteObject:K,deleteObjects:we,deleteBy:Ec,clearObjects:kc,browseObjects:wc,getObjectPosition:Ns,findObject:On,exists:Kn,saveSynonym:L6,saveSynonyms:Tc,getSynonym:N6,searchSynonyms:Vg,browseSynonyms:vc,deleteSynonym:fn,clearSynonyms:xc,replaceAllObjects:I6,replaceAllSynonyms:F6,searchRules:Dg,getRule:B6,deleteRule:Ae,saveRule:R6,saveRules:_c,replaceAllRules:P6,browseRules:Cc,clearRules:Sc}})}},initAnalytics:function(){return function(V){return function(G){var Q=G.region||"us",Y=f(b.WithinHeaders,G.appId,G.apiKey),ae=W(a(a({hosts:[{url:"analytics.".concat(Q,".algolia.com")}]},G),{},{headers:a(a(a({},Y.headers()),{"content-type":"application/json"}),G.headers),queryParameters:a(a({},Y.queryParameters()),G.queryParameters)}));return m({appId:G.appId,transporter:ae},G.methods)}(a(a(a({},N),V),{},{methods:{addABTest:pe,getABTest:Re,getABTests:_e,stopABTest:ve,deleteABTest:de}}))}},initPersonalization:J,initRecommendation:function(){return function(V){return z.logger.info("The `initRecommendation` method is deprecated. Use `initPersonalization` instead."),J()(V)}}}}))}return Mg.version="4.22.1",Mg})})(Tg);var JA=Tg.exports;const ZA=FS(JA);class Bg{constructor(t,r,o="https://api.pennsieve.io"){this.client=ZA(t,r),this.PENNSIEVE_API_LOCATION=o,this.anatomyFacetLabels=[]}initIndex(t){this.index=this.client.initIndex(t)}getAlgoliaFacets(t){const r=t.map(i=>i.facetPropPath),o=t.map(i=>i.facetSubpropPath);let a=[],s=0;return this.index.search("",{sortFacetValuesBy:"alpha",facets:r.concat(o)}).then(i=>(r.map(l=>{const c=t.find(h=>h.facetPropPath==l);var d=[];const u=i.facets;if(u===void 0)return;const f=u[l]==null?{}:u[l],g=c&&u[c.facetSubpropPath]?Object.keys(u[c.facetSubpropPath]):[];Object.keys(f).map(h=>{const p=g.reduce((y,b)=>{const k=b.split(".");return k.length!==2||h===k[0]&&y.push({label:k[1],id:s++,facetPropPath:`${c?c.facetSubpropPath:void 0}`}),y},[]);let m={label:h,id:s++,facetPropPath:l};p.length>0&&(m.children=p),d.push(m)}),d.length>0&&a.push({label:c?c.label:"",id:s++,children:d,key:l})}),a))}_discoverAllDois(t,r="https://api.pennsieve.io"){return new Promise(o=>{fetch(`${r}/discover/datasets/${t}/versions`).then(a=>a.json()).then(a=>{o(a.map(s=>s.doi))})})}_expandDois(t,r="https://api.pennsieve.io"){return new Promise(o=>{let a=t.map(s=>this._discoverAllDois(s,r));Promise.all(a).then(s=>{o(s.flat())})})}_processResultsForCards(t){let r=[],o={};for(let a of t)o={...a},o={anatomy:a.anatomy?a.anatomy.organ.map(s=>s.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},r.push(o);return r}_processAnatomy(t){let r=[],o=[],a=[],s=[];return t.forEach(i=>{i.item&&i.item.keywords&&i.item.keywords.forEach(l=>{let c=l.keyword.toUpperCase();(c.includes("UBERON")||c.includes("ILX"))&&r.push(this._processUberonURL(c))}),i.anatomy&&i.anatomy.organ&&i.anatomy.organ.forEach(l=>{l.curie&&(r.push(l.curie),o.push(l.name))})}),s=[...new Set(r)],a=[...new Set(o)],this.anatomyFacetLabels=a,s}_processUberonURL(t){return t.split("/").pop().replace("_",":")}search(t,r="",o=10,a=1){return new Promise(s=>{this.index.search(r,{facets:["*"],hitsPerPage:o,page:a-1,filters:t,attributesToHighlight:[],attributesToRetrieve:["pennsieve.publishDate","pennsieve.updatedAt","item.curie","item.name","item.description","objectID","anatomy.organ.curie"]}).then(i=>{let l={items:this._processResultsForCards(i.hits),total:i.nbHits,discoverIds:i.hits.map(c=>c.pennsieve?c.pennsieve.identifier:c.objectID),dois:i.hits.map(c=>c.item.curie.split(":")[1])};s(l)})})}anatomyInSearch(t,r="",o=999999,a=1){return new Promise(s=>{this.index.search(r,{facets:["*"],hitsPerPage:o,page:a-1,filters:t,attributesToHighlight:[],attributesToRetrieve:["objectID","item.keywords.keyword","anatomy.organ.name","anatomy.organ.curie"]}).then(i=>{s({forFlatmap:this.processResultsForFlatmap(i.hits),forScaffold:this.processResultsForScaffold(i.hits)})})})}processResultsForFlatmap(t){return t.map(o=>({id:o.objectID,terms:o.anatomy?o.anatomy.organ.map(a=>a.curie):[]}))}processResultsForScaffold(t){let r={};return t.forEach(o=>{o.anatomy&&o.anatomy.organ&&o.anatomy.organ.forEach(a=>{a.name&&(r[a.name]?r[a.name]++:r[a.name]=1)})}),r}}const hc=[{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",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"}];function Ng(e=void 0){if(e===void 0)return"NOT item.published.status:embargo";e.forEach(a=>a.label=a.facet);let t=YA(e),r="NOT item.published.status:embargo";return r=`(${r}) AND `,hc.map(a=>a.facetPropPath).map(a=>{let s=t.filter(c=>c.facetPropPath==a),i="",l="";s.map(c=>{let d=c.facetSubPropPath?c.facetSubPropPath:a;c.AND?l+=`AND "${d}":"${c.label}"`:i+=`"${d}":"${c.label}" OR `}),!(i==""&&l=="")&&(i=`(${i.substring(0,i.lastIndexOf(" OR "))})`,r+=`${i+l} AND `,r=r.split("()AND ").join(""))}),console.log("filters about to be applied:",r),r.substring(0,r.lastIndexOf(" AND "))}function YA(e){return e.filter(t=>t.label!=="Show all")}const _s=function(e){return e.charAt(0).toUpperCase()+e.slice(1)},mc=function(e){const t=e.toLowerCase();return Os[t]?_s(Os[t]):_s(t)},XA={name:"SearchFilters",components:{MapSvgIcon:DA,MapSvgSpriteColor:GA,Option:$a,Select:So,Popover:Xf,Cascader:Hf},props:{entry:Object,envVars:{type:Object,default:()=>{}}},data:function(){return{cascaderIsReady:!1,previousShowAllChecked:{species:!1,gender:!1,organ:!1,datasets:!1},showFilters:!0,showFiltersText:!0,cascadeSelected:[],cascadeSelectedWithBoolean:[],numberShown:10,filters:[],facets:["Species","Gender","Organ","Datasets"],numberDatasetsShown:["10","20","50"],props:{multiple:!0},options:[{value:"Species",label:"Species",children:[{}]}],presentTags:[]}},setup(){const e=n.markRaw({}),t=n.markRaw({term:new Set,facet:new Set,facet2:new Set});return{cascaderTags:e,correctnessCheck:t}},computed:{numberOfResultsText:function(){return`${this.entry.numberOfHits} results | Showing`}},methods:{createCascaderItemValue:function(e,t=void 0,r=void 0){let o=e;return t&&(o=`${e}>${t}`),t&&r&&(o=`${e}>${t}>${r}`),!t&&r&&console.warn(`Warning: ${r} provided without its parent, this will not be shown in the cascader`),o},populateCascader:function(){return new Promise(e=>{this.algoliaClient.getAlgoliaFacets(hc).then(t=>{this.facets=t,this.options=t,this.options.forEach((r,o)=>{this.options[o].total=this.countTotalFacet(r),this.options[o].label=mc(r.label),this.options[o].value=this.createCascaderItemValue(r.key,void 0),this.options[o].children.unshift({value:this.createCascaderItemValue("Show all"),label:"Show all"}),this.options[o].children.forEach((a,s)=>{this.options[o].children[s].label=mc(a.label),this.options[o].children[s].value=this.createCascaderItemValue(r.label,a.label),this.options[o].children[s].children&&this.options[o].children[s].children.length>0&&this.options[o].children[s].children.forEach((i,l)=>{this.options[o].children[s].children[l].label=mc(i.label),this.options[o].children[s].children[l].value=this.createCascaderItemValue(r.label,a.label,i.label)})})})}).finally(()=>{e()})})},cascadeTagClose:function(e){let t=[];Object.entries(this.cascaderTags).map(r=>{const o=r[0],a=r[1],s=this.options.filter(l=>l.label==o)[0],i=s.key;for(let l=0;l<s.children.length;l++){const c=s.children[l],d=c.label,u=c.value;if(Array.isArray(a))if(a.length===0&&d.toLowerCase()==="show all"){t.push([i,u]);break}else d!==e&&a.includes(d)&&t.push([i,u]);else Object.entries(a).map(f=>{const g=f[0],h=f[1];g===d&&c.children.map(p=>{const m=p.label,y=p.value;m!==e&&h.includes(m)&&t.push([i,y])})})}}),this.cascadeEvent(t)},tagsChangedCallback:function(e){this.correctnessCheck.term&&this.correctnessCheck.facet&&this.correctnessCheck.facet2&&this.options.map(t=>{this.correctnessCheck.term.add(t.label),t.children.map(r=>{this.correctnessCheck.facet.add(r.label),t.label==="Anatomical structure"&&r.label!=="Show all"&&r.children.map(o=>{this.correctnessCheck.facet2.add(o.label)})})}),this.cascaderTags={},this.presentTags=[],e.map(t=>{const{facet:r,facet2:o,term:a}=t;this.correctnessCheck.term.has(a)&&this.correctnessCheck.facet.has(r)&&(o?this.correctnessCheck.facet2.has(o)&&(a in this.cascaderTags?r in this.cascaderTags[a]?this.cascaderTags[a][r].push(o):this.cascaderTags[a][r]=[o]:(this.cascaderTags[a]={},this.cascaderTags[a][r]=[o])):a in this.cascaderTags&&a!=="Anatomical structure"?this.cascaderTags[a].push(r):r.toLowerCase()!=="show all"?this.cascaderTags[a]=[r]:this.cascaderTags[a]=[])}),Object.values(this.cascaderTags).map(t=>{const r=Array.isArray(t)?t:Object.values(t).flat(1);this.presentTags=[...this.presentTags,...r]}),this.presentTags=[...new Set(this.presentTags)],this.presentTags.length>0?this.showFiltersText=!1:this.showFiltersText=!0},countTotalFacet:function(e){return["anatomy.organ.category.name"].includes(e.key)?e.children.reduce((r,o)=>(r=typeof r=="number"?r:r.children.length,r+o.children.length)):e.children.length},showAllEventModifierForAutoCheckAll:function(e){const t={};return e.map(r=>{const o=r[0];o in t?t[o]+=1:t[o]=1}),this.options.map(r=>{const o=r.key,a=r.children.filter(i=>i.label==="Show all")[0].value,s=r.total;t[o]===s&&(e=e.filter(i=>i[0]!==r.key),delete t[o]),o in t||e.unshift([o,a])}),e},cascadeEvent:function(e){let t=[...e];if(t){if(t=this.showAllEventModifier(t),t=this.showAllEventModifierForAutoCheckAll(t),this.__expandItem__){let a=0;this.__expandItem__.length>1&&(a=1);const s=t.filter(l=>l[a]==this.__expandItem__[a]),i=t.filter(l=>l[a]!==this.__expandItem__[a]);t=[...s,...i]}let r=t.filter(a=>a!==void 0).map(a=>{let{hString:s,bString:i}=this.findHierarachyStringAndBooleanString(a),{facet:l,facet2:c,term:d}=this.getFacetsFromHierarchyString(s);return{facetPropPath:a[0],facet:l,facet2:c,term:d,AND:i}}),o=t.filter(a=>a!==void 0).map(a=>{let s,i=a[0].includes("duplicate")?a[0].split("duplicate")[0]:a[0],{hString:l,bString:c}=this.findHierarachyStringAndBooleanString(a),{facet:d,facet2:u,term:f}=this.getFacetsFromHierarchyString(l);return u&&(d=u,s="anatomy.organ.name"),{facetPropPath:i,facet:d,term:f,AND:c,facetSubPropPath:s}});this.$emit("loading",!0),this.$emit("filterResults",o),this.setCascader(r),this.cssMods()}},findHierarachyStringAndBooleanString(e){let t,r;return e.length>=3?e[2]&&(typeof e[2]=="string"||e[2]instanceof String)&&e[2].split(">").length>2?(t=e[2],r=e.length==4?e[3]:void 0):(t=e[1],r=e[2]):(t=e[1],r=void 0),{hString:t,bString:r}},getFacetsFromHierarchyString(e){let t,r,o,a=e.split(">");return a.length==3?(o=a[2],t=a[1],r=a[0]):(t=a[1],r=a[0]),{facet:t,facet2:o,term:r}},showAllEventModifier:function(e){if(e.map(r=>r?r[1].toLowerCase().includes("show all"):!1).includes(!0)){let r=[],o={};for(const a in e)o[e[a][0]]===void 0&&(o[e[a][0]]=[]),o[e[a][0]].push(e[a]);for(const a in o){let s;for(let i=o[a].length-1;i>=0;i--)if(o[a][i][1].toLowerCase().includes("show all")){s=o[a].splice(i,1)[0];break}s?this.previousShowAllChecked[a]&&o[a].length>0?r.push(...o[a]):r.push(s):r.push(...o[a])}return r.sort((a,s)=>this.__expandItem__?a[0]==this.__expandItem__?s[0]==this.__expandItem__?0:-1:s[0]==this.__expandItem__?a[0]==this.__expandItem__?0:1:0:0)}return e},cascadeExpandChange:function(e){this.__expandItem__=e,this.cssMods()},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=r=>{let o=[r.facetPropPath,this.createCascaderItemValue(_s(r.term),r.facet)];return r.facet2&&o.push(this.createCascaderItemValue(_s(r.term),r.facet,r.facet2)),o};this.cascadeSelected=e.map(r=>t(r)),this.cascadeSelectedWithBoolean=e.map(r=>{let o=t(r);return o.push(r.AND),o}),this.updatePreviousShowAllChecked(this.cascadeSelected)}this.tagsChangedCallback(e)},addFilter:function(e){if(this.cascaderIsReady&&e){let t=this.validateAndConvertFilterToHierarchical(e);if(t)return this.cascadeSelected.filter(r=>r.term!=t.term),this.cascadeSelected.push([t.facetPropPath,this.createCascaderItemValue(t.term,t.facet),this.createCascaderItemValue(t.term,t.facet,t.facet2)]),this.cascadeSelectedWithBoolean.push([t.facetPropPath,this.createCascaderItemValue(t.term,t.facet),this.createCascaderItemValue(t.term,t.facet,t.facet2),t.AND]),!0}},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(),this.removeTopLevelCascaderCheckboxes()},removeTopLevelCascaderCheckboxes:function(){this.$nextTick(()=>{document.querySelectorAll(".sidebar-cascader-popper .el-cascader-menu__list")[0].querySelectorAll(".el-checkbox__input").forEach(t=>t.style.display="none")})},validateAndConvertFilterToHierarchical:function(e){if(e&&e.facet&&e.term){if(e.facet2)return e;for(const t of this.options)if(t.value===e.facetPropPath)for(const r of t.children){if(r.label===e.facet)return e;if(r.children&&r.children.length>0){for(const o of r.children)if(o.label===e.facet)return e.facet2=o.label,e.facet=r.label,e}}}return!1},getHierarchicalValidatedFilters:function(e){if(e)if(this.cascaderIsReady){const t=[];return e.forEach(r=>{const o=this.validateAndConvertFilterToHierarchical(r);o&&t.push(o)}),t}else return e;return[]}},mounted:function(){this.algoliaClient=new Bg(this.envVars.ALGOLIA_ID,this.envVars.ALGOLIA_KEY,this.envVars.PENNSIEVE_API_LOCATION),this.algoliaClient.initIndex(this.envVars.ALGOLIA_INDEX),this.populateCascader().then(()=>{this.cascaderIsReady=!0,this.checkShowAllBoxes(),this.setCascader(this.entry.filterFacets),this.cssMods(),this.$emit("cascaderReady")})}},QA=e=>(n.pushScopeId("data-v-6eb85be8"),e=e(),n.popScopeId(),e),e6={class:"filters"},t6={key:0,class:"cascader-tag"},n6={class:"el-tags-container"},r6={class:"el-tags-container"},o6={class:"search-filters transition-box"},a6={key:0,class:"filter-default-value"},s6=QA(()=>n.createElementVNode("div",null,[n.createElementVNode("strong",null,"Within categories:"),n.createTextVNode(" OR "),n.createElementVNode("br"),n.createTextVNode(" example: 'heart' OR 'colon' "),n.createElementVNode("br"),n.createElementVNode("br"),n.createElementVNode("strong",null,"Between categories:"),n.createTextVNode(" AND "),n.createElementVNode("br"),n.createTextVNode(" example: 'rat' AND 'lung' ")],-1)),i6={class:"dataset-shown"},l6={class:"dataset-results-feedback"};function c6(e,t,r,o,a,s){const i=n.resolveComponent("MapSvgSpriteColor"),l=Br,c=Xf,d=Hf,u=n.resolveComponent("MapSvgIcon"),f=$a,g=So,h=Zi;return n.openBlock(),n.createElementBlock("div",e6,[n.createVNode(i),e.presentTags.length>0?(n.openBlock(),n.createElementBlock("div",t6,[n.createVNode(l,{class:"ml-2",type:"info",closable:"",onClose:t[0]||(t[0]=p=>s.cascadeTagClose(e.presentTags[0]))},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(e.presentTags[0]),1)]),_:1}),e.presentTags.length>1?(n.openBlock(),n.createBlock(c,{key:0,placement:"bottom-start",width:200,trigger:"hover"},{default:n.withCtx(()=>[n.createElementVNode("div",n6,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.presentTags.slice(1),(p,m)=>(n.openBlock(),n.createBlock(l,{key:m,class:"ml-2",type:"info",closable:"",onClose:y=>s.cascadeTagClose(p)},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(p),1)]),_:2},1032,["onClose"]))),128))])]),reference:n.withCtx(()=>[n.createElementVNode("div",r6,[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",o6,[n.createVNode(d,{class:"cascader",ref:"cascader",modelValue:e.cascadeSelected,"onUpdate:modelValue":t[1]||(t[1]=p=>e.cascadeSelected=p),size:"large",placeholder:" ","collapse-tags":!0,"collapse-tags-tooltip":"",options:e.options,props:e.props,onChange:t[2]||(t[2]=p=>s.cascadeEvent(p)),onExpandChange:s.cascadeExpandChange,"show-all-levels":!0,"popper-class":"sidebar-cascader-popper"},null,8,["modelValue","options","props","onExpandChange"]),e.showFiltersText?(n.openBlock(),n.createElementBlock("div",a6,"Filters")):n.createCommentVNode("",!0),n.createVNode(c,{title:"How do filters work?",width:"250",trigger:"hover","append-to-body":!1,"popper-class":"popover"},{reference:n.withCtx(()=>[n.createVNode(u,{icon:"help",class:"help"})]),default:n.withCtx(()=>[s6]),_:1})])),[[n.vShow,e.showFilters],[h,!e.cascaderIsReady]])]),_:1}),n.createElementVNode("div",i6,[n.createElementVNode("span",l6,n.toDisplayString(s.numberOfResultsText),1),n.createVNode(g,{class:"number-shown-select",modelValue:e.numberShown,"onUpdate:modelValue":t[3]||(t[3]=p=>e.numberShown=p),placeholder:"10",onChange:t[4]||(t[4]=p=>s.numberShownChanged(p))},{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.numberDatasetsShown,p=>(n.openBlock(),n.createBlock(f,{key:p,label:p,value:p},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])])])}const Ag=Ln(XA,[["render",c6],["__scopeId","data-v-6eb85be8"]]);var d6=async function(e){if(!e.ok){let t=await e.json();throw t?new Error(t.message):new Error(e)}return e},u6={searchInput:"",lastSearch:"",results:[],numberOfHits:0,filter:[],loadingCards:!1,numberPerPage:10,page:1,pageModel:1,start:0,hasSearched:!1,contextCardEnabled:!1};const f6={components:{SearchFilters:Ag,DatasetCard:Jm,SearchHistory:Ym,Button:Or,Card:Bf,Drawer:Wi,Icon:Pe,Input:vo,Pagination:Zf},name:"SideBarContent",props:{visible:{type:Boolean,default:!1},isDrawer:{type:Boolean,default:!0},entry:{type:Object,default:()=>u6},envVars:{type:Object,default:()=>{}}},data:function(){return{...this.entry,bodyStyle:{flex:"1 1 auto","flex-flow":"column",display:"flex"},cascaderIsReady:!1}},computed:{filterEntry:function(){return{numberOfHits:this.numberOfHits,filterFacets:this.filter}}},methods:{hoverChanged:function(e){this.$emit("hover-changed",e)},resetSearch:function(){this.numberOfHits=0,this.discoverIds=[],this._dois=[],this.results=[],this.loadingCards=!1},openSearch:function(e,t=""){this.searchInput=t,this.resetPageNavigation(),this.cascaderIsReady?(this.filter=this.$refs.filtersRef.getHierarchicalValidatedFilters(e),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.filter=e,(!e||e.length==0)&&this.searchAlgolia(this.filter,t))},addFilter:function(e){this.cascaderIsReady?(this.resetPageNavigation(),e&&this.$refs.filtersRef.addFilter(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.resetPageNavigation(),this.searchAlgolia(this.filters,this.searchInput),this.$refs.searchHistory.selectValue="Full search history"},searchEvent:function(e=!1){(e.keyCode===13||e instanceof MouseEvent)&&(this.resetPageNavigation(),this.searchAlgolia(this.filters,this.searchInput),this.$refs.searchHistory.selectValue="Full search history",this.$refs.searchHistory.addSearchToHistory(this.filters,this.searchInput))},filterUpdate:function(e){this.filters=[...e],this.resetPageNavigation(),this.searchAlgolia(e,this.searchInput),this.$emit("search-changed",{value:e,type:"filter-update"})},searchAlgolia(e,t=""){this.loadingCards=!0,this.algoliaClient.anatomyInSearch(Ng(e),t).then(r=>{Yt.emit("anatomy-in-datasets",r.forFlatmap),Yt.emit("number-of-datasets-for-anatomies",r.forScaffold)}),this.algoliaClient.search(Ng(e),t,this.numberPerPage,this.page).then(r=>{this.numberOfHits=r.total,this.discoverIds=r.discoverIds,this._dois=r.dois,this.results=r.items,this.loadingCards=!1,this.scrollToTop(),this.$emit("search-changed",{value:this.searchInput,type:"query-update"}),this._abortController&&this._abortController.abort(),this._abortController=new AbortController;const o=this._abortController.signal;this.perItemSearch(o,{count:0})})},filtersLoading:function(e){this.loadingCards=e},numberPerPageUpdate:function(e){this.numberPerPage=e,this.pageChange(1)},pageChange:function(e){this.start=(e-1)*this.numberPerPage,this.page=e,this.searchAlgolia(this.filters,this.searchInput,this.numberPerPage,this.page)},handleMissingData:function(e){let t=this.results.findIndex(r=>r.doi===e);this.results[t]&&(this.results[t].detailsReady=!0)},perItemSearch:function(e,t){if(10>t.count){const o=this._dois.shift();o&&(t.count++,this.callSciCrunch(this.envVars.API_LOCATION,{dois:[o]},e).then(a=>{a.numberOfHits===0?this.handleMissingData(o):this.resultsProcessing(a),this.$refs.content.style["overflow-y"]="scroll",t.count--,this.perItemSearch(e,t)}).catch(a=>{a.name!=="AbortError"&&(this.handleMissingData(o),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 r=this.results.findIndex(o=>t.doi?t.doi.includes(o.doi):!1);Object.assign(this.results[r],t),Object.assign(this.results[r],{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(o=>o.name))]:void 0,species:t.organisms&&t.organisms[0].species?[...new Set(t.organisms.map(o=>o.species?o.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-file"],additionalLinks:t.additionalLinks,detailsReady:!0}),this.results[r]=this.results[r]})},createfilterParams:function(e){let t=new URLSearchParams;for(const r in e)Array.isArray(e[r])?e[r].forEach(o=>{t.append(r,o)}):t.append(r,e[r]);return t.toString()},callSciCrunch:function(e,t={},r){return new Promise((o,a)=>{let s=this.envVars.API_LOCATION+this.searchEndpoint+"?"+this.createfilterParams(t);fetch(s,{signal:r}).then(d6).then(i=>i.json()).then(i=>o(i)).catch(i=>a(i))})},getAlgoliaFacets:async function(){return await this.algoliaClient.getAlgoliaFacets(hc)},searchHistorySearch:function(e){this.searchInput=e.search,this.filters=e.filters,this.openSearch(e.filters,e.search)}},mounted:function(){this.algoliaClient=new Bg(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/"}},p6={class:"header"},h6={class:"content scrollbar",ref:"content"},m6={key:0,class:"error-feedback"};function g6(e,t,r,o,a,s){const i=vo,l=Or,c=Ag,d=Ym,u=Jm,f=Zf,g=Bf,h=Zi;return n.openBlock(),n.createBlock(g,{"body-style":e.bodyStyle,class:"content-card"},{header:n.withCtx(()=>[n.createElementVNode("div",p6,[n.createVNode(i,{class:"search-input",placeholder:"Search",modelValue:e.searchInput,"onUpdate:modelValue":t[0]||(t[0]=p=>e.searchInput=p),onKeyup:s.searchEvent,clearable:"",onClear:s.clearSearchClicked},null,8,["modelValue","onKeyup","onClear"]),n.createVNode(l,{type:"primary",class:"button",onClick:s.searchEvent,size:"large"},{default:n.withCtx(()=>[n.createTextVNode(" Search ")]),_:1},8,["onClick"])])]),default:n.withCtx(()=>[n.createVNode(c,{class:"filters",ref:"filtersRef",entry:s.filterEntry,envVars:r.envVars,onFilterResults:s.filterUpdate,onNumberPerPage:s.numberPerPageUpdate,onLoading:s.filtersLoading,onCascaderReady:s.cascaderReady},null,8,["entry","envVars","onFilterResults","onNumberPerPage","onLoading","onCascaderReady"]),n.createVNode(d,{ref:"searchHistory",onSearch:s.searchHistorySearch},null,8,["onSearch"]),n.withDirectives((n.openBlock(),n.createElementBlock("div",h6,[e.results.length===0&&!e.loadingCards?(n.openBlock(),n.createElementBlock("div",m6," No results found - Please change your search / filter criteria. ")):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.results,p=>(n.openBlock(),n.createElementBlock("div",{key:p.doi,class:"step-item"},[n.createVNode(u,{class:"dataset-card",entry:p,envVars:r.envVars,onMouseenter:m=>s.hoverChanged(p),onMouseleave:t[1]||(t[1]=m=>s.hoverChanged(void 0))},null,8,["entry","envVars","onMouseenter"])]))),128)),n.createVNode(f,{class:"pagination","current-page":e.page,"onUpdate:currentPage":t[2]||(t[2]=p=>e.page=p),"hide-on-single-page":"",large:"",layout:"prev, pager, next","page-size":e.numberPerPage,total:e.numberOfHits,onCurrentChange:s.pageChange},null,8,["current-page","page-size","total","onCurrentChange"])])),[[h,e.loadingCards]])]),_:1},8,["body-style"])}const Ig=Ln(f6,[["render",g6],["__scopeId","data-v-aa5467f3"]]),y6={name:"Tabs",props:{tabTitles:{type:Array,default:()=>[]},activeId:{type:Number,default:1}},methods:{titleClicked:function(e){this.$emit("titleClicked",e)}}},b6={class:"tab-container"},w6=["onClick"],C6={class:"title-text"};function v6(e,t,r,o,a,s){return n.openBlock(),n.createElementBlock("div",b6,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(r.tabTitles,i=>(n.openBlock(),n.createElementBlock("div",{class:"title",key:i.id},[n.createElementVNode("div",{class:n.normalizeClass(["title-text-table",{highlightText:i.id==r.activeId}]),onClick:l=>s.titleClicked(i.id)},[n.createElementVNode("div",C6,n.toDisplayString(i.title),1)],10,w6)]))),128))])}const Pg=Ln(y6,[["render",v6],["__scopeId","data-v-9d874017"]]),k6={components:{SidebarContent:Ig,Tabs:Pg,ElIconArrowLeft:ii,ElIconArrowRight:da,Drawer:Wi,Icon:Pe},name:"SideBar",props:{visible:{type:Boolean,default:!1},envVars:{type:Object,default:()=>{}},tabs:{type:Array,default:()=>[{title:"flatmap",id:1}]},activeId:{type:Number,default:1},openAtStart:{type:Boolean,default:!1}},data:function(){return{drawerOpen:!1}},methods:{hoverChanged:function(e){this.$emit("hover-changed",e)},searchChanged:function(e,t){this.$emit("search-changed",{...t,id:e})},close:function(){this.drawerOpen=!1},toggleDrawer:function(){this.drawerOpen=!this.drawerOpen},openSearch:function(e,t){this.drawerOpen=!0,this.$nextTick(()=>{this.$refs[this.activeId][0].openSearch(e,t)})},addFilter:function(e){this.drawerOpen=!0,e.AND=!0,this.$nextTick(()=>{this.$refs[this.activeId][0].addFilter(e)})},openNeuronSearch:function(e){this.drawerOpen=!0,this.$nextTick(()=>{this.$refs[this.activeId][0].openSearch("",void 0,"scicrunch-query-string/",{field:"*organ.curie",curie:e})})},getAlgoliaFacets:async function(){return await this.$refs[this.activeId][0].getAlgoliaFacets()},setDrawerOpen:function(e=!0){this.drawerOpen=e},tabClicked:function(e){this.$emit("tabClicked",e)}},created:function(){this.drawerOpen=this.openAtStart},mounted:function(){Yt.on("PopoverActionClick",e=>{this.$emit("actionClick",e)}),Yt.on("number-of-datasets-for-anatomies",e=>{this.$emit("number-of-datasets-for-anatomies",e)}),Yt.on("anatomy-in-datasets",e=>{this.$emit("anatomy-in-datasets",e)}),Yt.on("contextUpdate",e=>{this.$emit("contextUpdate",e)}),Yt.on("datalink-clicked",e=>{this.$emit("datalink-clicked",e)})}},S6={ref:"container"},x6={class:"box-card"},E6={class:"sidebar-container"};function O6(e,t,r,o,a,s){const i=ii,l=Pe,c=da,d=Pg,u=Ig,f=Wi;return n.openBlock(),n.createElementBlock("div",S6,[e.drawerOpen?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("div",{key:0,onClick:t[0]||(t[0]=(...g)=>s.toggleDrawer&&s.toggleDrawer(...g)),class:"open-tab"},[n.createVNode(l,null,{default:n.withCtx(()=>[n.createVNode(i)]),_:1})])),n.createVNode(f,{class:"side-bar my-drawer",modelValue:e.drawerOpen,"onUpdate:modelValue":t[3]||(t[3]=g=>e.drawerOpen=g),teleported:!1,"modal-append-to-body":!1,size:"584","with-header":!1,wrapperClosable:!1,modal:!1,"modal-class":"sidebar-body","z-index":10,"lock-scroll":!1},{default:n.withCtx(()=>[n.createElementVNode("div",x6,[e.drawerOpen?(n.openBlock(),n.createElementBlock("div",{key:0,onClick:t[1]||(t[1]=(...g)=>s.close&&s.close(...g)),class:"close-tab"},[n.createVNode(l,null,{default:n.withCtx(()=>[n.createVNode(c)]),_:1})])):n.createCommentVNode("",!0),n.createElementVNode("div",E6,[r.tabs.length>1?(n.openBlock(),n.createBlock(d,{key:0,tabTitles:r.tabs,activeId:r.activeId,onTitleClicked:s.tabClicked},null,8,["tabTitles","activeId","onTitleClicked"])):n.createCommentVNode("",!0),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(r.tabs,g=>n.withDirectives((n.openBlock(),n.createBlock(u,{key:"tab.id",class:"sidebar-content-container",contextCardEntry:g.contextCard,envVars:r.envVars,ref_for:!0,ref:g.id,onSearchChanged:h=>s.searchChanged(g.id,h),onHoverChanged:t[2]||(t[2]=h=>s.hoverChanged(h))},null,8,["contextCardEntry","envVars","onSearchChanged"])),[[n.vShow,g.id===r.activeId]])),128))])])]),_:1},8,["modelValue"])],512)}const _6=Ln(k6,[["render",O6],["__scopeId","data-v-b57d4d14"]]);je.SideBar=_6,Object.defineProperty(je,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/map-side-bar",
3
- "version": "2.2.1-alpha-2",
3
+ "version": "2.2.1-alpha-3",
4
4
  "files": [
5
5
  "dist/*",
6
6
  "src/*",
@@ -208,7 +208,7 @@ export class AlgoliaClient {
208
208
  // let anatomyAsUberons = this._processAnatomy(response.hits)
209
209
 
210
210
  resolve({
211
- forFlamap: this.processResultsForFlatmap(response.hits),
211
+ forFlatmap: this.processResultsForFlatmap(response.hits),
212
212
  forScaffold: this.processResultsForScaffold(response.hits)
213
213
  })
214
214
  })