import{f as E,h as p,g as T,E as l,i as S,j as b,k as g,l as u,e as k,n as v,o as w,q as y,u as _,t as x,D as A,S as B}from"./CAC3fBSS.js";import{B as N}from"./DZ_RyJea.js";function F(r,t,i=!1){var h;p&&(h=k,T());var e=new N(r),d=i?l:0;function n(a,s){if(p){var c=S(h);if(a!==parseInt(c.substring(1))){var f=b();g(f),e.anchor=f,u(!1),e.ensure(a,s),u(!0);return}}e.ensure(a,s)}E(()=>{var a=!1;t((s,c=0)=>{a=!0,n(c,s)}),a||n(-1,null)},d)}function o(r,t){return r===t||(r==null?void 0:r[B])===t}function I(r={},t,i,h){var e=v.r,d=x;return w(()=>{var n,a;return y(()=>{n=a,a=[],_(()=>{r!==i(...a)&&(t(r,...a),n&&o(i(...n),r)&&t(null,...n))})}),()=>{let s=d;for(;s!==e&&s.parent!==null&&s.parent.f&A;)s=s.parent;const c=()=>{a&&o(i(...a),r)&&t(null,...a)},f=s.teardown;s.teardown=()=>{c(),f==null||f()}}}),r}export{I as b,F as i};
