var m=t=>{throw TypeError(t)};var p=(t,e,n)=>e.has(t)||m("Cannot "+n);var o=(t,e,n)=>(p(t,e,"read from private field"),n?n.call(t):e.get(t)),l=(t,e,n)=>e.has(t)?m("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),d=(t,e,n,r)=>(p(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n);import{av as y,g as A,ak as g,G as E,H as b,al as h,I as q,aq as F,d as I}from"./D0ctIA8a.js";import{a as w}from"./C2LhSlbT.js";function R(t){let e=0,n=g(0),r;return()=>{y()&&(A(n),E(()=>(e===0&&(r=b(()=>t(()=>h(n)))),e+=1,()=>{q(()=>{e-=1,e===0&&(r==null||r(),r=void 0,h(n))})})))}}const W=typeof window<"u"?window:void 0;function x(t){let e=t.activeElement;for(;e!=null&&e.shadowRoot;){const n=e.shadowRoot.activeElement;if(n===e)break;e=n}return e}var s,u;class z{constructor(e={}){l(this,s);l(this,u);const{window:n=W,document:r=n==null?void 0:n.document}=e;n!==void 0&&(d(this,s,r),d(this,u,R(a=>{const i=w(n,"focusin",a),c=w(n,"focusout",a);return()=>{i(),c()}})))}get current(){var e;return(e=o(this,u))==null||e.call(this),o(this,s)?x(o(this,s)):null}}s=new WeakMap,u=new WeakMap;new z;function G(t,e){switch(t){case"post":I(e);break;case"pre":F(e);break}}function v(t,e,n,r={}){const{lazy:a=!1}=r;let i=!a,c=Array.isArray(t)?[]:void 0;G(e,()=>{const f=Array.isArray(t)?t.map(_=>_()):t();if(!i){i=!0,c=f;return}const k=b(()=>n(f,c));return c=f,k})}function H(t,e,n){v(t,"post",e,n)}function O(t,e,n){v(t,"pre",e,n)}H.pre=O;export{H as w};