import{a6 as v,h as y,F as g,d as O}from"./index-deud-udu.js";function w(e,t,...r){if(e in t){let o=t[e];return typeof o=="function"?o(...r):o}let n=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(o=>`"${o}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,w),n}var E=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(E||{}),P=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(P||{});function N({visible:e=!0,features:t=0,ourProps:r,theirProps:n,...o}){var l;let a=j(n,r),s=Object.assign(o,{props:a});if(e||t&2&&a.static)return h(s);if(t&1){let u=(l=a.unmount)==null||l?0:1;return w(u,{0(){return null},1(){return h({...o,props:{...a,hidden:!0,style:{display:"none"}}})}})}return h(s)}function h({props:e,attrs:t,slots:r,slot:n,name:o}){var l;let{as:a,...s}=A(e,["unmount","static"]),u=(l=r.default)==null?void 0:l.call(r,n),p={};if(n){let c=!1,f=[];for(let[i,d]of Object.entries(n))typeof d=="boolean"&&(c=!0),d===!0&&f.push(i);c&&(p["data-headlessui-state"]=f.join(" "))}if(a==="template"){if(u=b(u??[]),Object.keys(s).length>0||Object.keys(t).length>0){let[c,...f]=u??[];if(!S(c)||f.length>0)throw new Error(['Passing props on "template"!',"",`The current component <${o} /> is rendering a "template".`,"However we need to passthrough the following props:",Object.keys(s).concat(Object.keys(t)).sort((i,d)=>i.localeCompare(d)).map(i=>`  - ${i}`).join(`
`),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "template".',"Render a single element as the child so that we can forward the props onto that element."].map(i=>`  - ${i}`).join(`
`)].join(`
`));return v(c,Object.assign({},s,p))}return Array.isArray(u)&&u.length===1?u[0]:u}return y(a,Object.assign({},s,p),u)}function b(e){return e.flatMap(t=>t.type===g?b(t.children):[t])}function j(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},r={};for(let n of e)for(let o in n)o.startsWith("on")&&typeof n[o]=="function"?(r[o]!=null||(r[o]=[]),r[o].push(n[o])):t[o]=n[o];if(t.disabled||t["aria-disabled"])return Object.assign(t,Object.fromEntries(Object.keys(r).map(n=>[n,void 0])));for(let n in r)Object.assign(t,{[n](o,...l){let a=r[n];for(let s of a){if(o instanceof Event&&o.defaultPrevented)return;s(o,...l)}}});return t}function A(e,t=[]){let r=Object.assign({},e);for(let n of t)n in r&&delete r[n];return r}function S(e){return e==null?!1:typeof e.type=="string"||typeof e.type=="object"||typeof e.type=="function"}let x=0;function F(){return++x}function B(){return F()}var $=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))($||{});function D(e){var t;return e==null||e.value==null?null:(t=e.value.$el)!=null?t:e.value}const k=typeof window>"u"||typeof document>"u";function T(e){if(k)return null;if(e instanceof Node)return e.ownerDocument;if(e!=null&&e.hasOwnProperty("value")){let t=D(e);if(t)return t.ownerDocument}return document}let m=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var H=(e=>(e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll",e))(H||{}),L=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(L||{}),M=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(M||{});function U(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(m))}var R=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(R||{});function G(e,t=0){var r;return e===((r=T(e))==null?void 0:r.body)?!1:w(t,{0(){return e.matches(m)},1(){let n=e;for(;n!==null;){if(n.matches(m))return!0;n=n.parentElement}return!1}})}function V(e){e==null||e.focus({preventScroll:!0})}let I=["textarea","input"].join(",");function C(e){var t,r;return(r=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,I))!=null?r:!1}function W(e,t=r=>r){return e.slice().sort((r,n)=>{let o=t(r),l=t(n);if(o===null||l===null)return 0;let a=o.compareDocumentPosition(l);return a&Node.DOCUMENT_POSITION_FOLLOWING?-1:a&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function Y(e,t,r=!0,n=null){var o;let l=(o=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e==null?void 0:e.ownerDocument)!=null?o:document,a=Array.isArray(e)?r?W(e):e:U(e);n=n??l.activeElement;let s=(()=>{if(t&5)return 1;if(t&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),u=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,a.indexOf(n))-1;if(t&4)return Math.max(0,a.indexOf(n))+1;if(t&8)return a.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),p=t&32?{preventScroll:!0}:{},c=0,f=a.length,i;do{if(c>=f||c+f<=0)return 0;let d=u+c;if(t&16)d=(d+f)%f;else{if(d<0)return 3;if(d>=f)return 1}i=a[d],i==null||i.focus(p),c+=s}while(i!==l.activeElement);return t&6&&C(i)&&i.select(),i.hasAttribute("tabindex")||i.setAttribute("tabindex","0"),2}var _=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(_||{});let z=O({name:"Hidden",props:{as:{type:[Object,String],default:"div"},features:{type:Number,default:1}},setup(e,{slots:t,attrs:r}){return()=>{let{features:n,...o}=e,l={"aria-hidden":(n&2)===2?!0:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(n&4)===4&&(n&2)!==2&&{display:"none"}}};return N({ourProps:l,theirProps:o,slot:{},attrs:r,slots:t,name:"Hidden"})}}});function J(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}export{R as F,H as M,L as N,P as O,N as P,E as R,_ as a,Y as b,B as c,$ as d,k as e,z as f,A as g,G as h,T as m,D as o,J as t,w as u,V as w};
