import{H as e,l as t,ot as n,s as r,st as i,ut as a}from"./branding-ClCX8iZg.js";var o=a(i()),s=[];function c(e){o.useEffect(e,s)}var l=null;globalThis.requestAnimationFrame;var u=new class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;let t=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let n=0;n<t.length;n+=1)t[n]?.(e)};request(e){let t=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,this.isScheduled||=(requestAnimationFrame(this.tick),!0),t}cancel(e){let t=e-this.startId;t<0||t>=this.callbacks.length||(this.callbacks[t]=null,--this.callbacksCount)}},d=class e{static create(){return new e}static request(e){return u.request(e)}static cancel(e){return u.cancel(e)}currentId=l;request(e){this.cancel(),this.currentId=u.request(()=>{this.currentId=l,e()})}cancel=()=>{this.currentId!==l&&(u.cancel(this.currentId),this.currentId=l)};disposeEffect=()=>this.cancel};function f(){let t=e(d.create).current;return c(t.disposeEffect),t}function p(e){return e==null?e:`current`in e?e.current:e}var m=function(e){return e.startingStyle=`data-starting-style`,e.endingStyle=`data-ending-style`,e}({}),h={[m.startingStyle]:``},g={[m.endingStyle]:``},_={transitionStatus(e){return e===`starting`?h:e===`ending`?g:null}},v=a(n());function y(e,n=!1,r=!0){let i=f();return t((t,a=null)=>{i.cancel();function o(){v.flushSync(t)}let s=p(e);if(s==null)return;let c=s;if(typeof c.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED)t();else{function e(){let e=m.startingStyle;if(!c.hasAttribute(e)){i.request(t);return}let n=new MutationObserver(()=>{c.hasAttribute(e)||(n.disconnect(),t())});n.observe(c,{attributes:!0,attributeFilter:[e]}),a?.addEventListener(`abort`,()=>n.disconnect(),{once:!0})}function t(){Promise.all(c.getAnimations().map(e=>e.finished)).then(()=>{a?.aborted||o()}).catch(()=>{let e=c.getAnimations();if(r){if(a?.aborted)return;o()}else e.length>0&&e.some(e=>e.pending||e.playState!==`finished`)&&t()})}if(n){e();return}i.request(t)}})}function b(e){let{enabled:n=!0,open:r,ref:i,onComplete:a}=e,s=t(a),c=y(i,r,!1);o.useEffect(()=>{if(!n)return;let e=new AbortController;return c(s,e.signal),()=>{e.abort()}},[n,r,s,c])}function x(e,t=!1,n=!1){let[i,a]=o.useState(e&&t?`idle`:void 0),[s,c]=o.useState(e);return e&&!s&&(c(!0),a(`starting`)),!e&&s&&i!==`ending`&&!n&&a(`ending`),!e&&!s&&i===`ending`&&a(void 0),r(()=>{if(!e&&s&&i!==`ending`&&n){let e=d.request(()=>{a(`ending`)});return()=>{d.cancel(e)}}},[e,s,i,n]),r(()=>{if(!e||t)return;let n=d.request(()=>{a(void 0)});return()=>{d.cancel(n)}},[t,e]),r(()=>{if(!e||!t)return;e&&s&&i!==`idle`&&a(`starting`);let n=d.request(()=>{a(`idle`)});return()=>{d.cancel(n)}},[t,e,s,a,i]),o.useMemo(()=>({mounted:s,setMounted:c,transitionStatus:i}),[s,i])}var S={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},C={...S,position:`fixed`,top:0,left:0},w={...S,position:`absolute`};export{y as a,p as c,c as d,b as i,d as l,w as n,m as o,x as r,_ as s,C as t,f as u};