import{q as C,r as R,t as A,v as H,w as M,x as I,y as b,i as P,a as Y,g as j,z as T,s as g,d as D,A as q,f as p,B,C as $,D as z,F,G,I as J,c as K,j as W,J as Q,h as E,K as U,m as X}from"./w9TiaPO3.js";import{r as Z}from"./CEUsAAFn.js";import{b as x}from"./Zxz7OfLJ.js";const rr=["touchstart","touchmove"];function er(r){return rr.includes(r)}const tr=new Set,O=new Set;function m(r){var N;var e=this,s=e.ownerDocument,c=r.type,o=((N=r.composedPath)==null?void 0:N.call(r))||[],t=o[0]||r.target,d=0,_=r.__root;if(_){var u=o.indexOf(_);if(u!==-1&&(e===document||e===window)){r.__root=e;return}var h=o.indexOf(e);if(h===-1)return;u<=h&&(d=u)}if(t=o[d]||r.target,t!==e){C(r,"currentTarget",{configurable:!0,get(){return t||s}});var w=M,i=I;R(null),A(null);try{for(var a,n=[];t!==null;){var f=t.assignedSlot||t.parentNode||t.host||null;try{var l=t["__"+c];if(l!==void 0&&!t.disabled)if(H(l)){var[V,...k]=l;V.apply(t,[r,...k])}else l.call(t,r)}catch(y){a?n.push(y):a=y}if(r.cancelBubble||f===e||f===null)break;t=f}if(a){for(let y of n)queueMicrotask(()=>{throw y});throw a}}finally{r.__root=e,delete r.currentTarget,R(w),A(i)}}}function or(r,e){var s=e==null?"":typeof e=="object"?e+"":e;s!==(r.__t??(r.__t=r.nodeValue))&&(r.__t=s,r.nodeValue=s==null?"":s+"")}function ar(r,e){return L(r,e)}function fr(r,e){b(),e.intro=e.intro??!1;const s=e.target,c=E,o=p;try{for(var t=P(s);t&&(t.nodeType!==8||t.data!==Y);)t=j(t);if(!t)throw T;g(!0),D(t),q();const d=L(r,{...e,anchor:t});if(p===null||p.nodeType!==8||p.data!==B)throw $(),T;return g(!1),d}catch(d){if(d===T)return e.recover===!1&&z(),b(),F(s),g(!1),ar(r,e);throw d}finally{g(c),D(o),Z()}}const v=new Map;function L(r,{target:e,anchor:s,props:c={},events:o,context:t,intro:d=!0}){b();var _=new Set,u=i=>{for(var a=0;a<i.length;a++){var n=i[a];if(!_.has(n)){_.add(n);var f=er(n);e.addEventListener(n,m,{passive:f});var l=v.get(n);l===void 0?(document.addEventListener(n,m,{passive:f}),v.set(n,1)):v.set(n,l+1)}}};u(G(tr)),O.add(u);var h=void 0,w=J(()=>{var i=s??e.appendChild(K());return W(()=>{if(t){Q({});var a=X;a.c=t}o&&(c.$$events=o),E&&x(i,null),h=r(i,c)||{},E&&(I.nodes_end=p),t&&U()}),()=>{var f;for(var a of _){e.removeEventListener(a,m);var n=v.get(a);--n===0?(document.removeEventListener(a,m),v.delete(a)):v.set(a,n)}O.delete(u),i!==s&&((f=i.parentNode)==null||f.removeChild(i))}});return S.set(h,w),h}let S=new WeakMap;function dr(r,e){const s=S.get(r);return s?(S.delete(r),s(e)):Promise.resolve()}export{fr as h,ar as m,or as s,dr as u};
