var M=Object.defineProperty;var y=a=>{throw TypeError(a)};var R=(a,e,t)=>e in a?M(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t;var A=(a,e,t)=>R(a,typeof e!="symbol"?e+"":e,t),T=(a,e,t)=>e.has(a)||y("Cannot "+t);var s=(a,e,t)=>(T(a,e,"read from private field"),t?t.call(a):e.get(a)),u=(a,e,t)=>e.has(a)?y("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(a):e.set(a,t),w=(a,e,t,i)=>(T(a,e,"write to private field"),i?i.call(a,t):e.set(a,t),t);import{x as E,V as S,W as k,X as N,Y as x,Z as D,D as g,_ as B,a0 as C,a1 as Y,a2 as H,a3 as I,a4 as L,a5 as O,a6 as P,a7 as V,a8 as W,a9 as F}from"./s1dcSIVc.js";var d,l,c,_,v,m,b;class X{constructor(e,t=!0){A(this,"anchor");u(this,d,new Map);u(this,l,new Map);u(this,c,new Map);u(this,_,new Set);u(this,v,!0);u(this,m,()=>{var e=E;if(s(this,d).has(e)){var t=s(this,d).get(e),i=s(this,l).get(t);if(i)S(i),s(this,_).delete(t);else{var n=s(this,c).get(t);n&&(s(this,l).set(t,n.effect),s(this,c).delete(t),n.fragment.lastChild.remove(),this.anchor.before(n.fragment),i=n.effect)}for(const[f,r]of s(this,d)){if(s(this,d).delete(f),f===e)break;const h=s(this,c).get(r);h&&(k(h.effect),s(this,c).delete(r))}for(const[f,r]of s(this,l)){if(f===t||s(this,_).has(f))continue;const h=()=>{if(Array.from(s(this,d).values()).includes(f)){var p=document.createDocumentFragment();C(r,p),p.append(x()),s(this,c).set(f,{effect:r,fragment:p})}else k(r);s(this,_).delete(f),s(this,l).delete(f)};s(this,v)||!i?(s(this,_).add(f),N(r,h,!1)):h()}}});u(this,b,e=>{s(this,d).delete(e);const t=Array.from(s(this,d).values());for(const[i,n]of s(this,c))t.includes(i)||(k(n.effect),s(this,c).delete(i))});this.anchor=e,w(this,v,t)}ensure(e,t){var i=E,n=Y();if(t&&!s(this,l).has(e)&&!s(this,c).has(e))if(n){var f=document.createDocumentFragment(),r=x();f.append(r),s(this,c).set(e,{effect:D(()=>t(r)),fragment:f})}else s(this,l).set(e,D(()=>t(this.anchor)));if(s(this,d).set(i,e),n){for(const[h,o]of s(this,l))h===e?i.skipped_effects.delete(o):i.skipped_effects.add(o);for(const[h,o]of s(this,c))h===e?i.skipped_effects.delete(o.effect):i.skipped_effects.add(o.effect);i.oncommit(s(this,m)),i.ondiscard(s(this,b))}else g&&(this.anchor=B),s(this,m).call(this)}}d=new WeakMap,l=new WeakMap,c=new WeakMap,_=new WeakMap,v=new WeakMap,m=new WeakMap,b=new WeakMap;function q(a,e,t=!1){g&&I();var i=new X(a),n=t?L:0;function f(r,h){if(g){const p=O(a)===P;if(r===p){var o=V();W(o),i.anchor=o,F(!1),i.ensure(r,h),F(!0);return}}i.ensure(r,h)}H(()=>{var r=!1;e((h,o=!0)=>{r=!0,f(o,h)}),r||f(!1,null)},n)}export{X as B,q as i};
