search_web_components-1.0.x-dev/lit/search-web-components.min.js
lit/search-web-components.min.js
/**
* @license
* Copyright 2021 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
class t extends Event{constructor(t,s,e){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.callback=s,this.subscribe=e??!1}}
/**
* @license
* Copyright 2021 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
/**
* @license
* Copyright 2021 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
class s{constructor(t,s,e,i){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(t,s)=>{this.unsubscribe&&(this.unsubscribe!==s&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=t,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(t,s)),this.unsubscribe=s},this.host=t,void 0!==s.context){const t=s;this.context=t.context,this.callback=t.callback,this.subscribe=t.subscribe??!1}else this.context=s,this.callback=e,this.subscribe=i??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new t(this.context,this.t,this.subscribe))}}
/**
* @license
* Copyright 2021 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/class e{get value(){return this.o}set value(t){this.setValue(t)}setValue(t,s=!1){const e=s||!Object.is(t,this.o);this.o=t,e&&this.updateObservers()}constructor(t){this.subscriptions=new Map,this.updateObservers=()=>{for(const[t,{disposer:s}]of this.subscriptions)t(this.o,s)},void 0!==t&&(this.value=t)}addCallback(t,s,e){if(!e)return void t(this.value);this.subscriptions.has(t)||this.subscriptions.set(t,{disposer:()=>{this.subscriptions.delete(t)},consumerHost:s});const{disposer:i}=this.subscriptions.get(t);t(this.value,i)}clearCallbacks(){this.subscriptions.clear()}}
/**
* @license
* Copyright 2021 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/class i extends Event{constructor(t){super("context-provider",{bubbles:!0,composed:!0}),this.context=t}}class h extends e{constructor(s,e,i){super(void 0!==e.context?e.initialValue:i),this.onContextRequest=t=>{const s=t.composedPath()[0];t.context===this.context&&s!==this.host&&(t.stopPropagation(),this.addCallback(t.callback,s,t.subscribe))},this.onProviderRequest=s=>{const e=s.composedPath()[0];if(s.context!==this.context||e===this.host)return;const i=new Set;for(const[s,{consumerHost:e}]of this.subscriptions)i.has(s)||(i.add(s),e.dispatchEvent(new t(this.context,s,!0)));s.stopPropagation()},this.host=s,void 0!==e.context?this.context=e.context:this.context=e,this.attachListeners(),this.host.addController?.(this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new i(this.context))}}
/**
* @license
* Copyright 2021 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/class n{constructor(){this.pendingContextRequests=new Map,this.onContextProvider=s=>{const e=this.pendingContextRequests.get(s.context);if(void 0===e)return;this.pendingContextRequests.delete(s.context);const{requests:i}=e;for(const{elementRef:e,callbackRef:h}of i){const i=e.deref(),n=h.deref();void 0===i||void 0===n||i.dispatchEvent(new t(s.context,n,!0))}},this.onContextRequest=t=>{if(!0!==t.subscribe)return;const s=t.composedPath()[0],e=t.callback;let i=this.pendingContextRequests.get(t.context);void 0===i&&this.pendingContextRequests.set(t.context,i={callbacks:new WeakMap,requests:[]});let h=i.callbacks.get(s);void 0===h&&i.callbacks.set(s,h=new WeakSet),h.has(e)||(h.add(e),i.requests.push({elementRef:new WeakRef(s),callbackRef:new WeakRef(e)}))}}attach(t){t.addEventListener("context-request",this.onContextRequest),t.addEventListener("context-provider",this.onContextProvider)}detach(t){t.removeEventListener("context-request",this.onContextRequest),t.removeEventListener("context-provider",this.onContextProvider)}}
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/const r=Symbol("search-context"),o=t=>(s,e)=>{void 0!==e?e.addInitializer((()=>{customElements.define(t,s)})):customElements.define(t,s)}
/**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/,l=globalThis,c=l.ShadowRoot&&(void 0===l.ShadyCSS||l.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,a=Symbol(),u=new WeakMap;
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/class d{constructor(t,s,e){if(this._$cssResult$=!0,e!==a)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=s}get styleSheet(){let t=this.o;const s=this.t;if(c&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=u.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&u.set(s,t))}return t}toString(){return this.cssText}}const p=c?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let s="";for(const e of t.cssRules)s+=e.cssText;return(t=>new d("string"==typeof t?t:t+"",void 0,a))(s)})(t):t
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/,{is:f,defineProperty:b,getOwnPropertyDescriptor:v,getOwnPropertyNames:$,getOwnPropertySymbols:g,getPrototypeOf:m}=Object,w=globalThis,y=w.trustedTypes,S=y?y.emptyScript:"",O=w.reactiveElementPolyfillSupport,x=(t,s)=>t,_={toAttribute(t,s){switch(s){case Boolean:t=t?S:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,s){let e=t;switch(s){case Boolean:e=null!==t;break;case Number:e=null===t?null:Number(t);break;case Object:case Array:try{e=JSON.parse(t)}catch(t){e=null}}return e}},k=(t,s)=>!f(t,s),L={attribute:!0,type:String,converter:_,reflect:!1,hasChanged:k};Symbol.metadata??=Symbol("metadata"),w.litPropertyMetadata??=new WeakMap;class R extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,s=L){if(s.state&&(s.attribute=!1),this._$Ei(),this.elementProperties.set(t,s),!s.noAccessor){const e=Symbol(),i=this.getPropertyDescriptor(t,e,s);void 0!==i&&b(this.prototype,t,i)}}static getPropertyDescriptor(t,s,e){const{get:i,set:h}=v(this.prototype,t)??{get(){return this[s]},set(t){this[s]=t}};return{get(){return i?.call(this)},set(s){const n=i?.call(this);h.call(this,s),this.requestUpdate(t,n,e)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??L}static _$Ei(){if(this.hasOwnProperty(x("elementProperties")))return;const t=m(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(x("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(x("properties"))){const t=this.properties,s=[...$(t),...g(t)];for(const e of s)this.createProperty(e,t[e])}const t=this[Symbol.metadata];if(null!==t){const s=litPropertyMetadata.get(t);if(void 0!==s)for(const[t,e]of s)this.elementProperties.set(t,e)}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const e=this._$Eu(t,s);void 0!==e&&this._$Eh.set(e,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const s=[];if(Array.isArray(t)){const e=new Set(t.flat(1/0).reverse());for(const t of e)s.unshift(p(t))}else void 0!==t&&s.push(p(t));return s}static _$Eu(t,s){const e=s.attribute;return!1===e?void 0:"string"==typeof e?e:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$Eg=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$ES(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)))}addController(t){(this._$E_??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$E_?.delete(t)}_$ES(){const t=new Map,s=this.constructor.elementProperties;for(const e of s.keys())this.hasOwnProperty(e)&&(t.set(e,this[e]),delete this[e]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((t,s)=>{if(c)t.adoptedStyleSheets=s.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const e of s){const s=document.createElement("style"),i=l.litNonce;void 0!==i&&s.setAttribute("nonce",i),s.textContent=e.cssText,t.appendChild(s)}})(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$E_?.forEach((t=>t.hostConnected?.()))}enableUpdating(t){}disconnectedCallback(){this._$E_?.forEach((t=>t.hostDisconnected?.()))}attributeChangedCallback(t,s,e){this._$AK(t,e)}_$EO(t,s){const e=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,e);if(void 0!==i&&!0===e.reflect){const h=(void 0!==e.converter?.toAttribute?e.converter:_).toAttribute(s,e.type);this._$Em=t,null==h?this.removeAttribute(i):this.setAttribute(i,h),this._$Em=null}}_$AK(t,s){const e=this.constructor,i=e._$Eh.get(t);if(void 0!==i&&this._$Em!==i){const t=e.getPropertyOptions(i),h="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:_;this._$Em=i,this[i]=h.fromAttribute(s,t.type),this._$Em=null}}requestUpdate(t,s,e,i=!1,h){if(void 0!==t){if(e??=this.constructor.getPropertyOptions(t),!(e.hasChanged??k)(i?h:this[t],s))return;this.C(t,s,e)}!1===this.isUpdatePending&&(this._$Eg=this._$EP())}C(t,s,e){this._$AL.has(t)||this._$AL.set(t,s),!0===e.reflect&&this._$Em!==t&&(this._$Ej??=new Set).add(t)}async _$EP(){this.isUpdatePending=!0;try{await this._$Eg}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,s]of this._$Ep)this[t]=s;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[s,e]of t)!0!==e.wrapped||this._$AL.has(s)||void 0===this[s]||this.C(s,this[s],e)}let t=!1;const s=this._$AL;try{t=this.shouldUpdate(s),t?(this.willUpdate(s),this._$E_?.forEach((t=>t.hostUpdate?.())),this.update(s)):this._$ET()}catch(s){throw t=!1,this._$ET(),s}t&&this._$AE(s)}willUpdate(t){}_$AE(t){this._$E_?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$ET(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$Eg}shouldUpdate(t){return!0}update(t){this._$Ej&&=this._$Ej.forEach((t=>this._$EO(t,this[t]))),this._$ET()}updated(t){}firstUpdated(t){}}R.elementStyles=[],R.shadowRootOptions={mode:"open"},R[x("elementProperties")]=new Map,R[x("finalized")]=new Map,O?.({ReactiveElement:R}),(w.reactiveElementVersions??=[]).push("2.0.2");
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const j={attribute:!0,type:String,converter:_,reflect:!1,hasChanged:k},P=(t=j,s,e)=>{const{kind:i,metadata:h}=e;let n=globalThis.litPropertyMetadata.get(h);if(void 0===n&&globalThis.litPropertyMetadata.set(h,n=new Map),n.set(e.name,t),"accessor"===i){const{name:i}=e;return{set(e){const h=s.get.call(this);s.set.call(this,e),this.requestUpdate(i,h,t)},init(s){return void 0!==s&&this.C(i,void 0,t),s}}}if("setter"===i){const{name:i}=e;return function(e){const h=this[i];s.call(this,e),this.requestUpdate(i,h,t)}}throw Error("Unsupported decorator location: "+i)};function E(t){return(s,e)=>"object"==typeof e?P(t,s,e):((t,s,e)=>{const i=s.hasOwnProperty(e);return s.constructor.createProperty(e,i?{...t,wrapped:!0}:t),i?Object.getOwnPropertyDescriptor(s,e):void 0})(t,s,e)
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/}function C(t){return E({...t,state:!0,attribute:!1})}
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/const A=globalThis,T=A.trustedTypes,U=T?T.createPolicy("lit-html",{createHTML:t=>t}):void 0,M="$lit$",D=`lit$${(Math.random()+"").slice(9)}$`,B="?"+D,H=`<${B}>`,N=document,q=()=>N.createComment(""),F=t=>null===t||"object"!=typeof t&&"function"!=typeof t,I=Array.isArray,W=t=>I(t)||"function"==typeof t?.[Symbol.iterator],z="[ \t\n\f\r]",K=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,V=/-->/g,J=/>/g,Z=RegExp(`>|${z}(?:([^\\s"'>=/]+)(${z}*=${z}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),Q=/'/g,G=/"/g,X=/^(?:script|style|textarea|title)$/i,Y=(t=>(s,...e)=>({_$litType$:t,strings:s,values:e}))(1),tt=Symbol.for("lit-noChange"),st=Symbol.for("lit-nothing"),et=new WeakMap,it=N.createTreeWalker(N,129);function ht(t,s){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==U?U.createHTML(s):s}const nt=(t,s)=>{const e=t.length-1,i=[];let h,n=2===s?"<svg>":"",r=K;for(let s=0;s<e;s++){const e=t[s];let o,l,c=-1,a=0;for(;a<e.length&&(r.lastIndex=a,l=r.exec(e),null!==l);)a=r.lastIndex,r===K?"!--"===l[1]?r=V:void 0!==l[1]?r=J:void 0!==l[2]?(X.test(l[2])&&(h=RegExp("</"+l[2],"g")),r=Z):void 0!==l[3]&&(r=Z):r===Z?">"===l[0]?(r=h??K,c=-1):void 0===l[1]?c=-2:(c=r.lastIndex-l[2].length,o=l[1],r=void 0===l[3]?Z:'"'===l[3]?G:Q):r===G||r===Q?r=Z:r===V||r===J?r=K:(r=Z,h=void 0);const u=r===Z&&t[s+1].startsWith("/>")?" ":"";n+=r===K?e+H:c>=0?(i.push(o),e.slice(0,c)+M+e.slice(c)+D+u):e+D+(-2===c?s:u)}return[ht(t,n+(t[e]||"<?>")+(2===s?"</svg>":"")),i]};class rt{constructor({strings:t,_$litType$:s},e){let i;this.parts=[];let h=0,n=0;const r=t.length-1,o=this.parts,[l,c]=nt(t,s);if(this.el=rt.createElement(l,e),it.currentNode=this.el.content,2===s){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(i=it.nextNode())&&o.length<r;){if(1===i.nodeType){if(i.hasAttributes())for(const t of i.getAttributeNames())if(t.endsWith(M)){const s=c[n++],e=i.getAttribute(t).split(D),r=/([.?@])?(.*)/.exec(s);o.push({type:1,index:h,name:r[2],strings:e,ctor:"."===r[1]?ut:"?"===r[1]?dt:"@"===r[1]?pt:at}),i.removeAttribute(t)}else t.startsWith(D)&&(o.push({type:6,index:h}),i.removeAttribute(t));if(X.test(i.tagName)){const t=i.textContent.split(D),s=t.length-1;if(s>0){i.textContent=T?T.emptyScript:"";for(let e=0;e<s;e++)i.append(t[e],q()),it.nextNode(),o.push({type:2,index:++h});i.append(t[s],q())}}}else if(8===i.nodeType)if(i.data===B)o.push({type:2,index:h});else{let t=-1;for(;-1!==(t=i.data.indexOf(D,t+1));)o.push({type:7,index:h}),t+=D.length-1}h++}}static createElement(t,s){const e=N.createElement("template");return e.innerHTML=t,e}}function ot(t,s,e=t,i){if(s===tt)return s;let h=void 0!==i?e._$Co?.[i]:e._$Cl;const n=F(s)?void 0:s._$litDirective$;return h?.constructor!==n&&(h?._$AO?.(!1),void 0===n?h=void 0:(h=new n(t),h._$AT(t,e,i)),void 0!==i?(e._$Co??=[])[i]=h:e._$Cl=h),void 0!==h&&(s=ot(t,h._$AS(t,s.values),h,i)),s}class lt{constructor(t,s){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=s}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:s},parts:e}=this._$AD,i=(t?.creationScope??N).importNode(s,!0);it.currentNode=i;let h=it.nextNode(),n=0,r=0,o=e[0];for(;void 0!==o;){if(n===o.index){let s;2===o.type?s=new ct(h,h.nextSibling,this,t):1===o.type?s=new o.ctor(h,o.name,o.strings,this,t):6===o.type&&(s=new ft(h,this,t)),this._$AV.push(s),o=e[++r]}n!==o?.index&&(h=it.nextNode(),n++)}return it.currentNode=N,i}p(t){let s=0;for(const e of this._$AV)void 0!==e&&(void 0!==e.strings?(e._$AI(t,e,s),s+=e.strings.length-2):e._$AI(t[s])),s++}}class ct{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,s,e,i){this.type=2,this._$AH=st,this._$AN=void 0,this._$AA=t,this._$AB=s,this._$AM=e,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const s=this._$AM;return void 0!==s&&11===t?.nodeType&&(t=s.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,s=this){t=ot(this,t,s),F(t)?t===st||null==t||""===t?(this._$AH!==st&&this._$AR(),this._$AH=st):t!==this._$AH&&t!==tt&&this._(t):void 0!==t._$litType$?this.g(t):void 0!==t.nodeType?this.$(t):W(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==st&&F(this._$AH)?this._$AA.nextSibling.data=t:this.$(N.createTextNode(t)),this._$AH=t}g(t){const{values:s,_$litType$:e}=t,i="number"==typeof e?this._$AC(t):(void 0===e.el&&(e.el=rt.createElement(ht(e.h,e.h[0]),this.options)),e);if(this._$AH?._$AD===i)this._$AH.p(s);else{const t=new lt(i,this),e=t.u(this.options);t.p(s),this.$(e),this._$AH=t}}_$AC(t){let s=et.get(t.strings);return void 0===s&&et.set(t.strings,s=new rt(t)),s}T(t){I(this._$AH)||(this._$AH=[],this._$AR());const s=this._$AH;let e,i=0;for(const h of t)i===s.length?s.push(e=new ct(this.k(q()),this.k(q()),this,this.options)):e=s[i],e._$AI(h),i++;i<s.length&&(this._$AR(e&&e._$AB.nextSibling,i),s.length=i)}_$AR(t=this._$AA.nextSibling,s){for(this._$AP?.(!1,!0,s);t&&t!==this._$AB;){const s=t.nextSibling;t.remove(),t=s}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class at{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,s,e,i,h){this.type=1,this._$AH=st,this._$AN=void 0,this.element=t,this.name=s,this._$AM=i,this.options=h,e.length>2||""!==e[0]||""!==e[1]?(this._$AH=Array(e.length-1).fill(new String),this.strings=e):this._$AH=st}_$AI(t,s=this,e,i){const h=this.strings;let n=!1;if(void 0===h)t=ot(this,t,s,0),n=!F(t)||t!==this._$AH&&t!==tt,n&&(this._$AH=t);else{const i=t;let r,o;for(t=h[0],r=0;r<h.length-1;r++)o=ot(this,i[e+r],s,r),o===tt&&(o=this._$AH[r]),n||=!F(o)||o!==this._$AH[r],o===st?t=st:t!==st&&(t+=(o??"")+h[r+1]),this._$AH[r]=o}n&&!i&&this.O(t)}O(t){t===st?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class ut extends at{constructor(){super(...arguments),this.type=3}O(t){this.element[this.name]=t===st?void 0:t}}class dt extends at{constructor(){super(...arguments),this.type=4}O(t){this.element.toggleAttribute(this.name,!!t&&t!==st)}}class pt extends at{constructor(t,s,e,i,h){super(t,s,e,i,h),this.type=5}_$AI(t,s=this){if((t=ot(this,t,s,0)??st)===tt)return;const e=this._$AH,i=t===st&&e!==st||t.capture!==e.capture||t.once!==e.once||t.passive!==e.passive,h=t!==st&&(e===st||i);i&&this.element.removeEventListener(this.name,this,e),h&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class ft{constructor(t,s,e){this.element=t,this.type=6,this._$AN=void 0,this._$AM=s,this.options=e}get _$AU(){return this._$AM._$AU}_$AI(t){ot(this,t)}}const bt={j:M,P:D,A:B,C:1,M:nt,L:lt,R:W,V:ot,D:ct,I:at,H:dt,N:pt,U:ut,B:ft},vt=A.litHtmlPolyfillSupport;vt?.(rt,ct),(A.litHtmlVersions??=[]).push("3.1.0");
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
class $t extends R{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const s=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,s,e)=>{const i=e?.renderBefore??s;let h=i._$litPart$;if(void 0===h){const t=e?.renderBefore??null;i._$litPart$=h=new ct(s.insertBefore(q(),t),t,void 0,e??{})}return h._$AI(t),h})(s,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return tt}}$t._$litElement$=!0,$t.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:$t});const gt=globalThis.litElementPolyfillSupport;gt?.({LitElement:$t}),(globalThis.litElementVersions??=[]).push("4.0.2");var mt=function(t,s,e,i){for(var h,n=arguments.length,r=n<3?s:null===i?i=Object.getOwnPropertyDescriptor(s,e):i,o=t.length-1;o>=0;o--)(h=t[o])&&(r=(n<3?h(r):n>3?h(s,e,r):h(s,e))||r);return n>3&&r&&Object.defineProperty(s,e,r),r};class wt extends $t{constructor(){super(...arguments),this.uid=this.genUniqId()}createRenderRoot(){return this.style.display="block",this}updateContext(t){const s=new CustomEvent("update-context",{bubbles:!0,composed:!0});s.context=t,this.dispatchEvent(s)}applyFacet(t,s,e=!1){const i=new URLSearchParams(this.context?.query?.toString()),h=`f[${t}]`;e&&i.delete(h),i.getAll(h).includes(s)?i.delete(h,s):i.append(h,s),i.delete("page"),this.getResults(i)}clearFacet(t){const s=new URLSearchParams(this.context?.query?.toString()),e=`f[${t}]`;s.delete(e),s.delete("page"),this.getResults(s)}clearFacets(){const t=new URLSearchParams(this.context?.query?.toString()),s=[];t.forEach(((t,e)=>{e.startsWith("f[")&&s.push(e)})),s.forEach((s=>t.delete(s))),t.has("page")&&t.delete("page"),this.getResults(t)}async getResults(t){const s=new URL(window.location.href);s.search=t.toString();const e={...this.context};e.query=t;let i=t;this.context?.additionalParams&&(i=new URLSearchParams(new URLSearchParams(this.context.additionalParams).toString()+"&"+t.toString())),[e.response]=await Promise.all([wt.doSearch(e.url??"",i)]),this.context={...e},this.updateContext(e),this.context.updateUrl&&window.history.pushState(null,"",s.toString())}static async doSearch(t,s){const e=new URLSearchParams(s.toString());let i=0;for(const[t,h]of s.entries()){if(!t.startsWith("f["))continue;e.delete(t);let s=t.replace("f[","");s=s.substring(0,s.length-1),e.append(`f[${i}]`,`${s}:${h}`),i++}const h=new URL(t);return h.search=e.toString(),wt.doFetch(h).then((t=>t))}static async doFetch(t,s=void 0){const e=new Headers(s);return fetch(t,{headers:e,cache:"no-store"}).then((async t=>{const s=await t.text();if(!t.ok)throw new Error(`HTTP error! Status: ${t.status}. Message:${s}`);return Promise.resolve(JSON.parse(s))})).catch((t=>console.error("Error in fetching:",t)))}safeIdentifier(t){return t.replace(/\W/g,"-")}genUniqId(t=""){return(t?`${t}-`:"")+Math.random().toString(36).slice(2,9)}}mt([
/**
* @license
* Copyright 2022 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
function({context:t,subscribe:e}){return(i,h)=>{"object"==typeof h?h.addInitializer((function(){new s(this,{context:t,callback:t=>{this[h.name]=t},subscribe:e})})):i.constructor.addInitializer((i=>{new s(i,{context:t,callback:t=>{i[h]=t},subscribe:e})}))}}({context:r,subscribe:!0}),E({attribute:!1})],wt.prototype,"context",void 0),mt([C()],wt.prototype,"uid",void 0);var yt=function(t,s,e,i){for(var h,n=arguments.length,r=n<3?s:null===i?i=Object.getOwnPropertyDescriptor(s,e):i,o=t.length-1;o>=0;o--)(h=t[o])&&(r=(n<3?h(r):n>3?h(s,e,r):h(s,e))||r);return n>3&&r&&Object.defineProperty(s,e,r),r};let St=class extends $t{constructor(){super(...arguments),this.context={url:"",query:new URLSearchParams(window.location.search),responseReady:!1,defaultPerPage:"10",updateUrl:!0,resultDisplay:"list",additionalParams:"",dialogOpen:!1,dialogBreakpoint:0,thirdPartySettings:{}},this.url="",this.additionalParams="",this.defaultPerPage="10",this.defaultResultDisplay="list",this.noPageUrlUpdate=!1,this.dialogBreakpoint=-1,this.root=new n}createRenderRoot(){return this.style.display="block",this}async connectedCallback(){super.connectedCallback();const t={...this.context};let s;if(this.url){const[e,i]=this.url.split("?");e.startsWith("/")?t.url=new URL(e,document.baseURI).href:t.url=e,i&&(s=new URLSearchParams(i))}if(t.defaultPerPage=this.defaultPerPage,t.resultDisplay=this.defaultResultDisplay,t.dialogBreakpoint=this.dialogBreakpoint,this.noPageUrlUpdate&&(t.updateUrl=!1),t.query&&!this.noPageUrlUpdate||(t.query=new URLSearchParams),s){let e=!0;const i=["q","page","limit","sort","order"];t.query.forEach(((t,s)=>{(i.includes(s)&&""!==t||s.startsWith("f["))&&(e=!1)})),(0===t.query.size||e)&&(t.query=s,this.context.query=s)}t.additionalParams=this.additionalParams;let e=t.query;if(this.additionalParams&&(e=new URLSearchParams(new URLSearchParams(this.additionalParams).toString()+"&"+e.toString())),t.response=await wt.doSearch(t.url??"",e),t.responseReady=!0,t.updateUrl){const s=new URL(window.location.href);s.search=t.query.toString(),window.history.pushState(null,"",s.toString())}this.context=t,this.addEventListener("update-context",(t=>{this.context={...this.context,...t.context}}))}};yt([function({context:t}){return(s,e)=>{const i=new WeakMap;if("object"==typeof e)return e.addInitializer((function(){i.set(this,new h(this,{context:t}))})),{get(){return s.get.call(this)},set(t){return i.get(this)?.setValue(t),s.set.call(this,t)},init(t){return i.get(this)?.setValue(t),t}};{s.constructor.addInitializer((s=>{i.set(s,new h(s,{context:t}))}));const n=Object.getOwnPropertyDescriptor(s,e);let r;if(void 0===n){const t=new WeakMap;r={get:function(){return t.get(this)},set:function(s){i.get(this).setValue(s),t.set(this,s)},configurable:!0,enumerable:!0}}else{const t=n.set;r={...n,set:function(s){i.get(this).setValue(s),t?.call(this,s)}}}return void Object.defineProperty(s,e,r)}}}({context:r}),C()],St.prototype,"context",void 0),yt([E()],St.prototype,"url",void 0),yt([E()],St.prototype,"additionalParams",void 0),yt([E()],St.prototype,"defaultPerPage",void 0),yt([E()],St.prototype,"defaultResultDisplay",void 0),yt([E({type:Boolean})],St.prototype,"noPageUrlUpdate",void 0),yt([E({type:Number})],St.prototype,"dialogBreakpoint",void 0),St=yt([o("search-root")],St);
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const Ot=2,xt=t=>(...s)=>({_$litDirective$:t,values:s});class _t{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,s,e){this._$Ct=t,this._$AM=s,this._$Ci=e}_$AS(t,s){return this.update(t,s)}update(t,s){return this.render(...s)}}
/**
* @license
* Copyright 2020 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/const{D:kt}=bt,Lt=()=>document.createComment(""),Rt=(t,s,e)=>{const i=t._$AA.parentNode,h=void 0===s?t._$AB:s._$AA;if(void 0===e){const s=i.insertBefore(Lt(),h),n=i.insertBefore(Lt(),h);e=new kt(s,n,t,t.options)}else{const s=e._$AB.nextSibling,n=e._$AM,r=n!==t;if(r){let s;e._$AQ?.(t),e._$AM=t,void 0!==e._$AP&&(s=t._$AU)!==n._$AU&&e._$AP(s)}if(s!==h||r){let t=e._$AA;for(;t!==s;){const s=t.nextSibling;i.insertBefore(t,h),t=s}}}return e},jt=(t,s,e=t)=>(t._$AI(s,e),t),Pt={},Et=t=>{t._$AP?.(!1,!0);let s=t._$AA;const e=t._$AB.nextSibling;for(;s!==e;){const t=s.nextSibling;s.remove(),s=t}},Ct=(t,s,e)=>{const i=new Map;for(let h=s;h<=e;h++)i.set(t[h],h);return i},At=xt(class extends _t{constructor(t){if(super(t),t.type!==Ot)throw Error("repeat() can only be used in text expressions")}ht(t,s,e){let i;void 0===e?e=s:void 0!==s&&(i=s);const h=[],n=[];let r=0;for(const s of t)h[r]=i?i(s,r):r,n[r]=e(s,r),r++;return{values:n,keys:h}}render(t,s,e){return this.ht(t,s,e).values}update(t,[s,e,i]){const h=(t=>t._$AH)(t),{values:n,keys:r}=this.ht(s,e,i);if(!Array.isArray(h))return this.dt=r,n;const o=this.dt??=[],l=[];let c,a,u=0,d=h.length-1,p=0,f=n.length-1;for(;u<=d&&p<=f;)if(null===h[u])u++;else if(null===h[d])d--;else if(o[u]===r[p])l[p]=jt(h[u],n[p]),u++,p++;else if(o[d]===r[f])l[f]=jt(h[d],n[f]),d--,f--;else if(o[u]===r[f])l[f]=jt(h[u],n[f]),Rt(t,l[f+1],h[u]),u++,f--;else if(o[d]===r[p])l[p]=jt(h[d],n[p]),Rt(t,h[u],h[d]),d--,p++;else if(void 0===c&&(c=Ct(r,p,f),a=Ct(o,u,d)),c.has(o[u]))if(c.has(o[d])){const s=a.get(r[p]),e=void 0!==s?h[s]:null;if(null===e){const s=Rt(t,h[u]);jt(s,n[p]),l[p]=s}else l[p]=jt(e,n[p]),Rt(t,h[u],e),h[s]=null;p++}else Et(h[d]),d--;else Et(h[u]),u++;for(;p<=f;){const s=Rt(t,l[f+1]);jt(s,n[p]),l[p++]=s}for(;u<=d;){const t=h[u++];null!==t&&Et(t)}return this.dt=r,((t,s=Pt)=>{t._$AH=s})(t,l),tt}});
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/var Tt=function(t,s,e,i){for(var h,n=arguments.length,r=n<3?s:null===i?i=Object.getOwnPropertyDescriptor(s,e):i,o=t.length-1;o>=0;o--)(h=t[o])&&(r=(n<3?h(r):n>3?h(s,e,r):h(s,e))||r);return n>3&&r&&Object.defineProperty(s,e,r),r};class Ut extends wt{constructor(){super(...arguments),this.key="",this.overrideLabel="",this.showLabel=!1,this.showCount=!1,this.showReset=!1,this.resetText="Reset (@count)",this.collapsible=!1,this.closed=!1,this.showCountInCollapseLabel=!1,this.preferAttributes=!1,this.urlAlias="",this.optionsOpen=!0,this.facetConfigLoaded=!1,this.showMoreOpen=!1}connectedCallback(){super.connectedCallback(),this.optionsOpen=!this.closed}updated(t){if(this.facetConfigLoaded||!this.context?.responseReady)return;const s=this._getFacetData();s&&(this.urlAlias=s.settings.url_alias,this.showLabel=this._configOrAttribute(s.settings.show_title,this.showLabel),this.showCount=this._configOrAttribute(s.settings.widget.show_numbers,this.showCount),this.showReset=this._configOrAttribute(s.settings.widget.showReset,this.showReset),this.resetText=this._configOrAttribute(s.settings.widget.resetText,this.resetText),this.collapsible=this._configOrAttribute(s.settings.widget.collapsible,this.collapsible),this.closed=this._configOrAttribute(s.settings.widget.closed,this.closed),this.showCountInCollapseLabel=this._configOrAttribute(s.settings.widget.showCountInCollapseLabel,this.showCountInCollapseLabel),this.softLimit=this._configOrAttribute(Number(s?.settings.widget?.soft_limit?.limit),this.softLimit),this.softLimitLessLabel=this._configOrAttribute(s?.settings.widget?.soft_limit?.less_label,this.softLimitLessLabel),this.softLimitMoreLabel=this._configOrAttribute(s?.settings.widget?.soft_limit?.more_label,this.softLimitMoreLabel),this.facetConfigLoaded=!0)}_configOrAttribute(t,s){return this.preferAttributes?s:!("boolean"!=typeof s||!t&&!s)||(void 0!==t?t:s)}_getOptionId(t){const s=t.replace(/\W/g,"-");return`option-${this.uid}-${s}`}_getFacetData(){return this.context?.response?.facets.find((t=>t.key===this.key))}_getLabelElement(){const t=this._getFacetData(),s=this.overrideLabel?this.overrideLabel:t.label;return Y`<div class="facet-label ${t.key}">${s}</div>`}_getCollapsibleLabelElement(){const t=this._getFacetData(),s=this.overrideLabel?this.overrideLabel:t.label;return Y`<button
aria-expanded="${this.optionsOpen}"
class="facet-label ${t.key} ${this.optionsOpen?"open":"closed"}"
@click=${()=>this.optionsOpen=!this.optionsOpen}
aria-controls="${"facet-collapse-"+this.uid}"
>
${s}${this.showCountInCollapseLabel&&t.active_values?.length?`(${t.active_values.length})`:null}
</button>`}_getSoftLimitElement(){const t=this._getFacetData();return!this.softLimit||t.results.length<=this.softLimit?Y``:Y`<button
aria-expanded="${this.showMoreOpen}"
class="facet-show-more ${t.key} ${this.showMoreOpen?"open":"closed"}"
@click=${()=>this.showMoreOpen=!this.showMoreOpen}
aria-controls="${"facet-options-collapse-"+this.uid}"
>
${this.showMoreOpen?this.softLimitLessLabel:this.softLimitMoreLabel}
</button>`}wrapCollapsible(t,s){return Y`
${t}
<div
id="${"facet-collapse-"+this.uid}"
class="facet-options ${this.optionsOpen?"open":"closed"}"
>
${this.optionsOpen?s:null}
</div>
`}_getResetElement(){const t=this._getFacetData();return this.showReset&&t.active_values&&0!==t.active_values.length?Y`<button
class="${this.key} facet reset"
@click="${()=>this.clearFacet(this.urlAlias)}"
>
${this.resetText.replaceAll("@count",""+t.active_values.length)}
</button>`:Y``}shouldRender(){return!(!this.context?.response||void 0===this._getFacetData()||0===this._getFacetData().count)}render(){this.classList.add(this.safeIdentifier(this.key));const t=this._getFacetData();t&&t.count?this.classList.add("has-options"):this.classList.remove("has-options"),t&&t.active_values&&t.active_values.length>0?this.classList.add("is-active"):this.classList.remove("is-active"),this.collapsible&&!this.optionsOpen?this.classList.add("collapsed"):this.classList.remove("collapsed")}}Tt([E()],Ut.prototype,"key",void 0),Tt([E()],Ut.prototype,"overrideLabel",void 0),Tt([E({type:Boolean})],Ut.prototype,"showLabel",void 0),Tt([E({type:Boolean})],Ut.prototype,"showCount",void 0),Tt([E({type:Boolean})],Ut.prototype,"showReset",void 0),Tt([E()],Ut.prototype,"resetText",void 0),Tt([E({type:Boolean})],Ut.prototype,"collapsible",void 0),Tt([E({type:Boolean})],Ut.prototype,"closed",void 0),Tt([E({type:Boolean})],Ut.prototype,"showCountInCollapseLabel",void 0),Tt([E({type:Boolean})],Ut.prototype,"preferAttributes",void 0),Tt([E({attribute:!1})],Ut.prototype,"urlAlias",void 0),Tt([E({type:Number})],Ut.prototype,"softLimit",void 0),Tt([E()],Ut.prototype,"softLimitLessLabel",void 0),Tt([E()],Ut.prototype,"softLimitMoreLabel",void 0),Tt([C()],Ut.prototype,"optionsOpen",void 0),Tt([C()],Ut.prototype,"facetConfigLoaded",void 0),Tt([C()],Ut.prototype,"facet",void 0),Tt([C()],Ut.prototype,"showMoreOpen",void 0);var Mt=function(t,s,e,i){for(var h,n=arguments.length,r=n<3?s:null===i?i=Object.getOwnPropertyDescriptor(s,e):i,o=t.length-1;o>=0;o--)(h=t[o])&&(r=(n<3?h(r):n>3?h(s,e,r):h(s,e))||r);return n>3&&r&&Object.defineProperty(s,e,r),r};let Dt=class extends Ut{_getOptions(t=void 0){const s=this._getFacetData();let e=t??s.results;return void 0===t&&this.softLimit&&0!==this.softLimit&&!this.showMoreOpen&&(e=e.slice(0,this.softLimit)),Y`
<ul>
${At(e,(t=>t.key),(t=>{const s=["facet","button"];return t.active&&s.push("active"),t.in_active_trail&&s.push("active-trail"),t.children.length>0&&(s.push("has-children"),t.children_expanded?s.push("children-expanded"):s.push("children-hidden")),Y`
<li class="${s.join(" ")}">
<button
class="${this.key}"
type="button"
name="${t.key}"
value="${t.key}"
aria-pressed="${t.active??!1}"
@click=${()=>this.applyFacet(this.urlAlias,t.key)}
>${t.label}${this.showCount?` (${t.count})`:null}
</li>
`}))}
</ul>
`}render(){return super.render(),this.shouldRender()?this.collapsible?this.wrapCollapsible(this._getCollapsibleLabelElement(),Y`${this._getOptions()} ${this._getSoftLimitElement()}
${this._getResetElement()}`):Y`
${this.showLabel?this._getLabelElement():null} ${this._getOptions()}
${this._getSoftLimitElement()} ${this._getResetElement()}
`:null}};Dt=Mt([o("facet-button")],Dt);var Bt=function(t,s,e,i){for(var h,n=arguments.length,r=n<3?s:null===i?i=Object.getOwnPropertyDescriptor(s,e):i,o=t.length-1;o>=0;o--)(h=t[o])&&(r=(n<3?h(r):n>3?h(s,e,r):h(s,e))||r);return n>3&&r&&Object.defineProperty(s,e,r),r};let Ht=class extends Ut{constructor(){super(...arguments),this.useRadios=!1}updated(t){if(this.facetConfigLoaded||!this.context?.responseReady)return;super.updated(t);const s=this._getFacetData();this.useRadios=this._configOrAttribute(s?.settings.widget.useRadios,this.useRadios)}applyFacet(t,s,e=!1){this.useRadios&&this.context?.query?.delete(`f[${t}]`),super.applyFacet(t,s,e)}_getOptions(t=void 0){const s=this._getFacetData();let e=t??s.results;return void 0===t&&this.softLimit&&0!==this.softLimit&&!this.showMoreOpen&&(e=e.slice(0,this.softLimit)),Y`
<ul>
${At(e,(t=>t.key),(t=>{const e=this.genUniqId(`${s.key}-${this.safeIdentifier(t.key)}`),i=["facet"];return this.useRadios?i.push("radio"):i.push("checkbox"),t.active&&i.push("active"),t.in_active_trail&&i.push("active-trail"),t.children.length>0&&(i.push("has-children"),t.children_expanded?i.push("children-expanded"):i.push("children-hidden")),Y`
<li class="${i.join(" ")}">
<input
type="${this.useRadios?"radio":"checkbox"}"
id=${e}
name="${t.key}"
value="${t.key}"
.checked=${t.active??!1}
?checked=${t.active??!1}
@click=${()=>this.applyFacet(this.urlAlias,t.key)}
/>
<label for="${e}"
>${t.label}${this.showCount?` (${t.count})`:null}</label
>
${t.children.length>0?this._getOptions(t.children):null}
</li>
`}))}
</ul>
`}render(){return super.render(),this.shouldRender()?this.collapsible?this.wrapCollapsible(this._getCollapsibleLabelElement(),Y`${this._getOptions()} ${this._getSoftLimitElement()}
${this._getResetElement()} `):Y`
${this.showLabel?this._getLabelElement():null} ${this._getOptions()}
${this._getSoftLimitElement()} ${this._getResetElement()}
`:null}};Bt([E({type:Boolean})],Ht.prototype,"useRadios",void 0),Ht=Bt([o("facet-checkbox")],Ht);var Nt=function(t,s,e,i){for(var h,n=arguments.length,r=n<3?s:null===i?i=Object.getOwnPropertyDescriptor(s,e):i,o=t.length-1;o>=0;o--)(h=t[o])&&(r=(n<3?h(r):n>3?h(s,e,r):h(s,e))||r);return n>3&&r&&Object.defineProperty(s,e,r),r};let qt=class extends Ut{constructor(){super(...arguments),this.selectLabel="Choose an option"}updated(t){if(this.facetConfigLoaded||!this.context?.responseReady)return;super.updated(t);const s=this._getFacetData();this.selectLabel=this._configOrAttribute(s?.settings.widget.selectLabel,this.selectLabel)}applyFacet(t,s,e=!1){s?super.applyFacet(t,s,e):this.clearFacet(t)}_getLabelElementSelect(){const t=this._getFacetData(),s=this.overrideLabel?this.overrideLabel:t.label;return Y`<label
for="facet-select-${this.uid}"
class="facet-label ${t.key}"
>${s}</label
>`}_getOptionElement(t){return Y` <option
value=${t.key}
?selected=${t.active??!1}
>
${t.label}${this.showCount?` (${t.count})`:null}
</option>`}_getAllOptionsElements(){const t=this._getFacetData();return Y`
<option value="" ?selected="${(t.active_values?.length??0)<=0}">
${this.selectLabel}
</option>
${At(t.results,(t=>t.key),(t=>Y`${this._getOptionElement(t)}`))}
`}_getSelectElement(){return Y`
<select
id="facet-select-${this.uid}"
@change="${t=>{const s=t.currentTarget;this.applyFacet(this.urlAlias,s.value,!0)}}"
>
${this._getAllOptionsElements()}
</select>
`}render(){return super.render(),this.shouldRender()?this.collapsible?this.wrapCollapsible(this._getCollapsibleLabelElement(),Y`${this._getSelectElement()} ${this._getResetElement()}`):Y` ${this.showLabel?this._getLabelElementSelect():null}
${this._getSelectElement()} ${this._getResetElement()}`:null}};Nt([E()],qt.prototype,"selectLabel",void 0),qt=Nt([o("facet-dropdown")],qt);
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const Ft=(t,s)=>{const e=t._$AN;if(void 0===e)return!1;for(const t of e)t._$AO?.(s,!1),Ft(t,s);return!0},It=t=>{let s,e;do{if(void 0===(s=t._$AM))break;e=s._$AN,e.delete(t),t=s}while(0===e?.size)},Wt=t=>{for(let s;s=t._$AM;t=s){let e=s._$AN;if(void 0===e)s._$AN=e=new Set;else if(e.has(t))break;e.add(t),Vt(s)}};function zt(t){void 0!==this._$AN?(It(this),this._$AM=t,Wt(this)):this._$AM=t}function Kt(t,s=!1,e=0){const i=this._$AH,h=this._$AN;if(void 0!==h&&0!==h.size)if(s)if(Array.isArray(i))for(let t=e;t<i.length;t++)Ft(i[t],!1),It(i[t]);else null!=i&&(Ft(i,!1),It(i));else Ft(this,t)}const Vt=t=>{t.type==Ot&&(t._$AP??=Kt,t._$AQ??=zt)};class Jt extends _t{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,s,e){super._$AT(t,s,e),Wt(this),this.isConnected=t._$AU}_$AO(t,s=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),s&&(Ft(this,t),It(this))}setValue(t){if((t=>void 0===t.strings)(this._$Ct))this._$Ct._$AI(t,this);else{const s=[...this._$Ct._$AH];s[this._$Ci]=t,this._$Ct._$AI(s,this,0)}}disconnected(){}reconnected(){}}
/**
* @license
* Copyright 2020 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/const Zt=()=>new Qt;class Qt{}const Gt=new WeakMap,Xt=xt(class extends Jt{render(t){return st}update(t,[s]){const e=s!==this.G;return e&&void 0!==this.G&&this.ot(void 0),(e||this.rt!==this.lt)&&(this.G=s,this.ct=t.options?.host,this.ot(this.lt=t.element)),st}ot(t){if("function"==typeof this.G){const s=this.ct??globalThis;let e=Gt.get(s);void 0===e&&(e=new WeakMap,Gt.set(s,e)),void 0!==e.get(this.G)&&this.G.call(this.ct,void 0),e.set(this.G,t),void 0!==t&&this.G.call(this.ct,t)}else this.G.value=t}get rt(){return"function"==typeof this.G?Gt.get(this.ct??globalThis)?.get(this.G):this.G?.value}disconnected(){this.rt===this.lt&&this.ot(void 0)}reconnected(){this.ot(this.lt)}});var Yt=function(t,s,e,i){for(var h,n=arguments.length,r=n<3?s:null===i?i=Object.getOwnPropertyDescriptor(s,e):i,o=t.length-1;o>=0;o--)(h=t[o])&&(r=(n<3?h(r):n>3?h(s,e,r):h(s,e))||r);return n>3&&r&&Object.defineProperty(s,e,r),r};const ts=t=>{class s extends t{constructor(){super(...arguments),this.htmlSelectLabel="Choose an option",this.multipleSelect=!1,this.dropdownOpen=!1,this.required=!1,this.focusedOption=null,this.focusOnOpen=!1,this.searchTerm="",this.inputRef=Zt(),this.listboxRef=Zt(),this.selectActions={Close:0,CloseSelect:1,First:2,Last:3,Next:4,Open:5,PageDown:6,PageUp:7,Previous:8,Select:9,Type:10}}updated(t){super.updated(t),this.focusOnOpen&&(this._setOptionFocus(this._getNextOption(this.selectActions.First)),this.focusOnOpen=!1)}getHtmlLabel(){return""}getOptionId(t){const s=this.safeIdentifier(this.getOptionKey(t));return`option-${this.uid}-${s}`}getOptionKey(t){return""}getOptionValue(t){return""}getOptionLabel(t){return""}getAllOptions(){return[]}isOptionSelected(t){return!0}hasSelectedOptions(){return!1}getHtmlSelectLabel(){return this.htmlSelectLabel}optionMouseDown(t,s){t.preventDefault()}clearSelection(t){t.preventDefault()}applySelection(t){}getSelectedOptions(){return[]}filterOptions(t){return[]}_getHtmlLabelElement(){return this.getHtmlLabel()?Y`<label id="combo-label-${this.uid}" class="combo-label"
>${this.getHtmlLabel()}</label
>`:Y``}_getOptionElement(t){return Y`
<div
role="option"
id=${this.getOptionId(t)}
class="combo-option ${this.isOptionSelected(t)?"selected":null}"
aria-selected="${this.isOptionSelected(t)}"
@mousedown=${s=>this.optionMouseDown(s,t)}
data-value="${this.getOptionValue(t)}"
>
${this.getOptionLabel(t)}
</div>
`}_getAllOptionsElements(){return Y`
<div
role="option"
id="select-label-${this.uid}"
class="combo-option combo-option-label${this.required?" disabled":null}"
aria-selected=${!this.hasSelectedOptions()}
@mousedown=${this.required?null:this.clearSelection}
aria-disabled="${this.required}"
>
${this.htmlSelectLabel}
</div>
${At(this.getAllOptions(),(t=>this.getOptionId(t)),(t=>this._getOptionElement(t)))}
`}_getHtmlSelectLabelElement(){return Y`
<div
${Xt(this.inputRef)}
id="combo-input-${this.uid}"
role="combobox"
tabindex="0"
class="combo-input ${this.dropdownOpen?"open":null}"
aria-controls="combo-listbox-${this.uid}"
aria-expanded="${this.dropdownOpen}"
aria-haspopup="listbox"
aria-labelledby="combo-label-${this.uid}"
@blur=${this.close}
@focusout=${this.close}
@click=${this.toggleDropdown}
@keydown=${t=>this.onSelectKeyDown(t)}
>
${this.getHtmlSelectLabel()}
</div>
`}_getHtmlSelectElement(){return Y`
<div
${Xt(this.listboxRef)}
class="combo-options ${this.dropdownOpen?"open":null}"
role="listbox"
id="combo-listbox-${this.uid}"
aria-labelledby="combo-label-${this.uid}"
tabindex="-1"
>
${this.dropdownOpen?this._getAllOptionsElements():null}
</div>
`}close(){this.dropdownOpen=!1,this.focusedOption=null}_getActionFromKey(t){const{key:s,altKey:e,ctrlKey:i,metaKey:h}=t;if(!this.dropdownOpen&&["ArrowDown","ArrowUp","Enter"," "].includes(s))return this.selectActions.Open;if("Home"===s)return this.selectActions.First;if("End"===s)return this.selectActions.Last;if("Backspace"===s||"Clear"===s||1===s.length&&" "!==s&&!e&&!i&&!h)return this.selectActions.Type;if(this.dropdownOpen){if("ArrowUp"===s&&e)return this.selectActions.CloseSelect;if("ArrowDown"===s&&!e)return this.selectActions.Next;if("ArrowUp"===s)return this.selectActions.Previous;if("PageUp"===s)return this.selectActions.PageUp;if("PageDown"===s)return this.selectActions.PageDown;if("Escape"===s)return this.selectActions.Close;if("Enter"===s||" "===s)return this.selectActions.CloseSelect}return-1}onSelectKeyDown(t){const{key:s}=t,e=this._getActionFromKey(t);switch(e){case this.selectActions.Last:case this.selectActions.First:case this.selectActions.Next:case this.selectActions.Previous:case this.selectActions.PageUp:case this.selectActions.PageDown:t.preventDefault(),this._setOptionFocus(this._getNextOption(e));break;case this.selectActions.CloseSelect:t.preventDefault(),this.applySelection(t),this.multipleSelect||this.close();break;case this.selectActions.Close:t.preventDefault(),this.dropdownOpen=!1;break;case this.selectActions.Type:this._typeSearch(s);break;case this.selectActions.Open:t.preventDefault(),this.focusOnOpen=!0,this.dropdownOpen=!0}}toggleDropdown(){const t=this.getSelectedOptions();this.dropdownOpen=!this.dropdownOpen,this.dropdownOpen?t.length>0&&this.inputRef.value?.setAttribute("aria-activedescendant",this.getOptionId(t[0])):this.inputRef.value?.removeAttribute("aria-activedescendant")}_typeSearch(t){this.dropdownOpen=!0;const s=this._getSearchTerm(t),e=this._searchOptions(s);if(!e)return window.clearTimeout(this.searchTimeout),void(this.searchTerm="");this._setOptionFocus(e)}_searchOptions(t){const s=this.filterOptions(t),e=t.split(""),i=e.every((t=>t===e[0]));if(0!==s.length||i){if(s[0])return this.getOptionId(s[0]);if(i){const t=this.filterOptions(e[0]);if(0===t.length)return;return this.getOptionId(t[(e.length-1)%t.length])}}}_getNextOption(t){const s=this.getAllOptions(),e=`select-label-${this.uid}`;if(!this.focusedOption)return e;let i=s.findIndex((t=>this.focusedOption?.id===this.getOptionId(t)));i=-1===i?0:i+1;const h=s.length+1;let n;switch(t){case this.selectActions.First:n=0;break;case this.selectActions.Last:n=h-1;break;case this.selectActions.Previous:n=Math.max(0,i-1);break;case this.selectActions.Next:n=Math.min(h,i+1);break;case this.selectActions.PageUp:n=Math.max(0,i-10);break;case this.selectActions.PageDown:n=Math.min(h-1,i+10);break;default:n=i}return 0===n?e:this.getOptionId(s[n-1])}_getSearchTerm(t){return"number"==typeof this.searchTimeout&&window.clearTimeout(this.searchTimeout),this.searchTimeout=window.setTimeout((()=>{this.searchTerm=""}),500),this.searchTerm+=t,this.searchTerm}_elementInView(t){const s=this.querySelector(`#${t}`);if(!s)return!0;var e=s.getBoundingClientRect();return e.top>=0&&e.left>=0&&e.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&e.right<=(window.innerWidth||document.documentElement.clientWidth)}_isScrollable(){const t=this.listboxRef.value;return void 0!==t&&t.clientHeight<t.scrollHeight}_maintainScrollVisibility(t){const s=this.querySelector(`#${t}`),e=this.listboxRef.value;if(!e)return;const{offsetHeight:i,offsetTop:h}=s,{offsetHeight:n,scrollTop:r}=e,o=h+i>r+n;h<r?e.scrollTo(0,h):o&&e.scrollTo(0,h-n+i)}_setOptionFocus(t){this.focusedOption=this.querySelector(`#${t}`),this.inputRef.value?.setAttribute("aria-activedescendant",t),this.listboxRef.value?.querySelectorAll(".focused")?.forEach((t=>{t.classList.remove("focused")})),this.focusedOption?.classList.add("focused"),this._isScrollable()&&this._maintainScrollVisibility(t),this._elementInView(t)||this.focusedOption?.scrollIntoView({behavior:"smooth",block:"nearest"}),this.inputRef.value?.focus()}}return Yt([E()],s.prototype,"htmlSelectLabel",void 0),Yt([E({type:Boolean})],s.prototype,"multipleSelect",void 0),Yt([C()],s.prototype,"dropdownOpen",void 0),Yt([E({type:Boolean})],s.prototype,"required",void 0),Yt([C()],s.prototype,"focusedOption",void 0),Yt([C()],s.prototype,"focusOnOpen",void 0),Yt([C()],s.prototype,"searchTimeout",void 0),Yt([C()],s.prototype,"searchTerm",void 0),s};var ss=function(t,s,e,i){for(var h,n=arguments.length,r=n<3?s:null===i?i=Object.getOwnPropertyDescriptor(s,e):i,o=t.length-1;o>=0;o--)(h=t[o])&&(r=(n<3?h(r):n>3?h(s,e,r):h(s,e))||r);return n>3&&r&&Object.defineProperty(s,e,r),r};let es=class extends(ts(Ut)){updated(t){if(this.facetConfigLoaded||!this.context?.responseReady)return;super.updated(t);const s=this._getFacetData();this.htmlSelectLabel=this._configOrAttribute(s?.settings.widget.htmlSelectLabel,this.htmlSelectLabel),this.required=this._configOrAttribute(s?.settings.widget.required,this.required),this.multipleSelect=this._configOrAttribute(s?.settings.widget.multipleSelect,this.multipleSelect)}applyFacet(t,s,e=!1){super.applyFacet(t,s,!this.multipleSelect),this.multipleSelect||this.close()}getHtmlLabel(){return this.overrideLabel?this.overrideLabel:this._getFacetData().label}getOptionKey(t){return t.key}getOptionValue(t){return t.key}getOptionLabel(t){return`${t.label}${this.showCount?` (${t.count})`:""}`}getAllOptions(){return this._getFacetData().results}isOptionSelected(t){return t.active??!1}hasSelectedOptions(){return(this._getFacetData()?.active_values?.length??0)>0}getHtmlSelectLabel(){if(this.hasSelectedOptions()){return this.getSelectedOptions().map((t=>t.label)).join(", ")}return this.htmlSelectLabel}optionMouseDown(t,s){t.preventDefault(),this.applyFacet(this.urlAlias,s.key)}clearSelection(t){t.preventDefault(),this.clearFacet(this.urlAlias),this.close()}applySelection(t){this.focusedOption&&this.focusedOption.dataset.value?this.applyFacet(this.urlAlias,this.focusedOption.dataset.value):(this.clearFacet(this.urlAlias),this.close())}getSelectedOptions(){return this._getFacetData().results.filter((t=>t.active))}filterOptions(t){return this.getAllOptions().filter((s=>s.label.toLowerCase().startsWith(t)))}render(){return super.render(),this.shouldRender()?this.collapsible?this.wrapCollapsible(this._getCollapsibleLabelElement(),Y`${this._getHtmlSelectLabelElement()}
${this._getHtmlSelectElement()} ${this._getResetElement()}`):Y`
${this.showLabel?this._getHtmlLabelElement():null}
${this._getHtmlSelectLabelElement()} ${this._getHtmlSelectElement()}
${this._getResetElement()}
`:null}};es=ss([o("facet-dropdown-html")],es);var is=function(t,s,e,i){for(var h,n=arguments.length,r=n<3?s:null===i?i=Object.getOwnPropertyDescriptor(s,e):i,o=t.length-1;o>=0;o--)(h=t[o])&&(r=(n<3?h(r):n>3?h(s,e,r):h(s,e))||r);return n>3&&r&&Object.defineProperty(s,e,r),r};let hs=class extends wt{constructor(){super(...arguments),this.removeText="Remove @value",this.resetText="Reset (@count)",this.showReset=!1,this.showIndividual=!1}_getApplied(){const t=[],s=this?.context?.query;return s?(this.context?.response&&this.context.response.facets.forEach((e=>{s.getAll(`f[${e.key}]`).forEach((s=>{t.push({key:e.key,facetKey:e.key,value:s})}))})),t):t}_getResetElement(){return Y`
<li class="applied reset">
<button class="applied-button-reset" @click=${()=>this.clearFacets()}>
${this.resetText.replaceAll("@count",""+this._getApplied().length)}
</button>
</li>
`}_getIndividualFacets(t){return Y`
${At(t,(t=>`${t.key}:${t.value}`),(t=>{const s=this.removeText.replace("@value",t.value);return Y`
<li class="applied facet">
<div @click=${()=>this.applyFacet(t.facetKey,t.value)}>
${t.value}
</div>
<button
@click=${()=>this.applyFacet(t.facetKey,t.value)}
class="applied-button-remove"
>
${s}
</button>
</li>
`}))}
`}render(){if(!this.context?.response)return null;const t=this._getApplied();return 0===t.length?null:Y`
<ul class="applied-facets">
${this.showIndividual?this._getIndividualFacets(t):null}
${this.showReset?this._getResetElement():null}
</ul>
`}};is([E()],hs.prototype,"removeText",void 0),is([E()],hs.prototype,"resetText",void 0),is([E({type:Boolean})],hs.prototype,"showReset",void 0),is([E({type:Boolean})],hs.prototype,"showIndividual",void 0),hs=is([o("search-applied-facets")],hs);var ns=function(t,s,e,i){for(var h,n=arguments.length,r=n<3?s:null===i?i=Object.getOwnPropertyDescriptor(s,e):i,o=t.length-1;o>=0;o--)(h=t[o])&&(r=(n<3?h(r):n>3?h(s,e,r):h(s,e))||r);return n>3&&r&&Object.defineProperty(s,e,r),r};let rs=class extends $t{constructor(){super(...arguments),this.url="",this.submitText="Search",this.ariaLabelText="",this.placeHolderText=""}createRenderRoot(){return this.style.display="block",this}_submit(t){t.preventDefault(),t.currentTarget instanceof Element&&window.location.replace(this.url+"?q="+t?.currentTarget?.querySelector("input")?.value?.trim())}render(){return Y`
<form class="search-box" @submit="${t=>this._submit(t)}">
<input
class="search-box-input"
type="text"
placeholder="${this.placeHolderText}"
aria-label="${this.ariaLabelText}"
/>
<button class="search-box-submit" type="submit">
${this.submitText}
</button>
</form>
`}};ns([E({attribute:!0})],rs.prototype,"url",void 0),ns([E({attribute:!0})],rs.prototype,"submitText",void 0),ns([E({attribute:!0})],rs.prototype,"ariaLabelText",void 0),ns([E({attribute:!0})],rs.prototype,"placeHolderText",void 0),rs=ns([o("search-box")],rs);var os=function(t,s,e,i){for(var h,n=arguments.length,r=n<3?s:null===i?i=Object.getOwnPropertyDescriptor(s,e):i,o=t.length-1;o>=0;o--)(h=t[o])&&(r=(n<3?h(r):n>3?h(s,e,r):h(s,e))||r);return n>3&&r&&Object.defineProperty(s,e,r),r};let ls=class extends wt{constructor(){super(...arguments),this.placeHolderText="",this.labelText="",this.clearText="Remove"}_querySearch(t){t.preventDefault();const s=this.querySelector("input"),e=s?.value.trim(),i=new URLSearchParams;e?i.set("q",e??""):i.delete("q"),this.getResults(i)}_clearSearch(){const t=new URLSearchParams;this.getResults(t)}render(){return Y`
<form class="search-input" @submit="${this._querySearch}">
<span>
<input
class="search-input-input"
type="text"
.value="${this?.context?.query?.get("q")??""}"
placeholder="${this.placeHolderText}"
/>
${this?.context?.query?.get("q")?Y`<button
class="search-input-clear"
type="button"
@click=${()=>{this._clearSearch()}}
>
${this.clearText}
</button>`:null}
</span>
<button class="search-input-submit" type="submit">
${this.labelText}
</button>
</form>
`}};os([E()],ls.prototype,"placeHolderText",void 0),os([E()],ls.prototype,"labelText",void 0),os([E()],ls.prototype,"clearText",void 0),ls=os([o("search-input")],ls);var cs=function(t,s,e,i){for(var h,n=arguments.length,r=n<3?s:null===i?i=Object.getOwnPropertyDescriptor(s,e):i,o=t.length-1;o>=0;o--)(h=t[o])&&(r=(n<3?h(r):n>3?h(s,e,r):h(s,e))||r);return n>3&&r&&Object.defineProperty(s,e,r),r};let as=class extends wt{createRenderRoot(){return this.style.display="none",this}render(){if(!this.context?.responseReady)return null;const t=this.context?.response?.search_results_count;return t?(this.classList.add("no-results-hidden"),this.classList.remove("no-results-visible"),this.style.setProperty("display","none")):(this.classList.add("no-results-visible"),this.classList.remove("no-results-hidden"),this.style.removeProperty("display")),""}};as=cs([o("search-no-results-message")],as);var us=function(t,s,e,i){for(var h,n=arguments.length,r=n<3?s:null===i?i=Object.getOwnPropertyDescriptor(s,e):i,o=t.length-1;o>=0;o--)(h=t[o])&&(r=(n<3?h(r):n>3?h(s,e,r):h(s,e))||r);return n>3&&r&&Object.defineProperty(s,e,r),r};let ds=class extends wt{constructor(){super(...arguments),this.data={}}render(){return Y`
<details open style="overflow-x: scroll">
<summary>Item</summary>
<pre>${JSON.stringify(this.data,null,2)}</pre>
</details>
`}};us([E({attribute:!0,type:Object})],ds.prototype,"data",void 0),ds=us([o("search-result-element-default")],ds);
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
class ps extends _t{constructor(t){if(super(t),this.et=st,t.type!==Ot)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===st||null==t)return this.vt=void 0,this.et=t;if(t===tt)return t;if("string"!=typeof t)throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.et)return this.vt;this.et=t;const s=[t];return s.raw=s,this.vt={_$litType$:this.constructor.resultType,strings:s,values:[]}}}ps.directiveName="unsafeHTML",ps.resultType=1;const fs=xt(ps);var bs=function(t,s,e,i){for(var h,n=arguments.length,r=n<3?s:null===i?i=Object.getOwnPropertyDescriptor(s,e):i,o=t.length-1;o>=0;o--)(h=t[o])&&(r=(n<3?h(r):n>3?h(s,e,r):h(s,e))||r);return n>3&&r&&Object.defineProperty(s,e,r),r};let vs=class extends wt{constructor(){super(...arguments),this.settings={},this.data={}}render(){return this?.settings?.field&&this.data&&this.data[this?.settings?.field]?Y`${fs(this.data[this?.settings.field])}`:null}};bs([E({type:Object})],vs.prototype,"settings",void 0),bs([E({type:Object})],vs.prototype,"data",void 0),vs=bs([o("search-result-element-rendered")],vs);var $s=function(t,s,e,i){for(var h,n=arguments.length,r=n<3?s:null===i?i=Object.getOwnPropertyDescriptor(s,e):i,o=t.length-1;o>=0;o--)(h=t[o])&&(r=(n<3?h(r):n>3?h(s,e,r):h(s,e))||r);return n>3&&r&&Object.defineProperty(s,e,r),r};let gs=class extends wt{constructor(){super(...arguments),this.summaryText="@start - @end of @total"}_getNumbers(){const t=this.context?.response?.search_results_page??0,s=parseInt(this.context?.response?.search_results_per_page?this.context?.response.search_results_per_page:this.context?.defaultPerPage),e=this.context?.response?.search_results_count,i=t*s,h={start:0,end:0,total:e};h.start=0===e?0:t*s+1;const n=+i+s;return h.end=n>e?e:n,h}_getSummaryElement(){const t=this._getNumbers(),s=this.context?.response?.took?this.context?.response?.took/1e3:"",e=this.summaryText.replaceAll("@start",""+t.start).replaceAll("@end",""+t.end).replaceAll("@total",""+t.total).replaceAll("@searchQuery",this.context?.query?.get("q")??"").replaceAll("@time",""+s);return Y`${e}`}render(){return this.context?.response?Y`<div>${this._getSummaryElement()}</div>`:null}};$s([E()],gs.prototype,"summaryText",void 0),gs=$s([o("search-result-summary")],gs);
/**
* @license
* Copyright 2020 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const ms=Symbol.for(""),ws=t=>{if(t?.r===ms)return t?._$litStatic$},ys=new Map,Ss=(t=>(s,...e)=>{const i=e.length;let h,n;const r=[],o=[];let l,c=0,a=!1;for(;c<i;){for(l=s[c];c<i&&void 0!==(n=e[c],h=ws(n));)l+=h+s[++c],a=!0;c!==i&&o.push(n),r.push(l),c++}if(c===i&&r.push(s[i]),a){const t=r.join("$$lit$$");void 0===(s=ys.get(t))&&(r.raw=r,ys.set(t,s=r)),e=o}return t(s,...e)})(Y);var Os=function(t,s,e,i){for(var h,n=arguments.length,r=n<3?s:null===i?i=Object.getOwnPropertyDescriptor(s,e):i,o=t.length-1;o>=0;o--)(h=t[o])&&(r=(n<3?h(r):n>3?h(s,e,r):h(s,e))||r);return n>3&&r&&Object.defineProperty(s,e,r),r};let xs=class extends wt{constructor(){super(...arguments),this.resultField="",this.mappings=[],this.configLoaded=!1,this.processedMappings={}}updated(t){!this.configLoaded&&this.context?.responseReady&&(this.resultField||(this.resultField=this.context.response?.swc_results.field??""),0===this.mappings.length&&(this.mappings=this.context.response?.swc_results.mappings??[]),this.mappings.forEach((t=>{t.keys.forEach((s=>{this.processedMappings[s]={element:t.element,settings:t.settings}}))})),this.configLoaded=!0)}_mapResult(t){return this.processedMappings[`${t[this.resultField]}-${this.context?.resultDisplay}`]?this.processedMappings[`${t[this.resultField]}-${this.context?.resultDisplay}`]:this.processedMappings[`default-${this.context?.resultDisplay}`]?this.processedMappings[`default-${this.context?.resultDisplay}`]:this.processedMappings[t[this.resultField]]?this.processedMappings[t[this.resultField]]:this.processedMappings.default?this.processedMappings.default:void console.warn("No element mapping found for: ",t)}_getResults(){const t=this.context?.response?.search_results??[];return 0===t.length?null:Ss`
<div>
<ul class="${this.context?.resultDisplay}">
${At(t,(t=>t.id),(t=>{const s=this._mapResult(t);return s?customElements.get(s.element)?Ss`<li
class="result-${this.safeIdentifier(t[this.resultField]??"default")}"
>
<${(t=>({_$litStatic$:t,r:ms}))(s.element)}
.data=${t}
.settings=${s.settings}
/>
</li>`:(console.warn(s.element+" is not defined as a custom element for element mapping:",t),null):null}))}
</ul>
</div>
`}render(){return this.configLoaded?Ss`${this._getResults()} `:null}};Os([E()],xs.prototype,"resultField",void 0),Os([E({type:Object})],xs.prototype,"mappings",void 0),Os([C()],xs.prototype,"configLoaded",void 0),Os([C()],xs.prototype,"processedMappings",void 0),xs=Os([o("search-results")],xs);var _s=function(t,s,e,i){for(var h,n=arguments.length,r=n<3?s:null===i?i=Object.getOwnPropertyDescriptor(s,e):i,o=t.length-1;o>=0;o--)(h=t[o])&&(r=(n<3?h(r):n>3?h(s,e,r):h(s,e))||r);return n>3&&r&&Object.defineProperty(s,e,r),r};let ks=class extends(ts(wt)){constructor(){super(...arguments),this.required=!0,this.type="select",this.labelText="Per page",this.options=[],this.indexConfigLoaded=!1}updated(t){!this.indexConfigLoaded&&this.context?.responseReady&&(this.indexConfigLoaded=!0,0===this.options.length&&this.context.response?.swc_page_sizes&&(this.options=this.context.response?.swc_page_sizes))}_queryPerPage(t){const s=new URLSearchParams(this.context?.query?.toString()??""),e=""+this?.context?.defaultPerPage,i=""+this?.context?.response?.search_results_per_page;t?s.set("limit",t):s.set("limit",e),t!==i&&s.delete("page"),t===e&&s.delete("limit"),this.getResults(s)}_getSelected(){const t=""+this?.context?.defaultPerPage,s=""+this?.context?.response?.search_results_per_page;let e=this.options.find((s=>s.key===t));return this.context?.response?.search_results_per_page&&(e=this.options.find((t=>t.key===s))),e}_getSelectOption(){return Y` ${At(this.options,(t=>t.key),(t=>Y`<option
value=${t.key}
?selected=${this._getSelected()?.key===t.key}
>
${t.label}
</option>`))}`}_getListOption(){return Y` ${At(this.options,(t=>t.key),(t=>Y`<li>
<button
class="${this._getSelected()?.key===t.key?"selected":null}"
value=${t.key}
@click=${s=>{s.preventDefault(),this._queryPerPage(""+t.key)}}
>
${t.label}
</button>
</li>`))}`}_getSelect(){return Y`
${this.labelText?Y`<label for="per-page-${this.uid}">${this.labelText}</label>`:null}
<select
id="per-page-${this.uid}"
name="result count"
@change="${t=>{t.preventDefault();const s=t.currentTarget.value;this._queryPerPage(s)}}"
required
>
${this._getSelectOption()}
</select>
`}_getList(){return Y`
${this.labelText?Y`<label for="per-page-${this.uid}">${this.labelText}</label>`:null}
<ul id="sort-${this.uid}">
${this._getListOption()}
</ul>
`}_getHtml(){return Y`
${this._getHtmlLabelElement()} ${this._getHtmlSelectLabelElement()}
${this._getHtmlSelectElement()}
`}render(){if(0===this.options.length||!this.context?.response)return null;switch(this.type){case"select":return this._getSelect();case"list":return this._getList();case"html":return this._getHtml()}}getHtmlLabel(){return this.labelText}getOptionKey(t){return t.key?""+t.key:""+t.value}getOptionValue(t){return t.value?""+t.value:""+t.key}getOptionLabel(t){return""+t.label}getAllOptions(){return this.options}isOptionSelected(t){const s=this._getSelected();return!!s&&this.getOptionValue(s)===this.getOptionValue(t)}hasSelectedOptions(){return!!this._getSelected()}getHtmlSelectLabel(){return this._getSelected()?""+this._getSelected()?.label:this.htmlSelectLabel}optionMouseDown(t,s){t.preventDefault(),this._queryPerPage(""+this.getOptionValue(s)),this.close()}applySelection(t){this.focusedOption&&this.focusedOption.dataset.value&&this._queryPerPage(this.focusedOption.dataset.value)}getSelectedOptions(){const t=this._getSelected();return t?[t]:[]}filterOptions(t){return this.getAllOptions().filter((s=>(""+s.label).toLowerCase().startsWith(t)))}};_s([E()],ks.prototype,"type",void 0),_s([E()],ks.prototype,"labelText",void 0),_s([E({type:Array})],ks.prototype,"options",void 0),_s([C()],ks.prototype,"indexConfigLoaded",void 0),ks=_s([o("search-results-per-page")],ks);var Ls=function(t,s,e,i){for(var h,n=arguments.length,r=n<3?s:null===i?i=Object.getOwnPropertyDescriptor(s,e):i,o=t.length-1;o>=0;o--)(h=t[o])&&(r=(n<3?h(r):n>3?h(s,e,r):h(s,e))||r);return n>3&&r&&Object.defineProperty(s,e,r),r};let Rs=class extends wt{constructor(){super(...arguments),this.options=[],this.indexConfigLoaded=!1}updated(t){!this.indexConfigLoaded&&this.context?.responseReady&&(this.indexConfigLoaded=!0,0===this.options.length&&this.context.response?.swc_displays&&(this.options=this.context.response?.swc_displays))}_getOptionElement(t){return Ss`<li>
<button
class="${t.key} ${t.key===this.context?.resultDisplay?"selected":""}"
aria-pressed="${t.key===this.context?.resultDisplay}"
@click="${()=>{const s={...this.context};s.resultDisplay=""+t.key,this.updateContext(s)}}"
>
${t.label}
</button>
</li>`}_getAllOptions(){return Ss` <ul>
${At(this.options,(t=>t.key),(t=>Ss`${this._getOptionElement(t)}`))}
</ul>`}render(){return Ss`${this._getAllOptions()} `}};Ls([E({type:Object})],Rs.prototype,"options",void 0),Ls([C()],Rs.prototype,"indexConfigLoaded",void 0),Rs=Ls([o("search-results-switcher")],Rs);var js=function(t,s,e,i){for(var h,n=arguments.length,r=n<3?s:null===i?i=Object.getOwnPropertyDescriptor(s,e):i,o=t.length-1;o>=0;o--)(h=t[o])&&(r=(n<3?h(r):n>3?h(s,e,r):h(s,e))||r);return n>3&&r&&Object.defineProperty(s,e,r),r};let Ps=class extends wt{constructor(){super(...arguments),this.prevLabel="<",this.nextLabel=">",this.showNextPrev=!1,this.showFirstLast=!1,this.firstLabel="First page",this.lastLabel="Last page",this.pagesToDisplay=void 0,this.firstLastPagesToDisplay=0}_changePage(t){const s=new URLSearchParams(this.context?.query?.toString()??"");0!==t?s.set("page",""+t):s.delete("page"),this.getResults(s)}_getCurrentPageElement(){const t=this.context?.response?.search_results_page??0;return Ss`<button class="page current" aria-pressed="true">
${t+1}
</button>`}_getWrappingPagesElements(){const t=[],s=[],e=this.context?.response?.search_results_page??0,i=this.context?.response?.search_results_pages??0,h=(!this.firstLastPagesToDisplay||0!==e&&e!==i-1?this.pagesToDisplay:this.firstLastPagesToDisplay)??0;for(let n=1;n<=h;n++)e-n>=0&&t.unshift(Ss` <button
class="prev page"
@click=${()=>this._changePage(e-n)}
>
${e-n+1}
</button>`),e+n<i&&s.push(Ss` <button
class="next page"
@click=${()=>this._changePage(e+n)}
>
${e+n+1}
</button>`);return{prev:t,next:s}}_getWrappingButtonElements(){const t=this.context?.response?.search_results_page??0,s=this.context?.response?.search_results_pages??0,e=Ss` ${this.showNextPrev?Ss` <button
class="prev"
?disabled=${0===t}
@click=${()=>this._changePage(t-1)}
>
${this.prevLabel}
</button>`:null}`;return{next:Ss` ${this.showNextPrev?Ss` <button
class="next"
?disabled=${t===s-1}
@click=${()=>this._changePage(t+1)}
>
${this.nextLabel}
</button>`:null}`,prev:e,first:Ss` ${this.showFirstLast?Ss`<button
class="first"
@click=${()=>this._changePage(0)}
?disabled=${0===t}
>
${this.firstLabel}
</button>`:null}`,last:Ss` ${this.showFirstLast?Ss`<button
class="last"
@click=${()=>this._changePage(s-1)}
?disabled=${t===s-1}
>
${this.lastLabel}
</button>`:null}`}}render(){const t=this._getWrappingPagesElements(),s=this._getWrappingButtonElements();return Ss`
<div class="pager">
${s.first} ${s.prev}
${t.prev.length>0?t.prev:null}
${this._getCurrentPageElement()}
${t.next.length>0?t.next:null}
${s.next} ${s.last}
</div>
`}};js([E()],Ps.prototype,"prevLabel",void 0),js([E()],Ps.prototype,"nextLabel",void 0),js([E({type:Boolean})],Ps.prototype,"showNextPrev",void 0),js([E({type:Boolean})],Ps.prototype,"showFirstLast",void 0),js([E()],Ps.prototype,"firstLabel",void 0),js([E()],Ps.prototype,"lastLabel",void 0),js([E({type:Number})],Ps.prototype,"pagesToDisplay",void 0),js([E({type:Number})],Ps.prototype,"firstLastPagesToDisplay",void 0),Ps=js([o("search-simple-pager")],Ps);var Es=function(t,s,e,i){for(var h,n=arguments.length,r=n<3?s:null===i?i=Object.getOwnPropertyDescriptor(s,e):i,o=t.length-1;o>=0;o--)(h=t[o])&&(r=(n<3?h(r):n>3?h(s,e,r):h(s,e))||r);return n>3&&r&&Object.defineProperty(s,e,r),r};let Cs=class extends(ts(wt)){constructor(){super(...arguments),this.required=!0,this.type="select",this.labelText="Sort",this.sorts=[],this.indexConfigLoaded=!1}updated(t){!this.indexConfigLoaded&&this.context?.responseReady&&(this.indexConfigLoaded=!0,0===this.sorts.length&&this.context.response?.swc_sorts&&(this.sorts=this.context.response?.swc_sorts))}_querySort(t,s){const e=new URLSearchParams(this.context?.query?.toString()??"");t?(e.set("sort",t),e.set("order",s)):(e.delete("sort"),e.delete("order")),this.getResults(e)}_getSelected(){let t=this.context?.query?.get("sort")+"|"+this.context?.query?.get("order");"null|null"===t&&(t=this.context?.response?.default_sort+"|"+this.context?.response?.default_sort_order);let s={label:"Relevance",key:"search_api_relevance",order:"desc"};return this.sorts.find((s=>`${s.key}|${s.order}`===t))&&(s=this.sorts.find((s=>`${s.key}|${s.order}`===t))),s}_getSelectOptions(){const t=this._getSelected(),s=t?.key+"|"+t?.order;return Y`${At(this.sorts,(t=>t.key),(t=>{const e=t.key+"|"+t.order;return Y`<option value=${e} ?selected=${e===s}>
${t.label}
</option>`}))}`}_getListOptions(){const t=this._getSelected(),s=t?.key+"|"+t?.order;return Y`${At(this.sorts,(t=>t.key),(t=>{const e=t.key+"|"+t.order;return Y`<li>
<button
class="${e===s?"selected":null}"
value=${e}
@click=${s=>{s.preventDefault(),this._querySort(t.key,t.order)}}
>
${t.label}
</button>
</li>`}))}`}_getSelect(){return Y`
${this.labelText?Y`<label for="sort-${this.uid}">${this.labelText}</label>`:null}
<select
id="sort-${this.uid}"
name="sort"
@change="${t=>{t.preventDefault();const s=t.currentTarget,[e,i]=s.value.split("|");this._querySort(e,i)}}"
required
>
${this._getSelectOptions()}
</select>
`}_getList(){return Y`
${this.labelText?Y`<label for="sort-${this.uid}">${this.labelText}</label>`:null}
<ul id="sort-${this.uid}">
${this._getListOptions()}
</ul>
`}_getHtml(){return Y`
${this._getHtmlLabelElement()} ${this._getHtmlSelectLabelElement()}
${this._getHtmlSelectElement()}
`}render(){if(0===this.sorts.length||!this.context?.response)return null;switch(this.type){case"select":return this._getSelect();case"list":return this._getList();case"html":return this._getHtml()}}getHtmlLabel(){return this.labelText}getOptionKey(t){return`${t.key}-${t.order}`}getOptionValue(t){return`${t.key}|${t.order}`}getOptionLabel(t){return""+t.label}getAllOptions(){return this.sorts}isOptionSelected(t){const s=this._getSelected();return!!s&&this.getOptionValue(s)===this.getOptionValue(t)}hasSelectedOptions(){return!!this._getSelected()}getHtmlSelectLabel(){return this._getSelected()?""+this._getSelected()?.label:this.htmlSelectLabel}optionMouseDown(t,s){t.preventDefault(),this._querySort(s.key,s.order),this.close()}applySelection(t){if(this.focusedOption&&this.focusedOption.dataset.value){const[t,s]=this.focusedOption.dataset.value.split("|");this._querySort(t,s)}}getSelectedOptions(){const t=this._getSelected();return t?[t]:[]}filterOptions(t){return this.getAllOptions().filter((s=>(""+s.label).toLowerCase().startsWith(t)))}};Es([E()],Cs.prototype,"type",void 0),Es([E()],Cs.prototype,"labelText",void 0),Es([E({type:Array})],Cs.prototype,"sorts",void 0),Es([C()],Cs.prototype,"indexConfigLoaded",void 0),Cs=Es([o("search-sort")],Cs);var As=function(t,s,e,i){for(var h,n=arguments.length,r=n<3?s:null===i?i=Object.getOwnPropertyDescriptor(s,e):i,o=t.length-1;o>=0;o--)(h=t[o])&&(r=(n<3?h(r):n>3?h(s,e,r):h(s,e))||r);return n>3&&r&&Object.defineProperty(s,e,r),r};let Ts=class extends wt{constructor(){super(...arguments),this.aboveBreakpointText="Filters",this.dialogOpenText="Filters",this.dialogCloseText="Close",this.showAppliedCount=!1,this.showButton=!1}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",(()=>{this._handleResize()}))}disconnectedCallback(){window.removeEventListener("resize",(()=>{this._handleResize()})),super.disconnectedCallback()}updated(t){super.updated(t),this._handleResize()}_handleResize(){this.context?.dialogBreakpoint&&(-1===this.context?.dialogBreakpoint||window.screen.width<=this.context.dialogBreakpoint)?this.showButton=!0:this.showButton=!1}_getLabelText(){return this.showButton?Y`${this.context?.dialogOpen?this.dialogCloseText:this.dialogOpenText}`:Y`${this.aboveBreakpointText}`}render(){return void 0!==this.context&&this.context.responseReady?this.showButton?Y`
<button
class="search-dialog-toggle-button"
@click=${()=>{if(this.context){const t=this.context;t.dialogOpen=!this.context?.dialogOpen,this.updateContext(t)}}}
>
${this._getLabelText()}
</button>
`:Y`<div class="search-dialog-toggle-div">
${this._getLabelText()}
</div>`:void 0}};As([E()],Ts.prototype,"aboveBreakpointText",void 0),As([E()],Ts.prototype,"dialogOpenText",void 0),As([E()],Ts.prototype,"dialogCloseText",void 0),As([E()],Ts.prototype,"showAppliedCount",void 0),As([C()],Ts.prototype,"showButton",void 0),Ts=As([o("search-dialog-toggle")],Ts);var Us=function(t,s,e,i){for(var h,n=arguments.length,r=n<3?s:null===i?i=Object.getOwnPropertyDescriptor(s,e):i,o=t.length-1;o>=0;o--)(h=t[o])&&(r=(n<3?h(r):n>3?h(s,e,r):h(s,e))||r);return n>3&&r&&Object.defineProperty(s,e,r),r};let Ms=class extends wt{constructor(){super(...arguments),this.closeText="Close",this.closePosition="top",this.modal=!1,this.useDialog=!1}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",(()=>{this._handleResize()}))}disconnectedCallback(){window.removeEventListener("resize",(()=>{this._handleResize()})),super.disconnectedCallback()}_handleResize(){this.context?.dialogBreakpoint&&(-1===this.context?.dialogBreakpoint||window.screen.width<=this.context.dialogBreakpoint)?this.useDialog=!0:this.useDialog=!1}updated(t){super.updated(t),this._handleResize()}_toggleDialog(t,s){"open"===s&&(this.modal?t.showModal():t.show()),"close"===s&&t.close()}_closeDialog(){this.context&&(this.context.dialogOpen=!1,this.updateContext(this.context))}render(){if(!this.context?.responseReady)return null;this.context.dialogOpen?(this.classList.add("search-dialog-pane-visible"),this.classList.remove("search-dialog-pane-hidden")):(this.classList.add("search-dialog-pane-hidden"),this.classList.remove("search-dialog-pane-visible"));const t=this.querySelector(":scope > dialog");if(this.useDialog&&!t){const t=document.createElement("dialog");for(t.addEventListener("cancel",(()=>this._closeDialog())),t.addEventListener("close",(()=>this._closeDialog()));this.children.length>0;)this.firstChild&&t.appendChild(this.firstChild);const s=document.createElement("button");if(s.innerText=this.closeText,s.classList.add("close-button"),"top"===this.closePosition||"both"===this.closePosition){const e=s.cloneNode(!0);e.addEventListener("click",(()=>this._toggleDialog(t,"close"))),e.classList.add("top"),t.prepend(e)}if("bottom"===this.closePosition||"both"===this.closePosition){const e=s.cloneNode(!0);e.addEventListener("click",(()=>this._toggleDialog(t,"close"))),e.classList.add("bottom"),t.append(e)}this.appendChild(t),this.context.dialogOpen?this._toggleDialog(t,"open"):this._toggleDialog(t,"close")}else if(this.useDialog&&t)this.context.dialogOpen?this._toggleDialog(t,"open"):this._toggleDialog(t,"close");else if(!this.useDialog&&t){for(t.querySelectorAll(":scope > .close-button").forEach((s=>{t.removeChild(s)}));t.children.length>0;)t.firstChild&&this.insertBefore(t.firstChild,t);this.removeChild(t),this.context.dialogOpen=!1,this.updateContext(this.context)}return null}};Us([E()],Ms.prototype,"closeText",void 0),Us([E()],Ms.prototype,"closePosition",void 0),Us([E({type:Boolean})],Ms.prototype,"modal",void 0),Us([C()],Ms.prototype,"useDialog",void 0),Ms=Us([o("search-dialog-pane")],Ms);var Ds={BaseSearchElement:wt,SearchRoot:St,FacetButton:Dt,FacetCheckbox:Ht,FacetDropdown:qt,FacetDropdownHtml:es,SearchAppliedFacets:hs,SearchBox:rs,SearchInput:ls,SearchNoResultsMessage:as,SearchResultElementDefault:ds,SearchResultElementRendered:vs,SearchResultSummary:gs,SearchResults:xs,SearchResultsPerPage:ks,SearchResultsSwitcher:Rs,SearchSimplePager:Ps,SearchSort:Cs,SearchDialogPane:Ms,SearchDialogToggle:Ts};export{Ds as default};
