import{W as Y,X as fe,Y as ne,B as M,C as B,D as ie,E as le,l as P,Z as ue,_ as se,a0 as Q,a1 as q,I as L,J as oe,a2 as de,a3 as $,x as ve,a4 as C,a5 as X,a6 as te,a7 as ce,a8 as pe,a9 as ge,aa as he,ab as _e,ac as j,ad as Ee,ae as me,af as re,ag as ae,ah as V,ai as Te,aj as Ce,ak as we,al as Ae,am as Se,an as Ie,ao as K,R as Ne,K as xe}from"./CiQWViEs.js";function be(e,r){return r}function De(e,r,u){for(var s=[],c=r.length,l,i=r.length,p=0;p<c;p++){let E=r[p];ae(E,()=>{if(l){if(l.pending.delete(E),l.done.add(E),l.pending.size===0){var d=e.outrogroups;J(e,K(l.done)),d.delete(l),d.size===0&&(e.outrogroups=null)}}else i-=1},!1)}if(i===0){var f=s.length===0&&u!==null;if(f){var t=u,a=t.parentNode;Ae(a),a.append(t),e.items.clear()}J(e,r,!f)}else l={pending:new Set(r),done:new Set},(e.outrogroups??(e.outrogroups=new Set)).add(l)}function J(e,r,u=!0){var s;if(e.pending.size>0){s=new Set;for(const i of e.pending.values())for(const p of i)s.add(e.items.get(p).e)}for(var c=0;c<r.length;c++){var l=r[c];if(s!=null&&s.has(l)){l.f|=C;const i=document.createDocumentFragment();Se(l,i)}else Ie(r[c],u)}}var ee;function He(e,r,u,s,c,l=null){var i=e,p=new Map,f=(r&ne)!==0;if(f){var t=e;i=M?B(ie(t)):t.appendChild(Y())}M&&le();var a=null,E=pe(()=>{var v=u();return Ne(v)?v:v==null?[]:K(v)}),d,m=new Map,T=!0;function x(v){(A.effect.f&me)===0&&(A.pending.delete(v),A.fallback=a,Re(A,d,i,r,s),a!==null&&(d.length===0?(a.f&C)===0?re(a):(a.f^=C,H(a,null,i)):ae(a,()=>{a=null})))}function n(v){A.pending.delete(v)}var o=fe(()=>{d=P(E);var v=d.length;let h=!1;if(M){var O=ue(i)===se;O!==(v===0)&&(i=Q(),B(i),q(!1),h=!0)}for(var S=new Set,g=ve,R=ce(),I=0;I<v;I+=1){M&&L.nodeType===oe&&L.data===de&&(i=L,h=!0,q(!1));var k=d[I],D=s(k,I),_=T?null:p.get(D);_?(_.v&&$(_.v,k),_.i&&$(_.i,I),R&&g.unskip_effect(_.e)):(_=ke(p,T?i:ee??(ee=Y()),k,D,I,c,r,u),T||(_.e.f|=C),p.set(D,_)),S.add(D)}if(v===0&&l&&!a&&(T?a=X(()=>l(i)):(a=X(()=>l(ee??(ee=Y()))),a.f|=C)),v>S.size&&te(),M&&v>0&&B(Q()),!T)if(m.set(g,S),R){for(const[F,z]of p)S.has(F)||g.skip_effect(z.e);g.oncommit(x),g.ondiscard(n)}else x(g);h&&q(!0),P(E)}),A={effect:o,items:p,pending:m,outrogroups:null,fallback:a};T=!1,M&&(i=L)}function b(e){for(;e!==null&&(e.f&Ce)===0;)e=e.next;return e}function Re(e,r,u,s,c){var k,D,_,F,z,U,W,Z,y;var l=(s&we)!==0,i=r.length,p=e.items,f=b(e.effect.first),t,a=null,E,d=[],m=[],T,x,n,o;if(l)for(o=0;o<i;o+=1)T=r[o],x=c(T,o),n=p.get(x).e,(n.f&C)===0&&((D=(k=n.nodes)==null?void 0:k.a)==null||D.measure(),(E??(E=new Set)).add(n));for(o=0;o<i;o+=1){if(T=r[o],x=c(T,o),n=p.get(x).e,e.outrogroups!==null)for(const w of e.outrogroups)w.pending.delete(n),w.done.delete(n);if((n.f&V)!==0&&(re(n),l&&((F=(_=n.nodes)==null?void 0:_.a)==null||F.unfix(),(E??(E=new Set)).delete(n))),(n.f&C)!==0)if(n.f^=C,n===f)H(n,null,u);else{var A=a?a.next:f;n===e.effect.last&&(e.effect.last=n.prev),n.prev&&(n.prev.next=n.next),n.next&&(n.next.prev=n.prev),N(e,a,n),N(e,n,A),H(n,A,u),a=n,d=[],m=[],f=b(a.next);continue}if(n!==f){if(t!==void 0&&t.has(n)){if(d.length<m.length){var v=m[0],h;a=v.prev;var O=d[0],S=d[d.length-1];for(h=0;h<d.length;h+=1)H(d[h],v,u);for(h=0;h<m.length;h+=1)t.delete(m[h]);N(e,O.prev,S.next),N(e,a,O),N(e,S,v),f=v,a=S,o-=1,d=[],m=[]}else t.delete(n),H(n,f,u),N(e,n.prev,n.next),N(e,n,a===null?e.effect.first:a.next),N(e,a,n),a=n;continue}for(d=[],m=[];f!==null&&f!==n;)(t??(t=new Set)).add(f),m.push(f),f=b(f.next);if(f===null)continue}(n.f&C)===0&&d.push(n),a=n,f=b(n.next)}if(e.outrogroups!==null){for(const w of e.outrogroups)w.pending.size===0&&(J(e,K(w.done)),(z=e.outrogroups)==null||z.delete(w));e.outrogroups.size===0&&(e.outrogroups=null)}if(f!==null||t!==void 0){var g=[];if(t!==void 0)for(n of t)(n.f&V)===0&&g.push(n);for(;f!==null;)(f.f&V)===0&&f!==e.fallback&&g.push(f),f=b(f.next);var R=g.length;if(R>0){var I=(s&ne)!==0&&i===0?u:null;if(l){for(o=0;o<R;o+=1)(W=(U=g[o].nodes)==null?void 0:U.a)==null||W.measure();for(o=0;o<R;o+=1)(y=(Z=g[o].nodes)==null?void 0:Z.a)==null||y.fix()}De(e,g,I)}}l&&Te(()=>{var w,G;if(E!==void 0)for(n of E)(G=(w=n.nodes)==null?void 0:w.a)==null||G.apply()})}function ke(e,r,u,s,c,l,i,p){var f=(i&ge)!==0?(i&he)===0?_e(u,!1,!1):j(u):null,t=(i&Ee)!==0?j(c):null;return{v:f,i:t,e:X(()=>(l(r,f??u,t??c,p),()=>{e.delete(s)}))}}function H(e,r,u){if(e.nodes)for(var s=e.nodes.start,c=e.nodes.end,l=r&&(r.f&C)===0?r.nodes.start:u;s!==null;){var i=xe(s);if(l.before(s),s===c)return;s=i}}function N(e,r,u){r===null?e.effect.first=u:r.next=u,u===null?e.effect.last=r:u.prev=r}export{He as e,be as i};
