import q from"./Icon.30f6becb.js";import U from"./Avatar.a7ca17e7.js";import O from"./Kbd.281578d0.js";import{g as B,E as H,j,v as w,o,c as t,y as s,t as u,l,a as m,F as I,x as A,k as f,w as S,I as h,L as z,V as L,d as N}from"./entry.eb978f24.js";import{_ as P}from"./_plugin-vue_export-helper.c27b6911.js";import{Y as V}from"./combobox.1e38e5ba.js";import"./dom.2ed3c503.js";import"./use-tracked-pointer.dbb7ea97.js";import"./focus-management.165c4009.js";import"./open-closed.41cbc312.js";import"./use-resolve-button-type.97982c22.js";import"./use-outside-click.0a4bdcf3.js";import"./hidden.a9dcbbf7.js";import"./use-controllable.6ce54b6b.js";import"./disposables.57da4964.js";import"./micro-task.89dcd6af.js";const E=B({components:{HComboboxOption:V,UIcon:q,UAvatar:U,UKbd:O},props:{group:{type:Object,required:!0},query:{type:String,default:""},groupAttribute:{type:String,required:!0},commandAttribute:{type:String,required:!0},selectedIcon:{type:String,required:!0},ui:{type:Object,default:()=>H.ui.commandPalette}},setup(e){const k=j(()=>{const n=e.group[e.groupAttribute];return typeof n=="function"?n(e.query):n});function v(n,{indices:$,value:g}){if(n===g)return"";let a="",d=0;$.forEach(p=>{const r=p[1]+1,y=r-p[0]>=e.query.length;a+=[g.substring(d,p[0]),y&&"<mark>",g.substring(p[0],r),y&&"</mark>"].filter(Boolean).join(""),d=r}),a+=g.substring(d);const b=a.indexOf("<mark>");return b>60&&(a=`...${a.substring(b-60)}`),a}return{label:k,highlight:v}}}),M=["aria-label"],T=["innerHTML"];function F(e,k,v,n,$,g){const a=q,d=U,b=O,p=w("HComboboxOption");return o(),t("div",{class:s(e.ui.group.wrapper),role:"option"},[e.label?(o(),t("h2",{key:0,class:s(e.ui.group.label)},u(e.label),3)):l("",!0),m("div",{class:s(e.ui.group.container),role:"listbox","aria-label":e.group[e.groupAttribute]},[(o(!0),t(I,null,A(e.group.commands,(r,y)=>(o(),f(p,{key:`${e.group.key}-${y}`,value:r,disabled:r.disabled,as:"template"},{default:S(({active:i,selected:c})=>[m("div",{class:s([e.ui.group.command.base,i?e.ui.group.command.active:e.ui.group.command.inactive,r.disabled?"cursor-not-allowed":"cursor-pointer"])},[m("div",{class:s(e.ui.group.command.container)},[h(e.$slots,`${e.group.key}-icon`,{group:e.group,command:r,active:i,selected:c},()=>[r.icon?(o(),f(a,{key:0,name:r.icon,class:s([e.ui.group.command.icon.base,i?e.ui.group.command.icon.active:e.ui.group.command.icon.inactive,r.iconClass]),"aria-hidden":"true"},null,8,["name","class"])):r.avatar?(o(),f(d,z({key:1},{size:e.ui.group.command.avatar.size,...r.avatar},{class:e.ui.group.command.avatar.base,"aria-hidden":"true"}),null,16,["class"])):r.chip?(o(),t("span",{key:2,class:s(e.ui.group.command.chip.base),style:L({background:`#${r.chip}`})},null,6)):l("",!0)]),m("div",{class:s([e.ui.group.command.label,r.disabled&&e.ui.group.command.disabled])},[h(e.$slots,`${e.group.key}-command`,{group:e.group,command:r,active:i,selected:c},()=>[r.prefix?(o(),t("span",{key:0,class:s(["flex-shrink-0",r.prefixClass||e.ui.group.command.prefix])},u(r.prefix),3)):l("",!0),m("span",{class:s(["truncate",{"flex-none":r.suffix||r.matches?.length}])},u(r[e.commandAttribute]),3),r.matches?.length?(o(),t("span",{key:1,class:s(["truncate",r.suffixClass||e.ui.group.command.suffix]),innerHTML:e.highlight(r[e.commandAttribute],r.matches[0])},null,10,T)):r.suffix?(o(),t("span",{key:2,class:s(["truncate",r.suffixClass||e.ui.group.command.suffix])},u(r.suffix),3)):l("",!0)])],2)],2),c?(o(),f(a,{key:0,name:e.selectedIcon,class:s(e.ui.group.command.selectedIcon.base),"aria-hidden":"true"},null,8,["name","class"])):i&&(e.group.active||e.$slots[`${e.group.key}-active`])?h(e.$slots,`${e.group.key}-active`,{key:1,group:e.group,command:r,active:i,selected:c},()=>[e.group.active?(o(),t("span",{key:0,class:s(e.ui.group.active)},u(e.group.active),3)):l("",!0)]):h(e.$slots,`${e.group.key}-inactive`,{key:2,group:e.group,command:r,active:i,selected:c},()=>[r.shortcuts?.length?(o(),t("span",{key:0,class:s(e.ui.group.command.shortcuts)},[(o(!0),t(I,null,A(r.shortcuts,C=>(o(),f(b,{key:C},{default:S(()=>[N(u(C),1)]),_:2},1024))),128))],2)):!r.disabled&&e.group.inactive?(o(),t("span",{key:1,class:s(e.ui.group.inactive)},u(e.group.inactive),3)):l("",!0)])],2)]),_:2},1032,["value","disabled"]))),128))],10,M)],2)}const te=P(E,[["render",F]]);export{te as default};
