UNPKG

@legumeinfo/web-components

Version:

Web Components for the Legume Information System and other AgBio databases

303 lines (300 loc) 84.7 kB
/** * @license * Copyright 2019 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,i=Symbol(),s=new WeakMap;let n=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==i)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const i=this.t;if(e&&void 0===t){const e=void 0!==i&&1===i.length;e&&(t=s.get(i)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&s.set(i,t))}return t}toString(){return this.cssText}};const o=(t,...e)=>{const s=1===t.length?t[0]:e.reduce(((e,i,s)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+t[s+1]),t[0]);return new n(s,t,i)},r=e?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new n("string"==typeof t?t:t+"",void 0,i))(e)})(t):t /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */,{is:l,defineProperty:h,getOwnPropertyDescriptor:a,getOwnPropertyNames:u,getOwnPropertySymbols:c,getPrototypeOf:d}=Object,p=globalThis,v=p.trustedTypes,m=v?v.emptyScript:"",f=p.reactiveElementPolyfillSupport,g=(t,e)=>t,b={toAttribute(t,e){switch(e){case Boolean:t=t?m:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},k=(t,e)=>!l(t,e),y={attribute:!0,type:String,converter:b,reflect:!1,useDefault:!1,hasChanged:k};Symbol.metadata??=Symbol("metadata"),p.litPropertyMetadata??=new WeakMap;let $=class 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,e=y){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const i=Symbol(),s=this.getPropertyDescriptor(t,i,e);void 0!==s&&h(this.prototype,t,s)}}static getPropertyDescriptor(t,e,i){const{get:s,set:n}=a(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:s,set(e){const o=s?.call(this);n?.call(this,e),this.requestUpdate(t,o,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??y}static _$Ei(){if(this.hasOwnProperty(g("elementProperties")))return;const t=d(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(g("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(g("properties"))){const t=this.properties,e=[...u(t),...c(t)];for(const i of e)this.createProperty(i,t[i])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const i=this._$Eu(t,e);void 0!==i&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(r(t))}else void 0!==t&&e.push(r(t));return e}static _$Eu(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"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._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const i of e.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const i=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((i,s)=>{if(e)i.adoptedStyleSheets=s.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const e of s){const s=document.createElement("style"),n=t.litNonce;void 0!==n&&s.setAttribute("nonce",n),s.textContent=e.cssText,i.appendChild(s)}})(i,this.constructor.elementStyles),i}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((t=>t.hostConnected?.()))}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()))}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$ET(t,e){const i=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,i);if(void 0!==s&&!0===i.reflect){const n=(void 0!==i.converter?.toAttribute?i.converter:b).toAttribute(e,i.type);this._$Em=t,null==n?this.removeAttribute(s):this.setAttribute(s,n),this._$Em=null}}_$AK(t,e){const i=this.constructor,s=i._$Eh.get(t);if(void 0!==s&&this._$Em!==s){const t=i.getPropertyOptions(s),n="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:b;this._$Em=s,this[s]=n.fromAttribute(e,t.type)??this._$Ej?.get(s)??null,this._$Em=null}}requestUpdate(t,e,i){if(void 0!==t){const s=this.constructor,n=this[t];if(i??=s.getPropertyOptions(t),!((i.hasChanged??k)(n,e)||i.useDefault&&i.reflect&&n===this._$Ej?.get(t)&&!this.hasAttribute(s._$Eu(t,i))))return;this.C(t,e,i)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:i,reflect:s,wrapped:n},o){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,o??e??this[t]),!0!==n||void 0!==o)||(this._$AL.has(t)||(this.hasUpdated||i||(e=void 0),this._$AL.set(t,e)),!0===s&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}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,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,i]of t){const{wrapped:t}=i,s=this[e];!0!==t||this._$AL.has(e)||void 0===s||this.C(e,void 0,i,s)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(e)):this._$EM()}catch(e){throw t=!1,this._$EM(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach((t=>this._$ET(t,this[t]))),this._$EM()}updated(t){}firstUpdated(t){}};$.elementStyles=[],$.shadowRootOptions={mode:"open"},$[g("elementProperties")]=new Map,$[g("finalized")]=new Map,f?.({ReactiveElement:$}),(p.reactiveElementVersions??=[]).push("2.1.0"); /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const w=globalThis,S=w.trustedTypes,x=S?S.createPolicy("lit-html",{createHTML:t=>t}):void 0,_="$lit$",O=`lit$${Math.random().toFixed(9).slice(2)}$`,C="?"+O,A=`<${C}>`,E=document,j=()=>E.createComment(""),F=t=>null===t||"object"!=typeof t&&"function"!=typeof t,T=Array.isArray,R="[ \t\n\f\r]",I=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,D=/-->/g,P=/>/g,N=RegExp(`>|${R}(?:([^\\s"'>=/]+)(${R}*=${R}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),M=/'/g,G=/"/g,L=/^(?:script|style|textarea|title)$/i,U=(t=>(e,...i)=>({_$litType$:t,strings:e,values:i}))(1),z=Symbol.for("lit-noChange"),q=Symbol.for("lit-nothing"),B=new WeakMap,W=E.createTreeWalker(E,129);function H(t,e){if(!T(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==x?x.createHTML(e):e}const Q=(t,e)=>{const i=t.length-1,s=[];let n,o=2===e?"<svg>":3===e?"<math>":"",r=I;for(let e=0;e<i;e++){const i=t[e];let l,h,a=-1,u=0;for(;u<i.length&&(r.lastIndex=u,h=r.exec(i),null!==h);)u=r.lastIndex,r===I?"!--"===h[1]?r=D:void 0!==h[1]?r=P:void 0!==h[2]?(L.test(h[2])&&(n=RegExp("</"+h[2],"g")),r=N):void 0!==h[3]&&(r=N):r===N?">"===h[0]?(r=n??I,a=-1):void 0===h[1]?a=-2:(a=r.lastIndex-h[2].length,l=h[1],r=void 0===h[3]?N:'"'===h[3]?G:M):r===G||r===M?r=N:r===D||r===P?r=I:(r=N,n=void 0);const c=r===N&&t[e+1].startsWith("/>")?" ":"";o+=r===I?i+A:a>=0?(s.push(l),i.slice(0,a)+_+i.slice(a)+O+c):i+O+(-2===a?e:c)}return[H(t,o+(t[i]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),s]};class J{constructor({strings:t,_$litType$:e},i){let s;this.parts=[];let n=0,o=0;const r=t.length-1,l=this.parts,[h,a]=Q(t,e);if(this.el=J.createElement(h,i),W.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(s=W.nextNode())&&l.length<r;){if(1===s.nodeType){if(s.hasAttributes())for(const t of s.getAttributeNames())if(t.endsWith(_)){const e=a[o++],i=s.getAttribute(t).split(O),r=/([.?@])?(.*)/.exec(e);l.push({type:1,index:n,name:r[2],strings:i,ctor:"."===r[1]?Y:"?"===r[1]?tt:"@"===r[1]?et:K}),s.removeAttribute(t)}else t.startsWith(O)&&(l.push({type:6,index:n}),s.removeAttribute(t));if(L.test(s.tagName)){const t=s.textContent.split(O),e=t.length-1;if(e>0){s.textContent=S?S.emptyScript:"";for(let i=0;i<e;i++)s.append(t[i],j()),W.nextNode(),l.push({type:2,index:++n});s.append(t[e],j())}}}else if(8===s.nodeType)if(s.data===C)l.push({type:2,index:n});else{let t=-1;for(;-1!==(t=s.data.indexOf(O,t+1));)l.push({type:7,index:n}),t+=O.length-1}n++}}static createElement(t,e){const i=E.createElement("template");return i.innerHTML=t,i}}function V(t,e,i=t,s){if(e===z)return e;let n=void 0!==s?i._$Co?.[s]:i._$Cl;const o=F(e)?void 0:e._$litDirective$;return n?.constructor!==o&&(n?._$AO?.(!1),void 0===o?n=void 0:(n=new o(t),n._$AT(t,i,s)),void 0!==s?(i._$Co??=[])[s]=n:i._$Cl=n),void 0!==n&&(e=V(t,n._$AS(t,e.values),n,s)),e}class X{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:i}=this._$AD,s=(t?.creationScope??E).importNode(e,!0);W.currentNode=s;let n=W.nextNode(),o=0,r=0,l=i[0];for(;void 0!==l;){if(o===l.index){let e;2===l.type?e=new Z(n,n.nextSibling,this,t):1===l.type?e=new l.ctor(n,l.name,l.strings,this,t):6===l.type&&(e=new it(n,this,t)),this._$AV.push(e),l=i[++r]}o!==l?.index&&(n=W.nextNode(),o++)}return W.currentNode=E,s}p(t){let e=0;for(const i of this._$AV)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class Z{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,i,s){this.type=2,this._$AH=q,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=s,this._$Cv=s?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t?.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=V(this,t,e),F(t)?t===q||null==t||""===t?(this._$AH!==q&&this._$AR(),this._$AH=q):t!==this._$AH&&t!==z&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>T(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==q&&F(this._$AH)?this._$AA.nextSibling.data=t:this.T(E.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:i}=t,s="number"==typeof i?this._$AC(t):(void 0===i.el&&(i.el=J.createElement(H(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===s)this._$AH.p(e);else{const t=new X(s,this),i=t.u(this.options);t.p(e),this.T(i),this._$AH=t}}_$AC(t){let e=B.get(t.strings);return void 0===e&&B.set(t.strings,e=new J(t)),e}k(t){T(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,s=0;for(const n of t)s===e.length?e.push(i=new Z(this.O(j()),this.O(j()),this,this.options)):i=e[s],i._$AI(n),s++;s<e.length&&(this._$AR(i&&i._$AB.nextSibling,s),e.length=s)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class K{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,i,s,n){this.type=1,this._$AH=q,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=n,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=q}_$AI(t,e=this,i,s){const n=this.strings;let o=!1;if(void 0===n)t=V(this,t,e,0),o=!F(t)||t!==this._$AH&&t!==z,o&&(this._$AH=t);else{const s=t;let r,l;for(t=n[0],r=0;r<n.length-1;r++)l=V(this,s[i+r],e,r),l===z&&(l=this._$AH[r]),o||=!F(l)||l!==this._$AH[r],l===q?t=q:t!==q&&(t+=(l??"")+n[r+1]),this._$AH[r]=l}o&&!s&&this.j(t)}j(t){t===q?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class Y extends K{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===q?void 0:t}}class tt extends K{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==q)}}class et extends K{constructor(t,e,i,s,n){super(t,e,i,s,n),this.type=5}_$AI(t,e=this){if((t=V(this,t,e,0)??q)===z)return;const i=this._$AH,s=t===q&&i!==q||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,n=t!==q&&(i===q||s);s&&this.element.removeEventListener(this.name,this,i),n&&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 it{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){V(this,t)}}const st=w.litHtmlPolyfillSupport;st?.(J,Z),(w.litHtmlVersions??=[]).push("3.3.0");const nt=globalThis; /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */let ot=class extends ${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 e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,i)=>{const s=i?.renderBefore??e;let n=s._$litPart$;if(void 0===n){const t=i?.renderBefore??null;s._$litPart$=n=new Z(e.insertBefore(j(),t),t,void 0,i??{})}return n._$AI(t),n})(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return z}};ot._$litElement$=!0,ot.finalized=!0,nt.litElementHydrateSupport?.({LitElement:ot});const rt=nt.litElementPolyfillSupport;rt?.({LitElement:ot}),(nt.litElementVersions??=[]).push("4.2.0"); /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const lt=t=>(e,i)=>{void 0!==i?i.addInitializer((()=>{customElements.define(t,e)})):customElements.define(t,e)} /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */,ht={attribute:!0,type:String,converter:b,reflect:!1,hasChanged:k},at=(t=ht,e,i)=>{const{kind:s,metadata:n}=i;let o=globalThis.litPropertyMetadata.get(n);if(void 0===o&&globalThis.litPropertyMetadata.set(n,o=new Map),"setter"===s&&((t=Object.create(t)).wrapped=!0),o.set(i.name,t),"accessor"===s){const{name:s}=i;return{set(i){const n=e.get.call(this);e.set.call(this,i),this.requestUpdate(s,n,t)},init(e){return void 0!==e&&this.C(s,void 0,t,e),e}}}if("setter"===s){const{name:s}=i;return function(i){const n=this[s];e.call(this,i),this.requestUpdate(s,n,t)}}throw Error("Unsupported decorator location: "+s)};function ut(t){return(e,i)=>"object"==typeof i?at(t,e,i):((t,e,i)=>{const s=e.hasOwnProperty(i);return e.constructor.createProperty(i,t),s?Object.getOwnPropertyDescriptor(e,i):void 0})(t,e,i) /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */}function ct(t){return ut({...t,state:!0,attribute:!1})} /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */const dt=(t,e,i)=>(i.configurable=!0,i.enumerable=!0,i) /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */;function pt(t,e){return(e,i,s)=>dt(0,0,{get(){return(e=>e.renderRoot?.querySelector(t)??null)(this)}})} /** * @license * Copyright 2021 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ /** * @license * Copyright 2020 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const vt=t=>void 0===t.strings,mt={},ft=1,gt=2,bt=3,kt=4,yt=t=>(...e)=>({_$litDirective$:t,values:e}); /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */class $t{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}} /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */const wt=(t,e)=>{const i=t._$AN;if(void 0===i)return!1;for(const t of i)t._$AO?.(e,!1),wt(t,e);return!0},St=t=>{let e,i;do{if(void 0===(e=t._$AM))break;i=e._$AN,i.delete(t),t=e}while(0===i?.size)},xt=t=>{for(let e;e=t._$AM;t=e){let i=e._$AN;if(void 0===i)e._$AN=i=new Set;else if(i.has(t))break;i.add(t),Ct(e)}};function _t(t){void 0!==this._$AN?(St(this),this._$AM=t,xt(this)):this._$AM=t}function Ot(t,e=!1,i=0){const s=this._$AH,n=this._$AN;if(void 0!==n&&0!==n.size)if(e)if(Array.isArray(s))for(let t=i;t<s.length;t++)wt(s[t],!1),St(s[t]);else null!=s&&(wt(s,!1),St(s));else wt(this,t)}const Ct=t=>{t.type==gt&&(t._$AP??=Ot,t._$AQ??=_t)};class At extends $t{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,i){super._$AT(t,e,i),xt(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(wt(this,t),St(this))}setValue(t){if(vt(this._$Ct))this._$Ct._$AI(t,this);else{const e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}} /** * @license * Copyright 2020 Google LLC * SPDX-License-Identifier: BSD-3-Clause */const Et=()=>new jt;class jt{}const Ft=new WeakMap,Tt=yt(class extends At{render(t){return q}update(t,[e]){const i=e!==this.G;return i&&void 0!==this.G&&this.rt(void 0),(i||this.lt!==this.ct)&&(this.G=e,this.ht=t.options?.host,this.rt(this.ct=t.element)),q}rt(t){if(this.isConnected||(t=void 0),"function"==typeof this.G){const e=this.ht??globalThis;let i=Ft.get(e);void 0===i&&(i=new WeakMap,Ft.set(e,i)),void 0!==i.get(this.G)&&this.G.call(this.ht,void 0),i.set(this.G,t),void 0!==t&&this.G.call(this.ht,t)}else this.G.value=t}get lt(){return"function"==typeof this.G?Ft.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}}); /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */class Rt extends $t{constructor(t){if(super(t),this.it=q,t.type!==gt)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===q||null==t)return this._t=void 0,this.it=t;if(t===z)return t;if("string"!=typeof t)throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;const e=[t];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}}Rt.directiveName="unsafeHTML",Rt.resultType=1;const It=yt(Rt);class Dt{constructor(t){this._listeners=[],(this.host=t).addController(this),this._initialize()}hostConnected(){this._addEventListener()}hostDisconnected(){this.abortSignal.removeEventListener("abort",this._aborted.bind(this))}wrapPromise(t){const e=this._cancelState;return e.wrapCount+=1,Promise.race([t,e.promise])}addListener(t){this._listeners.push(t.bind(this.host))}cancel(){this._abortController.abort()}_addEventListener(){this.abortSignal.addEventListener("abort",this._aborted.bind(this),{once:!0})}_initialize(){this._abortController=new AbortController,this.abortSignal=this._abortController.signal,this._addEventListener();const t={abortSignal:this.abortSignal,wrapCount:0};t.promise=new Promise(((e,i)=>{t.abortSignal.addEventListener("abort",(t=>i(t)),{once:!0})})).catch((e=>{if(t.wrapCount>0)throw e})),this._cancelState=t}_aborted(t){this._initialize(),this.host.requestUpdate(),this.host.updateComplete.then((()=>{this._listeners.forEach((e=>{e(t)}))}))}}class Pt{constructor(t){this._listeners=[],(this.host=t).addController(this)}hostConnected(){document.addEventListener("DOMContentLoaded",this._contentLoaded.bind(this))}hostDisconnected(){document.removeEventListener("DOMContentLoaded",this._contentLoaded.bind(this))}addListener(t){this._listeners.push(t.bind(this.host))}_contentLoaded(t){this.host.requestUpdate(),this.host.updateComplete.then((()=>{this._listeners.forEach((e=>{e(t)}))}))}}class Nt{constructor(t){this._preUpdateListeners=[],this._listeners=[],(this.host=t).addController(this)}hostConnected(){window.addEventListener("popstate",this._popState.bind(this))}hostDisconnected(){window.removeEventListener("popstate",this._popState.bind(this))}getParameter(t,e=""){const i=new URLSearchParams(window.location.search).get(t);return null!==i?decodeURIComponent(i):e}setParameters(t){if(!this._differentValues(t))return;const e="?"+Object.entries(t).map((([t,e])=>`${t}=${encodeURIComponent(e)}`)).join("&");history.pushState(t,"",e)}addPreUpdateListener(t){this._preUpdateListeners.push(t.bind(this.host))}addListener(t){this._listeners.push(t.bind(this.host))}_differentValues(t){const e=new URLSearchParams(window.location.search);return Object.entries(t).some((([t,i])=>encodeURIComponent(i)!==e.get(t)))}_popState(t){this._preUpdateListeners.forEach((e=>{e(t)})),this.host.requestUpdate(),this.host.updateComplete.then((()=>{this._listeners.forEach((e=>{e(t)}))}))}}class Mt{constructor(t,...e){this._children=[],(this.host=t).addController(this),this._slotRefs=e}hostUpdate(){this._children=Array.from(this.host.children)}hostUpdated(){this._slotRefs.forEach((t=>{if(void 0===t.value)return;const e=t.value.getAttribute("name"),i=this._children.filter((t=>t.getAttribute("slot")===e)).map((t=>t instanceof HTMLTemplateElement?Array.from(t.children):t)).flat();if(i.length>0)try{t.value.replaceChildren(...i)}catch(t){}}))}}class Gt{constructor(t,e){(this.host=t).addController(this),this._resizeObserver=new ResizeObserver(e.bind(t))}hostDisconnected(){this._resizeObserver.disconnect()}observe(t){this._resizeObserver.observe(t)}unobserve(t){this._resizeObserver.unobserve(t)}}var Lt=function(t,e,i,s){for(var n,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s,l=t.length-1;l>=0;l--)(n=t[l])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);return o>3&&r&&Object.defineProperty(e,i,r),r};let Ut=class extends ot{createRenderRoot(){return this}constructor(){super(),this.defaultSlotRef=Et(),this.closeable=!1,this.content="",this.type="",this.slotController=new Mt(this,this.defaultSlotRef)}updateAlert(t,e){this.content=t,this.type=e}basic(t){this.updateAlert(t,"")}primary(t){this.updateAlert(t,"primary")}success(t){this.updateAlert(t,"success")}warning(t){this.updateAlert(t,"warning")}danger(t){this.updateAlert(t,"danger")}_renderClassModifier(){return""==this.type?"":`uk-alert-${this.type}`}_renderClose(){return this.closeable?U`<a class="uk-alert-close" uk-close></a>`:U``}render(){const t=this._renderClassModifier(),e=this._renderClose();return U` <div class="uk-alert ${t}" uk-alert> ${e} <p ${Tt(this.defaultSlotRef)}>${It(this.content)}</p> </div> `}};Ut.styles=o``,Lt([ut({type:Boolean})],Ut.prototype,"closeable",void 0),Lt([ut({type:String})],Ut.prototype,"content",void 0),Lt([ut({type:String})],Ut.prototype,"type",void 0),Ut=Lt([lt("lis-alert-element")],Ut);var zt=function(t,e,i,s){for(var n,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s,l=t.length-1;l>=0;l--)(n=t[l])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);return o>3&&r&&Object.defineProperty(e,i,r),r};let qt=class extends ot{createRenderRoot(){return this}_getexampleElement(){return this.text?U`<span class="uk-text-small" >e.g. ${It(this.text)}</span >`:U``}render(){const t=this._getexampleElement();return U`${t}`}};qt.styles=o``,zt([ut({type:String})],qt.prototype,"text",void 0),qt=zt([lt("lis-form-input-example-element")],qt);var Bt=function(t,e,i,s){for(var n,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s,l=t.length-1;l>=0;l--)(n=t[l])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);return o>3&&r&&Object.defineProperty(e,i,r),r};let Wt=class extends ot{submit(t=""){if(!this._forms.length)throw new Error("No form to submit");const e=this._forms[0],i=['[type="submit"]'];t&&i.push(`[value="${t}"]`);const s=e.querySelector(i.join(""));null!==s?e.requestSubmit(s):e.requestSubmit()}_submit(t){t.preventDefault(),t.stopPropagation();const e={detail:{formData:new FormData(t.target),formEvent:t},bubbles:!0,composed:!0};this.dispatchEvent(new CustomEvent("submit",e))}render(){return U`<slot @submit="${this._submit}"></slot>`}};Wt.styles=o``,Bt([function(t){return(e,i)=>{const{slot:s,selector:n}=t??{},o="slot"+(s?`[name=${s}]`:":not([name])");return dt(0,0,{get(){const e=this.renderRoot?.querySelector(o),i=e?.assignedElements(t)??[];return void 0===n?i:i.filter((t=>t.matches(n)))}})}}({selector:"form"})],Wt.prototype,"_forms",void 0),Wt=Bt([lt("lis-form-wrapper-element")],Wt);var Ht=function(t,e,i,s){for(var n,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s,l=t.length-1;l>=0;l--)(n=t[l])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);return o>3&&r&&Object.defineProperty(e,i,r),r};let Qt=class extends ot{constructor(){super(...arguments),this.dataType="data",this.state="loaded",this.content="loaded"}createRenderRoot(){return this}loading(){this.content="",this.state="loading"}success(){this.content="",this.state="loaded"}noResults(){this.content=`No ${this.dataType} found`,this.state="info"}failure(){this.content=`Failed to load ${this.dataType}`,this.state="error"}error(t){this.content=t,this.state="info"}render(){if("loaded"==this.state)return U``;if("error"==this.state||"info"==this.state){const t="error"==this.state?"warning":"info";return U`<span uk-icon="${t}" uk-tooltip="${this.content}"></span>`}return U`<span uk-spinner></span>`}};Qt.styles=o``,Ht([ut({type:String})],Qt.prototype,"dataType",void 0),Ht([ct()],Qt.prototype,"state",void 0),Ht([ct()],Qt.prototype,"content",void 0),Qt=Ht([lt("lis-inline-loading-element")],Qt);var Jt=function(t,e,i,s){for(var n,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s,l=t.length-1;l>=0;l--)(n=t[l])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);return o>3&&r&&Object.defineProperty(e,i,r),r};let Vt=class extends ot{constructor(){super(...arguments),this.page=1,this.hasNext=!1,this.scrollTarget=null}createRenderRoot(){return this}previous(t){void 0!==t&&t.preventDefault(),this.page>1&&(this.page-=1,this._dispatchPageChange(),this._scrollToTarget())}next(t){void 0!==t&&t.preventDefault(),this._hasNext()&&(this.page+=1,this._dispatchPageChange(),this._scrollToTarget())}_hasNext(){return void 0!==this.numPages?this.page<this.numPages:this.hasNext}_scrollToTarget(){null!=this.scrollTarget&&this.scrollTarget.scrollIntoView({behavior:"smooth"})}_dispatchPageChange(){const t={detail:{page:this.page},bubbles:!0,composed:!0},e=new CustomEvent("pageChange",t);this.dispatchEvent(e)}_renderPreviousClass(){return this.page>1?"uk-active":"uk-disabled"}_pageInfo(){return this.numPages?U`Page ${this.page.toLocaleString()} of ${this.numPages.toLocaleString()}`:U`Page ${this.page.toLocaleString()}`}_renderNextClass(){return this._hasNext()?"uk-active":"uk-disabled"}render(){const t=this._renderPreviousClass(),e=this._pageInfo(),i=this._renderNextClass();return U` <ul class="uk-pagination"> <li class="${t}"> <a href="" @click=${this.previous} ><span class="uk-margin-small-right" uk-pagination-previous></span> Previous</a > </li> <li class="uk-active"><span>${e}</span></li> <li class="uk-margin-auto-left ${i}"> <a href="" @click=${this.next} >Next <span class="uk-margin-small-left" uk-pagination-next></span ></a> </li> </ul> `}};function Xt(t,e){return(i,s,n)=>{const o=n.value;return n.value=function(...i){const s=window[t];void 0!==window[e]&&(window[t]=window[e]);try{const e=o.apply(this,i);return window[t]=s,e}catch(e){throw window[t]=s,e}},n}}function Zt(t,e){return Object.prototype.hasOwnProperty.call(t,e)}Vt.styles=o``,Jt([ut({type:Number,reflect:!0})],Vt.prototype,"page",void 0),Jt([ut()],Vt.prototype,"numPages",void 0),Jt([ut({type:Boolean})],Vt.prototype,"hasNext",void 0),Jt([ut({type:HTMLElement,attribute:!1})],Vt.prototype,"scrollTarget",void 0),Vt=Jt([lt("lis-pagination-element")],Vt);var Kt=function(t,e,i,s){for(var n,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s,l=t.length-1;l>=0;l--)(n=t[l])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);return o>3&&r&&Object.defineProperty(e,i,r),r};let Yt=class extends ot{createRenderRoot(){return this}constructor(){super(),this.defaultSlotRef=Et(),this.caption="",this.dataAttributes=[],this.header={},this.columnClasses={},this.data=[],this.slotController=new Mt(this,this.defaultSlotRef)}_objectToRow(t,e="td",i={}){const s=`</${e}>`,n=this.dataAttributes.map((n=>{const o=Zt(i,n)?i[n]:"",r=Zt(t,n)?t[n]:"",l=(t=>t?`<${e} class="${t}">`:`<${e}>`)(o)+r+s;return l}));return U`<tr> ${It(n.join(""))} </tr>`}_getCaption(){return this.caption?U`<caption> ${this.caption} </caption>`:U``}_getHeader(){if(!this.header)return U``;const t=this._objectToRow(this.header,"th");return U`<thead> ${t} </thead>`}_getBody(){if(!this.data)return U``;const t=this.data.map((t=>this._objectToRow(t)));return U`<tbody> ${t} </tbody>`}render(){const t=this._getCaption(),e=this._getHeader(),i=this._getBody();return U` <table class="uk-table uk-table-divider uk-table-small" ${Tt(this.defaultSlotRef)} > ${t} ${e} ${i} </table> `}};Yt.styles=o``,Kt([ut({type:String})],Yt.prototype,"caption",void 0),Kt([ut({type:Array})],Yt.prototype,"dataAttributes",void 0),Kt([ut({type:Object})],Yt.prototype,"header",void 0),Kt([ut({type:Object})],Yt.prototype,"columnClasses",void 0),Kt([ut({type:Array,attribute:!1})],Yt.prototype,"data",void 0),Yt=Kt([lt("lis-simple-table-element")],Yt);var te=function(t,e,i,s){for(var n,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s,l=t.length-1;l>=0;l--)(n=t[l])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);return o>3&&r&&Object.defineProperty(e,i,r),r};let ee=class extends ot{constructor(){super(...arguments),this.dataType="data",this.state="loaded",this._alertRef=Et()}createRenderRoot(){return this}loading(){this.state="loading"}success(){this.state="loaded"}noResults(){var t;const e=`No ${this.dataType} found`;null===(t=this._alertRef.value)||void 0===t||t.warning(e),this.state="message"}failure(){var t;const e=`Failed to load ${this.dataType}`;null===(t=this._alertRef.value)||void 0===t||t.danger(e),this.state="message"}error(t){var e;null===(e=this._alertRef.value)||void 0===e||e.warning(t),this.state="message"}render(){return U` <div class="uk-overlay-default uk-position-cover uk-flex uk-flex-center uk-flex-middle" ?hidden=${"loading"!=this.state} > <span uk-spinner></span> </div> <lis-alert-element ${Tt(this._alertRef)} ?hidden=${"message"!=this.state} ></lis-alert-element> `}};ee.styles=o``,te([ut({type:String})],ee.prototype,"dataType",void 0),te([ct()],ee.prototype,"state",void 0),ee=te([lt("lis-loading-element")],ee);var ie=function(t,e,i,s){for(var n,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s,l=t.length-1;l>=0;l--)(n=t[l])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);return o>3&&r&&Object.defineProperty(e,i,r),r};let se=class extends ot{createRenderRoot(){return this}constructor(){super(),this.defaultSlotRef=Et(),this.modalId="lis-modal",this.heading="",this.slotController=new Mt(this,this.defaultSlotRef)}_getHeading(){return this.heading?U`<div class="uk-modal-header">${It(this.heading)}</div>`:U``}render(){const t=this._getHeading();return U` <div id="${this.modalId}" uk-modal> <div class="uk-modal-dialog"> <button class="uk-modal-close-default" type="button" uk-close ></button> ${t} <div class="uk-modal-body" uk-overflow-auto> <slot ${Tt(this.defaultSlotRef)}></slot> <div></div> </div> </div> </div> `}};se.styles=o``,ie([ut({type:String})],se.prototype,"modalId",void 0),ie([ut({type:String})],se.prototype,"heading",void 0),se=ie([lt("lis-modal-element")],se); /** * @license * Copyright 2020 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const ne=yt(class extends $t{constructor(t){if(super(t),t.type!==bt&&t.type!==ft&&t.type!==kt)throw Error("The `live` directive is not allowed on child or event bindings");if(!vt(t))throw Error("`live` bindings can only contain a single expression")}render(t){return t}update(t,[e]){if(e===z||e===q)return e;const i=t.element,s=t.name;if(t.type===bt){if(e===i[s])return z}else if(t.type===kt){if(!!e===i.hasAttribute(s))return z}else if(t.type===ft&&i.getAttribute(s)===e+"")return z;return((t,e=mt)=>{t._$AH=e})(t),e}});var oe=function(t,e,i,s){for(var n,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s,l=t.length-1;l>=0;l--)(n=t[l])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);return o>3&&r&&Object.defineProperty(e,i,r),r};const re=t=>()=>{class e extends t{constructor(...t){super(...t),this.queryStringController=new Nt(this),this.domContentLoadedController=new Pt(this),this.cancelPromiseController=new Dt(this),this.searchFunction=()=>Promise.reject(new Error("No search function provided")),this.resultAttributes=[],this.tableHeader={},this.tableColumnClasses={},this.requiredQueryStringParams=[],this.queryStringReflection=!0,this.searchResults=[],this.resultsInfo="",this._searchData=void 0,this._formRef=Et(),this._loadingRef=Et(),this._downloadingRef=Et(),this._queryStringSubmitted=!1}connectedCallback(){super.connectedCallback(),this.queryStringReflection&&(this.domContentLoadedController.addListener(this._queryStringSubmit),this.queryStringController.addListener(this._queryStringSubmit))}createRenderRoot(){return this}valueOrQuerystringParameter(t,e){return void 0===t?this.queryStringController.getParameter(e):t}submit(){var t;if(void 0===this._formRef.value)throw new Error("No form wrapper in the template");null===(t=this._formRef.value)||void 0===t||t.submit()}_queryStringSubmit(){this.requiredQueryStringParams.some((t=>t.length&&t.every((t=>Boolean(this.queryStringController.getParameter(t))))))&&this.requiredQueryStringParams.length?(this._paginator.page=Number(this.queryStringController.getParameter("page","1")),this._queryStringSubmitted=!0,this.submit()):this._resetComponent()}_changePage(t){if(t.preventDefault(),t.stopPropagation(),void 0!==this._searchData){const t=this._paginator.page;this._searchData={...this._searchData,page:t}}this._search(this._searchData)}_search(t){var e;if(void 0===t)return;null===(e=this._loadingRef.value)||void 0===e||e.loading(),!this._queryStringSubmitted&&this.queryStringReflection?this.queryStringController.setParameters(t):this._queryStringSubmitted=!1,this.cancelPromiseController.cancel();const i={abortSignal:this.cancelPromiseController.abortSignal},s=this.searchFunction(t,i);this.cancelPromiseController.wrapPromise(s).then((t=>this._searchSuccess(t)),(t=>{var e;if(!(t instanceof Event&&"abort"===t.type))throw null===(e=this._loadingRef.value)||void 0===e||e.failure(),t}))}_searchSuccess(t){var e,i,s;const{hasNext:n,numPages:o,results:r,errors:l}={hasNext:Boolean(t.results.length),...t};if(l&&l.length){const t=l.join("<br/>");null===(e=this._loadingRef.value)||void 0===e||e.error(t)}else r.length?null===(i=this._loadingRef.value)||void 0===i||i.success():null===(s=this._loadingRef.value)||void 0===s||s.noResults();this.resultsInfo=this._getResultsInfo(t),this.searchResults=r,this._paginator.hasNext=n,this._paginator.numPages=o}_download(t){var e;if(void 0!==this.downloadFunction){null===(e=this._downloadingRef.value)||void 0===e||e.loading(),this.cancelPromiseController.cancel();const i={abortSignal:this.cancelPromiseController.abortSignal},s=this.downloadFunction(t,i);this.cancelPromiseController.wrapPromise(s).then((t=>this._downloadSuccess(t)),(t=>{var e;if(!(t instanceof Event&&"abort"===t.type))throw null===(e=this._downloadingRef.value)||void 0===e||e.failure(),t}))}}_downloadSuccess(t){var e,i;const{errors:s}=t;if(s&&s.length){const t=s.join("<br/>");null===(e=this._downloadingRef.value)||void 0===e||e.error(t)}else null===(i=this._downloadingRef.value)||void 0===i||i.success()}formToObject(t){return Object.fromEntries(t)}_resetComponent(){var t;this._searchData=void 0,null===(t=this._loadingRef.value)||void 0===t||t.success(),this.resultsInfo="",this.searchResults=[],this._paginator.page=1,this._paginator.numPages=void 0,this._paginator.hasNext=!1}_formSubmitted(t){t.preventDefault(),t.stopPropagation();const e=t.detail.formEvent.submitter,i=this.formToObject(t.detail.formData);if("download"===e.value&&void 0!==this.downloadFunction)this._download(i);else{this._queryStringSubmitted&&this.queryStringReflection||(this._paginator.page=1);const t=this._paginator.page;this._searchData={...i,page:t},this._search(this._searchData)}}_getResultsInfo(t){const{pageSize:e,numResults:i,results:s}=t,n=s.length,o=this._paginator.page,r=[];if(n>0&&null!=e){const t=(o-1)*e+1,i=t+n-1,s=`${t.toLocaleString()}-${i.toLocaleString()}`;r.push(s)}if(void 0!==i){r.length>0&&r.push("of");const t=1==i?"":"s",e=`${i.toLocaleString()} result${t}`;r.push(e)}return r.join(" ")}renderForm(){throw new Error("Method not implemented")}renderResultsInfo(){return this.resultsInfo?U`<p>${this.resultsInfo}</p>`:U``}renderResults(){return U` <lis-simple-table-element .dataAttributes=${this.resultAttributes} .header=${this.tableHeader} .columnClasses=${this.tableColumnClasses} .data=${this.searchResults} > </lis-simple-table-element> `}render(){const t=this.renderForm(),e=this.renderResultsInfo(),i=this.renderResults();return U` <lis-form-wrapper-element ${Tt(this._formRef)} @submit="${this._formSubmitted}" > ${t} </lis-form-wrapper-element> ${e} <div class="uk-inline uk-width-1-1 uk-overflow-auto uk-text-small"> <lis-loading-element ${Tt(this._loadingRef)}></lis-loading-element> ${i} </div> <lis-pagination-element .scrollTarget=${this._formRef.value} @pageChange=${this._changePage} > </lis-pagination-element> `}}return oe([ut({type:Function,attribute:!1})],e.prototype,"searchFunction",void 0),oe([ut({type:Function,attribute:!1})],e.prototype,"downloadFunction",void 0),oe([ut()],e.prototype,"resultAttributes",void 0),oe([ut()],e.prototype,"tableHeader",void 0),oe([ut()],e.prototype,"tableColumnClasses",void 0),oe([ct()],e.prototype,"requiredQueryStringParams",void 0),oe([ct()],e.prototype,"queryStringReflection",void 0),oe([ct()],e.prototype,"searchResults",void 0),oe([ct()],e.prototype,"resultsInfo",void 0),oe([ct()],e.prototype,"_searchData",void 0),oe([pt("lis-pagination-element")],e.prototype,"_paginator",void 0),e};var le=function(t,e,i,s){for(var n,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s,l=t.length-1;l>=0;l--)(n=t[l])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);return o>3&&r&&Object.defineProperty(e,i,r),r};let he=class extends(re(ot)()){constructor(){super(),this.formData={genuses:[]},this.formDataFunction=()=>Promise.reject(new Error("No form data function provided")),this.selectedGenus=0,this.selectedSpecies=0,this.selectedStrain=0,this.formDataCancelPromiseController=new Dt(this),this._formLoadingRef=Et(),this.requiredQueryStringParams=[["genus"],["genus","species"],["genus","species","strain"],["identifier"],["description"],["family"]],this.resultAttributes=["name","identifier","locations","description","geneFamilyAssignments","panGeneSets","genus","species","strain"],this.tableHeader={name:"Name",identifier:"Identifier",description:"Description",genus:"Genus",species:"Species",strain:"Strain",geneFamilyAssignments:"Gene Family Assignments",panGeneSets:"PanGene Sets",locations:"Locations"},this.tableColumnClasses={description:"uk-table-expand"}}_getDefaultGenus(){return this.valueOrQuerystringParameter(this.genus,"genus")}_getDefaultSpecies(){return this.valueOrQuerystringParameter(this.species,"species")}connectedCallback(){super.connectedCallback();const t={genuses:[]},e=this._getDefaultGenus();if(e){t.genuses.push({genus:e,species:[]});const i=this._getDefaultSpecies();if(i){t.genuses[0].species.push({species:i,strains:[]});const e=this.queryStringController.getParameter("strain");e&&t.genuses[0].species[0].strains.push({strain:e})}}this.formData=t,this.queryStringController.addPreUpdateListener((t=>{this._initializeSelections()}))}updated(t){t.has("formDataFunction")&&this._getFormData(),(t.has("formData")||t.has("genus")||t.has("species"))&&this._initializeSelections()}_getFormData(){var t;null===(t=this._formLoadingRef.value)||void 0===t||t.loading(),this.formDataCancelPromiseController.cancel();const e={abortSignal:this.formDataCancelPromiseController.abortSignal},i=this.formDataFunction(e);this.formDataCancelPromiseController.wrapPromise(i).then((t=>{var e;null===(e=this._formLoadingRef.value)||void 0===e||e.success(),this.formData=t}),(t=>{var e;if(!(t instanceof Event&&"abort"===t.type))throw null===(e=this._formLoadingRef.value)||void 0===e||e.failure(),t}))}async _initializeSelections(){const t=this._getDefaultGenus();this.selectedGenus=t?this.formData.genuses.map((({genus:t})=>t)).indexOf(t)+1:0,await this.updateComplete;const e=this._getDefaultSpecies();this.selectedGenus&&e?this.selectedSpecies=this.formData.genuses[this.selectedGenus-1].species.map((({species:t})=>t)).indexOf(e)+1:this.selectedSpecies=0,await this.updateComplete;const i=this.queryStringController.getParameter("strain");this.selectedSpecies&&i?this.selectedStrain=this.formData.genuses[this.selectedGenus-1].species[this.selectedSpecies-1].strains.map((({strain:t})=>t)).indexOf(i)+1:this.selectedStrain=0}_selectGenus(t){null!=t.target&&(this.selectedGenus=t.target.selectedIndex,this.selectedSpecies=0,this.selectedStrain=0)}_renderGenusSelector(){const t=this.formData.genuses.map((({genus:t})=>U`<option value="${t}">${t}</option>`));if(void 0!==this.genus){const e=this.selectedGenus?this.formData.genuses[this.selectedGenus-1].genus:"";return U` <select class="uk-select uk-form-small" disabled .selectedIndex=${ne(this.selectedGenus)} @change="${this._selectGenus}" > <option value="">-- any --</option> ${t} </select> <input type="hidden" name="genus" value="${e}" /> `}return U` <select class="uk-select uk-form-small" name="genus" .selectedIndex=${ne(this.selectedGenus)} @change="${this._selectGenus}" > <option value="">-- any --</option> ${t} </select> `}_selectSpecies(t){null!=t.target&&(this.selectedSpecies=t.target.selectedIndex,this.selectedStrain=0)}_renderSpeciesSelector(){let t=[U``];if(this.selectedGenus&&(t=this.formData.genuses[this.selectedGenus-1].species.map((({species:t})=>U`<option value="${t}">${t}</option>`))),void 0!==this.genus&&void 0!==this.species){const e=this.selectedGenus&&this.selectedSpecies?this.formData.genuses[this.selectedGenus-1].species[this.selectedSpecies-1].species:"";return U` <select class="uk-select uk-form-small" disabled .selectedIndex=${ne(this.selectedSpecies)} @change="${this._selectSpecies}" > <option value="">-- any --</option> ${t} </select> <input type="hidden" name="species" value="${e}" /> `}return U` <select class="uk-select uk-form-small" name="species" .selectedIndex=${ne(this.selectedSpecies)} @change="${this._selectSpecies}" > <option value="">-- any --</option> ${t} </select> `}_selectStrain(t){null!=t.target&&(this.selectedStrain=t.target.selectedIndex)}_renderStrainSelector(){let t=[U``];return this.selectedGenus&&this.selectedSpecies&&(t=this.formData.genuses[this.selectedGenus-1].species[this.selectedSpecies-1].strains.map((({strain:t})=>U`<option value="${t}">${t}</option>`))),U` <select class="uk-select uk-form-small" name="strain" .selectedIndex=${ne(this.selectedStrain)} @change="${this._selectStrain}" > <option value="">-- any --</option> ${t} </select> `}renderForm(){const t=this._renderGenusSelector(),e=this._renderSpeciesSelector(),i=this._renderStrainSelector();return U` <form class="uk-form-stacked"> <fieldset class="uk-fieldset"> <legend class="uk-legend">Gene Search</legend> <lis-loading-element ${Tt(this._formLoadingRef)} ></lis-loading-element> <div class="uk-margin uk-grid-small" uk-grid> <div class="uk-width-1-3@s"> <label class="uk-form-label" for="genus">Genus</label> ${t} </div> <div class="uk-width-1-3@s"> <label class="uk-form-label" for="species">Species</label> ${e} </div> <div class="uk-width-1-3@s"> <label class="uk-form-label" for="strain">Strain</label> ${i} </div> </div> <div class="uk-margin uk-grid-small" uk-grid> <div class="uk-width-1-3@s"> <label class="uk-form-label" for="identifier">Identifier</label> <input class="uk-input" type="text" name="identifier" .value=${this.queryStringController.getParameter("identifier")} /> <lis-form-input-example-element .text=${this.identifierExample} ></lis-form-input-example-element> </div> <div class="uk-width-1-3@s"> <label class="uk-form-label" for="description">Description</label> <input class="uk-input" type="text" name="description" .value=${this.queryStringController.getParameter("description")} /> <lis-form-input-example-element .text=${this.descriptionExample} ></lis-form-input-example-element> </div> <div class="uk-width-1-3@s"> <label class="uk-form-label" for="family">Gene Family ID</label> <input class="uk-input" type="text" name="family" .value=${this.queryStringController.getParameter("family")} /> <lis-form-input-example-element .text=${this.familyExample} ></lis-form-input-example-element> </div> </div> <div class="uk-margin"> <button type="submit" class="uk-button uk-button-primary"> Search </button> </div> </fieldset> </form> `}};he.styles=o``,le([ut()],he.prototype,"formData",void 0),le([ut({type:Function,attribute:!1})],he.prototype,"formDataFunction",void 0),le([ut({type:String})],he.prototype,"genus",void 0),le([ut({type:String})],he.prototype,"species",void 0),le([ut({type:String})],he.prototype,"identifierExample",void 0),le([ut({type:String})],he.prototype,"descriptionExample",void 0),le([ut({type:String})],he.prototype,"familyExample",void 0),le([ct()],he.prototype,"selectedGenus",void 0),le([ct()],he.prototype,"selectedSpecies",void 0),le([ct()],he.prototype,"selectedStrain",void 0),he=le([lt("lis-gene-search-element")],he);var ae=function(t,e,i,s){for(var n,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s,l=t.length-1;l>=0;l--)(n=t[l])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);return o>3&&r&&Object.defineProperty(e,i,r),r};let ue=class extends(re(ot)()){constructor(){super(),this.requiredQueryStringParams=[["query"]],this.resultAttributes=["name","identifier","description"],this.tableHeader={name:"Name",identifier:"Identifier",description:"Description"}}renderForm(){return U` <form> <fieldset class="uk-fieldset"> <legend class="uk-legend">Trait name search</legend> <div class="uk-margin"> <input name="query" class="uk-input" type="tex