import{u as $e}from"./BRWupM9M.js";import{d as q,j as k,h as C,J as ge,z as x,U as O,F as ee,k as te,I as be,p as oe,i as ue,H as se,E as W,o as H,f as ie,w as j,a as J,n as L,l as pe,e as ve,V as ce,m as V,c as Y,b as U,W as ke}from"./CA5dr3DQ.js";import{U as Ce,w as Ee,x as Te,y as de,A as Fe,C as Be}from"./DptpiC8N.js";import{q as Ie,N as De,E as Oe,n as me,d as I}from"./BiPZ7YS6.js";import{o as l,u as A,t as Me,i as K,A as ae,a as G,l as Ne,N as fe,b as M,s as Ae}from"./CzhFqAUt.js";import{i as le,E as ne,w as He,a as je,h as Le,f as X,u as Z,P as N,N as D,T as _}from"./BFJHRox1.js";import{s as Ge}from"./DviZHyOR.js";import{c as Re}from"./LRuyHsaC.js";const ze={wrapper:"relative",container:"z-50 group",trigger:"inline-flex w-full",width:"",background:"bg-white dark:bg-gray-900",shadow:"shadow-lg",rounded:"rounded-md",ring:"ring-1 ring-gray-200 dark:ring-gray-800",base:"overflow-hidden focus:outline-none relative",transition:{enterActiveClass:"transition ease-out duration-200",enterFromClass:"opacity-0 translate-y-1",enterToClass:"opacity-100 translate-y-0",leaveActiveClass:"transition ease-in duration-150",leaveFromClass:"opacity-100 translate-y-0",leaveToClass:"opacity-0 translate-y-1"},overlay:{base:"fixed inset-0 transition-opacity z-50",background:"bg-gray-200/75 dark:bg-gray-800/75",transition:{enterActiveClass:"ease-out duration-200",enterFromClass:"opacity-0",enterToClass:"opacity-100",leaveActiveClass:"ease-in duration-150",leaveFromClass:"opacity-100",leaveToClass:"opacity-0"}},popper:{strategy:"fixed"},default:{openDelay:0,closeDelay:0},arrow:Ce};var Ue=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Ue||{});let ye=Symbol("PopoverContext");function re(e){let P=oe(ye,null);if(P===null){let S=new Error(`<${e} /> is missing a parent <${he.name} /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(S,re),S}return P}let Ke=Symbol("PopoverGroupContext");function Pe(){return oe(Ke,null)}let Se=Symbol("PopoverPanelContext");function qe(){return oe(Se,null)}let he=q({name:"Popover",inheritAttrs:!1,props:{as:{type:[Object,String],default:"div"}},setup(e,{slots:P,attrs:S,expose:T}){var h;let w=k(null);T({el:w,$el:w});let a=k(1),o=k(null),u=k(null),d=k(null),v=k(null),g=C(()=>le(w)),$=C(()=>{var t,r;if(!l(o)||!l(v))return!1;for(let z of document.querySelectorAll("body > *"))if(Number(z==null?void 0:z.contains(l(o)))^Number(z==null?void 0:z.contains(l(v))))return!0;let n=ne(),y=n.indexOf(l(o)),E=(y+n.length-1)%n.length,B=(y+1)%n.length,R=n[E],we=n[B];return!((t=l(v))!=null&&t.contains(R))&&!((r=l(v))!=null&&r.contains(we))}),b={popoverState:a,buttonId:k(null),panelId:k(null),panel:v,button:o,isPortalled:$,beforePanelSentinel:u,afterPanelSentinel:d,togglePopover(){a.value=A(a.value,{0:1,1:0})},closePopover(){a.value!==1&&(a.value=1)},close(t){b.closePopover();let r=t?t instanceof HTMLElement?t:t.value instanceof HTMLElement?l(t):l(b.button):l(b.button);r==null||r.focus()}};ge(ye,b),Me(C(()=>A(a.value,{0:K.Open,1:K.Closed})));let F={buttonId:b.buttonId,panelId:b.panelId,close(){b.closePopover()}},s=Pe(),f=s==null?void 0:s.registerPopover,[m,p]=Ie(),c=De({mainTreeNodeRef:s==null?void 0:s.mainTreeNodeRef,portals:m,defaultContainers:[o,v]});function i(){var t,r,n,y;return(y=s==null?void 0:s.isFocusWithinPopoverGroup())!=null?y:((t=g.value)==null?void 0:t.activeElement)&&(((r=l(o))==null?void 0:r.contains(g.value.activeElement))||((n=l(v))==null?void 0:n.contains(g.value.activeElement)))}return x(()=>f==null?void 0:f(F)),Oe((h=g.value)==null?void 0:h.defaultView,"focus",t=>{var r,n;t.target!==window&&t.target instanceof HTMLElement&&a.value===0&&(i()||o&&v&&(c.contains(t.target)||(r=l(b.beforePanelSentinel))!=null&&r.contains(t.target)||(n=l(b.afterPanelSentinel))!=null&&n.contains(t.target)||b.closePopover()))},!0),He(c.resolveContainers,(t,r)=>{var n;b.closePopover(),je(r,Le.Loose)||(t.preventDefault(),(n=l(o))==null||n.focus())},C(()=>a.value===0)),()=>{let t={open:a.value===0,close:b.close};return O(ee,[O(p,{},()=>ae({theirProps:{...e,...S},ourProps:{ref:w},slot:t,slots:P,attrs:S,name:"Popover"})),O(c.MainTreeNode)])}}}),We=q({name:"PopoverButton",props:{as:{type:[Object,String],default:"button"},disabled:{type:[Boolean],default:!1},id:{type:String,default:null}},inheritAttrs:!1,setup(e,{attrs:P,slots:S,expose:T}){var h;let w=(h=e.id)!=null?h:`headlessui-popover-button-${G()}`,a=re("PopoverButton"),o=C(()=>le(a.button));T({el:a.button,$el:a.button}),te(()=>{a.buttonId.value=w}),be(()=>{a.buttonId.value=null});let u=Pe(),d=u==null?void 0:u.closeOthers,v=qe(),g=C(()=>v===null?!1:v.value===a.panelId.value),$=k(null),b=`headlessui-focus-sentinel-${G()}`;g.value||x(()=>{a.button.value=l($)});let F=Ge(C(()=>({as:e.as,type:P.type})),$);function s(t){var r,n,y,E,B;if(g.value){if(a.popoverState.value===1)return;switch(t.key){case M.Space:case M.Enter:t.preventDefault(),(n=(r=t.target).click)==null||n.call(r),a.closePopover(),(y=l(a.button))==null||y.focus();break}}else switch(t.key){case M.Space:case M.Enter:t.preventDefault(),t.stopPropagation(),a.popoverState.value===1&&(d==null||d(a.buttonId.value)),a.togglePopover();break;case M.Escape:if(a.popoverState.value!==0)return d==null?void 0:d(a.buttonId.value);if(!l(a.button)||(E=o.value)!=null&&E.activeElement&&!((B=l(a.button))!=null&&B.contains(o.value.activeElement)))return;t.preventDefault(),t.stopPropagation(),a.closePopover();break}}function f(t){g.value||t.key===M.Space&&t.preventDefault()}function m(t){var r,n;e.disabled||(g.value?(a.closePopover(),(r=l(a.button))==null||r.focus()):(t.preventDefault(),t.stopPropagation(),a.popoverState.value===1&&(d==null||d(a.buttonId.value)),a.togglePopover(),(n=l(a.button))==null||n.focus()))}function p(t){t.preventDefault(),t.stopPropagation()}let c=me();function i(){let t=l(a.panel);if(!t)return;function r(){A(c.value,{[I.Forwards]:()=>N(t,D.First),[I.Backwards]:()=>N(t,D.Last)})===_.Error&&N(ne().filter(n=>n.dataset.headlessuiFocusGuard!=="true"),A(c.value,{[I.Forwards]:D.Next,[I.Backwards]:D.Previous}),{relativeTo:l(a.button)})}r()}return()=>{let t=a.popoverState.value===0,r={open:t},{...n}=e,y=g.value?{ref:$,type:F.value,onKeydown:s,onClick:m}:{ref:$,id:w,type:F.value,"aria-expanded":a.popoverState.value===0,"aria-controls":l(a.panel)?a.panelId.value:void 0,disabled:e.disabled?!0:void 0,onKeydown:s,onKeyup:f,onClick:m,onMousedown:p};return O(ee,[ae({ourProps:y,theirProps:{...P,...n},slot:r,attrs:P,slots:S,name:"PopoverButton"}),t&&!g.value&&a.isPortalled.value&&O(X,{id:b,features:Z.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:i})])}}}),Je=q({name:"PopoverPanel",props:{as:{type:[Object,String],default:"div"},static:{type:Boolean,default:!1},unmount:{type:Boolean,default:!0},focus:{type:Boolean,default:!1},id:{type:String,default:null}},inheritAttrs:!1,setup(e,{attrs:P,slots:S,expose:T}){var h;let w=(h=e.id)!=null?h:`headlessui-popover-panel-${G()}`,{focus:a}=e,o=re("PopoverPanel"),u=C(()=>le(o.panel)),d=`headlessui-focus-sentinel-before-${G()}`,v=`headlessui-focus-sentinel-after-${G()}`;T({el:o.panel,$el:o.panel}),te(()=>{o.panelId.value=w}),be(()=>{o.panelId.value=null}),ge(Se,o.panelId),x(()=>{var p,c;if(!a||o.popoverState.value!==0||!o.panel)return;let i=(p=u.value)==null?void 0:p.activeElement;(c=l(o.panel))!=null&&c.contains(i)||N(l(o.panel),D.First)});let g=Ne(),$=C(()=>g!==null?(g.value&K.Open)===K.Open:o.popoverState.value===0);function b(p){var c,i;switch(p.key){case M.Escape:if(o.popoverState.value!==0||!l(o.panel)||u.value&&!((c=l(o.panel))!=null&&c.contains(u.value.activeElement)))return;p.preventDefault(),p.stopPropagation(),o.closePopover(),(i=l(o.button))==null||i.focus();break}}function F(p){var c,i,t,r,n;let y=p.relatedTarget;y&&l(o.panel)&&((c=l(o.panel))!=null&&c.contains(y)||(o.closePopover(),((t=(i=l(o.beforePanelSentinel))==null?void 0:i.contains)!=null&&t.call(i,y)||(n=(r=l(o.afterPanelSentinel))==null?void 0:r.contains)!=null&&n.call(r,y))&&y.focus({preventScroll:!0})))}let s=me();function f(){let p=l(o.panel);if(!p)return;function c(){A(s.value,{[I.Forwards]:()=>{var i;N(p,D.First)===_.Error&&((i=l(o.afterPanelSentinel))==null||i.focus())},[I.Backwards]:()=>{var i;(i=l(o.button))==null||i.focus({preventScroll:!0})}})}c()}function m(){let p=l(o.panel);if(!p)return;function c(){A(s.value,{[I.Forwards]:()=>{let i=l(o.button),t=l(o.panel);if(!i)return;let r=ne(),n=r.indexOf(i),y=r.slice(0,n+1),E=[...r.slice(n+1),...y];for(let B of E.slice())if(B.dataset.headlessuiFocusGuard==="true"||t!=null&&t.contains(B)){let R=E.indexOf(B);R!==-1&&E.splice(R,1)}N(E,D.First,{sorted:!1})},[I.Backwards]:()=>{var i;N(p,D.Previous)===_.Error&&((i=l(o.button))==null||i.focus())}})}c()}return()=>{let p={open:o.popoverState.value===0,close:o.close},{focus:c,...i}=e,t={ref:o.panel,id:w,onKeydown:b,onFocusout:a&&o.popoverState.value===0?F:void 0,tabIndex:-1};return ae({ourProps:t,theirProps:{...P,...i},attrs:P,slot:p,slots:{...S,default:(...r)=>{var n;return[O(ee,[$.value&&o.isPortalled.value&&O(X,{id:d,ref:o.beforePanelSentinel,features:Z.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:f}),(n=S.default)==null?void 0:n.call(S,...r),$.value&&o.isPortalled.value&&O(X,{id:v,ref:o.afterPanelSentinel,features:Z.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:m})])]}},features:fe.RenderStrategy|fe.Static,visible:$.value,name:"PopoverPanel"})}}});const Q=Te(de.ui.strategy,de.ui.popover,ze),Ve=q({components:{HPopover:he,HPopoverButton:We,HPopoverPanel:Je},inheritAttrs:!1,props:{mode:{type:String,default:"click",validator:e=>["click","hover"].includes(e)},open:{type:Boolean,default:void 0},disabled:{type:Boolean,default:!1},openDelay:{type:Number,default:()=>Q.default.openDelay},closeDelay:{type:Number,default:()=>Q.default.closeDelay},overlay:{type:Boolean,default:!1},popper:{type:Object,default:()=>({})},class:{type:[String,Object,Array],default:()=>""},ui:{type:Object,default:()=>({})}},emits:["update:open"],setup(e,{emit:P}){const{ui:S,attrs:T}=Fe("popover",ue(e,"ui"),Q,ue(e,"class")),h=C(()=>Be(e.mode==="hover"?{offsetDistance:0}:{},e.popper,S.value.popper)),[w,a]=Re(h.value),o=k(null),u=k(null);let d=null,v=null;te(()=>{var m,p;const s=(m=o.value)==null?void 0:m.$.provides;if(!s)return;const f=Object.getOwnPropertySymbols(s);u.value=f.length&&s[f[0]],e.open&&((p=u.value)==null||p.togglePopover())});const g=C(()=>{var p,c,i;if(e.mode!=="hover")return{};const s=((p=e.popper)==null?void 0:p.offsetDistance)||((c=S.value.popper)==null?void 0:c.offsetDistance)||8,f=(i=h.value.placement)==null?void 0:i.split("-")[0],m=`${s}px`;return f==="top"||f==="bottom"?{paddingTop:m,paddingBottom:m}:f==="left"||f==="right"?{paddingLeft:m,paddingRight:m}:{paddingTop:m,paddingBottom:m,paddingLeft:m,paddingRight:m}});function $(s){!s.cancelable||!u.value||e.mode==="click"||(u.value.popoverState===0?u.value.closePopover():u.value.togglePopover())}function b(){e.mode!=="hover"||!u.value||(v&&(clearTimeout(v),v=null),u.value.popoverState!==0&&(d=d||setTimeout(()=>{u.value.togglePopover&&u.value.togglePopover(),d=null},e.openDelay)))}function F(){e.mode!=="hover"||!u.value||(d&&(clearTimeout(d),d=null),u.value.popoverState!==1&&(v=v||setTimeout(()=>{u.value.closePopover&&u.value.closePopover(),v=null},e.closeDelay)))}return se(()=>e.open,(s,f)=>{u.value&&(f===void 0||s===f||(s?u.value.popoverState=0:u.value.closePopover()))}),se(()=>{var s;return(s=u.value)==null?void 0:s.popoverState},(s,f)=>{f===void 0||s===f||P("update:open",s===0)}),Ae(()=>$e("$dcv2Y3vSTA")),{ui:S,attrs:T,popover:o,popper:h,trigger:w,container:a,containerStyle:g,onTouchStart:$,onMouseEnter:b,onMouseLeave:F}}}),Ye=["disabled"];function Qe(e,P,S,T,h,w){const a=W("HPopoverButton"),o=W("HPopoverPanel"),u=W("HPopover");return H(),ie(u,V({ref:"popover",class:e.ui.wrapper},e.attrs,{onMouseleave:e.onMouseLeave}),{default:j(({open:d,close:v})=>[J(a,{ref:"trigger",as:"div",disabled:e.disabled,class:L(e.ui.trigger),role:"button",onMouseenter:e.onMouseEnter,onTouchstartPassive:e.onTouchStart},{default:j(()=>[pe(e.$slots,"default",{open:d,close:v},()=>[ve("button",{disabled:e.disabled}," Open ",8,Ye)])]),_:2},1032,["disabled","class","onMouseenter","onTouchstartPassive"]),e.overlay?(H(),ie(ce,V({key:0,appear:""},e.ui.overlay.transition),{default:j(()=>[d?(H(),Y("div",{key:0,class:L([e.ui.overlay.base,e.ui.overlay.background])},null,2)):U("",!0)]),_:2},1040)):U("",!0),d?(H(),Y("div",{key:1,ref:"container",class:L([e.ui.container,e.ui.width]),style:ke(e.containerStyle),onMouseenter:P[0]||(P[0]=(...g)=>e.onMouseEnter&&e.onMouseEnter(...g))},[J(ce,V({appear:""},e.ui.transition),{default:j(()=>[ve("div",null,[e.popper.arrow?(H(),Y("div",{key:0,"data-popper-arrow":"",class:L(Object.values(e.ui.arrow))},null,2)):U("",!0),J(o,{class:L([e.ui.base,e.ui.background,e.ui.ring,e.ui.rounded,e.ui.shadow]),static:""},{default:j(()=>[pe(e.$slots,"panel",{open:d,close:v})]),_:2},1032,["class"])])]),_:2},1040)],38)):U("",!0)]),_:3},16,["class","onMouseleave"])}const lt=Ee(Ve,[["render",Qe]]);export{lt as _};