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