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