1import{f as q}from"./chunk-FNKCSJ2W.js";import{h as M}from"./chunk-MDFI7MM2.js";import{x as j}from"./chunk-46TIY27H.js";import{$ as b,D as Q,G as R,M as x,Pa as A,Q as $,ca as I,cd as C,ea as g,ja as U,l as a,m as f,ma as P,oa as n,p as F,r as w,w as p,x as v}from"./chunk-ZKNABTT2.js";var O=new P("haupiaServiceConfiguration");function G(...i){for(let t of i){if(Array.isArray(t)){if(t[0])return t[0];continue}if(typeof t=="string"&&t)return t;if(typeof t=="number")return t.toString()}return""}var J=(()=>{class i{http=n(M);settingsService=n(q);platformId=n(A);serviceBaseUrl;target=this.settingsService.overrideHaupiaTarget;locale=n(C);constructor(){let e=n(O),r=e.onServer?.baseUrl&&j(this.platformId)?e.onServer.baseUrl:e.baseUrl;this.serviceBaseUrl=r.toString()}prepareSearch(e,r,u=!0){return new d(this,this.locale,e,r,u)}fetch(e){return this.http.get(this.serviceBaseUrl+e)}static \u0275fac=function(r){return new(r||i)};static \u0275prov=U({token:i,factory:i.\u0275fac,providedIn:"root"})}return i})(),d=class{haupiaService;locale;results$;loading$=new f(1);resultRows=[];numRows=null;facets;additionalParameters=new Map;additionalQueryString$=new a("");facetFilter=new Map;facetFilterQueryString$=new a("");query$=new f(1);page$=new a(1);sortQuery$=new a("");pos$=new a("");radius$=new a("");constructor(t,e,r,u,B=!0){this.haupiaService=t,this.locale=e,this.results$=v([this.query$,this.page$.pipe($()),this.facetFilterQueryString$,this.additionalQueryString$,this.sortQuery$,this.haupiaService.target,this.pos$,this.radius$]).pipe(x(10),p(([c,s,o,h,T,L,m,y])=>{let S="";B&&(S=this.locale==="en"?`&language=${this.locale}`:`&language=${this.locale},en`);let l=`${r}?query=${c}${S}&rows=${u}&page=${s}${o}${h}${T}&target=${L}`;return m&&(l=`${l}&pos=${m}`),y&&(l=`${l}&radius=${y}`),l}),$(),g(()=>{this.loading$.next(!0)}),I(c=>R(Q(()=>this.facets!==void 0,w({rows:this.resultRows,numRows:this.numRows,facets:this.facets}),F),this.haupiaService.fetch(c).pipe(p(s=>{this.facets=Object.fromEntries(s.facets.map((o,h)=>[s.facetConfigs[h].baseName,o.counts]));for(let o of s.results)this.resultRows.push({result:o,highlighting:s.highlighting[o.id]});return this.numRows=s.numRows,{rows:this.resultRows,numRows:this.numRows,facets:this.facets}}),g(()=>{this.loading$.next(!1)})))),b(1))}close(){this.query$.complete(),this.page$.complete(),this.additionalQueryString$.complete(),this.sortQuery$.complete(),this.pos$.complete(),this.radius$.complete()}setQuery(t){this.reset(),t===""&&(t="*"),this.query$.next(encodeURIComponent(t.trim()))}setSorting(t,e=!1){this.reset(),this.sortQuery$.next(`&sortBy=${t}&sortOrder=${e?"desc":"asc"}`)}getSortQueryValue(){return this.sortQuery$.getValue()}removeSorting(){this.reset(),this.sortQuery$.next("")}setPos(t,e){this.reset(),t===""&&(t="*"),this.pos$.next(`${t}`),this.setRadius(e)}removePos(){this.reset(),this.pos$.next("")}setRadius(t){this.reset(),this.radius$.next(`${t}`)}removeRadius(){this.reset(),this.radius$.next("")}getFacetFilter(t){return this.facetFilter.get(t)}setFacetFilterManually(t,e){this.facetFilter.set(t,e.map(r=>({value:r,count:void 0,urlFilterQuery:`facet.filter.${t.toString()}=${encodeURIComponent(r)}`}))),this.updateFacetFilterQueryString()}setFacetFilter(t,e){this.facetFilter.set(t,e),this.updateFacetFilterQueryString()}removeFacetFilter(t){this.facetFilter.delete(t),this.updateFacetFilterQueryString()}updateFacetFilterQueryString(){let t="";for(let[,e]of Array.from(this.facetFilter))for(let r of e)t+=`&${r.urlFilterQuery}`;this.reset(),this.facetFilterQueryString$.next(t)}setParameter(t,e){this.additionalParameters.set(t,e),this.updateAdditionalQueryString()}removeParameter(t){this.additionalParameters.delete(t),this.updateAdditionalQueryString()}next(){this.page$.next(this.page$.value+1)}updateAdditionalQueryString(){let t="";for(let[e,r]of Array.from(this.additionalParameters))for(let u of r)t+=`&${e}=${encodeURIComponent(u)}`;this.reset(),this.additionalQueryString$.next(t)}reset(){this.resultRows=[],this.numRows=null,this.page$.next(1)}};export{O as a,G as b,J as c}; 2/**i18n:9b2f1e34af068233b6abd63a66684d4e9dbff90014448b8ec97e38af3af71f01*/ 3//# sourceMappingURL=chunk-VA6LXZ5W.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.