UNPKG

iobroker.lovelace

Version:

With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI

7 lines 20.4 kB
export const __rspack_esm_id=26092;export const __rspack_esm_ids=[26092];export const __webpack_modules__={32023(e,t,i){var s=i(62826),o=i(42034),r=i(20832),l=i(63374),a=i(75640),n=i(91735),c=i(43826),h=i(5124),d=i(22441);class m extends r.${renderLeadingIcon(){return this.noLeadingIcon?h.qy``:super.renderLeadingIcon()}constructor(...e){super(...e),this.noLeadingIcon=!1}}m.styles=[n.R,o.R,c.R,a.R,l.R,h.AH`:host{--md-sys-color-primary:var(--primary-text-color);--md-sys-color-on-surface:var(--primary-text-color);--md-sys-color-on-surface-variant:var(--primary-text-color);--md-sys-color-on-secondary-container:var(--primary-text-color);--md-filter-chip-container-shape:var(--ha-border-radius-md);--md-filter-chip-outline-color:var(--outline-color);--md-filter-chip-selected-container-color:rgba( var(--rgb-primary-text-color), 0.15 );--_label-text-font:var(--ha-font-family-body)}`],(0,s.Cg)([(0,d.MZ)({type:Boolean,reflect:!0,attribute:"no-leading-icon"})],m.prototype,"noLeadingIcon",void 0),m=(0,s.Cg)([(0,d.EM)("ha-filter-chip")],m)},75064(e,t,i){var s=i(62826),o=i(5124),r=i(22441),l=i(2846);class a extends l.G{constructor(...e){super(...e),this.borderTop=!1}}a.styles=[...l.J,o.AH`:host{--md-list-item-one-line-container-height:48px;--md-list-item-two-line-container-height:64px}:host([border-top]) md-item{border-top:1px solid var(--divider-color)}[slot=start]{--state-icon-color:var(--secondary-text-color)}[slot=overline]{line-height:1.15rem;font-size:calc(var(--mdc-typography-subtitle1-font-size, 1rem) * .75);font-weight:var(--mdc-typography-subtitle1-font-weight,400);font-family:var( --mdc-typography-subtitle1-font-family, var(--mdc-typography-font-family) );color:var(--mdc-select-label-ink-color,rgba(0,0,0,.6))}[slot=headline]{line-height:var(--ha-line-height-normal);font-size:var(--ha-font-size-m);white-space:nowrap}[slot=supporting-text]{line-height:var(--ha-line-height-normal);font-size:var(--ha-font-size-s);white-space:nowrap}::slotted(img),::slotted(state-badge){width:32px;height:32px}::slotted(.code){font-family:var(--ha-font-family-code);font-size:var(--ha-font-size-xs)}::slotted(.domain){font-size:var(--ha-font-size-s);font-weight:var(--ha-font-weight-normal);line-height:var(--ha-line-height-normal);align-self:flex-end;max-width:30%;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}`],(0,s.Cg)([(0,r.MZ)({type:Boolean,reflect:!0,attribute:"border-top"})],a.prototype,"borderTop",void 0),a=(0,s.Cg)([(0,r.EM)("ha-combo-box-item")],a)},2846(e,t,i){i.d(t,{G:()=>c,J:()=>n});var s=i(62826),o=i(58168),r=i(82553),l=i(5124),a=i(22441);i(54276);const n=[r.R,l.AH`:host{--ha-icon-display:block;--md-sys-color-primary:var(--primary-text-color);--md-sys-color-secondary:var(--secondary-text-color);--md-sys-color-surface:var(--card-background-color);--md-sys-color-on-surface:var(--primary-text-color);--md-sys-color-on-surface-variant:var(--secondary-text-color)}md-item{overflow:var(--md-item-overflow,hidden);align-items:var(--md-item-align-items,center);gap:var(--ha-md-list-item-gap,16px)}`];class c extends o.n{renderRipple(){return"text"===this.type?l.s6:l.qy`<ha-ripple part="ripple" for="item" ?disabled="${this.disabled&&"link"!==this.type}"></ha-ripple>`}}c.styles=n,c=(0,s.Cg)([(0,a.EM)("ha-md-list-item")],c)},49639(e,t,i){i.a(e,async function(e,s){try{i.d(t,{A1:()=>C,LE:()=>$,RR:()=>z});i(44114),i(18111),i(22489),i(7588),i(61701);var o=i(62826),r=i(35211),l=i(78648),a=i(5124),n=i(22441),c=i(22786),h=i(91335),d=i(1087),m=i(52220),p=i(22792),u=i(59992),v=i(59653),g=i(14503),_=i(85614),y=i(88438),f=(i(5745),i(32023),i(75064),i(47680),i(26300)),b=(i(67094),i(36866)),x=e([f,b]);[f,b]=x.then?(await x)():x;const I="M9.5,3A6.5,6.5 0 0,1 16,9.5C16,11.11 15.41,12.59 14.44,13.73L14.71,14H15.5L20.5,19L19,20.5L14,15.5V14.71L13.73,14.44C12.59,15.41 11.11,16 9.5,16A6.5,6.5 0 0,1 3,9.5A6.5,6.5 0 0,1 9.5,3M9.5,5C7,5 5,7 5,9.5C5,12 7,14 9.5,14C12,14 14,12 14,9.5C14,7 12,5 9.5,5Z",w="M19,19V5H5V19H19M19,3A2,2 0 0,1 21,5V19A2,2 0 0,1 19,21H5A2,2 0 0,1 3,19V5C3,3.89 3.9,3 5,3H19M17,11V13H7V11H17Z",S="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z",C=[{name:"primary",weight:10},{name:"secondary",weight:7},{name:"id",weight:3}],z="___no_items_available___",E="___padding___",$=e=>a.qy` ${e.icon?a.qy`<ha-icon slot="start" .icon="${e.icon}"></ha-icon>`:e.icon_path?a.qy`<ha-svg-icon slot="start" .path="${e.icon_path}"></ha-svg-icon>`:a.s6} <span slot="headline">${e.primary}</span> ${e.secondary?a.qy`<span slot="supporting-text">${e.secondary}</span>`:a.s6}`,k=e=>a.qy`<ha-combo-box-item type="button" compact="compact"> ${$(e)} </ha-combo-box-item>`;class L extends((0,u.V)(a.WF)){setFieldValue(e){this._searchFieldElement&&(this._searchFieldElement.value=e)}get scrollableElement(){return this.virtualizerElement}firstUpdated(){this._registerKeyboardShortcuts()}willUpdate(){this.hasUpdated||((0,_.i)(),this._selectedSection=this.selectedSection,this._allItems=this._getItems(),this._items=this._allItems)}disconnectedCallback(){super.disconnectedCallback(),this._removeKeyboardShortcuts?.()}refreshItems(){this._allItems=this._getItems(),this._search&&!this.sections?.length||(this._items=this._allItems)}render(){const e=this.label??(this.allowCustomValue?this.i18n?.localize?.("ui.components.combo-box.search_or_custom")??"Search | Add custom value":this.i18n?.localize?.("ui.common.search")??"Search");return a.qy`<ha-input-search appearance="outlined" .placeholder="${e}" @blur="${this._resetSelectedItem}" @input="${this._filterChanged}"> </ha-input-search> ${this._renderSectionButtons()} ${this.sections?.length?a.qy` <div class="section-title-wrapper"> <div class="section-title ${!this._selectedSection&&this._sectionTitle?"show":""}"> ${this._sectionTitle} </div> </div> `:a.s6} <div class="virtualizer-wrapper"> <lit-virtualizer .keyFunction="${this._keyFunction}" tabindex="0" scroller .items="${this._items}" .renderItem="${this._renderItem}" style="min-height:36px" class="${this._listScrolled?"scrolled":""}" .layout="${this.value&&this._valuePinned?{pin:{index:this._getInitialSelectedIndex(),block:"center"}}:void 0}" @unpinned="${this._handleUnpinned}" @scroll="${this._onScrollList}" @focus="${this._focusList}" @blur="${this._resetSelectedItem}" @visibilityChanged="${this._visibilityChanged}"> </lit-virtualizer> ${this.renderScrollableFades()} </div>`}_renderSectionButtons(){return this.sections&&0!==this.sections.length?a.qy` <ha-chip-set class="sections"> ${this.sections.map(e=>"separator"===e?a.qy`<div class="separator"></div>`:a.qy`<ha-filter-chip @mousedown="${y.C?void 0:this._preventBlur}" @click="${this._toggleSection}" .section-id="${e.id}" .selected="${this._selectedSection===e.id}" .label="${e.label}"> </ha-filter-chip>`)} </ha-chip-set> `:a.s6}_visibilityChanged(e){if(this.virtualizerElement&&this.sectionTitleFunction&&this.sections?.length){const t=this.virtualizerElement.items[e.first],i=this.virtualizerElement.items[e.first+1];this._sectionTitle=this.sectionTitleFunction({firstIndex:e.first,lastIndex:e.last,firstItem:t,secondItem:i,itemsCount:this.virtualizerElement.items.length})}}_handleUnpinned(){this._valuePinned=!1}_onScrollList(e){const t=e.target.scrollTop??0;this._listScrolled=t>0}_fireSelectedEvents(e,t,i=!1){(0,d.r)(this,"value-changed",{value:e}),(0,d.r)(this,"index-selected",{index:t,newTab:i})}_preventBlur(e){e.preventDefault()}_toggleSection(e){e.stopPropagation(),this._resetSelectedItem(),this._sectionTitle=void 0;const t=e.target["section-id"];t&&(this._selectedSection===t?this._selectedSection=void 0:this._selectedSection=t,this._items=this._getItems(),this.virtualizerElement?.element(0)?.scrollIntoView())}_registerKeyboardShortcuts(){this._removeKeyboardShortcuts=(0,h.Tc)(this,{ArrowUp:this._selectPreviousItem,ArrowDown:this._selectNextItem,Home:this._selectFirstItem,End:this._selectLastItem,Enter:this._pickSelectedItem,"$mod+Enter":this._pickSelectedItemNewTab})}_focusList(){-1===this._selectedItemIndex&&this._initializeSelectedIndex()}_initializeSelectedIndex(){if(!this.virtualizerElement?.items?.length)return;const e=this._getInitialSelectedIndex();if(0===e&&!this._search)return;let t=e;"string"==typeof this.virtualizerElement.items[t]&&(t+=1),t>=this.virtualizerElement.items.length||(this._selectedItemIndex=t,this._scrollToSelectedItem())}_resetSelectedItem(){this.virtualizerElement?.querySelector(".selected")?.classList.remove("selected"),this._selectedItemIndex=-1}_getInitialSelectedIndex(){if(!this.virtualizerElement||this._search||!this.value)return 0;const e=this.virtualizerElement.items.findIndex(e=>"string"!=typeof e&&e.id===this.value);return-1===e?0:e}static get styles(){return[...super.styles,g.dp,a.AH`:host{display:flex;flex-direction:column;padding-top:var(--ha-space-4);flex:1}:host([clearable]){--text-field-padding-top:0;--text-field-padding-bottom:0;--text-field-padding-start:var(--ha-space-4);--text-field-padding-end:0}ha-input-search{padding:0 var(--ha-space-3) var(--ha-space-3)}:host([mode=dialog]) ha-input-search{padding:0 var(--ha-space-4) var(--ha-space-3)}ha-combo-box-item{width:100%}ha-combo-box-item.selected{background-color:var(--ha-color-fill-neutral-quiet-hover)}@media (prefers-color-scheme:dark){ha-combo-box-item.selected{background-color:var(--ha-color-fill-neutral-normal-hover)}}.virtualizer-wrapper{position:relative;flex:1;display:flex;flex-direction:column;min-height:0}lit-virtualizer{flex:1}lit-virtualizer:focus-visible{outline:0}lit-virtualizer.scrolled{border-top:1px solid var(--ha-color-border-neutral-quiet)}.bottom-padding{height:max(var(--safe-area-inset-bottom,0px),var(--ha-space-8));width:100%}.empty{text-align:center}.combo-box-row{display:flex;width:100%;align-items:center;box-sizing:border-box;min-height:36px}.combo-box-row.current-value{background-color:var(--ha-color-fill-primary-quiet-resting)}.combo-box-row.selected{background-color:var(--ha-color-fill-neutral-quiet-hover)}@media (prefers-color-scheme:dark){.combo-box-row.selected{background-color:var(--ha-color-fill-neutral-normal-hover)}}.sections{display:flex;flex-wrap:nowrap;gap:var(--ha-space-2);padding:0 var(--ha-space-3) var(--ha-space-3);overflow:auto}:host([mode=dialog]) .sections{padding:0 var(--ha-space-4) var(--ha-space-3)}.sections ha-filter-chip{flex-shrink:0;--md-filter-chip-selected-container-color:var(--ha-color-fill-primary-normal-hover);color:var(--primary-color)}.sections .separator{height:var(--ha-space-8);width:0;border:1px solid var(--ha-color-border-neutral-quiet)}.section-title,.title{box-sizing:border-box;background-color:var(--ha-color-fill-neutral-quiet-resting);padding:var(--ha-space-1) var(--ha-space-4);font-weight:var(--ha-font-weight-bold);color:var(--secondary-text-color);min-height:var(--ha-space-6);display:flex;align-items:center}.title{width:100%}:host([mode=dialog]) .title{padding:var(--ha-space-1) var(--ha-space-4)}.section-title-wrapper{height:0;position:relative}.section-title{opacity:0;position:absolute;top:1px;width:calc(100% - var(--ha-space-4))}.section-title.show{opacity:1;z-index:1}.empty-search{display:flex;width:100%;flex-direction:column;align-items:center;padding:var(--ha-space-3)}`]}constructor(...e){super(...e),this.autofocus=!1,this.disabled=!1,this.required=!1,this._listScrolled=!1,this.mode="popover",this.clearable=!1,this.noSort=!1,this._items=[],this._valuePinned=!0,this._allItems=[],this._selectedItemIndex=-1,this._search="",this._getAdditionalItems=e=>this.getAdditionalItems?.(e)||[],this._getItems=()=>{let e=[...this.getItems(this._search,this._selectedSection)||[]];this.sections?.length||this.noSort||(e=e.sort((e,t)=>{const i="string"==typeof e?e:e.sorting_label,s="string"==typeof t?t:t.sorting_label;return i&&s?s?i?(0,m.SH)(i,s,this.i18n?.locale?.language??navigator.language):1:-1:0})),e.length||this.allowCustomValue||e.push({id:z,primary:""});const t=this._getAdditionalItems();return e.push(...t),this.allowCustomValue&&this._search&&e.push({id:this._search,primary:this.customValueLabel??this.i18n?.localize?.("ui.components.combo-box.add_custom_item")??"Add custom item",secondary:`"${this._search}"`,icon_path:S}),"dialog"===this.mode&&e.push({id:E,primary:""}),e},this._renderItem=(e,t)=>{if(!e)return a.s6;if(e.id===E)return a.qy`<div class="bottom-padding"></div>`;if(e.id===z)return a.qy` <div class="combo-box-row"> <ha-combo-box-item type="text" compact="compact"> <ha-svg-icon slot="start" .path="${this._search?I:w}"></ha-svg-icon> <span slot="headline">${this._search?"function"==typeof this.notFoundLabel?this.notFoundLabel(this._search):this.notFoundLabel||this.i18n?.localize?.("ui.components.combo-box.no_match")||"No matching items found":this.emptyLabel||this.i18n?.localize?.("ui.components.combo-box.no_items")||"No items available"}</span> </ha-combo-box-item> </div> `;if("string"==typeof e)return a.qy`<div class="title">${e}</div>`;const i=this.rowRenderer||k;return a.qy`<div id="${`list-item-${t}`}" class="combo-box-row ${this.value===e.id?"current-value":""}" .value="${e.id}" .index="${t}" .disabled="${e.disabled}" @click="${this._valueSelected}"> ${i(e,t)} </div>`},this._valueSelected=e=>{e.stopPropagation();const{disabled:t,index:i,value:s}=e.currentTarget;if(t)return;const o=s?.trim(),r=e.ctrlKey||e.metaKey;this._fireSelectedEvents(o,i,r)},this._fuseIndex=(0,c.A)((e,t)=>l.A.createIndex(t||C,e)),this._filterChanged=e=>{const t=(e.target.value??"").trim();if(this._search=t,this.sections?.length)this._items=this._getItems();else{if(!t)return void(this._items=this._allItems);const e=this._fuseIndex(this._allItems,this.searchKeys);let i=(0,v.x)(this._allItems,t,this.searchKeys||C,e=>e.id,e);i.length||this.allowCustomValue||i.push({id:z,primary:""});const s=this._getAdditionalItems(t);i.push(...s),this.searchFn&&(i=this.searchFn(t,i,this._allItems)),this.allowCustomValue&&t&&i.push({id:t,primary:this.customValueLabel??this.i18n?.localize?.("ui.components.combo-box.add_custom_item")??"Add custom item",secondary:`"${t}"`,icon_path:S}),this._items=i}this._selectedItemIndex=-1,this._valuePinned=!0},this._selectNextItem=e=>{if(e?.stopPropagation(),e?.preventDefault(),!this.virtualizerElement)return;this._searchFieldElement?.focus();const t=this.virtualizerElement.items,i=t.length-1;if(-1===i)return void this._resetSelectedItem();if(-1===this._selectedItemIndex&&(this._initializeSelectedIndex(),-1!==this._selectedItemIndex))return;const s=i===this._selectedItemIndex?this._selectedItemIndex:this._selectedItemIndex+1;if(t[s]){if("string"==typeof t[s]){if(s===i)return;this._selectedItemIndex=s+1}else this._selectedItemIndex=s;this._scrollToSelectedItem()}},this._selectPreviousItem=e=>{if(e.stopPropagation(),e.preventDefault(),this.virtualizerElement&&this._selectedItemIndex>0){const e=this._selectedItemIndex-1,t=this.virtualizerElement.items;if(!t[e])return;if("string"==typeof t[e]){if(0===e)return;this._selectedItemIndex=e-1}else this._selectedItemIndex=e;this._scrollToSelectedItem()}},this._selectFirstItem=e=>{if(e.stopPropagation(),!this.virtualizerElement||!this.virtualizerElement.items.length)return;"string"==typeof this.virtualizerElement.items[0]?this._selectedItemIndex=1:this._selectedItemIndex=0,this._scrollToSelectedItem()},this._selectLastItem=e=>{if(e.stopPropagation(),!this.virtualizerElement||!this.virtualizerElement.items.length)return;const t=this.virtualizerElement.items.length-1;"string"==typeof this.virtualizerElement.items[t]?this._selectedItemIndex=t-1:this._selectedItemIndex=t,this._scrollToSelectedItem()},this._scrollToSelectedItem=()=>{this.virtualizerElement?.querySelector(".selected")?.classList.remove("selected"),this.virtualizerElement?.element(this._selectedItemIndex)?.scrollIntoView({block:"nearest"}),requestAnimationFrame(()=>{this.virtualizerElement?.querySelector(`#list-item-${this._selectedItemIndex}`)?.classList.add("selected")})},this._pickSelectedItem=e=>{this._pickItem(e,!1)},this._pickSelectedItemNewTab=e=>{this._pickItem(e,!0)},this._pickItem=(e,t)=>{if(e.stopPropagation(),void 0!==this.virtualizerElement?.items?.length&&this.virtualizerElement.items.length<4&&1===this.virtualizerElement.items.filter(e=>"string"!=typeof e).length)return void(this.virtualizerElement?.items).forEach((e,i)=>{"string"==typeof e||e.disabled||this._fireSelectedEvents(e.id,i,t)});if(-1===this._selectedItemIndex&&(this._initializeSelectedIndex(),-1===this._selectedItemIndex))return;e.preventDefault();const i=this.virtualizerElement?.items[this._selectedItemIndex];i&&!i.disabled&&this._fireSelectedEvents(i.id,this._selectedItemIndex,t)},this._keyFunction=e=>"string"==typeof e?e:e?.id}}L.shadowRootOptions={...a.WF.shadowRootOptions,delegatesFocus:!0},(0,o.Cg)([(0,n.MZ)({type:Boolean})],L.prototype,"autofocus",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean})],L.prototype,"disabled",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean})],L.prototype,"required",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean,attribute:"allow-custom-value"})],L.prototype,"allowCustomValue",void 0),(0,o.Cg)([(0,n.MZ)({attribute:"custom-value-label"})],L.prototype,"customValueLabel",void 0),(0,o.Cg)([(0,n.MZ)()],L.prototype,"label",void 0),(0,o.Cg)([(0,n.MZ)()],L.prototype,"value",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],L.prototype,"searchKeys",void 0),(0,o.Cg)([(0,n.wk)()],L.prototype,"_listScrolled",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],L.prototype,"getItems",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],L.prototype,"getAdditionalItems",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],L.prototype,"rowRenderer",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],L.prototype,"notFoundLabel",void 0),(0,o.Cg)([(0,n.MZ)({attribute:"empty-label"})],L.prototype,"emptyLabel",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],L.prototype,"searchFn",void 0),(0,o.Cg)([(0,n.MZ)({reflect:!0})],L.prototype,"mode",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],L.prototype,"sections",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],L.prototype,"sectionTitleFunction",void 0),(0,o.Cg)([(0,n.MZ)({attribute:"selected-section"})],L.prototype,"selectedSection",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean,reflect:!0})],L.prototype,"clearable",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean,attribute:"no-sort"})],L.prototype,"noSort",void 0),(0,o.Cg)([(0,n.P)("lit-virtualizer")],L.prototype,"virtualizerElement",void 0),(0,o.Cg)([(0,n.P)("ha-input-search")],L.prototype,"_searchFieldElement",void 0),(0,o.Cg)([(0,n.wk)(),(0,r.Fg)({context:p.D5,subscribe:!0})],L.prototype,"i18n",void 0),(0,o.Cg)([(0,n.wk)()],L.prototype,"_items",void 0),(0,o.Cg)([(0,n.wk)()],L.prototype,"_selectedSection",void 0),(0,o.Cg)([(0,n.wk)()],L.prototype,"_sectionTitle",void 0),(0,o.Cg)([(0,n.wk)()],L.prototype,"_valuePinned",void 0),(0,o.Cg)([(0,n.Ls)({passive:!0})],L.prototype,"_visibilityChanged",null),(0,o.Cg)([(0,n.Ls)({passive:!0})],L.prototype,"_handleUnpinned",null),(0,o.Cg)([(0,n.Ls)({passive:!0})],L.prototype,"_onScrollList",null),L=(0,o.Cg)([(0,n.EM)("ha-picker-combo-box")],L),s()}catch(e){s(e)}})},59653(e,t,i){i.d(t,{C:()=>l,x:()=>a});i(18111),i(22489),i(20116),i(7588),i(61701);var s=i(78648);const o={ignoreDiacritics:!0,isCaseSensitive:!1,threshold:.3,minMatchCharLength:2,ignoreLocation:!0};function r(e,t,i,r,l){return new s.A(e,{...o,minMatchCharLength:l??("string"==typeof t&&t.length<2?t.length:2),...r||{}},i).search(t)}function l(e,t,i,s,o={}){const l=t.toLowerCase().split(" ").filter(e=>e.trim());if(!l.length)return e;let a=2;l.forEach(e=>{e.length<a&&(a=e.length)});return r(e,{$and:l.map(e=>({$or:i.map(t=>({$path:"string"==typeof t?t:Array.isArray(t)?t.join("."):"string"==typeof t.name?t.name:t.name.join("."),$val:e}))}))},s,{...o,shouldSort:!1},a).map(e=>e.item)}function a(e,t,i,s,o,l={}){const a=t.toLowerCase().split(" ").filter(e=>e.trim());if(!a.length)return e;if(1===a.length)return r(e,a[0],o,l).map(e=>e.item);const n={};let c=0;if(a.forEach(t=>{if(!t.trim())return;const a=r(e,t,o,{...l,shouldSort:!1,includeScore:!0,includeMatches:!0});a.length&&(c++,a.forEach(e=>{const t=s(e.item);n[t]||(n[t]={item:e.item,hits:0,score:0}),n[t].hits+=1;const o=function(e,t){if(!e.matches||0===e.matches.length)return 1;let i=1;for(const s of e.matches){const e=t.find(e=>"string"==typeof e.name?e.name===s.key:e.name.join(".")===s.key);e&&e.weight&&e.weight>i&&(i=e.weight)}return i}(e,i),r=(e.score?1-e.score:0)*o;n[t].score+=r}))}),c!==a.length)return[];const h=Object.values(n).filter(({hits:e})=>e===a.length);return h.sort((e,t)=>t.score-e.score),h.map(({item:e})=>e)}}};