import{L as b,w as I,M as Y,v as u,N as T,H as A,O as N,C as _,B as p,I as f,P as H,Q as R,R as E,x as F,T as V,V as $,W as j,X as k,Y as P,Z as S,F as W,p as B,_ as Q,$ as X,a as Z}from"./CwuLZfOX.js";import{b as q,g as D,h as v,i as z,j as G}from"./8V7BUHOp.js";let n;function J(){n=void 0}function ee(a){let e=null,t=u;var o;if(u){for(e=f,n===void 0&&(n=H(document.head));n!==null&&(n.nodeType!==T||n.data!==A);)n=N(n);n===null?_(!1):n=p(N(n))}u||(o=document.head.appendChild(b()));try{I(()=>a(o),Y)}finally{t&&(_(!0),n=f,p(e))}}function ae(a,e){var t=e==null?"":typeof e=="object"?e+"":e;t!==(a.__t??(a.__t=a.nodeValue))&&(a.__t=t,a.nodeValue=t+"")}function K(a,e){return L(a,e)}function te(a,e){R(),e.intro=e.intro??!1;const t=e.target,o=u,y=f;try{for(var r=H(t);r&&(r.nodeType!==T||r.data!==A);)r=N(r);if(!r)throw E;_(!0),p(r),F();const h=L(a,{...e,anchor:r});if(f===null||f.nodeType!==T||f.data!==V)throw $(),E;return _(!1),h}catch(h){if(h===E)return e.recover===!1&&j(),R(),k(t),_(!1),K(a,e);throw h}finally{_(o),p(y),J()}}const l=new Map;function L(a,{target:e,anchor:t,props:o={},events:y,context:r,intro:h=!0}){R();var g=new Set,m=i=>{for(var s=0;s<i.length;s++){var d=i[s];if(!g.has(d)){g.add(d);var c=z(d);e.addEventListener(d,v,{passive:c});var C=l.get(d);C===void 0?(document.addEventListener(d,v,{passive:c}),l.set(d,1)):l.set(d,C+1)}}};m(P(q)),D.add(m);var w=void 0,M=S(()=>{var i=t??e.appendChild(b());return W(()=>{if(r){B({});var s=Q;s.c=r}y&&(o.$$events=y),u&&G(i,null),w=a(i,o)||{},u&&(X.nodes_end=f),r&&Z()}),()=>{var c;for(var s of g){e.removeEventListener(s,v);var d=l.get(s);--d===0?(document.removeEventListener(s,v),l.delete(s)):l.set(s,d)}D.delete(m),i!==t&&((c=i.parentNode)==null||c.removeChild(i))}});return O.set(w,M),w}let O=new WeakMap;function re(a,e){const t=O.get(a);return t?(O.delete(a),t(e)):Promise.resolve()}export{ee as a,te as h,K as m,ae as s,re as u};
