1import{ag as T,s as f,v as y,A as g,O,f as w,d as U,U as S,a0 as C,a6 as P}from"./app-BqWDJPtg.js";import{i as b,x}from"./Primitive-BLdXoIuz.js";import{f as _,u as $}from"./useForwardExpose-DZBYVw5m.js";function B(a,e="reka"){return`${e}-${T?.()}`}function D(a,e){const s=f(a);function l(r){return e[s.value][r]??s.value}return{state:s,dispatch:r=>{s.value=l(r)}}}function F(a,e){const s=f({}),l=f("none"),v=f(a),r=a.value?"mounted":"unmounted";let u;const c=e.value?.ownerDocument.defaultView??_,{state:m,dispatch:i}=D(r,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}}),n=t=>{if(b){const o=new CustomEvent(t,{bubbles:!1,cancelable:!1});e.value?.dispatchEvent(o)}};y(a,async(t,o)=>{const h=o!==t;if(await g(),h){const A=l.value,d=N(e.value);t?(i("MOUNT"),n("enter"),d==="none"&&n("after-enter")):d==="none"||d==="undefined"||s.value?.display==="none"?(i("UNMOUNT"),n("leave"),n("after-leave")):o&&A!==d?(i("ANIMATION_OUT"),n("leave")):(i("UNMOUNT"),n("after-leave"))}},{immediate:!0});const p=t=>{const o=N(e.value),h=o.includes(t.animationName),A=m.value==="mounted"?"enter":"leave";if(t.target===e.value&&h&&(n(`after-${A}`),i("ANIMATION_END"),!v.value)){const d=e.value.style.animationFillMode;e.value.style.animationFillMode="forwards",u=c?.setTimeout(()=>{e.value?.style.animationFillMode==="forwards"&&(e.value.style.animationFillMode=d)})}t.target===e.value&&o==="none"&&i("ANIMATION_END")},M=t=>{t.target===e.value&&(l.value=N(e.value))},E=y(e,(t,o)=>{t?(s.value=getComputedStyle(t),t.addEventListener("animationstart",M),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p)):(i("ANIMATION_END"),u!==void 0&&c?.clearTimeout(u),o?.removeEventListener("animationstart",M),o?.removeEventListener("animationcancel",p),o?.removeEventListener("animationend",p))},{immediate:!0}),I=y(m,()=>{const t=N(e.value);l.value=m.value==="mounted"?t:"none"});return O(()=>{E(),I()}),{isPresent:w(()=>["mounted","unmountSuspended"].includes(m.value))}}function N(a){return a&&getComputedStyle(a).animationName||"none"}var V=U({name:"Presence",props:{present:{type:Boolean,required:!0},forceMount:{type:Boolean}},slots:{},setup(a,{slots:e,expose:s}){const{present:l,forceMount:v}=S(a),r=f(),{isPresent:u}=F(l,r);s({present:u});let c=e.default({present:u.value});c=x(c||[]);const m=C();if(c&&c?.length>1){const i=m?.parent?.type.name?`<${m.parent.type.name} />`:"component";throw new Error([`Detected an invalid children for \`${i}\` for \`Presence\` component.`,"","Note: Presence works similarly to `v-if` directly, but it waits for animation/transition to finished before unmounting. So it expect only one direct child of valid VNode type.","You can apply a few solutions:",["Provide a single child element so that `presence` directive attach correctly.","Ensure the first child is an actual element instead of a raw text node or comment node."].map(n=>` - ${n}`).join(` 2`)].join(` 3`))}return()=>v.value||l.value||u.value?P(e.default({present:u.value})[0],{ref:i=>{const n=$(i);return typeof n?.hasAttribute>"u"||(n?.hasAttribute("data-reka-popper-content-wrapper")?r.value=n.firstElementChild:r.value=n),n}}):null}});export{V as P,B as u};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.